diff --git a/.circleci/config.yml b/.circleci/config.yml index ee3bc7769..35cf66ca0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,37 +2,32 @@ # See: https://circleci.com/docs/2.0/configuration-reference version: 2.1 -# Define a job to be invoked later in a workflow. -# See: https://circleci.com/docs/2.0/configuration-reference/#jobs +orbs: + aws-ecr: circleci/aws-ecr@8.2.1 + go: circleci/go@1.7.3 + + jobs: - build: - # Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub. - # See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor + build-test: machine: image: ubuntu-2204:2022.10.1 - resource_class: large - # Add steps to the job - # See: https://circleci.com/docs/2.0/configuration-reference/#steps + resource_class: large steps: + - go/install: + version: "1.20" - checkout - run: name: Print Go environment command: "go env" - - restore_cache: # restores saved cache if no changes are detected since last run - keys: - - go-mod-v6-{{ checksum "go.sum" }} + - go/load-cache: + key: go-mod-v6-{{ checksum "go.sum" }} + - go/mod-download + - go/save-cache: + key: go-mod-v6-{{ checksum "go.sum" }} + path: "/home/circleci/.go_workspace/pkg/mod" - run: name: Build babylond command: make build - - save_cache: - key: go-mod-v6-{{ checksum "go.sum" }} - paths: - - "/home/circleci/.go_workspace/pkg/mod" - - run: - name: Lint - command: | - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.50.1 - ./bin/golangci-lint run - run: name: Run tests command: | @@ -40,20 +35,95 @@ jobs: - run: # sudo is needed, so that integration test binary have proper access to nodes keyring name: Run integration tests command: | - make localnet-start-test - sudo -E env "PATH=$PATH" make test-babylon-integration - make localnet-stop + sudo -E env "PATH=$PATH" make localnet-test-integration # TODO: If CI tests will take to long consider having only this e2e test # instead of separate integration tests and e2e tests. - run: name: Run e2e tests command: | - make test-e2e + make test-e2e + lint: + machine: + image: ubuntu-2204:2022.10.1 + resource_class: large + steps: + - go/install: + version: "1.20" + - checkout + - run: + name: Lint proto files + command: make proto-lint + - run: + name: Lint + command: | + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2 + ./bin/golangci-lint run + + build_docker: + machine: + image: ubuntu-2204:2022.10.1 + resource_class: large + steps: + - checkout + - aws-ecr/build-image: + push-image: false + dockerfile: Dockerfile + path: ./contrib/images/babylond/ + build-path: ./ + tag: "$CIRCLE_SHA1,$CIRCLE_TAG" + repo: "babylond" + - run: + name: Save Docker image to export it to workspace + command: | + docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}') > /tmp/babylond.tar + - persist_to_workspace: + root: /tmp + paths: + - babylond.tar + push_docker: + machine: + image: ubuntu-2204:2022.10.1 + resource_class: large + steps: + - attach_workspace: + at: /tmp + - run: + name: Load Docker image from workspace + command: | + docker load -i /tmp/babylond.tar + - aws-ecr/ecr-login: + aws-access-key-id: AWS_ACCESS_KEY_ID + aws-secret-access-key: AWS_SECRET_ACCESS_KEY + region: "$AWS_REGION" + - aws-ecr/push-image: + registry-id: AWS_ECR_REGISTRY_ID + region: "$AWS_REGION" + repo: "babylond" + tag: "$CIRCLE_SHA1,$CIRCLE_TAG" # Invoke jobs via workflows # See: https://circleci.com/docs/2.0/configuration-reference/#workflows workflows: - build-lint-test: + version: 2 + build-test: + jobs: + - build-test + lint: + jobs: + - lint + docker: jobs: - - build + - build_docker: + filters: + tags: + only: /.*/ + - push_docker: + requires: + - build_docker + filters: + tags: + only: /.*/ + branches: + only: + - main diff --git a/.gitignore b/.gitignore index 607e987fd..cf18c804e 100644 --- a/.gitignore +++ b/.gitignore @@ -194,6 +194,9 @@ $RECYCLE.BIN/ # Windows shortcuts *.lnk +# Build artifacts for wasm contracts used in tests +wasmbinding/testdata/target + # End of https://www.toptal.com/developers/gitignore/api/intellij,vscode,macos,windows # The following content is adapted from https://github.com/osmosis-labs/osmosis/blob/main/.gitignore @@ -211,4 +214,4 @@ docs/diagrams/plantuml.jar .testnets/ .testnet/ mytestnet/ -output/ \ No newline at end of file +output/ diff --git a/Makefile b/Makefile index 123435446..272a682c1 100644 --- a/Makefile +++ b/Makefile @@ -8,12 +8,17 @@ BINDIR ?= $(GOPATH)/bin BUILDDIR ?= $(CURDIR)/build HTTPS_GIT := https://github.com/babylonchain/babylon.git DOCKER := $(shell which docker) -DOCKER_BUF := $(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace bufbuild/buf SIMAPP = ./simapp BRANCH := $(shell git rev-parse --abbrev-ref HEAD) COMMIT := $(shell git log -1 --format='%H') +CUR_DIR := $(shell pwd) + +WASM_DIR := $(CUR_DIR)/wasmbinding/testdata + +WASM_DIR_BASE_NAME := $(shell basename $(WASM_DIR)) + # don't override user values ifeq (,$(VERSION)) # Find a name that exactly describes the current commit (e.g. a version tag) @@ -61,7 +66,7 @@ ifeq (secp,$(findstring secp,$(BABYLON_BUILD_OPTIONS))) endif whitespace := -whitespace += $(whitespace) +whitespace := $(whitespace) $(whitespace) comma := , build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) @@ -93,6 +98,10 @@ ifeq (boltdb,$(findstring boltdb,$(BABYLON_BUILD_OPTIONS))) ldflags += -X github.com/cosmos/cosmos-sdk/types.DBBackend=boltdb endif +ifeq ($(LINK_STATICALLY),true) + ldflags += -linkmode=external -extldflags "-Wl,-z,muldefs -static" +endif + ifeq (,$(findstring nostrip,$(BABYLON_BUILD_OPTIONS))) ldflags += -w -s endif @@ -219,10 +228,13 @@ endif .PHONY: run-tests test test-all $(TEST_TARGETS) -test-babylon-integration: +test-integration: @echo "Running babylon integration test" @go test github.com/babylonchain/babylon/test -v -count=1 --tags=integration -p 1 +test-e2e: + go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1 --tags=e2e + test-sim-nondeterminism: @echo "Running non-determinism test..." @go test -mod=readonly $(SIMAPP) -run TestAppStateDeterminism -Enabled=true \ @@ -351,70 +363,82 @@ devdoc-update: ### Protobuf ### ############################################################################### -containerProtoVer=v0.7 -containerProtoImage=tendermintdev/sdk-proto-gen:$(containerProtoVer) -containerProtoGen=babylon-sdk-proto-gen-$(containerProtoVer) -containerProtoGenSwagger=cosmos-sdk-proto-gen-swagger-$(containerProtoVer) -containerProtoFmt=babylon-sdk-proto-fmt-$(containerProtoVer) +protoVer=0.12.0 +protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer) +protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName) proto-all: proto-gen proto-swagger-gen proto-gen: @echo "Generating Protobuf files" - @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then docker start -a $(containerProtoGen); else docker run --name $(containerProtoGen) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \ - sh ./proto/scripts/protocgen.sh; fi + @$(protoImage) sh ./proto/scripts/protocgen.sh proto-swagger-gen: @echo "Generating Protobuf Swagger" - @if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGenSwagger}$$"; then docker start -a $(containerProtoGenSwagger); else docker run --name $(containerProtoGenSwagger) -v $(CURDIR):/workspace --workdir /workspace $(containerProtoImage) \ - sh ./proto/scripts/protoc-swagger-gen.sh; fi + @$(protoImage) sh ./proto/scripts/protoc-swagger-gen.sh + +proto-format: + @$(protoImage) find ./ -name "*.proto" -exec clang-format -i {} \; + +proto-lint: + @$(protoImage) buf lint --error-format=json -.PHONY: proto-gen proto-swagger-gen +.PHONY: proto-gen proto-swagger-gen proto-format prot-lint ############################################################################### -### Localnet ### +### Docker ### ############################################################################### -localnet-build-env: - $(MAKE) -C contrib/images babylond-env +build-docker: + $(MAKE) -C contrib/images babylond -localnet-build-dlv: - $(MAKE) -C contrib/images babylond-dlv +.PHONY: build-docker -localnet-build-nodes-test: - $(DOCKER) run --rm -v $(CURDIR)/.testnets:/data babylonchain/babylond \ - testnet init-files --v 4 -o /data \ +############################################################################### +### Localnet ### +############################################################################### + +# init-testnet-dirs will create a ./.testnets directory containing configuration for 4 Babylon nodes +init-testnet-dirs: + # 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 babylonchain/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 - docker-compose up -d -localnet-build-nodes: - $(DOCKER) run --rm -v $(CURDIR)/.testnets:/data babylonchain/babylond \ - testnet init-files --v 4 -o /data \ - --starting-ip-address 192.168.10.2 --keyring-backend=test \ - --chain-id chain-test +# localnet-start-nodes will boot the nodes described in the docker-compose.yml file +localnet-start-nodes: init-testnet-dirs docker-compose up -d # localnet-start will run a with 4 nodes with 4 nodes, a bitcoin instance, and a vigilante instance -localnet-start: localnet-stop localnet-build-env localnet-build-nodes - -# localnet-start-test will start with 4 nodes with test confiuration and low -# epoch interval -localnet-start-test: localnet-stop localnet-build-env localnet-build-nodes-test - -# localnet-debug will run a 4-node testnet locally in debug mode -# you can read more about the debug mode here: ./contrib/images/babylond-dlv/README.md -localnet-debug: localnet-stop localnet-build-dlv localnet-build-nodes - -test-e2e: - go test -mod=readonly -timeout=25m -v $(PACKAGES_E2E) -count=1 --tags=e2e +localnet-start: localnet-stop build-docker localnet-start-nodes +# localnet-stop will stop all localnets running localnet-stop: docker-compose down -.PHONY: localnet-start localnet-stop localnet-debug localnet-build-env \ -localnet-build-dlv localnet-build-nodes +# localnet-test-integration will spin up a localnet and run integration tests on it +localnet-test-integration: localnet-start test-integration localnet-stop + +build-test-wasm: + 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 \ + --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-test-integration \ +localnet-stop .PHONY: diagrams diagrams: diff --git a/app/ante_btc_validation_decorator.go b/app/ante_btc_validation_decorator.go index 232cb17b8..109789023 100644 --- a/app/ante_btc_validation_decorator.go +++ b/app/ante_btc_validation_decorator.go @@ -2,18 +2,24 @@ package app import ( bbn "github.com/babylonchain/babylon/types" + btccheckpointkeeper "github.com/babylonchain/babylon/x/btccheckpoint/keeper" btccheckpointtypes "github.com/babylonchain/babylon/x/btccheckpoint/types" btclightclient "github.com/babylonchain/babylon/x/btclightclient/types" sdk "github.com/cosmos/cosmos-sdk/types" ) type BtcValidationDecorator struct { - BtcCfg bbn.BtcConfig + BtcCfg bbn.BtcConfig + btccheckpointKeeper *btccheckpointkeeper.Keeper } -func NewBtcValidationDecorator(cfg bbn.BtcConfig) BtcValidationDecorator { +func NewBtcValidationDecorator( + cfg bbn.BtcConfig, + k *btccheckpointkeeper.Keeper, +) BtcValidationDecorator { return BtcValidationDecorator{ - BtcCfg: cfg, + BtcCfg: cfg, + btccheckpointKeeper: k, } } @@ -26,7 +32,7 @@ func (bvd BtcValidationDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulat switch msg := m.(type) { case *btccheckpointtypes.MsgInsertBTCSpvProof: powLimit := bvd.BtcCfg.PowLimit() - _, err := btccheckpointtypes.ParseSubmission(msg, &powLimit, bvd.BtcCfg.CheckpointTag()) + _, err := btccheckpointtypes.ParseSubmission(msg, &powLimit, bvd.btccheckpointKeeper.GetExpectedTag(ctx)) if err != nil { return ctx, btccheckpointtypes.ErrInvalidCheckpointProof.Wrap(err.Error()) diff --git a/app/app.go b/app/app.go index 6790210f7..ddef2f6c4 100644 --- a/app/app.go +++ b/app/app.go @@ -4,22 +4,36 @@ import ( "encoding/json" "fmt" "io" - "net/http" "os" "path/filepath" + "strings" - nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" + wasmapp "github.com/CosmWasm/wasmd/app" + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + "github.com/babylonchain/babylon/client/docs" bbn "github.com/babylonchain/babylon/types" - "github.com/gorilla/mux" - "github.com/rakyll/statik/fs" + owasm "github.com/babylonchain/babylon/wasmbinding" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" + "github.com/cosmos/cosmos-sdk/x/consensus" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" + ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" + tmos "github.com/cometbft/cometbft/libs/os" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" "github.com/spf13/cast" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - tmos "github.com/tendermint/tendermint/libs/os" - dbm "github.com/tendermint/tm-db" - appparams "github.com/babylonchain/babylon/app/params" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" @@ -54,7 +68,6 @@ import ( crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" distr "github.com/cosmos/cosmos-sdk/x/distribution" - distrclient "github.com/cosmos/cosmos-sdk/x/distribution/client" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" "github.com/cosmos/cosmos-sdk/x/evidence" @@ -87,8 +100,7 @@ import ( upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" - // unnamed import of statik for swagger UI support - _ "github.com/cosmos/cosmos-sdk/client/docs/statik" + appparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/x/btccheckpoint" btccheckpointkeeper "github.com/babylonchain/babylon/x/btccheckpoint/keeper" @@ -107,21 +119,22 @@ import ( monitortypes "github.com/babylonchain/babylon/x/monitor/types" storetypes "github.com/cosmos/cosmos-sdk/store/types" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + extendedkeeper "github.com/babylonchain/babylon/x/zoneconcierge/extended-client-keeper" + "github.com/cosmos/ibc-go/v7/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v7/modules/core" + porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" // ibc module puts types under `ibchost` rather than `ibctypes` + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + // IBC-related "github.com/babylonchain/babylon/x/zoneconcierge" zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" zctypes "github.com/babylonchain/babylon/x/zoneconcierge/types" - transfer "github.com/cosmos/ibc-go/v5/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v5/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v5/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v5/modules/core" - ibcclientkeeper "github.com/cosmos/ibc-go/v5/modules/core/02-client/keeper" - porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types" - ibchost "github.com/cosmos/ibc-go/v5/modules/core/24-host" // ibc module puts types under `ibchost` rather than `ibctypes` - ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ) const ( @@ -131,27 +144,45 @@ const ( // From cosmos version 0.46 is is possible to have custom prefix for application // enviromental variables - https://github.com/cosmos/cosmos-sdk/pull/10950 BabylonAppEnvPrefix = "" + + // TODO review possible capabilities + // The last arguments can contain custom message handlers, and custom query handlers, + // if we want to allow any custom callbacks + // See https://github.com/CosmWasm/cosmwasm/blob/main/docs/CAPABILITIES-BUILT-IN.md + wasmCapabilities = "iterator,stargate,cosmwasm_1_1,cosmwasm_1_2,babylon" + + // According to https://github.com/CosmWasm/wasmd#genesis-configuration chains + // using smart contracts should configure proper gas limits per block. + // https://medium.com/cosmwasm/cosmwasm-for-ctos-iv-native-integrations-713140bf75fc + // suggests 50M as reasonable limits. Me may want to adjust it later. + DefaultGasLimit int64 = 50000000 ) var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - // ModuleBasics defines the module BasicManager is in charge of setting up basic, // non-dependant module elements, such as codec registration // and genesis verification. ModuleBasics = module.NewBasicManager( auth.AppModuleBasic{}, - genutil.AppModuleBasic{}, + genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), bank.AppModuleBasic{}, capability.AppModuleBasic{}, staking.AppModuleBasic{}, mint.AppModuleBasic{}, distr.AppModuleBasic{}, gov.NewAppModuleBasic( - []govclient.ProposalHandler{paramsclient.ProposalHandler, distrclient.ProposalHandler, upgradeclient.LegacyProposalHandler, upgradeclient.LegacyCancelProposalHandler}, + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + upgradeclient.LegacyProposalHandler, + upgradeclient.LegacyCancelProposalHandler, + ibcclientclient.UpdateClientProposalHandler, + ibcclientclient.UpgradeProposalHandler, + }, ), params.AppModuleBasic{}, + consensus.AppModuleBasic{}, crisis.AppModuleBasic{}, slashing.AppModuleBasic{}, feegrantmodule.AppModuleBasic{}, @@ -159,6 +190,7 @@ var ( evidence.AppModuleBasic{}, authzmodule.AppModuleBasic{}, vesting.AppModuleBasic{}, + wasm.AppModuleBasic{}, // Babylon modules epoching.AppModuleBasic{}, @@ -169,6 +201,7 @@ var ( // IBC-related ibc.AppModuleBasic{}, + ibctm.AppModuleBasic{}, transfer.AppModuleBasic{}, zoneconcierge.AppModuleBasic{}, ) @@ -187,6 +220,46 @@ var ( } ) +// Wasm related variables +var ( + // WasmProposalsEnabled enables all x/wasm proposals when its value is "true" + // and EnableSpecificWasmProposals is empty. Otherwise, all x/wasm proposals + // are disabled. + WasmProposalsEnabled = "true" + + // EnableSpecificWasmProposals, if set, must be comma-separated list of values + // that are all a subset of "EnableAllProposals", which takes precedence over + // WasmProposalsEnabled. + // + // See: https://github.com/CosmWasm/wasmd/blob/02a54d33ff2c064f3539ae12d75d027d9c665f05/x/wasm/internal/types/proposal.go#L28-L34 + EnableSpecificWasmProposals = "" + + // EmptyWasmOpts defines a type alias for a list of wasm options. + EmptyWasmOpts []wasm.Option +) + +// GetWasmEnabledProposals parses the WasmProposalsEnabled and +// EnableSpecificWasmProposals values to produce a list of enabled proposals to +// pass into the application. +func GetWasmEnabledProposals() []wasm.ProposalType { + if EnableSpecificWasmProposals == "" { + if WasmProposalsEnabled == "true" { + return wasm.EnableAllProposals + } + + return wasm.DisableAllProposals + } + + chunks := strings.Split(EnableSpecificWasmProposals, ",") + + proposals, err := wasm.ConvertToProposals(chunks) + if err != nil { + panic(err) + } + + return proposals +} + var ( _ App = (*BabylonApp)(nil) _ servertypes.Application = (*BabylonApp)(nil) @@ -197,8 +270,10 @@ var ( // capabilities aren't needed for testing. type BabylonApp struct { *baseapp.BaseApp - legacyAmino *codec.LegacyAmino - appCodec codec.Codec + legacyAmino *codec.LegacyAmino + appCodec codec.Codec + txConfig client.TxConfig + interfaceRegistry types.InterfaceRegistry invCheckPeriod uint @@ -209,20 +284,21 @@ type BabylonApp struct { memKeys map[string]*storetypes.MemoryStoreKey // keepers - AccountKeeper authkeeper.AccountKeeper - BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper - StakingKeeper stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper - DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper - CrisisKeeper crisiskeeper.Keeper - UpgradeKeeper upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - AuthzKeeper authzkeeper.Keeper - EvidenceKeeper evidencekeeper.Keeper - FeeGrantKeeper feegrantkeeper.Keeper + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper *crisiskeeper.Keeper + UpgradeKeeper *upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + AuthzKeeper authzkeeper.Keeper + EvidenceKeeper evidencekeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + ConsensusParamsKeeper consensusparamkeeper.Keeper // Babylon modules EpochingKeeper epochingkeeper.Keeper @@ -236,10 +312,12 @@ type BabylonApp struct { TransferKeeper ibctransferkeeper.Keeper // for cross-chain fungible token transfers ZoneConciergeKeeper zckeeper.Keeper // for cross-chain fungible token transfers + WasmKeeper wasm.Keeper // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper ScopedZoneConciergeKeeper capabilitykeeper.ScopedKeeper + ScopedWasmKeeper capabilitykeeper.ScopedKeeper // the module manager mm *module.Manager @@ -265,7 +343,10 @@ func init() { func NewBabylonApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, skipUpgradeHeights map[int64]bool, homePath string, invCheckPeriod uint, encodingConfig appparams.EncodingConfig, privSigner *PrivSigner, - appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), + appOpts servertypes.AppOptions, + wasmEnabledProposals []wasm.ProposalType, + wasmOpts []wasm.Option, + baseAppOptions ...func(*baseapp.BaseApp), ) *BabylonApp { // we could also take it from global object which should be initilised in rootCmd // but this way it makes babylon app more testable @@ -275,16 +356,17 @@ func NewBabylonApp( appCodec := encodingConfig.Marshaler legacyAmino := encodingConfig.Amino interfaceRegistry := encodingConfig.InterfaceRegistry - - bApp := baseapp.NewBaseApp(appName, logger, db, encodingConfig.TxConfig.TxDecoder(), baseAppOptions...) + txConfig := encodingConfig.TxConfig + bApp := baseapp.NewBaseApp(appName, logger, db, txConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) bApp.SetVersion(version.Version) bApp.SetInterfaceRegistry(interfaceRegistry) + bApp.SetTxEncoder(txConfig.TxEncoder()) keys := sdk.NewKVStoreKeys( - authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, + authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, - govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, + govtypes.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey, // Babylon modules @@ -294,11 +376,14 @@ func NewBabylonApp( checkpointingtypes.StoreKey, monitortypes.StoreKey, // IBC-related modules - ibchost.StoreKey, + ibcexported.StoreKey, ibctransfertypes.StoreKey, zctypes.StoreKey, + wasm.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) + + tkeys := sdk.NewTransientStoreKeys( + paramstypes.TStoreKey, btccheckpointtypes.TStoreKey) // NOTE: The testingkey is just mounted for testing purposes. Actual applications should // not include this key. memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey, "testingkey") @@ -307,6 +392,7 @@ func NewBabylonApp( BaseApp: bApp, legacyAmino: legacyAmino, appCodec: appCodec, + txConfig: txConfig, interfaceRegistry: interfaceRegistry, invCheckPeriod: invCheckPeriod, keys: keys, @@ -316,15 +402,16 @@ func NewBabylonApp( app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) - // set the BaseApp's parameter store - bApp.SetParamStore(app.ParamsKeeper.Subspace(baseapp.Paramspace).WithKeyTable(paramstypes.ConsensusParamsKeyTable())) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[consensusparamtypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + bApp.SetParamStore(&app.ConsensusParamsKeeper) app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey]) // grant capabilities for the ibc and ibc-transfer modules - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibchost.ModuleName) + scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) scopedZoneConciergeKeeper := app.CapabilityKeeper.ScopeToModule(zctypes.ModuleName) + scopedWasmKeeper := app.CapabilityKeeper.ScopeToModule(wasm.ModuleName) // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating // their scoped modules in `NewApp` with `ScopeToModule` @@ -333,48 +420,57 @@ func NewBabylonApp( // TODO: Grant capabilities for the ibc and ibc-transfer modules // add keepers - app.AccountKeeper = authkeeper.NewAccountKeeper( - appCodec, keys[authtypes.StoreKey], app.GetSubspace(authtypes.ModuleName), authtypes.ProtoBaseAccount, maccPerms, appparams.Bech32PrefixAccAddr, - ) + app.AccountKeeper = authkeeper.NewAccountKeeper(appCodec, keys[authtypes.StoreKey], authtypes.ProtoBaseAccount, maccPerms, appparams.Bech32PrefixAccAddr, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.BankKeeper = bankkeeper.NewBaseKeeper( - appCodec, keys[banktypes.StoreKey], app.AccountKeeper, app.GetSubspace(banktypes.ModuleName), app.ModuleAccountAddrs(), + appCodec, + keys[banktypes.StoreKey], + app.AccountKeeper, + BlockedAddresses(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - stakingKeeper := stakingkeeper.NewKeeper( - appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName), + + app.StakingKeeper = stakingkeeper.NewKeeper( + appCodec, keys[stakingtypes.StoreKey], app.AccountKeeper, app.BankKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // NOTE: the epoching module has to be set before the chekpointing module, as the checkpointing module will have access to the epoching module epochingKeeper := epochingkeeper.NewKeeper( - appCodec, keys[epochingtypes.StoreKey], keys[epochingtypes.StoreKey], app.GetSubspace(epochingtypes.ModuleName), &app.StakingKeeper, + appCodec, keys[epochingtypes.StoreKey], keys[epochingtypes.StoreKey], app.BankKeeper, app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - app.MintKeeper = mintkeeper.NewKeeper( - appCodec, keys[minttypes.StoreKey], app.GetSubspace(minttypes.ModuleName), &stakingKeeper, - app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, - ) - app.DistrKeeper = distrkeeper.NewKeeper( - appCodec, keys[distrtypes.StoreKey], app.GetSubspace(distrtypes.ModuleName), app.AccountKeeper, app.BankKeeper, - &stakingKeeper, authtypes.FeeCollectorName, - ) + app.MintKeeper = mintkeeper.NewKeeper(appCodec, keys[minttypes.StoreKey], app.StakingKeeper, app.AccountKeeper, app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + app.DistrKeeper = distrkeeper.NewKeeper(appCodec, keys[distrtypes.StoreKey], app.AccountKeeper, app.BankKeeper, app.StakingKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.SlashingKeeper = slashingkeeper.NewKeeper( - appCodec, keys[slashingtypes.StoreKey], &stakingKeeper, app.GetSubspace(slashingtypes.ModuleName), - ) - app.CrisisKeeper = crisiskeeper.NewKeeper( - app.GetSubspace(crisistypes.ModuleName), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, + appCodec, legacyAmino, keys[slashingtypes.StoreKey], app.StakingKeeper, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.CrisisKeeper = crisiskeeper.NewKeeper(appCodec, keys[crisistypes.StoreKey], invCheckPeriod, + app.BankKeeper, authtypes.FeeCollectorName, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.FeeGrantKeeper = feegrantkeeper.NewKeeper(appCodec, keys[feegrant.StoreKey], app.AccountKeeper) // set the governance module account as the authority for conducting upgrades app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String()) // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks - app.StakingKeeper = *stakingKeeper.SetHooks( + app.StakingKeeper.SetHooks( stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), epochingKeeper.Hooks()), ) app.AuthzKeeper = authzkeeper.NewKeeper(keys[authzkeeper.StoreKey], appCodec, app.MsgServiceRouter(), app.AccountKeeper) + app.IBCKeeper = ibckeeper.NewKeeper( + appCodec, + keys[ibcexported.StoreKey], + app.GetSubspace(ibcexported.ModuleName), + app.StakingKeeper, + app.UpgradeKeeper, + scopedIBCKeeper, + ) + // ... other modules keepers // TODO: Create IBC keeper @@ -386,8 +482,9 @@ func NewBabylonApp( govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(distrtypes.RouterKey, distr.NewCommunityPoolSpendProposalHandler(app.DistrKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)) + AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). + AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)) + govConfig := govtypes.DefaultConfig() /* @@ -395,8 +492,8 @@ func NewBabylonApp( govConfig.MaxMetadataLen = 10000 */ govKeeper := govkeeper.NewKeeper( - appCodec, keys[govtypes.StoreKey], app.GetSubspace(govtypes.ModuleName), app.AccountKeeper, app.BankKeeper, - &stakingKeeper, govRouter, app.MsgServiceRouter(), govConfig, + appCodec, keys[govtypes.StoreKey], app.AccountKeeper, app.BankKeeper, + app.StakingKeeper, app.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.GovKeeper = *govKeeper.SetHooks( @@ -405,16 +502,6 @@ func NewBabylonApp( ), ) - // Keepers for IBC-related modules - ibcKeeper := ibckeeper.NewKeeper( - appCodec, - keys[ibchost.StoreKey], - app.GetSubspace(ibchost.ModuleName), - app.StakingKeeper, - app.UpgradeKeeper, - scopedIBCKeeper, - ) - // create Tendermint client tmClient, err := client.NewClientFromNode(privSigner.ClientCtx.NodeURI) // create a Tendermint client for ZoneConcierge if err != nil { @@ -423,16 +510,15 @@ func NewBabylonApp( // create querier for KVStore storeQuerier, ok := app.CommitMultiStore().(sdk.Queryable) if !ok { - panic(sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, "multistore doesn't support queries")) + panic(errorsmod.Wrap(sdkerrors.ErrUnknownRequest, "multistore doesn't support queries")) } zcKeeper := zckeeper.NewKeeper( appCodec, keys[zctypes.StoreKey], keys[zctypes.MemStoreKey], - app.GetSubspace(zctypes.ModuleName), - ibcKeeper.ChannelKeeper, - ibcKeeper.ChannelKeeper, - &ibcKeeper.PortKeeper, + app.IBCKeeper.ChannelKeeper, + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, nil, // CheckpointingKeeper is set later (TODO: figure out a proper way for this) @@ -444,15 +530,13 @@ func NewBabylonApp( ) // replace IBC keeper's client keeper with our ExtendedKeeper - extendedClientKeeper := ibcclientkeeper.NewExtendedKeeper(appCodec, keys[ibchost.StoreKey], app.GetSubspace(ibchost.ModuleName), stakingKeeper, app.UpgradeKeeper) + extendedClientKeeper := extendedkeeper.NewExtendedKeeper(appCodec, keys[ibcexported.StoreKey], app.GetSubspace(ibcexported.ModuleName), app.StakingKeeper, app.UpgradeKeeper) // make zcKeeper to hooks onto extendedClientKeeper so that zcKeeper can receive notifications of new headers extendedClientKeeper = *extendedClientKeeper.SetHooks( - ibcclientkeeper.NewMultiClientHooks(zcKeeper.Hooks()), + extendedkeeper.NewMultiClientHooks(zcKeeper.Hooks()), ) - ibcKeeper.ClientKeeper = extendedClientKeeper + app.IBCKeeper.ClientKeeper = extendedClientKeeper - // set IBC keeper and ZC keeper for app - app.IBCKeeper = ibcKeeper app.ZoneConciergeKeeper = *zcKeeper // Create Transfer Keepers @@ -477,7 +561,6 @@ func NewBabylonApp( appCodec, keys[btclightclienttypes.StoreKey], keys[btclightclienttypes.MemStoreKey], - app.GetSubspace(btclightclienttypes.ModuleName), btcConfig, ) @@ -485,7 +568,6 @@ func NewBabylonApp( appCodec, keys[monitortypes.StoreKey], keys[monitortypes.StoreKey], - app.GetSubspace(monitortypes.ModuleName), &btclightclientKeeper, ) @@ -504,7 +586,6 @@ func NewBabylonApp( keys[checkpointingtypes.MemStoreKey], privSigner.WrappedPV, app.EpochingKeeper, - app.GetSubspace(checkpointingtypes.ModuleName), privSigner.ClientCtx, ) app.CheckpointingKeeper = *checkpointingKeeper.SetHooks( @@ -518,14 +599,12 @@ func NewBabylonApp( btccheckpointkeeper.NewKeeper( appCodec, keys[btccheckpointtypes.StoreKey], + tkeys[btccheckpointtypes.TStoreKey], keys[btccheckpointtypes.MemStoreKey], - app.GetSubspace(btccheckpointtypes.ModuleName), &btclightclientKeeper, app.CheckpointingKeeper, - // TODO decide on proper values for those constants, also those should be taken - // from some global config &powLimit, - btcConfig.CheckpointTag(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) app.ZoneConciergeKeeper.SetBtcCheckpointKeeper(app.BtcCheckpointKeeper) @@ -535,11 +614,47 @@ func NewBabylonApp( // create evidence keeper with router evidenceKeeper := evidencekeeper.NewKeeper( - appCodec, keys[evidencetypes.StoreKey], &app.StakingKeeper, app.SlashingKeeper, + appCodec, keys[evidencetypes.StoreKey], app.StakingKeeper, app.SlashingKeeper, ) // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper + wasmDir := filepath.Join(homePath, "wasm") + wasmConfig, err := wasm.ReadWasmConfig(appOpts) + if err != nil { + panic(fmt.Sprintf("error while reading wasm config: %s", err)) + } + + wasmOpts = append(owasm.RegisterCustomPlugins(&app.EpochingKeeper, &app.ZoneConciergeKeeper, &app.BTCLightClientKeeper), wasmOpts...) + + app.WasmKeeper = wasm.NewKeeper( + appCodec, + keys[wasm.StoreKey], + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + distrkeeper.NewQuerier(app.DistrKeeper), + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, + scopedWasmKeeper, + app.TransferKeeper, + app.MsgServiceRouter(), + app.GRPCQueryRouter(), + wasmDir, + wasmConfig, + wasmCapabilities, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + wasmOpts..., + ) + + // The gov proposal types can be individually enabled + if len(wasmEnabledProposals) != 0 { + govRouter.AddRoute(wasm.RouterKey, wasm.NewWasmProposalHandler(app.WasmKeeper, wasmEnabledProposals)) + } + + // Set legacy router for backwards compatibility with gov v1beta1 + app.GovKeeper.SetLegacyRouter(govRouter) + /**** Module Options ****/ // NOTE: we may consider parsing `appOpts` inside module constructors. For the moment @@ -553,21 +668,23 @@ func NewBabylonApp( app.AccountKeeper, app.StakingKeeper, app.BaseApp.DeliverTx, encodingConfig.TxConfig, ), - auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts), + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), - capability.NewAppModule(appCodec, *app.CapabilityKeeper), - crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), + gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), params.NewAppModule(app.ParamsKeeper), + consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + wasm.NewAppModule(appCodec, &app.WasmKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasm.ModuleName)), // Babylon modules epoching.NewAppModule(appCodec, app.EpochingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), btclightclient.NewAppModule(appCodec, app.BTCLightClientKeeper, app.AccountKeeper, app.BankKeeper), @@ -590,7 +707,7 @@ func NewBabylonApp( evidencetypes.ModuleName, stakingtypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName, - paramstypes.ModuleName, vestingtypes.ModuleName, + paramstypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName, // Babylon modules epochingtypes.ModuleName, btclightclienttypes.ModuleName, @@ -598,9 +715,10 @@ func NewBabylonApp( checkpointingtypes.ModuleName, monitortypes.ModuleName, // IBC-related modules - ibchost.ModuleName, + ibcexported.ModuleName, ibctransfertypes.ModuleName, zctypes.ModuleName, + wasm.ModuleName, ) // TODO: there will be an architecture design on whether to modify slashing/evidence, specifically // - how many validators can we slash in a single epoch and @@ -613,7 +731,7 @@ func NewBabylonApp( slashingtypes.ModuleName, minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, - paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, + paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName, // Babylon modules epochingtypes.ModuleName, btclightclienttypes.ModuleName, @@ -621,9 +739,10 @@ func NewBabylonApp( checkpointingtypes.ModuleName, monitortypes.ModuleName, // IBC-related modules - ibchost.ModuleName, + ibcexported.ModuleName, ibctransfertypes.ModuleName, zctypes.ModuleName, + wasm.ModuleName, ) // Babylon does not want EndBlock processing in staking app.mm.OrderEndBlockers = append(app.mm.OrderEndBlockers[:2], app.mm.OrderEndBlockers[2+1:]...) // remove stakingtypes.ModuleName @@ -638,7 +757,7 @@ func NewBabylonApp( slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, - paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, + paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, consensusparamtypes.ModuleName, // Babylon modules epochingtypes.ModuleName, btclightclienttypes.ModuleName, @@ -646,19 +765,27 @@ func NewBabylonApp( checkpointingtypes.ModuleName, monitortypes.ModuleName, // IBC-related modules - ibchost.ModuleName, + ibcexported.ModuleName, ibctransfertypes.ModuleName, zctypes.ModuleName, + wasm.ModuleName, ) // Uncomment if you want to set a custom migration order here. // app.mm.SetOrderMigrations(custom order) - app.mm.RegisterInvariants(&app.CrisisKeeper) - app.mm.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino) + app.mm.RegisterInvariants(app.CrisisKeeper) app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) app.mm.RegisterServices(app.configurator) + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) + + reflectionSvc, err := runtimeservices.NewReflectionService() + if err != nil { + panic(err) + } + reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) + // add test gRPC service for testing gRPC queries in isolation testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) @@ -666,30 +793,10 @@ func NewBabylonApp( // // NOTE: this is not required apps that don't use the simulator for fuzz testing // transactions - app.sm = module.NewSimulationManager( - auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts), - bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper), - capability.NewAppModule(appCodec, *app.CapabilityKeeper), - feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper), - mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - params.NewAppModule(app.ParamsKeeper), - evidence.NewAppModule(app.EvidenceKeeper), - authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - // Babylon modules - epoching.NewAppModule(appCodec, app.EpochingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper), - btclightclient.NewAppModule(appCodec, app.BTCLightClientKeeper, app.AccountKeeper, app.BankKeeper), - btccheckpoint.NewAppModule(appCodec, app.BtcCheckpointKeeper, app.AccountKeeper, app.BankKeeper), - checkpointing.NewAppModule(appCodec, app.CheckpointingKeeper, app.AccountKeeper, app.BankKeeper), - monitor.NewAppModule(appCodec, app.MonitorKeeper, app.AccountKeeper, app.BankKeeper), - // IBC-related modules - ibc.NewAppModule(app.IBCKeeper), - transferModule, - zoneconcierge.NewAppModule(appCodec, app.ZoneConciergeKeeper, app.AccountKeeper, app.BankKeeper), - ) + overrideModules := map[string]module.AppModuleSimulation{ + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + } + app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager().Modules, overrideModules) app.sm.RegisterStoreDecoders() @@ -703,27 +810,50 @@ func NewBabylonApp( app.SetBeginBlocker(app.BeginBlocker) // initialize AnteHandler, which includes - // - authAnteHandler: the default AnteHandler created by `auth.ante.NewAnteHandler` + // - authAnteHandler + // - custom wasm ante handler NewLimitSimulationGasDecorator and NewCountTXDecorator // - Extra decorators introduced in Babylon, such as DropValidatorMsgDecorator that delays validator-related messages - authAnteHandler, err := ante.NewAnteHandler( - ante.HandlerOptions{ - AccountKeeper: app.AccountKeeper, - BankKeeper: app.BankKeeper, - SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), - FeegrantKeeper: app.FeeGrantKeeper, - SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + // + // We are using constructor from wasmapp as it introduces custom wasm ante handle decorators + // early in chain of ante handlers. + authAnteHandler, err := wasmapp.NewAnteHandler( + wasmapp.HandlerOptions{ + HandlerOptions: ante.HandlerOptions{ + AccountKeeper: app.AccountKeeper, + BankKeeper: app.BankKeeper, + SignModeHandler: encodingConfig.TxConfig.SignModeHandler(), + FeegrantKeeper: app.FeeGrantKeeper, + SigGasConsumer: ante.DefaultSigVerificationGasConsumer, + }, + IBCKeeper: app.IBCKeeper, + WasmConfig: &wasmConfig, + TXCounterStoreKey: keys[wasm.StoreKey], }, ) + if err != nil { panic(err) } + anteHandler := sdk.ChainAnteDecorators( NewWrappedAnteHandler(authAnteHandler), epochingkeeper.NewDropValidatorMsgDecorator(app.EpochingKeeper), - NewBtcValidationDecorator(btcConfig), + NewBtcValidationDecorator(btcConfig, &app.BtcCheckpointKeeper), ) app.SetAnteHandler(anteHandler) + // must be before Loading version + // requires the snapshot store to be created and registered as a BaseAppOption + // see cmd/wasmd/root.go: 206 - 214 approx + if manager := app.SnapshotManager(); manager != nil { + err := manager.RegisterExtensions( + wasmkeeper.NewWasmSnapshotter(app.CommitMultiStore(), &app.WasmKeeper), + ) + if err != nil { + panic(fmt.Errorf("failed to register snapshot extension: %s", err)) + } + } + // initialize EndBlocker app.SetEndBlocker(app.EndBlocker) @@ -731,11 +861,19 @@ func NewBabylonApp( if err := app.LoadLatestVersion(); err != nil { tmos.Exit(err.Error()) } + + ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) + + // Initialize pinned codes in wasmvm as they are not persisted there + if err := app.WasmKeeper.InitializePinnedCodes(ctx); err != nil { + tmos.Exit(fmt.Sprintf("failed initialize pinned codes %s", err)) + } } app.ScopedIBCKeeper = scopedIBCKeeper app.ScopedZoneConciergeKeeper = scopedZoneConciergeKeeper app.ScopedTransferKeeper = scopedTransferKeeper + app.ScopedWasmKeeper = scopedWasmKeeper return app } @@ -857,7 +995,7 @@ func (app *BabylonApp) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.AP // register swagger API from root so that other applications can override easily if apiConfig.Swagger { - RegisterSwaggerAPI(clientCtx, apiSvr.Router) + docs.RegisterOpenAPIService(apiSvr.Router) } } @@ -876,19 +1014,21 @@ func (app *BabylonApp) RegisterTendermintService(clientCtx client.Context) { ) } +func (app *BabylonApp) RegisterNodeService(clientCtx client.Context) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) +} + func (app *BabylonApp) ModuleManager() *module.Manager { return app.mm } -// RegisterSwaggerAPI registers swagger route with API Server -func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { - statikFS, err := fs.New() - if err != nil { - panic(err) - } +// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. +func (a *BabylonApp) DefaultGenesis() map[string]json.RawMessage { + return ModuleBasics.DefaultGenesis(a.appCodec) +} - staticServer := http.FileServer(statikFS) - rtr.PathPrefix("/swagger/").Handler(http.StripPrefix("/swagger/", staticServer)) +func (app *BabylonApp) TxConfig() client.TxConfig { + return app.txConfig } // GetMaccPerms returns a copy of the module account permissions @@ -900,26 +1040,27 @@ func GetMaccPerms() map[string][]string { return dupMaccPerms } +// BlockedAddresses returns all the app's blocked account addresses. +func BlockedAddresses() map[string]bool { + modAccAddrs := make(map[string]bool) + for acc := range GetMaccPerms() { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } + + // allow the following addresses to receive funds + delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + return modAccAddrs +} + // initParamsKeeper init params keeper and its subspaces func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) - paramsKeeper.Subspace(authtypes.ModuleName) - paramsKeeper.Subspace(banktypes.ModuleName) - paramsKeeper.Subspace(stakingtypes.ModuleName) - paramsKeeper.Subspace(minttypes.ModuleName) - paramsKeeper.Subspace(distrtypes.ModuleName) - paramsKeeper.Subspace(slashingtypes.ModuleName) - paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) - paramsKeeper.Subspace(crisistypes.ModuleName) - // Babylon modules - paramsKeeper.Subspace(epochingtypes.ModuleName) - paramsKeeper.Subspace(btclightclienttypes.ModuleName) - paramsKeeper.Subspace(btccheckpointtypes.ModuleName) - paramsKeeper.Subspace(checkpointingtypes.ModuleName) - paramsKeeper.Subspace(monitortypes.ModuleName) - // IBC-related modules - paramsKeeper.Subspace(ibchost.ModuleName) + // TODO: Only modules which did not migrate yet to new way of hanldling params + // are the IBC-related modules. Once they are migrated, we can remove this and + // whole usage of params module + paramsKeeper.Subspace(ibcexported.ModuleName) paramsKeeper.Subspace(ibctransfertypes.ModuleName) paramsKeeper.Subspace(zctypes.ModuleName) diff --git a/app/app_test.go b/app/app_test.go index 429796666..75a406c64 100644 --- a/app/app_test.go +++ b/app/app_test.go @@ -1,17 +1,20 @@ package app import ( + "fmt" "os" "testing" + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" ) func TestBabylonBlockedAddrs(t *testing.T) { - encCfg := MakeTestEncodingConfig() + encCfg := GetEncodingConfig() db := dbm.NewMemDB() signer, _ := SetupPrivSigner() logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) @@ -25,11 +28,18 @@ func TestBabylonBlockedAddrs(t *testing.T) { AppOpts: EmptyAppOptions{}, }) - for acc := range maccPerms { + for acc := range BlockedAddresses() { + var addr sdk.AccAddress + if modAddr, err := sdk.AccAddressFromBech32(acc); err == nil { + addr = modAddr + } else { + addr = app.AccountKeeper.GetModuleAddress(acc) + } + require.True( t, - app.BankKeeper.BlockedAddr(app.AccountKeeper.GetModuleAddress(acc)), - "ensure that blocked addresses are properly set in bank keeper", + app.BankKeeper.BlockedAddr(addr), + fmt.Sprintf("ensure that blocked addresses are properly set in bank keeper: %s should be blocked", acc), ) } @@ -37,8 +47,8 @@ func TestBabylonBlockedAddrs(t *testing.T) { logger2 := log.NewTMLogger(log.NewSyncWriter(os.Stdout)) // Making a new app object with the db, so that initchain hasn't been called - app2 := NewBabylonApp(logger2, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, signer, EmptyAppOptions{}) - _, err := app2.ExportAppStateAndValidators(false, []string{}) + app2 := NewBabylonApp(logger2, db, nil, true, map[int64]bool{}, DefaultNodeHome, 0, encCfg, signer, EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts) + _, err := app2.ExportAppStateAndValidators(false, []string{}, []string{}) require.NoError(t, err, "ExportAppStateAndValidators should not have an error") } @@ -48,7 +58,7 @@ func TestGetMaccPerms(t *testing.T) { } func TestUpgradeStateOnGenesis(t *testing.T) { - encCfg := MakeTestEncodingConfig() + encCfg := GetEncodingConfig() db := dbm.NewMemDB() privSigner, err := SetupPrivSigner() require.NoError(t, err) @@ -68,6 +78,8 @@ func TestUpgradeStateOnGenesis(t *testing.T) { ctx := app.NewContext(false, tmproto.Header{}) vm := app.UpgradeKeeper.GetModuleVersionMap(ctx) for v, i := range app.mm.Modules { - require.Equal(t, vm[v], i.ConsensusVersion()) + if i, ok := i.(module.HasConsensusVersion); ok { + require.Equal(t, vm[v], i.ConsensusVersion()) + } } } diff --git a/app/encoding.go b/app/encoding.go index c414f23f0..800f0e302 100644 --- a/app/encoding.go +++ b/app/encoding.go @@ -1,16 +1,20 @@ package app import ( - appparams "github.com/babylonchain/babylon/app/params" "github.com/cosmos/cosmos-sdk/std" + + appparams "github.com/babylonchain/babylon/app/params" ) -// MakeTestEncodingConfig creates an EncodingConfig for testing. This function -// should be used only in tests or when creating a new app instance (NewApp*()). -// App user shouldn't create new codecs - use the app.AppCodec instead. -// [DEPRECATED] -func MakeTestEncodingConfig() appparams.EncodingConfig { - encodingConfig := appparams.MakeTestEncodingConfig() +var encodingConfig = makeEncodingConfig() + +func GetEncodingConfig() appparams.EncodingConfig { + return encodingConfig +} + +// makeEncodingConfig creates an EncodingConfig. +func makeEncodingConfig() appparams.EncodingConfig { + encodingConfig := appparams.GetEncodingConfig() std.RegisterLegacyAminoCodec(encodingConfig.Amino) std.RegisterInterfaces(encodingConfig.InterfaceRegistry) ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) diff --git a/app/export.go b/app/export.go index 32ff9374b..ada8411d7 100644 --- a/app/export.go +++ b/app/export.go @@ -4,7 +4,7 @@ import ( "encoding/json" "log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -16,8 +16,9 @@ import ( // ExportAppStateAndValidators exports the state of the application for a genesis // file. func (app *BabylonApp) ExportAppStateAndValidators( - forZeroHeight bool, jailAllowedAddrs []string, -) (servertypes.ExportedApp, error) { + forZeroHeight bool, + jailAllowedAddrs []string, + modulesToExport []string) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) @@ -29,7 +30,8 @@ func (app *BabylonApp) ExportAppStateAndValidators( app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.mm.ExportGenesis(ctx, app.appCodec) + genState := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err diff --git a/app/modules.go b/app/modules.go index d3fafbc66..424a5179a 100644 --- a/app/modules.go +++ b/app/modules.go @@ -3,8 +3,8 @@ package app import ( "github.com/cosmos/cosmos-sdk/client" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - ibckeeper "github.com/cosmos/ibc-go/v5/modules/core/keeper" - ibctestingtypes "github.com/cosmos/ibc-go/v5/testing/types" + ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" ) // The following functions are required by ibctesting @@ -23,5 +23,5 @@ func (app *BabylonApp) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { } func (app *BabylonApp) GetTxConfig() client.TxConfig { - return MakeTestEncodingConfig().TxConfig + return GetEncodingConfig().TxConfig } diff --git a/app/params/config.go b/app/params/config.go index 3dd8ee782..7649b7066 100644 --- a/app/params/config.go +++ b/app/params/config.go @@ -3,6 +3,7 @@ package params import ( "github.com/cosmos/cosmos-sdk/types/address" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -57,16 +58,16 @@ func SetAddressPrefixes() { // source: https://github.com/cosmos/cosmos-sdk/blob/v0.43.0-beta1/types/address.go#L141 config.SetAddressVerifier(func(bytes []byte) error { if len(bytes) == 0 { - return sdkerrors.Wrap(sdkerrors.ErrUnknownAddress, "addresses cannot be empty") + return errorsmod.Wrap(sdkerrors.ErrUnknownAddress, "addresses cannot be empty") } if len(bytes) > address.MaxAddrLen { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "address max length is %d, got %d", address.MaxAddrLen, len(bytes)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address max length is %d, got %d", address.MaxAddrLen, len(bytes)) } // TODO: Do we want to allow addresses of lengths other than 20 and 32 bytes? if len(bytes) != 20 && len(bytes) != 32 { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownAddress, "address length must be 20 or 32 bytes, got %d", len(bytes)) + return errorsmod.Wrapf(sdkerrors.ErrUnknownAddress, "address length must be 20 or 32 bytes, got %d", len(bytes)) } return nil diff --git a/app/params/params.go b/app/params/params.go index b6aa5fb55..85d61e3c1 100644 --- a/app/params/params.go +++ b/app/params/params.go @@ -4,4 +4,5 @@ package params const ( StakePerAccount = "stake_per_account" InitiallyBondedValidators = "initially_bonded_validators" + SimAppChainID = "simulation-app" ) diff --git a/app/params/proto.go b/app/params/proto.go index a752d1079..f2f36aae3 100644 --- a/app/params/proto.go +++ b/app/params/proto.go @@ -9,19 +9,17 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/tx" ) -// MakeTestEncodingConfig creates an EncodingConfig for a non-amino based test configuration. -// This function should be used only internally (in the SDK). -// App user should'nt create new codecs - use the app.AppCodec instead. -// [DEPRECATED] -func MakeTestEncodingConfig() EncodingConfig { - cdc := codec.NewLegacyAmino() +// GetEncodingConfig creates an EncodingConfig for an amino based test configuration. +func GetEncodingConfig() EncodingConfig { + amino := codec.NewLegacyAmino() interfaceRegistry := types.NewInterfaceRegistry() marshaler := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(marshaler, tx.DefaultSignModes) return EncodingConfig{ InterfaceRegistry: interfaceRegistry, Marshaler: marshaler, - TxConfig: tx.NewTxConfig(marshaler, tx.DefaultSignModes), - Amino: cdc, + TxConfig: txCfg, + Amino: amino, } } diff --git a/app/test_helpers.go b/app/test_helpers.go index 170e95d19..f83e2a392 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -11,15 +11,21 @@ import ( "time" "cosmossdk.io/math" - tmconfig "github.com/tendermint/tendermint/config" + tmconfig "github.com/cometbft/cometbft/config" + + tmjson "github.com/cometbft/cometbft/libs/json" - "github.com/babylonchain/babylon/app/params" - appparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/testutil/datagen" - tmjson "github.com/tendermint/tendermint/libs/json" - txformat "github.com/babylonchain/babylon/btctxformatter" + errorsmod "cosmossdk.io/errors" + "github.com/babylonchain/babylon/app/params" + appparams "github.com/babylonchain/babylon/app/params" bbn "github.com/babylonchain/babylon/types" + dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" bam "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -29,7 +35,7 @@ import ( sec256k1 "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/server/types" - "github.com/cosmos/cosmos-sdk/simapp/helpers" + simsutils "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/errors" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" @@ -38,32 +44,8 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" - dbm "github.com/tendermint/tm-db" ) -// DefaultConsensusParams defines the default Tendermint consensus params used in -// Babylon testing. -var DefaultConsensusParams = &abci.ConsensusParams{ - Block: &abci.BlockParams{ - MaxBytes: 200000, - MaxGas: 2000000, - }, - Evidence: &tmproto.EvidenceParams{ - MaxAgeNumBlocks: 302400, - MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration - MaxBytes: 10000, - }, - Validator: &tmproto.ValidatorParams{ - PubKeyTypes: []string{ - tmtypes.ABCIPubKeyTypeEd25519, - }, - }, -} - // SetupOptions defines arguments that are passed into `Simapp` constructor. type SetupOptions struct { Logger log.Logger @@ -77,12 +59,12 @@ type SetupOptions struct { func setup(withGenesis bool, invCheckPeriod uint) (*BabylonApp, GenesisState) { db := dbm.NewMemDB() - encCdc := MakeTestEncodingConfig() + encCdc := GetEncodingConfig() privSigner, err := SetupPrivSigner() if err != nil { panic(err) } - app := NewBabylonApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, privSigner, EmptyAppOptions{}) + app := NewBabylonApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, invCheckPeriod, encCdc, privSigner, EmptyAppOptions{}, GetWasmEnabledProposals(), EmptyWasmOpts) if withGenesis { return app, NewDefaultGenesisState(encCdc.Marshaler) } @@ -121,7 +103,7 @@ func NewBabyblonAppWithCustomOptions(t *testing.T, isCheckTx bool, privSigner *P options.InvCheckPeriod, options.EncConfig, privSigner, - options.AppOpts) + options.AppOpts, GetWasmEnabledProposals(), EmptyWasmOpts) genesisState := NewDefaultGenesisState(app.appCodec) genesisState = genesisStateWithValSet(t, app, genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) @@ -134,7 +116,7 @@ func NewBabyblonAppWithCustomOptions(t *testing.T, isCheckTx bool, privSigner *P app.InitChain( abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, - ConsensusParams: DefaultConsensusParams, + ConsensusParams: simsutils.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) @@ -201,7 +183,13 @@ func genesisStateWithValSet(t *testing.T, }) // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) + bankGenesis := banktypes.NewGenesisState( + banktypes.DefaultGenesisState().Params, + balances, + totalSupply, + []banktypes.Metadata{}, + []banktypes.SendEnabled{}, + ) genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) return genesisState @@ -237,12 +225,13 @@ func Setup(t *testing.T, isCheckTx bool) *BabylonApp { // SetupPrivSigner sets up a PrivSigner for testing func SetupPrivSigner() (*PrivSigner, error) { - nodeCfg := tmconfig.DefaultConfig() kr, err := client.NewKeyringFromBackend(client.Context{}, keyring.BackendMemory) if err != nil { return nil, err } - privSigner, _ := InitPrivSigner(client.Context{}, ".", kr) + nodeCfg := tmconfig.DefaultConfig() + encodingCfg := appparams.GetEncodingConfig() + privSigner, _ := InitPrivSigner(client.Context{}, ".", kr, "", encodingCfg) privSigner.WrappedPV.Clean(nodeCfg.PrivValidatorKeyFile(), nodeCfg.PrivValidatorStateFile()) return privSigner, nil } @@ -307,7 +296,13 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs }) // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) + bankGenesis := banktypes.NewGenesisState( + banktypes.DefaultGenesisState().Params, + balances, + totalSupply, + []banktypes.Metadata{}, + []banktypes.SendEnabled{}, + ) genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) stateBytes, err := json.MarshalIndent(genesisState, "", " ") @@ -317,7 +312,7 @@ func SetupWithGenesisValSet(t *testing.T, valSet *tmtypes.ValidatorSet, genAccs app.InitChain( abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, - ConsensusParams: DefaultConsensusParams, + ConsensusParams: simsutils.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) @@ -337,7 +332,13 @@ func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...ba totalSupply = totalSupply.Add(b.Coins...) } - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}) + bankGenesis := banktypes.NewGenesisState( + banktypes.DefaultGenesisState().Params, + balances, + totalSupply, + []banktypes.Metadata{}, + []banktypes.SendEnabled{}, + ) genesisState[banktypes.ModuleName] = app.AppCodec().MustMarshalJSON(bankGenesis) stateBytes, err := json.MarshalIndent(genesisState, "", " ") @@ -348,7 +349,7 @@ func SetupWithGenesisAccounts(genAccs []authtypes.GenesisAccount, balances ...ba app.InitChain( abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, - ConsensusParams: DefaultConsensusParams, + ConsensusParams: simsutils.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) @@ -486,12 +487,12 @@ func SignCheckDeliver( chainID string, accNums, accSeqs []uint64, expSimPass, expPass bool, priv ...cryptotypes.PrivKey, ) (sdk.GasInfo, *sdk.Result, error) { r := rand.New(rand.NewSource(time.Now().UnixNano())) - tx, err := helpers.GenSignedMockTx( + tx, err := simsutils.GenSignedMockTx( r, txCfg, msgs, sdk.Coins{sdk.NewInt64Coin(appparams.DefaultBondDenom, 0)}, - helpers.DefaultGenTxGas, + simsutils.DefaultGenTxGas, chainID, accNums, accSeqs, @@ -538,12 +539,12 @@ func GenSequenceOfTxs(txGen client.TxConfig, msgs []sdk.Msg, accNums []uint64, i var err error for i := 0; i < numToGenerate; i++ { r := rand.New(rand.NewSource(time.Now().UnixNano())) - txs[i], err = helpers.GenSignedMockTx( + txs[i], err = simsutils.GenSignedMockTx( r, txGen, msgs, sdk.Coins{sdk.NewInt64Coin(appparams.DefaultBondDenom, 0)}, - helpers.DefaultGenTxGas, + simsutils.DefaultGenTxGas, "", accNums, initSeqNums, @@ -588,7 +589,7 @@ func NewPubKeyFromHex(pk string) (res cryptotypes.PubKey) { panic(err) } if len(pkBytes) != ed25519.PubKeySize { - panic(errors.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size")) + panic(errorsmod.Wrap(errors.ErrInvalidPubKey, "invalid pubkey size")) } return &ed25519.PubKey{Key: pkBytes} } @@ -604,10 +605,6 @@ func (ao EmptyAppOptions) Get(o string) interface{} { return string(bbn.BtcSimnet) } - if o == "btc-config.checkpoint-tag" { - return txformat.DefaultMainTagStr - } - return nil } diff --git a/app/types.go b/app/types.go index 180944f3e..fc631ccdc 100644 --- a/app/types.go +++ b/app/types.go @@ -1,7 +1,7 @@ package app import ( - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/server/types" @@ -33,7 +33,7 @@ type App interface { // Exports the state of the application for a genesis file. ExportAppStateAndValidators( - forZeroHeight bool, jailAllowedAddrs []string, + forZeroHeight bool, jailAllowedAddrs []string, modulesToExport []string, ) (types.ExportedApp, error) // All the registered module account addreses. diff --git a/app/utils.go b/app/utils.go index 9705ebe72..4bbd2fd41 100644 --- a/app/utils.go +++ b/app/utils.go @@ -9,13 +9,13 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" + tmconfig "github.com/cometbft/cometbft/config" + tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" - tmconfig "github.com/tendermint/tendermint/config" - tmos "github.com/tendermint/tendermint/libs/os" + appparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/privval" ) @@ -43,7 +43,7 @@ type PrivSigner struct { ClientCtx client.Context } -func InitPrivSigner(clientCtx client.Context, nodeDir string, kr keyring.Keyring) (*PrivSigner, error) { +func InitPrivSigner(clientCtx client.Context, nodeDir string, kr keyring.Keyring, feePayer string, encodingCfg appparams.EncodingConfig) (*PrivSigner, error) { // setup private validator nodeCfg := tmconfig.DefaultConfig() pvKeyFile := filepath.Join(nodeDir, nodeCfg.PrivValidatorKeyFile()) @@ -58,26 +58,36 @@ func InitPrivSigner(clientCtx client.Context, nodeDir string, kr keyring.Keyring } wrappedPV := privval.LoadOrGenWrappedFilePV(pvKeyFile, pvStateFile) - // TODO this should probably not create separate config, but rahter accept it - // as argument - encodingCfg := MakeTestEncodingConfig() clientCtx = clientCtx. WithInterfaceRegistry(encodingCfg.InterfaceRegistry). WithCodec(encodingCfg.Marshaler). WithLegacyAmino(encodingCfg.Amino). WithTxConfig(encodingCfg.TxConfig). WithAccountRetriever(types.AccountRetriever{}). - WithFromAddress(sdk.AccAddress(wrappedPV.GetAddress())). - WithFeeGranterAddress(sdk.AccAddress(wrappedPV.GetAddress())). WithSkipConfirmation(true). WithKeyring(kr). WithNodeURI(nodeCfg.RPC.ListenAddress) + if feePayer != "" { + feePayerRecord, err := kr.Key(feePayer) + if err != nil { + return nil, err + } + feePayerAddress, err := feePayerRecord.GetAddress() + if err != nil { + return nil, err + } + clientCtx = clientCtx. + WithFromAddress(feePayerAddress). + WithFromName(feePayer) + } + return &PrivSigner{ WrappedPV: wrappedPV, ClientCtx: clientCtx, }, nil } + func CreateClientConfig(chainID string, backend string, homePath string) (*config.ClientConfig, error) { cliConf := &config.ClientConfig{ ChainID: chainID, diff --git a/btctxformatter/bbnformatter.go b/btctxformatter/bbnformatter.go deleted file mode 100644 index d9c8304e3..000000000 --- a/btctxformatter/bbnformatter.go +++ /dev/null @@ -1,25 +0,0 @@ -package btctxformatter - -// Little helpers for now which will be usefull in tests etc. -// Probably we should not hardcode stuff either way but to define this tags -// in some separate document/config - -const ( - mainTagPrefix string = "bbn" - testTagPrefix string = "bbt" - - DefaultTestTagStr string = testTagPrefix + "0" - DefaultMainTagStr string = testTagPrefix + "m" -) - -func MainTag(idx uint8) BabylonTag { - bytes := []byte(mainTagPrefix) - bytes = append(bytes, idx) - return BabylonTag(bytes) -} - -func TestTag(idx uint8) BabylonTag { - bytes := []byte(testTagPrefix) - bytes = append(bytes, idx) - return BabylonTag(bytes) -} diff --git a/btctxformatter/formatter_test.go b/btctxformatter/formatter_test.go index a8aef4b84..06b9ea10f 100644 --- a/btctxformatter/formatter_test.go +++ b/btctxformatter/formatter_test.go @@ -2,13 +2,14 @@ package btctxformatter import ( "bytes" + cprand "crypto/rand" "math/rand" "testing" ) func randNBytes(n int) []byte { bytes := make([]byte, n) - rand.Read(bytes) + cprand.Read(bytes) //nolint:errcheck // This is a test. return bytes } @@ -97,7 +98,8 @@ func FuzzDecodingWontPanic(f *testing.F) { f.Add(randNBytes(secondPartLength), uint8(rand.Intn(99))) f.Fuzz(func(t *testing.T, bytes []byte, tagIdx uint8) { - decoded, err := IsBabylonCheckpointData(MainTag(tagIdx), CurrentVersion, bytes) + tag := []byte{0, 1, 2, 3} + decoded, err := IsBabylonCheckpointData(BabylonTag(tag), CurrentVersion, bytes) if err == nil { if decoded.Index != 0 && decoded.Index != 1 { diff --git a/buf.work.yaml b/buf.work.yaml new file mode 100644 index 000000000..1878b341b --- /dev/null +++ b/buf.work.yaml @@ -0,0 +1,3 @@ +version: v1 +directories: + - proto diff --git a/client/docs/config.json b/client/docs/config.json index b6dc889ab..ece266f16 100644 --- a/client/docs/config.json +++ b/client/docs/config.json @@ -7,7 +7,7 @@ }, "apis": [ { - "url": "./tmp-swagger-gen/babylon/btccheckpoint/query.swagger.json", + "url": "./tmp-swagger-gen/babylon/btccheckpoint/v1/query.swagger.json", "operationIds": { "rename": { "Params": "BtcCheckpointParams" @@ -15,7 +15,7 @@ } }, { - "url": "./tmp-swagger-gen/babylon/btclightclient/query.swagger.json", + "url": "./tmp-swagger-gen/babylon/btclightclient/v1/query.swagger.json", "operationIds": { "rename": { "Params": "BtcLightClientParams" @@ -31,7 +31,7 @@ } }, { - "url": "./tmp-swagger-gen/babylon/checkpointing/query.swagger.json", + "url": "./tmp-swagger-gen/babylon/checkpointing/v1/query.swagger.json", "operationIds": { "rename": { "Params": "CheckpointingParams" @@ -39,7 +39,7 @@ } }, { - "url": "./tmp-swagger-gen/babylon/zoneconcierge/query.swagger.json", + "url": "./tmp-swagger-gen/babylon/zoneconcierge/v1/query.swagger.json", "operationIds": { "rename": { "Params": "ZoneConciergeParams" diff --git a/client/docs/docs.go b/client/docs/docs.go new file mode 100644 index 000000000..44f466970 --- /dev/null +++ b/client/docs/docs.go @@ -0,0 +1,37 @@ +package docs + +import ( + "embed" + "html/template" + "net/http" + + "github.com/gorilla/mux" +) + +const ( + apiFile = "/swagger-ui/swagger.yaml" + indexFile = "template/index.tpl" +) + +//go:embed swagger-ui +var staticFS embed.FS + +//go:embed template +var templateFS embed.FS + +func RegisterOpenAPIService(router *mux.Router) { + router.Handle(apiFile, http.FileServer(http.FS(staticFS))) + router.HandleFunc("/", openAPIHandler()) +} + +func openAPIHandler() http.HandlerFunc { + tmpl, _ := template.ParseFS(templateFS, indexFile) + + return func(w http.ResponseWriter, req *http.Request) { + _ = tmpl.Execute(w, struct { + URL string + }{ + apiFile, + }) + } +} diff --git a/client/docs/swagger-ui/swagger.yaml b/client/docs/swagger-ui/swagger.yaml index a4c2ae549..25146beee 100644 --- a/client/docs/swagger-ui/swagger.yaml +++ b/client/docs/swagger-ui/swagger.yaml @@ -23,17 +23,83 @@ paths: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: >- - height of earliest BTC block that includes this - checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - vigilante_address_list: + title: >- + hash of the btc block which determines checkpoint btc + block height i.e. + + youngest block of best submission + best_submission_transactions: + type: array + items: + type: object + properties: + key: + 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. + type: object + properties: + index: + type: integer + format: int64 + hash: + type: string + format: byte + title: >- + Each provided OP_RETURN transaction can be + idendtified by hash of block in + + which transaction was included and transaction + index in the block + 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 + + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains + Babylon checkpoint, + + 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 @@ -44,17 +110,31 @@ paths: description: >- TODO: this could probably be better typed - Address of the checkpoint submitter, extracted - from the checkpoint itself. + submitter is the address of the checkpoint + submitter to BTC, extracted from + + the checkpoint itself. reporter: type: string format: byte title: >- - Address of the reporter which reported the - submissions, calculated from + reporter is the address of the reporter who + reported the submissions, + + calculated from submission message + MsgInsertBTCSpvProof itself + title: >- + CheckpointAddresses contains the addresses of the + submitter and reporter of a + + given checkpoint + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of + checkpoint for - submission message MsgInsertBTCSpvProof itself - title: list of vigilantes' addresses + given epoch. Best submission is the submission which is + deeper in btc ledger pagination: title: pagination defines the pagination in the response type: object @@ -84,7 +164,7 @@ paths: repeated Bar results = 1; PageResponse page = 2; } - title: >- + title: |- QueryBtcCheckpointsInfoResponse is response type for the Query/BtcCheckpointsInfo RPC method default: @@ -110,16 +190,6 @@ paths: type: string format: byte parameters: - - name: start_epoch - in: query - required: false - type: string - format: uint64 - - name: end_epoch - in: query - required: false - type: string - format: uint64 - name: pagination.key description: |- key is a value returned in PageResponse.next_key to begin @@ -207,17 +277,26 @@ paths: format: uint64 title: >- checkpoint_finalization_timeout is the maximum time window - (measured in BTC blocks) between a checkpoint + (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 + blocks, then BBN - (w in research paper) + 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. @@ -262,15 +341,82 @@ paths: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - vigilante_address_list: + title: >- + hash of the btc block which determines checkpoint btc + block height i.e. + + youngest block of best submission + best_submission_transactions: + type: array + items: + type: object + properties: + key: + 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. + type: object + properties: + index: + type: integer + format: int64 + hash: + type: string + format: byte + title: >- + Each provided OP_RETURN transaction can be + idendtified by hash of block in + + which transaction was included and transaction index + in the block + 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 + + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains + Babylon checkpoint, + + 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 @@ -281,18 +427,32 @@ paths: description: >- TODO: this could probably be better typed - Address of the checkpoint submitter, extracted from + submitter is the address of the checkpoint submitter + to BTC, extracted from + the checkpoint itself. reporter: type: string format: byte title: >- - Address of the reporter which reported the - submissions, calculated from + reporter is the address of the reporter who reported + the submissions, - submission message MsgInsertBTCSpvProof itself - title: list of vigilantes' addresses - title: >- + calculated from submission message + MsgInsertBTCSpvProof itself + title: >- + CheckpointAddresses contains the addresses of the + submitter and reporter of a + + given checkpoint + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo 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 default: @@ -319,7 +479,7 @@ paths: format: byte parameters: - name: epoch_num - description: >- + description: |- Number of epoch for which the earliest checkpointing btc height is requested in: path @@ -330,6 +490,7 @@ paths: - Query /babylon/btccheckpoint/v1/{epoch_num}/submissions: get: + summary: EpochSubmissions returns all submissions for a given epoch operationId: EpochSubmissions responses: '200': @@ -366,20 +527,19 @@ paths: submission we need list of transaction keys. Each submission can generally be identified by this list of - (txIdx, blockHash) - - tuples. + (txIdx, - Note: this could possibly be optimized as if transactions - were in one block + blockHash) tuples. Note: this could possibly be optimized as + if transactions - they would have the same block hash and different indexes, - but each blockhash + were in one block they would have the same block hash and + different indexes, - is only 33 (1 byte for prefix encoding and 32 byte hash), - so there should + but each blockhash is only 33 (1 byte for prefix encoding + and 32 byte hash), - be other strong arguments for this optimization + so there should be other strong arguments for this + optimization description: All submissions saved during an epoch. pagination: type: object @@ -409,6 +569,11 @@ paths: repeated Bar results = 1; PageResponse page = 2; } + title: >- + QueryEpochSubmissionsResponse defines a response to get all + submissions in + + given epoch (QueryEpochSubmissionsRequest) default: description: An unexpected error response. schema: @@ -498,6 +663,11 @@ paths: - Query /babylon/btclightclient/v1/baseheader: get: + summary: >- + BaseHeader returns the base BTC header of the chain. This header is + defined + + on genesis. operationId: BaseHeader responses: '200': @@ -520,6 +690,22 @@ paths: work: type: string format: byte + description: >- + BTCHeaderInfo is a structure that contains all relevant + information about a + + BTC header + - Full header bytes + - Header hash for easy retrieval + - 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. default: description: An unexpected error response. schema: @@ -607,7 +793,9 @@ paths: type: boolean description: >- QueryContainsResponse is response type for the temporary - Query/ContainsBytes RPC method. + Query/ContainsBytes + + RPC method. default: description: An unexpected error response. schema: @@ -792,6 +980,17 @@ paths: work: type: string format: byte + description: >- + BTCHeaderInfo is a structure that contains all relevant + information about a + + BTC header + - Full header bytes + - Header hash for easy retrieval + - 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: @@ -904,46 +1103,6 @@ paths: type: boolean tags: - Query - /babylon/btclightclient/v1/params: - get: - summary: Parameters queries the parameters of the module. - operationId: BtcLightClientParams - responses: - '200': - description: A successful response. - schema: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is 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 - value: - type: string - format: byte - tags: - - Query /babylon/btclightclient/v1/tip: get: summary: Tip return best header on canonical chain @@ -969,6 +1128,20 @@ paths: work: type: string format: byte + description: >- + BTCHeaderInfo is a structure that contains all relevant + information about a + + BTC header + - Full header bytes + - Header hash for easy retrieval + - 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. default: description: An unexpected error response. schema: @@ -1013,7 +1186,9 @@ paths: title: epoch_boundary is the height of this epoch's last block title: >- QueryCurrentEpochResponse is the response type for the - Query/CurrentEpoch RPC method + Query/CurrentEpoch RPC + + method default: description: An unexpected error response. schema: @@ -1128,7 +1303,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1138,7 +1313,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1169,7 +1344,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1237,6 +1411,16 @@ paths: - 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 block_height: @@ -1245,6 +1429,19 @@ paths: 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 records the + lifecycle of + + a delegation + title: |- + QueryDelegationLifecycleRequest is the response type for the + Query/DelegationLifecycle RPC method default: description: An unexpected error response. schema: @@ -1359,7 +1556,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1369,7 +1566,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1400,7 +1597,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1448,12 +1644,11 @@ paths: get: summary: >- EpochsInfo queries the metadata of epochs in a given range, depending on - the - parameters in the pagination request. Th main use case will be querying - the + the parameters in the pagination request. Th main use case will be + querying - latest epochs in time order. + the latest epochs in time order. operationId: EpochsInfo responses: '200': @@ -1481,11 +1676,15 @@ paths: this epoch. Babylon needs to remember the last header of each epoch - to complete unbonding validators/delegations when a - previous epoch's checkpoint is finalised. + to complete + + unbonding validators/delegations when a previous epoch's + checkpoint is - The last_block_header field is nil in the epoch's - beginning, and is set upon the end of this epoch. + finalised. The last_block_header field is nil in the + epoch's beginning, and + + is set upon the end of this epoch. type: object properties: version: @@ -1574,7 +1773,9 @@ paths: sealer_header is the 2nd header of the next epoch This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header + `last_commit_hash` of + + the sealer header type: object properties: version: @@ -1650,9 +1851,8 @@ paths: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint block - header. + description: Header defines the structure of a block header. + title: Epoch is a structure that contains the metadata of an epoch pagination: title: pagination defines the pagination in the response type: object @@ -1682,6 +1882,9 @@ paths: repeated Bar results = 1; PageResponse page = 2; } + title: >- + QueryEpochsInfoResponse is the response type for the + Query/EpochInfos method default: description: An unexpected error response. schema: @@ -1796,7 +1999,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -1806,7 +2009,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -1837,7 +2040,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -1875,16 +2077,6 @@ paths: "value": "1.212s" } parameters: - - name: start_epoch - in: query - required: false - type: string - format: uint64 - - name: end_epoch - in: query - required: false - type: string - format: uint64 - name: pagination.key description: |- key is a value returned in PageResponse.next_key to begin @@ -1971,11 +2163,15 @@ paths: epoch. Babylon needs to remember the last header of each epoch to - complete unbonding validators/delegations when a previous - epoch's checkpoint is finalised. + complete + + unbonding validators/delegations when a previous epoch's + checkpoint is - The last_block_header field is nil in the epoch's - beginning, and is set upon the end of this epoch. + finalised. The last_block_header field is nil in the + epoch's beginning, and + + is set upon the end of this epoch. type: object properties: version: @@ -2064,7 +2260,9 @@ paths: sealer_header is the 2nd header of the next epoch This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header + `last_commit_hash` of + + the sealer header type: object properties: version: @@ -2140,7 +2338,11 @@ paths: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. + title: Epoch is a structure that contains the metadata of an epoch + title: >- + QueryEpochInfoRequest is the response type for the Query/EpochInfo + method default: description: An unexpected error response. schema: @@ -2255,7 +2457,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2265,7 +2467,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2296,7 +2498,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -2537,7 +2738,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2547,7 +2748,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2578,7 +2779,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -2725,7 +2925,9 @@ paths: destination validator. title: >- QueuedMessage is a message that can change the validator set - and is delayed to the epoch boundary + and is delayed + + to the epoch boundary title: msgs is the list of messages queued in the current epoch pagination: title: pagination defines the pagination in the response @@ -2758,7 +2960,9 @@ paths: } title: >- QueryEpochMsgsResponse is the response type for the - Query/EpochMsgs RPC method + Query/EpochMsgs RPC + + method default: description: An unexpected error response. schema: @@ -2873,7 +3077,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -2883,7 +3087,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -2914,7 +3118,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3039,6 +3242,7 @@ paths: 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 @@ -3070,6 +3274,11 @@ paths: repeated Bar results = 1; PageResponse page = 2; } + title: >- + QueryEpochValSetRequest is the response type for the + Query/EpochValSet RPC + + method default: description: An unexpected error response. schema: @@ -3184,7 +3393,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3194,7 +3403,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3225,7 +3434,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3330,7 +3538,9 @@ paths: get: summary: >- LatestEpochMsgs queries the messages within a given number of most - recent epochs + recent + + epochs operationId: LatestEpochMsgs responses: '200': @@ -3538,7 +3748,8 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in + Python. foo = Foo(...) any = Any() @@ -3548,7 +3759,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3579,7 +3790,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -3726,7 +3936,14 @@ paths: a destination validator. title: >- QueuedMessage is a message that can change the - validator set and is delayed to the epoch boundary + validator set and is delayed + + to the epoch boundary + title: >- + QueuedMessageList is a message that contains a list of + staking-related + + messages queued for an epoch title: >- epoch_msg_map is a list of QueuedMessageList @@ -3760,7 +3977,7 @@ paths: repeated Bar results = 1; PageResponse page = 2; } - title: >- + title: |- QueryLatestEpochMsgsResponse is the response type for the Query/LatestEpochMsgs RPC method default: @@ -3877,7 +4094,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -3887,7 +4104,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -3918,7 +4135,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -4163,7 +4379,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4173,7 +4389,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4204,7 +4420,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -4272,12 +4487,33 @@ paths: - 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 block_height: type: string format: uint64 block_time: type: string format: date-time + title: >- + ValStateUpdate is a messages that records a state update + of a validator + title: >- + ValidatorLifecycle is a message that records records the + lifecycle of + + a validator + title: |- + QueryValidatorLifecycleResponse is the response type for the + Query/ValidatorLifecycle RPC method default: description: An unexpected error response. schema: @@ -4392,7 +4628,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -4402,7 +4638,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -4433,7 +4669,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -4481,7 +4716,9 @@ paths: get: summary: >- BlsPublicKeyList queries a list of bls public keys of the validators at - a given epoch number. + a + + given epoch number. operationId: BlsPublicKeyList responses: '200': @@ -4504,7 +4741,9 @@ paths: format: uint64 title: >- ValidatorWithBlsKey couples validator address, voting power, - and its bls public key + and its bls + + public key pagination: description: pagination defines the pagination in the response. type: object @@ -4524,11 +4763,9 @@ paths: PageRequest.count_total was set, its value is undefined otherwise - description: >- + description: |- QueryBlsPublicKeyListResponse is the response type for the - Query/BlsPublicKeys - - RPC method. + Query/BlsPublicKeys RPC method. default: description: An unexpected error response. schema: @@ -4636,7 +4873,7 @@ paths: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -4680,7 +4917,7 @@ paths: - Query /babylon/checkpointing/v1/epochs:status_count: get: - summary: >- + summary: |- RecentEpochStatusCount queries the number of epochs with each status in recent epochs operationId: RecentEpochStatusCount @@ -4701,11 +4938,9 @@ paths: additionalProperties: type: string format: uint64 - description: >- + description: |- QueryRecentEpochStatusCountResponse is the response type for the - Query/EpochStatusCount - - RPC method. + Query/EpochStatusCount RPC method. default: description: An unexpected error response. schema: @@ -4732,7 +4967,9 @@ paths: - name: epoch_count description: >- epoch_count is the number of the most recent epochs to include in - the aggregation. + the + + aggregation. in: query required: false type: string @@ -4743,7 +4980,9 @@ paths: get: summary: >- LastCheckpointWithStatus queries the last checkpoint with a given status - or a more matured status + or + + a more matured status operationId: LastCheckpointWithStatus responses: '200': @@ -4765,7 +5004,9 @@ paths: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that - individual BLS sigs are signed on + individual BLS sigs are + + signed on bitmap: type: string format: byte @@ -4777,8 +5018,13 @@ paths: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated - from individual BLS sigs + from individual BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data + description: |- + QueryLastCheckpointWithStatusResponse is the response type for the + Query/LastCheckpointWithStatus RPC method. default: description: An unexpected error response. schema: @@ -4814,57 +5060,17 @@ paths: - CKPT_STATUS_FINALIZED tags: - Query - /babylon/checkpointing/v1/params: + /babylon/checkpointing/v1/raw_checkpoint/{epoch_num}: get: - summary: Parameters queries the parameters of the module. - operationId: CheckpointingParams + summary: RawCheckpoint queries a checkpoints at a given epoch number. + operationId: RawCheckpoint responses: '200': description: A successful response. schema: type: object properties: - params: - description: params holds all the parameters of this module. - type: object - description: >- - QueryParamsResponse is 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 - value: - type: string - format: byte - tags: - - Query - /babylon/checkpointing/v1/raw_checkpoint/{epoch_num}: - get: - summary: RawCheckpoint queries a checkpoints at a given epoch number. - operationId: RawCheckpoint - responses: - '200': - description: A successful response. - schema: - type: object - properties: - raw_checkpoint: + raw_checkpoint: type: object properties: ckpt: @@ -4881,7 +5087,9 @@ paths: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that - individual BLS sigs are signed on + individual BLS sigs are + + signed on bitmap: type: string format: byte @@ -4893,7 +5101,9 @@ paths: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated - from individual BLS sigs + from individual BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data status: type: string @@ -4905,7 +5115,7 @@ paths: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -4938,7 +5148,7 @@ paths: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -4953,18 +5163,27 @@ paths: format: uint64 title: >- block_height is the height of the Babylon block that - triggers the state update + 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 + that triggers the state + + update + description: >- + CheckpointStateUpdate defines a state transition on the + checkpoint. description: >- lifecycle defines the lifecycle of this checkpoint, i.e., - each state transition and + each state + + transition and the time (in both timestamp and block + height) of this - the time (in both timestamp and block height) of this transition. description: RawCheckpointWithMeta wraps the raw checkpoint with meta data. description: >- @@ -5003,10 +5222,12 @@ paths: format: uint64 tags: - Query - /babylon/checkpointing/v1/raw_checkpoints/{status}: + /babylon/checkpointing/v1/raw_checkpoints: get: - summary: RawCheckpointList queries all checkpoints that match the given status. - operationId: RawCheckpointList + summary: >- + RawCheckpoints queries checkpoints for a epoch range specified in + pagination params. + operationId: RawCheckpoints responses: '200': description: A successful response. @@ -5032,7 +5253,9 @@ paths: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that - individual BLS sigs are signed on + individual BLS sigs are + + signed on bitmap: type: string format: byte @@ -5044,7 +5267,9 @@ paths: format: byte title: >- bls_multi_sig defines the multi sig that is - aggregated from individual BLS sigs + aggregated from individual BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data status: type: string @@ -5056,7 +5281,7 @@ paths: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -5089,7 +5314,7 @@ paths: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -5104,18 +5329,27 @@ paths: format: uint64 title: >- block_height is the height of the Babylon block - that triggers the state update + 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 + that triggers the state + + update + description: >- + CheckpointStateUpdate defines a state transition on + the checkpoint. description: >- lifecycle defines the lifecycle of this checkpoint, - i.e., each state transition and + i.e., each state + + transition and the time (in both timestamp and block + height) of this - the time (in both timestamp and block height) of this transition. description: >- RawCheckpointWithMeta wraps the raw checkpoint with meta @@ -5143,7 +5377,7 @@ paths: was set, its value is undefined otherwise description: >- - QueryRawCheckpointListResponse is the response type for the + QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints RPC method. @@ -5170,17 +5404,6 @@ paths: type: string format: byte parameters: - - name: status - description: status defines the status of the raw checkpoints of the query - in: path - required: true - type: string - enum: - - CKPT_STATUS_ACCUMULATING - - CKPT_STATUS_SEALED - - CKPT_STATUS_SUBMITTED - - CKPT_STATUS_CONFIRMED - - CKPT_STATUS_FINALIZED - name: pagination.key description: |- key is a value returned in PageResponse.next_key to begin @@ -5239,306 +5462,161 @@ paths: type: boolean tags: - Query - /babylon/zoneconcierge/v1/chain_info/{chain_id}: + /babylon/checkpointing/v1/raw_checkpoints/{status}: get: - summary: ChainInfo queries the latest info of a chain in Babylon's view - operationId: ChainInfo + summary: RawCheckpointList queries all checkpoints that match the given status. + operationId: RawCheckpointList responses: '200': description: A successful response. schema: type: object properties: - chain_info: - title: chain_info is the info of the CZ - type: object - properties: - chain_id: - type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 + 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 + last_commit_hash: + type: string + format: byte + title: >- + last_commit_hash defines the 'LastCommitHash' that + individual BLS sigs are - (hash, height) jointly provides the position of the - header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, + 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 - including all blockchain data structures and the - rules of the application's + sigs + title: RawCheckpoint wraps the BLS multi sig with meta data + 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. - state transition machine. - chain_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 + 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 - height: + 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 + block_height: type: string - format: int64 - time: + format: uint64 + title: >- + block_height is the height of the Babylon block + that triggers the state + + update + block_time: type: string format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte + title: >- + block_time is the timestamp in the Babylon block + that triggers the state + + update description: >- - Header defines the structure of a Tendermint block - 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 - latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) - type: object - properties: - headers: - type: array - items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon - block that includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint - block 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. + CheckpointStateUpdate defines a state transition on + the checkpoint. + description: >- + lifecycle defines the lifecycle of this checkpoint, + i.e., each state - Also note that the IBC-Go implementation will only - consider the first header in a fork valid, since + transition and the time (in both timestamp and block + height) of this - the subsequent headers cannot be verified without knowing - the validator set in the previous header. - timestamped_headers_count: + transition. + description: >- + RawCheckpointWithMeta wraps the raw checkpoint with meta + data. + 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: >- - timestamped_headers_count is the number of timestamped - headers in CZ's canonical chain - description: >- - QueryChainInfoResponse is response type for the Query/ChainInfo - RPC method. + 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. default: description: An unexpected error response. schema: @@ -5558,488 +5636,365 @@ paths: 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 + value: + type: string + format: byte + parameters: + - name: status + description: status defines the status of the raw checkpoints of the query + in: path + required: true + type: string + enum: + - CKPT_STATUS_ACCUMULATING + - CKPT_STATUS_SEALED + - CKPT_STATUS_SUBMITTED + - CKPT_STATUS_CONFIRMED + - CKPT_STATUS_FINALIZED + - 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. - one "/" character. The last segment of the URL's path - must represent + It is less efficient than using key. Only one of offset or key + should - the fully qualified name of the type (as in + 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. - `path/google.protobuf.Duration`). The name should be in - a canonical form + 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 - (e.g., leading "." is not accepted). + 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 - In practice, teams usually precompile into the binary - all types that they + 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. - 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); - } - - 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: chain_id - in: path - required: true - type: string + Since: cosmos-sdk 0.43 + in: query + required: false + type: boolean tags: - Query - /babylon/zoneconcierge/v1/chain_info/{chain_id}/epochs/{epoch_num}: + /babylon/zoneconcierge/v1/chain_info/{chain_id}/header/{height}: get: - summary: >- - EpochChainInfo queries the latest info of a chain in a given epoch of - Babylon's view - operationId: EpochChainInfo + 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: - chain_info: - title: chain_info is the info of the CZ + header: type: object properties: chain_id: type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header type: object properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing + a block in the blockchain, + + including all blockchain data structures and the rules + of the application's + + state transition machine. chain_id: type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: + hash: type: string - format: date-time - last_block_id: - title: prev block info + format: byte + part_set_header: type: object properties: + total: + type: integer + format: int64 hash: type: string format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint block - header. - babylon_epoch: + title: PartsetHeader + last_commit_hash: type: string - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: + format: byte + title: hashes of block data + data_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 - latest_forks: + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) - type: object - properties: - headers: - type: array - items: + 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: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block + that includes this CZ + + header type: object properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. chain_id: type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon - block that includes this CZ header + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: + hash: type: string - format: date-time - last_block_id: - title: prev block info + format: byte + part_set_header: type: object properties: + total: + type: integer + format: int64 hash: type: string format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint - block header. - babylon_epoch: + title: PartsetHeader + last_commit_hash: type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: + format: byte + title: hashes of block data + data_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. + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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 - For example, assuming the following blockchain + (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. - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + For example, assuming the following blockchain - Then the fork will be {[D1, D2]} where each item is in - struct `IndexedBlock`. + ``` + 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. + Note that each `IndexedHeader` in the fork should have a valid + quorum - Also note that the IBC-Go implementation will only - consider the first header in a fork valid, since + certificate. Such forks exist since Babylon considers CZs + might have - the subsequent headers cannot be verified without knowing - the validator set in the previous header. - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped - headers in CZ's canonical chain + 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: >- - QueryEpochChainInfoResponse is response type for the - Query/EpochChainInfo RPC method. + QueryHeaderResponse is response type for the Query/Header RPC + method. default: description: An unexpected error response. schema: @@ -6154,7 +6109,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6164,7 +6119,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6195,7 +6150,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -6237,316 +6191,87 @@ paths: in: path required: true type: string - - name: epoch_num + - name: height in: path required: true type: string format: uint64 tags: - Query - /babylon/zoneconcierge/v1/chain_info/{chain_id}/header/{height}: + /babylon/zoneconcierge/v1/chains: get: - summary: Header queries the CZ header and fork headers at a given height. - operationId: Header + summary: ChainList queries the list of chains that checkpoint to Babylon + operationId: ChainList responses: '200': description: A successful response. schema: type: object properties: - header: + chain_ids: + type: array + items: + type: string + title: >- + chain_ids are IDs of the chains in ascending alphabetical + order + pagination: + title: pagination defines the pagination in the response type: object properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, + was set, its value is undefined otherwise + description: >- + PageResponse is to be embedded in gRPC response messages where + the - including all blockchain data structures and the rules - of the application's + corresponding request message has used PageRequest. - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block 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 + 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 - (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: - type: array - items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block - that includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint block - 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. - description: >- - QueryParamsResponse 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 - - protocol buffer message. This string must contain at - least + protocol buffer message. This string must contain at + least one "/" character. The last segment of the URL's path must represent @@ -6636,7 +6361,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6646,7 +6371,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6677,7 +6402,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -6715,66 +6439,381 @@ paths: "value": "1.212s" } parameters: - - name: chain_id - in: path - required: true + - 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 - - name: height - in: path - required: true + 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/chains: + /babylon/zoneconcierge/v1/chains_info: get: - summary: ChainList queries the list of chains that checkpoint to Babylon - operationId: ChainList + 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: - chain_ids: + chains_info: type: array items: - type: string - title: >- - chain_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 - - 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. + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: >- - QueryChainListResponse is response type for the Query/ChainList - RPC method + (hash, height) jointly provides the position of the + header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block + that includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon + block that includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures + and the rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: >- + hashes from the app output from the prev + block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: >- + Header defines the structure of a block + 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 + description: >- + QueryChainsInfoResponse is response type for the Query/ChainsInfo + RPC method. default: description: An unexpected error response. schema: @@ -6889,7 +6928,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -6899,7 +6938,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -6930,7 +6969,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -6968,809 +7006,335 @@ paths: "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. - - 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 + - name: chain_ids in: query required: false - type: boolean + type: array + items: + type: string + collectionFormat: multi tags: - Query - /babylon/zoneconcierge/v1/finalized_chain_info/{chain_id}: + /babylon/zoneconcierge/v1/epoch_chains_info: get: - summary: >- - FinalizedChainInfo queries the BTC-finalised info of a chain, with - proofs - operationId: FinalizedChainInfo + 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: - finalized_chain_info: - title: finalized_chain_info is the info of the CZ - type: object - properties: - chain_id: - type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and the - rules of the application's + chains_info: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint block - 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 + (hash, height) jointly provides the position of the + header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block + that includes this CZ - (babylon_block_height, babylon_tx_hash) jointly - provides the position of the header on Babylon ledger - latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) - type: object - properties: - headers: - type: array - items: + header type: object properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. chain_id: type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon - block that includes this CZ header + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, - - including all blockchain data structures and - the rules of the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: + hash: type: string - format: date-time - last_block_id: - title: prev block info + format: byte + part_set_header: type: object properties: + total: + type: integer + format: int64 hash: type: string format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: >- - hashes from the app output from the prev - block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint - block header. - babylon_epoch: + title: PartsetHeader + last_commit_hash: type: string - format: uint64 - title: >- - epoch is the epoch number of this header on - Babylon ledger - babylon_tx_hash: + format: byte + title: hashes of block data + data_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 + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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 - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + 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: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon + block that includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, - Then the fork will be {[D1, D2]} where each item is in - struct `IndexedBlock`. + including all blockchain data structures + and the rules of the application's + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: >- + hashes from the app output from the prev + block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: >- + Header defines the structure of a block + 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 - Note that each `IndexedHeader` in the fork should have a - valid quorum certificate. + (babylon_block_height, babylon_tx_hash) + jointly provides the position of - Such forks exist since Babylon considers CZs might have - dishonest majority. + 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. - Also note that the IBC-Go implementation will only - consider the first header in a fork valid, since + For example, assuming the following blockchain - the subsequent headers cannot be verified without knowing - the validator set in the previous header. - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped - headers in CZ's canonical chain - epoch_info: - title: epoch_info is the metadata of the last BTC-finalised epoch - type: object - properties: - epoch_number: - type: string - format: uint64 - current_epoch_interval: - type: string - format: uint64 - first_block_height: - type: string - format: uint64 - last_block_header: - description: >- - last_block_header is the header of the last block in this - epoch. + ``` - Babylon needs to remember the last header of each epoch to - complete unbonding validators/delegations when a previous - epoch's checkpoint is finalised. + A <- B <- C <- D <- E + \ -- D1 + \ -- D2 + ``` - The last_block_header field is nil in the epoch's - beginning, and is set upon the end of this epoch. - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, + Then the fork will be {[D1, D2]} where each item is in + struct `IndexedBlock`. - including all blockchain data structures and the rules - of the application's - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - app_hash_root: - type: string - format: byte - title: >- - app_hash_root is the Merkle root of all AppHashs in this - epoch + Note that each `IndexedHeader` in the fork should have a + valid quorum - It will be used for proving a block is in an epoch - sealer_header: - title: >- - sealer_header is the 2nd header of the next epoch + certificate. Such forks exist since Babylon considers + CZs might have - This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing - a block in the blockchain, + dishonest majority. Also note that the IBC-Go + implementation will only - including all blockchain data structures and the rules - of the application's + consider the first header in a fork valid, since the + subsequent headers - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block header. - 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 - last_commit_hash: - type: string - format: byte - title: >- - last_commit_hash defines the 'LastCommitHash' 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 + cannot be verified without knowing the validator set in + the previous header. title: >- - Each provided OP_RETURN transaction can be idendtified - 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_tx_in_block: - title: >- - proof_tx_in_block is the proof that tx that carries the - header is included in a certain Babylon block - type: object - properties: - root_hash: - type: string - format: byte - data: - type: string - format: byte - proof: - type: object - properties: - total: - type: string - format: int64 - index: - type: string - format: int64 - leaf_hash: - type: string - format: byte - aunts: - type: array - items: - type: string - format: byte - description: >- - TxProof represents a Merkle proof of the presence of a - transaction in the Merkle tree. - proof_header_in_epoch: - type: object - properties: - total: - type: string - format: int64 - index: - type: string - format: int64 - leaf_hash: - type: string - format: byte - aunts: - type: array - items: - type: string - format: byte - title: >- - proof_header_in_epoch is the proof that the Babylon header - is in a certain epoch - 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 - bls_pub_key: - type: string - format: byte - voting_power: - type: string - format: uint64 - 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 - `last_commit_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 - nessecary 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 - nessecary 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 - idendtified 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 + latest_forks is the latest forks, formed as a series of + IndexedHeader (from - valideated the proof? + low to high) + timestamped_headers_count: + type: string + format: uint64 title: >- - TransactionInfo is the info of a tx that contains - Babylon checkpoint, 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 + timestamped_headers_count is the number of timestamped + headers in CZ's - It is the two TransactionInfo in the best (i.e., earliest) - checkpoint submission + canonical chain + title: ChainInfo is the information of a CZ + title: chain_info is the info of the CZ description: >- - QueryFinalizedChainInfoResponse is response type for the - Query/FinalizedChainInfo RPC method. + QueryEpochChainsInfoResponse is response type for the + Query/EpochChainsInfo RPC + + method. default: description: An unexpected error response. schema: @@ -7885,7 +7449,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -7895,7 +7459,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -7926,7 +7490,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -7964,25 +7527,27 @@ paths: "value": "1.212s" } parameters: - - name: chain_id - description: chain_id is the ID of the CZ - in: path - required: true + - name: epoch_num + in: query + required: false type: string - - name: prove - description: >- - prove indicates whether the querier wants to get proofs of this - timestamp. + format: uint64 + - name: chain_ids in: query required: false - type: boolean + type: array + items: + type: string + collectionFormat: multi tags: - Query /babylon/zoneconcierge/v1/finalized_chain_info/{chain_id}/height/{height}: get: summary: >- FinalizedChainInfoUntilHeight queries the BTC-finalised info no later - than the provided CZ height, with proofs + than + + the provided CZ height, with proofs operationId: FinalizedChainInfoUntilHeight responses: '200': @@ -7991,14 +7556,12 @@ paths: type: object properties: finalized_chain_info: - title: finalized_chain_info is the info of the CZ type: object properties: chain_id: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -8019,7 +7582,9 @@ paths: babylon_header: title: >- babylon_header is the header of the babylon block that - includes this CZ header + includes this CZ + + header type: object properties: version: @@ -8095,9 +7660,7 @@ paths: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint block - header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -8112,11 +7675,11 @@ paths: this header (babylon_block_height, babylon_tx_hash) jointly - provides the position of the header on Babylon ledger + provides the position of + + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) type: object properties: headers: @@ -8142,7 +7705,9 @@ paths: babylon_header: title: >- babylon_header is the header of the babylon - block that includes this CZ header + block that includes this CZ + + header type: object properties: version: @@ -8220,9 +7785,7 @@ paths: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint - block header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -8237,8 +7800,9 @@ paths: includes this header (babylon_block_height, babylon_tx_hash) jointly - provides the position of the header on Babylon - ledger + 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 @@ -8261,22 +7825,33 @@ paths: Note that each `IndexedHeader` in the fork should have a - valid quorum certificate. + valid quorum + + certificate. Such forks exist since Babylon considers CZs + might have + + dishonest majority. Also note that the IBC-Go + implementation will only - Such forks exist since Babylon considers CZs might have - dishonest majority. + consider the first header in a fork valid, since the + subsequent headers - Also note that the IBC-Go implementation will only - consider the first header in a fork valid, since + 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 - the subsequent headers cannot be verified without knowing - the validator set in the previous header. + 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 + 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 @@ -8296,11 +7871,15 @@ paths: epoch. Babylon needs to remember the last header of each epoch to - complete unbonding validators/delegations when a previous - epoch's checkpoint is finalised. + complete + + unbonding validators/delegations when a previous epoch's + checkpoint is - The last_block_header field is nil in the epoch's - beginning, and is set upon the end of this epoch. + finalised. The last_block_header field is nil in the + epoch's beginning, and + + is set upon the end of this epoch. type: object properties: version: @@ -8389,7 +7968,9 @@ paths: sealer_header is the 2nd header of the next epoch This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header + `last_commit_hash` of + + the sealer header type: object properties: version: @@ -8465,7 +8046,7 @@ paths: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. raw_checkpoint: title: raw_checkpoint is the raw checkpoint of this epoch type: object @@ -8481,7 +8062,9 @@ paths: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that - individual BLS sigs are signed on + individual BLS sigs are + + signed on bitmap: type: string format: byte @@ -8493,11 +8076,15 @@ paths: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated - from individual BLS sigs + 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 + raw + + checkpoint of this epoch type: object properties: key: @@ -8524,7 +8111,9 @@ paths: proof_tx_in_block: title: >- proof_tx_in_block is the proof that tx that carries the - header is included in a certain Babylon block + header is included + + in a certain Babylon block type: object properties: root_hash: @@ -8572,7 +8161,9 @@ paths: format: byte title: >- proof_header_in_epoch is the proof that the Babylon header - is in a certain epoch + is in a certain + + epoch proof_epoch_sealed: title: proof_epoch_sealed is the proof that the epoch is sealed type: object @@ -8592,17 +8183,22 @@ paths: format: uint64 title: >- ValidatorWithBlsKey couples validator address, - voting power, and its bls public key + 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 - `last_commit_hash` of the sealer header + `last_commit_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 + metadata is committed + + to `app_hash` of the sealer header type: object properties: ops: @@ -8629,8 +8225,9 @@ paths: 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 + validator set is + + committed to `app_hash` of the sealer header type: object properties: ops: @@ -8707,7 +8304,9 @@ paths: valideated the proof? title: >- TransactionInfo is the info of a tx that contains - Babylon checkpoint, including + Babylon checkpoint, + + including - the position of the tx on BTC blockchain @@ -8716,13 +8315,17 @@ paths: - 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 + checkpoint is included + + in BTC ledger It is the two TransactionInfo in the best + (i.e., earliest) - It is the two TransactionInfo in the best (i.e., earliest) checkpoint submission description: >- QueryFinalizedChainInfoUntilHeightResponse is response type for - the Query/FinalizedChainInfoUntilHeight RPC method. + the + + Query/FinalizedChainInfoUntilHeight RPC method. default: description: An unexpected error response. schema: @@ -8837,7 +8440,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -8847,7 +8450,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -8878,7 +8481,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -8926,7 +8528,9 @@ paths: height is the height of the CZ chain such that the returned finalised chain info will be no later than - this height + this + + height in: path required: true type: string @@ -8940,188 +8544,829 @@ paths: type: boolean tags: - Query - /babylon/zoneconcierge/v1/headers/{chain_id}: + /babylon/zoneconcierge/v1/finalized_chains_info: get: summary: >- - ListHeaders queries the headers of a chain in Babylon's view, with - pagination support - operationId: ListHeaders + 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: - headers: + finalized_chains_info: type: array items: type: object properties: chain_id: type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header + title: chain_id is the ID of the chain + finalized_chain_info: type: object properties: - version: - title: basic block info + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: type: object properties: - block: + chain_id: + type: string + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: type: string format: uint64 - app: + title: >- + height is the height of this header on CZ ledger + + (hash, height) jointly provides the position of + the header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon + block that includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and + the rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: >- + hashes from the app output from the prev + block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the + babylon block that includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules + for processing a block in the + blockchain, + + including all blockchain data structures + and the rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: >- + hashes from the app output from the prev + block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: >- + Header defines the structure of a block + 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: >- - Consensus captures the consensus rules for - processing a block in the blockchain, + Forks is a list of non-canonical `IndexedHeader`s at + the same height. - including all blockchain data structures and the - rules of the application's + For example, assuming the following blockchain - state transition machine. - chain_id: + ``` + + 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 - height: + 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: int64 - time: + format: uint64 + current_epoch_interval: type: string - format: date-time - last_block_id: - title: prev block info + format: uint64 + first_block_height: + type: string + format: uint64 + last_block_header: + description: >- + last_block_header is the header of the last block in + this epoch. + + Babylon needs to remember the last header of each + epoch to complete + + unbonding validators/delegations when a previous + epoch's checkpoint is + + finalised. The last_block_header field is nil in the + epoch's beginning, and + + is set upon the end of this epoch. type: object properties: - hash: - type: string - format: byte - part_set_header: + version: + title: basic block info type: object properties: - total: - type: integer - format: int64 - hash: + block: type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + app_hash_root: type: string format: byte - app_hash: + title: >- + app_hash_root is the Merkle root of all AppHashs in + this epoch + + It will be used for proving a block is in an epoch + sealer_header: + title: >- + sealer_header is the 2nd header of the next epoch + + This validator set has generated a BLS multisig on + `last_commit_hash` of + + the sealer header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + raw_checkpoint: + title: raw_checkpoint is the raw checkpoint of this epoch + type: object + properties: + epoch_num: type: string - format: byte - last_results_hash: + format: uint64 + title: >- + epoch_num defines the epoch number the raw + checkpoint is for + last_commit_hash: type: string format: byte - evidence_hash: + title: >- + last_commit_hash defines the 'LastCommitHash' that + individual BLS sigs are + + signed on + bitmap: type: string format: byte - title: consensus info - proposer_address: + title: >- + bitmap defines the bitmap that indicates the signers + of the BLS multi sig + bls_multi_sig: type: string format: byte - description: >- - Header defines the structure of a Tendermint block - 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 + title: >- + bls_multi_sig defines the multi sig that is + aggregated from individual BLS - (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 + sigs + btc_submission_key: + title: >- + btc_submission_key is position of two BTC txs that + include the raw - was set, its value is undefined otherwise - description: >- - PageResponse is to be embedded in gRPC response messages where - the + 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 + idendtified by hash of block in - corresponding request message has used PageRequest. + 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_tx_in_block: + title: >- + proof_tx_in_block is the proof that tx that carries + the header is included - 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 + in a certain Babylon block + type: object + properties: + root_hash: + type: string + format: byte + data: + type: string + format: byte + proof: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + description: >- + TxProof represents a Merkle proof of the presence of + a transaction in the Merkle tree. + proof_header_in_epoch: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + title: >- + proof_header_in_epoch is the proof that the Babylon + header is in a certain + + epoch + 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 + bls_pub_key: + type: string + format: byte + voting_power: + type: string + format: uint64 + 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 `last_commit_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 nessecary 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 nessecary 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 + idendtified 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 + + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains + Babylon checkpoint, + + 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 @@ -9217,7 +9462,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -9227,7 +9472,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -9258,7 +9503,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -9296,74 +9540,29 @@ paths: "value": "1.212s" } parameters: - - name: chain_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. + - name: chain_ids + description: chain_ids is the list of ids of CZs. in: query required: false - type: boolean - - name: pagination.reverse + type: array + items: + type: string + collectionFormat: multi + - name: prove description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 + prove indicates whether the querier wants to get proofs of this + timestamp. in: query required: false type: boolean tags: - Query - /babylon/zoneconcierge/v1/headers/{chain_id}/epochs/{epoch_num}: + /babylon/zoneconcierge/v1/headers/{chain_id}: get: - summary: >- - ListEpochHeaders queries the headers of a chain timestamped in a given - epoch of Babylon, with pagination support - operationId: ListEpochHeaders + summary: |- + ListHeaders queries the headers of a chain in Babylon's view, with + pagination support + operationId: ListHeaders responses: '200': description: A successful response. @@ -9393,7 +9592,9 @@ paths: babylon_header: title: >- babylon_header is the header of the babylon block that - includes this CZ header + includes this CZ + + header type: object properties: version: @@ -9469,9 +9670,7 @@ paths: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint block - header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -9486,12 +9685,45 @@ paths: header (babylon_block_height, babylon_tx_hash) jointly provides - the position of the header on Babylon ledger + 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: >- - QueryListEpochHeadersResponse is response type for the - Query/ListEpochHeaders RPC method. + QueryListHeadersResponse is response type for the + Query/ListHeaders RPC + + method. default: description: An unexpected error response. schema: @@ -9606,7 +9838,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -9616,7 +9848,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -9647,7 +9879,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -9689,38 +9920,211 @@ paths: in: path required: true type: string - - name: epoch_num - in: path - required: true + - 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 - tags: - - Query - /babylon/zoneconcierge/v1/params: - get: - summary: Parameters 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 - description: >- - QueryParamsResponse is response type for the Query/Params RPC - method. - default: - description: An unexpected error response. - schema: - type: object - properties: - error: - type: string - code: - type: integer + - 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/{chain_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: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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 @@ -9826,7 +10230,7 @@ paths: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -9836,7 +10240,7 @@ paths: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -9867,7 +10271,6 @@ paths: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -9904,6 +10307,16 @@ paths: "@type": "type.googleapis.com/google.protobuf.Duration", "value": "1.212s" } + parameters: + - name: chain_id + in: path + required: true + type: string + - name: epoch_num + in: path + required: true + type: string + format: uint64 tags: - Query definitions: @@ -9914,15 +10327,82 @@ definitions: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - vigilante_address_list: + title: >- + hash of the btc block which determines checkpoint btc block height + i.e. + + youngest block of best submission + best_submission_transactions: + type: array + items: + type: object + properties: + key: + 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. + type: object + properties: + index: + type: integer + format: int64 + hash: + type: string + format: byte + title: >- + Each provided OP_RETURN transaction can be idendtified by hash + of block in + + which transaction was included and transaction index in the + block + 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 + + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains Babylon + checkpoint, + + 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 @@ -9933,17 +10413,30 @@ definitions: description: >- TODO: this could probably be better typed - Address of the checkpoint submitter, extracted from the - checkpoint itself. + submitter is the address of the checkpoint submitter to BTC, + extracted from + + the checkpoint itself. reporter: type: string format: byte title: >- - Address of the reporter which reported the submissions, - calculated from + reporter is the address of the reporter who reported the + submissions, + + calculated from submission message MsgInsertBTCSpvProof itself + title: >- + CheckpointAddresses contains the addresses of the submitter and + reporter of a + + given checkpoint + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of checkpoint + for - submission message MsgInsertBTCSpvProof itself - title: list of vigilantes' addresses + given epoch. Best submission is the submission which is deeper in btc + ledger babylon.btccheckpoint.v1.CheckpointAddresses: type: object properties: @@ -9953,16 +10446,21 @@ definitions: description: >- TODO: this could probably be better typed - Address of the checkpoint submitter, extracted from the checkpoint - itself. - reporter: + submitter is the address of the checkpoint submitter to BTC, extracted + from + + the checkpoint itself. + reporter: type: string format: byte - title: >- - Address of the reporter which reported the submissions, calculated - from + title: |- + reporter is the address of the reporter who reported the submissions, + calculated from submission message MsgInsertBTCSpvProof itself + title: >- + CheckpointAddresses contains the addresses of the submitter and reporter + of a - submission message MsgInsertBTCSpvProof itself + given checkpoint babylon.btccheckpoint.v1.Params: type: object properties: @@ -9981,16 +10479,26 @@ definitions: format: uint64 title: >- checkpoint_finalization_timeout is the maximum time window (measured - in BTC blocks) between a checkpoint + 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 + BBN - (w in research paper) + 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 @@ -10002,15 +10510,82 @@ definitions: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - vigilante_address_list: + title: >- + hash of the btc block which determines checkpoint btc block height + i.e. + + youngest block of best submission + best_submission_transactions: + type: array + items: + type: object + properties: + key: + 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. + type: object + properties: + index: + type: integer + format: int64 + hash: + type: string + format: byte + title: >- + Each provided OP_RETURN transaction can be idendtified by + hash of block in + + which transaction was included and transaction index in the + block + 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 + + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains Babylon + checkpoint, + + 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 @@ -10021,18 +10596,32 @@ definitions: description: >- TODO: this could probably be better typed - Address of the checkpoint submitter, extracted from the - checkpoint itself. + submitter is the address of the checkpoint submitter to BTC, + extracted from + + the checkpoint itself. reporter: type: string format: byte title: >- - Address of the reporter which reported the submissions, - calculated from + reporter is the address of the reporter who reported the + submissions, - submission message MsgInsertBTCSpvProof itself - title: list of vigilantes' addresses - title: >- + calculated from submission message MsgInsertBTCSpvProof + itself + title: >- + CheckpointAddresses contains the addresses of the submitter and + reporter of a + + given checkpoint + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo 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: @@ -10047,15 +10636,82 @@ definitions: type: string format: uint64 title: epoch number of this checkpoint - earliest_btc_block_number: + best_submission_btc_block_height: type: string format: uint64 - title: height of earliest BTC block that includes this checkpoint - earliest_btc_block_hash: + title: btc height of the best submission of the epoch + best_submission_btc_block_hash: type: string format: byte - title: hash of earliest BTC block that includes this checkpoint - vigilante_address_list: + title: >- + hash of the btc block which determines checkpoint btc block + height i.e. + + youngest block of best submission + best_submission_transactions: + type: array + items: + type: object + properties: + key: + 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. + type: object + properties: + index: + type: integer + format: int64 + hash: + type: string + format: byte + title: >- + Each provided OP_RETURN transaction can be idendtified by + hash of block in + + which transaction was included and transaction index in + the block + 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 + + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains Babylon + checkpoint, + + 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 @@ -10066,17 +10722,31 @@ definitions: description: >- TODO: this could probably be better typed - Address of the checkpoint submitter, extracted from the - checkpoint itself. + submitter is the address of the checkpoint submitter to + BTC, extracted from + + the checkpoint itself. reporter: type: string format: byte title: >- - Address of the reporter which reported the submissions, - calculated from + reporter is the address of the reporter who reported the + submissions, + + calculated from submission message MsgInsertBTCSpvProof + itself + title: >- + CheckpointAddresses contains the addresses of the submitter + and reporter of a + + given checkpoint + title: list of vigilantes' addresses of the best submission + title: >- + BTCCheckpointInfo contains all data about best submission of + checkpoint for - submission message MsgInsertBTCSpvProof itself - title: list of vigilantes' addresses + given epoch. Best submission is the submission which is deeper in + btc ledger pagination: title: pagination defines the pagination in the response type: object @@ -10104,7 +10774,7 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - title: >- + title: |- QueryBtcCheckpointsInfoResponse is response type for the Query/BtcCheckpointsInfo RPC method babylon.btccheckpoint.v1.QueryEpochSubmissionsResponse: @@ -10139,20 +10809,17 @@ definitions: submission we need list of transaction keys. Each submission can generally be identified by this list of (txIdx, - blockHash) - tuples. + blockHash) tuples. Note: this could possibly be optimized as if + transactions - Note: this could possibly be optimized as if transactions were in - one block + were in one block they would have the same block hash and different + indexes, - 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 + but each blockhash is only 33 (1 byte for prefix encoding and 32 + byte hash), - be other strong arguments for this optimization + so there should be other strong arguments for this optimization description: All submissions saved during an epoch. pagination: type: object @@ -10180,6 +10847,9 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } + title: |- + QueryEpochSubmissionsResponse defines a response to get all submissions in + given epoch (QueryEpochSubmissionsRequest) babylon.btccheckpoint.v1.QueryParamsResponse: type: object properties: @@ -10202,16 +10872,26 @@ definitions: format: uint64 title: >- checkpoint_finalization_timeout is the maximum time window - (measured in BTC blocks) between a checkpoint + (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 + 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 - (w in research paper) + related to babylon description: QueryParamsResponse is response type for the Query/Params RPC method. babylon.btccheckpoint.v1.SubmissionKey: type: object @@ -10239,19 +10919,62 @@ definitions: submission we need list of transaction keys. Each submission can generally be identified by this list of (txIdx, - blockHash) - tuples. + 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, - Note: this could possibly be optimized as if transactions were in one - block + 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: + 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. + type: object + properties: + index: + type: integer + format: int64 + hash: + type: string + format: byte + title: >- + Each provided OP_RETURN transaction can be idendtified by hash of + block in - they would have the same block hash and different indexes, but each - blockhash + which transaction was included and transaction index in the block + 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` - is only 33 (1 byte for prefix encoding and 32 byte hash), so there should + TODO: maybe it could use here better format as we already processed + and - be other strong arguments for this optimization + valideated the proof? + title: |- + TransactionInfo is the info of a tx that contains Babylon checkpoint, + 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: @@ -10430,7 +11153,7 @@ definitions: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -10440,7 +11163,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -10467,7 +11190,6 @@ definitions: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -10607,7 +11329,7 @@ definitions: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -10617,7 +11339,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -10644,7 +11366,6 @@ definitions: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -10691,9 +11412,17 @@ definitions: work: type: string format: byte - babylon.btclightclient.v1.Params: - type: object - description: Params defines the parameters for the module. + description: >- + BTCHeaderInfo is a structure that contains all relevant information about + a + + BTC header + - Full header bytes + - Header hash for easy retrieval + - 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.QueryBaseHeaderResponse: type: object properties: @@ -10712,6 +11441,20 @@ definitions: work: type: string format: byte + description: >- + BTCHeaderInfo is a structure that contains all relevant information + about a + + BTC header + - Full header bytes + - Header hash for easy retrieval + - 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: @@ -10719,7 +11462,9 @@ definitions: type: boolean description: >- QueryContainsResponse is response type for the temporary - Query/ContainsBytes RPC method. + Query/ContainsBytes + + RPC method. babylon.btclightclient.v1.QueryContainsResponse: type: object properties: @@ -10781,6 +11526,17 @@ definitions: work: type: string format: byte + description: >- + BTCHeaderInfo is a structure that contains all relevant information + about a + + BTC header + - Full header bytes + - Header hash for easy retrieval + - 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: @@ -10810,13 +11566,6 @@ definitions: 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 - description: QueryParamsResponse is response type for the Query/Params RPC method. babylon.btclightclient.v1.QueryTipResponse: type: object properties: @@ -10835,6 +11584,18 @@ definitions: work: type: string format: byte + description: >- + BTCHeaderInfo is a structure that contains all relevant information + about a + + BTC header + - Full header bytes + - Header hash for easy retrieval + - 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: @@ -10844,6 +11605,13 @@ definitions: - 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: @@ -10863,6 +11631,14 @@ definitions: - 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 block_height: @@ -10871,6 +11647,14 @@ definitions: 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 records the lifecycle of + a delegation babylon.epoching.v1.DelegationStateUpdate: type: object properties: @@ -10883,6 +11667,13 @@ definitions: - 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 block_height: @@ -10891,6 +11682,9 @@ definitions: block_time: type: string format: date-time + title: |- + DelegationStateUpdate is the message that records a state update of a + delegation babylon.epoching.v1.Epoch: type: object properties: @@ -10908,11 +11702,13 @@ definitions: last_block_header is the header of the last block in this epoch. Babylon needs to remember the last header of each epoch to complete + unbonding validators/delegations when a previous epoch's checkpoint is - finalised. - The last_block_header field is nil in the epoch's beginning, and is - set upon the end of this epoch. + finalised. The last_block_header field is nil in the epoch's + beginning, and + + is set upon the end of this epoch. type: object properties: version: @@ -10999,7 +11795,9 @@ definitions: sealer_header is the 2nd header of the next epoch This validator set has generated a BLS multisig on `last_commit_hash` - of the sealer header + of + + the sealer header type: object properties: version: @@ -11075,7 +11873,8 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. + title: Epoch is a structure that contains the metadata of an epoch babylon.epoching.v1.Params: type: object properties: @@ -11097,7 +11896,9 @@ definitions: title: epoch_boundary is the height of this epoch's last block title: >- QueryCurrentEpochResponse is the response type for the Query/CurrentEpoch - RPC method + RPC + + method babylon.epoching.v1.QueryDelegationLifecycleResponse: type: object properties: @@ -11120,6 +11921,14 @@ definitions: - 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 block_height: @@ -11128,6 +11937,17 @@ definitions: 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 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: @@ -11148,10 +11968,14 @@ definitions: last_block_header is the header of the last block in this epoch. Babylon needs to remember the last header of each epoch to - complete unbonding validators/delegations when a previous epoch's - checkpoint is finalised. + complete + + unbonding validators/delegations when a previous epoch's + checkpoint is + + finalised. The last_block_header field is nil in the epoch's + beginning, and - The last_block_header field is nil in the epoch's beginning, and is set upon the end of this epoch. type: object properties: @@ -11239,7 +12063,9 @@ definitions: sealer_header is the 2nd header of the next epoch This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header + `last_commit_hash` of + + the sealer header type: object properties: version: @@ -11315,7 +12141,9 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. + title: Epoch 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: @@ -11499,7 +12327,7 @@ definitions: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -11509,7 +12337,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -11540,7 +12368,6 @@ definitions: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -11681,7 +12508,9 @@ definitions: validator. title: >- QueuedMessage is a message that can change the validator set and is - delayed to the epoch boundary + delayed + + to the epoch boundary title: msgs is the list of messages queued in the current epoch pagination: title: pagination defines the pagination in the response @@ -11710,7 +12539,7 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - title: >- + title: |- QueryEpochMsgsResponse is the response type for the Query/EpochMsgs RPC method babylon.epoching.v1.QueryEpochValSetResponse: @@ -11729,6 +12558,7 @@ definitions: 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 @@ -11758,6 +12588,9 @@ definitions: 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: @@ -11780,10 +12613,14 @@ definitions: last_block_header is the header of the last block in this epoch. Babylon needs to remember the last header of each epoch to - complete unbonding validators/delegations when a previous - epoch's checkpoint is finalised. + complete + + unbonding validators/delegations when a previous epoch's + checkpoint is + + finalised. The last_block_header field is nil in the epoch's + beginning, and - The last_block_header field is nil in the epoch's beginning, and is set upon the end of this epoch. type: object properties: @@ -11871,7 +12708,9 @@ definitions: sealer_header is the 2nd header of the next epoch This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header + `last_commit_hash` of + + the sealer header type: object properties: version: @@ -11947,7 +12786,8 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. + title: Epoch is a structure that contains the metadata of an epoch pagination: title: pagination defines the pagination in the response type: object @@ -11975,6 +12815,9 @@ definitions: 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: @@ -12170,7 +13013,7 @@ definitions: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -12180,7 +13023,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -12211,7 +13054,6 @@ definitions: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -12358,7 +13200,14 @@ definitions: destination validator. title: >- QueuedMessage is a message that can change the validator set - and is delayed to the epoch boundary + and is delayed + + to the epoch boundary + title: >- + QueuedMessageList is a message that contains a list of + staking-related + + messages queued for an epoch title: |- epoch_msg_map is a list of QueuedMessageList each QueuedMessageList has a field identifying the epoch number @@ -12388,7 +13237,7 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - title: >- + title: |- QueryLatestEpochMsgsResponse is the response type for the Query/LatestEpochMsgs RPC method babylon.epoching.v1.QueryParamsResponse: @@ -12427,12 +13276,29 @@ definitions: - 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 block_height: type: string format: uint64 block_time: type: string format: date-time + title: >- + ValStateUpdate is a messages that records a state update of a + validator + title: |- + ValidatorLifecycle is a message that records records the lifecycle of + a validator + title: |- + QueryValidatorLifecycleResponse is the response type for the + Query/ValidatorLifecycle RPC method babylon.epoching.v1.QueuedMessage: type: object properties: @@ -12604,7 +13470,7 @@ definitions: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -12614,7 +13480,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -12642,7 +13508,6 @@ definitions: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -12774,7 +13639,9 @@ definitions: validator. title: >- QueuedMessage is a message that can change the validator set and is - delayed to the epoch boundary + delayed + + to the epoch boundary babylon.epoching.v1.QueuedMessageList: type: object properties: @@ -12961,7 +13828,7 @@ definitions: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -12971,7 +13838,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -13002,7 +13869,6 @@ definitions: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -13143,7 +14009,12 @@ definitions: validator. title: >- QueuedMessage is a message that can change the validator set and is - delayed to the epoch boundary + delayed + + to the epoch boundary + title: |- + QueuedMessageList is a message that contains a list of staking-related + messages queued for an epoch babylon.epoching.v1.ValStateUpdate: type: object properties: @@ -13156,12 +14027,20 @@ definitions: - 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 block_height: type: string format: uint64 block_time: type: string format: date-time + title: ValStateUpdate is a messages that records a state update of a validator babylon.epoching.v1.Validator: type: object properties: @@ -13173,6 +14052,7 @@ definitions: type: string format: int64 title: power is the validator's voting power + title: Validator is a message that denotes a validator babylon.epoching.v1.ValidatorLifecycle: type: object properties: @@ -13192,12 +14072,26 @@ definitions: - 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 block_height: type: string format: uint64 block_time: type: string format: date-time + title: >- + ValStateUpdate is a messages that records a state update of a + validator + title: |- + ValidatorLifecycle is a message that records records the lifecycle of + a validator cosmos.base.v1beta1.Coin: type: object properties: @@ -13420,7 +14314,7 @@ definitions: foo = any.unpack(Foo.class); } - Example 3: Pack and unpack a message in Python. + Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() @@ -13430,7 +14324,7 @@ definitions: any.Unpack(foo) ... - Example 4: Pack and unpack a message in Go + Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) @@ -13457,7 +14351,6 @@ definitions: JSON - ==== The JSON representation of an `Any` value uses the regular @@ -13639,7 +14532,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. tendermint.types.PartSetHeader: type: object properties: @@ -13680,7 +14573,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -13693,13 +14586,18 @@ definitions: format: uint64 title: >- block_height is the height of the Babylon block that triggers the - state update + state + + update block_time: type: string format: date-time title: >- block_time is the timestamp in the Babylon block that triggers the - state update + state + + update + description: CheckpointStateUpdate defines a state transition on the checkpoint. babylon.checkpointing.v1.CheckpointStatus: type: string enum: @@ -13710,16 +14608,13 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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.Params: - type: object - description: Params defines the parameters for the module. babylon.checkpointing.v1.QueryBlsPublicKeyListResponse: type: object properties: @@ -13738,7 +14633,9 @@ definitions: format: uint64 title: >- ValidatorWithBlsKey couples validator address, voting power, and its - bls public key + bls + + public key pagination: description: pagination defines the pagination in the response. type: object @@ -13758,11 +14655,9 @@ definitions: PageRequest.count_total was set, its value is undefined otherwise - description: >- + description: |- QueryBlsPublicKeyListResponse is the response type for the - Query/BlsPublicKeys - - RPC method. + Query/BlsPublicKeys RPC method. babylon.checkpointing.v1.QueryEpochStatusResponse: type: object properties: @@ -13776,7 +14671,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -13801,7 +14696,9 @@ definitions: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that individual BLS - sigs are signed on + sigs are + + signed on bitmap: type: string format: byte @@ -13813,15 +14710,13 @@ definitions: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated from - individual BLS sigs + individual BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data - babylon.checkpointing.v1.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. + description: |- + QueryLastCheckpointWithStatusResponse is the response type for the + Query/LastCheckpointWithStatus RPC method. babylon.checkpointing.v1.QueryRawCheckpointListResponse: type: object properties: @@ -13842,7 +14737,9 @@ definitions: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that - individual BLS sigs are signed on + individual BLS sigs are + + signed on bitmap: type: string format: byte @@ -13854,7 +14751,9 @@ definitions: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated from - individual BLS sigs + individual BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data status: type: string @@ -13866,7 +14765,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -13899,7 +14798,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -13914,18 +14813,27 @@ definitions: format: uint64 title: >- block_height is the height of the Babylon block that - triggers the state update + 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 + triggers the state + + update + description: >- + CheckpointStateUpdate defines a state transition on the + checkpoint. description: >- lifecycle defines the lifecycle of this checkpoint, i.e., each - state transition and + state + + transition and the time (in both timestamp and block height) of + this - the time (in both timestamp and block height) of this transition. description: RawCheckpointWithMeta wraps the raw checkpoint with meta data. title: the order is going from the newest to oldest based on the epoch number @@ -13948,11 +14856,9 @@ definitions: PageRequest.count_total was set, its value is undefined otherwise - description: >- + description: |- QueryRawCheckpointListResponse is the response type for the - Query/RawCheckpoints - - RPC method. + Query/RawCheckpoints RPC method. babylon.checkpointing.v1.QueryRawCheckpointResponse: type: object properties: @@ -13971,7 +14877,9 @@ definitions: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that individual - BLS sigs are signed on + BLS sigs are + + signed on bitmap: type: string format: byte @@ -13983,7 +14891,9 @@ definitions: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated from - individual BLS sigs + individual BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data status: type: string @@ -13995,7 +14905,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -14026,7 +14936,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -14041,23 +14951,177 @@ definitions: format: uint64 title: >- block_height is the height of the Babylon block that - triggers the state update + 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 + triggers the state + + update + description: >- + CheckpointStateUpdate defines a state transition on the + checkpoint. description: >- lifecycle defines the lifecycle of this checkpoint, i.e., each - state transition and + state + + transition and the time (in both timestamp and block height) of + this - the time (in both timestamp and block height) of this transition. + transition. description: RawCheckpointWithMeta wraps the raw checkpoint with meta data. 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 + last_commit_hash: + type: string + format: byte + title: >- + last_commit_hash defines the 'LastCommitHash' 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 meta data + 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 + 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 + 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: >- + CheckpointStateUpdate 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: RawCheckpointWithMeta wraps the raw checkpoint with meta data. + 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 @@ -14073,11 +15137,9 @@ definitions: additionalProperties: type: string format: uint64 - description: >- + description: |- QueryRecentEpochStatusCountResponse is the response type for the - Query/EpochStatusCount - - RPC method. + Query/EpochStatusCount RPC method. babylon.checkpointing.v1.RawCheckpoint: type: object properties: @@ -14090,7 +15152,9 @@ definitions: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that individual BLS sigs - are signed on + are + + signed on bitmap: type: string format: byte @@ -14102,7 +15166,9 @@ definitions: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated from individual - BLS sigs + BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data babylon.checkpointing.v1.RawCheckpointWithMeta: type: object @@ -14119,7 +15185,9 @@ definitions: format: byte title: >- last_commit_hash defines the 'LastCommitHash' that individual BLS - sigs are signed on + sigs are + + signed on bitmap: type: string format: byte @@ -14131,7 +15199,9 @@ definitions: format: byte title: >- bls_multi_sig defines the multi sig that is aggregated from - individual BLS sigs + individual BLS + + sigs title: RawCheckpoint wraps the BLS multi sig with meta data status: type: string @@ -14143,7 +15213,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -14174,7 +15244,7 @@ definitions: - CKPT_STATUS_FINALIZED default: CKPT_STATUS_ACCUMULATING description: |- - CkptStatus is the status of a checkpoint. + 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. @@ -14187,18 +15257,22 @@ definitions: format: uint64 title: >- block_height is the height of the Babylon block that triggers - the state update + 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: >- - lifecycle defines the lifecycle of this checkpoint, i.e., each state - transition and + the state - the time (in both timestamp and block height) of this transition. + update + description: CheckpointStateUpdate 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: RawCheckpointWithMeta wraps the raw checkpoint with meta data. babylon.checkpointing.v1.ValidatorWithBlsKey: type: object @@ -14211,57 +15285,9 @@ definitions: voting_power: type: string format: uint64 - title: >- + title: |- ValidatorWithBlsKey couples validator address, voting power, and its bls public key - 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 idendtified 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 - - valideated the proof? - title: >- - TransactionInfo is the info of a tx that contains Babylon checkpoint, - 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.zoneconcierge.v1.ChainInfo: type: object properties: @@ -14269,7 +15295,6 @@ definitions: type: string title: chain_id is the ID of the chain latest_header: - title: latest_header is the latest header in CZ's canonical chain type: object properties: chain_id: @@ -14290,7 +15315,9 @@ definitions: babylon_header: title: >- babylon_header is the header of the babylon block that includes - this CZ header + this CZ + + header type: object properties: version: @@ -14366,7 +15393,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -14378,11 +15405,11 @@ definitions: 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 + position of + + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of IndexedHeader - (from low to high) type: object properties: headers: @@ -14408,7 +15435,9 @@ definitions: babylon_header: title: >- babylon_header is the header of the babylon block that - includes this CZ header + includes this CZ + + header type: object properties: version: @@ -14484,7 +15513,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -14497,7 +15526,9 @@ definitions: header (babylon_block_height, babylon_tx_hash) jointly provides the - position of the header on Babylon ledger + 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 @@ -14519,724 +15550,185 @@ definitions: Note that each `IndexedHeader` in the fork should have a valid quorum - certificate. - Such forks exist since Babylon considers CZs might have dishonest - majority. + 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 - Also note that the IBC-Go implementation will only consider the first - header in a fork valid, since + 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 - the subsequent headers cannot be verified without knowing the - validator set in the previous header. + low to high) timestamped_headers_count: type: string format: uint64 - title: >- + 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.Forks: - type: object - properties: - headers: - type: array - items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that includes - this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, - - including all blockchain data structures and the rules of - the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block 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. - babylon.zoneconcierge.v1.IndexedHeader: + babylon.zoneconcierge.v1.FinalizedChainInfo: type: object properties: chain_id: type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that includes this - CZ header + title: chain_id is the ID of the chain + finalized_chain_info: type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block in - the blockchain, - - including all blockchain data structures and the rules of the - application's - - state transition machine. chain_id: type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info + title: chain_id is the ID of the chain + latest_header: type: object properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain hash: type: string format: byte - part_set_header: + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header type: object properties: - total: - type: integer + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, + + including all blockchain data structures and the rules of + the application's + + state transition machine. + chain_id: + type: string + height: + type: string format: int64 - hash: + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: type: string format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block 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 - babylon.zoneconcierge.v1.Params: - type: object - description: Params defines the parameters for the module. - babylon.zoneconcierge.v1.ProofEpochSealed: - type: object - properties: - validator_set: - type: array - items: - type: object - properties: - validator_address: - type: string - bls_pub_key: - type: string - format: byte - voting_power: - type: string - format: uint64 - 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 `last_commit_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 nessecary 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 nessecary data - for example neighbouring node hash - 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 `last_commit_hash` is same as in the sealer header - - - More than 1/3 (in voting power) validators in the validator set of this - epoch have signed `last_commit_hash` of the sealer header - - - The epoch medatata is committed to the `app_hash` of the sealer header - - - The validator set is committed to the `app_hash` of the sealer header - babylon.zoneconcierge.v1.ProofFinalizedChainInfo: - type: object - properties: - proof_tx_in_block: - title: >- - proof_tx_in_block is the proof that tx that carries the header is - included in a certain Babylon block - type: object - properties: - root_hash: - type: string - format: byte - data: - type: string - format: byte - proof: - type: object - properties: - total: - type: string - format: int64 - index: + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: type: string - format: int64 - leaf_hash: + format: uint64 + title: epoch is the epoch number of this header on Babylon ledger + babylon_tx_hash: type: string format: byte - aunts: - type: array - items: - type: string - format: byte - description: >- - TxProof represents a Merkle proof of the presence of a transaction in - the Merkle tree. - proof_header_in_epoch: - type: object - properties: - total: - type: string - format: int64 - index: - type: string - format: int64 - leaf_hash: - type: string - format: byte - aunts: - type: array - items: - type: string - format: byte - title: >- - proof_header_in_epoch is the proof that the Babylon header is in a - certain epoch - 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 - bls_pub_key: - type: string - format: byte - voting_power: - type: string - format: uint64 - 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 - `last_commit_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 + title: >- + babylon_tx_hash is the hash of the tx that includes this + header - The data could be arbitrary format, providing nessecary data + (babylon_block_height, babylon_tx_hash) jointly provides the + position of - 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 + the header on Babylon ledger + title: IndexedHeader is the metadata of a CZ header + latest_forks: type: object properties: - ops: + headers: type: array items: type: object properties: - type: + chain_id: type: string - key: + title: chain_id is the unique ID of the chain + hash: type: string format: byte - data: + title: hash is the hash of this header + height: type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root + format: uint64 + title: >- + height is the height of this header on CZ ledger - The data could be arbitrary format, providing nessecary data + (hash, height) jointly provides the position of the + header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ - 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 idendtified 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 - - valideated the proof? - title: >- - TransactionInfo is the info of a tx that contains Babylon - checkpoint, 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: >- - ProofFinalizedChainInfo is a set of proofs that attest a chain info is - BTC-finalised - babylon.zoneconcierge.v1.QueryChainInfoResponse: - type: object - properties: - chain_info: - title: chain_info is the info of the CZ - type: object - properties: - chain_id: - type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, - - including all blockchain data structures and the rules of - the application's - - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block 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 - latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) - type: object - properties: - headers: - type: array - items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header + header type: object properties: version: @@ -15312,9 +15804,7 @@ definitions: proposer_address: type: string format: byte - description: >- - Header defines the structure of a Tendermint block - header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -15329,7 +15819,9 @@ definitions: header (babylon_block_height, babylon_tx_hash) jointly provides - the position of the header on Babylon ledger + 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 @@ -15352,1791 +15844,3251 @@ definitions: Note that each `IndexedHeader` in the fork should have a valid - quorum certificate. + quorum - Such forks exist since Babylon considers CZs might have dishonest - majority. + certificate. Such forks exist since Babylon considers CZs might + have - Also note that the IBC-Go implementation will only consider the - first header in a fork valid, since + dishonest majority. Also note that the IBC-Go implementation will + only - the subsequent headers cannot be verified without knowing the - validator set in the previous header. + 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 - description: >- - QueryChainInfoResponse is response type for the Query/ChainInfo RPC - method. - babylon.zoneconcierge.v1.QueryChainListResponse: - type: object - properties: - chain_ids: - type: array - items: - type: string - title: chain_ids are IDs of the chains in ascending alphabetical order - pagination: - title: pagination defines the pagination in the response + 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: - next_key: + epoch_number: 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: + format: uint64 + current_epoch_interval: type: string format: uint64 - title: >- - total is total number of results available if - PageRequest.count_total + first_block_height: + type: string + format: uint64 + last_block_header: + description: >- + last_block_header is the header of the last block in this epoch. - 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 needs to remember the last header of each epoch to + complete - message SomeResponse { - repeated Bar results = 1; - PageResponse page = 2; - } - title: QueryChainListResponse is response type for the Query/ChainList RPC method - babylon.zoneconcierge.v1.QueryEpochChainInfoResponse: - type: object - properties: - chain_info: - title: chain_info is the info of the CZ - type: object - properties: - chain_id: - type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain + unbonding validators/delegations when a previous epoch's + checkpoint is + + finalised. The last_block_header field is nil in the epoch's + beginning, and + + is set upon the end of this epoch. type: object properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a block + in the blockchain, + + including all blockchain data structures and the rules of the + application's + + state transition machine. chain_id: type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - version: - title: basic block info + hash: + type: string + format: byte + part_set_header: type: object properties: - block: - type: string - format: uint64 - app: + total: + type: integer + format: int64 + hash: type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + app_hash_root: + type: string + format: byte + title: |- + app_hash_root is the Merkle root of all AppHashs in this epoch + It will be used for proving a block is in an epoch + sealer_header: + title: >- + sealer_header is the 2nd header of the next epoch - including all blockchain data structures and the rules of - the application's + This validator set has generated a BLS multisig on + `last_commit_hash` of - state transition machine. - chain_id: + the sealer header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: type: string - height: + format: uint64 + app: type: string - format: int64 - time: + format: uint64 + description: >- + Consensus captures the consensus rules for processing a block + in the blockchain, + + including all blockchain data structures and the rules of the + application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: type: string - format: date-time - last_block_id: - title: prev block info + format: byte + part_set_header: type: object properties: + total: + type: integer + format: int64 hash: type: string format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block header. - babylon_epoch: + title: PartsetHeader + last_commit_hash: type: string - format: uint64 - title: epoch is the epoch number of this header on Babylon ledger - babylon_tx_hash: + format: byte + title: hashes of block data + data_hash: type: string format: byte - title: >- - babylon_tx_hash is the hash of the tx that includes this - header + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + 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 + last_commit_hash: + type: string + format: byte + title: >- + last_commit_hash defines the 'LastCommitHash' that individual BLS + sigs are - (babylon_block_height, babylon_tx_hash) jointly provides the - position of the header on Babylon ledger - latest_forks: + signed on + bitmap: + type: string + format: byte title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) - type: object - properties: - headers: - type: array - items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - hash: - type: string - format: byte - title: hash is the hash of this header - height: + 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 idendtified 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_tx_in_block: + title: >- + proof_tx_in_block is the proof that tx that carries the header is + included + + in a certain Babylon block + type: object + properties: + root_hash: + type: string + format: byte + data: + type: string + format: byte + proof: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + description: >- + TxProof represents a Merkle proof of the presence of a transaction + in the Merkle tree. + proof_header_in_epoch: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + title: >- + proof_header_in_epoch is the proof that the Babylon header is in a + certain + + epoch + 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 + bls_pub_key: + type: string + format: byte + voting_power: type: string format: uint64 - title: >- - height is the height of this header on CZ ledger + title: >- + ValidatorWithBlsKey couples validator address, voting power, + and its bls - (hash, height) jointly provides the position of the - header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, + public key + title: >- + validator_set is the validator set of the sealed epoch - including all blockchain data structures and the - rules of the application's + This validator set has generated a BLS multisig on + `last_commit_hash` of - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: + 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 - format: byte - consensus_hash: + key: type: string format: byte - app_hash: + data: type: string format: byte - last_results_hash: + title: >- + ProofOp defines an operation used for calculating Merkle + root + + The data could be arbitrary format, providing nessecary + 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 - format: byte - evidence_hash: + key: type: string format: byte - title: consensus info - proposer_address: + data: type: string format: byte - description: >- - Header defines the structure of a Tendermint block - header. - babylon_epoch: - type: string - format: uint64 title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: + ProofOp defines an operation used for calculating Merkle + root + + The data could be arbitrary format, providing nessecary + 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: >- - 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. + title: >- + Each provided OP_RETURN transaction can be idendtified by + hash of block in - For example, assuming the following blockchain + 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 - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + to make TransactionInfo self-contained. - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. + For example, storing the key allows TransactionInfo to not + relay on + the fact that TransactionInfo will be ordered in the same + order as - Note that each `IndexedHeader` in the fork should have a valid - quorum certificate. + 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` - Such forks exist since Babylon considers CZs might have dishonest - majority. + TODO: maybe it could use here better format as we already + processed and - Also note that the IBC-Go implementation will only consider the - first header in a fork valid, since + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains Babylon + checkpoint, - the subsequent headers cannot be verified without knowing the - validator set in the previous header. - timestamped_headers_count: - type: string - format: uint64 + 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: >- - timestamped_headers_count is the number of timestamped headers in - CZ's canonical chain + 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 + babylon.zoneconcierge.v1.Forks: + type: object + properties: + headers: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that includes + this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, + + including all blockchain data structures and the rules of + the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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: >- - QueryEpochChainInfoResponse is response type for the Query/EpochChainInfo - RPC method. - babylon.zoneconcierge.v1.QueryFinalizedChainInfoResponse: + 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. + babylon.zoneconcierge.v1.IndexedHeader: type: object properties: - finalized_chain_info: - title: finalized_chain_info is the info of the CZ + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that includes this + CZ + + header type: object properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a block in + the blockchain, + + including all blockchain data structures and the rules of the + application's + + state transition machine. chain_id: type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header + part_set_header: type: object properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, - - including all blockchain data structures and the rules of - the application's - - state transition machine. - chain_id: - type: string - height: - type: string + total: + type: integer format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: + hash: type: string format: byte - description: Header defines the structure of a Tendermint block 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 + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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 - latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) + (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 + babylon.zoneconcierge.v1.ProofEpochSealed: + type: object + properties: + validator_set: + type: array + items: + type: object + properties: + validator_address: + type: string + bls_pub_key: + type: string + format: byte + voting_power: + type: string + format: uint64 + 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 `last_commit_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 nessecary 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 nessecary data + for example neighbouring node hash + 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 `last_commit_hash` is same as in the sealer header + + - More than 1/3 (in voting power) validators in the validator set of this + + epoch have signed `last_commit_hash` of the sealer header + + - The epoch medatata is committed to the `app_hash` of the sealer header + + - The validator set is committed to the `app_hash` of the sealer header + babylon.zoneconcierge.v1.ProofFinalizedChainInfo: + type: object + properties: + proof_tx_in_block: + title: >- + proof_tx_in_block is the proof that tx that carries the header is + included + + in a certain Babylon block + type: object + properties: + root_hash: + type: string + format: byte + data: + type: string + format: byte + proof: type: object properties: - headers: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: type: array items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 + type: string + format: byte + description: >- + TxProof represents a Merkle proof of the presence of a transaction in + the Merkle tree. + proof_header_in_epoch: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + title: >- + proof_header_in_epoch is the proof that the Babylon header is in a + certain - (hash, height) jointly provides the position of the - header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, + epoch + 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 + bls_pub_key: + type: string + format: byte + voting_power: + type: string + format: uint64 + title: >- + ValidatorWithBlsKey couples validator address, voting power, and + its bls - including all blockchain data structures and the - rules of the application's + public key + title: >- + validator_set is the validator set of the sealed epoch - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint block - header. - babylon_epoch: + This validator set has generated a BLS multisig on + `last_commit_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 - format: uint64 - title: >- - epoch is the epoch number of this header on Babylon - ledger - babylon_tx_hash: + key: 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. + data: + type: string + format: byte + title: >- + ProofOp defines an operation used for calculating Merkle + root - For example, assuming the following blockchain + The data could be arbitrary format, providing nessecary 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 - A <- B <- C <- D <- E - \ -- D1 - \ -- D2 - ``` + 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 - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. + The data could be arbitrary format, providing nessecary 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 idendtified by hash + of block in - Note that each `IndexedHeader` in the fork should have a valid - quorum certificate. + which transaction was included and transaction index in the + block + description: >- + key is the position (txIdx, blockHash) of this tx on BTC + blockchain - Such forks exist since Babylon considers CZs might have dishonest - majority. + Although it is already a part of SubmissionKey, we store it here + again - Also note that the IBC-Go implementation will only consider the - first header in a fork valid, since + to make TransactionInfo self-contained. - the subsequent headers cannot be verified without knowing the - validator set in the previous header. - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped headers in - CZ's canonical chain - epoch_info: - title: epoch_info is the metadata of the last BTC-finalised epoch - type: object - properties: - epoch_number: - type: string - format: uint64 - current_epoch_interval: - type: string - format: uint64 - first_block_height: - type: string - format: uint64 - last_block_header: - description: >- - last_block_header is the header of the last block in this epoch. + For example, storing the key allows TransactionInfo to not relay + on - Babylon needs to remember the last header of each epoch to - complete unbonding validators/delegations when a previous epoch's - checkpoint is finalised. + the fact that TransactionInfo will be ordered in the same order + as - The last_block_header field is nil in the epoch's beginning, and - is set upon the end of this epoch. - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, + 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` - including all blockchain data structures and the rules of the - application's + TODO: maybe it could use here better format as we already + processed and - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - app_hash_root: - type: string - format: byte - title: |- - app_hash_root is the Merkle root of all AppHashs in this epoch - It will be used for proving a block is in an epoch - sealer_header: - title: >- - sealer_header is the 2nd header of the next epoch + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains Babylon + checkpoint, - This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, + including - including all blockchain data structures and the rules of the - application's + - the position of the tx on BTC blockchain - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block header. - raw_checkpoint: - title: raw_checkpoint is the raw checkpoint of this epoch + - 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: |- + ProofFinalizedChainInfo is a set of proofs that attest a chain info is + BTC-finalised + babylon.zoneconcierge.v1.QueryChainListResponse: + type: object + properties: + chain_ids: + type: array + items: + type: string + title: chain_ids are IDs of the chains in ascending alphabetical order + pagination: + title: pagination defines the pagination in the response type: object properties: - epoch_num: - type: string - format: uint64 - title: epoch_num defines the epoch number the raw checkpoint is for - last_commit_hash: - type: string - format: byte - title: >- - last_commit_hash defines the 'LastCommitHash' that individual BLS - sigs are signed on - bitmap: + next_key: type: string format: byte - title: >- - bitmap defines the bitmap that indicates the signers of the BLS - multi sig - bls_multi_sig: + 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: byte + format: uint64 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: + 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: QueryChainListResponse is response type for the Query/ChainList RPC method + babylon.zoneconcierge.v1.QueryChainsInfoResponse: + type: object + properties: + chains_info: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: type: object properties: - index: - type: integer - format: int64 + chain_id: + type: string + title: chain_id is the unique ID of the chain hash: type: string format: byte - title: >- - Each provided OP_RETURN transaction can be idendtified 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_tx_in_block: - title: >- - proof_tx_in_block is the proof that tx that carries the header is - included in a certain Babylon block - type: object - properties: - root_hash: - type: string - format: byte - data: - type: string - format: byte - proof: - type: object - properties: - total: - type: string - format: int64 - index: - type: string - format: int64 - leaf_hash: - type: string - format: byte - aunts: - type: array - items: - type: string - format: byte - description: >- - TxProof represents a Merkle proof of the presence of a transaction - in the Merkle tree. - proof_header_in_epoch: - type: object - properties: - total: - type: string - format: int64 - index: - type: string - format: int64 - leaf_hash: - type: string - format: byte - aunts: - type: array - items: + title: hash is the hash of this header + height: type: string - format: byte - title: >- - proof_header_in_epoch is the proof that the Babylon header is in a - certain epoch - 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 - bls_pub_key: - type: string - format: byte - voting_power: - type: string - format: uint64 + format: uint64 title: >- - ValidatorWithBlsKey couples validator address, voting power, - and its bls public key - title: >- - validator_set is the validator set of the sealed epoch + height is the height of this header on CZ ledger - This validator set has generated a BLS multisig on - `last_commit_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: + (hash, height) jointly provides the position of the header + on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header + type: object + properties: + version: + title: basic block info type: object properties: - type: - type: string - key: + block: type: string - format: byte - data: + format: uint64 + app: type: string - format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, - The data could be arbitrary format, providing nessecary - data + including all blockchain data structures and the rules + of the application's - 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: + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info type: object properties: - type: - type: string - key: - type: string - format: byte - data: + hash: type: string format: byte - title: >- - ProofOp defines an operation used for calculating Merkle - root - - The data could be arbitrary format, providing nessecary - 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: + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: type: string format: byte - title: >- - Each provided OP_RETURN transaction can be idendtified 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: + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: type: string - format: byte - title: transaction is the full transaction in bytes - proof: + format: uint64 + title: epoch is the epoch number of this header on Babylon ledger + babylon_tx_hash: 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 - - valideated the proof? - title: >- - TransactionInfo is the info of a tx that contains Babylon - checkpoint, including - - - the position of the tx on BTC blockchain - - - the full tx content + babylon_tx_hash is the hash of the tx that includes this + header - - 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 + (babylon_block_height, babylon_tx_hash) jointly provides the + position of - It is the two TransactionInfo in the best (i.e., earliest) - checkpoint submission - description: >- - QueryFinalizedChainInfoResponse is response type for the - Query/FinalizedChainInfo RPC method. - babylon.zoneconcierge.v1.QueryFinalizedChainInfoUntilHeightResponse: - type: object - properties: - finalized_chain_info: - title: finalized_chain_info is the info of the CZ - type: object - properties: - chain_id: - type: string - title: chain_id is the ID of the chain - latest_header: - title: latest_header is the latest header in CZ's canonical chain - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info + 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: - block: + chain_id: type: string - format: uint64 - app: + title: chain_id is the unique ID of the chain + hash: + type: string + format: byte + title: hash is the hash of this header + height: type: string format: uint64 - description: >- - Consensus captures the consensus rules for processing a - block in the blockchain, + title: >- + height is the height of this header on CZ ledger - including all blockchain data structures and the rules of - the application's + (hash, height) jointly provides the position of the + header on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: + header type: object properties: - total: - type: integer + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string format: int64 - hash: + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: type: string format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block 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 + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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 - latest_forks: - title: >- - latest_forks is the latest forks, formed as a series of - IndexedHeader (from low to high) - type: object - properties: - headers: - type: array - items: - type: object - properties: - chain_id: - type: string - title: chain_id is the unique ID of the chain - 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 + (babylon_block_height, babylon_tx_hash) jointly + provides the position of - (hash, height) jointly provides the position of the - header on CZ ledger - babylon_header: - title: >- - babylon_header is the header of the babylon block that - includes this CZ header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for - processing a block in the blockchain, + 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. - including all blockchain data structures and the - rules of the application's + For example, assuming the following blockchain - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: >- - Header defines the structure of a Tendermint block - 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 - ``` + A <- B <- C <- D <- E + \ -- D1 + \ -- D2 + ``` - Then the fork will be {[D1, D2]} where each item is in struct - `IndexedBlock`. + 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. + Note that each `IndexedHeader` in the fork should have a valid + quorum - Such forks exist since Babylon considers CZs might have dishonest - majority. + certificate. Such forks exist since Babylon considers CZs might + have - Also note that the IBC-Go implementation will only consider the - first header in a fork valid, since + dishonest majority. Also note that the IBC-Go implementation + will only - the subsequent headers cannot be verified without knowing the - validator set in the previous header. - timestamped_headers_count: - type: string - format: uint64 - title: >- - timestamped_headers_count is the number of timestamped headers in - CZ's canonical chain - epoch_info: - title: epoch_info is the metadata of the last BTC-finalised epoch - type: object - properties: - epoch_number: - type: string - format: uint64 - current_epoch_interval: - type: string - format: uint64 - first_block_height: - type: string - format: uint64 - last_block_header: - description: >- - last_block_header is the header of the last block in this epoch. + consider the first header in a fork valid, since the subsequent + headers - Babylon needs to remember the last header of each epoch to - complete unbonding validators/delegations when a previous epoch's - checkpoint is finalised. + 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 - The last_block_header field is nil in the epoch's beginning, and - is set upon the end of this epoch. - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, + low to high) + timestamped_headers_count: + type: string + format: uint64 + title: >- + timestamped_headers_count is the number of timestamped headers + in CZ's - including all blockchain data structures and the rules of the - application'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: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: - type: object - properties: - total: - type: integer - format: int64 - hash: - type: string - format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: - type: string - format: byte - app_hash: - type: string - format: byte - last_results_hash: - type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - app_hash_root: - type: string - format: byte - title: |- - app_hash_root is the Merkle root of all AppHashs in this epoch - It will be used for proving a block is in an epoch - sealer_header: - title: >- - sealer_header is the 2nd header of the next epoch + (hash, height) jointly provides the position of the header + on CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ - This validator set has generated a BLS multisig on - `last_commit_hash` of the sealer header - type: object - properties: - version: - title: basic block info - type: object - properties: - block: - type: string - format: uint64 - app: - type: string - format: uint64 - description: >- - Consensus captures the consensus rules for processing a block - in the blockchain, + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, - including all blockchain data structures and the rules of the - application's + including all blockchain data structures and the rules + of the application's - state transition machine. - chain_id: - type: string - height: - type: string - format: int64 - time: - type: string - format: date-time - last_block_id: - title: prev block info - type: object - properties: - hash: - type: string - format: byte - part_set_header: + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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: - total: - type: integer - format: int64 + chain_id: + type: string + title: chain_id is the unique ID of the chain hash: type: string format: byte - title: PartsetHeader - last_commit_hash: - type: string - format: byte - title: hashes of block data - data_hash: - type: string - format: byte - validators_hash: - type: string - format: byte - title: hashes from the app output from the prev block - next_validators_hash: - type: string - format: byte - consensus_hash: + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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. + babylon.zoneconcierge.v1.QueryFinalizedChainInfoUntilHeightResponse: + type: object + properties: + finalized_chain_info: + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: + type: object + properties: + chain_id: type: string - format: byte - app_hash: + title: chain_id is the unique ID of the chain + hash: type: string format: byte - last_results_hash: + title: hash is the hash of this header + height: type: string - format: byte - evidence_hash: - type: string - format: byte - title: consensus info - proposer_address: - type: string - format: byte - description: Header defines the structure of a Tendermint block header. - 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 - last_commit_hash: - type: string - format: byte - title: >- - last_commit_hash defines the 'LastCommitHash' 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 idendtified by hash - of block in + format: uint64 + title: >- + height is the height of this header on CZ ledger - 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_tx_in_block: - title: >- - proof_tx_in_block is the proof that tx that carries the header is - included in a certain Babylon block - type: object - properties: - root_hash: - type: string - format: byte - data: - type: string - format: byte - proof: + (hash, height) jointly provides the position of the header on + CZ ledger + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header type: object properties: - total: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, + + including all blockchain data structures and the rules of + the application's + + state transition machine. + chain_id: type: string - format: int64 - index: + height: type: string format: int64 - leaf_hash: + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: type: string format: byte - aunts: - type: array - items: - type: string - format: byte - description: >- - TxProof represents a Merkle proof of the presence of a transaction - in the Merkle tree. - proof_header_in_epoch: - type: object - properties: - total: - type: string - format: int64 - index: + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + babylon_epoch: type: string - format: int64 - leaf_hash: + format: uint64 + title: epoch is the epoch number of this header on Babylon ledger + babylon_tx_hash: type: string format: byte - aunts: + 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: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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 + current_epoch_interval: + type: string + format: uint64 + first_block_height: + type: string + format: uint64 + last_block_header: + description: >- + last_block_header is the header of the last block in this epoch. + + Babylon needs to remember the last header of each epoch to + complete + + unbonding validators/delegations when a previous epoch's + checkpoint is + + finalised. The last_block_header field is nil in the epoch's + beginning, and + + is set upon the end of this epoch. + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a block + in the blockchain, + + including all blockchain data structures and the rules of the + application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + app_hash_root: + type: string + format: byte + title: |- + app_hash_root is the Merkle root of all AppHashs in this epoch + It will be used for proving a block is in an epoch + sealer_header: + title: >- + sealer_header is the 2nd header of the next epoch + + This validator set has generated a BLS multisig on + `last_commit_hash` of + + the sealer header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a block + in the blockchain, + + including all blockchain data structures and the rules of the + application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + 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 + last_commit_hash: + type: string + format: byte + title: >- + last_commit_hash defines the 'LastCommitHash' 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 idendtified 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_tx_in_block: + title: >- + proof_tx_in_block is the proof that tx that carries the header is + included + + in a certain Babylon block + type: object + properties: + root_hash: + type: string + format: byte + data: + type: string + format: byte + proof: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + description: >- + TxProof represents a Merkle proof of the presence of a transaction + in the Merkle tree. + proof_header_in_epoch: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + title: >- + proof_header_in_epoch is the proof that the Babylon header is in a + certain + + epoch + 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 + bls_pub_key: + type: string + format: byte + voting_power: + type: string + format: uint64 + 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 + `last_commit_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 nessecary + 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 nessecary + 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 idendtified 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 + + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains Babylon + checkpoint, + + 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. + babylon.zoneconcierge.v1.QueryFinalizedChainsInfoResponse: + type: object + properties: + finalized_chains_info: + type: array + items: + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + finalized_chain_info: + type: object + properties: + chain_id: + type: string + title: chain_id is the ID of the chain + latest_header: + type: object + properties: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block that + includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and the + rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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: + chain_id: + type: string + title: chain_id is the unique ID of the chain + 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 + babylon_header: + title: >- + babylon_header is the header of the babylon block + that includes this CZ + + header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for + processing a block in the blockchain, + + including all blockchain data structures and + the rules of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block 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 + current_epoch_interval: + type: string + format: uint64 + first_block_height: + type: string + format: uint64 + last_block_header: + description: >- + last_block_header is the header of the last block in this + epoch. + + Babylon needs to remember the last header of each epoch to + complete + + unbonding validators/delegations when a previous epoch's + checkpoint is + + finalised. The last_block_header field is nil in the epoch's + beginning, and + + is set upon the end of this epoch. + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, + + including all blockchain data structures and the rules + of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + app_hash_root: + type: string + format: byte + title: >- + app_hash_root is the Merkle root of all AppHashs in this + epoch + + It will be used for proving a block is in an epoch + sealer_header: + title: >- + sealer_header is the 2nd header of the next epoch + + This validator set has generated a BLS multisig on + `last_commit_hash` of + + the sealer header + type: object + properties: + version: + title: basic block info + type: object + properties: + block: + type: string + format: uint64 + app: + type: string + format: uint64 + description: >- + Consensus captures the consensus rules for processing a + block in the blockchain, + + including all blockchain data structures and the rules + of the application's + + state transition machine. + chain_id: + type: string + height: + type: string + format: int64 + time: + type: string + format: date-time + last_block_id: + title: prev block info + type: object + properties: + hash: + type: string + format: byte + part_set_header: + type: object + properties: + total: + type: integer + format: int64 + hash: + type: string + format: byte + title: PartsetHeader + last_commit_hash: + type: string + format: byte + title: hashes of block data + data_hash: + type: string + format: byte + validators_hash: + type: string + format: byte + title: hashes from the app output from the prev block + next_validators_hash: + type: string + format: byte + consensus_hash: + type: string + format: byte + app_hash: + type: string + format: byte + last_results_hash: + type: string + format: byte + evidence_hash: + type: string + format: byte + title: consensus info + proposer_address: + type: string + format: byte + description: Header defines the structure of a block header. + 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 + last_commit_hash: type: string format: byte - title: >- - proof_header_in_epoch is the proof that the Babylon header is in a - certain epoch - proof_epoch_sealed: - title: proof_epoch_sealed is the proof that the epoch is sealed - type: object - properties: - validator_set: - type: array - items: + title: >- + last_commit_hash defines the 'LastCommitHash' 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 idendtified 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_tx_in_block: + title: >- + proof_tx_in_block is the proof that tx that carries the + header is included + + in a certain Babylon block type: object properties: - validator_address: - type: string - bls_pub_key: + root_hash: type: string format: byte - voting_power: + data: type: string - format: uint64 - 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 - `last_commit_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: + format: byte + proof: type: object properties: - type: + total: type: string - key: + format: int64 + index: type: string - format: byte - data: + format: int64 + leaf_hash: type: string format: byte + aunts: + type: array + items: + type: string + format: byte + description: >- + TxProof represents a Merkle proof of the presence of a + transaction in the Merkle tree. + proof_header_in_epoch: + type: object + properties: + total: + type: string + format: int64 + index: + type: string + format: int64 + leaf_hash: + type: string + format: byte + aunts: + type: array + items: + type: string + format: byte + title: >- + proof_header_in_epoch is the proof that the Babylon header + is in a certain + + epoch + 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 + bls_pub_key: + type: string + format: byte + voting_power: + type: string + format: uint64 + title: >- + ValidatorWithBlsKey couples validator address, voting + power, and its bls + + public key title: >- - ProofOp defines an operation used for calculating Merkle - root + validator_set is the validator set of the sealed epoch - The data could be arbitrary format, providing nessecary - data + This validator set has generated a BLS multisig on + `last_commit_hash` of - 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: + 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: - type: - type: string - key: - type: string - format: byte - data: - type: string - format: byte + 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 + nessecary data + + for example neighbouring node hash + proof_epoch_val_set: title: >- - ProofOp defines an operation used for calculating Merkle - root + proof_epoch_info is the Merkle proof that the epoch's + validator set is - The data could be arbitrary format, providing nessecary - data + 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 - 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 idendtified by - hash of block in + The data could be arbitrary format, providing + nessecary data - which transaction was included and transaction index in the - block - description: >- - key is the position (txIdx, blockHash) of this tx on BTC - blockchain + 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 idendtified + by hash of block in - Although it is already a part of SubmissionKey, we store it - here again + which transaction was included and transaction index + in the block + description: >- + key is the position (txIdx, blockHash) of this tx on + BTC blockchain - to make TransactionInfo self-contained. + Although it is already a part of SubmissionKey, we + store it here again - For example, storing the key allows TransactionInfo to not - relay on + to make TransactionInfo self-contained. - the fact that TransactionInfo will be ordered in the same - order as + For example, storing the key allows TransactionInfo to + not relay on - 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` + the fact that TransactionInfo will be ordered in the + same order as - TODO: maybe it could use here better format as we already - processed and + 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` - valideated the proof? - title: >- - TransactionInfo is the info of a tx that contains Babylon - checkpoint, including + TODO: maybe it could use here better format as we + already processed and - - the position of the tx on BTC blockchain + valideated the proof? + title: >- + TransactionInfo is the info of a tx that contains Babylon + checkpoint, - - the full tx content + including - - 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 + - the position of the tx on BTC blockchain - It is the two TransactionInfo in the best (i.e., earliest) - checkpoint submission - description: >- - QueryFinalizedChainInfoUntilHeightResponse is response type for the - Query/FinalizedChainInfoUntilHeight RPC method. + - 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. babylon.zoneconcierge.v1.QueryHeaderResponse: type: object properties: @@ -17161,7 +19113,9 @@ definitions: babylon_header: title: >- babylon_header is the header of the babylon block that includes - this CZ header + this CZ + + header type: object properties: version: @@ -17237,7 +19191,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -17249,7 +19203,9 @@ definitions: 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 + position of + + the header on Babylon ledger title: IndexedHeader is the metadata of a CZ header fork_headers: type: object @@ -17277,7 +19233,9 @@ definitions: babylon_header: title: >- babylon_header is the header of the babylon block that - includes this CZ header + includes this CZ + + header type: object properties: version: @@ -17353,7 +19311,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -17366,7 +19324,9 @@ definitions: header (babylon_block_height, babylon_tx_hash) jointly provides the - position of the header on Babylon ledger + 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 @@ -17388,17 +19348,17 @@ definitions: Note that each `IndexedHeader` in the fork should have a valid quorum - certificate. - Such forks exist since Babylon considers CZs might have dishonest - majority. + certificate. Such forks exist since Babylon considers CZs might have + + dishonest majority. Also note that the IBC-Go implementation will only - Also note that the IBC-Go implementation will only consider the first - header in a fork valid, since + consider the first header in a fork valid, since the subsequent + headers - the subsequent headers cannot be verified without knowing the - validator set in the previous header. - description: QueryParamsResponse is response type for the Query/Header RPC method. + 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: type: object properties: @@ -17425,7 +19385,9 @@ definitions: babylon_header: title: >- babylon_header is the header of the babylon block that includes - this CZ header + this CZ + + header type: object properties: version: @@ -17501,7 +19463,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -17513,12 +19475,16 @@ definitions: 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 + 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. + Query/ListEpochHeaders + + RPC method. babylon.zoneconcierge.v1.QueryListHeadersResponse: type: object properties: @@ -17545,7 +19511,9 @@ definitions: babylon_header: title: >- babylon_header is the header of the babylon block that includes - this CZ header + this CZ + + header type: object properties: version: @@ -17621,7 +19589,7 @@ definitions: proposer_address: type: string format: byte - description: Header defines the structure of a Tendermint block header. + description: Header defines the structure of a block header. babylon_epoch: type: string format: uint64 @@ -17633,7 +19601,9 @@ definitions: 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 + position of + + the header on Babylon ledger title: IndexedHeader is the metadata of a CZ header title: headers is the list of headers pagination: @@ -17663,16 +19633,9 @@ definitions: repeated Bar results = 1; PageResponse page = 2; } - description: >- + description: |- QueryListHeadersResponse is response type for the Query/ListHeaders RPC method. - babylon.zoneconcierge.v1.QueryParamsResponse: - type: object - properties: - params: - description: params holds all the parameters of this module. - type: object - description: QueryParamsResponse is response type for the Query/Params RPC method. tendermint.crypto.Proof: type: object properties: diff --git a/client/docs/template/index.tpl b/client/docs/template/index.tpl new file mode 100644 index 000000000..f228fc71d --- /dev/null +++ b/client/docs/template/index.tpl @@ -0,0 +1,23 @@ + + + + + + + + +
+ + + + + diff --git a/client/tx/tx.go b/client/tx/tx.go index 1460728d7..cc7b9b4e3 100644 --- a/client/tx/tx.go +++ b/client/tx/tx.go @@ -1,14 +1,14 @@ package tx import ( + "errors" "fmt" - appparams "github.com/babylonchain/babylon/app/params" "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" sdktx "github.com/cosmos/cosmos-sdk/client/tx" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/pflag" + + "github.com/babylonchain/babylon/types" ) func SendMsgToTendermint(clientCtx client.Context, msg sdk.Msg) (*sdk.TxResponse, error) { @@ -22,16 +22,15 @@ func SendMsgsToTendermint(clientCtx client.Context, msgs []sdk.Msg) (*sdk.TxResp } } - // TODO make the fee dynamic - fs := pflag.NewFlagSet("", pflag.ContinueOnError) - fs.String(flags.FlagFees, "", "Fees to pay along with transaction; eg: 10ubbn") - fee := fmt.Sprintf("100%s", appparams.BaseCoinUnit) - err := fs.Set(flags.FlagFees, fee) - if err != nil { - return nil, err - } - - txf := sdktx.NewFactoryCLI(clientCtx, fs) + gasPrice, gasAdjustment := types.MustGetGasSettings(clientCtx.HomeDir, clientCtx.Viper) + txf := sdktx.Factory{}. + WithTxConfig(clientCtx.TxConfig). + WithAccountRetriever(clientCtx.AccountRetriever). + WithKeybase(clientCtx.Keyring). + WithChainID(clientCtx.ChainID). + WithFeePayer(clientCtx.FeePayer). + WithGasPrices(gasPrice). + WithGasAdjustment(gasAdjustment) return BroadcastTx(clientCtx, txf, msgs...) } @@ -47,6 +46,17 @@ func BroadcastTx(clientCtx client.Context, txf sdktx.Factory, msgs ...sdk.Msg) ( return nil, err } + _, adjusted, err := sdktx.CalculateGas(clientCtx, txf, msgs...) + if err != nil { + return nil, err + } + + if adjusted <= 0 { + return nil, errors.New("calculated gas should be positive") + } + + txf = txf.WithGas(adjusted) + tx, err := txf.BuildUnsignedTx(msgs...) if err != nil { return nil, err @@ -102,7 +112,6 @@ func prepareFactory(clientCtx client.Context, txf sdktx.Factory) (sdktx.Factory, if initNum == 0 { txf = txf.WithAccountNumber(num) } - if initSeq == 0 { txf = txf.WithSequence(seq) } diff --git a/cmd/babylond/cmd/add_gen_bls.go b/cmd/babylond/cmd/add_gen_bls.go index 11eb6e1be..f4af2c504 100644 --- a/cmd/babylond/cmd/add_gen_bls.go +++ b/cmd/babylond/cmd/add_gen_bls.go @@ -4,18 +4,19 @@ import ( "encoding/json" "errors" "fmt" + + tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/spf13/cobra" - tmos "github.com/tendermint/tendermint/libs/os" "github.com/babylonchain/babylon/x/checkpointing/types" ) -func AddGenBlsCmd() *cobra.Command { +func AddGenBlsCmd(validator genutiltypes.MessageValidator) *cobra.Command { cmd := &cobra.Command{ Use: "add-genesis-bls [genesis_bls_file]", Short: "Add a genesis BLS key to genesis.json", @@ -65,7 +66,7 @@ BLS keys in the checkpointing module's genesis state.' genTxState := genutiltypes.GetGenesisStateFromAppState(clientCtx.Codec, appState) foundInGenTx := false for _, genTx := range genTxState.GenTxs { - tx, err := genutiltypes.ValidateAndGetGenTx(genTx, clientCtx.TxConfig.TxJSONDecoder()) + tx, err := genutiltypes.ValidateAndGetGenTx(genTx, clientCtx.TxConfig.TxJSONDecoder(), validator) if err != nil { return err } diff --git a/cmd/babylond/cmd/add_gen_bls_test.go b/cmd/babylond/cmd/add_gen_bls_test.go index f1e631ba3..0bb59cfb7 100644 --- a/cmd/babylond/cmd/add_gen_bls_test.go +++ b/cmd/babylond/cmd/add_gen_bls_test.go @@ -3,10 +3,16 @@ package cmd_test import ( "context" "fmt" - "github.com/cosmos/cosmos-sdk/server/config" "path/filepath" "testing" + "github.com/cosmos/cosmos-sdk/server/config" + "github.com/cosmos/cosmos-sdk/x/genutil" + + tmconfig "github.com/cometbft/cometbft/config" + tmjson "github.com/cometbft/cometbft/libs/json" + "github.com/cometbft/cometbft/libs/log" + "github.com/cometbft/cometbft/libs/tempfile" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" @@ -15,10 +21,6 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/spf13/viper" "github.com/stretchr/testify/require" - tmconfig "github.com/tendermint/tendermint/config" - tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/tendermint/tendermint/libs/log" - "github.com/tendermint/tendermint/libs/tempfile" "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/cmd/babylond/cmd" @@ -36,7 +38,9 @@ func Test_AddGenBlsCmdWithoutGentx(t *testing.T) { tmcfg, err := genutiltest.CreateDefaultTendermintConfig(home) require.NoError(t, err) - appCodec := app.MakeTestEncodingConfig().Marshaler + appCodec := app.GetEncodingConfig().Marshaler + gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) + err = genutiltest.ExecInitCmd(testMbm, home, appCodec) require.NoError(t, err) @@ -55,7 +59,7 @@ func Test_AddGenBlsCmdWithoutGentx(t *testing.T) { genKeyFileName := filepath.Join(home, fmt.Sprintf("gen-bls-%s.json", genKey.ValidatorAddress)) err = tempfile.WriteFileAtomic(genKeyFileName, jsonBytes, 0600) require.NoError(t, err) - addGenBlsCmd := cmd.AddGenBlsCmd() + addGenBlsCmd := cmd.AddGenBlsCmd(gentxModule.GenTxValidator) addGenBlsCmd.SetArgs( []string{genKeyFileName}, ) @@ -66,7 +70,8 @@ func Test_AddGenBlsCmdWithoutGentx(t *testing.T) { // test adding genesis BLS keys with gentx // error is expected if adding duplicate func Test_AddGenBlsCmdWithGentx(t *testing.T) { - cfg := network.DefaultConfig() + min := network.MinimumAppConfig() + cfg, _ := network.DefaultConfigWithAppConfig(min) config.SetConfigTemplate(config.DefaultConfigTemplate) cfg.NumValidators = 1 @@ -76,6 +81,7 @@ func Test_AddGenBlsCmdWithGentx(t *testing.T) { _, err = testNetwork.WaitForHeight(1) require.NoError(t, err) + gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) targetCfg := tmconfig.DefaultConfig() targetCfg.SetRoot(filepath.Join(testNetwork.Validators[0].Dir, "simd")) @@ -101,7 +107,7 @@ func Test_AddGenBlsCmdWithGentx(t *testing.T) { require.NotNil(t, genKey) // add genesis BLS key to the target context - addBlsCmd := cmd.AddGenBlsCmd() + addBlsCmd := cmd.AddGenBlsCmd(gentxModule.GenTxValidator) _, err = cli.ExecTestCLICmd(targetCtx, addBlsCmd, []string{genKeyFileName}) require.NoError(t, err) appState, _, err := genutiltypes.GenesisStateFromGenFile(targetGenesisFile) diff --git a/cmd/babylond/cmd/create_bls_key.go b/cmd/babylond/cmd/create_bls_key.go index efad6e2f9..2d2430e2c 100644 --- a/cmd/babylond/cmd/create_bls_key.go +++ b/cmd/babylond/cmd/create_bls_key.go @@ -7,11 +7,11 @@ import ( appparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/privval" + tmconfig "github.com/cometbft/cometbft/config" + tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/client/flags" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" - tmconfig "github.com/tendermint/tendermint/config" - tmos "github.com/tendermint/tendermint/libs/os" "path/filepath" "strings" ) diff --git a/cmd/babylond/cmd/custom_babylon_config.go b/cmd/babylond/cmd/custom_babylon_config.go index 4a0917d37..dea8fd351 100644 --- a/cmd/babylond/cmd/custom_babylon_config.go +++ b/cmd/babylond/cmd/custom_babylon_config.go @@ -1,35 +1,47 @@ package cmd import ( - txformat "github.com/babylonchain/babylon/btctxformatter" - bbn "github.com/babylonchain/babylon/types" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" serverconfig "github.com/cosmos/cosmos-sdk/server/config" + + bbn "github.com/babylonchain/babylon/types" +) + +const ( + defaultKeyName = "" + defaultGasPrice = "0.01ubbn" + defaultGasAdjustment = 1.5 ) type BtcConfig struct { Network string `mapstructure:"network"` - - CheckpointTag string `mapstructure:"checkpoint-tag"` } func defaultBabylonBtcConfig() BtcConfig { return BtcConfig{ - Network: string(bbn.BtcMainnet), - CheckpointTag: string(txformat.DefaultMainTagStr), + Network: string(bbn.BtcMainnet), } } func defaultSignerConfig() SignerConfig { - return SignerConfig{KeyName: ""} + return SignerConfig{ + KeyName: defaultKeyName, + GasPrice: defaultGasPrice, + GasAdjustment: defaultGasAdjustment, + } } type SignerConfig struct { - KeyName string `mapstructure:"key-name"` + KeyName string `mapstructure:"key-name"` + GasPrice string `mapstructure:"gas-price"` + GasAdjustment float64 `mapstructure:"gas-adjustment"` } type BabylonAppConfig struct { serverconfig.Config `mapstructure:",squash"` + Wasm wasmtypes.WasmConfig `mapstructure:"wasm"` + BtcConfig BtcConfig `mapstructure:"btc-config"` SignerConfig SignerConfig `mapstructure:"signer-config"` @@ -38,13 +50,14 @@ type BabylonAppConfig struct { func DefaultBabylonConfig() *BabylonAppConfig { return &BabylonAppConfig{ Config: *serverconfig.DefaultConfig(), + Wasm: wasmtypes.DefaultWasmConfig(), BtcConfig: defaultBabylonBtcConfig(), SignerConfig: defaultSignerConfig(), } } func DefaultBabylonTemplate() string { - return serverconfig.DefaultConfigTemplate + ` + return serverconfig.DefaultConfigTemplate + wasmtypes.DefaultConfigTemplate() + ` ############################################################################### ### Babylon Bitcoin configuration ### ############################################################################### @@ -55,14 +68,13 @@ func DefaultBabylonTemplate() string { # valid values are: [mainnet, testnet, simnet, regtest] network = "{{ .BtcConfig.Network }}" - -# Configures what tag should be prepended to op_return data in btc transaction -# for it to be considered as valid babylon checkpoint. Must have exactly 4 bytes. -checkpoint-tag = "{{ .BtcConfig.CheckpointTag }}" - [signer-config] # Configures which key that the BLS signer uses to sign BLS-sig transactions key-name = "{{ .SignerConfig.KeyName }}" +# Configures the gas-price that the signer would like to pay +gas-price = "{{ .SignerConfig.GasPrice }}" +# Configures the adjustment of the gas cost of estimation +gas-adjustment = "{{ .SignerConfig.GasAdjustment }}" ` } diff --git a/cmd/babylond/cmd/flags.go b/cmd/babylond/cmd/flags.go index b6c5e6fbc..0e24553ec 100644 --- a/cmd/babylond/cmd/flags.go +++ b/cmd/babylond/cmd/flags.go @@ -1,10 +1,13 @@ package cmd import ( + "time" + + babylonApp "github.com/babylonchain/babylon/app" + btcctypes "github.com/babylonchain/babylon/x/btccheckpoint/types" + tmrand "github.com/cometbft/cometbft/libs/rand" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - tmrand "github.com/tendermint/tendermint/libs/rand" - "time" ) const ( @@ -12,9 +15,16 @@ const ( flagBtcConfirmationDepth = "btc-confirmation-depth" flagEpochInterval = "epoch-interval" flagBtcFinalizationTimeout = "btc-finalization-timeout" + flagCheckpointTag = "checkpoint-tag" flagBaseBtcHeaderHex = "btc-base-header" flagBaseBtcHeaderHeight = "btc-base-header-height" + flagInflationRateChange = "inflation-rate-change" + flagInflationMax = "inflation-max" + flagInflationMin = "inflation-min" + flagGoalBonded = "goal-bonded" + flagBlocksPerYear = "blocks-per-year" flagGenesisTime = "genesis-time" + flagBlockGasLimit = "block-gas-limit" ) type GenesisCLIArgs struct { @@ -22,10 +32,17 @@ type GenesisCLIArgs struct { MaxActiveValidators uint32 BtcConfirmationDepth uint64 BtcFinalizationTimeout uint64 + CheckpointTag string EpochInterval uint64 BaseBtcHeaderHex string BaseBtcHeaderHeight uint64 + InflationRateChange float64 + InflationMax float64 + InflationMin float64 + GoalBonded float64 + BlocksPerYear uint64 GenesisTime time.Time + BlockGasLimit int64 } func addGenesisFlags(cmd *cobra.Command) { @@ -35,13 +52,20 @@ func addGenesisFlags(cmd *cobra.Command) { // btccheckpoint flags cmd.Flags().Uint64(flagBtcConfirmationDepth, 6, "Confirmation depth for Bitcoin headers.") cmd.Flags().Uint64(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.") // btclightclient args // Genesis header for the simnet cmd.Flags().String(flagBaseBtcHeaderHex, "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a45068653ffff7f2002000000", "Hex of the base Bitcoin header.") cmd.Flags().Uint64(flagBaseBtcHeaderHeight, 0, "Height of the base Bitcoin header.") + cmd.Flags().Float64(flagInflationRateChange, 0.13, "Inflation rate change") + cmd.Flags().Float64(flagInflationMax, 0.2, "Maximum inflation") + cmd.Flags().Float64(flagInflationMin, 0.07, "Minimum inflation") + cmd.Flags().Float64(flagGoalBonded, 0.67, "Bonded tokens goal") + cmd.Flags().Uint64(flagBlocksPerYear, 6311520, "Blocks per year") cmd.Flags().Int64(flagGenesisTime, time.Now().Unix(), "Genesis time") + cmd.Flags().Int64(flagBlockGasLimit, babylonApp.DefaultGasLimit, "Block gas limit") } func parseGenesisFlags(cmd *cobra.Command) *GenesisCLIArgs { @@ -49,10 +73,17 @@ func parseGenesisFlags(cmd *cobra.Command) *GenesisCLIArgs { maxActiveValidators, _ := cmd.Flags().GetUint32(flagMaxActiveValidators) btcConfirmationDepth, _ := cmd.Flags().GetUint64(flagBtcConfirmationDepth) btcFinalizationTimeout, _ := cmd.Flags().GetUint64(flagBtcFinalizationTimeout) + checkpointTag, _ := cmd.Flags().GetString(flagCheckpointTag) epochInterval, _ := cmd.Flags().GetUint64(flagEpochInterval) baseBtcHeaderHex, _ := cmd.Flags().GetString(flagBaseBtcHeaderHex) baseBtcHeaderHeight, _ := cmd.Flags().GetUint64(flagBaseBtcHeaderHeight) genesisTimeUnix, _ := cmd.Flags().GetInt64(flagGenesisTime) + inflationRateChange, _ := cmd.Flags().GetFloat64(flagInflationRateChange) + inflationMax, _ := cmd.Flags().GetFloat64(flagInflationMax) + inflationMin, _ := cmd.Flags().GetFloat64(flagInflationMin) + goalBonded, _ := cmd.Flags().GetFloat64(flagGoalBonded) + blocksPerYear, _ := cmd.Flags().GetUint64(flagBlocksPerYear) + blockGasLimit, _ := cmd.Flags().GetInt64(flagBlockGasLimit) if chainID == "" { chainID = "chain-" + tmrand.NewRand().Str(6) @@ -65,9 +96,16 @@ func parseGenesisFlags(cmd *cobra.Command) *GenesisCLIArgs { MaxActiveValidators: maxActiveValidators, BtcConfirmationDepth: btcConfirmationDepth, BtcFinalizationTimeout: btcFinalizationTimeout, + CheckpointTag: checkpointTag, EpochInterval: epochInterval, BaseBtcHeaderHeight: baseBtcHeaderHeight, BaseBtcHeaderHex: baseBtcHeaderHex, GenesisTime: genesisTime, + InflationRateChange: inflationRateChange, + InflationMax: inflationMax, + InflationMin: inflationMin, + GoalBonded: goalBonded, + BlocksPerYear: blocksPerYear, + BlockGasLimit: blockGasLimit, } } diff --git a/cmd/babylond/cmd/genaccounts_test.go b/cmd/babylond/cmd/genaccounts_test.go index ef8a2101a..3f18a76be 100644 --- a/cmd/babylond/cmd/genaccounts_test.go +++ b/cmd/babylond/cmd/genaccounts_test.go @@ -9,12 +9,10 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cometbft/cometbft/libs/log" "github.com/spf13/viper" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - "github.com/babylonchain/babylon/app" - bbncmd "github.com/babylonchain/babylon/cmd/babylond/cmd" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" @@ -22,6 +20,9 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" + + "github.com/babylonchain/babylon/app" + bbncmd "github.com/babylonchain/babylon/cmd/babylond/cmd" ) var testMbm = module.NewBasicManager(genutil.AppModuleBasic{}) @@ -73,7 +74,7 @@ func TestAddGenesisAccountCmd(t *testing.T) { cfg, err := genutiltest.CreateDefaultTendermintConfig(home) require.NoError(t, err) - appCodec := app.MakeTestEncodingConfig().Marshaler + appCodec := app.GetEncodingConfig().Marshaler err = genutiltest.ExecInitCmd(testMbm, home, appCodec) require.NoError(t, err) diff --git a/cmd/babylond/cmd/genbls.go b/cmd/babylond/cmd/genbls.go index 4fb1d0dc8..5534cd60b 100644 --- a/cmd/babylond/cmd/genbls.go +++ b/cmd/babylond/cmd/genbls.go @@ -7,10 +7,10 @@ import ( "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/privval" + tmconfig "github.com/cometbft/cometbft/config" + tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" - tmconfig "github.com/tendermint/tendermint/config" - tmos "github.com/tendermint/tendermint/libs/os" ) func GenBlsCmd() *cobra.Command { diff --git a/cmd/babylond/cmd/genbls_test.go b/cmd/babylond/cmd/genbls_test.go index 46904a3c6..bf9abc7c4 100644 --- a/cmd/babylond/cmd/genbls_test.go +++ b/cmd/babylond/cmd/genbls_test.go @@ -7,6 +7,8 @@ import ( "path/filepath" "testing" + tmconfig "github.com/cometbft/cometbft/config" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/hd" @@ -17,8 +19,6 @@ import ( genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" "github.com/spf13/viper" "github.com/stretchr/testify/require" - tmconfig "github.com/tendermint/tendermint/config" - "github.com/tendermint/tendermint/libs/log" "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/cmd/babylond/cmd" @@ -28,7 +28,7 @@ import ( func Test_GenBlsCmd(t *testing.T) { home := t.TempDir() - encodingConfig := app.MakeTestEncodingConfig() + encodingConfig := app.GetEncodingConfig() logger := log.NewNopLogger() cfg, err := genutiltest.CreateDefaultTendermintConfig(home) require.NoError(t, err) diff --git a/cmd/babylond/cmd/genesis.go b/cmd/babylond/cmd/genesis.go index 9caf49a22..fd61482d9 100644 --- a/cmd/babylond/cmd/genesis.go +++ b/cmd/babylond/cmd/genesis.go @@ -11,6 +11,7 @@ import ( btclightclienttypes "github.com/babylonchain/babylon/x/btclightclient/types" checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + comettypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -28,7 +29,6 @@ import ( minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/spf13/cobra" - "github.com/tendermint/tendermint/types" ) func PrepareGenesisCmd(defaultNodeHome string, mbm module.BasicManager) *cobra.Command { @@ -51,6 +51,7 @@ Example: genesisCliArgs := parseGenesisFlags(cmd) genFile := config.GenesisFile() + appState, genDoc, err := genutiltypes.GenesisStateFromGenFile(genFile) if err != nil { return fmt.Errorf("failed to unmarshal genesis state: %s", err) @@ -62,9 +63,11 @@ Example: var genesisParams GenesisParams if network == "testnet" { genesisParams = TestnetGenesisParams(genesisCliArgs.MaxActiveValidators, - genesisCliArgs.BtcConfirmationDepth, genesisCliArgs.BtcFinalizationTimeout, + genesisCliArgs.BtcConfirmationDepth, genesisCliArgs.BtcFinalizationTimeout, genesisCliArgs.CheckpointTag, genesisCliArgs.EpochInterval, genesisCliArgs.BaseBtcHeaderHex, - genesisCliArgs.BaseBtcHeaderHeight, genesisCliArgs.GenesisTime) + genesisCliArgs.BaseBtcHeaderHeight, genesisCliArgs.InflationRateChange, + genesisCliArgs.InflationMin, genesisCliArgs.InflationMax, genesisCliArgs.GoalBonded, + genesisCliArgs.BlocksPerYear, genesisCliArgs.GenesisTime, genesisCliArgs.BlockGasLimit) } else if network == "mainnet" { // TODO: mainnet genesis params panic("Mainnet params not implemented.") @@ -72,7 +75,7 @@ Example: return fmt.Errorf("please choose testnet or mainnet") } - appState, genDoc, err = PrepareGenesis(clientCtx, appState, genDoc, genesisParams, chainID) + err = PrepareGenesis(clientCtx, appState, genDoc, genesisParams, chainID) if err != nil { return fmt.Errorf("failed to prepare genesis: %w", err) } @@ -81,11 +84,6 @@ Example: return fmt.Errorf("error validating genesis file: %s", err) } - appStateJSON, err := json.Marshal(appState) - if err != nil { - return fmt.Errorf("failed to marshal application genesis state: %w", err) - } - genDoc.AppState = appStateJSON return genutil.ExportGenesisFile(genDoc, genFile) }, } @@ -96,8 +94,16 @@ Example: return cmd } -func PrepareGenesis(clientCtx client.Context, appState map[string]json.RawMessage, - genDoc *types.GenesisDoc, genesisParams GenesisParams, chainID string) (map[string]json.RawMessage, *types.GenesisDoc, error) { +func PrepareGenesis( + clientCtx client.Context, + appState map[string]json.RawMessage, + genDoc *comettypes.GenesisDoc, + genesisParams GenesisParams, + chainID string, +) error { + if genDoc == nil { + return fmt.Errorf("provided genesis must not be nil") + } depCdc := clientCtx.Codec cdc := depCdc @@ -106,6 +112,13 @@ func PrepareGenesis(clientCtx client.Context, appState map[string]json.RawMessag genDoc.ChainID = chainID genDoc.GenesisTime = genesisParams.GenesisTime + if genDoc.ConsensusParams == nil { + genDoc.ConsensusParams = comettypes.DefaultConsensusParams() + } + + // Set gas limit + genDoc.ConsensusParams.Block.MaxGas = genesisParams.BlockGasLimit + // Set the confirmation and finalization parameters btccheckpointGenState := btccheckpointtypes.DefaultGenesis() btccheckpointGenState.Params = genesisParams.BtccheckpointParams @@ -144,7 +157,7 @@ func PrepareGenesis(clientCtx client.Context, appState map[string]json.RawMessag // gov module genesis govGenState := govv1.DefaultGenesisState() - govGenState.DepositParams = &genesisParams.GovParams.DepositParams + govGenState.Params = &genesisParams.GovParams appState[govtypes.ModuleName] = cdc.MustMarshalJSON(govGenState) // crisis module genesis @@ -165,8 +178,15 @@ func PrepareGenesis(clientCtx client.Context, appState map[string]json.RawMessag } appState[banktypes.ModuleName] = cdc.MustMarshalJSON(bankGenState) - // return appState - return appState, genDoc, nil + appGenStateJSON, err := json.MarshalIndent(appState, "", " ") + + if err != nil { + return err + } + + genDoc.AppState = appGenStateJSON + + return nil } type GenesisParams struct { @@ -187,11 +207,14 @@ type GenesisParams struct { BtccheckpointParams btccheckpointtypes.Params EpochingParams epochingtypes.Params BtclightclientBaseBtcHeader btclightclienttypes.BTCHeaderInfo + BlockGasLimit int64 } func TestnetGenesisParams(maxActiveValidators uint32, btcConfirmationDepth uint64, - btcFinalizationTimeout uint64, epochInterval uint64, baseBtcHeaderHex string, - baseBtcHeaderHeight uint64, genesisTime time.Time) GenesisParams { + btcFinalizationTimeout uint64, checkpointTag string, epochInterval uint64, baseBtcHeaderHex string, + baseBtcHeaderHeight uint64, inflationRateChange float64, + inflationMin float64, inflationMax float64, goalBonded float64, + blocksPerYear uint64, genesisTime time.Time, blockGasLimit int64) GenesisParams { genParams := GenesisParams{} @@ -226,9 +249,15 @@ func TestnetGenesisParams(maxActiveValidators uint32, btcConfirmationDepth uint6 genParams.MintParams = minttypes.DefaultParams() genParams.MintParams.MintDenom = genParams.NativeCoinMetadatas[0].Base + genParams.MintParams.BlocksPerYear = blocksPerYear + // This should always work as inflation rate is already a float64 + genParams.MintParams.InflationRateChange = sdk.MustNewDecFromStr(fmt.Sprintf("%f", inflationRateChange)) + genParams.MintParams.InflationMin = sdk.MustNewDecFromStr(fmt.Sprintf("%f", inflationMin)) + genParams.MintParams.InflationMax = sdk.MustNewDecFromStr(fmt.Sprintf("%f", inflationMax)) + genParams.MintParams.GoalBonded = sdk.MustNewDecFromStr(fmt.Sprintf("%f", goalBonded)) genParams.GovParams = govv1.DefaultParams() - genParams.GovParams.DepositParams.MinDeposit = sdk.NewCoins(sdk.NewCoin( + genParams.GovParams.MinDeposit = sdk.NewCoins(sdk.NewCoin( genParams.NativeCoinMetadatas[0].Base, sdk.NewInt(2_500_000_000), )) @@ -241,6 +270,11 @@ func TestnetGenesisParams(maxActiveValidators uint32, btcConfirmationDepth uint6 genParams.BtccheckpointParams = btccheckpointtypes.DefaultParams() genParams.BtccheckpointParams.BtcConfirmationDepth = btcConfirmationDepth genParams.BtccheckpointParams.CheckpointFinalizationTimeout = btcFinalizationTimeout + genParams.BtccheckpointParams.CheckpointTag = checkpointTag + + if err := genParams.BtccheckpointParams.Validate(); err != nil { + panic(err) + } // set the base BTC header in the genesis state baseBtcHeader, err := bbn.NewBTCHeaderBytesFromHex(baseBtcHeaderHex) @@ -256,6 +290,6 @@ func TestnetGenesisParams(maxActiveValidators uint32, btcConfirmationDepth uint6 } genParams.EpochingParams = epochingtypes.DefaultParams() genParams.EpochingParams.EpochInterval = epochInterval - + genParams.BlockGasLimit = blockGasLimit return genParams } diff --git a/cmd/babylond/cmd/root.go b/cmd/babylond/cmd/root.go index c04b2dac8..709402c37 100644 --- a/cmd/babylond/cmd/root.go +++ b/cmd/babylond/cmd/root.go @@ -6,6 +6,15 @@ import ( "os" "path/filepath" + rosettaCmd "cosmossdk.io/tools/rosetta/cmd" + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + dbm "github.com/cometbft/cometbft-db" + tmcfg "github.com/cometbft/cometbft/config" + tmcli "github.com/cometbft/cometbft/libs/cli" + tmtypes "github.com/cometbft/cometbft/types" + + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" @@ -24,13 +33,12 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/crisis" + "github.com/cosmos/cosmos-sdk/x/genutil" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + "github.com/prometheus/client_golang/prometheus" "github.com/spf13/cast" "github.com/spf13/cobra" - tmcfg "github.com/tendermint/tendermint/config" - tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/app/params" @@ -40,7 +48,7 @@ import ( // NewRootCmd creates a new root command for babylond. It is called once in the // main function. func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - encodingConfig := app.MakeTestEncodingConfig() + encodingConfig := app.GetEncodingConfig() initClientCtx := client.Context{}. WithCodec(encodingConfig.Marshaler). WithInterfaceRegistry(encodingConfig.InterfaceRegistry). @@ -133,19 +141,21 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { cfg := sdk.GetConfig() cfg.Seal() + gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) + rootCmd.AddCommand( genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), + genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator), genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd(app.ModuleBasics, encodingConfig.TxConfig, banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome), - ValidateGenesisCmd(app.ModuleBasics), + ValidateGenesisCmd(app.ModuleBasics, gentxModule.GenTxValidator), PrepareGenesisCmd(app.DefaultNodeHome, app.ModuleBasics), AddGenesisAccountCmd(app.DefaultNodeHome), tmcli.NewCompletionCmd(rootCmd, true), TestnetCmd(app.ModuleBasics, banktypes.GenesisBalancesIterator{}), CreateBlsKeyCmd(), GenBlsCmd(), - AddGenBlsCmd(), + AddGenBlsCmd(gentxModule.GenTxValidator), debug.Cmd(), config.Cmd(), ) @@ -162,11 +172,12 @@ func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { ) // add rosetta - rootCmd.AddCommand(server.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) + rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Marshaler)) } func addModuleInitFlags(startCmd *cobra.Command) { crisis.AddModuleInitFlags(startCmd) + wasm.AddModuleInitFlags(startCmd) startCmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") startCmd.Flags().String(flags.FlagChainID, "", "genesis file chain-id, if left blank will be randomly created") @@ -230,6 +241,7 @@ type appCreator struct { func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { var cache sdk.MultiStorePersistentCache + // TODO migrate following option to using server.DefaultBaseappOptions if cast.ToBool(appOpts.Get(server.FlagInterBlockCache)) { cache = store.NewCommitKVStoreCacheManager() } @@ -245,8 +257,20 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a } homeDir := cast.ToString(appOpts.Get(flags.FlagHome)) + + chainID := cast.ToString(appOpts.Get(flags.FlagChainID)) + if chainID == "" { + // fallback to genesis chain-id + appGenesis, err := tmtypes.GenesisDocFromFile(filepath.Join(homeDir, "config", "genesis.json")) + if err != nil { + panic(err) + } + chainID = appGenesis.ChainID + } + snapshotDir := filepath.Join(homeDir, "data", "snapshots") - snapshotDB, err := sdk.NewLevelDB("metadata", snapshotDir) //nolint:staticcheck // Prefer the old-fashioned way. + snapshotDB, err := dbm.NewDB("metadata", server.GetAppDBBackend(appOpts), snapshotDir) + if err != nil { panic(err) } @@ -255,16 +279,12 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a panic(err) } - // parse the key name that will be used for signing BLS-sig txs from app.toml - keyName := bbntypes.ParseKeyNameFromConfig(appOpts) - clientCtx, err := config.ReadFromClientConfig( client.Context{}. WithHomeDir(homeDir). WithViper(""). WithKeyringDir(homeDir). WithInput(os.Stdin). - WithFromName(keyName). // Warning: It is important that ReadFromClientConfig receives context // with already initialized codec. It creates keyring inside, and from cosmos // 0.46.0 keyring requires codec. Without codec, operations performed by @@ -274,7 +294,10 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a if err != nil { panic(err) } - privSigner, err := app.InitPrivSigner(clientCtx, homeDir, clientCtx.Keyring) + // parse the key name that will be used for signing BLS-sig txs from app.toml + keyName := bbntypes.ParseKeyNameFromConfig(appOpts) + + privSigner, err := app.InitPrivSigner(clientCtx, homeDir, clientCtx.Keyring, keyName, a.encCfg) if err != nil { panic(err) } @@ -284,6 +307,11 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a cast.ToUint32(appOpts.Get(server.FlagStateSyncSnapshotKeepRecent)), ) + var wasmOpts []wasm.Option + if cast.ToBool(appOpts.Get("telemetry.enabled")) { + wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) + } + return app.NewBabylonApp( logger, db, traceStore, true, skipUpgradeHeights, cast.ToString(appOpts.Get(flags.FlagHome)), @@ -291,6 +319,8 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a a.encCfg, privSigner, appOpts, + app.GetWasmEnabledProposals(), + wasmOpts, baseapp.SetPruning(pruningOpts), baseapp.SetMinGasPrices(cast.ToString(appOpts.Get(server.FlagMinGasPrices))), baseapp.SetHaltHeight(cast.ToUint64(appOpts.Get(server.FlagHaltHeight))), @@ -302,14 +332,22 @@ func (a appCreator) newApp(logger log.Logger, db dbm.DB, traceStore io.Writer, a baseapp.SetSnapshot(snapshotStore, snapshotOptions), baseapp.SetIAVLCacheSize(cast.ToInt(appOpts.Get(server.FlagIAVLCacheSize))), baseapp.SetIAVLDisableFastNode(cast.ToBool(appOpts.Get(server.FlagDisableIAVLFastNode))), + baseapp.SetChainID(chainID), ) } // appExport creates a new app (optionally at a given height) // and exports state. func (a appCreator) appExport( - logger log.Logger, db dbm.DB, traceStore io.Writer, height int64, forZeroHeight bool, jailAllowedAddrs []string, - appOpts servertypes.AppOptions) (servertypes.ExportedApp, error) { + logger log.Logger, + db dbm.DB, + traceStore io.Writer, + height int64, + forZeroHeight bool, + jailAllowedAddrs []string, + appOpts servertypes.AppOptions, + modulesToExport []string, +) (servertypes.ExportedApp, error) { var babylonApp *app.BabylonApp homePath, ok := appOpts.Get(flags.FlagHome).(string) @@ -337,19 +375,19 @@ func (a appCreator) appExport( panic(err) } - privSigner, err := app.InitPrivSigner(clientCtx, homePath, kr) + privSigner, err := app.InitPrivSigner(clientCtx, homePath, kr, "", a.encCfg) if err != nil { panic(err) } if height != -1 { - babylonApp = app.NewBabylonApp(logger, db, traceStore, false, map[int64]bool{}, homePath, uint(1), a.encCfg, privSigner, appOpts) + babylonApp = app.NewBabylonApp(logger, db, traceStore, false, map[int64]bool{}, homePath, uint(1), a.encCfg, privSigner, appOpts, app.GetWasmEnabledProposals(), app.EmptyWasmOpts) if err = babylonApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } } else { - babylonApp = app.NewBabylonApp(logger, db, traceStore, true, map[int64]bool{}, homePath, uint(1), a.encCfg, privSigner, appOpts) + babylonApp = app.NewBabylonApp(logger, db, traceStore, true, map[int64]bool{}, homePath, uint(1), a.encCfg, privSigner, appOpts, app.GetWasmEnabledProposals(), app.EmptyWasmOpts) } - return babylonApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs) + return babylonApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) } diff --git a/cmd/babylond/cmd/testnet.go b/cmd/babylond/cmd/testnet.go index 6cd7d9b74..6f3ac6cc1 100644 --- a/cmd/babylond/cmd/testnet.go +++ b/cmd/babylond/cmd/testnet.go @@ -10,9 +10,9 @@ import ( "net" "os" "path/filepath" + "time" appparams "github.com/babylonchain/babylon/app/params" - txformat "github.com/babylonchain/babylon/btctxformatter" bbn "github.com/babylonchain/babylon/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" @@ -24,11 +24,11 @@ import ( checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + tmconfig "github.com/cometbft/cometbft/config" + tmos "github.com/cometbft/cometbft/libs/os" + "github.com/cometbft/cometbft/types" + tmtime "github.com/cometbft/cometbft/types/time" "github.com/spf13/cobra" - tmconfig "github.com/tendermint/tendermint/config" - tmos "github.com/tendermint/tendermint/libs/os" - "github.com/tendermint/tendermint/types" - tmtime "github.com/tendermint/tendermint/types/time" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -53,8 +53,8 @@ var ( flagNodeDaemonHome = "node-daemon-home" flagStartingIPAddress = "starting-ip-address" flagBtcNetwork = "btc-network" - flagBtcCheckpointTag = "btc-checkpoint-tag" flagAdditionalSenderAccount = "additional-sender-account" + flagTimeBetweenBlocks = "time-between-blocks-seconds" ) // TestnetCmd initializes all files for tendermint testnet and application @@ -87,23 +87,25 @@ Example: nodeDaemonHome, _ := cmd.Flags().GetString(flagNodeDaemonHome) startingIPAddress, _ := cmd.Flags().GetString(flagStartingIPAddress) numValidators, _ := cmd.Flags().GetInt(flagNumValidators) - algo, _ := cmd.Flags().GetString(flags.FlagKeyAlgorithm) + algo, _ := cmd.Flags().GetString(flags.FlagKeyType) btcNetwork, _ := cmd.Flags().GetString(flagBtcNetwork) - btcCheckpointTag, _ := cmd.Flags().GetString(flagBtcCheckpointTag) 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, - genesisCliArgs.BtcConfirmationDepth, genesisCliArgs.BtcFinalizationTimeout, + genesisCliArgs.BtcConfirmationDepth, genesisCliArgs.BtcFinalizationTimeout, genesisCliArgs.CheckpointTag, genesisCliArgs.EpochInterval, genesisCliArgs.BaseBtcHeaderHex, - genesisCliArgs.BaseBtcHeaderHeight, genesisCliArgs.GenesisTime) + genesisCliArgs.BaseBtcHeaderHeight, genesisCliArgs.InflationRateChange, + genesisCliArgs.InflationMin, genesisCliArgs.InflationMax, genesisCliArgs.GoalBonded, + genesisCliArgs.BlocksPerYear, genesisCliArgs.GenesisTime, genesisCliArgs.BlockGasLimit) return InitTestnet( clientCtx, cmd, config, mbm, genBalIterator, outputDir, genesisCliArgs.ChainID, minGasPrices, nodeDirPrefix, nodeDaemonHome, startingIPAddress, keyringBackend, algo, numValidators, - btcNetwork, btcCheckpointTag, additionalAccount, genesisParams, + btcNetwork, additionalAccount, timeBetweenBlocks, genesisParams, ) }, } @@ -115,10 +117,10 @@ Example: cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") cmd.Flags().String(server.FlagMinGasPrices, fmt.Sprintf("0.000006%s", appparams.BaseCoinUnit), "Minimum gas prices to accept for transactions; All fees in a tx must meet this minimum (e.g. 0.001bbn)") cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") - cmd.Flags().String(flags.FlagKeyAlgorithm, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") + cmd.Flags().String(flags.FlagKeyType, string(hd.Secp256k1Type), "Key signing algorithm to generate keys for") cmd.Flags().String(flagBtcNetwork, string(bbn.BtcSimnet), "Bitcoin network to use. Available networks: simnet, testnet, regtest, mainnet") - cmd.Flags().String(flagBtcCheckpointTag, string(txformat.DefaultTestTagStr), "Tag to use for Bitcoin checkpoints.") cmd.Flags().Bool(flagAdditionalSenderAccount, false, "If there should be additional pre funded account per validator") + cmd.Flags().Uint64(flagTimeBetweenBlocks, 5, "Time between blocks in seconds") addGenesisFlags(cmd) return cmd @@ -143,8 +145,8 @@ func InitTestnet( algoStr string, numValidators int, btcNetwork string, - btcCheckpointTag string, additionalAccount bool, + timeBetweenBlocks uint64, genesisParams GenesisParams, ) error { @@ -154,15 +156,17 @@ func InitTestnet( babylonConfig := DefaultBabylonConfig() babylonConfig.MinGasPrices = minGasPrices babylonConfig.API.Enable = true + babylonConfig.API.Address = "tcp://0.0.0.0:1317" babylonConfig.Telemetry.Enabled = true babylonConfig.Telemetry.PrometheusRetentionTime = 60 babylonConfig.Telemetry.EnableHostnameLabel = false babylonConfig.Telemetry.GlobalLabels = [][]string{{"chain_id", chainID}} // BTC related config. Default values "simnet" and "BBT1" babylonConfig.BtcConfig.Network = btcNetwork - babylonConfig.BtcConfig.CheckpointTag = btcCheckpointTag // Explorer related config. Allow CORS connections. babylonConfig.API.EnableUnsafeCORS = true + babylonConfig.GRPC.Address = "0.0.0.0:9090" + babylonConfig.GRPCWeb.Address = "0.0.0.0:9091" var ( genAccounts []authtypes.GenesisAccount @@ -188,6 +192,8 @@ func InitTestnet( nodeConfig.Instrumentation.Prometheus = true // Set the number of simultaneous connections to unlimited nodeConfig.Instrumentation.MaxOpenConnections = 0 + // Time between blocks + nodeConfig.Consensus.TimeoutCommit = time.Second * time.Duration(timeBetweenBlocks) if err := os.MkdirAll(filepath.Join(nodeDir, "config"), nodeDirPerm); err != nil { _ = os.RemoveAll(outputDir) @@ -397,21 +403,16 @@ func initGenFiles( // set the bls keys for the checkpointing module genesisParams.CheckpointingGenKeys = genKeys - appGenState, _, err = PrepareGenesis(clientCtx, appGenState, &types.GenesisDoc{}, genesisParams, chainID) - if err != nil { - return err - } + genDoc := &types.GenesisDoc{} + + err = PrepareGenesis(clientCtx, appGenState, genDoc, genesisParams, chainID) - appGenStateJSON, err := json.MarshalIndent(appGenState, "", " ") if err != nil { return err } - - genDoc := types.GenesisDoc{ - ChainID: chainID, - AppState: appGenStateJSON, - Validators: nil, - } + // set initial validators to nil, they will be added by collectGenFiles based on + // genesis tranascations + genDoc.Validators = nil // generate empty genesis files for each validator and save for i := 0; i < numValidators; i++ { @@ -447,7 +448,14 @@ func collectGenFiles( return err } - nodeAppState, err := genutil.GenAppStateFromConfig(clientCtx.Codec, clientCtx.TxConfig, nodeConfig, initCfg, *genDoc, genBalIterator) + nodeAppState, err := genutil.GenAppStateFromConfig( + clientCtx.Codec, + clientCtx.TxConfig, + nodeConfig, initCfg, + *genDoc, + genBalIterator, + genutiltypes.DefaultMessageValidator, + ) if err != nil { return err } @@ -457,10 +465,17 @@ func collectGenFiles( appState = nodeAppState } + // overwrite each validator's genesis file to have a canonical genesis time genFile := nodeConfig.GenesisFile() - // overwrite each validator's genesis file to have a canonical genesis time - if err := genutil.ExportGenesisFileWithTime(genFile, chainID, nil, appState, genTime); err != nil { + newGendoc := types.GenesisDoc{ + GenesisTime: genTime, + AppState: appState, + ConsensusParams: genDoc.ConsensusParams, + ChainID: genDoc.ChainID, + } + + if err := genutil.ExportGenesisFile(&newGendoc, genFile); err != nil { return err } } diff --git a/cmd/babylond/cmd/testnet_test.go b/cmd/babylond/cmd/testnet_test.go index a8660c821..82215080b 100644 --- a/cmd/babylond/cmd/testnet_test.go +++ b/cmd/babylond/cmd/testnet_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/babylonchain/babylon/app" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" @@ -14,12 +14,13 @@ import ( genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/spf13/viper" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" + + "github.com/babylonchain/babylon/app" ) func Test_TestnetCmd(t *testing.T) { home := t.TempDir() - encodingConfig := app.MakeTestEncodingConfig() + encodingConfig := app.GetEncodingConfig() logger := log.NewNopLogger() cfg, err := genutiltest.CreateDefaultTendermintConfig(home) require.NoError(t, err) diff --git a/cmd/babylond/cmd/validate_genesis.go b/cmd/babylond/cmd/validate_genesis.go index 68d80d75e..d17818bd3 100644 --- a/cmd/babylond/cmd/validate_genesis.go +++ b/cmd/babylond/cmd/validate_genesis.go @@ -7,12 +7,12 @@ import ( "github.com/spf13/cobra" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/types/module" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - tmtypes "github.com/tendermint/tendermint/types" "github.com/babylonchain/babylon/x/checkpointing/types" ) @@ -25,7 +25,7 @@ const chainUpgradeGuide = "https://github.com/cosmos/cosmos-sdk/blob/a51aa517c46 // 2. each genesis BLS key or gentx should have a corresponding gentx or genesis // BLS key // modified based on "https://github.com/cosmos/cosmos-sdk/blob/6d32debf1aca4b7f1ed1429d87be1d02c315f02d/x/genutil/client/cli/validate_genesis.go" -func ValidateGenesisCmd(mbm module.BasicManager) *cobra.Command { +func ValidateGenesisCmd(mbm module.BasicManager, validator genutiltypes.MessageValidator) *cobra.Command { return &cobra.Command{ Use: "validate-genesis [file]", Args: cobra.RangeArgs(0, 1), @@ -58,7 +58,7 @@ func ValidateGenesisCmd(mbm module.BasicManager) *cobra.Command { return fmt.Errorf("error validating genesis file %s: %s", genesis, err.Error()) } - if err = CheckCorrespondence(clientCtx, genState); err != nil { + if err = CheckCorrespondence(clientCtx, genState, validator); err != nil { return fmt.Errorf("error validating genesis file correspondence %s: %s", genesis, err.Error()) } @@ -86,7 +86,7 @@ func validateGenDoc(importGenesisFile string) (*tmtypes.GenesisDoc, error) { // CheckCorrespondence checks that each genesis tx/BLS key should have one // corresponding BLS key/genesis tx -func CheckCorrespondence(ctx client.Context, genesis map[string]json.RawMessage) error { +func CheckCorrespondence(ctx client.Context, genesis map[string]json.RawMessage, validator genutiltypes.MessageValidator) error { checkpointingGenState := types.GetGenesisStateFromAppState(ctx.Codec, genesis) gks := checkpointingGenState.GetGenesisKeys() genTxState := genutiltypes.GetGenesisStateFromAppState(ctx.Codec, genesis) @@ -105,7 +105,7 @@ func CheckCorrespondence(ctx client.Context, genesis map[string]json.RawMessage) } // ensure every gentx has a match with BLS key by address for _, genTx := range genTxState.GenTxs { - tx, err := genutiltypes.ValidateAndGetGenTx(genTx, ctx.TxConfig.TxJSONDecoder()) + tx, err := genutiltypes.ValidateAndGetGenTx(genTx, ctx.TxConfig.TxJSONDecoder(), validator) if err != nil { return err } diff --git a/cmd/babylond/cmd/validate_genesis_test.go b/cmd/babylond/cmd/validate_genesis_test.go index 070ce5037..5406591d9 100644 --- a/cmd/babylond/cmd/validate_genesis_test.go +++ b/cmd/babylond/cmd/validate_genesis_test.go @@ -6,6 +6,7 @@ import ( "fmt" "testing" + "github.com/cosmos/cosmos-sdk/x/genutil" "github.com/spf13/viper" "github.com/stretchr/testify/require" @@ -13,20 +14,20 @@ import ( "github.com/babylonchain/babylon/cmd/babylond/cmd" "github.com/babylonchain/babylon/x/checkpointing/types" + tmjson "github.com/cometbft/cometbft/libs/json" + "github.com/cometbft/cometbft/libs/log" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" genutiltest "github.com/cosmos/cosmos-sdk/x/genutil/client/testutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - tmjson "github.com/tendermint/tendermint/libs/json" - "github.com/tendermint/tendermint/libs/log" - tmtypes "github.com/tendermint/tendermint/types" ) func TestCheckCorrespondence(t *testing.T) { homePath := t.TempDir() - encodingCft := app.MakeTestEncodingConfig() + encodingCft := app.GetEncodingConfig() clientCtx := client.Context{}.WithCodec(encodingCft.Marshaler).WithTxConfig(encodingCft.TxConfig) // generate valid genesis doc @@ -68,6 +69,8 @@ func TestCheckCorrespondence(t *testing.T) { }, } + gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) + for _, tc := range testCases { genDoc, err := tmtypes.GenesisDocFromJSON(tc.genesis) require.NoError(t, err) @@ -75,7 +78,7 @@ func TestCheckCorrespondence(t *testing.T) { genesisState, err := genutiltypes.GenesisStateFromGenDoc(*genDoc) require.NoError(t, err) require.NotEmpty(t, genesisState) - err = cmd.CheckCorrespondence(clientCtx, genesisState) + err = cmd.CheckCorrespondence(clientCtx, genesisState, gentxModule.GenTxValidator) if tc.expErr { require.Error(t, err) } else { @@ -85,7 +88,7 @@ func TestCheckCorrespondence(t *testing.T) { } func generateTestGenesisState(home string, n int) (map[string]json.RawMessage, *tmtypes.GenesisDoc) { - encodingConfig := app.MakeTestEncodingConfig() + encodingConfig := app.GetEncodingConfig() logger := log.NewNopLogger() cfg, _ := genutiltest.CreateDefaultTendermintConfig(home) diff --git a/contrib/images/Makefile b/contrib/images/Makefile index 998778ef6..711077c7e 100644 --- a/contrib/images/Makefile +++ b/contrib/images/Makefile @@ -1,14 +1,10 @@ -all: babylond-env +all: babylond -babylond-env: babylond-rmi - docker build --tag babylonchain/babylond -f babylond-env/Dockerfile \ +babylond: babylond-rmi + docker build --tag babylonchain/babylond -f babylond/Dockerfile \ $(shell git rev-parse --show-toplevel) -babylond-dlv: babylond-rmi - docker build --tag babylonchain/babylond -f babylond-dlv/Dockerfile \ - $(shell git rev-parse --show-toplevel) - babylond-rmi: docker rmi babylonchain/babylond 2>/dev/null; true -.PHONY: all babylond-env babylond-dlv babylond-rmi +.PHONY: all babylondbabylond-rmi diff --git a/contrib/images/babylond-dlv/Dockerfile b/contrib/images/babylond-dlv/Dockerfile deleted file mode 100644 index 79f1cfaba..000000000 --- a/contrib/images/babylond-dlv/Dockerfile +++ /dev/null @@ -1,22 +0,0 @@ -FROM golang:1.19-alpine AS build -RUN apk add build-base git linux-headers libc-dev -RUN go install github.com/go-delve/delve/cmd/dlv@latest -WORKDIR /work -COPY go.mod go.sum /work/ -RUN go mod download -COPY ./ /work -RUN LEDGER_ENABLED=false make COSMOS_BUILD_OPTIONS="debug,nostrip" clean build - -FROM alpine:3.14 AS run -RUN apk add bash curl jq -COPY contrib/images/babylond-dlv/wrapper.sh /usr/bin/wrapper.sh - -VOLUME /babylond -COPY --from=build /work/build/babylond /babylond/ -COPY --from=build /go/bin/dlv /usr/local/bin -WORKDIR /babylond - -EXPOSE 26656 26657 2345 1317 -ENTRYPOINT ["/usr/bin/wrapper.sh"] -CMD ["start", "--log_format", "plain"] -STOPSIGNAL SIGTERM diff --git a/contrib/images/babylond-dlv/README.md b/contrib/images/babylond-dlv/README.md deleted file mode 100644 index 9cf7671c5..000000000 --- a/contrib/images/babylond-dlv/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# Remote Debugging with go-delve - -[Delve](https://github.com/go-delve/delve) is a debugger for the Go programming language. The goal of the project is to provide a simple, full featured debugging tool for Go. Delve should be easy to invoke and easy to use. Chances are if you're using a debugger, things aren't going your way. With that in mind, Delve should stay out of your way as much as possible. - -## Use-case - -Cosmos-SDK provides you with a local network to bootstrap a chain in your machine, but how does one debug a node or module? - -If we start a single node, we won't be able to debug transactions as the machine will be in bootstrapping phase trying to find peers to connect too, thats why we need to start a local network. - -But the current `localnet-start` does not provide us with debugging tools so that's why there is a different image for debugging a local network, that is to avoid any issues in the future were debugging won't be needed. - -Both `babylond-env` and `babylond-dlv` work and run the same, except that `babylond-dlv` uses `go-delve` to run the binaries. - -## How to use - -The command to start a local network in debug mode is: - -```shell -# make localnet-debug -``` - -The command to stop the local network and destroy its containers is: - -```shell -# make localnet-stop -``` - -__note: this works the same for both `localnet-start` and `localnet-debug`__ - -Now, by default only `babylonnode0` is run in debug mode, but you can run any of the other nodes in debug mode by changing the `DEBUG` environment variable to `1` in `docker-compose.yml`. - -## How to connect - -Delve will open a port on `2345` for `babylonnode0` and it will increment for each of the other nodes that have `DEBUG` set to `1`. - -You can connect to the debugging server either through [GoLand IDE](https://www.jetbrains.com/help/go/attach-to-running-go-processes-with-debugger.html) or you can use [delve cli](https://github.com/go-delve/delve/blob/master/Documentation/usage/dlv_connect.md) command. diff --git a/contrib/images/babylond-dlv/wrapper.sh b/contrib/images/babylond-dlv/wrapper.sh deleted file mode 100755 index 21b6badbb..000000000 --- a/contrib/images/babylond-dlv/wrapper.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env sh -set -euo pipefail -set -x - -DEBUG=${DEBUG:-0} -BINARY=/babylond/${BINARY:-babylond} -LOG=${LOG:-babylond.log} - -if ! [ -f "${BINARY}" ]; then - echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'babylond'" - exit 1 -fi - -export BABYLONDHOME="${HOME:-/data/node0/babylond}" - -if [ "$DEBUG" -eq 1 ]; then - dlv --listen=:2345 --continue --headless=true --api-version=2 --accept-multiclient exec "${BINARY}" -- --home "${BABYLONDHOME}" "$@" -elif [ "$DEBUG" -eq 1 ] && [ -d "$(dirname "${BABYLONDHOME}"/"${LOG}")" ]; then - dlv --listen=:2345 --continue --headless=true --api-version=2 --accept-multiclient exec "${BINARY}" -- --home "${BABYLONDHOME}" "$@" | tee "${BABYLONDHOME}/${LOG}" -elif [ -d "$(dirname "${BABYLONDHOME}"/"${LOG}")" ]; then - "${BINARY}" --home "${BABYLONDHOME}" "$@" | tee "${BABYLONDHOME}/${LOG}" -else - "${BINARY}" --home "${BABYLONDHOME}" "$@" -fi diff --git a/contrib/images/babylond-env/Dockerfile b/contrib/images/babylond-env/Dockerfile deleted file mode 100644 index 9fe29b87c..000000000 --- a/contrib/images/babylond-env/Dockerfile +++ /dev/null @@ -1,21 +0,0 @@ -FROM golang:1.19-alpine AS build -RUN apk add build-base git linux-headers -WORKDIR /work -COPY go.mod go.sum /work/ - -RUN go mod download -COPY ./ /work -RUN LEDGER_ENABLED=false make clean build - -FROM alpine:3.14 AS run -RUN apk add bash curl jq -COPY contrib/images/babylond-env/wrapper.sh /usr/bin/wrapper.sh - -VOLUME /babylond -COPY --from=build /work/build/babylond /babylond/ -WORKDIR /babylond - -EXPOSE 26656 26657 1317 -ENTRYPOINT ["/usr/bin/wrapper.sh"] -CMD ["start", "--log_format", "plain"] -STOPSIGNAL SIGTERM diff --git a/contrib/images/babylond-env/wrapper.sh b/contrib/images/babylond-env/wrapper.sh deleted file mode 100755 index 539f5588a..000000000 --- a/contrib/images/babylond-env/wrapper.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env sh -set -euo pipefail -set -x - -BINARY=/babylond/${BINARY:-babylond} -LOG=${LOG:-babylond.log} - -if ! [ -f "${BINARY}" ]; then - echo "The binary $(basename "${BINARY}") cannot be found. Please add the binary to the shared folder. Please use the BINARY environment variable if the name of the binary is not 'babylond'" - exit 1 -fi - -export BABYLONDHOME="${HOME:-/data/node0/babylond}" - -if [ -d "$(dirname "${BABYLONDHOME}"/"${LOG}")" ]; then - "${BINARY}" --home "${BABYLONDHOME}" "$@" 2>&1 | tee "${BABYLONDHOME}/${LOG}" -else - "${BINARY}" --home "${BABYLONDHOME}" "$@" -fi diff --git a/contrib/images/babylond/Dockerfile b/contrib/images/babylond/Dockerfile new file mode 100644 index 000000000..11bb49450 --- /dev/null +++ b/contrib/images/babylond/Dockerfile @@ -0,0 +1,60 @@ +FROM golang:1.20-alpine AS build-env + +# Customize to your build env + +# TARGETPLATFORM should be one of linux/amd64 or linux/arm64. +ARG TARGETPLATFORM="linux/amd64" +# Version to build. Default is the Git HEAD. +ARG VERSION="HEAD" + +# Use muslc for static libs +ARG BUILD_TAGS="muslc" +ARG LEDGER_ENABLED="false" +# Cosmos build options +ARG COSMOS_BUILD_OPTIONS="" + +# Install cli tools for building and final image +RUN apk add --update --no-cache make git bash gcc linux-headers eudev-dev ncurses-dev openssh curl jq +RUN apk add --no-cache musl-dev + +# Build +WORKDIR /go/src/github.com/babylonchain/babylon +# First cache dependencies +COPY go.mod go.sum /go/src/github.com/babylonchain/babylon/ +RUN go mod download +# Then copy everything else +COPY ./ /go/src/github.com/babylonchain/babylon/ +RUN git checkout -f ${VERSION} + +# Cosmwasm - Download correct libwasmvm version +RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \ + wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$(uname -m).a \ + -O /lib/libwasmvm_muslc.a && \ + # verify checksum + wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \ + sha256sum /lib/libwasmvm_muslc.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$(uname -m) | cut -d ' ' -f 1) + +RUN LEDGER_ENABLED=$LEDGER_ENABLED \ + BUILD_TAGS=$BUILD_TAGS \ + COSMOS_BUILD_OPTIONS=$COSMOS_BUILD_OPTIONS \ + LINK_STATICALLY=true \ + make build + +FROM alpine:3.14 AS run +# Create a user +RUN addgroup --gid 1137 -S babylon && adduser --uid 1137 -S babylon -G babylon +RUN apk add bash curl jq + +# Label should match your github repo +LABEL org.opencontainers.image.source="https://github.com/babylonchain/babylond:${VERSION}" + +# Install Libraries +# COPY --from=build-env /usr/lib/libgcc_s.so.1 /lib/ +# COPY --from=build-env /lib/ld-musl*.so.1* /lib + +COPY --from=build-env /go/src/github.com/babylonchain/babylon/build/babylond /bin/babylond + +# Set home directory and user +WORKDIR /home/babylon +RUN chown -R babylon /home/babylon +USER babylon diff --git a/crypto/bls12381/bls.go b/crypto/bls12381/bls.go index 02ce9b3c8..114db2af3 100644 --- a/crypto/bls12381/bls.go +++ b/crypto/bls12381/bls.go @@ -2,9 +2,9 @@ package bls12381 import ( "crypto/rand" + tmcrypto "github.com/cometbft/cometbft/crypto" "github.com/pkg/errors" blst "github.com/supranational/blst/bindings/go" - tmcrypto "github.com/tendermint/tendermint/crypto" "io" ) diff --git a/docker-compose.yml b/docker-compose.yml index 0acb4f90d..e864519c6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,10 +4,8 @@ services: babylondnode0: container_name: babylondnode0 image: "babylonchain/babylond" - environment: - - DEBUG=1 - - HOME=/data/node0/babylond - - LOG=${LOG:-babylond.log} + command: > + babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log cap_add: - SYS_PTRACE security_opt: @@ -18,7 +16,7 @@ services: - "9090:9090" - "2345:2345" volumes: - - ./.testnets:/data:Z + - ./.testnets/node0/babylond:/babylondhome:Z networks: localnet: ipv4_address: 192.168.10.2 @@ -26,10 +24,8 @@ services: babylondnode1: container_name: babylondnode1 image: "babylonchain/babylond" - environment: - - DEBUG=0 - - HOME=/data/node1/babylond - - LOG=${LOG:-babylond.log} + command: > + babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log cap_add: - SYS_PTRACE security_opt: @@ -40,7 +36,7 @@ services: - "9091:9090" - "2346:2345" volumes: - - ./.testnets:/data:Z + - ./.testnets/node1/babylond:/babylondhome:Z networks: localnet: ipv4_address: 192.168.10.3 @@ -49,9 +45,10 @@ services: container_name: babylondnode2 image: "babylonchain/babylond" environment: - - DEBUG=0 - HOME=/data/node2/babylond - LOG=${LOG:-babylond.log} + command: > + babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log cap_add: - SYS_PTRACE security_opt: @@ -62,7 +59,7 @@ services: - "9092:9090" - "2347:2345" volumes: - - ./.testnets:/data:Z + - ./.testnets/node2/babylond:/babylondhome:Z networks: localnet: ipv4_address: 192.168.10.4 @@ -71,9 +68,10 @@ services: container_name: babylondnode3 image: "babylonchain/babylond" environment: - - DEBUG=0 - HOME=/data/node3/babylond - LOG=${LOG:-babylond.log} + command: > + babylond --home /babylondhome start --log_format 'plain' 2>&1 | tee /babylondhome/babylond.log cap_add: - SYS_PTRACE security_opt: @@ -84,7 +82,7 @@ services: - "9093:9090" - "2348:2345" volumes: - - ./.testnets:/data:Z + - ./.testnets/node3/babylond:/babylondhome:Z networks: localnet: ipv4_address: 192.168.10.5 diff --git a/go.mod b/go.mod index 2c7954cc8..d71a4bd01 100644 --- a/go.mod +++ b/go.mod @@ -1,75 +1,75 @@ -go 1.19 +go 1.20 module github.com/babylonchain/babylon require ( - github.com/btcsuite/btcd v0.22.3 - github.com/cosmos/cosmos-sdk v0.46.6 - github.com/gogo/protobuf v1.3.3 - github.com/golang/protobuf v1.5.2 + github.com/CosmWasm/wasmd v0.40.0-rc.1 + github.com/btcsuite/btcd v0.23.4 + github.com/cometbft/cometbft v0.37.1 + github.com/cometbft/cometbft-db v0.7.0 + github.com/cosmos/cosmos-sdk v0.47.2 + github.com/golang/protobuf v1.5.3 github.com/gorilla/mux v1.8.0 github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/pkg/errors v0.9.1 - github.com/rakyll/statik v0.1.7 + github.com/rakyll/statik v0.1.7 // indirect github.com/spf13/cast v1.5.0 - github.com/spf13/cobra v1.6.0 - github.com/spf13/viper v1.13.0 - github.com/stretchr/testify v1.8.0 + github.com/spf13/cobra v1.6.1 + github.com/spf13/viper v1.15.0 + github.com/stretchr/testify v1.8.2 github.com/supranational/blst v0.3.8 - github.com/tendermint/tendermint v0.34.24 - github.com/tendermint/tm-db v0.6.7 - google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a - google.golang.org/grpc v1.51.0 - gopkg.in/yaml.v2 v2.4.0 + google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 + google.golang.org/grpc v1.54.0 + gopkg.in/yaml.v2 v2.4.0 // indirect ) require ( + cosmossdk.io/api v0.3.1 cosmossdk.io/errors v1.0.0-beta.7 - cosmossdk.io/math v1.0.0-beta.3 + cosmossdk.io/math v1.0.0 + cosmossdk.io/tools/rosetta v0.2.1 + github.com/CosmWasm/wasmvm v1.2.3 github.com/boljen/go-bitmap v0.0.0-20151001105940-23cd2fb0ce7d + github.com/btcsuite/btcd/btcutil v1.1.2 github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 - github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce - github.com/cosmos/cosmos-proto v1.0.0-alpha7 - github.com/cosmos/ibc-go/v5 v5.1.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.2 + github.com/cosmos/gogoproto v1.4.8 + github.com/cosmos/ibc-go/v7 v7.0.0 github.com/golang/mock v1.6.0 github.com/jinzhu/copier v0.3.5 github.com/ory/dockertest/v3 v3.9.1 - google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8 + google.golang.org/protobuf v1.30.0 ) require ( - filippo.io/edwards25519 v1.0.0-rc.1 // indirect + filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/keyring v1.2.1 // indirect github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect - github.com/Workiva/go-datastructures v1.0.53 // indirect - github.com/armon/go-metrics v0.4.0 + github.com/armon/go-metrics v0.4.1 github.com/beorn7/perks v1.0.1 // indirect - github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.1.2 // indirect - github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/confio/ics23/go v0.7.0 // indirect - github.com/cosmos/btcutil v1.0.4 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/confio/ics23/go v0.9.0 // indirect + github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 - github.com/cosmos/iavl v0.19.4 // indirect - github.com/cosmos/ledger-cosmos-go v0.11.1 // indirect - github.com/cosmos/ledger-go v0.9.2 // indirect + github.com/cosmos/iavl v0.20.0 // indirect + github.com/cosmos/ledger-cosmos-go v0.12.1 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect - github.com/dgraph-io/ristretto v0.1.0 // indirect + github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect + github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect - github.com/fsnotify/fsnotify v1.5.4 // indirect + github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect - github.com/go-logfmt/logfmt v0.5.1 // indirect + github.com/go-logfmt/logfmt v0.6.0 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect - github.com/gogo/gateway v1.1.0 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/btree v1.0.1 // indirect + github.com/google/btree v1.1.2 // indirect github.com/google/orderedcode v0.0.1 // indirect github.com/gorilla/handlers v1.5.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect @@ -80,112 +80,122 @@ require ( github.com/hashicorp/go-immutable-radix v1.3.1 // indirect github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect github.com/hashicorp/hcl v1.0.0 // indirect - github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 // indirect + github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect - github.com/inconshreveable/mousetrap v1.0.1 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d // indirect - github.com/klauspost/compress v1.15.11 // indirect - github.com/lib/pq v1.10.6 // indirect + github.com/klauspost/compress v1.16.3 // indirect + github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/magiconair/properties v1.8.6 // indirect - github.com/mattn/go-isatty v0.0.16 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect + github.com/magiconair/properties v1.8.7 // indirect + github.com/mattn/go-isatty v0.0.17 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect - github.com/pelletier/go-toml v1.9.5 // indirect - github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 // indirect + github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/prometheus/client_golang v1.12.2 // indirect - github.com/prometheus/client_model v0.2.0 // indirect - github.com/prometheus/common v0.34.0 // indirect - github.com/prometheus/procfs v0.8.0 // indirect + github.com/prometheus/client_golang v1.15.0 + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rs/cors v1.8.2 // indirect - github.com/rs/zerolog v1.27.0 // indirect + github.com/rs/cors v1.8.3 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect - github.com/spf13/afero v1.8.2 // indirect + github.com/spf13/afero v1.9.3 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 - github.com/subosito/gotenv v1.4.1 // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect - github.com/tendermint/btcd v0.1.1 // indirect - github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect + github.com/subosito/gotenv v1.4.2 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 // indirect - go.etcd.io/bbolt v1.3.6 // indirect - golang.org/x/crypto v0.1.0 // indirect - golang.org/x/sys v0.2.0 // indirect - golang.org/x/term v0.2.0 // indirect - golang.org/x/text v0.4.0 // indirect + github.com/zondax/hid v0.9.1 // indirect + go.etcd.io/bbolt v1.3.7 // indirect + golang.org/x/crypto v0.7.0 // indirect + golang.org/x/sys v0.7.0 // indirect + golang.org/x/term v0.7.0 // indirect + golang.org/x/text v0.9.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect nhooyr.io/websocket v1.8.6 // indirect ) require ( - cloud.google.com/go v0.102.1 // indirect - cloud.google.com/go/compute v1.7.0 // indirect - cloud.google.com/go/iam v0.4.0 // indirect - cloud.google.com/go/storage v1.22.1 // indirect + cloud.google.com/go v0.110.0 // indirect + cloud.google.com/go/compute v1.18.0 // indirect + cloud.google.com/go/compute/metadata v0.2.3 // indirect + cloud.google.com/go/iam v0.12.0 // indirect + cloud.google.com/go/storage v1.29.0 // indirect + cosmossdk.io/core v0.5.1 // indirect + cosmossdk.io/depinject v1.0.0-alpha.3 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Microsoft/go-winio v0.6.0 // indirect github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect - github.com/aws/aws-sdk-go v1.40.45 // indirect + github.com/aws/aws-sdk-go v1.44.203 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect + github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cenkalti/backoff/v4 v4.2.0 // indirect - github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect + github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect + github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/containerd/continuity v0.3.0 // indirect - github.com/cosmos/gorocksdb v1.2.0 // indirect - github.com/creachadair/taskgroup v0.3.2 // indirect + github.com/cosmos/gogogateway v1.2.0 // indirect + github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab // indirect + github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect + github.com/creachadair/taskgroup v0.4.2 // indirect github.com/danieljoos/wincred v1.1.2 // indirect + github.com/decred/dcrd/crypto/blake256 v1.0.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect github.com/docker/cli v20.10.21+incompatible // indirect - github.com/docker/docker v20.10.21+incompatible // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/docker v20.10.24+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect - github.com/felixge/httpsnoop v1.0.1 // indirect - github.com/golang/glog v1.0.0 // indirect + github.com/felixge/httpsnoop v1.0.2 // indirect + github.com/gogo/googleapis v1.4.1 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang/glog v1.1.0 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/google/go-cmp v0.5.9 // indirect + github.com/google/gofuzz v1.2.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect - github.com/googleapis/gax-go/v2 v2.4.0 // indirect - github.com/googleapis/go-type-adapters v1.0.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect + github.com/googleapis/gax-go/v2 v2.7.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.6.1 // indirect + github.com/hashicorp/go-getter v1.7.1 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect + github.com/huandu/skiplist v1.2.0 // indirect github.com/imdario/mergo v0.3.13 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/manifoldco/promptui v0.9.0 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/go-testing-interface v1.0.0 // indirect + github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/moby/term v0.0.0-20221120202655-abb19827d345 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect - github.com/opencontainers/runc v1.1.4 // indirect - github.com/pelletier/go-toml/v2 v2.0.5 // indirect - github.com/regen-network/cosmos-proto v0.3.1 // indirect - github.com/rogpeppe/go-internal v1.8.1 // indirect + github.com/opencontainers/runc v1.1.5 // indirect + github.com/pelletier/go-toml/v2 v2.0.6 // indirect github.com/sirupsen/logrus v1.9.0 // indirect - github.com/ulikunitz/xz v0.5.8 // indirect + github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect + github.com/tidwall/btree v1.6.0 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect - go.opencensus.io v0.23.0 // indirect - golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect - golang.org/x/mod v0.7.0 // indirect - golang.org/x/net v0.2.0 // indirect - golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect - golang.org/x/tools v0.3.0 // indirect - golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect - google.golang.org/api v0.93.0 // indirect + github.com/zondax/ledger-go v0.14.1 // indirect + go.opencensus.io v0.24.0 // indirect + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect + golang.org/x/mod v0.8.0 // indirect + golang.org/x/net v0.9.0 // indirect + golang.org/x/oauth2 v0.5.0 // indirect + golang.org/x/tools v0.6.0 // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect + google.golang.org/api v0.110.0 // indirect google.golang.org/appengine v1.6.7 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + pgregory.net/rapid v0.5.5 // indirect sigs.k8s.io/yaml v1.3.0 // indirect ) @@ -194,10 +204,12 @@ replace ( // slay the dragonberry github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 - github.com/cosmos/ibc-go/v5 => github.com/babylonchain/ibc-go/v5 v5.0.1-0.20221107054049-dbf7e4efe6fd + github.com/cosmos/ibc-go/v7 => github.com/babylonchain/ibc-go/v7 v7.0.0-20230324085744-4d6a0d2c0fcf // 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.7.0 - github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 + + // Downgraded to stable version see: https://github.com/cosmos/cosmos-sdk/pull/14952 + github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 ) diff --git a/go.sum b/go.sum index 5aec91ca3..f9161abe8 100644 --- a/go.sum +++ b/go.sum @@ -1,14 +1,12 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.44.3/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= @@ -32,61 +30,190 @@ cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Ud cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= -cloud.google.com/go v0.102.1 h1:vpK6iQWv/2uUeFJth4/cBHsQAGjn1iIE6AAlxipRaA0= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= +cloud.google.com/go v0.104.0/go.mod h1:OO6xxXdJyvuJPcEPBLN9BJPD+jep5G1+2U5B5gkRYtA= +cloud.google.com/go v0.110.0 h1:Zc8gqp3+a9/Eyph2KDmcGaPtbKRIoqq4YTlL4NMD0Ys= +cloud.google.com/go v0.110.0/go.mod h1:SJnCLqQ0FCFGSZMUNUf84MV3Aia54kn7pi8st7tMzaY= +cloud.google.com/go/aiplatform v1.22.0/go.mod h1:ig5Nct50bZlzV6NvKaTwmplLLddFx0YReh9WfTO5jKw= +cloud.google.com/go/aiplatform v1.24.0/go.mod h1:67UUvRBKG6GTayHKV8DBv2RtR1t93YRu5B1P3x99mYY= +cloud.google.com/go/analytics v0.11.0/go.mod h1:DjEWCu41bVbYcKyvlws9Er60YE4a//bK6mnhWvQeFNI= +cloud.google.com/go/analytics v0.12.0/go.mod h1:gkfj9h6XRf9+TS4bmuhPEShsh3hH8PAZzm/41OOhQd4= +cloud.google.com/go/area120 v0.5.0/go.mod h1:DE/n4mp+iqVyvxHN41Vf1CR602GiHQjFPusMFW6bGR4= +cloud.google.com/go/area120 v0.6.0/go.mod h1:39yFJqWVgm0UZqWTOdqkLhjoC7uFfgXRC8g/ZegeAh0= +cloud.google.com/go/artifactregistry v1.6.0/go.mod h1:IYt0oBPSAGYj/kprzsBjZ/4LnG/zOcHyFHjWPCi6SAQ= +cloud.google.com/go/artifactregistry v1.7.0/go.mod h1:mqTOFOnGZx8EtSqK/ZWcsm/4U8B77rbcLP6ruDU2Ixk= +cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o= +cloud.google.com/go/asset v1.7.0/go.mod h1:YbENsRK4+xTiL+Ofoj5Ckf+O17kJtgp3Y3nn4uzZz5s= +cloud.google.com/go/asset v1.8.0/go.mod h1:mUNGKhiqIdbr8X7KNayoYvyc4HbbFO9URsjbytpUaW0= +cloud.google.com/go/assuredworkloads v1.5.0/go.mod h1:n8HOZ6pff6re5KYfBXcFvSViQjDwxFkAkmUFffJRbbY= +cloud.google.com/go/assuredworkloads v1.6.0/go.mod h1:yo2YOk37Yc89Rsd5QMVECvjaMKymF9OP+QXWlKXUkXw= +cloud.google.com/go/assuredworkloads v1.7.0/go.mod h1:z/736/oNmtGAyU47reJgGN+KVoYoxeLBoj4XkKYscNI= +cloud.google.com/go/automl v1.5.0/go.mod h1:34EjfoFGMZ5sgJ9EoLsRtdPSNZLcfflJR39VbVNS2M0= +cloud.google.com/go/automl v1.6.0/go.mod h1:ugf8a6Fx+zP0D59WLhqgTDsQI9w07o64uf/Is3Nh5p8= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg= cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= -cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= +cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= +cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= +cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= +cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= +cloud.google.com/go/binaryauthorization v1.2.0/go.mod h1:86WKkJHtRcv5ViNABtYMhhNWRrD1Vpi//uKEy7aYEfI= +cloud.google.com/go/cloudtasks v1.5.0/go.mod h1:fD92REy1x5woxkKEkLdvavGnPJGEn8Uic9nWuLzqCpY= +cloud.google.com/go/cloudtasks v1.6.0/go.mod h1:C6Io+sxuke9/KNRkbQpihnW93SWDU3uXt92nu85HkYI= cloud.google.com/go/compute v0.1.0/go.mod h1:GAesmwr110a34z04OlxYkATPBEfVhkymfTBXtfbBFow= cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJWM7YD99wM= cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0 h1:v/k9Eueb8aAJ0vZuxKMrgm6kPhCLZU9HxFU+AFDs9Uk= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= +cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= +cloud.google.com/go/compute v1.18.0 h1:FEigFqoDbys2cvFkZ9Fjq4gnHBP55anJ0yQyau2f9oY= +cloud.google.com/go/compute v1.18.0/go.mod h1:1X7yHxec2Ga+Ss6jPyjxRxpu2uu7PLgsOVXvgU0yacs= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= +cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= +cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= +cloud.google.com/go/containeranalysis v0.6.0/go.mod h1:HEJoiEIu+lEXM+k7+qLCci0h33lX3ZqoYFdmPcoO7s4= +cloud.google.com/go/datacatalog v1.3.0/go.mod h1:g9svFY6tuR+j+hrTw3J2dNcmI0dzmSiyOzm8kpLq0a0= +cloud.google.com/go/datacatalog v1.5.0/go.mod h1:M7GPLNQeLfWqeIm3iuiruhPzkt65+Bx8dAKvScX8jvs= +cloud.google.com/go/datacatalog v1.6.0/go.mod h1:+aEyF8JKg+uXcIdAmmaMUmZ3q1b/lKLtXCmXdnc0lbc= +cloud.google.com/go/dataflow v0.6.0/go.mod h1:9QwV89cGoxjjSR9/r7eFDqqjtvbKxAK2BaYU6PVk9UM= +cloud.google.com/go/dataflow v0.7.0/go.mod h1:PX526vb4ijFMesO1o202EaUmouZKBpjHsTlCtB4parQ= +cloud.google.com/go/dataform v0.3.0/go.mod h1:cj8uNliRlHpa6L3yVhDOBrUXH+BPAO1+KFMQQNSThKo= +cloud.google.com/go/dataform v0.4.0/go.mod h1:fwV6Y4Ty2yIFL89huYlEkwUPtS7YZinZbzzj5S9FzCE= +cloud.google.com/go/datalabeling v0.5.0/go.mod h1:TGcJ0G2NzcsXSE/97yWjIZO0bXj0KbVlINXMG9ud42I= +cloud.google.com/go/datalabeling v0.6.0/go.mod h1:WqdISuk/+WIGeMkpw/1q7bK/tFEZxsrFJOJdY2bXvTQ= +cloud.google.com/go/dataqna v0.5.0/go.mod h1:90Hyk596ft3zUQ8NkFfvICSIfHFh1Bc7C4cK3vbhkeo= +cloud.google.com/go/dataqna v0.6.0/go.mod h1:1lqNpM7rqNLVgWBJyk5NF6Uen2PHym0jtVJonplVsDA= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= +cloud.google.com/go/datastream v1.2.0/go.mod h1:i/uTP8/fZwgATHS/XFu0TcNUhuA0twZxxQ3EyCUQMwo= +cloud.google.com/go/datastream v1.3.0/go.mod h1:cqlOX8xlyYF/uxhiKn6Hbv6WjwPPuI9W2M9SAXwaLLQ= +cloud.google.com/go/dialogflow v1.15.0/go.mod h1:HbHDWs33WOGJgn6rfzBW1Kv807BE3O1+xGbn59zZWI4= +cloud.google.com/go/dialogflow v1.16.1/go.mod h1:po6LlzGfK+smoSmTBnbkIZY2w8ffjz/RcGSS+sh1el0= +cloud.google.com/go/dialogflow v1.17.0/go.mod h1:YNP09C/kXA1aZdBgC/VtXX74G/TKn7XVCcVumTflA+8= +cloud.google.com/go/documentai v1.7.0/go.mod h1:lJvftZB5NRiFSX4moiye1SMxHx0Bc3x1+p9e/RfXYiU= +cloud.google.com/go/documentai v1.8.0/go.mod h1:xGHNEB7CtsnySCNrCFdCyyMz44RhFEEX2Q7UD0c5IhU= +cloud.google.com/go/domains v0.6.0/go.mod h1:T9Rz3GasrpYk6mEGHh4rymIhjlnIuB4ofT1wTxDeT4Y= +cloud.google.com/go/domains v0.7.0/go.mod h1:PtZeqS1xjnXuRPKE/88Iru/LdfoRyEHYA9nFQf4UKpg= +cloud.google.com/go/edgecontainer v0.1.0/go.mod h1:WgkZ9tp10bFxqO8BLPqv2LlfmQF1X8lZqwW4r1BTajk= +cloud.google.com/go/edgecontainer v0.2.0/go.mod h1:RTmLijy+lGpQ7BXuTDa4C4ssxyXT34NIuHIgKuP4s5w= +cloud.google.com/go/functions v1.6.0/go.mod h1:3H1UA3qiIPRWD7PeZKLvHZ9SaQhR26XIJcC0A5GbvAk= +cloud.google.com/go/functions v1.7.0/go.mod h1:+d+QBcWM+RsrgZfV9xo6KfA1GlzJfxcfZcRPEhDDfzg= +cloud.google.com/go/gaming v1.5.0/go.mod h1:ol7rGcxP/qHTRQE/RO4bxkXq+Fix0j6D4LFPzYTIrDM= +cloud.google.com/go/gaming v1.6.0/go.mod h1:YMU1GEvA39Qt3zWGyAVA9bpYz/yAhTvaQ1t2sK4KPUA= +cloud.google.com/go/gkeconnect v0.5.0/go.mod h1:c5lsNAg5EwAy7fkqX/+goqFsU1Da/jQFqArp+wGNr/o= +cloud.google.com/go/gkeconnect v0.6.0/go.mod h1:Mln67KyU/sHJEBY8kFZ0xTeyPtzbq9StAVvEULYK16A= +cloud.google.com/go/gkehub v0.9.0/go.mod h1:WYHN6WG8w9bXU0hqNxt8rm5uxnk8IH+lPY9J2TV7BK0= +cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y977wO+hBH0= +cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= -cloud.google.com/go/iam v0.4.0 h1:YBYU00SCDzZJdHqVc4I5d6lsklcYIjQZa1YmEz4jlSE= -cloud.google.com/go/iam v0.4.0/go.mod h1:cbaZxyScUhxl7ZAkNWiALgihfP75wS/fUsVNaa1r3vA= +cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= +cloud.google.com/go/iam v0.12.0 h1:DRtTY29b75ciH6Ov1PHb4/iat2CLCvrOm40Q0a6DFpE= +cloud.google.com/go/iam v0.12.0/go.mod h1:knyHGviacl11zrtZUoDuYpDgLjvr28sLQaG0YB2GYAY= +cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= +cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= +cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= +cloud.google.com/go/lifesciences v0.6.0/go.mod h1:ddj6tSX/7BOnhxCSd3ZcETvtNr8NZ6t/iPhY2Tyfu08= +cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs= +cloud.google.com/go/mediatranslation v0.5.0/go.mod h1:jGPUhGTybqsPQn91pNXw0xVHfuJ3leR1wj37oU3y1f4= +cloud.google.com/go/mediatranslation v0.6.0/go.mod h1:hHdBCTYNigsBxshbznuIMFNe5QXEowAuNmmC7h8pu5w= +cloud.google.com/go/memcache v1.4.0/go.mod h1:rTOfiGZtJX1AaFUrOgsMHX5kAzaTQ8azHiuDoTPzNsE= +cloud.google.com/go/memcache v1.5.0/go.mod h1:dk3fCK7dVo0cUU2c36jKb4VqKPS22BTkf81Xq617aWM= +cloud.google.com/go/metastore v1.5.0/go.mod h1:2ZNrDcQwghfdtCwJ33nM0+GrBGlVuh8rakL3vdPY3XY= +cloud.google.com/go/metastore v1.6.0/go.mod h1:6cyQTls8CWXzk45G55x57DVQ9gWg7RiH65+YgPsNh9s= +cloud.google.com/go/networkconnectivity v1.4.0/go.mod h1:nOl7YL8odKyAOtzNX73/M5/mGZgqqMeryi6UPZTk/rA= +cloud.google.com/go/networkconnectivity v1.5.0/go.mod h1:3GzqJx7uhtlM3kln0+x5wyFvuVH1pIBJjhCpjzSt75o= +cloud.google.com/go/networksecurity v0.5.0/go.mod h1:xS6fOCoqpVC5zx15Z/MqkfDwH4+m/61A3ODiDV1xmiQ= +cloud.google.com/go/networksecurity v0.6.0/go.mod h1:Q5fjhTr9WMI5mbpRYEbiexTzROf7ZbDzvzCrNl14nyU= +cloud.google.com/go/notebooks v1.2.0/go.mod h1:9+wtppMfVPUeJ8fIWPOq1UnATHISkGXGqTkxeieQ6UY= +cloud.google.com/go/notebooks v1.3.0/go.mod h1:bFR5lj07DtCPC7YAAJ//vHskFBxA5JzYlH68kXVdk34= +cloud.google.com/go/osconfig v1.7.0/go.mod h1:oVHeCeZELfJP7XLxcBGTMBvRO+1nQ5tFG9VQTmYS2Fs= +cloud.google.com/go/osconfig v1.8.0/go.mod h1:EQqZLu5w5XA7eKizepumcvWx+m8mJUhEwiPqWiZeEdg= +cloud.google.com/go/oslogin v1.4.0/go.mod h1:YdgMXWRaElXz/lDk1Na6Fh5orF7gvmJ0FGLIs9LId4E= +cloud.google.com/go/oslogin v1.5.0/go.mod h1:D260Qj11W2qx/HVF29zBg+0fd6YCSjSqLUkY/qEenQU= +cloud.google.com/go/phishingprotection v0.5.0/go.mod h1:Y3HZknsK9bc9dMi+oE8Bim0lczMU6hrX0UpADuMefr0= +cloud.google.com/go/phishingprotection v0.6.0/go.mod h1:9Y3LBLgy0kDTcYET8ZH3bq/7qni15yVUoAxiFxnlSUA= +cloud.google.com/go/privatecatalog v0.5.0/go.mod h1:XgosMUvvPyxDjAVNDYxJ7wBW8//hLDDYmnsNcMGq1K0= +cloud.google.com/go/privatecatalog v0.6.0/go.mod h1:i/fbkZR0hLN29eEWiiwue8Pb+GforiEIBnV9yrRUOKI= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw= cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA= cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU= +cloud.google.com/go/recaptchaenterprise v1.3.1/go.mod h1:OdD+q+y4XGeAlxRaMn1Y7/GveP6zmq76byL6tjPE7d4= +cloud.google.com/go/recaptchaenterprise/v2 v2.1.0/go.mod h1:w9yVqajwroDNTfGuhmOjPDN//rZGySaf6PtFVcSCa7o= +cloud.google.com/go/recaptchaenterprise/v2 v2.2.0/go.mod h1:/Zu5jisWGeERrd5HnlS3EUGb/D335f9k51B/FVil0jk= +cloud.google.com/go/recaptchaenterprise/v2 v2.3.0/go.mod h1:O9LwGCjrhGHBQET5CA7dd5NwwNQUErSgEDit1DLNTdo= +cloud.google.com/go/recommendationengine v0.5.0/go.mod h1:E5756pJcVFeVgaQv3WNpImkFP8a+RptV6dDLGPILjvg= +cloud.google.com/go/recommendationengine v0.6.0/go.mod h1:08mq2umu9oIqc7tDy8sx+MNJdLG0fUi3vaSVbztHgJ4= +cloud.google.com/go/recommender v1.5.0/go.mod h1:jdoeiBIVrJe9gQjwd759ecLJbxCDED4A6p+mqoqDvTg= +cloud.google.com/go/recommender v1.6.0/go.mod h1:+yETpm25mcoiECKh9DEScGzIRyDKpZ0cEhWGo+8bo+c= +cloud.google.com/go/redis v1.7.0/go.mod h1:V3x5Jq1jzUcg+UNsRvdmsfuFnit1cfe3Z/PGyq/lm4Y= +cloud.google.com/go/redis v1.8.0/go.mod h1:Fm2szCDavWzBk2cDKxrkmWBqoCiL1+Ctwq7EyqBCA/A= +cloud.google.com/go/retail v1.8.0/go.mod h1:QblKS8waDmNUhghY2TI9O3JLlFk8jybHeV4BF19FrE4= +cloud.google.com/go/retail v1.9.0/go.mod h1:g6jb6mKuCS1QKnH/dpu7isX253absFl6iE92nHwlBUY= +cloud.google.com/go/scheduler v1.4.0/go.mod h1:drcJBmxF3aqZJRhmkHQ9b3uSSpQoltBPGPxGAWROx6s= +cloud.google.com/go/scheduler v1.5.0/go.mod h1:ri073ym49NW3AfT6DZi21vLZrG07GXr5p3H1KxN5QlI= +cloud.google.com/go/secretmanager v1.6.0/go.mod h1:awVa/OXF6IiyaU1wQ34inzQNc4ISIDIrId8qE5QGgKA= +cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4= +cloud.google.com/go/security v1.7.0/go.mod h1:mZklORHl6Bg7CNnnjLH//0UlAlaXqiG7Lb9PsPXLfD0= +cloud.google.com/go/security v1.8.0/go.mod h1:hAQOwgmaHhztFhiQ41CjDODdWP0+AE1B3sX4OFlq+GU= +cloud.google.com/go/securitycenter v1.13.0/go.mod h1:cv5qNAqjY84FCN6Y9z28WlkKXyWsgLO832YiWwkCWcU= +cloud.google.com/go/securitycenter v1.14.0/go.mod h1:gZLAhtyKv85n52XYWt6RmeBdydyxfPeTrpToDPw4Auc= +cloud.google.com/go/servicedirectory v1.4.0/go.mod h1:gH1MUaZCgtP7qQiI+F+A+OpeKF/HQWgtAddhTbhL2bs= +cloud.google.com/go/servicedirectory v1.5.0/go.mod h1:QMKFL0NUySbpZJ1UZs3oFAmdvVxhhxB6eJ/Vlp73dfg= +cloud.google.com/go/speech v1.6.0/go.mod h1:79tcr4FHCimOp56lwC01xnt/WPJZc4v3gzyT7FoBkCM= +cloud.google.com/go/speech v1.7.0/go.mod h1:KptqL+BAQIhMsj1kOP2la5DSEEerPDuOP/2mmkhHhZQ= cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cloud.google.com/go/storage v1.22.1 h1:F6IlQJZrZM++apn9V5/VfS3gbTUYg98PS3EMQAzqtfg= cloud.google.com/go/storage v1.22.1/go.mod h1:S8N1cAStu7BOeFfE8KAQzmyyLkK8p/vmRq6kuBTW58Y= -collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= +cloud.google.com/go/storage v1.23.0/go.mod h1:vOEEDNFnciUMhBeT6hsJIn3ieU5cFRmzeLgDvXzfIXc= +cloud.google.com/go/storage v1.27.0/go.mod h1:x9DOL8TK/ygDUMieqwfhdpQryTeEkhGKMi80i/iqR2s= +cloud.google.com/go/storage v1.29.0 h1:6weCgzRvMg7lzuUurI4697AqIRPU1SvzHhynwpW31jI= +cloud.google.com/go/storage v1.29.0/go.mod h1:4puEjyTKnku6gfKoTfNOU/W+a9JyuVNxjpS5GBrB8h4= +cloud.google.com/go/talent v1.1.0/go.mod h1:Vl4pt9jiHKvOgF9KoZo6Kob9oV4lwd/ZD5Cto54zDRw= +cloud.google.com/go/talent v1.2.0/go.mod h1:MoNF9bhFQbiJ6eFD3uSsg0uBALw4n4gaCaEjBw9zo8g= +cloud.google.com/go/videointelligence v1.6.0/go.mod h1:w0DIDlVRKtwPCn/C4iwZIJdvC69yInhW0cfi+p546uU= +cloud.google.com/go/videointelligence v1.7.0/go.mod h1:k8pI/1wAhjznARtVT9U1llUaFNPh7muw8QyOUpavru4= +cloud.google.com/go/vision v1.2.0/go.mod h1:SmNwgObm5DpFBme2xpyOyasvBc1aPdjvMk2bBk0tKD0= +cloud.google.com/go/vision/v2 v2.2.0/go.mod h1:uCdV4PpN1S0jyCyq8sIM42v2Y6zOLkZs+4R9LrGYwFo= +cloud.google.com/go/vision/v2 v2.3.0/go.mod h1:UO61abBx9QRMFkNBbf1D8B1LXdS2cGiiCRx0vSpZoUo= +cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xXZmFiHmGE= +cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= +cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= +cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= +cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= +cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= +cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI= +cosmossdk.io/core v0.5.1/go.mod h1:KZtwHCLjcFuo0nmDc24Xy6CRNEL9Vl/MeimQ2aC7NLE= +cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw= +cosmossdk.io/depinject v1.0.0-alpha.3/go.mod h1:eRbcdQ7MRpIPEM5YUJh8k97nxHpYbc3sMUnEtt8HPWU= cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w= cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE= -cosmossdk.io/math v1.0.0-beta.3 h1:TbZxSopz2LqjJ7aXYfn7nJSb8vNaBklW6BLpcei1qwM= -cosmossdk.io/math v1.0.0-beta.3/go.mod h1:3LYasri3Zna4XpbrTNdKsWmD5fHHkaNAod/mNT9XdE4= +cosmossdk.io/math v1.0.0 h1:ro9w7eKx23om2tZz/VM2Pf+z2WAbGX1yDQQOJ6iGeJw= +cosmossdk.io/math v1.0.0/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k= +cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= +cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= -filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= -git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= +filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= +filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/CosmWasm/wasmd v0.40.0-rc.1 h1:prIM2vP1jNh0zgs9seua5BgKdayBgp3FiHtwxFcZSGs= +github.com/CosmWasm/wasmd v0.40.0-rc.1/go.mod h1:uacdue6EGn9JA1TqBNHB3iCe4PCIChuFT23AzIl2VME= +github.com/CosmWasm/wasmvm v1.2.3 h1:OKYlobwmVGbl0eSn0mXoAAjE5hIuXnQCLPjbNd91sVY= +github.com/CosmWasm/wasmvm v1.2.3/go.mod h1:vW/E3h8j9xBQs9bCoijDuawKo9kCtxOaS8N8J7KFtkc= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= @@ -96,94 +223,72 @@ github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Workiva/go-datastructures v1.0.53 h1:J6Y/52yX10Xc5JjXmGtWoSSxs3mZnGSaq37xZZh7Yig= -github.com/Workiva/go-datastructures v1.0.53/go.mod h1:1yZL+zfsztete+ePzZz/Zb1/t5BnDuE2Ya2MMGhzP6A= -github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/alecthomas/participle/v2 v2.0.0-alpha7 h1:cK4vjj0VSgb3lN1nuKA5F7dw+1s1pWBe5bx7nNCnN+c= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.0 h1:yCQqn7dwca4ITXb+CbubHmedzaQYHhNhrEXLYUeEe8Q= -github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= +github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= +github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= -github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= -github.com/aws/aws-sdk-go v1.40.45 h1:QN1nsY27ssD/JmW4s83qmSb+uL6DG4GmCDzjmJB4xUI= -github.com/aws/aws-sdk-go v1.40.45/go.mod h1:585smgzpB/KqRA+K3y/NL/oYRqQvpNJYvLm+LY1U59Q= +github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= +github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= +github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= -github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= -github.com/babylonchain/ibc-go/v5 v5.0.1-0.20221107054049-dbf7e4efe6fd h1:0y7HPL7xb/N1Oa/q5cQJ80K3ZfnQoKSG5sveZwpm0/E= -github.com/babylonchain/ibc-go/v5 v5.0.1-0.20221107054049-dbf7e4efe6fd/go.mod h1:Wqsguq98Iuns8tgTv8+xaGYbC+Q8zJfbpjzT6IgMJbs= +github.com/babylonchain/ibc-go/v7 v7.0.0-20230324085744-4d6a0d2c0fcf h1:NJU3YuruPqV8w6/y45Zsb8FudcWSkTBugdpTT7kJmjw= +github.com/babylonchain/ibc-go/v7 v7.0.0-20230324085744-4d6a0d2c0fcf/go.mod h1:BFh8nKWjr5zeR2OZfhkzdgDzj1+KjRn3aJLpwapStj8= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= -github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= +github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/boljen/go-bitmap v0.0.0-20151001105940-23cd2fb0ce7d h1:zsO4lp+bjv5XvPTF58Vq+qgmZEYZttJK+CWtSZhKenI= github.com/boljen/go-bitmap v0.0.0-20151001105940-23cd2fb0ce7d/go.mod h1:f1iKL6ZhUWvbk7PdWVmOaak10o86cqMUYEmn1CZNGEI= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/btcsuite/btcd v0.0.0-20190115013929-ed77733ec07d/go.mod h1:d3C0AkH6BRcvO8T0UEPu53cnw4IbV63x1bEjildYhO0= -github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd v0.22.3 h1:kYNaWFvOw6xvqP0vR20RP1Zq1DVMBxEO8QN5d1/EfNg= -github.com/btcsuite/btcd v0.22.3/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c/go.mod h1:tjmYdS6MLJ5/s0Fj4DbLgSbDHbEqLJrtnHecBFkdz5M= +github.com/btcsuite/btcd v0.23.0/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd v0.23.4 h1:IzV6qqkfwbItOS/sg/aDfPDsjPP8twrCOE2R93hxMlQ= +github.com/btcsuite/btcd v0.23.4/go.mod h1:0QJIIN1wwIXF/3G/m87gIwGniDMDQqjVn4SZgnFpsYY= +github.com/btcsuite/btcd/btcec/v2 v2.1.0/go.mod h1:2VzYrv4Gm4apmbVVsSq5bqf1Ec8v56E48Vt0Y/umPgA= +github.com/btcsuite/btcd/btcec/v2 v2.1.3/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= +github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.0.0/go.mod h1:Uoxwv0pqYWhD//tfTiipkxNfdhG9UrLwaeswfjfdF0A= +github.com/btcsuite/btcd/btcutil v1.1.0/go.mod h1:5OapHB7A2hBBWLm48mmw4MOHNJCcUBTwmWH/0Jn8VHE= +github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= +github.com/btcsuite/btcd/btcutil v1.1.2/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20180706230648-ab6388e0c60a/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/goleveldb v1.0.0 h1:Tvd0BfvqX9o823q1j2UZ/epQo09eJh6dTcRp79ilIN4= github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/snappy-go v1.0.0 h1:ZxaA6lo2EpxGddsA8JwWOcxlzRybb444sgmeJQMJGQE= github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= -github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= 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= @@ -191,26 +296,27 @@ github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= github.com/cenkalti/backoff/v4 v4.2.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.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/chzyer/logex v1.1.10 h1:Swpa1K6QvQznwJRcfTfQJmTE72DqScAa40E+fbHEXEE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= -github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= -github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1 h1:q763qf9huN11kDQavWsoZXJNW3xEE4JJyHa5Q25/sd8= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/cilium/ebpf v0.7.0/go.mod h1:/oI2+1shJiTGAMgl6/RgJr36Eo1jzrRcAWbcXO2usCA= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -222,15 +328,15 @@ github.com/cncf/xds/go v0.0.0-20211001041855-01bcc9b48dfe/go.mod h1:eXthEFrGJvWH github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= +github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= -github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= -github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= -github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= -github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= +github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= +github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= +github.com/cometbft/cometbft v0.37.1 h1:KLxkQTK2hICXYq21U2hn1W5hOVYUdQgDQ1uB+90xPIg= +github.com/cometbft/cometbft v0.37.1/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs= +github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo= +github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= @@ -239,93 +345,88 @@ github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8Nz github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cosmos/btcutil v1.0.4 h1:n7C2ngKXo7UC9gNyMNLbzqz7Asuf+7Qv4gnX/rOdQ44= -github.com/cosmos/btcutil v1.0.4/go.mod h1:Ffqc8Hn6TJUdDgHBwIZLtrLQC1KdJ9jGJl/TvgUaxbU= -github.com/cosmos/cosmos-proto v1.0.0-alpha7 h1:yqYUOHF2jopwZh4dVQp3xgqwftE5/2hkrwIV6vkUbO0= -github.com/cosmos/cosmos-proto v1.0.0-alpha7/go.mod h1:dosO4pSAbJF8zWCzCoTWP7nNsjcvSUBQmniFxDg5daw= -github.com/cosmos/cosmos-sdk v0.46.6 h1:K9EZsqOZ2jQX3bIQUpn7Hk/YCoaJWRLU56PzvpX8INk= -github.com/cosmos/cosmos-sdk v0.46.6/go.mod h1:JNklMfXo7MhDF1j/jxZCmDyOYyqhVoKB22e8p1ATEqA= +github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= +github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8= +github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0= +github.com/cosmos/cosmos-sdk v0.47.2 h1:9rSriCoiJD+4F+tEDobyM8V7HF5BtY5Ef4VYNig96s0= +github.com/cosmos/cosmos-sdk v0.47.2/go.mod h1:zYzgI8w8hhotXTSoGbbSOAKfpJTx4wOy4XgbaKhtRtc= github.com/cosmos/cosmos-sdk/ics23/go v0.8.0 h1:iKclrn3YEOwk4jQHT2ulgzuXyxmzmPczUalMwW4XH9k= github.com/cosmos/cosmos-sdk/ics23/go v0.8.0/go.mod h1:2a4dBq88TUoqoWAU5eu0lGvpFP3wWDPgdHPargtyw30= github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= -github.com/cosmos/gorocksdb v1.2.0 h1:d0l3jJG8M4hBouIZq0mDUHZ+zjOx044J3nGRskwTb4Y= -github.com/cosmos/gorocksdb v1.2.0/go.mod h1:aaKvKItm514hKfNJpUJXnnOWeBnk2GL4+Qw9NHizILw= -github.com/cosmos/iavl v0.19.4 h1:t82sN+Y0WeqxDLJRSpNd8YFX5URIrT+p8n6oJbJ2Dok= -github.com/cosmos/iavl v0.19.4/go.mod h1:X9PKD3J0iFxdmgNLa7b2LYWdsGd90ToV5cAONApkEPw= +github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= +github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= +github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= +github.com/cosmos/gogoproto v1.4.8 h1:BrHKc6WFZt8+jRV71vKSQE+JrfF+JAnzrKo2VP7wIZ4= +github.com/cosmos/gogoproto v1.4.8/go.mod h1:hnb0DIEWTv+wdNzNcqus5xCQXq5+CXauq1FJuurRfVY= +github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38= +github.com/cosmos/iavl v0.20.0/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= +github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab h1:I9ialKTQo7248V827Bba4OuKPmk+FPzmTVHsLXaIJWw= +github.com/cosmos/ics23/go v0.9.1-0.20221207100636-b1abd8678aab/go.mod h1:2CwqasX5dSD7Hbp/9b6lhK6BwoBDCBldx7gPKRukR60= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76 h1:DdzS1m6o/pCqeZ8VOAit/gyATedRgjvkVI+UCrLpyuU= github.com/cosmos/keyring v1.1.7-0.20210622111912-ef00f8ac3d76/go.mod h1:0mkLWIoZuQ7uBoospo5Q9zIpqq6rYCPJDSUdeCJvPM8= -github.com/cosmos/ledger-cosmos-go v0.11.1 h1:9JIYsGnXP613pb2vPjFeMMjBI5lEDsEaF6oYorTy6J4= -github.com/cosmos/ledger-cosmos-go v0.11.1/go.mod h1:J8//BsAGTo3OC/vDLjMRFLW6q0WAaXvHnVc7ZmE8iUY= -github.com/cosmos/ledger-go v0.9.2 h1:Nnao/dLwaVTk1Q5U9THldpUMMXU94BOTWPddSmVB6pI= -github.com/cosmos/ledger-go v0.9.2/go.mod h1:oZJ2hHAZROdlHiwTg4t7kP+GKIIkBT+o6c9QWFanOyI= +github.com/cosmos/ledger-cosmos-go v0.12.1 h1:sMBxza5p/rNK/06nBSNmsI/WDqI0pVJFVNihy1Y984w= +github.com/cosmos/ledger-cosmos-go v0.12.1/go.mod h1:dhO6kj+Y+AHIOgAe4L9HL/6NDdyyth4q238I9yFpD2g= +github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= +github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM= -github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk= +github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= +github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11 h1:07n33Z8lZxZ2qwegKbObQohDhXDQxiMMz1NOUGYlesw= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= +github.com/cucumber/common/gherkin/go/v22 v22.0.0 h1:4K8NqptbvdOrjL9DEea6HFjSpbdT9+Q5kgLpmmsHYl0= +github.com/cucumber/common/messages/go/v17 v17.1.1 h1:RNqopvIFyLWnKv0LfATh34SWBhXeoFTJnSrgm9cT/Ts= github.com/cyphar/filepath-securejoin v0.2.3/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= github.com/danieljoos/wincred v1.0.2/go.mod h1:SnuYRW9lp1oJrZX/dXJqr0cPK5gYXqx3EJbmjhLdK9U= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= +github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= -github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.1.0 h1:Jv3CGQHp9OjuMBSne1485aDpUkTKEcUqF+jm/LuerPI= -github.com/dgraph-io/ristretto v0.1.0/go.mod h1:fux0lOrBhrVCJd3lcTHsIJhq1T2rokOu6v9Vcb3Q9ug= +github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= +github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= github.com/docker/cli v20.10.21+incompatible h1:qVkgyYUnOLQ98LtXBrwd/duVqPT2X4SHndOuGsfwyhU= github.com/docker/cli v20.10.21+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v20.10.21+incompatible h1:UTLdBmHk3bEY+w8qeO5KttOhy6OmXWsl/FEet9Uswog= -github.com/docker/docker v20.10.21+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v20.10.24+incompatible h1:Ugvxm7a8+Gz6vqQYQQ2W7GYq5EUPaAiuPgIfVyI3dYE= +github.com/docker/docker v20.10.24+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac h1:opbrjaN/L8gg6Xh5D04Tem+8xVcz6ajZlGCs49mQgyg= -github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= +github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= +github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= github.com/dvsekhvalnov/jose2go v0.0.0-20200901110807-248326c1351b/go.mod h1:7BvyPhdbLxMXIYTFPLsyJRFMsKmOZnQmzh6Gb+uquuM= github.com/dvsekhvalnov/jose2go v1.5.0 h1:3j8ya4Z4kMCwT5nXIKFSV84YS+HdqSSO0VsTQxaLAeM= github.com/dvsekhvalnov/jose2go v1.5.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB/mPZadG+mhXU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -338,16 +439,13 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ= github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o= +github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= github.com/franela/goreq v0.0.0-20171204163338-bcd34c9993f8/go.mod h1:ZhphrRTfi2rbfLwlschooIH4+wKKDR4Pdxhh+TRoA20= @@ -355,19 +453,13 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= -github.com/fsnotify/fsnotify v1.5.4 h1:jRbGcIw6P2Meqdwuo0H1p6JVLbL5DHKAKlYndzMwVZI= -github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= +github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= 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.7.0 h1:jGB9xAJQ12AIGNB4HguylppmDK1Am9ppF7XnGXXJuoU= github.com/gin-gonic/gin v1.7.0/go.mod h1:jD2toBW3GZUr5UMcdrwQA10I7RuaFOl/SGeDjXkfUtY= -github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= -github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -376,28 +468,21 @@ github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2 github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= -github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= -github.com/go-kit/log v0.2.0/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= -github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= -github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= +github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0 h1:icxd5fm+REJzpZx7ZfpaD876Lmtgy7VtROAbHHXk8no= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/validator/v10 v10.4.1 h1:pH2c5ADXtd66mxoE0Zm9SUhxE20r7aM3F26W0hOn+GE= github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= -github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= +github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-sql-driver/mysql v1.6.0 h1:BCTh4TKNUYmOmMUcQ3IipzF5prigylS7XXjEkfCHuOE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= @@ -410,16 +495,20 @@ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+ github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/godbus/dbus/v5 v5.0.6/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= -github.com/gogo/gateway v1.1.0 h1:u0SuhL9+Il+UbjM9VIE3ntfRujKbvVpFvNB4HbjeVQ0= -github.com/gogo/gateway v1.1.0/go.mod h1:S7rR8FRQyG3QFESeSv4l2WnsyzlCLG0CzBbUUo/mbic= +github.com/gofrs/uuid v4.3.0+incompatible h1:CaSVZxm5B+7o45rtab4jC2G37WGYX1zQfuU2i6DSvnc= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= -github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= +github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= +github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= +github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/glog v1.0.0 h1:nfP3RFugxnNRyKgeWd4oI1nYvXpxrx8ck8ZrcizshdQ= -github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4= +github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE= +github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -453,18 +542,17 @@ github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.1/go.mod h1:DopwsBzvsk0Fs44TXzsVbJyPhcCPeIwnvohx4u74HPM= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= -github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= +github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -483,14 +571,14 @@ github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= -github.com/google/martian/v3 v3.2.1 h1:d8MncMlErDFTwQGBK1xhv026j9kqhvw1Qv9IbWT1VLQ= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= +github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -512,23 +600,25 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4= github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= +github.com/googleapis/enterprise-certificate-proxy v0.2.3 h1:yk9/cqRKtT9wXZSsRH9aurXEpJX+U6FLtpYTdC3R06k= +github.com/googleapis/enterprise-certificate-proxy v0.2.3/go.mod h1:AwSRAtLfXpU5Nm3pW+v7rGDHp09LsPtGY9MduiEsR9k= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0eJc8R6ouapiM= github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= -github.com/googleapis/gax-go/v2 v2.4.0 h1:dS9eYAjhrE2RjmzYw2XAPvcXfmcQLtFEQWn0CR82awk= github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/go-type-adapters v1.0.0 h1:9XdMn+d/G57qq1s8dNc5IesGCXHf6V2HZ2JwRxfA2tA= +github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= +github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ= +github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= @@ -541,16 +631,13 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.8.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -564,13 +651,12 @@ github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIv github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.6.1 h1:NASsgP4q6tL94WH6nJxKWj8As2H/2kop/bB1d8JMyRY= -github.com/hashicorp/go-getter v1.6.1/go.mod h1:IZCrswsZPeWv9IkVnLElzRU/gz/QPi6pZHn4tv6vbwA= +github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= +github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= @@ -585,7 +671,6 @@ github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdv github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-version v1.1.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -600,14 +685,14 @@ github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= -github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3 h1:aSVUgRRRtOrZOC1fYmY9gV0e9z/Iu+xNVSASWjsuyGU= -github.com/hdevalence/ed25519consensus v0.0.0-20220222234857-c00d1f31bab3/go.mod h1:5PC6ZNPde8bBqU/ewGZig35+UIZtw9Ytxez8/q5ZyFE= -github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= +github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= +github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= +github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= +github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= @@ -615,28 +700,15 @@ github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= -github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= -github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= -github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= -github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= -github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= -github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= -github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/jhump/protoreflect v1.12.1-0.20220721211354-060cc04fc18b h1:izTof8BKh/nE1wrKOrloNA5q4odOarjf+Xpe+4qow98= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= github.com/jinzhu/copier v0.3.5/go.mod h1:DfbEm0FYsaqBcKcFuvmOZb218JkPGtvSHsKg8S8hyyg= -github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -652,92 +724,60 @@ github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d h1:Z+RDyXzjKE0i2sTjZ/b1uxiGtPhFy34Ou/Tk0qwN0kM= github.com/keybase/go-keychain v0.0.0-20190712205309-48d3d31d256d/go.mod h1:JJNrCn9otv/2QP4D7SMJBgaleKpOf66PnW6F5WGNRIc= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= +github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= 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/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= -github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= -github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= -github.com/lib/pq v1.10.6 h1:jbk+ZieJ0D7EVGJYpL9QTz7/YW6UHbmdnZWYyK5cdBs= -github.com/lib/pq v1.10.6/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +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= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= -github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo= -github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= +github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= +github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= -github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= @@ -748,17 +788,15 @@ github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceT github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/go-testing-interface v1.0.0 h1:fzU/JVNcaqHQEcVFAKeR41fkiLdIPrefOvVG1VZ96U0= github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= +github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= +github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS42BGNg= github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdxbhnCLlSvSU= github.com/moby/term v0.0.0-20221120202655-abb19827d345 h1:J9c53/kxIH+2nTKBEfZYFMlhghtHpIHSXpm5VRGHSnU= github.com/moby/term v0.0.0-20221120202655-abb19827d345/go.mod h1:15ce4BGCFxt7I5NQKT+HV0yEDxmf6fSysfEDiVo3zFM= @@ -768,18 +806,13 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/mrunalp/fileutils v0.5.0/go.mod h1:M1WthSahJixYnrXQl/DFQuteStB1weuxD2QJNHXfbSQ= -github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -787,38 +820,34 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= -github.com/opencontainers/runc v1.1.4 h1:nRCz/8sKg6K6jgYAFLDlXzPeITBZJyX28DBVhWD+5dg= -github.com/opencontainers/runc v1.1.4/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= +github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= +github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.10.0/go.mod h1:2i0OySw99QjzBBQByd1Gr9gSjvuho1lHsJxIJ3gGbJI= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= @@ -831,30 +860,22 @@ github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIw github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= 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 v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3ve8= -github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= -github.com/pelletier/go-toml/v2 v2.0.5 h1:ipoSadvV8oGUjnUbMub59IDPPwfxF694nG/jwbMiyQg= -github.com/pelletier/go-toml/v2 v2.0.5/go.mod h1:OMHamSCAODeSsVrwwvcJOaoN0LIUIaFVNZzmWyNfXas= +github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU= +github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= -github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5 h1:q2e307iGHPdTGp0hoxKjt1H5pDo6utceo3dQVK3I5XQ= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= -github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d h1:htwtWgtQo8YS6JFWWi2DNgY0RwSGJ1ruMoxY6CUUclk= +github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= -github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= -github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= @@ -864,62 +885,45 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.11.0/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= -github.com/prometheus/client_golang v1.12.1/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= -github.com/prometheus/client_golang v1.12.2 h1:51L9cDoUHVrXx4zWYlcLQIZ+d+VXHgqnYKkIuq4g/34= -github.com/prometheus/client_golang v1.12.2/go.mod h1:3Z9XVyYiZYEO+YQWt3RD2R3jrbd179Rt297l4aS6nDY= +github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.0/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= -github.com/prometheus/common v0.32.1/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls= -github.com/prometheus/common v0.34.0 h1:RBmGO9d/FVjqHT0yUGQwBJhkwKV+wPCn7KGpvfab0uE= -github.com/prometheus/common v0.34.0/go.mod h1:gB3sOl7P0TvJabZpLY5uQMpUqRCPPCyRLCZYc7JZTNE= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= -github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= -github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= +github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= -github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= -github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= -github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= +github.com/regen-network/gocuke v0.6.2 h1:pHviZ0kKAq2U2hN2q3smKNxct6hS0mGByFMHGnWA97M= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= -github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= -github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= -github.com/rs/xid v1.3.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.27.0 h1:1T7qCieN22GVc8S4Q2yuexzBb1EqjbgjSH9RohbMjKs= -github.com/rs/zerolog v1.27.0/go.mod h1:7frBqO0oezxmnO7GF86FY++uy8I0Tk/If5ni1G9Qc0U= +github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= +github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -929,11 +933,6 @@ github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71e github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.2-0.20220502022130-f33da4d89646/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= -github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -950,15 +949,15 @@ github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasO github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/afero v1.8.2 h1:xehSyVa0YnHWsJ49JFljMpg1HX19V6NDZ1fkm1Xznbo= -github.com/spf13/afero v1.8.2/go.mod h1:CtAatgMJh6bJEIs48Ay/FOnkljP3WeGUG0MC1RfAqwo= +github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk= +github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI= -github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= +github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA= +github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= @@ -967,18 +966,17 @@ github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnIn github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= -github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= -github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= +github.com/spf13/viper v1.15.0 h1:js3yy885G8xwJa6iOISGFwd+qlUo5AvyXb7CiihdtiU= +github.com/spf13/viper v1.15.0/go.mod h1:fFcTBJxvhhzSJiZy8n+PeW6t8l+KeT/uTARa0jHOQLA= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= -github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -986,57 +984,37 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs= -github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= +github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/supranational/blst v0.3.8 h1:glwLF4oBRSJOTr05lRBgNwGQST0ndP2wg29fSeTRKCY= github.com/supranational/blst v0.3.8/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= -github.com/tendermint/btcd v0.1.1 h1:0VcxPfflS2zZ3RiOAHkBiFUcPvbtRj5O7zHmcJWHV7s= -github.com/tendermint/btcd v0.1.1/go.mod h1:DC6/m53jtQzr/NFmMNEu0rxf18/ktVoVtMrnDD5pN+U= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 h1:hqAk8riJvK4RMWx1aInLzndwxKalgi5rTqgfXxOxbEI= -github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15/go.mod h1:z4YtwM70uOnk8h0pjJYlj3zdYwi9l03By6iAIF5j/Pk= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok= +github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c/go.mod h1:ahpPrc7HpcfEWDQRZEmnXMzHY03mLDYMCxeDzy46i+8= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/tendermint/tendermint v0.34.24 h1:879MKKJWYYPJEMMKME+DWUTY4V9f/FBpnZDI82ky+4k= -github.com/tendermint/tendermint v0.34.24/go.mod h1:rXVrl4OYzmIa1I91av3iLv2HS0fGSiucyW9J4aMTpKI= -github.com/tendermint/tm-db v0.6.7 h1:fE00Cbl0jayAoqlExN6oyQJ7fR/ZtoVOmvPJ//+shu8= -github.com/tendermint/tm-db v0.6.7/go.mod h1:byQDzFkZV1syXr/ReXS808NxA2xvyuuVgXOJ/088L6I= -github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= -github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= -github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= -github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= +github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ttacon/chalk v0.0.0-20160626202418-22c06c80ed31/go.mod h1:onvgF043R+lC5RZ8IT9rBXDaEDnpnw/Cl+HFiw+v/7Q= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= 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 h1:2SvQaVZ1ouYrrKKwoSk2pzd4A9evlKJb9oTL+OaLUSs= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ulikunitz/xz v0.5.8 h1:ERv8V6GKqVi23rgu5cj9pVfVzJbOqAY2Ntl88O6c2nQ= -github.com/ulikunitz/xz v0.5.8/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYppBueQtXaqoE= github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo= github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= @@ -1045,20 +1023,20 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v1.2.0 h1:LhYJRs+L4fBtjZUfuSZIKGeVu0QRy8e5Xi7D17UxZ74= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= -github.com/zondax/hid v0.9.0/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= -github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266 h1:O9XLFXGkVswDFmH9LaYpqu+r/AAFWqr0DL6V00KEVFg= -github.com/zondax/hid v0.9.1-0.20220302062450-5552068d2266/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zondax/hid v0.9.1 h1:gQe66rtmyZ8VeGFcOpbuH3r7erYtNEAezCAYu8LdkJo= +github.com/zondax/hid v0.9.1/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWpEM= +github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN4c= +github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU= -go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= +go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= +go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1068,8 +1046,9 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= -go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= +go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= +go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= @@ -1077,7 +1056,6 @@ go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1085,29 +1063,19 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= 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-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0 h1:MDRAIl0xIo9Io2xV565hzXHw3zVseKrJKodhohM5CjU= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= -golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/exp v0.0.0-20190125153040-c74c464bbbf2/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= @@ -1118,9 +1086,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= -golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1146,8 +1113,9 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= 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.7.0 h1:LapD9S96VoQRhi/GrNTqeBJFrUjs5UHCAtTlgwA5oZA= -golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1186,32 +1154,31 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220617184016-355a448f1bc9/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.2.0 h1:sZfSu1wtKLGlWI4ZZayP0ck9Y73K1ynO6gqzTdBVdPU= -golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +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.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= +golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1233,8 +1200,12 @@ golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= +golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= +golang.org/x/oauth2 v0.5.0 h1:HuArIo48skDwlrvM3sEdHXElYslAMsf3KwRkkW4MC4s= +golang.org/x/oauth2 v0.5.0/go.mod h1:9/XBHVqLaWO3/BRHs5jbpYCnOZVjj5V0ndyaAM7KB4I= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1247,6 +1218,8 @@ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= 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 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1259,7 +1232,6 @@ golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1271,7 +1243,6 @@ golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1283,7 +1254,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1303,9 +1273,7 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1316,55 +1284,54 @@ golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210225134936-a50acf3fe073/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210603125802-9665404d3644/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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-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.2.0 h1:ljd4t30dBnAvMZaQCevtY0xLLD0A+bRZXbgLMLU1F/A= -golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20220908164124-27713097b956/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.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= +golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= 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.2.0 h1:z85xZCsEl7bi/KwbNADeBYoOP0++7W1ipu+aGnpwzRM= -golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ= +golang.org/x/term v0.7.0/go.mod h1:P32HKFT3hSsZrRxla30E9HqToFYAQPCMs/zFMBUFqPY= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1374,19 +1341,18 @@ golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= 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.4.0 h1:BrVqGRd7+k1DiOgtnFvAkoQEWQvBc25ouMJM6429SFg= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE= +golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -1411,7 +1377,6 @@ golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1432,7 +1397,6 @@ golang.org/x/tools v0.0.0-20200729194436-6467de6f59a7/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= -golang.org/x/tools v0.0.0-20201022035929-9cf592e881e9/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1445,22 +1409,18 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= 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.3.0 h1:SrNbZl6ECOS1qFzgTdQfWXZM9XBkiA6tkFrH9YSTPHM= -golang.org/x/tools v0.3.0/go.mod h1:/rWhSS2+zyEVwoJf8YAX6L2f0ntZ7Kn/mGgAWcipA5k= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1498,11 +1458,20 @@ google.golang.org/api v0.70.0/go.mod h1:Bs4ZM2HGifEvXwd50TtW70ovgJffJYw2oRCOFU/S google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc4j8= google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= +google.golang.org/api v0.77.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.93.0 h1:T2xt9gi0gHdxdnRkVQhT8mIvPaXKNsDNWz+L696M66M= +google.golang.org/api v0.85.0/go.mod h1:AqZf8Ep9uZ2pyTvgL+x0D3Zt0eoT9b5E8fmzfu6FO2g= +google.golang.org/api v0.90.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw= +google.golang.org/api v0.95.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI= +google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= +google.golang.org/api v0.110.0 h1:l+rh0KYUooe9JGbGVx71tbFo4SMbMTXK3I3ia2QSEeU= +google.golang.org/api v0.110.0/go.mod h1:7FC4Vvx1Mooxh8C5HWjzZHcavuS2f6pmJpZx60ca7iI= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1519,7 +1488,6 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -1527,7 +1495,6 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= @@ -1536,7 +1503,6 @@ google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200228133532-8c2c7df3a383/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200312145019-da6875a35672/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200324203455-a04cca1dde73/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200331122359-1ee6d9798940/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200430143042-b979b6f78d84/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= @@ -1588,12 +1554,14 @@ google.golang.org/genproto v0.0.0-20220218161850-94dd64e39d7c/go.mod h1:kGP+zUP2 google.golang.org/genproto v0.0.0-20220222213610-43724f9ea8cf/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220304144024-325a89244dc8/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= google.golang.org/genproto v0.0.0-20220310185008-1973136f34c6/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI= +google.golang.org/genproto v0.0.0-20220314164441-57ef72a4c106/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220324131243-acbaeb5b85eb/go.mod h1:hAL49I2IFola2sVEjAn7MEwsja0xp51I0tlGAf9hz4E= google.golang.org/genproto v0.0.0-20220407144326-9054f6ed7bac/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220413183235-5e96e2839df9/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= +google.golang.org/genproto v0.0.0-20220502173005-c8bf987b8c21/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= @@ -1601,11 +1569,30 @@ google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljW google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a h1:GH6UPn3ixhWcKDhpnEC55S75cerLPdpp3hrhfKYjZgw= +google.golang.org/genproto v0.0.0-20220628213854-d9e0b6570c03/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= +google.golang.org/genproto v0.0.0-20220722212130-b98a9ff5e252/go.mod h1:GkXuJDJ6aQ7lnJcRF+SJVgFdQhypqgl3LB1C9vabdRE= +google.golang.org/genproto v0.0.0-20220801145646-83ce21fca29f/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= +google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220817144833-d7fd3f11b9b1/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220822174746-9e6da59bd2fc/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829144015-23454907ede3/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk= +google.golang.org/genproto v0.0.0-20220913154956-18f8339a66a5/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220914142337-ca0e39ece12f/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220916172020-2692e8806bfa/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220919141832-68c03719ef51/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20220920201722-2b89144ce006/go.mod h1:ht8XFiar2npT/g4vkk7O0WYS1sHOHbdujxbEp7CJWbw= +google.golang.org/genproto v0.0.0-20220926165614-551eb538f295/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20220926220553-6981cbe3cfce/go.mod h1:woMGP53BroOrRY3xTxlbr8Y3eB/nzAvvFM83q7kG2OI= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= +google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= +google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44 h1:EfLuoKW5WfkgVdDy7dTK8qSbH37AX5mj/MFh+bGPz14= +google.golang.org/genproto v0.0.0-20230216225411-c8e22ba71e44/go.mod h1:8B0gmkoRebU8ukX6HP+4wrVQUY1+6PkQ44BSyIlflHA= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.19.1/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1641,8 +1628,12 @@ google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11 google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.51.0 h1:E1eGv1FTqoLIdnBCZufiSHgKjlqG6fKFf6pPWtMTh8U= -google.golang.org/grpc v1.51.0/go.mod h1:wgNDFcnuBGmxLKI/qn4T+m5BtEBYXJPvibbUPsAIPww= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= +google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1658,15 +1649,15 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= 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.2-0.20220831092852-f930b1dc76e8 h1:KR8+MyP7/qOlV+8Af01LtjL04bu7on42eVsxT4EyBQk= -google.golang.org/protobuf v1.28.2-0.20220831092852-f930b1dc76e8/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 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= +google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1674,12 +1665,9 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1697,8 +1685,7 @@ gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= -gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1707,16 +1694,13 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= -pgregory.net/rapid v0.4.7 h1:MTNRktPuv5FNqOO151TM9mDTa+XHcX6ypYeISDVD14g= -pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= +pgregory.net/rapid v0.5.5 h1:jkgx1TjbQPD/feRoK+S/mXw9e1uj6WilpHrXJowi6oA= +pgregory.net/rapid v0.5.5/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/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/privval/file.go b/privval/file.go index 46e70831a..05183c218 100644 --- a/privval/file.go +++ b/privval/file.go @@ -8,21 +8,23 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/codec" + tmcrypto "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/ed25519" + tmjson "github.com/cometbft/cometbft/libs/json" + tmos "github.com/cometbft/cometbft/libs/os" + "github.com/cometbft/cometbft/libs/tempfile" + "github.com/cometbft/cometbft/privval" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" - tmcrypto "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/ed25519" - tmjson "github.com/tendermint/tendermint/libs/json" - tmos "github.com/tendermint/tendermint/libs/os" - "github.com/tendermint/tendermint/libs/tempfile" - "github.com/tendermint/tendermint/privval" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - "github.com/tendermint/tendermint/types" "github.com/babylonchain/babylon/crypto/bls12381" checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" ) -// copied from github.com/tendermint/tendermint/privval/file.go" +// copied from github.com/cometbft/cometbft/privval/file.go" +// +//nolint:unused const ( stepNone int8 = 0 // Used to distinguish the initial state stepPropose int8 = 1 @@ -30,7 +32,7 @@ const ( stepPrecommit int8 = 3 ) -// copied from github.com/tendermint/tendermint/privval/file.go" +// copied from github.com/cometbft/cometbft/privval/file.go" // //nolint:unused func voteToStep(vote *tmproto.Vote) int8 { diff --git a/privval/types.go b/privval/types.go index 5ae88708c..ceb5334ef 100644 --- a/privval/types.go +++ b/privval/types.go @@ -3,7 +3,7 @@ package privval import ( "errors" - tmcrypto "github.com/tendermint/tendermint/crypto" + tmcrypto "github.com/cometbft/cometbft/crypto" "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/x/checkpointing/types" diff --git a/proto/babylon/btccheckpoint/params.proto b/proto/babylon/btccheckpoint/params.proto deleted file mode 100644 index 69c2d30c7..000000000 --- a/proto/babylon/btccheckpoint/params.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package babylon.btccheckpoint.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.equal) = true; - - // 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 [ (gogoproto.moretags) = "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) - uint64 checkpoint_finalization_timeout = 2 [ (gogoproto.moretags) = "yaml:\"checkpoint_finalization_timeout\"" ]; -} diff --git a/proto/babylon/btccheckpoint/tx.proto b/proto/babylon/btccheckpoint/tx.proto deleted file mode 100644 index e4d0f775b..000000000 --- a/proto/babylon/btccheckpoint/tx.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; -package babylon.btccheckpoint.v1; - -import "gogoproto/gogo.proto"; -import "babylon/btccheckpoint/btccheckpoint.proto"; - -option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; - -// Msg defines the Msg service. -service Msg { - rpc InsertBTCSpvProof(MsgInsertBTCSpvProof) - returns (MsgInsertBTCSpvProofResponse); -} - -message MsgInsertBTCSpvProof { - string submitter = 1; - repeated babylon.btccheckpoint.v1.BTCSpvProof proofs = 2; -} - -message MsgInsertBTCSpvProofResponse {} diff --git a/proto/babylon/btccheckpoint/btccheckpoint.proto b/proto/babylon/btccheckpoint/v1/btccheckpoint.proto similarity index 66% rename from proto/babylon/btccheckpoint/btccheckpoint.proto rename to proto/babylon/btccheckpoint/v1/btccheckpoint.proto index 84067295c..68126cc7b 100644 --- a/proto/babylon/btccheckpoint/btccheckpoint.proto +++ b/proto/babylon/btccheckpoint/v1/btccheckpoint.proto @@ -43,37 +43,36 @@ message BTCSpvProof { // which transaction was included and transaction index in the block message TransactionKey { uint32 index = 1; - bytes hash = 2 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" - ]; + bytes hash = 2 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" ]; } // 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 -message SubmissionKey { - repeated TransactionKey key = 1; -} +// 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 +message SubmissionKey { repeated TransactionKey key = 1; } +// BtcStatus is an enum describing the current btc status of the checkpoint enum BtcStatus { option (gogoproto.goproto_enum_prefix) = false; // SUBMITTED Epoch has Submitted btc status if there ever was at least one // known submission on btc main chain - EPOCH_STATUS_SUBMITTED = 0 [(gogoproto.enumvalue_customname) = "Submitted"]; + EPOCH_STATUS_SUBMITTED = 0 [ (gogoproto.enumvalue_customname) = "Submitted" ]; // CONFIRMED Epoch has Confirmed btc status if there ever was at least one // known submission on btc main chain which was k-deep - EPOCH_STATUS_CONFIRMED = 1 [(gogoproto.enumvalue_customname) = "Confirmed"]; + EPOCH_STATUS_CONFIRMED = 1 [ (gogoproto.enumvalue_customname) = "Confirmed" ]; // CONFIRMED Epoch has Finalized btc status if there is was at exactly one // knon submission on btc main chain which is w-deep - EPOCH_STATUS_FINALIZED = 2 [(gogoproto.enumvalue_customname) = "Finalized"]; + EPOCH_STATUS_FINALIZED = 2 [ (gogoproto.enumvalue_customname) = "Finalized" ]; } -// TransactionInfo is the info of a tx that contains Babylon checkpoint, including +// TransactionInfo is the info of a tx that contains Babylon checkpoint, +// including // - the position of the tx on BTC blockchain // - the full tx content // - the Merkle proof that this tx is on the above position @@ -94,22 +93,24 @@ message TransactionInfo { } // TODO: Determine if we should keep any block number or depth info. -// On one hand it may be usefull to determine if block is stable or not, on other -// depth/block number info, without context (i.e info about chain) is pretty useless -// and blockshash in enough to retrieve is from lightclient +// On one hand it may be usefull to determine if block is stable or not, on +// other depth/block number info, without context (i.e info about chain) is +// pretty useless and blockshash in enough to retrieve is from lightclient message SubmissionData { // address of the submitter and reporter CheckpointAddresses vigilante_addresses = 1; // txs_info is the two `TransactionInfo`s corresponding to the submission // It is used for // - recovering address of sender of btc transction to payup the reward. - // - allowing the ZoneConcierge module to prove the checkpoint is submitted to BTC + // - allowing the ZoneConcierge module to prove the checkpoint is submitted to + // BTC repeated TransactionInfo txs_info = 2; uint64 epoch = 3; } // Data stored in db and indexed by epoch number -// TODO: Add btc blockheight at epooch end, when adding hadnling of epoching callbacks +// TODO: Add btc blockheight at epooch end, when adding hadnling of epoching +// callbacks message EpochData { // List of all received checkpoints during this epoch, sorted by order of // submission. @@ -119,22 +120,32 @@ message EpochData { BtcStatus status = 2; } +// CheckpointAddresses contains the addresses of the submitter and reporter of a +// given checkpoint message CheckpointAddresses { // TODO: this could probably be better typed - // Address of the checkpoint submitter, extracted from the checkpoint itself. + // submitter is the address of the checkpoint submitter to BTC, extracted from + // the checkpoint itself. bytes submitter = 1; - // Address of the reporter which reported the submissions, calculated from - // submission message MsgInsertBTCSpvProof itself + // reporter is the address of the reporter who reported the submissions, + // calculated from submission message MsgInsertBTCSpvProof itself bytes reporter = 2; } +// BTCCheckpointInfo contains all data about best submission of checkpoint for +// given epoch. Best submission is the submission which is deeper in btc ledger message BTCCheckpointInfo { // epoch number of this checkpoint uint64 epoch_number = 1; - // height of earliest BTC block that includes this checkpoint - uint64 earliest_btc_block_number = 2; - // hash of earliest BTC block that includes this checkpoint - bytes earliest_btc_block_hash = 3; - // list of vigilantes' addresses - repeated CheckpointAddresses vigilante_address_list = 4; + // btc height of the best submission of the epoch + uint64 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 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" ]; + // the BTC checkpoint transactions of the best submission + repeated TransactionInfo best_submission_transactions = 4; + // list of vigilantes' addresses of the best submission + repeated CheckpointAddresses best_submission_vigilante_address_list = 5; } diff --git a/proto/babylon/btccheckpoint/genesis.proto b/proto/babylon/btccheckpoint/v1/genesis.proto similarity index 86% rename from proto/babylon/btccheckpoint/genesis.proto rename to proto/babylon/btccheckpoint/v1/genesis.proto index 2aa6e1b47..49097c360 100644 --- a/proto/babylon/btccheckpoint/genesis.proto +++ b/proto/babylon/btccheckpoint/v1/genesis.proto @@ -2,7 +2,7 @@ syntax = "proto3"; package babylon.btccheckpoint.v1; import "gogoproto/gogo.proto"; -import "babylon/btccheckpoint/params.proto"; +import "babylon/btccheckpoint/v1/params.proto"; option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; diff --git a/proto/babylon/btccheckpoint/v1/params.proto b/proto/babylon/btccheckpoint/v1/params.proto new file mode 100644 index 000000000..20ed5e6ee --- /dev/null +++ b/proto/babylon/btccheckpoint/v1/params.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package babylon.btccheckpoint.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; + +// Params defines the parameters for the module. +message Params { + option (gogoproto.equal) = true; + + // 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 + [ (gogoproto.moretags) = "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) + uint64 checkpoint_finalization_timeout = 2 + [ (gogoproto.moretags) = "yaml:\"checkpoint_finalization_timeout\"" ]; + + // 4byte tag in hex format, required to be present in the OP_RETURN transaction + // related to babylon + string checkpoint_tag = 3 + [ (gogoproto.moretags) = "yaml:\"checkpoint_tag\"" ]; +} diff --git a/proto/babylon/btccheckpoint/query.proto b/proto/babylon/btccheckpoint/v1/query.proto similarity index 59% rename from proto/babylon/btccheckpoint/query.proto rename to proto/babylon/btccheckpoint/v1/query.proto index 6cad44bab..2c88f8905 100644 --- a/proto/babylon/btccheckpoint/query.proto +++ b/proto/babylon/btccheckpoint/v1/query.proto @@ -4,8 +4,8 @@ package babylon.btccheckpoint.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "babylon/btccheckpoint/params.proto"; -import "babylon/btccheckpoint/btccheckpoint.proto"; +import "babylon/btccheckpoint/v1/params.proto"; +import "babylon/btccheckpoint/v1/btccheckpoint.proto"; option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; @@ -17,17 +17,22 @@ service Query { } // BtcCheckpointInfo returns checkpoint info for a given epoch - rpc BtcCheckpointInfo(QueryBtcCheckpointInfoRequest) returns (QueryBtcCheckpointInfoResponse) { + rpc BtcCheckpointInfo(QueryBtcCheckpointInfoRequest) + returns (QueryBtcCheckpointInfoResponse) { option (google.api.http).get = "/babylon/btccheckpoint/v1/{epoch_num}"; } // BtcCheckpointsInfo returns checkpoint info for a range of epochs - rpc BtcCheckpointsInfo(QueryBtcCheckpointsInfoRequest) returns (QueryBtcCheckpointsInfoResponse) { + rpc BtcCheckpointsInfo(QueryBtcCheckpointsInfoRequest) + returns (QueryBtcCheckpointsInfoResponse) { option (google.api.http).get = "/babylon/btccheckpoint/v1"; } - rpc EpochSubmissions(QueryEpochSubmissionsRequest) returns (QueryEpochSubmissionsResponse) { - option (google.api.http).get = "/babylon/btccheckpoint/v1/{epoch_num}/submissions"; + // EpochSubmissions returns all submissions for a given epoch + rpc EpochSubmissions(QueryEpochSubmissionsRequest) + returns (QueryEpochSubmissionsResponse) { + option (google.api.http).get = + "/babylon/btccheckpoint/v1/{epoch_num}/submissions"; } } @@ -40,32 +45,35 @@ message QueryParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } +// QueryBtcCheckpointInfoRequest defines the query to get the best checkpoint +// for a given epoch message QueryBtcCheckpointInfoRequest { - // Number of epoch for which the earliest checkpointing btc height is requested + // Number of epoch for which the earliest checkpointing btc height is + // requested uint64 epoch_num = 1; } -// QueryBtcCheckpointInfoResponse is response type for the Query/BtcCheckpointInfo RPC method -message QueryBtcCheckpointInfoResponse { - BTCCheckpointInfo info = 1; -} +// QueryBtcCheckpointInfoResponse is response type for the +// Query/BtcCheckpointInfo RPC method +message QueryBtcCheckpointInfoResponse { BTCCheckpointInfo info = 1; } -// QueryBtcCheckpointsInfoRequest is request type for the Query/BtcCheckpointsInfo RPC method +// QueryBtcCheckpointsInfoRequest is request type for the +// Query/BtcCheckpointsInfo RPC method message QueryBtcCheckpointsInfoRequest { - uint64 start_epoch = 1; - uint64 end_epoch = 2; - // pagination defines whether to have the pagination in the request - cosmos.base.query.v1beta1.PageRequest pagination = 3; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } -// QueryBtcCheckpointsInfoResponse is response type for the Query/BtcCheckpointsInfo RPC method +// QueryBtcCheckpointsInfoResponse is response type for the +// Query/BtcCheckpointsInfo RPC method message QueryBtcCheckpointsInfoResponse { repeated BTCCheckpointInfo info_list = 1; // pagination defines the pagination in the response cosmos.base.query.v1beta1.PageResponse pagination = 2; } +// QueryEpochSubmissionsRequest defines a request to get all submissions in +// given epoch message QueryEpochSubmissionsRequest { // Number of epoch for which submissions are requested uint64 epoch_num = 1; @@ -73,6 +81,8 @@ message QueryEpochSubmissionsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } +// QueryEpochSubmissionsResponse defines a response to get all submissions in +// given epoch (QueryEpochSubmissionsRequest) message QueryEpochSubmissionsResponse { // All submissions saved during an epoch. repeated SubmissionKey keys = 1; diff --git a/proto/babylon/btccheckpoint/v1/tx.proto b/proto/babylon/btccheckpoint/v1/tx.proto new file mode 100644 index 000000000..d0d12b363 --- /dev/null +++ b/proto/babylon/btccheckpoint/v1/tx.proto @@ -0,0 +1,50 @@ +syntax = "proto3"; +package babylon.btccheckpoint.v1; + +import "babylon/btccheckpoint/v1/btccheckpoint.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "babylon/btccheckpoint/v1/params.proto"; +import "gogoproto/gogo.proto"; + +option go_package = "github.com/babylonchain/babylon/x/btccheckpoint/types"; + +// Msg defines the Msg service. +service Msg { + // InsertBTCSpvProof tries to insert a new checkpoint into the store. + rpc InsertBTCSpvProof(MsgInsertBTCSpvProof) + returns (MsgInsertBTCSpvProofResponse); + + // UpdateParams updates the btccheckpoint module parameters. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); +} + +// MsgInsertBTCSpvProof defines resquest to insert a new checkpoint into the +// store +message MsgInsertBTCSpvProof { + string submitter = 1; + repeated babylon.btccheckpoint.v1.BTCSpvProof proofs = 2; +} + +// MsgInsertBTCSpvProofResponse defines the response for the +// MsgInsertBTCSpvProof message +message MsgInsertBTCSpvProofResponse {} + +// MsgUpdateParams defines a message to update the btccheckpoint module params. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + // just FYI: cosmos.AddressString marks that this field should use type alias + // for AddressString instead of string, but the functionality is not yet implemented + // in cosmos-proto + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the btccheckpoint parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse defines the response to the MsgUpdateParams message. +message MsgUpdateParamsResponse {} diff --git a/proto/babylon/btclightclient/btclightclient.proto b/proto/babylon/btclightclient/btclightclient.proto deleted file mode 100644 index 16891fe49..000000000 --- a/proto/babylon/btclightclient/btclightclient.proto +++ /dev/null @@ -1,20 +0,0 @@ -syntax = "proto3"; -package babylon.btclightclient.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; - -message BTCHeaderInfo { - bytes header = 1 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BTCHeaderBytes" - ]; - bytes hash = 2 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" - ]; - uint64 height = 3; - bytes work = 4 [ - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint" - ]; -} - diff --git a/proto/babylon/btclightclient/params.proto b/proto/babylon/btclightclient/params.proto deleted file mode 100644 index 2b6488364..000000000 --- a/proto/babylon/btclightclient/params.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; -package babylon.btclightclient.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; -} diff --git a/proto/babylon/btclightclient/v1/btclightclient.proto b/proto/babylon/btclightclient/v1/btclightclient.proto new file mode 100644 index 000000000..6c1c400fb --- /dev/null +++ b/proto/babylon/btclightclient/v1/btclightclient.proto @@ -0,0 +1,26 @@ +syntax = "proto3"; +package babylon.btclightclient.v1; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; + +// BTCHeaderInfo is a structure that contains all relevant information about a +// BTC header +// - Full header bytes +// - Header hash for easy retrieval +// - 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. +message BTCHeaderInfo { + bytes header = 1 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderBytes" ]; + bytes hash = 2 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" ]; + uint64 height = 3; + bytes work = 4 + [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint" ]; +} diff --git a/proto/babylon/btclightclient/event.proto b/proto/babylon/btclightclient/v1/event.proto similarity index 75% rename from proto/babylon/btclightclient/event.proto rename to proto/babylon/btclightclient/v1/event.proto index f3278d5e7..4b1a3a0af 100644 --- a/proto/babylon/btclightclient/event.proto +++ b/proto/babylon/btclightclient/v1/event.proto @@ -1,8 +1,7 @@ syntax = "proto3"; package babylon.btclightclient.v1; -import "gogoproto/gogo.proto"; -import "babylon/btclightclient/btclightclient.proto"; +import "babylon/btclightclient/v1/btclightclient.proto"; option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; @@ -10,21 +9,15 @@ option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; // of the current mainchain to which we are rolling back to. // In other words, there is one rollback event emitted per re-org, to the // greatest common ancestor of the old and the new fork. -message EventBTCRollBack { - BTCHeaderInfo header = 1; -} +message EventBTCRollBack { BTCHeaderInfo header = 1; } // EventBTCRollForward is emitted on Msg/InsertHeader // The header included in the event is the one the main chain is extended with. // In the event of a reorg, each block on the new fork that comes after // the greatest common ancestor will have a corresponding roll forward event. -message EventBTCRollForward { - BTCHeaderInfo header = 1; -} +message EventBTCRollForward { BTCHeaderInfo header = 1; } // EventBTCHeaderInserted is emitted on Msg/InsertHeader // The header included in the event is the one that was added to the // on chain BTC storage. -message EventBTCHeaderInserted { - BTCHeaderInfo header = 1; -} +message EventBTCHeaderInserted { BTCHeaderInfo header = 1; } diff --git a/proto/babylon/btclightclient/genesis.proto b/proto/babylon/btclightclient/v1/genesis.proto similarity index 53% rename from proto/babylon/btclightclient/genesis.proto rename to proto/babylon/btclightclient/v1/genesis.proto index e159e7d2f..4b15f0714 100644 --- a/proto/babylon/btclightclient/genesis.proto +++ b/proto/babylon/btclightclient/v1/genesis.proto @@ -2,14 +2,11 @@ syntax = "proto3"; package babylon.btclightclient.v1; import "gogoproto/gogo.proto"; -import "babylon/btclightclient/params.proto"; -import "babylon/btclightclient/btclightclient.proto"; +import "babylon/btclightclient/v1/btclightclient.proto"; option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; // GenesisState defines the btclightclient module's genesis state. message GenesisState { - Params params = 1 [(gogoproto.nullable) = false]; - - BTCHeaderInfo base_btc_header = 2 [(gogoproto.nullable) = false]; + BTCHeaderInfo base_btc_header = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/babylon/btclightclient/query.proto b/proto/babylon/btclightclient/v1/query.proto similarity index 66% rename from proto/babylon/btclightclient/query.proto rename to proto/babylon/btclightclient/v1/query.proto index a3f422bed..a562cfece 100644 --- a/proto/babylon/btclightclient/query.proto +++ b/proto/babylon/btclightclient/v1/query.proto @@ -4,18 +4,12 @@ package babylon.btclightclient.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "babylon/btclightclient/params.proto"; -import "babylon/btclightclient/btclightclient.proto"; +import "babylon/btclightclient/v1/btclightclient.proto"; option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; // Query defines the gRPC querier service. service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/babylon/btclightclient/v1/params"; - } - // Hashes retrieves the hashes maintained by the module. rpc Hashes(QueryHashesRequest) returns (QueryHashesResponse) { option (google.api.http).get = "/babylon/btclightclient/v1/hashes"; @@ -30,7 +24,8 @@ service Query { // checks whether a hash is maintained by the module. // See discussion at https://github.com/babylonchain/babylon/pull/132 // for more details. - rpc ContainsBytes(QueryContainsBytesRequest) returns (QueryContainsBytesResponse) { + rpc ContainsBytes(QueryContainsBytesRequest) + returns (QueryContainsBytesResponse) { option (google.api.http).get = "/babylon/btclightclient/v1/containsBytes"; } @@ -44,19 +39,13 @@ service Query { option (google.api.http).get = "/babylon/btclightclient/v1/tip"; } + // BaseHeader returns the base BTC header of the chain. This header is defined + // on genesis. rpc BaseHeader(QueryBaseHeaderRequest) returns (QueryBaseHeaderResponse) { option (google.api.http).get = "/babylon/btclightclient/v1/baseheader"; } } -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} // QueryHashesRequest is request type for the Query/Hashes RPC method. // It involves retrieving all hashes that are maintained by the module. message QueryHashesRequest { @@ -65,35 +54,30 @@ message QueryHashesRequest { // QueryHashesResponse is response type for the Query/Hashes RPC method. message QueryHashesResponse { - repeated bytes hashes = 1 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" - ]; + repeated bytes hashes = 1 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" ]; cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryContainsRequest is request type for the Query/Contains RPC method. // It involves checking whether a hash is maintained by the module. message QueryContainsRequest { - bytes hash = 1 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" - ]; + bytes hash = 1 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderHashBytes" ]; } // QueryContainsResponse is response type for the Query/Contains RPC method. -message QueryContainsResponse { - bool contains = 1; -} +message QueryContainsResponse { bool contains = 1; } -// QueryContainsRequest is request type for the temporary Query/ContainsBytes RPC method. -// It involves checking whether a hash is maintained by the module. -message QueryContainsBytesRequest { - bytes hash = 1; -} +// QueryContainsRequest is request type for the temporary Query/ContainsBytes +// RPC method. It involves checking whether a hash is maintained by the module. +message QueryContainsBytesRequest { bytes hash = 1; } -// QueryContainsResponse is response type for the temporary Query/ContainsBytes RPC method. -message QueryContainsBytesResponse { - bool contains = 1; -} +// QueryContainsResponse is response type for the temporary Query/ContainsBytes +// RPC method. +message QueryContainsBytesResponse { bool contains = 1; } // QueryMainChainRequest is request type for the Query/MainChain RPC method. // It involves retrieving the canonical chain maintained by the module. @@ -108,16 +92,16 @@ message QueryMainChainResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryTipRequest { -} +// QueryTipRequest is the request type for the Query/Tip RPC method. +message QueryTipRequest {} -message QueryTipResponse { - BTCHeaderInfo header = 1; -} +// QueryTipResponse is the response type for the Query/Tip RPC method. +message QueryTipResponse { BTCHeaderInfo header = 1; } -message QueryBaseHeaderRequest { -} +// QueryBaseHeaderRequest is the request type for the Query/BaseHeader RPC +// method. +message QueryBaseHeaderRequest {} -message QueryBaseHeaderResponse { - BTCHeaderInfo header = 1; -} +// QueryBaseHeaderResponse is the response type for the Query/BaseHeader RPC +// method. +message QueryBaseHeaderResponse { BTCHeaderInfo header = 1; } diff --git a/proto/babylon/btclightclient/tx.proto b/proto/babylon/btclightclient/v1/tx.proto similarity index 59% rename from proto/babylon/btclightclient/tx.proto rename to proto/babylon/btclightclient/v1/tx.proto index bd79f76b0..30127aaee 100644 --- a/proto/babylon/btclightclient/tx.proto +++ b/proto/babylon/btclightclient/v1/tx.proto @@ -2,21 +2,23 @@ syntax = "proto3"; package babylon.btclightclient.v1; import "gogoproto/gogo.proto"; -import "babylon/btclightclient/btclightclient.proto"; - option go_package = "github.com/babylonchain/babylon/x/btclightclient/types"; // Msg defines the Msg service. service Msg { + // InsertHeader adds a header to the BTC light client chain maintained by + // Babylon. rpc InsertHeader(MsgInsertHeader) returns (MsgInsertHeaderResponse) {}; } // MsgInsertHeader defines the message for incoming header bytes message MsgInsertHeader { string signer = 1; - bytes header = 2 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/types.BTCHeaderBytes" - ]; + bytes header = 2 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/types.BTCHeaderBytes" ]; } + +// MsgInsertHeaderResponse defines the response for the InsertHeader transaction message MsgInsertHeaderResponse {} diff --git a/proto/babylon/checkpointing/events.proto b/proto/babylon/checkpointing/events.proto deleted file mode 100644 index f5bc3865f..000000000 --- a/proto/babylon/checkpointing/events.proto +++ /dev/null @@ -1,35 +0,0 @@ -syntax = "proto3"; -package babylon.checkpointing.v1; - -import "babylon/checkpointing/checkpoint.proto"; - -option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; - -message EventCheckpointAccumulating { - RawCheckpointWithMeta checkpoint = 1; -} - -message EventCheckpointSealed { - RawCheckpointWithMeta checkpoint = 1; -} - -message EventCheckpointSubmitted { - RawCheckpointWithMeta checkpoint = 1; -} - -message EventCheckpointConfirmed { - RawCheckpointWithMeta checkpoint = 1; -} - -message EventCheckpointFinalized { - RawCheckpointWithMeta checkpoint = 1; -} - -message EventCheckpointForgotten { - RawCheckpointWithMeta checkpoint = 1; -} - -message EventConflictingCheckpoint { - RawCheckpoint conflicting_checkpoint = 1; - RawCheckpointWithMeta local_checkpoint = 2; -} diff --git a/proto/babylon/checkpointing/params.proto b/proto/babylon/checkpointing/params.proto deleted file mode 100644 index 15612d498..000000000 --- a/proto/babylon/checkpointing/params.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; -package babylon.checkpointing.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; - -// Params defines the parameters for the module. -message Params { option (gogoproto.goproto_stringer) = false; } diff --git a/proto/babylon/checkpointing/bls_key.proto b/proto/babylon/checkpointing/v1/bls_key.proto similarity index 66% rename from proto/babylon/checkpointing/bls_key.proto rename to proto/babylon/checkpointing/v1/bls_key.proto index 4dc568a64..204af94e8 100644 --- a/proto/babylon/checkpointing/bls_key.proto +++ b/proto/babylon/checkpointing/v1/bls_key.proto @@ -8,33 +8,34 @@ option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // BlsKey wraps BLS public key with PoP message BlsKey { // pubkey is the BLS public key of a validator - bytes pubkey = 2 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/crypto/bls12381.PublicKey" - ]; + bytes pubkey = 2 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/crypto/bls12381.PublicKey" ]; // pop is the proof-of-possession of the BLS key ProofOfPossession pop = 3; } -// ProofOfPossession defines proof for the ownership of Ed25519 and BLS private keys +// ProofOfPossession defines proof for the ownership of Ed25519 and BLS private +// keys message ProofOfPossession { - // ed25519_sig is used for verification, ed25519_sig = sign(key = Ed25519_sk, data = BLS_pk) + // ed25519_sig is used for verification, ed25519_sig = sign(key = Ed25519_sk, + // data = BLS_pk) bytes ed25519_sig = 2; - // bls_sig is the result of PoP, bls_sig = sign(key = BLS_sk, data = ed25519_sig) - bytes bls_sig = 3 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/crypto/bls12381.Signature" - ]; + // bls_sig is the result of PoP, bls_sig = sign(key = BLS_sk, data = + // ed25519_sig) + bytes bls_sig = 3 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/crypto/bls12381.Signature" ]; } // ValidatorWithBLSSet defines a set of validators with their BLS public keys -message ValidatorWithBlsKeySet { - repeated ValidatorWithBlsKey val_set = 1; -} +message ValidatorWithBlsKeySet { repeated ValidatorWithBlsKey val_set = 1; } -// ValidatorWithBlsKey couples validator address, voting power, and its bls public key +// ValidatorWithBlsKey couples validator address, voting power, and its bls +// public key message ValidatorWithBlsKey { string validator_address = 1; bytes bls_pub_key = 2; uint64 voting_power = 3; } - diff --git a/proto/babylon/checkpointing/checkpoint.proto b/proto/babylon/checkpointing/v1/checkpoint.proto similarity index 55% rename from proto/babylon/checkpointing/checkpoint.proto rename to proto/babylon/checkpointing/v1/checkpoint.proto index ccbac63c4..909450708 100644 --- a/proto/babylon/checkpointing/checkpoint.proto +++ b/proto/babylon/checkpointing/v1/checkpoint.proto @@ -2,90 +2,92 @@ syntax = "proto3"; package babylon.checkpointing.v1; import "google/protobuf/timestamp.proto"; -import "cosmos_proto/cosmos.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // RawCheckpoint wraps the BLS multi sig with meta data message RawCheckpoint { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; // epoch_num defines the epoch number the raw checkpoint is for uint64 epoch_num = 1; - // last_commit_hash defines the 'LastCommitHash' that individual BLS sigs are signed on - bytes last_commit_hash = 2 [ - (gogoproto.customtype) = "LastCommitHash" - ]; + // last_commit_hash defines the 'LastCommitHash' that individual BLS sigs are + // signed on + bytes last_commit_hash = 2 [ (gogoproto.customtype) = "LastCommitHash" ]; // bitmap defines the bitmap that indicates the signers of the BLS multi sig bytes bitmap = 3; - // bls_multi_sig defines the multi sig that is aggregated from individual BLS sigs - bytes bls_multi_sig = 4 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/crypto/bls12381.Signature" - ]; + // bls_multi_sig defines the multi sig that is aggregated from individual BLS + // sigs + bytes bls_multi_sig = 4 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/crypto/bls12381.Signature" ]; } // RawCheckpointWithMeta wraps the raw checkpoint with meta data. message RawCheckpointWithMeta { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; RawCheckpoint ckpt = 1; // status defines the status of the checkpoint CheckpointStatus status = 2; // bls_aggr_pk defines the aggregated BLS public key - bytes bls_aggr_pk = 3 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/crypto/bls12381.PublicKey" - ]; + bytes bls_aggr_pk = 3 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/crypto/bls12381.PublicKey" ]; // power_sum defines the accumulated voting power for the checkpoint uint64 power_sum = 4; - // lifecycle defines the lifecycle of this checkpoint, i.e., each state transition and - // the time (in both timestamp and block height) of this transition. + // lifecycle defines the lifecycle of this checkpoint, i.e., each state + // transition and the time (in both timestamp and block height) of this + // transition. repeated CheckpointStateUpdate lifecycle = 5; } -// CkptStatus is the status of a checkpoint. +// CheckpointStatus is the status of a checkpoint. enum CheckpointStatus { option (gogoproto.goproto_enum_prefix) = false; // ACCUMULATING defines a checkpoint that is awaiting for BLS signatures. - CKPT_STATUS_ACCUMULATING = 0 [(gogoproto.enumvalue_customname) = "Accumulating"]; + CKPT_STATUS_ACCUMULATING = 0 + [ (gogoproto.enumvalue_customname) = "Accumulating" ]; // SEALED defines a checkpoint that has accumulated sufficient BLS signatures. - CKPT_STATUS_SEALED = 1 [(gogoproto.enumvalue_customname) = "Sealed"]; + CKPT_STATUS_SEALED = 1 [ (gogoproto.enumvalue_customname) = "Sealed" ]; // SUBMITTED defines a checkpoint that is included on BTC. - CKPT_STATUS_SUBMITTED = 2 [(gogoproto.enumvalue_customname) = "Submitted"]; + CKPT_STATUS_SUBMITTED = 2 [ (gogoproto.enumvalue_customname) = "Submitted" ]; // CONFIRMED defines a checkpoint that is k-deep on BTC. - CKPT_STATUS_CONFIRMED = 3 [(gogoproto.enumvalue_customname) = "Confirmed"]; + CKPT_STATUS_CONFIRMED = 3 [ (gogoproto.enumvalue_customname) = "Confirmed" ]; // FINALIZED defines a checkpoint that is w-deep on BTC. - CKPT_STATUS_FINALIZED = 4 [(gogoproto.enumvalue_customname) = "Finalized"]; + CKPT_STATUS_FINALIZED = 4 [ (gogoproto.enumvalue_customname) = "Finalized" ]; } +// CheckpointStateUpdate defines a state transition on the checkpoint. message CheckpointStateUpdate { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; // state defines the event of a state transition towards this state CheckpointStatus state = 1; - // block_height is the height of the Babylon block that triggers the state update + // block_height is the height of the Babylon block that triggers the state + // update uint64 block_height = 2; - // block_time is the timestamp in the Babylon block that triggers the state update - google.protobuf.Timestamp block_time = 3 [(gogoproto.stdtime) = true]; + // block_time is the timestamp in the Babylon block that triggers the state + // update + google.protobuf.Timestamp block_time = 3 [ (gogoproto.stdtime) = true ]; } // BlsSig wraps the BLS sig with meta data. message BlsSig { - option (gogoproto.equal) = false; + option (gogoproto.equal) = false; // epoch_num defines the epoch number that the BLS sig is signed on uint64 epoch_num = 1; // last_commit_hash defines the 'LastCommitHash' that the BLS sig is signed on - bytes last_commit_hash = 2 [ - (gogoproto.customtype) = "LastCommitHash" - ]; - bytes bls_sig = 3 [ - (gogoproto.customtype) = "github.com/babylonchain/babylon/crypto/bls12381.Signature" - ]; - // can't find cosmos_proto.scalar when compiling due to cosmos v0.45.4 does not support scalar - // string signer_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // the signer_address defines the address of the signer + bytes last_commit_hash = 2 [ (gogoproto.customtype) = "LastCommitHash" ]; + bytes bls_sig = 3 + [ (gogoproto.customtype) = + "github.com/babylonchain/babylon/crypto/bls12381.Signature" ]; + // can't find cosmos_proto.scalar when compiling due to cosmos v0.45.4 does + // not support scalar string signer_address = 4 [(cosmos_proto.scalar) = + // "cosmos.AddressString"]; the signer_address defines the address of the + // signer string signer_address = 4; } - diff --git a/proto/babylon/checkpointing/v1/events.proto b/proto/babylon/checkpointing/v1/events.proto new file mode 100644 index 000000000..4e170c058 --- /dev/null +++ b/proto/babylon/checkpointing/v1/events.proto @@ -0,0 +1,37 @@ +syntax = "proto3"; +package babylon.checkpointing.v1; + +import "babylon/checkpointing/v1/checkpoint.proto"; + +option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; + +// EventCheckpointAccumulating is emitted when a checkpoint reaches the +// `Accumulating` state. +message EventCheckpointAccumulating { RawCheckpointWithMeta checkpoint = 1; } + +// EventCheckpointSealed is emitted when a checkpoint reaches the `Sealed` +// state. +message EventCheckpointSealed { RawCheckpointWithMeta checkpoint = 1; } + +// EventCheckpointSubmitted is emitted when a checkpoint reaches the `Submitted` +// state. +message EventCheckpointSubmitted { RawCheckpointWithMeta checkpoint = 1; } + +// EventCheckpointConfirmed is emitted when a checkpoint reaches the `Confirmed` +// state. +message EventCheckpointConfirmed { RawCheckpointWithMeta checkpoint = 1; } + +// EventCheckpointFinalized is emitted when a checkpoint reaches the `Finalized` +// state. +message EventCheckpointFinalized { RawCheckpointWithMeta checkpoint = 1; } + +// EventCheckpointForgotten is emitted when a checkpoint switches to a +// `Forgotten` state. +message EventCheckpointForgotten { RawCheckpointWithMeta checkpoint = 1; } + +// EventConflictingCheckpoint is emitted when two conflicting checkpoints are +// found. +message EventConflictingCheckpoint { + RawCheckpoint conflicting_checkpoint = 1; + RawCheckpointWithMeta local_checkpoint = 2; +} diff --git a/proto/babylon/checkpointing/genesis.proto b/proto/babylon/checkpointing/v1/genesis.proto similarity index 65% rename from proto/babylon/checkpointing/genesis.proto rename to proto/babylon/checkpointing/v1/genesis.proto index a701f5170..dd65d5017 100644 --- a/proto/babylon/checkpointing/genesis.proto +++ b/proto/babylon/checkpointing/v1/genesis.proto @@ -1,22 +1,18 @@ syntax = "proto3"; package babylon.checkpointing.v1; -import "cosmos_proto/cosmos.proto"; -import "gogoproto/gogo.proto"; import "cosmos/crypto/ed25519/keys.proto"; -import "babylon/checkpointing/params.proto"; -import "babylon/checkpointing/bls_key.proto"; +import "babylon/checkpointing/v1/bls_key.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // GenesisState defines the checkpointing module's genesis state. message GenesisState { - // params defines all the paramaters of related to checkpointing - Params params = 1 [(gogoproto.nullable) = false]; - - repeated GenesisKey genesis_keys = 2; + // genesis_keys defines the public keys for the genesis validators + repeated GenesisKey genesis_keys = 1; } +// GenesisKey defines public key information about the genesis validators message GenesisKey { // validator_address is the address corresponding to a validator string validator_address = 1; diff --git a/proto/babylon/checkpointing/query.proto b/proto/babylon/checkpointing/v1/query.proto similarity index 50% rename from proto/babylon/checkpointing/query.proto rename to proto/babylon/checkpointing/v1/query.proto index 3accee792..b522c9a7e 100644 --- a/proto/babylon/checkpointing/query.proto +++ b/proto/babylon/checkpointing/v1/query.proto @@ -1,55 +1,69 @@ syntax = "proto3"; package babylon.checkpointing.v1; -import "babylon/checkpointing/bls_key.proto"; +import "babylon/checkpointing/v1/bls_key.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; -import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "babylon/checkpointing/params.proto"; -import "babylon/checkpointing/checkpoint.proto"; +import "babylon/checkpointing/v1/checkpoint.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; // Query defines the gRPC querier service. service Query { // RawCheckpointList queries all checkpoints that match the given status. - rpc RawCheckpointList(QueryRawCheckpointListRequest) returns (QueryRawCheckpointListResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoints/{status}"; + rpc RawCheckpointList(QueryRawCheckpointListRequest) + returns (QueryRawCheckpointListResponse) { + option (google.api.http).get = + "/babylon/checkpointing/v1/raw_checkpoints/{status}"; } // RawCheckpoint queries a checkpoints at a given epoch number. - rpc RawCheckpoint(QueryRawCheckpointRequest) returns (QueryRawCheckpointResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/raw_checkpoint/{epoch_num}"; + rpc RawCheckpoint(QueryRawCheckpointRequest) + returns (QueryRawCheckpointResponse) { + option (google.api.http).get = + "/babylon/checkpointing/v1/raw_checkpoint/{epoch_num}"; } - // BlsPublicKeyList queries a list of bls public keys of the validators at a given epoch number. - rpc BlsPublicKeyList(QueryBlsPublicKeyListRequest) returns (QueryBlsPublicKeyListResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/bls_public_keys/{epoch_num}"; + // RawCheckpoints queries checkpoints for a epoch range specified in pagination params. + rpc RawCheckpoints(QueryRawCheckpointsRequest) + returns (QueryRawCheckpointsResponse) { + option (google.api.http).get = + "/babylon/checkpointing/v1/raw_checkpoints"; } - // EpochStatus queries the status of the checkpoint at a given epoch - rpc EpochStatus(QueryEpochStatusRequest) returns (QueryEpochStatusResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/epochs/{epoch_num}/status"; + // BlsPublicKeyList queries a list of bls public keys of the validators at a + // given epoch number. + rpc BlsPublicKeyList(QueryBlsPublicKeyListRequest) + returns (QueryBlsPublicKeyListResponse) { + option (google.api.http).get = + "/babylon/checkpointing/v1/bls_public_keys/{epoch_num}"; } - // RecentEpochStatusCount queries the number of epochs with each status in recent epochs - rpc RecentEpochStatusCount(QueryRecentEpochStatusCountRequest) returns (QueryRecentEpochStatusCountResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/epochs:status_count"; + // EpochStatus queries the status of the checkpoint at a given epoch + rpc EpochStatus(QueryEpochStatusRequest) returns (QueryEpochStatusResponse) { + option (google.api.http).get = + "/babylon/checkpointing/v1/epochs/{epoch_num}/status"; } - // LastCheckpointWithStatus queries the last checkpoint with a given status or a more matured status - rpc LastCheckpointWithStatus(QueryLastCheckpointWithStatusRequest) returns (QueryLastCheckpointWithStatusResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/last_raw_checkpoint/{status}"; + // RecentEpochStatusCount queries the number of epochs with each status in + // recent epochs + rpc RecentEpochStatusCount(QueryRecentEpochStatusCountRequest) + returns (QueryRecentEpochStatusCountResponse) { + option (google.api.http).get = + "/babylon/checkpointing/v1/epochs:status_count"; } - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/babylon/checkpointing/v1/params"; + // LastCheckpointWithStatus queries the last checkpoint with a given status or + // a more matured status + rpc LastCheckpointWithStatus(QueryLastCheckpointWithStatusRequest) + returns (QueryLastCheckpointWithStatusResponse) { + option (google.api.http).get = + "/babylon/checkpointing/v1/last_raw_checkpoint/{status}"; } } -// QueryRawCheckpointListRequest is the request type for the Query/RawCheckpoints -// RPC method. +// QueryRawCheckpointListRequest is the request type for the +// Query/RawCheckpoints RPC method. message QueryRawCheckpointListRequest { // status defines the status of the raw checkpoints of the query CheckpointStatus status = 1; @@ -58,8 +72,8 @@ message QueryRawCheckpointListRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryRawCheckpointListResponse is the response type for the Query/RawCheckpoints -// RPC method. +// QueryRawCheckpointListResponse is the response type for the +// Query/RawCheckpoints RPC method. message QueryRawCheckpointListResponse { // the order is going from the newest to oldest based on the epoch number repeated RawCheckpointWithMeta raw_checkpoints = 1; @@ -77,8 +91,24 @@ message QueryRawCheckpointRequest { // QueryRawCheckpointResponse is the response type for the Query/RawCheckpoint // RPC method. -message QueryRawCheckpointResponse { - RawCheckpointWithMeta raw_checkpoint = 1; +message QueryRawCheckpointResponse { RawCheckpointWithMeta raw_checkpoint = 1; } + + +// QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints +// RPC method. +message QueryRawCheckpointsRequest { + // pagination defines whether to have the pagination in the request + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// RPC method. +message QueryRawCheckpointsResponse { + // the order is going from the newest to oldest based on the epoch number + repeated RawCheckpointWithMeta raw_checkpoints = 1; + + // pagination defines the pagination in the response. + cosmos.base.query.v1beta1.PageResponse pagination = 2; } // QueryBlsPublicKeyListRequest is the request type for the Query/BlsPublicKeys @@ -91,8 +121,8 @@ message QueryBlsPublicKeyListRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryBlsPublicKeyListResponse is the response type for the Query/BlsPublicKeys -// RPC method. +// QueryBlsPublicKeyListResponse is the response type for the +// Query/BlsPublicKeys RPC method. message QueryBlsPublicKeyListResponse { repeated ValidatorWithBlsKey validator_with_bls_keys = 1; @@ -102,44 +132,34 @@ message QueryBlsPublicKeyListResponse { // QueryEpochStatusRequest is the request type for the Query/EpochStatus // RPC method. -message QueryEpochStatusRequest { - uint64 epoch_num = 1; -} +message QueryEpochStatusRequest { uint64 epoch_num = 1; } // QueryEpochStatusResponse is the response type for the Query/EpochStatus // RPC method. -message QueryEpochStatusResponse { - CheckpointStatus status = 1; -} +message QueryEpochStatusResponse { CheckpointStatus status = 1; } -// QueryRecentEpochStatusCountRequest is the request type for the Query/EpochStatusCount -// RPC method. +// QueryRecentEpochStatusCountRequest is the request type for the +// Query/EpochStatusCount RPC method. message QueryRecentEpochStatusCountRequest { - // epoch_count is the number of the most recent epochs to include in the aggregation + // epoch_count is the number of the most recent epochs to include in the + // aggregation uint64 epoch_count = 1; } -// QueryRecentEpochStatusCountResponse is the response type for the Query/EpochStatusCount -// RPC method. +// QueryRecentEpochStatusCountResponse is the response type for the +// Query/EpochStatusCount RPC method. message QueryRecentEpochStatusCountResponse { uint64 tip_epoch = 1; uint64 epoch_count = 2; map status_count = 3; } -message QueryLastCheckpointWithStatusRequest { - CheckpointStatus status = 1; -} +// QueryLastCheckpointWithStatusRequest is the request type for the +// Query/LastCheckpointWithStatus RPC method. +message QueryLastCheckpointWithStatusRequest { CheckpointStatus status = 1; } +// QueryLastCheckpointWithStatusResponse is the response type for the +// Query/LastCheckpointWithStatus RPC method. message QueryLastCheckpointWithStatusResponse { RawCheckpoint raw_checkpoint = 1; } - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [ (gogoproto.nullable) = false ]; -} diff --git a/proto/babylon/checkpointing/tx.proto b/proto/babylon/checkpointing/v1/tx.proto similarity index 65% rename from proto/babylon/checkpointing/tx.proto rename to proto/babylon/checkpointing/v1/tx.proto index a6c89b28a..78a990491 100644 --- a/proto/babylon/checkpointing/tx.proto +++ b/proto/babylon/checkpointing/v1/tx.proto @@ -2,9 +2,10 @@ syntax = "proto3"; package babylon.checkpointing.v1; import "gogoproto/gogo.proto"; -import "babylon/checkpointing/checkpoint.proto"; -import "babylon/checkpointing/bls_key.proto"; +import "babylon/checkpointing/v1/checkpoint.proto"; +import "babylon/checkpointing/v1/bls_key.proto"; import "cosmos/staking/v1beta1/tx.proto"; +import "cosmos_proto/cosmos.proto"; option go_package = "github.com/babylonchain/babylon/x/checkpointing/types"; @@ -14,7 +15,8 @@ service Msg { rpc AddBlsSig(MsgAddBlsSig) returns (MsgAddBlsSigResponse); // WrappedCreateValidator defines a method for registering a new validator - rpc WrappedCreateValidator(MsgWrappedCreateValidator) returns (MsgWrappedCreateValidatorResponse); + rpc WrappedCreateValidator(MsgWrappedCreateValidator) + returns (MsgWrappedCreateValidatorResponse); } // MsgAddBlsSig defines a message to add a bls signature from a @@ -23,7 +25,12 @@ message MsgAddBlsSig { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - BlsSig bls_sig = 1; + // signer corresponds to the submitter of the transaction + // This might be a different entity compared to the one that created the BLS signature + // (i.e. the validator owner of the BLS key which is specified by the `bls_sig.signer_address`) + string signer = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + BlsSig bls_sig = 2; } // MsgAddBlsSigResponse defines the MsgAddBlsSig response type. @@ -38,5 +45,6 @@ message MsgWrappedCreateValidator { cosmos.staking.v1beta1.MsgCreateValidator msg_create_validator = 2; } -// MsgWrappedCreateValidatorResponse defines the MsgWrappedCreateValidator response type +// MsgWrappedCreateValidatorResponse defines the MsgWrappedCreateValidator +// response type message MsgWrappedCreateValidatorResponse {} diff --git a/proto/babylon/epoching/v1/epoching.proto b/proto/babylon/epoching/v1/epoching.proto index 4cd3fe688..9b56c0bca 100644 --- a/proto/babylon/epoching/v1/epoching.proto +++ b/proto/babylon/epoching/v1/epoching.proto @@ -8,23 +8,28 @@ import "cosmos/staking/v1beta1/tx.proto"; option go_package = "github.com/babylonchain/babylon/x/epoching/types"; +// Epoch is a structure that contains the metadata of an epoch message Epoch { uint64 epoch_number = 1; uint64 current_epoch_interval = 2; uint64 first_block_height = 3; // last_block_header is the header of the last block in this epoch. - // Babylon needs to remember the last header of each epoch to complete unbonding validators/delegations when a previous epoch's checkpoint is finalised. - // The last_block_header field is nil in the epoch's beginning, and is set upon the end of this epoch. + // Babylon needs to remember the last header of each epoch to complete + // unbonding validators/delegations when a previous epoch's checkpoint is + // finalised. The last_block_header field is nil in the epoch's beginning, and + // is set upon the end of this epoch. tendermint.types.Header last_block_header = 4; // app_hash_root is the Merkle root of all AppHashs in this epoch // It will be used for proving a block is in an epoch bytes app_hash_root = 5; // sealer_header is the 2nd header of the next epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of the sealer header + // This validator set has generated a BLS multisig on `last_commit_hash` of + // the sealer header tendermint.types.Header sealer_header = 6; } -// QueuedMessage is a message that can change the validator set and is delayed to the epoch boundary +// QueuedMessage is a message that can change the validator set and is delayed +// to the epoch boundary message QueuedMessage { // tx_id is the ID of the tx that contains the message bytes tx_id = 1; @@ -33,8 +38,9 @@ message QueuedMessage { // block_height is the height when this msg is submitted to Babylon uint64 block_height = 3; // block_time is the timestamp when this msg is submitted to Babylon - google.protobuf.Timestamp block_time = 4 [(gogoproto.stdtime) = true]; - // msg is the actual message that is sent by a user and is queued by the epoching module + google.protobuf.Timestamp block_time = 4 [ (gogoproto.stdtime) = true ]; + // msg is the actual message that is sent by a user and is queued by the + // epoching module oneof msg { cosmos.staking.v1beta1.MsgCreateValidator msg_create_validator = 5; cosmos.staking.v1beta1.MsgDelegate msg_delegate = 6; @@ -44,45 +50,61 @@ message QueuedMessage { } } +// QueuedMessageList is a message that contains a list of staking-related +// messages queued for an epoch message QueuedMessageList { uint64 epoch_number = 1; repeated QueuedMessage msgs = 2; } +// BondState is the bond state of a validator or delegation enum BondState { + // CREATED is when the validator/delegation has been created CREATED = 0; + // CREATED is when the validator/delegation has become bonded BONDED = 1; + // CREATED is when the validator/delegation has become unbonding UNBONDING = 2; + // CREATED is when the validator/delegation has become unbonded UNBONDED = 3; + // CREATED is when the validator/delegation has been removed REMOVED = 4; } +// ValStateUpdate is a messages that records a state update of a validator message ValStateUpdate { BondState state = 1; uint64 block_height = 2; - google.protobuf.Timestamp block_time = 3 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp block_time = 3 [ (gogoproto.stdtime) = true ]; } +// ValidatorLifecycle is a message that records records the lifecycle of +// a validator message ValidatorLifecycle { string val_addr = 1; repeated ValStateUpdate val_life = 2; } +// DelegationStateUpdate is the message that records a state update of a +// delegation message DelegationStateUpdate { BondState state = 1; string val_addr = 2; uint64 block_height = 3; - google.protobuf.Timestamp block_time = 4 [(gogoproto.stdtime) = true]; + google.protobuf.Timestamp block_time = 4 [ (gogoproto.stdtime) = true ]; } +// ValidatorLifecycle is a message that records records the lifecycle of +// a delegation message DelegationLifecycle { string del_addr = 1; repeated DelegationStateUpdate del_life = 2; } +// Validator is a message that denotes a validator message Validator { // addr is the validator's address (in sdk.ValAddress) bytes addr = 1; // power is the validator's voting power int64 power = 2; -} \ No newline at end of file +} diff --git a/proto/babylon/epoching/v1/events.proto b/proto/babylon/epoching/v1/events.proto index f2e96eb60..ec210e2f8 100644 --- a/proto/babylon/epoching/v1/events.proto +++ b/proto/babylon/epoching/v1/events.proto @@ -5,53 +5,61 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/babylonchain/babylon/x/epoching/types"; -message EventBeginEpoch { - uint64 epoch_number = 1; -} +// EventBeginEpoch is the event emitted when an epoch has started +message EventBeginEpoch { uint64 epoch_number = 1; } -message EventEndEpoch { - uint64 epoch_number = 1; -} +// EventEndEpoch is the event emitted when an epoch has ended +message EventEndEpoch { uint64 epoch_number = 1; } +// EventHandleQueuedMsg is the event emitted when a queued message has been +// handled message EventHandleQueuedMsg { - string original_event_type = 1; - uint64 epoch_number = 2; - uint64 height = 3; - bytes tx_id = 4; - bytes msg_id = 5; - repeated bytes original_attributes = 6 [ - (gogoproto.customtype) = "github.com/tendermint/tendermint/abci/types.EventAttribute" - ]; - string error = 7; + string original_event_type = 1; + uint64 epoch_number = 2; + uint64 height = 3; + bytes tx_id = 4; + bytes msg_id = 5; + repeated bytes original_attributes = 6 + [ (gogoproto.customtype) = + "github.com/cometbft/cometbft/abci/types.EventAttribute" ]; + string error = 7; } +// EventSlashThreshold is the event emitted when a set of validators have been +// slashed message EventSlashThreshold { - int64 slashed_voting_power = 1; - int64 total_voting_power = 2; - repeated bytes slashed_validators = 3; + int64 slashed_voting_power = 1; + int64 total_voting_power = 2; + repeated bytes slashed_validators = 3; } +// EventWrappedDelegate is the event emitted when a MsgWrappedDelegate has been +// queued message EventWrappedDelegate { - string delegator_address = 1; - string validator_address = 2; - uint64 amount = 3; - string denom = 4; - uint64 epoch_boundary = 5; + string delegator_address = 1; + string validator_address = 2; + uint64 amount = 3; + string denom = 4; + uint64 epoch_boundary = 5; } +// EventWrappedUndelegate is the event emitted when a MsgWrappedUndelegate has +// been queued message EventWrappedUndelegate { - string delegator_address = 1; - string validator_address = 2; - uint64 amount = 3; - string denom = 4; - uint64 epoch_boundary = 5; + string delegator_address = 1; + string validator_address = 2; + uint64 amount = 3; + string denom = 4; + uint64 epoch_boundary = 5; } +// EventWrappedBeginRedelegate is the event emitted when a +// MsgWrappedBeginRedelegate has been queued message EventWrappedBeginRedelegate { - string delegator_address = 1; - string source_validator_address = 2; - string destination_validator_address = 3; - uint64 amount = 4; - string denom = 5; - uint64 epoch_boundary = 6; + string delegator_address = 1; + string source_validator_address = 2; + string destination_validator_address = 3; + uint64 amount = 4; + string denom = 5; + uint64 epoch_boundary = 6; } diff --git a/proto/babylon/epoching/v1/genesis.proto b/proto/babylon/epoching/v1/genesis.proto index 7f7a99177..eea522cba 100644 --- a/proto/babylon/epoching/v1/genesis.proto +++ b/proto/babylon/epoching/v1/genesis.proto @@ -7,6 +7,4 @@ import "babylon/epoching/v1/params.proto"; option go_package = "github.com/babylonchain/babylon/x/epoching/types"; // GenesisState defines the epoching module's genesis state. -message GenesisState { - Params params = 1 [ (gogoproto.nullable) = false ]; -} +message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/babylon/epoching/v1/params.proto b/proto/babylon/epoching/v1/params.proto index 9da17151d..a9ce9a531 100644 --- a/proto/babylon/epoching/v1/params.proto +++ b/proto/babylon/epoching/v1/params.proto @@ -7,8 +7,9 @@ option go_package = "github.com/babylonchain/babylon/x/epoching/types"; // Params defines the parameters for the module. message Params { - option (gogoproto.equal) = true; + option (gogoproto.equal) = true; // epoch_interval is the number of consecutive blocks to form an epoch - uint64 epoch_interval = 1 [ (gogoproto.moretags) = "yaml:\"epoch_interval\"" ]; + uint64 epoch_interval = 1 + [ (gogoproto.moretags) = "yaml:\"epoch_interval\"" ]; } diff --git a/proto/babylon/epoching/v1/query.proto b/proto/babylon/epoching/v1/query.proto index 18fcead52..f78acae35 100644 --- a/proto/babylon/epoching/v1/query.proto +++ b/proto/babylon/epoching/v1/query.proto @@ -21,41 +21,51 @@ service Query { option (google.api.http).get = "/babylon/epoching/v1/epochs/{epoch_num=*}"; } - // EpochsInfo queries the metadata of epochs in a given range, depending on the - // parameters in the pagination request. Th main use case will be querying the - // latest epochs in time order. + // EpochsInfo queries the metadata of epochs in a given range, depending on + // the parameters in the pagination request. Th main use case will be querying + // the latest epochs in time order. rpc EpochsInfo(QueryEpochsInfoRequest) returns (QueryEpochsInfoResponse) { option (google.api.http).get = "/babylon/epoching/v1/epochs"; } // CurrentEpoch queries the current epoch - rpc CurrentEpoch(QueryCurrentEpochRequest) returns (QueryCurrentEpochResponse) { + rpc CurrentEpoch(QueryCurrentEpochRequest) + returns (QueryCurrentEpochResponse) { option (google.api.http).get = "/babylon/epoching/v1/current_epoch"; } // EpochMsgs queries the messages of a given epoch rpc EpochMsgs(QueryEpochMsgsRequest) returns (QueryEpochMsgsResponse) { - option (google.api.http).get = "/babylon/epoching/v1/epochs/{epoch_num=*}/messages"; + option (google.api.http).get = + "/babylon/epoching/v1/epochs/{epoch_num=*}/messages"; } - // LatestEpochMsgs queries the messages within a given number of most recent epochs - rpc LatestEpochMsgs(QueryLatestEpochMsgsRequest) returns (QueryLatestEpochMsgsResponse) { - option (google.api.http).get = "/babylon/epoching/v1/epochs:latest/messages"; + // LatestEpochMsgs queries the messages within a given number of most recent + // epochs + rpc LatestEpochMsgs(QueryLatestEpochMsgsRequest) + returns (QueryLatestEpochMsgsResponse) { + option (google.api.http).get = + "/babylon/epoching/v1/epochs:latest/messages"; } // ValidatorLifecycle queries the lifecycle of a given validator - rpc ValidatorLifecycle(QueryValidatorLifecycleRequest) returns (QueryValidatorLifecycleResponse) { - option (google.api.http).get = "/babylon/epoching/v1/validator_lifecycle/{val_addr}"; + rpc ValidatorLifecycle(QueryValidatorLifecycleRequest) + returns (QueryValidatorLifecycleResponse) { + option (google.api.http).get = + "/babylon/epoching/v1/validator_lifecycle/{val_addr}"; } // DelegationLifecycle queries the lifecycle of a given delegation - rpc DelegationLifecycle(QueryDelegationLifecycleRequest) returns (QueryDelegationLifecycleResponse) { - option (google.api.http).get = "/babylon/epoching/v1/delegation_lifecycle/{del_addr}"; + rpc DelegationLifecycle(QueryDelegationLifecycleRequest) + returns (QueryDelegationLifecycleResponse) { + option (google.api.http).get = + "/babylon/epoching/v1/delegation_lifecycle/{del_addr}"; } // EpochValSet queries the validator set of a given epoch rpc EpochValSet(QueryEpochValSetRequest) returns (QueryEpochValSetResponse) { - option (google.api.http).get = "/babylon/epoching/v1/epochs/{epoch_num=*}/validator_set"; + option (google.api.http).get = + "/babylon/epoching/v1/epochs/{epoch_num=*}/validator_set"; } } @@ -68,34 +78,33 @@ message QueryParamsResponse { babylon.epoching.v1.Params params = 1 [ (gogoproto.nullable) = false ]; } -message QueryEpochInfoRequest { - uint64 epoch_num = 1; -} +// QueryEpochInfoRequest is the request type for the Query/EpochInfo method +message QueryEpochInfoRequest { uint64 epoch_num = 1; } -message QueryEpochInfoResponse { - babylon.epoching.v1.Epoch epoch = 1; -} +// QueryEpochInfoRequest is the response type for the Query/EpochInfo method +message QueryEpochInfoResponse { babylon.epoching.v1.Epoch epoch = 1; } +// QueryEpochInfosRequest is the request type for the Query/EpochInfos method message QueryEpochsInfoRequest { - uint64 start_epoch = 1; - uint64 end_epoch = 2; - // pagination defines whether to have the pagination in the request - cosmos.base.query.v1beta1.PageRequest pagination = 3; + cosmos.base.query.v1beta1.PageRequest pagination = 1; } +// QueryEpochsInfoResponse is the response type for the Query/EpochInfos method message QueryEpochsInfoResponse { repeated babylon.epoching.v1.Epoch epochs = 1; - + // pagination defines the pagination in the response cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryCurrentEpochRequest is the request type for the Query/CurrentEpoch RPC method +// QueryCurrentEpochRequest is the request type for the Query/CurrentEpoch RPC +// method message QueryCurrentEpochRequest {} -// QueryCurrentEpochResponse is the response type for the Query/CurrentEpoch RPC method -message QueryCurrentEpochResponse { +// QueryCurrentEpochResponse is the response type for the Query/CurrentEpoch RPC +// method +message QueryCurrentEpochResponse { // current_epoch is the current epoch number uint64 current_epoch = 1; // epoch_boundary is the height of this epoch's last block @@ -111,7 +120,8 @@ message QueryEpochMsgsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 2; } -// QueryEpochMsgsResponse is the response type for the Query/EpochMsgs RPC method +// QueryEpochMsgsResponse is the response type for the Query/EpochMsgs RPC +// method message QueryEpochMsgsResponse { // msgs is the list of messages queued in the current epoch repeated babylon.epoching.v1.QueuedMessage msgs = 1; @@ -119,8 +129,9 @@ message QueryEpochMsgsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -// QueryLatestEpochMsgsRequest is the request type for the Query/LatestEpochMsgs RPC method -// it returns epoch msgs within epoch [max(1, end_epoch-epoch_count+1), end_epoch] +// QueryLatestEpochMsgsRequest is the request type for the Query/LatestEpochMsgs +// RPC method it returns epoch msgs within epoch [max(1, +// end_epoch-epoch_count+1), end_epoch] message QueryLatestEpochMsgsRequest { // end_epoch is the number of the last epoch to query uint64 end_epoch = 1; @@ -130,7 +141,8 @@ message QueryLatestEpochMsgsRequest { cosmos.base.query.v1beta1.PageRequest pagination = 3; } -// QueryLatestEpochMsgsResponse is the response type for the Query/LatestEpochMsgs RPC method +// QueryLatestEpochMsgsResponse is the response type for the +// Query/LatestEpochMsgs RPC method message QueryLatestEpochMsgsResponse { // epoch_msg_map is a list of QueuedMessageList // each QueuedMessageList has a field identifying the epoch number @@ -139,27 +151,31 @@ message QueryLatestEpochMsgsResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryValidatorLifecycleRequest { - string val_addr = 1; -} +// QueryValidatorLifecycleRequest is the request type for the +// Query/ValidatorLifecycle RPC method +message QueryValidatorLifecycleRequest { string val_addr = 1; } -message QueryValidatorLifecycleResponse { - ValidatorLifecycle val_life = 1; -} +// QueryValidatorLifecycleResponse is the response type for the +// Query/ValidatorLifecycle RPC method +message QueryValidatorLifecycleResponse { ValidatorLifecycle val_life = 1; } -message QueryDelegationLifecycleRequest { - string del_addr = 1; -} +// QueryDelegationLifecycleRequest is the request type for the +// Query/DelegationLifecycle RPC method +message QueryDelegationLifecycleRequest { string del_addr = 1; } -message QueryDelegationLifecycleResponse { - DelegationLifecycle del_life = 1; -} +// QueryDelegationLifecycleRequest is the response type for the +// Query/DelegationLifecycle RPC method +message QueryDelegationLifecycleResponse { DelegationLifecycle del_life = 1; } +// QueryEpochValSetRequest is the request type for the Query/EpochValSet RPC +// method message QueryEpochValSetRequest { uint64 epoch_num = 1; cosmos.base.query.v1beta1.PageRequest pagination = 2; } +// QueryEpochValSetRequest is the response type for the Query/EpochValSet RPC +// method message QueryEpochValSetResponse { repeated babylon.epoching.v1.Validator validators = 1; int64 total_voting_power = 2; diff --git a/proto/babylon/epoching/v1/tx.proto b/proto/babylon/epoching/v1/tx.proto index d998f0ef4..a9bc48604 100644 --- a/proto/babylon/epoching/v1/tx.proto +++ b/proto/babylon/epoching/v1/tx.proto @@ -1,44 +1,86 @@ syntax = "proto3"; package babylon.epoching.v1; -import "google/protobuf/any.proto"; import "gogoproto/gogo.proto"; import "cosmos/staking/v1beta1/tx.proto"; +import "babylon/epoching/v1/params.proto"; + +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; option go_package = "github.com/babylonchain/babylon/x/epoching/types"; // Msg defines the Msg service. service Msg { - // WrappedDelegate defines a method for performing a delegation of coins from a delegator to a validator. + // WrappedDelegate defines a method for performing a delegation of coins from + // a delegator to a validator. rpc WrappedDelegate(MsgWrappedDelegate) returns (MsgWrappedDelegateResponse); - // WrappedUndelegate defines a method for performing an undelegation from a delegate and a validator. - rpc WrappedUndelegate(MsgWrappedUndelegate) returns (MsgWrappedUndelegateResponse); + // WrappedUndelegate defines a method for performing an undelegation from a + // delegate and a validator. + rpc WrappedUndelegate(MsgWrappedUndelegate) + returns (MsgWrappedUndelegateResponse); + + // WrappedBeginRedelegate defines a method for performing a redelegation of + // coins from a delegator and source validator to a destination validator. + rpc WrappedBeginRedelegate(MsgWrappedBeginRedelegate) + returns (MsgWrappedBeginRedelegateResponse); - // WrappedBeginRedelegate defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. - rpc WrappedBeginRedelegate(MsgWrappedBeginRedelegate) returns (MsgWrappedBeginRedelegateResponse); + // UpdateParams defines a method for updating epoching module parameters. + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } +// MsgWrappedDelegate is the message for delegating stakes message MsgWrappedDelegate { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - cosmos.staking.v1beta1.MsgDelegate msg = 1; + cosmos.staking.v1beta1.MsgDelegate msg = 1; } + +// MsgWrappedDelegate is the response to the MsgWrappedDelegate message message MsgWrappedDelegateResponse {} +// MsgWrappedUndelegate is the message for undelegating stakes message MsgWrappedUndelegate { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - cosmos.staking.v1beta1.MsgUndelegate msg = 1; + cosmos.staking.v1beta1.MsgUndelegate msg = 1; } + +// MsgWrappedUndelegateResponse is the response to the MsgWrappedUndelegate +// message message MsgWrappedUndelegateResponse {} +// MsgWrappedDelegate is the message for moving bonded stakes from a +// validator to another validator message MsgWrappedBeginRedelegate { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; - cosmos.staking.v1beta1.MsgBeginRedelegate msg = 1; + cosmos.staking.v1beta1.MsgBeginRedelegate msg = 1; } + +// MsgWrappedBeginRedelegateResponse is the response to the +// MsgWrappedBeginRedelegate message message MsgWrappedBeginRedelegateResponse {} + +// MsgUpdateParams defines a message for updating epoching module parameters. +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + // authority is the address of the governance account. + // just FYI: cosmos.AddressString marks that this field should use type alias + // for AddressString instead of string, but the functionality is not yet implemented + // in cosmos-proto + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // params defines the epoching paramaeters parameters to update. + // + // NOTE: All parameters must be supplied. + Params params = 2 [(gogoproto.nullable) = false]; +} + +// MsgUpdateParamsResponse is the response to the MsgUpdateParams message. +message MsgUpdateParamsResponse {} diff --git a/proto/babylon/monitor/params.proto b/proto/babylon/monitor/params.proto deleted file mode 100644 index 9ffe19c63..000000000 --- a/proto/babylon/monitor/params.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; -package babylon.monitor.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/babylonchain/babylon/x/monitor/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.equal) = true; -} diff --git a/proto/babylon/monitor/query.proto b/proto/babylon/monitor/query.proto deleted file mode 100644 index ae2128f31..000000000 --- a/proto/babylon/monitor/query.proto +++ /dev/null @@ -1,55 +0,0 @@ -syntax = "proto3"; -package babylon.monitor.v1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "babylon/monitor/params.proto"; - -option go_package = "github.com/babylonchain/babylon/x/monitor/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/babylon/monitor/v1/params"; - } - - // EndedEpochBtcHeight returns the BTC light client height at provided epoch finish - rpc EndedEpochBtcHeight(QueryEndedEpochBtcHeightRequest) returns (QueryEndedEpochBtcHeightResponse) { - option (google.api.http).get = "/babylon/monitor/v1/epochs/{epoch_num}"; - } - - // ReportedCheckpointBtcHeight returns the BTC light client height at which the checkpoint with the given hash is reported back to Babylon - rpc ReportedCheckpointBtcHeight(QueryReportedCheckpointBtcHeightRequest) returns (QueryReportedCheckpointBtcHeightResponse) { - option (google.api.http).get = "/babylon/monitor/v1/checkpoints/{ckpt_hash}"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [ (gogoproto.nullable) = false ]; -} - -message QueryEndedEpochBtcHeightRequest { - uint64 epoch_num = 1; -} - -message QueryEndedEpochBtcHeightResponse { - // height of btc light client when epoch ended - uint64 btc_light_client_height = 1; -} - -message QueryReportedCheckpointBtcHeightRequest { - // ckpt_hash is hex encoded byte string of the hash of the checkpoint - string ckpt_hash = 1; -} - -message QueryReportedCheckpointBtcHeightResponse { - // height of btc light client when checkpoint is reported - uint64 btc_light_client_height = 1; -} diff --git a/proto/babylon/monitor/genesis.proto b/proto/babylon/monitor/v1/genesis.proto similarity index 54% rename from proto/babylon/monitor/genesis.proto rename to proto/babylon/monitor/v1/genesis.proto index fb79098d0..66a259f15 100644 --- a/proto/babylon/monitor/genesis.proto +++ b/proto/babylon/monitor/v1/genesis.proto @@ -1,10 +1,7 @@ syntax = "proto3"; package babylon.monitor.v1; -import "gogoproto/gogo.proto"; -import "babylon/monitor/params.proto"; - option go_package = "github.com/babylonchain/babylon/x/monitor/types"; // GenesisState defines the monitor module's genesis state. -message GenesisState { Params params = 1 [ (gogoproto.nullable) = false ]; } +message GenesisState {} diff --git a/proto/babylon/monitor/v1/query.proto b/proto/babylon/monitor/v1/query.proto new file mode 100644 index 000000000..622305a34 --- /dev/null +++ b/proto/babylon/monitor/v1/query.proto @@ -0,0 +1,48 @@ +syntax = "proto3"; +package babylon.monitor.v1; + +import "google/api/annotations.proto"; + +option go_package = "github.com/babylonchain/babylon/x/monitor/types"; + +// Query defines the gRPC querier service. +service Query { + // EndedEpochBtcHeight returns the BTC light client height at provided epoch + // finish + rpc EndedEpochBtcHeight(QueryEndedEpochBtcHeightRequest) + returns (QueryEndedEpochBtcHeightResponse) { + option (google.api.http).get = "/babylon/monitor/v1/epochs/{epoch_num}"; + } + + // ReportedCheckpointBtcHeight returns the BTC light client height at which + // the checkpoint with the given hash is reported back to Babylon + rpc ReportedCheckpointBtcHeight(QueryReportedCheckpointBtcHeightRequest) + returns (QueryReportedCheckpointBtcHeightResponse) { + option (google.api.http).get = + "/babylon/monitor/v1/checkpoints/{ckpt_hash}"; + } +} +// QueryEndedEpochBtcHeightRequest defines a query type for EndedEpochBtcHeight +// RPC method +message QueryEndedEpochBtcHeightRequest { uint64 epoch_num = 1; } + +// QueryEndedEpochBtcHeightResponse defines a response type for +// EndedEpochBtcHeight RPC method +message QueryEndedEpochBtcHeightResponse { + // height of btc light client when epoch ended + uint64 btc_light_client_height = 1; +} + +// QueryReportedCheckpointBtcHeightRequest defines a query type for +// ReportedCheckpointBtcHeight RPC method +message QueryReportedCheckpointBtcHeightRequest { + // ckpt_hash is hex encoded byte string of the hash of the checkpoint + string ckpt_hash = 1; +} + +// QueryReportedCheckpointBtcHeightResponse defines a response type for +// ReportedCheckpointBtcHeight RPC method +message QueryReportedCheckpointBtcHeightResponse { + // height of btc light client when checkpoint is reported + uint64 btc_light_client_height = 1; +} diff --git a/proto/babylon/zoneconcierge/params.proto b/proto/babylon/zoneconcierge/params.proto deleted file mode 100644 index a633f0d8d..000000000 --- a/proto/babylon/zoneconcierge/params.proto +++ /dev/null @@ -1,12 +0,0 @@ -syntax = "proto3"; -package babylon.zoneconcierge.v1; - -import "gogoproto/gogo.proto"; - -option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types"; - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - -} diff --git a/proto/babylon/zoneconcierge/query.proto b/proto/babylon/zoneconcierge/query.proto deleted file mode 100644 index 92d755eb6..000000000 --- a/proto/babylon/zoneconcierge/query.proto +++ /dev/null @@ -1,191 +0,0 @@ -syntax = "proto3"; -package babylon.zoneconcierge.v1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "cosmos/base/query/v1beta1/pagination.proto"; -import "babylon/btccheckpoint/tx.proto"; -import "babylon/btccheckpoint/btccheckpoint.proto"; -import "babylon/checkpointing/query.proto"; -import "babylon/checkpointing/checkpoint.proto"; -import "babylon/epoching/v1/epoching.proto"; -import "babylon/zoneconcierge/params.proto"; -import "babylon/zoneconcierge/zoneconcierge.proto"; - -option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types"; - -// Query defines the gRPC querier service. -service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/params"; - } - // Header queries the CZ header and fork headers at a given height. - rpc Header(QueryHeaderRequest) returns (QueryHeaderResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/chain_info/{chain_id}/header/{height}"; - } - // ChainList queries the list of chains that checkpoint to Babylon - rpc ChainList(QueryChainListRequest) returns (QueryChainListResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/chains"; - } - // ChainInfo queries the latest info of a chain in Babylon's view - rpc ChainInfo(QueryChainInfoRequest) returns (QueryChainInfoResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/chain_info/{chain_id}"; - } - // EpochChainInfo queries the latest info of a chain in a given epoch of Babylon's view - rpc EpochChainInfo(QueryEpochChainInfoRequest) returns (QueryEpochChainInfoResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/chain_info/{chain_id}/epochs/{epoch_num}"; - } - // ListHeaders queries the headers of a chain in Babylon's view, with pagination support - rpc ListHeaders(QueryListHeadersRequest) returns (QueryListHeadersResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/headers/{chain_id}"; - } - // ListEpochHeaders queries the headers of a chain timestamped in a given epoch of Babylon, with pagination support - rpc ListEpochHeaders(QueryListEpochHeadersRequest) returns (QueryListEpochHeadersResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/headers/{chain_id}/epochs/{epoch_num}"; - } - // FinalizedChainInfo queries the BTC-finalised info of a chain, with proofs - rpc FinalizedChainInfo(QueryFinalizedChainInfoRequest) returns (QueryFinalizedChainInfoResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/finalized_chain_info/{chain_id}"; - } - // FinalizedChainInfoUntilHeight queries the BTC-finalised info no later than the provided CZ height, with proofs - rpc FinalizedChainInfoUntilHeight(QueryFinalizedChainInfoUntilHeightRequest) returns (QueryFinalizedChainInfoUntilHeightResponse) { - option (google.api.http).get = "/babylon/zoneconcierge/v1/finalized_chain_info/{chain_id}/height/{height}"; - } -} - -// QueryParamsRequest is request type for the Query/Params RPC method. -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - -// QueryHeaderRequest is request type for the Query/Header RPC method. -message QueryHeaderRequest { - string chain_id = 1; - uint64 height = 2; -} - -// QueryParamsResponse is response type for the Query/Header RPC method. -message QueryHeaderResponse { - babylon.zoneconcierge.v1.IndexedHeader header = 1; - babylon.zoneconcierge.v1.Forks fork_headers = 2; -} - -// QueryChainListRequest is request type for the Query/ChainList RPC method -message QueryChainListRequest { - // pagination defines whether to have the pagination in the request - cosmos.base.query.v1beta1.PageRequest pagination = 1; -} - -// QueryChainListResponse is response type for the Query/ChainList RPC method -message QueryChainListResponse { - // chain_ids are IDs of the chains in ascending alphabetical order - repeated string chain_ids = 1; - // pagination defines the pagination in the response - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryChainInfoRequest is request type for the Query/ChainInfo RPC method. -message QueryChainInfoRequest { - string chain_id = 1; -} - -// QueryChainInfoResponse is response type for the Query/ChainInfo RPC method. -message QueryChainInfoResponse { - // chain_info is the info of the CZ - babylon.zoneconcierge.v1.ChainInfo chain_info = 1; -} - -// QueryEpochChainInfoRequest is request type for the Query/EpochChainInfo RPC method. -message QueryEpochChainInfoRequest { - uint64 epoch_num = 1; - string chain_id = 2; -} - -// QueryEpochChainInfoResponse is response type for the Query/EpochChainInfo RPC method. -message QueryEpochChainInfoResponse { - // chain_info is the info of the CZ - babylon.zoneconcierge.v1.ChainInfo chain_info = 1; -} - -// QueryListHeadersRequest is request type for the Query/ListHeaders RPC method. -message QueryListHeadersRequest { - string chain_id = 1; - // pagination defines whether to have the pagination in the request - cosmos.base.query.v1beta1.PageRequest pagination = 2; -} - -// QueryListHeadersResponse is response type for the Query/ListHeaders RPC method. -message QueryListHeadersResponse { - // headers is the list of headers - repeated babylon.zoneconcierge.v1.IndexedHeader headers = 1; - // pagination defines the pagination in the response - cosmos.base.query.v1beta1.PageResponse pagination = 2; -} - -// QueryListEpochHeadersRequest is request type for the Query/ListEpochHeaders RPC method. -message QueryListEpochHeadersRequest { - uint64 epoch_num = 1; - string chain_id = 2; -} - -// QueryListEpochHeadersResponse is response type for the Query/ListEpochHeaders RPC method. -message QueryListEpochHeadersResponse { - // headers is the list of headers - repeated babylon.zoneconcierge.v1.IndexedHeader headers = 1; -} - -// QueryFinalizedChainInfoRequest is request type for the Query/FinalizedChainInfo RPC method. -message QueryFinalizedChainInfoRequest { - // chain_id is the ID of the CZ - string chain_id = 1; - // prove indicates whether the querier wants to get proofs of this timestamp - bool prove = 2; -} - -// QueryFinalizedChainInfoResponse is response type for the Query/FinalizedChainInfo RPC method. -message QueryFinalizedChainInfoResponse { - // finalized_chain_info is the info of the CZ - babylon.zoneconcierge.v1.ChainInfo finalized_chain_info = 1; - - // epoch_info is the metadata of the last BTC-finalised epoch - babylon.epoching.v1.Epoch epoch_info = 2; - // raw_checkpoint is the raw checkpoint of this epoch - babylon.checkpointing.v1.RawCheckpoint raw_checkpoint = 3; - // btc_submission_key is position of two BTC txs that include the raw checkpoint of this epoch - babylon.btccheckpoint.v1.SubmissionKey btc_submission_key = 4; - - // proof is the proof that the chain info is finalized - babylon.zoneconcierge.v1.ProofFinalizedChainInfo proof = 5; -} - -// QueryFinalizedChainInfoUntilHeightRequest is request type for the Query/FinalizedChainInfoUntilHeight RPC method. -message QueryFinalizedChainInfoUntilHeightRequest { - // chain_id is the ID of the CZ - string chain_id = 1; - // height is the height of the CZ chain - // such that the returned finalised chain info will be no later than this height - uint64 height = 2; - // prove indicates whether the querier wants to get proofs of this timestamp - bool prove = 3; -} - -// QueryFinalizedChainInfoUntilHeightResponse is response type for the Query/FinalizedChainInfoUntilHeight RPC method. -message QueryFinalizedChainInfoUntilHeightResponse { - // finalized_chain_info is the info of the CZ - babylon.zoneconcierge.v1.ChainInfo finalized_chain_info = 1; - - // epoch_info is the metadata of the last BTC-finalised epoch - babylon.epoching.v1.Epoch epoch_info = 2; - // raw_checkpoint is the raw checkpoint of this epoch - babylon.checkpointing.v1.RawCheckpoint raw_checkpoint = 3; - // btc_submission_key is position of two BTC txs that include the raw checkpoint of this epoch - babylon.btccheckpoint.v1.SubmissionKey btc_submission_key = 4; - - // proof is the proof that the chain info is finalized - babylon.zoneconcierge.v1.ProofFinalizedChainInfo proof = 5; -} diff --git a/proto/babylon/zoneconcierge/genesis.proto b/proto/babylon/zoneconcierge/v1/genesis.proto similarity index 59% rename from proto/babylon/zoneconcierge/genesis.proto rename to proto/babylon/zoneconcierge/v1/genesis.proto index 8acfe6ca3..65ed8cb19 100644 --- a/proto/babylon/zoneconcierge/genesis.proto +++ b/proto/babylon/zoneconcierge/v1/genesis.proto @@ -1,13 +1,9 @@ syntax = "proto3"; package babylon.zoneconcierge.v1; -import "gogoproto/gogo.proto"; -import "babylon/zoneconcierge/params.proto"; - option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types"; // GenesisState defines the zoneconcierge module's genesis state. message GenesisState { - Params params = 1 [ (gogoproto.nullable) = false ]; - string port_id = 2; + string port_id = 1; } diff --git a/proto/babylon/zoneconcierge/packet.proto b/proto/babylon/zoneconcierge/v1/packet.proto similarity index 51% rename from proto/babylon/zoneconcierge/packet.proto rename to proto/babylon/zoneconcierge/v1/packet.proto index 8ce8bb28f..a330e0141 100644 --- a/proto/babylon/zoneconcierge/packet.proto +++ b/proto/babylon/zoneconcierge/v1/packet.proto @@ -3,8 +3,13 @@ package babylon.zoneconcierge.v1; option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types"; +// ZoneconciergePacketData is the message that defines the IBC packets of +// ZoneConcierge message ZoneconciergePacketData { + // packet is the actual message carried in the IBC packet oneof packet { Heartbeat heartbeart = 1; } } +// Heartbeat is a heartbeat message that can be carried in IBC packets of +// ZoneConcierge message Heartbeat { string msg = 1; } diff --git a/proto/babylon/zoneconcierge/v1/query.proto b/proto/babylon/zoneconcierge/v1/query.proto new file mode 100644 index 000000000..e3675682d --- /dev/null +++ b/proto/babylon/zoneconcierge/v1/query.proto @@ -0,0 +1,187 @@ +syntax = "proto3"; +package babylon.zoneconcierge.v1; + +import "google/api/annotations.proto"; +import "cosmos/base/query/v1beta1/pagination.proto"; +import "babylon/btccheckpoint/v1/btccheckpoint.proto"; +import "babylon/checkpointing/v1/checkpoint.proto"; +import "babylon/epoching/v1/epoching.proto"; +import "babylon/zoneconcierge/v1/zoneconcierge.proto"; + +option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types"; + +// Query defines the gRPC querier service. +service Query { + // Header queries the CZ header and fork headers at a given height. + rpc Header(QueryHeaderRequest) returns (QueryHeaderResponse) { + option (google.api.http).get = + "/babylon/zoneconcierge/v1/chain_info/{chain_id}/header/{height}"; + } + // ChainList queries the list of chains that checkpoint to Babylon + rpc ChainList(QueryChainListRequest) returns (QueryChainListResponse) { + option (google.api.http).get = "/babylon/zoneconcierge/v1/chains"; + } + // ChainsInfo queries the latest info for a given list of chains in Babylon's view + rpc ChainsInfo(QueryChainsInfoRequest) returns (QueryChainsInfoResponse) { + option (google.api.http).get = + "/babylon/zoneconcierge/v1/chains_info"; + } + // EpochChainsInfo queries the latest info for a list of chains + // in a given epoch in Babylon's view + rpc EpochChainsInfo(QueryEpochChainsInfoRequest) + returns (QueryEpochChainsInfoResponse) { + option (google.api.http).get = + "/babylon/zoneconcierge/v1/epoch_chains_info"; + } + // ListHeaders queries the headers of a chain in Babylon's view, with + // pagination support + rpc ListHeaders(QueryListHeadersRequest) returns (QueryListHeadersResponse) { + option (google.api.http).get = + "/babylon/zoneconcierge/v1/headers/{chain_id}"; + } + // ListEpochHeaders queries the headers of a chain timestamped in a given + // epoch of Babylon, with pagination support + rpc ListEpochHeaders(QueryListEpochHeadersRequest) + returns (QueryListEpochHeadersResponse) { + option (google.api.http).get = + "/babylon/zoneconcierge/v1/headers/{chain_id}/epochs/{epoch_num}"; + } + // FinalizedChainsInfo queries the BTC-finalised info of chains with given IDs, with proofs + rpc FinalizedChainsInfo(QueryFinalizedChainsInfoRequest) + returns (QueryFinalizedChainsInfoResponse) { + option (google.api.http).get = + "/babylon/zoneconcierge/v1/finalized_chains_info"; + } + // FinalizedChainInfoUntilHeight queries the BTC-finalised info no later than + // the provided CZ height, with proofs + rpc FinalizedChainInfoUntilHeight(QueryFinalizedChainInfoUntilHeightRequest) + returns (QueryFinalizedChainInfoUntilHeightResponse) { + option (google.api.http).get = + "/babylon/zoneconcierge/v1/finalized_chain_info/{chain_id}/height/" + "{height}"; + } +} + +// QueryHeaderRequest is request type for the Query/Header RPC method. +message QueryHeaderRequest { + string chain_id = 1; + uint64 height = 2; +} + +// QueryHeaderResponse is response type for the Query/Header RPC method. +message QueryHeaderResponse { + babylon.zoneconcierge.v1.IndexedHeader header = 1; + babylon.zoneconcierge.v1.Forks fork_headers = 2; +} + +// QueryChainListRequest is request type for the Query/ChainList RPC method +message QueryChainListRequest { + // pagination defines whether to have the pagination in the request + cosmos.base.query.v1beta1.PageRequest pagination = 1; +} + +// QueryChainListResponse is response type for the Query/ChainList RPC method +message QueryChainListResponse { + // chain_ids are IDs of the chains in ascending alphabetical order + repeated string chain_ids = 1; + // pagination defines the pagination in the response + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryChainsInfoRequest is request type for the Query/ChainsInfo RPC method. +message QueryChainsInfoRequest { repeated string chain_ids = 1; } + +// QueryChainsInfoResponse is response type for the Query/ChainsInfo RPC method. +message QueryChainsInfoResponse { + repeated babylon.zoneconcierge.v1.ChainInfo chains_info = 1; +} + +// QueryEpochChainsInfoRequest is request type for the Query/EpochChainsInfo RPC +// method. +message QueryEpochChainsInfoRequest { + uint64 epoch_num = 1; + repeated string chain_ids = 2; +} + +// QueryEpochChainsInfoResponse is response type for the Query/EpochChainsInfo RPC +// method. +message QueryEpochChainsInfoResponse { + // chain_info is the info of the CZ + repeated babylon.zoneconcierge.v1.ChainInfo chains_info = 1; +} + +// QueryListHeadersRequest is request type for the Query/ListHeaders RPC method. +message QueryListHeadersRequest { + string chain_id = 1; + // pagination defines whether to have the pagination in the request + cosmos.base.query.v1beta1.PageRequest pagination = 2; +} + +// QueryListHeadersResponse is response type for the Query/ListHeaders RPC +// method. +message QueryListHeadersResponse { + // headers is the list of headers + repeated babylon.zoneconcierge.v1.IndexedHeader headers = 1; + // pagination defines the pagination in the response + cosmos.base.query.v1beta1.PageResponse pagination = 2; +} + +// QueryListEpochHeadersRequest is request type for the Query/ListEpochHeaders +// RPC method. +message QueryListEpochHeadersRequest { + uint64 epoch_num = 1; + string chain_id = 2; +} + +// QueryListEpochHeadersResponse is response type for the Query/ListEpochHeaders +// RPC method. +message QueryListEpochHeadersResponse { + // headers is the list of headers + repeated babylon.zoneconcierge.v1.IndexedHeader headers = 1; +} + +// QueryFinalizedChainsInfoRequest is request type for the +// Query/FinalizedChainsInfo RPC method. +message QueryFinalizedChainsInfoRequest { + // chain_ids is the list of ids of CZs + repeated string chain_ids = 1; + // prove indicates whether the querier wants to get proofs of this timestamp + bool prove = 2; +} + +// QueryFinalizedChainsInfoResponse is response type for the +// Query/FinalizedChainsInfo RPC method. +message QueryFinalizedChainsInfoResponse { + repeated babylon.zoneconcierge.v1.FinalizedChainInfo finalized_chains_info = 1; +} + +// QueryFinalizedChainInfoUntilHeightRequest is request type for the +// Query/FinalizedChainInfoUntilHeight RPC method. +message QueryFinalizedChainInfoUntilHeightRequest { + // chain_id is the ID of the CZ + string chain_id = 1; + // height is the height of the CZ chain + // such that the returned finalised chain info will be no later than this + // height + uint64 height = 2; + // prove indicates whether the querier wants to get proofs of this timestamp + bool prove = 3; +} + +// QueryFinalizedChainInfoUntilHeightResponse is response type for the +// Query/FinalizedChainInfoUntilHeight RPC method. +message QueryFinalizedChainInfoUntilHeightResponse { + // finalized_chain_info is the info of the CZ + babylon.zoneconcierge.v1.ChainInfo finalized_chain_info = 1; + + // epoch_info is the metadata of the last BTC-finalised epoch + babylon.epoching.v1.Epoch epoch_info = 2; + // raw_checkpoint is the raw checkpoint of this epoch + babylon.checkpointing.v1.RawCheckpoint raw_checkpoint = 3; + // btc_submission_key is position of two BTC txs that include the raw + // checkpoint of this epoch + babylon.btccheckpoint.v1.SubmissionKey btc_submission_key = 4; + + // proof is the proof that the chain info is finalized + babylon.zoneconcierge.v1.ProofFinalizedChainInfo proof = 5; +} diff --git a/proto/babylon/zoneconcierge/tx.proto b/proto/babylon/zoneconcierge/v1/tx.proto similarity index 100% rename from proto/babylon/zoneconcierge/tx.proto rename to proto/babylon/zoneconcierge/v1/tx.proto diff --git a/proto/babylon/zoneconcierge/zoneconcierge.proto b/proto/babylon/zoneconcierge/v1/zoneconcierge.proto similarity index 63% rename from proto/babylon/zoneconcierge/zoneconcierge.proto rename to proto/babylon/zoneconcierge/v1/zoneconcierge.proto index 07f219530..c19a34bba 100644 --- a/proto/babylon/zoneconcierge/zoneconcierge.proto +++ b/proto/babylon/zoneconcierge/v1/zoneconcierge.proto @@ -3,10 +3,10 @@ package babylon.zoneconcierge.v1; import "tendermint/types/types.proto"; import "tendermint/crypto/proof.proto"; -import "babylon/btccheckpoint/btccheckpoint.proto"; -import "babylon/checkpointing/bls_key.proto"; -import "babylon/checkpointing/query.proto"; -import "babylon/checkpointing/checkpoint.proto"; +import "babylon/btccheckpoint/v1/btccheckpoint.proto"; +import "babylon/checkpointing/v1/bls_key.proto"; +import "babylon/checkpointing/v1/checkpoint.proto"; +import "babylon/epoching/v1/epoching.proto"; option go_package = "github.com/babylonchain/babylon/x/zoneconcierge/types"; @@ -19,12 +19,14 @@ message IndexedHeader { // height is the height of this header on CZ ledger // (hash, height) jointly provides the position of the header on CZ ledger uint64 height = 3; - // babylon_header is the header of the babylon block that includes this CZ header + // babylon_header is the header of the babylon block that includes this CZ + // header tendermint.types.Header babylon_header = 4; // epoch is the epoch number of this header on Babylon ledger uint64 babylon_epoch = 5; // 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 + // (babylon_block_height, babylon_tx_hash) jointly provides the position of + // the header on Babylon ledger bytes babylon_tx_hash = 6; } @@ -36,11 +38,12 @@ message IndexedHeader { // \ -- 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. +// +// 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. message Forks { // blocks is the list of non-canonical indexed headers at the same height repeated IndexedHeader headers = 3; @@ -52,43 +55,73 @@ message ChainInfo { string chain_id = 1; // latest_header is the latest header in CZ's canonical chain IndexedHeader latest_header = 2; - // latest_forks is the latest forks, formed as a series of IndexedHeader (from low to high) + // latest_forks is the latest forks, formed as a series of IndexedHeader (from + // low to high) Forks latest_forks = 3; - // timestamped_headers_count is the number of timestamped headers in CZ's canonical chain + // timestamped_headers_count is the number of timestamped headers in CZ's + // canonical chain uint64 timestamped_headers_count = 4; } -// 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 +// FinalizedChainInfo is the information of a CZ that is BTC-finalised +message FinalizedChainInfo { + // chain_id is the ID of the chain + string chain_id = 1; + // finalized_chain_info is the info of the CZ + babylon.zoneconcierge.v1.ChainInfo finalized_chain_info = 2; + + // epoch_info is the metadata of the last BTC-finalised epoch + babylon.epoching.v1.Epoch epoch_info = 3; + // raw_checkpoint is the raw checkpoint of this epoch + babylon.checkpointing.v1.RawCheckpoint raw_checkpoint = 4; + // btc_submission_key is position of two BTC txs that include the raw + // checkpoint of this epoch + babylon.btccheckpoint.v1.SubmissionKey btc_submission_key = 5; + + // proof is the proof that the chain info is finalized + babylon.zoneconcierge.v1.ProofFinalizedChainInfo proof = 6; +} + +// 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 `last_commit_hash` is same as in the sealer header -// - More than 1/3 (in voting power) validators in the validator set of this epoch have signed `last_commit_hash` of the sealer header +// - More than 1/3 (in voting power) validators in the validator set of this +// epoch have signed `last_commit_hash` of the sealer header // - The epoch medatata is committed to the `app_hash` of the sealer header // - The validator set is committed to the `app_hash` of the sealer header message ProofEpochSealed { // validator_set is the validator set of the sealed epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of the sealer header + // This validator set has generated a BLS multisig on `last_commit_hash` of + // the sealer header repeated babylon.checkpointing.v1.ValidatorWithBlsKey validator_set = 1; - // proof_epoch_info is the Merkle proof that the epoch's metadata is committed to `app_hash` of the sealer header + // proof_epoch_info is the Merkle proof that the epoch's metadata is committed + // to `app_hash` of the sealer header tendermint.crypto.ProofOps proof_epoch_info = 2; - // proof_epoch_info is the Merkle proof that the epoch's validator set is committed to `app_hash` of the sealer header + // proof_epoch_info is the Merkle proof that the epoch's validator set is + // committed to `app_hash` of the sealer header tendermint.crypto.ProofOps proof_epoch_val_set = 3; } -// ProofFinalizedChainInfo is a set of proofs that attest a chain info is BTC-finalised +// ProofFinalizedChainInfo is a set of proofs that attest a chain info is +// BTC-finalised message ProofFinalizedChainInfo { /* - The following fields include proofs that attest the chain info is BTC-finalised + The following fields include proofs that attest the chain info is + BTC-finalised */ - // proof_tx_in_block is the proof that tx that carries the header is included in a certain Babylon block + // proof_tx_in_block is the proof that tx that carries the header is included + // in a certain Babylon block tendermint.types.TxProof proof_tx_in_block = 4; - // proof_header_in_epoch is the proof that the Babylon header is in a certain epoch + // proof_header_in_epoch is the proof that the Babylon header is in a certain + // epoch tendermint.crypto.Proof proof_header_in_epoch = 5; // proof_epoch_sealed is the proof that the epoch is sealed babylon.zoneconcierge.v1.ProofEpochSealed proof_epoch_sealed = 6; - // 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 + // 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 repeated babylon.btccheckpoint.v1.TransactionInfo proof_epoch_submitted = 7; } diff --git a/proto/buf.lock b/proto/buf.lock index 0563220f5..7a2810e68 100644 --- a/proto/buf.lock +++ b/proto/buf.lock @@ -5,15 +5,19 @@ deps: owner: cosmos repository: cosmos-proto commit: 1935555c206d4afb9e94615dfd0fad31 + digest: shake256:c74d91a3ac7ae07d579e90eee33abf9b29664047ac8816500cf22c081fec0d72d62c89ce0bebafc1f6fec7aa5315be72606717740ca95007248425102c365377 - remote: buf.build owner: cosmos repository: cosmos-sdk - commit: 8cb30a2c4de74dc9bd8d260b1e75e176 + commit: 954f7b05f38440fc8250134b15adec47 + digest: shake256:2ab4404fd04a7d1d52df0e2d0f2d477a3d83ffd88d876957bf3fedfd702c8e52833d65b3ce1d89a3c5adf2aab512616b0e4f51d8463f07eda9a8a3317ee3ac54 - remote: buf.build owner: cosmos repository: gogo-proto - commit: bee5511075b7499da6178d9e4aaa628b + commit: 34d970b699f84aa382f3c29773a60836 + digest: shake256:3d3bee5229ba579e7d19ffe6e140986a228b48a8c7fe74348f308537ab95e9135210e81812489d42cd8941d33ff71f11583174ccc5972e86e6112924b6ce9f04 - remote: buf.build owner: googleapis repository: googleapis commit: 8d7204855ec14631a499bd7393ce1970 + digest: shake256:40bf4112960cad01281930beed85829910768e32e80e986791596853eccd42c0cbd9d96690b918f658020d2d427e16f8b6514e2ac7f4a10306fd32e77be44329 diff --git a/proto/buf.yaml b/proto/buf.yaml index 619e81262..dc5409427 100644 --- a/proto/buf.yaml +++ b/proto/buf.yaml @@ -1,9 +1,9 @@ version: v1 name: buf.build/babylon/babylond deps: - - buf.build/cosmos/cosmos-sdk:8cb30a2c4de74dc9bd8d260b1e75e176 + - buf.build/cosmos/cosmos-sdk:v0.47.0 - buf.build/cosmos/cosmos-proto:1935555c206d4afb9e94615dfd0fad31 - - buf.build/cosmos/gogo-proto:bee5511075b7499da6178d9e4aaa628b + - buf.build/cosmos/gogo-proto:a14993478f40695898ed8a86931094b6656e8a5d - buf.build/googleapis/googleapis:8d7204855ec14631a499bd7393ce1970 breaking: use: @@ -13,9 +13,16 @@ lint: - DEFAULT - COMMENTS - FILE_LOWER_SNAKE_CASE + - COMMENT_MESSAGE + - COMMENT_ENUM_VALUE + - COMMENT_ENUM + - COMMENT_RPC + - COMMENT_ONEOF except: - UNARY_RPC - COMMENT_FIELD - SERVICE_SUFFIX - PACKAGE_VERSION_SUFFIX - RPC_REQUEST_STANDARD_NAME + - ENUM_VALUE_PREFIX + - ENUM_ZERO_VALUE_SUFFIX diff --git a/proto/scripts/protocgen.sh b/proto/scripts/protocgen.sh index 84e793d13..70312bb3d 100755 --- a/proto/scripts/protocgen.sh +++ b/proto/scripts/protocgen.sh @@ -2,11 +2,6 @@ set -eo pipefail -# get protoc executions -go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest 2>/dev/null -# get cosmos sdk from github -go get github.com/cosmos/cosmos-sdk@v0.46.6 2>/dev/null - cd proto proto_dirs=$(find ./babylon -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq) @@ -24,4 +19,4 @@ cd .. cp -r github.com/babylonchain/babylon/* ./ rm -rf github.com -go mod tidy -compat=1.19 +go mod tidy -compat=1.20 diff --git a/simapp/sim_bench_test.go b/simapp/sim_bench_test.go index 7eb28b0d3..4efb8f4c7 100644 --- a/simapp/sim_bench_test.go +++ b/simapp/sim_bench_test.go @@ -5,9 +5,8 @@ import ( "os" "testing" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - - sdksimapp "github.com/cosmos/cosmos-sdk/simapp" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/testutil/sims" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" @@ -39,7 +38,20 @@ func BenchmarkFullAppSimulation(b *testing.B) { if err != nil { b.Fatal(err) } - babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, interBlockCacheOpt()) + babylon := app.NewBabylonApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + FlagPeriodValue, + app.GetEncodingConfig(), + privSigner, + sims.EmptyAppOptions{}, + app.GetWasmEnabledProposals(), + app.EmptyWasmOpts, + interBlockCacheOpt()) // run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( @@ -55,7 +67,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { ) // export state and simParams before the simulation error is checked - if err = sdksimapp.CheckExportSimulation(babylon, config, simParams); err != nil { + if err = sims.CheckExportSimulation(babylon, config, simParams); err != nil { b.Fatal(err) } @@ -64,7 +76,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { } if config.Commit { - sdksimapp.PrintStats(db) + sims.PrintStats(db) } } @@ -93,7 +105,20 @@ func BenchmarkInvariants(b *testing.B) { if err != nil { b.Fatal(err) } - babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, interBlockCacheOpt()) + babylon := app.NewBabylonApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + FlagPeriodValue, + app.GetEncodingConfig(), + privSigner, + sims.EmptyAppOptions{}, + app.GetWasmEnabledProposals(), + app.EmptyWasmOpts, + interBlockCacheOpt()) // run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( @@ -109,7 +134,7 @@ func BenchmarkInvariants(b *testing.B) { ) // export state and simParams before the simulation error is checked - if err = sdksimapp.CheckExportSimulation(babylon, config, simParams); err != nil { + if err = sims.CheckExportSimulation(babylon, config, simParams); err != nil { b.Fatal(err) } @@ -118,7 +143,7 @@ func BenchmarkInvariants(b *testing.B) { } if config.Commit { - sdksimapp.PrintStats(db) + sims.PrintStats(db) } ctx := babylon.NewContext(true, tmproto.Header{Height: babylon.LastBlockHeight() + 1}) diff --git a/simapp/sim_test.go b/simapp/sim_test.go index e18fd3c35..e95e0ac66 100644 --- a/simapp/sim_test.go +++ b/simapp/sim_test.go @@ -7,21 +7,19 @@ import ( "os" "testing" + simappparams "github.com/babylonchain/babylon/app/params" + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - dbm "github.com/tendermint/tm-db" - "github.com/babylonchain/babylon/app" storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/testutil/sims" - btccheckpointtypes "github.com/babylonchain/babylon/x/btccheckpoint/types" - btclightclienttypes "github.com/babylonchain/babylon/x/btclightclient/types" - checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" - epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + "github.com/babylonchain/babylon/app" + + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/baseapp" - sdksimapp "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/simapp/helpers" "github.com/cosmos/cosmos-sdk/store" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -37,7 +35,11 @@ import ( "github.com/cosmos/cosmos-sdk/x/simulation" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - abci "github.com/tendermint/tendermint/abci/types" + + btccheckpointtypes "github.com/babylonchain/babylon/x/btccheckpoint/types" + btclightclienttypes "github.com/babylonchain/babylon/x/btclightclient/types" + checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" + epochingtypes "github.com/babylonchain/babylon/x/epoching/types" ) // Get flags every time the simulator is run @@ -77,7 +79,7 @@ func TestFullAppSimulation(t *testing.T) { privSigner, err := app.SetupPrivSigner() require.NoError(t, err) - babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, fauxMerkleModeOpt) + babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.GetEncodingConfig(), privSigner, sims.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts, fauxMerkleModeOpt) require.Equal(t, "BabylonApp", babylon.Name()) // run randomized simulation @@ -94,12 +96,12 @@ func TestFullAppSimulation(t *testing.T) { ) // export state and simParams before the simulation error is checked - err = sdksimapp.CheckExportSimulation(babylon, config, simParams) + err = sims.CheckExportSimulation(babylon, config, simParams) require.NoError(t, err) require.NoError(t, simErr) if config.Commit { - sdksimapp.PrintStats(db) + sims.PrintStats(db) } } @@ -117,7 +119,7 @@ func TestAppImportExport(t *testing.T) { privSigner, err := app.SetupPrivSigner() require.NoError(t, err) - babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, fauxMerkleModeOpt) + babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.GetEncodingConfig(), privSigner, sims.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts, fauxMerkleModeOpt) require.Equal(t, "BabylonApp", babylon.Name()) // Run randomized simulation @@ -134,17 +136,17 @@ func TestAppImportExport(t *testing.T) { ) // export state and simParams before the simulation error is checked - err = sdksimapp.CheckExportSimulation(babylon, config, simParams) + err = sims.CheckExportSimulation(babylon, config, simParams) require.NoError(t, err) require.NoError(t, simErr) if config.Commit { - sdksimapp.PrintStats(db) + sims.PrintStats(db) } fmt.Printf("exporting genesis...\n") - exported, err := babylon.ExportAppStateAndValidators(false, []string{}) + exported, err := babylon.ExportAppStateAndValidators(false, []string{}, []string{}) require.NoError(t, err) fmt.Printf("importing genesis...\n") @@ -157,7 +159,7 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newBabylon := app.NewBabylonApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, fauxMerkleModeOpt) + newBabylon := app.NewBabylonApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.GetEncodingConfig(), privSigner, sims.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts, fauxMerkleModeOpt) require.Equal(t, "BabylonApp", newBabylon.Name()) var genesisState app.GenesisState @@ -203,7 +205,7 @@ func TestAppImportExport(t *testing.T) { require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, len(failedKVAs), 0, sdksimapp.GetSimulationLog(skp.A.Name(), babylon.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) + require.Equal(t, len(failedKVAs), 0, sims.GetSimulationLog(skp.A.Name(), babylon.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) } } @@ -221,7 +223,7 @@ func TestAppSimulationAfterImport(t *testing.T) { privSigner, err := app.SetupPrivSigner() require.NoError(t, err) - babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, fauxMerkleModeOpt) + babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.GetEncodingConfig(), privSigner, sims.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts, fauxMerkleModeOpt) require.Equal(t, "BabylonApp", babylon.Name()) // Run randomized simulation @@ -238,12 +240,12 @@ func TestAppSimulationAfterImport(t *testing.T) { ) // export state and simParams before the simulation error is checked - err = sdksimapp.CheckExportSimulation(babylon, config, simParams) + err = sims.CheckExportSimulation(babylon, config, simParams) require.NoError(t, err) require.NoError(t, simErr) if config.Commit { - sdksimapp.PrintStats(db) + sims.PrintStats(db) } if stopEarly { @@ -253,7 +255,7 @@ func TestAppSimulationAfterImport(t *testing.T) { fmt.Printf("exporting genesis...\n") - exported, err := babylon.ExportAppStateAndValidators(true, []string{}) + exported, err := babylon.ExportAppStateAndValidators(true, []string{}, []string{}) require.NoError(t, err) fmt.Printf("importing genesis...\n") @@ -266,7 +268,7 @@ func TestAppSimulationAfterImport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newBabylon := app.NewBabylonApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, fauxMerkleModeOpt) + newBabylon := app.NewBabylonApp(log.NewNopLogger(), newDB, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.GetEncodingConfig(), privSigner, sims.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts, fauxMerkleModeOpt) require.Equal(t, "BabylonApp", newBabylon.Name()) newBabylon.InitChain(abci.RequestInitChain{ @@ -299,7 +301,7 @@ func TestAppStateDeterminism(t *testing.T) { config.ExportParamsPath = "" config.OnOperation = false config.AllInvariants = false - config.ChainID = helpers.SimAppChainID + config.ChainID = simappparams.SimAppChainID numSeeds := 3 numTimesToRunPerSeed := 5 @@ -319,7 +321,7 @@ func TestAppStateDeterminism(t *testing.T) { db := dbm.NewMemDB() privSigner, err := app.SetupPrivSigner() require.NoError(t, err) - babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.MakeTestEncodingConfig(), privSigner, sdksimapp.EmptyAppOptions{}, interBlockCacheOpt()) + babylon := app.NewBabylonApp(logger, db, nil, true, map[int64]bool{}, app.DefaultNodeHome, FlagPeriodValue, app.GetEncodingConfig(), privSigner, sims.EmptyAppOptions{}, app.GetWasmEnabledProposals(), app.EmptyWasmOpts, interBlockCacheOpt()) fmt.Printf( "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", @@ -340,7 +342,7 @@ func TestAppStateDeterminism(t *testing.T) { require.NoError(t, err) if config.Commit { - sdksimapp.PrintStats(db) + sims.PrintStats(db) } appHash := babylon.LastCommitID().Hash diff --git a/simapp/state.go b/simapp/state.go index 58f5c17ee..dec564272 100644 --- a/simapp/state.go +++ b/simapp/state.go @@ -9,15 +9,15 @@ import ( "time" sdkmath "cosmossdk.io/math" + simappparams "github.com/babylonchain/babylon/app/params" - tmjson "github.com/tendermint/tendermint/libs/json" - tmtypes "github.com/tendermint/tendermint/types" + tmjson "github.com/cometbft/cometbft/libs/json" + tmtypes "github.com/cometbft/cometbft/types" "github.com/babylonchain/babylon/app" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -43,7 +43,6 @@ func AppStateFn(cdc codec.JSONCodec, simManager *module.SimulationManager) simty switch { case config.ParamsFile != "" && config.GenesisFile != "": panic("cannot provide both a genesis file and a params file") - case config.GenesisFile != "": // override the default chain-id from simapp to set it later to the config genesisDoc, accounts := AppStateFromGenesisFileFn(r, cdc, config.GenesisFile) @@ -69,7 +68,6 @@ func AppStateFn(cdc codec.JSONCodec, simManager *module.SimulationManager) simty panic(err) } appState, simAccs = AppStateRandomizedFn(simManager, r, cdc, accs, genesisTimestamp, appParams) - default: appParams := make(simtypes.AppParams) appState, simAccs = AppStateRandomizedFn(simManager, r, cdc, accs, genesisTimestamp, appParams) diff --git a/simapp/utils.go b/simapp/utils.go index 110278212..6efac1755 100644 --- a/simapp/utils.go +++ b/simapp/utils.go @@ -4,13 +4,12 @@ import ( "encoding/json" "os" - "github.com/tendermint/tendermint/libs/log" - dbm "github.com/tendermint/tm-db" - + "github.com/babylonchain/babylon/app" + simappparams "github.com/babylonchain/babylon/app/params" + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/simapp" - "github.com/cosmos/cosmos-sdk/simapp/helpers" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/staking" @@ -30,7 +29,7 @@ func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, } config := NewConfigFromFlags() - config.ChainID = helpers.SimAppChainID + config.ChainID = simappparams.SimAppChainID var logger log.Logger if FlagVerboseValue { @@ -44,7 +43,7 @@ func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, return simtypes.Config{}, nil, "", nil, false, err } - db, err := sdk.NewLevelDB(dbName, dir) //nolint:staticcheck // Prefer the old-fashioned way. + db, err := dbm.NewDB(dbName, dbm.BackendType(config.DBBackend), dir) if err != nil { return simtypes.Config{}, nil, "", nil, false, err } @@ -57,7 +56,7 @@ func SetupSimulation(dirPrefix, dbName string) (simtypes.Config, dbm.DB, string, // NOTE: the code is same as https://github.com/cosmos/cosmos-sdk/blob/v0.45.5/simapp/utils.go#L50-L73, // except that this function modifies the default weights given in Cosmos SDK. // Specifically, Babylon does not want unwrapped message types in the staking module. -func SimulationOperations(app simapp.App, cdc codec.JSONCodec, config simtypes.Config) []simtypes.WeightedOperation { +func SimulationOperations(app app.App, cdc codec.JSONCodec, config simtypes.Config) []simtypes.WeightedOperation { simState := module.SimulationState{ AppParams: make(simtypes.AppParams), Cdc: cdc, @@ -74,10 +73,6 @@ func SimulationOperations(app simapp.App, cdc codec.JSONCodec, config simtypes.C panic(err) } } - - simState.ParamChanges = app.SimulationManager().GenerateParamChanges(config.Seed) - simState.Contents = app.SimulationManager().GetProposalContents(simState) - // get weighted operations from all modules, except for the staking module whose messages will be rejected by Babylon sm := app.SimulationManager() appWOps := make([]simtypes.WeightedOperation, 0, len(sm.Modules)) diff --git a/test/e2e/configurer/base.go b/test/e2e/configurer/base.go index 4f50c852d..5e22941fc 100644 --- a/test/e2e/configurer/base.go +++ b/test/e2e/configurer/base.go @@ -168,8 +168,8 @@ func (bc *baseConfigurer) runIBCRelayer(chainConfigA *chain.Config, chainConfigB func (bc *baseConfigurer) connectIBCChains(chainA *chain.Config, chainB *chain.Config) error { bc.t.Logf("connecting %s and %s chains via IBC", chainA.ChainMeta.Id, chainB.ChainMeta.Id) - cmd := []string{"hermes", "create", "channel", chainA.ChainMeta.Id, chainB.ChainMeta.Id, "--port-a=zoneconcierge", "--port-b=zoneconcierge"} - _, _, err := bc.containerManager.ExecHermesCmd(bc.t, cmd, "successfully opened init channel") + cmd := []string{"hermes", "create", "channel", "--a-chain", chainA.ChainMeta.Id, "--b-chain", chainB.ChainMeta.Id, "--a-port", "zoneconcierge", "--b-port", "zoneconcierge", "--new-client-connection", "--yes"} + _, _, err := bc.containerManager.ExecHermesCmd(bc.t, cmd, "SUCCESS") if err != nil { return err } diff --git a/test/e2e/configurer/chain/chain.go b/test/e2e/configurer/chain/chain.go index fd0d5d437..f08f8f575 100644 --- a/test/e2e/configurer/chain/chain.go +++ b/test/e2e/configurer/chain/chain.go @@ -5,9 +5,9 @@ import ( "testing" "time" + coretypes "github.com/cometbft/cometbft/rpc/core/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - coretypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/babylonchain/babylon/test/e2e/configurer/config" "github.com/babylonchain/babylon/test/e2e/containers" diff --git a/test/e2e/configurer/chain/commands.go b/test/e2e/configurer/chain/commands.go index c55d6f843..6b1364fcb 100644 --- a/test/e2e/configurer/chain/commands.go +++ b/test/e2e/configurer/chain/commands.go @@ -4,10 +4,15 @@ import ( "encoding/hex" "encoding/json" "fmt" + "math/rand" + "time" + + "github.com/cosmos/cosmos-sdk/types/bech32" + + sdkquerytypes "github.com/cosmos/cosmos-sdk/types/query" btccheckpointtypes "github.com/babylonchain/babylon/x/btccheckpoint/types" cttypes "github.com/babylonchain/babylon/x/checkpointing/types" - "github.com/cosmos/cosmos-sdk/types/bech32" txformat "github.com/babylonchain/babylon/btctxformatter" bbn "github.com/babylonchain/babylon/types" @@ -54,17 +59,17 @@ func (n *NodeConfig) BankSend(amount string, sendAddress string, receiveAddress func (n *NodeConfig) SendHeaderHex(headerHex string) { n.LogActionF("btclightclient sending header %s", headerHex) - cmd := []string{"./babylond", "tx", "btclightclient", "insert-header", headerHex, "--from=val", "--gas=500000"} + cmd := []string{"babylond", "tx", "btclightclient", "insert-header", headerHex, "--from=val", "--gas=500000"} _, _, err := n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd) require.NoError(n.t, err) n.LogActionF("successfully inserted header %s", headerHex) } -func (n *NodeConfig) InsertNewEmptyBtcHeader() *blc.BTCHeaderInfo { +func (n *NodeConfig) InsertNewEmptyBtcHeader(r *rand.Rand) *blc.BTCHeaderInfo { tip, err := n.QueryTip() require.NoError(n.t, err) n.t.Logf("Retrieved current tip of btc headerchain. Height: %d", tip.Height) - child := datagen.GenRandomValidBTCHeaderInfoWithParent(*tip) + child := datagen.GenRandomValidBTCHeaderInfoWithParent(r, *tip) n.SendHeaderHex(child.Header.MarshalHex()) n.WaitUntilBtcHeight(tip.Height + 1) return child @@ -89,67 +94,65 @@ func (n *NodeConfig) InsertProofs(p1 *btccheckpointtypes.BTCSpvProof, p2 *btcche p1HexBytes := hex.EncodeToString(p1bytes) p2HexBytes := hex.EncodeToString(p2bytes) - cmd := []string{"./babylond", "tx", "btccheckpoint", "insert-proofs", p1HexBytes, p2HexBytes, "--from=val"} + cmd := []string{"babylond", "tx", "btccheckpoint", "insert-proofs", p1HexBytes, p2HexBytes, "--from=val"} _, _, err = n.containerManager.ExecTxCmd(n.t, n.chainId, n.Name, cmd) require.NoError(n.t, err) n.LogActionF("successfully inserted btc spv proofs") } -func (n *NodeConfig) FinalizeSealedEpochs(startingEpoch uint64, lastEpoch uint64) { - n.LogActionF("start finalizing epoch starting from %d", startingEpoch) +func (n *NodeConfig) FinalizeSealedEpochs(startEpoch uint64, lastEpoch uint64) { + n.LogActionF("start finalizing epochs from %d to %d", startEpoch, lastEpoch) + // Random source for the generation of BTC data + r := rand.New(rand.NewSource(time.Now().Unix())) madeProgress := false - currEpoch := startingEpoch - for { - if currEpoch > lastEpoch { - break - } - checkpoint, err := n.QueryCheckpointForEpoch(currEpoch) + pageLimit := lastEpoch - startEpoch + 1 + pagination := &sdkquerytypes.PageRequest{ + Key: cttypes.CkptsObjectKey(startEpoch), + Limit: pageLimit, + } - require.NoError(n.t, err) + resp, err := n.QueryRawCheckpoints(pagination) + require.NoError(n.t, err) + require.Equal(n.t, int(pageLimit), len(resp.RawCheckpoints)) - // can only finalize sealed checkpoints - if checkpoint.Status != cttypes.Sealed { - return - } + for _, checkpoint := range resp.RawCheckpoints { + require.Equal(n.t, checkpoint.Status, cttypes.Sealed) currentBtcTip, err := n.QueryTip() - require.NoError(n.t, err) _, c, err := bech32.DecodeAndConvert(n.PublicAddress) - require.NoError(n.t, err) btcCheckpoint, err := cttypes.FromRawCkptToBTCCkpt(checkpoint.Ckpt, c) + require.NoError(n.t, err) + babylonTagBytes, err := hex.DecodeString(initialization.BabylonOpReturnTag) require.NoError(n.t, err) p1, p2, err := txformat.EncodeCheckpointData( - txformat.BabylonTag(initialization.BabylonOpReturnTag), + babylonTagBytes, txformat.CurrentVersion, btcCheckpoint, ) - require.NoError(n.t, err) - opReturn1 := datagen.CreateBlockWithTransaction(currentBtcTip.Header.ToBlockHeader(), p1) - - opReturn2 := datagen.CreateBlockWithTransaction(opReturn1.HeaderBytes.ToBlockHeader(), p2) + opReturn1 := datagen.CreateBlockWithTransaction(r, currentBtcTip.Header.ToBlockHeader(), p1) + opReturn2 := datagen.CreateBlockWithTransaction(r, opReturn1.HeaderBytes.ToBlockHeader(), p2) n.InsertHeader(&opReturn1.HeaderBytes) n.InsertHeader(&opReturn2.HeaderBytes) n.InsertProofs(opReturn1.SpvProof, opReturn2.SpvProof) n.WaitForCondition(func() bool { - ckpt, err := n.QueryCheckpointForEpoch(currEpoch) + ckpt, err := n.QueryRawCheckpoint(checkpoint.Ckpt.EpochNum) require.NoError(n.t, err) return ckpt.Status == cttypes.Submitted }, "Checkpoint should be submitted ") madeProgress = true - currEpoch++ } if madeProgress { @@ -158,7 +161,7 @@ func (n *NodeConfig) FinalizeSealedEpochs(startingEpoch uint64, lastEpoch uint64 // checkpoints for i := 0; i < initialization.BabylonBtcFinalizationPeriod; i++ { - n.InsertNewEmptyBtcHeader() + n.InsertNewEmptyBtcHeader(r) } } } diff --git a/test/e2e/configurer/chain/node.go b/test/e2e/configurer/chain/node.go index 9f133091a..ac7c27f0b 100644 --- a/test/e2e/configurer/chain/node.go +++ b/test/e2e/configurer/chain/node.go @@ -8,9 +8,9 @@ import ( "testing" "time" + rpchttp "github.com/cometbft/cometbft/rpc/client/http" + coretypes "github.com/cometbft/cometbft/rpc/core/types" "github.com/stretchr/testify/require" - rpchttp "github.com/tendermint/tendermint/rpc/client/http" - coretypes "github.com/tendermint/tendermint/rpc/core/types" "github.com/babylonchain/babylon/test/e2e/containers" "github.com/babylonchain/babylon/test/e2e/initialization" @@ -145,7 +145,7 @@ func (n *NodeConfig) extractOperatorAddressIfValidator() error { return nil } - cmd := []string{"./babylond", "debug", "addr", n.PublicKey} + cmd := []string{"babylond", "debug", "addr", n.PublicKey} n.t.Logf("extracting validator operator addresses for validator: %s", n.Name) _, errBuf, err := n.containerManager.ExecCmd(n.t, n.Name, cmd, "") if err != nil { diff --git a/test/e2e/configurer/chain/queries.go b/test/e2e/configurer/chain/queries.go index 3144ca161..c832f5135 100644 --- a/test/e2e/configurer/chain/queries.go +++ b/test/e2e/configurer/chain/queries.go @@ -2,18 +2,22 @@ package chain import ( "context" + "encoding/base64" "encoding/json" "fmt" "io" "net/http" + "net/url" + "strconv" "time" sdkmath "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/types/query" + tmabcitypes "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/stretchr/testify/require" - tmabcitypes "github.com/tendermint/tendermint/abci/types" "github.com/babylonchain/babylon/test/e2e/util" blc "github.com/babylonchain/babylon/x/btclightclient/types" @@ -23,12 +27,8 @@ import ( zctypes "github.com/babylonchain/babylon/x/zoneconcierge/types" ) -func (n *NodeConfig) QueryGRPCGateway(path string, parameters ...string) ([]byte, error) { - if len(parameters)%2 != 0 { - return nil, fmt.Errorf("invalid number of parameters, must follow the format of key + value") - } - - // add the URL for the given validator ID, and pre-pend to to path. +func (n *NodeConfig) QueryGRPCGateway(path string, queryParams url.Values) ([]byte, error) { + // add the URL for the given validator ID, and pre-pend to path. hostPort, err := n.containerManager.GetHostPort(n.Name, "1317/tcp") require.NoError(n.t, err) endpoint := fmt.Sprintf("http://%s", hostPort) @@ -41,12 +41,8 @@ func (n *NodeConfig) QueryGRPCGateway(path string, parameters ...string) ([]byte return false } - if len(parameters) > 0 { - q := req.URL.Query() - for i := 0; i < len(parameters); i += 2 { - q.Add(parameters[i], parameters[i+1]) - } - req.URL.RawQuery = q.Encode() + if len(queryParams) > 0 { + req.URL.RawQuery = queryParams.Encode() } resp, err = http.DefaultClient.Do(req) @@ -70,10 +66,10 @@ func (n *NodeConfig) QueryGRPCGateway(path string, parameters ...string) ([]byte return bz, nil } -// QueryBalancer returns balances at the address. +// QueryBalances returns balances at the address. func (n *NodeConfig) QueryBalances(address string) (sdk.Coins, error) { path := fmt.Sprintf("cosmos/bank/v1beta1/balances/%s", address) - bz, err := n.QueryGRPCGateway(path) + bz, err := n.QueryGRPCGateway(path, url.Values{}) require.NoError(n.t, err) var balancesResp banktypes.QueryAllBalancesResponse @@ -85,7 +81,7 @@ func (n *NodeConfig) QueryBalances(address string) (sdk.Coins, error) { func (n *NodeConfig) QuerySupplyOf(denom string) (sdkmath.Int, error) { path := fmt.Sprintf("cosmos/bank/v1beta1/supply/%s", denom) - bz, err := n.QueryGRPCGateway(path) + bz, err := n.QueryGRPCGateway(path, url.Values{}) require.NoError(n.t, err) var supplyResp banktypes.QuerySupplyOfResponse @@ -149,9 +145,9 @@ func (n *NodeConfig) QueryListSnapshots() ([]*tmabcitypes.Snapshot, error) { // return contractsResponse.Contracts, nil // } -func (n *NodeConfig) QueryCheckpointForEpoch(epoch uint64) (*ct.RawCheckpointWithMeta, error) { +func (n *NodeConfig) QueryRawCheckpoint(epoch uint64) (*ct.RawCheckpointWithMeta, error) { path := fmt.Sprintf("babylon/checkpointing/v1/raw_checkpoint/%d", epoch) - bz, err := n.QueryGRPCGateway(path) + bz, err := n.QueryGRPCGateway(path, url.Values{}) require.NoError(n.t, err) var checkpointingResponse ct.QueryRawCheckpointResponse @@ -162,8 +158,26 @@ func (n *NodeConfig) QueryCheckpointForEpoch(epoch uint64) (*ct.RawCheckpointWit return checkpointingResponse.RawCheckpoint, nil } +func (n *NodeConfig) QueryRawCheckpoints(pagination *query.PageRequest) (*ct.QueryRawCheckpointsResponse, error) { + queryParams := url.Values{} + if pagination != nil { + queryParams.Set("pagination.key", base64.URLEncoding.EncodeToString(pagination.Key)) + queryParams.Set("pagination.limit", strconv.Itoa(int(pagination.Limit))) + } + + bz, err := n.QueryGRPCGateway("babylon/checkpointing/v1/raw_checkpoints", queryParams) + require.NoError(n.t, err) + + var checkpointingResponse ct.QueryRawCheckpointsResponse + if err := util.Cdc.UnmarshalJSON(bz, &checkpointingResponse); err != nil { + return nil, err + } + + return &checkpointingResponse, nil +} + func (n *NodeConfig) QueryBtcBaseHeader() (*blc.BTCHeaderInfo, error) { - bz, err := n.QueryGRPCGateway("babylon/btclightclient/v1/baseheader") + bz, err := n.QueryGRPCGateway("babylon/btclightclient/v1/baseheader", url.Values{}) require.NoError(n.t, err) var blcResponse blc.QueryBaseHeaderResponse @@ -175,7 +189,7 @@ func (n *NodeConfig) QueryBtcBaseHeader() (*blc.BTCHeaderInfo, error) { } func (n *NodeConfig) QueryTip() (*blc.BTCHeaderInfo, error) { - bz, err := n.QueryGRPCGateway("babylon/btclightclient/v1/tip") + bz, err := n.QueryGRPCGateway("babylon/btclightclient/v1/tip", url.Values{}) require.NoError(n.t, err) var blcResponse blc.QueryTipResponse @@ -186,21 +200,43 @@ func (n *NodeConfig) QueryTip() (*blc.BTCHeaderInfo, error) { return blcResponse.Header, nil } -func (n *NodeConfig) QueryFinalizedChainInfo(chainId string) (*zctypes.QueryFinalizedChainInfoResponse, error) { - finalizedPath := fmt.Sprintf("babylon/zoneconcierge/v1/finalized_chain_info/%s", chainId) - bz, err := n.QueryGRPCGateway(finalizedPath) +func (n *NodeConfig) QueryFinalizedChainsInfo(chainIDs []string) ([]*zctypes.FinalizedChainInfo, error) { + queryParams := url.Values{} + for _, chainId := range chainIDs { + queryParams.Add("chain_ids", chainId) + } + + bz, err := n.QueryGRPCGateway("babylon/zoneconcierge/v1/finalized_chains_info", queryParams) + require.NoError(n.t, err) + + var resp zctypes.QueryFinalizedChainsInfoResponse + if err := util.Cdc.UnmarshalJSON(bz, &resp); err != nil { + return nil, err + } + + return resp.FinalizedChainsInfo, nil +} + +func (n *NodeConfig) QueryEpochChainsInfo(epochNum uint64, chainIDs []string) ([]*zctypes.ChainInfo, error) { + queryParams := url.Values{} + for _, chainId := range chainIDs { + queryParams.Add("epoch_num", fmt.Sprintf("%d", epochNum)) + queryParams.Add("chain_ids", chainId) + } + + bz, err := n.QueryGRPCGateway("babylon/zoneconcierge/v1/epoch_chains_info", queryParams) require.NoError(n.t, err) - var finalizedResponse zctypes.QueryFinalizedChainInfoResponse - if err := util.Cdc.UnmarshalJSON(bz, &finalizedResponse); err != nil { + var resp zctypes.QueryEpochChainsInfoResponse + if err := util.Cdc.UnmarshalJSON(bz, &resp); err != nil { return nil, err } - return &finalizedResponse, nil + return resp.ChainsInfo, nil } -func (n *NodeConfig) QueryCheckpointChains() (*[]string, error) { - bz, err := n.QueryGRPCGateway("babylon/zoneconcierge/v1/chains") +func (n *NodeConfig) QueryChains() (*[]string, error) { + bz, err := n.QueryGRPCGateway("babylon/zoneconcierge/v1/chains", url.Values{}) require.NoError(n.t, err) var chainsResponse zctypes.QueryChainListResponse if err := util.Cdc.UnmarshalJSON(bz, &chainsResponse); err != nil { @@ -209,19 +245,23 @@ func (n *NodeConfig) QueryCheckpointChains() (*[]string, error) { return &chainsResponse.ChainIds, nil } -func (n *NodeConfig) QueryCheckpointChainInfo(chainId string) (*zctypes.ChainInfo, error) { - infoPath := fmt.Sprintf("/babylon/zoneconcierge/v1/chain_info/%s", chainId) - bz, err := n.QueryGRPCGateway(infoPath) +func (n *NodeConfig) QueryChainsInfo(chainIDs []string) ([]*zctypes.ChainInfo, error) { + queryParams := url.Values{} + for _, chainId := range chainIDs { + queryParams.Add("chain_ids", chainId) + } + + bz, err := n.QueryGRPCGateway("/babylon/zoneconcierge/v1/chains_info", queryParams) require.NoError(n.t, err) - var infoResponse zctypes.QueryChainInfoResponse - if err := util.Cdc.UnmarshalJSON(bz, &infoResponse); err != nil { + var resp zctypes.QueryChainsInfoResponse + if err := util.Cdc.UnmarshalJSON(bz, &resp); err != nil { return nil, err } - return infoResponse.ChainInfo, nil + return resp.ChainsInfo, nil } func (n *NodeConfig) QueryCurrentEpoch() (uint64, error) { - bz, err := n.QueryGRPCGateway("/babylon/epoching/v1/current_epoch") + bz, err := n.QueryGRPCGateway("/babylon/epoching/v1/current_epoch", url.Values{}) require.NoError(n.t, err) var epochResponse etypes.QueryCurrentEpochResponse if err := util.Cdc.UnmarshalJSON(bz, &epochResponse); err != nil { @@ -232,7 +272,7 @@ func (n *NodeConfig) QueryCurrentEpoch() (uint64, error) { func (n *NodeConfig) QueryLightClientHeightEpochEnd(epoch uint64) (uint64, error) { monitorPath := fmt.Sprintf("/babylon/monitor/v1/epochs/%d", epoch) - bz, err := n.QueryGRPCGateway(monitorPath) + bz, err := n.QueryGRPCGateway(monitorPath, url.Values{}) require.NoError(n.t, err) var mResponse mtypes.QueryEndedEpochBtcHeightResponse if err := util.Cdc.UnmarshalJSON(bz, &mResponse); err != nil { @@ -243,7 +283,7 @@ func (n *NodeConfig) QueryLightClientHeightEpochEnd(epoch uint64) (uint64, error func (n *NodeConfig) QueryLightClientHeightCheckpointReported(ckptHash []byte) (uint64, error) { monitorPath := fmt.Sprintf("/babylon/monitor/v1/checkpoints/%x", ckptHash) - bz, err := n.QueryGRPCGateway(monitorPath) + bz, err := n.QueryGRPCGateway(monitorPath, url.Values{}) require.NoError(n.t, err) var mResponse mtypes.QueryReportedCheckpointBtcHeightResponse if err := util.Cdc.UnmarshalJSON(bz, &mResponse); err != nil { diff --git a/test/e2e/configurer/setup.go b/test/e2e/configurer/setup.go index 4eea29e7d..50a6d2c15 100644 --- a/test/e2e/configurer/setup.go +++ b/test/e2e/configurer/setup.go @@ -1,5 +1,7 @@ package configurer +import "time" + type setupFn func(configurer Configurer) error func baseSetup(configurer Configurer) error { @@ -14,7 +16,7 @@ func withIBC(setupHandler setupFn) setupFn { if err := setupHandler(configurer); err != nil { return err } - + time.Sleep(5 * time.Second) if err := configurer.RunIBC(); err != nil { return err } diff --git a/test/e2e/containers/config.go b/test/e2e/containers/config.go index 1340d70fb..90b8416cc 100644 --- a/test/e2e/containers/config.go +++ b/test/e2e/containers/config.go @@ -12,10 +12,8 @@ const ( // name of babylon container produced by running `make localnet-build-env` BabylonContainerName = "babylonchain/babylond" - // TODO currently using image hosted by osmolab we should probably use our own - // Hermes repo/version for relayer - relayerRepository = "osmolabs/hermes" - relayerTag = "0.13.0" + relayerRepository = "informalsystems/hermes" + relayerTag = "1.4.0" ) // Returns ImageConfig needed for running e2e test. diff --git a/test/e2e/containers/containers.go b/test/e2e/containers/containers.go index e97fba0db..7806d6bda 100644 --- a/test/e2e/containers/containers.go +++ b/test/e2e/containers/containers.go @@ -61,7 +61,7 @@ func (m *Manager) ExecTxCmd(t *testing.T, chainId string, containerName string, // namely adding flags `--chain-id={chain-id} -b=block --yes --keyring-backend=test "--log_format=json"`, // and searching for `successStr` func (m *Manager) ExecTxCmdWithSuccessString(t *testing.T, chainId string, containerName string, command []string, successStr string) (bytes.Buffer, bytes.Buffer, error) { - allTxArgs := []string{fmt.Sprintf("--chain-id=%s", chainId), "-b=block", "--yes", "--keyring-backend=test", "--log_format=json", "--home=/babylondata"} + allTxArgs := []string{fmt.Sprintf("--chain-id=%s", chainId), "-b=sync", "--yes", "--keyring-backend=test", "--log_format=json", "--home=/home/babylon/babylondata"} txCommand := append(command, allTxArgs...) return m.ExecCmd(t, containerName, txCommand, successStr) } @@ -174,6 +174,7 @@ func (m *Manager) RunHermesResource(chainAID, osmoARelayerNodeName, osmoAValMnem PortBindings: map[docker.Port][]docker.PortBinding{ "3031/tcp": {{HostIP: "", HostPort: "3031"}}, }, + Platform: "linux/x86_64", Env: []string{ fmt.Sprintf("BBN_A_E2E_CHAIN_ID=%s", chainAID), fmt.Sprintf("BBN_B_E2E_CHAIN_ID=%s", chainBID), @@ -205,12 +206,15 @@ func (m *Manager) RunNodeResource(chainId string, containerName, valCondifDir st Repository: BabylonContainerName, NetworkID: m.network.Network.ID, User: "root:root", - Cmd: []string{"start"}, - Env: []string{ - "HOME=/babylondata", + Entrypoint: []string{ + "sh", + "-c", + "babylond start --home /home/babylon/babylondata", }, + ExposedPorts: []string{"26656", "26657", "1317", "9090"}, + Platform: "linux/x86_64", Mounts: []string{ - fmt.Sprintf("%s/:/babylondata", valCondifDir), + fmt.Sprintf("%s/:/home/babylon/babylondata", valCondifDir), }, } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 182430580..b5e69cf9a 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -23,28 +23,41 @@ func (s *IntegrationTestSuite) TestConnectIbc() { func (s *IntegrationTestSuite) TestIbcCheckpointing() { chainA := s.configurer.GetChainConfig(0) - - chainA.WaitUntilHeight(25) + chainA.WaitUntilHeight(35) nonValidatorNode, err := chainA.GetNodeAtIndex(2) s.NoError(err) - // Finalize epoch 1 and 2, as first headers of opposing chain are in epoch 2 - nonValidatorNode.FinalizeSealedEpochs(1, 2) + // Query checkpoint chain info for opposing chain + chainsInfo, err := nonValidatorNode.QueryChainsInfo([]string{initialization.ChainBID}) + s.NoError(err) + s.Equal(chainsInfo[0].ChainId, initialization.ChainBID) + + // Finalize epoch 1,2,3 , as first headers of opposing chain are in epoch 3 + var ( + startEpochNum uint64 = 1 + endEpochNum uint64 = 3 + ) + + nonValidatorNode.FinalizeSealedEpochs(startEpochNum, endEpochNum) - epoch2, err := nonValidatorNode.QueryCheckpointForEpoch(2) + endEpoch, err := nonValidatorNode.QueryRawCheckpoint(endEpochNum) s.NoError(err) + s.Equal(endEpoch.Status, ct.Finalized) - if epoch2.Status != ct.Finalized { - s.FailNow("Epoch 2 should be finalized") - } + // Check we have epoch info for opposing chain and some basic assertions + epochChainsInfo, err := nonValidatorNode.QueryEpochChainsInfo(endEpochNum, []string{initialization.ChainBID}) + s.NoError(err) + s.Equal(epochChainsInfo[0].ChainId, initialization.ChainBID) + s.Equal(epochChainsInfo[0].LatestHeader.BabylonEpoch, endEpochNum) // Check we have finalized epoch info for opposing chain and some basic assertions - fininfo, err := nonValidatorNode.QueryFinalizedChainInfo(initialization.ChainBID) + finalizedChainsInfo, err := nonValidatorNode.QueryFinalizedChainsInfo([]string{initialization.ChainBID}) s.NoError(err) + // TODO Add more assertion here. Maybe check proofs ? - s.Equal(fininfo.FinalizedChainInfo.ChainId, initialization.ChainBID) - s.Equal(fininfo.EpochInfo.EpochNumber, uint64(2)) + s.Equal(finalizedChainsInfo[0].FinalizedChainInfo.ChainId, initialization.ChainBID) + s.Equal(finalizedChainsInfo[0].EpochInfo.EpochNumber, endEpochNum) currEpoch, err := nonValidatorNode.QueryCurrentEpoch() s.NoError(err) diff --git a/test/e2e/initialization/config.go b/test/e2e/initialization/config.go index 77b69f11d..3903f49f3 100644 --- a/test/e2e/initialization/config.go +++ b/test/e2e/initialization/config.go @@ -11,6 +11,7 @@ import ( btccheckpointtypes "github.com/babylonchain/babylon/x/btccheckpoint/types" blctypes "github.com/babylonchain/babylon/x/btclightclient/types" checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" + tmjson "github.com/cometbft/cometbft/libs/json" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" ed25519 "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/server" @@ -21,8 +22,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" staketypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/gogo/protobuf/proto" - tmjson "github.com/tendermint/tendermint/libs/json" + "github.com/cosmos/gogoproto/proto" "github.com/babylonchain/babylon/test/e2e/util" ) @@ -43,10 +43,11 @@ type NodeConfig struct { const ( // common - BabylonDenom = "ubbn" - MinGasPrice = "0.000" - ValidatorWalletName = "val" - BabylonOpReturnTag = "bbni" + BabylonDenom = "ubbn" + MinGasPrice = "0.000" + ValidatorWalletName = "val" + BabylonOpReturnTag = "01020304" + BabylonBtcConfirmationPeriod = 2 BabylonBtcFinalizationPeriod = 4 // chainA @@ -295,7 +296,6 @@ func updateCrisisGenesis(crisisGenState *crisistypes.GenesisState) { } func updateBtcLightClientGenesis(blcGenState *blctypes.GenesisState) { - blcGenState.Params = blctypes.DefaultParams() btcSimnetGenesisHex := "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a45068653ffff7f2002000000" baseBtcHeader, err := bbn.NewBTCHeaderBytesFromHex(btcSimnetGenesisHex) if err != nil { @@ -309,6 +309,7 @@ func updateBtccheckpointGenesis(btccheckpointGenState *btccheckpointtypes.Genesi btccheckpointGenState.Params = btccheckpointtypes.DefaultParams() btccheckpointGenState.Params.BtcConfirmationDepth = BabylonBtcConfirmationPeriod btccheckpointGenState.Params.CheckpointFinalizationTimeout = BabylonBtcFinalizationPeriod + btccheckpointGenState.Params.CheckpointTag = BabylonOpReturnTag } func updateGenUtilGenesis(c *internalChain) func(*genutiltypes.GenesisState) { diff --git a/test/e2e/initialization/node.go b/test/e2e/initialization/node.go index 2d990ed9c..f3ede8b3b 100644 --- a/test/e2e/initialization/node.go +++ b/test/e2e/initialization/node.go @@ -11,6 +11,11 @@ import ( "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/privval" bbn "github.com/babylonchain/babylon/types" + tmconfig "github.com/cometbft/cometbft/config" + tmed25519 "github.com/cometbft/cometbft/crypto/ed25519" + tmos "github.com/cometbft/cometbft/libs/os" + "github.com/cometbft/cometbft/p2p" + tmtypes "github.com/cometbft/cometbft/types" sdkcrypto "github.com/cosmos/cosmos-sdk/crypto" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/hd" @@ -26,11 +31,6 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/cosmos/go-bip39" "github.com/spf13/viper" - tmconfig "github.com/tendermint/tendermint/config" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - tmos "github.com/tendermint/tendermint/libs/os" - "github.com/tendermint/tendermint/p2p" - tmtypes "github.com/tendermint/tendermint/types" "github.com/babylonchain/babylon/test/e2e/util" @@ -125,12 +125,14 @@ func (n *internalNode) createAppConfig(nodeConfig *NodeConfig) { appConfig.BaseConfig.PruningKeepRecent = nodeConfig.PruningKeepRecent appConfig.BaseConfig.PruningInterval = nodeConfig.PruningInterval appConfig.API.Enable = true + appConfig.API.Address = "tcp://0.0.0.0:1317" appConfig.MinGasPrices = fmt.Sprintf("%s%s", MinGasPrice, BabylonDenom) appConfig.StateSync.SnapshotInterval = nodeConfig.SnapshotInterval appConfig.StateSync.SnapshotKeepRecent = nodeConfig.SnapshotKeepRecent appConfig.SignerConfig.KeyName = ValidatorWalletName appConfig.BtcConfig.Network = string(bbn.BtcSimnet) - appConfig.BtcConfig.CheckpointTag = BabylonOpReturnTag + appConfig.GRPC.Enable = true + appConfig.GRPC.Address = "0.0.0.0:9090" customTemplate := cmd.DefaultBabylonTemplate() @@ -305,6 +307,8 @@ func (n *internalNode) init() error { genDoc.ChainID = n.chain.chainMeta.Id genDoc.Validators = nil genDoc.AppState = appState + genDoc.ConsensusParams = tmtypes.DefaultConsensusParams() + genDoc.ConsensusParams.Block.MaxGas = babylonApp.DefaultGasLimit if err = genutil.ExportGenesisFile(genDoc, config.GenesisFile()); err != nil { return fmt.Errorf("failed to export app genesis state: %w", err) diff --git a/test/e2e/scripts/hermes_bootstrap.sh b/test/e2e/scripts/hermes_bootstrap.sh index bed26faf5..cfb3702bd 100644 --- a/test/e2e/scripts/hermes_bootstrap.sh +++ b/test/e2e/scripts/hermes_bootstrap.sh @@ -6,10 +6,12 @@ set -ex mkdir -p /root/.hermes/ touch /root/.hermes/config.toml +echo $BBN_A_E2E_VAL_MNEMONIC > /root/.hermes/BBN_A_MNEMONIC.txt +echo $BBN_B_E2E_VAL_MNEMONIC > /root/.hermes/BBN_B_MNEMONIC.txt # setup Hermes relayer configuration tee /root/.hermes/config.toml <= max { panic("min and max maust be positve numbers. min must be smaller than max") } - return rand.Intn(max-min) + min + return r.Intn(max-min) + min } -func GenerateMessageWithRandomSubmitterForEpoch(epoch uint64) *btcctypes.MsgInsertBTCSpvProof { +func GenerateMessageWithRandomSubmitterForEpoch(r *rand.Rand, epoch uint64) *btcctypes.MsgInsertBTCSpvProof { numTransactions := 100 - tx1 := numInRange(1, 99) + tx1 := numInRange(r, 1, 99) - tx2 := numInRange(1, 99) + tx2 := numInRange(r, 1, 99) // in those tests epoch is not important - raw, _ := RandomRawCheckpointDataForEpoch(epoch) + raw, _ := RandomRawCheckpointDataForEpoch(r, epoch) - blck1 := CreateBlock(0, uint32(numTransactions), uint32(tx1), raw.FirstPart) + blck1 := CreateBlock(r, 0, uint32(numTransactions), uint32(tx1), raw.FirstPart) - blck2 := CreateBlock(0, uint32(numTransactions), uint32(tx2), raw.SecondPart) + blck2 := CreateBlock(r, 0, uint32(numTransactions), uint32(tx2), raw.SecondPart) msg := GenerateMessageWithRandomSubmitter([]*BlockCreationResult{blck1, blck2}) diff --git a/testutil/datagen/datagen.go b/testutil/datagen/datagen.go index 1c4ac4718..d38fdf18d 100644 --- a/testutil/datagen/datagen.go +++ b/testutil/datagen/datagen.go @@ -5,32 +5,32 @@ import ( "math/rand" ) -func GenRandomByteArray(length uint64) []byte { +func GenRandomByteArray(r *rand.Rand, length uint64) []byte { newHeaderBytes := make([]byte, length) - rand.Read(newHeaderBytes) + r.Read(newHeaderBytes) return newHeaderBytes } -func GenRandomHexStr(length uint64) string { - randBytes := GenRandomByteArray(length) +func GenRandomHexStr(r *rand.Rand, length uint64) string { + randBytes := GenRandomByteArray(r, length) return hex.EncodeToString(randBytes) } -func OneInN(n int) bool { - return RandomInt(n) == 0 +func OneInN(r *rand.Rand, n int) bool { + return RandomInt(r, n) == 0 } -func RandomInt(rng int) uint64 { - return uint64(rand.Intn(rng)) +func RandomInt(r *rand.Rand, rng int) uint64 { + return uint64(r.Intn(rng)) } -func RandomIntOtherThan(x int, rng int) uint64 { +func RandomIntOtherThan(r *rand.Rand, x int, rng int) uint64 { if rng == 1 && x == 0 { panic("There is no other int") } - res := RandomInt(rng) + res := RandomInt(r, rng) for res == uint64(x) { - res = RandomInt(rng) + res = RandomInt(r, rng) } return res } diff --git a/testutil/datagen/epoching.go b/testutil/datagen/epoching.go index 78f71662c..4b44d4c69 100644 --- a/testutil/datagen/epoching.go +++ b/testutil/datagen/epoching.go @@ -6,9 +6,9 @@ import ( epochingtypes "github.com/babylonchain/babylon/x/epoching/types" ) -// firstBlockHeight returns the height of the first block of a given epoch and epoch interval +// getFirstBlockHeight returns the height of the first block of a given epoch and epoch interval // NOTE: this is only a function for testing and assumes static epoch interval -func firstBlockHeight(epochNumber uint64, epochInterval uint64) uint64 { +func getFirstBlockHeight(epochNumber uint64, epochInterval uint64) uint64 { if epochNumber == 0 { return 0 } else { @@ -16,27 +16,27 @@ func firstBlockHeight(epochNumber uint64, epochInterval uint64) uint64 { } } -func GenRandomEpochNum() uint64 { - epochNum := rand.Int63n(100) +func GenRandomEpochNum(r *rand.Rand) uint64 { + epochNum := r.Int63n(100) return uint64(epochNum) } -func GenRandomEpochInterval() uint64 { - epochInterval := rand.Int63n(10) + 2 // interval should be at least 2 +func GenRandomEpochInterval(r *rand.Rand) uint64 { + epochInterval := r.Int63n(10) + 2 // interval should be at least 2 return uint64(epochInterval) } -func GenRandomEpoch() *epochingtypes.Epoch { - epochNum := GenRandomEpochNum() - epochInterval := GenRandomEpochInterval() - firstBlockHeight := firstBlockHeight(epochNum, epochInterval) - lastBlockHeader := GenRandomTMHeader("test-chain", firstBlockHeight+epochInterval-1) +func GenRandomEpoch(r *rand.Rand) *epochingtypes.Epoch { + epochNum := GenRandomEpochNum(r) + epochInterval := GenRandomEpochInterval(r) + firstBlockHeight := getFirstBlockHeight(epochNum, epochInterval) + lastBlockHeader := GenRandomTMHeader(r, "test-chain", firstBlockHeight+epochInterval-1) epoch := epochingtypes.NewEpoch( epochNum, epochInterval, firstBlockHeight, lastBlockHeader, ) - epoch.SealerHeader = GenRandomTMHeader("test-chain", firstBlockHeight+epochInterval+1) // 2nd block in the next epoch + epoch.SealerHeader = GenRandomTMHeader(r, "test-chain", firstBlockHeight+epochInterval+1) // 2nd block in the next epoch return &epoch } diff --git a/testutil/datagen/fuzz.go b/testutil/datagen/fuzz.go index 4eb59418d..8653db974 100644 --- a/testutil/datagen/fuzz.go +++ b/testutil/datagen/fuzz.go @@ -8,9 +8,9 @@ import ( func AddRandomSeedsToFuzzer(f *testing.F, num uint) { // Seed based on the current time - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) var idx uint for idx = 0; idx < num; idx++ { - f.Add(rand.Int63()) + f.Add(r.Int63()) } } diff --git a/testutil/datagen/genesiskey.go b/testutil/datagen/genesiskey.go index 4855ec701..89e2ee6ff 100644 --- a/testutil/datagen/genesiskey.go +++ b/testutil/datagen/genesiskey.go @@ -4,10 +4,10 @@ import ( "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/privval" "github.com/babylonchain/babylon/x/checkpointing/types" + ed255192 "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" - ed255192 "github.com/tendermint/tendermint/crypto/ed25519" ) func GenerateGenesisKey() *types.GenesisKey { diff --git a/testutil/datagen/init_val.go b/testutil/datagen/init_val.go index 8d59ad425..6b06d2e6e 100644 --- a/testutil/datagen/init_val.go +++ b/testutil/datagen/init_val.go @@ -4,12 +4,12 @@ import ( "fmt" "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/privval" + cfg "github.com/cometbft/cometbft/config" + tmed25519 "github.com/cometbft/cometbft/crypto/ed25519" + tmos "github.com/cometbft/cometbft/libs/os" + "github.com/cometbft/cometbft/p2p" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/go-bip39" - cfg "github.com/tendermint/tendermint/config" - tmed25519 "github.com/tendermint/tendermint/crypto/ed25519" - tmos "github.com/tendermint/tendermint/libs/os" - "github.com/tendermint/tendermint/p2p" "path/filepath" ) diff --git a/testutil/datagen/priv_validator.go b/testutil/datagen/priv_validator.go index d94055b39..42af77a70 100644 --- a/testutil/datagen/priv_validator.go +++ b/testutil/datagen/priv_validator.go @@ -1,9 +1,9 @@ package datagen import ( - "github.com/tendermint/tendermint/crypto" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" + "github.com/cometbft/cometbft/crypto" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" diff --git a/testutil/datagen/raw_checkpoint.go b/testutil/datagen/raw_checkpoint.go index a798171c5..37cb771bf 100644 --- a/testutil/datagen/raw_checkpoint.go +++ b/testutil/datagen/raw_checkpoint.go @@ -3,19 +3,18 @@ package datagen import ( "math/rand" - sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/boljen/go-bitmap" "github.com/babylonchain/babylon/btctxformatter" txformat "github.com/babylonchain/babylon/btctxformatter" "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/x/checkpointing/types" - "github.com/boljen/go-bitmap" ) // GenRandomBitmap generates a random bitmap for the validator set // It returns a random bitmap and the number of validators in the subset -func GenRandomBitmap() (bitmap.Bitmap, int) { - bmBytes := GenRandomByteArray(txformat.BitMapLength) +func GenRandomBitmap(r *rand.Rand) (bitmap.Bitmap, int) { + bmBytes := GenRandomByteArray(r, txformat.BitMapLength) bm := bitmap.Bitmap(bmBytes) numSubset := 0 for i := 0; i < bm.Len(); i++ { @@ -26,31 +25,31 @@ func GenRandomBitmap() (bitmap.Bitmap, int) { return bm, numSubset } -func GetRandomRawBtcCheckpoint() *btctxformatter.RawBtcCheckpoint { - rawCkpt := GenRandomRawCheckpoint() +func GetRandomRawBtcCheckpoint(r *rand.Rand) *btctxformatter.RawBtcCheckpoint { + rawCkpt := GenRandomRawCheckpoint(r) return &btctxformatter.RawBtcCheckpoint{ Epoch: rawCkpt.EpochNum, LastCommitHash: *rawCkpt.LastCommitHash, BitMap: rawCkpt.Bitmap, - SubmitterAddress: GenRandomByteArray(btctxformatter.AddressLength), + SubmitterAddress: GenRandomByteArray(r, btctxformatter.AddressLength), BlsSig: rawCkpt.BlsMultiSig.Bytes(), } } -func GenRandomRawCheckpointWithMeta() *types.RawCheckpointWithMeta { +func GenRandomRawCheckpointWithMeta(r *rand.Rand) *types.RawCheckpointWithMeta { ckptWithMeta := &types.RawCheckpointWithMeta{ - Ckpt: GenRandomRawCheckpoint(), - Status: GenRandomStatus(), + Ckpt: GenRandomRawCheckpoint(r), + Status: GenRandomStatus(r), PowerSum: 0, } return ckptWithMeta } -func GenRandomRawCheckpoint() *types.RawCheckpoint { - randomHashBytes := GenRandomLastCommitHash() - randomBLSSig := GenRandomBlsMultiSig() +func GenRandomRawCheckpoint(r *rand.Rand) *types.RawCheckpoint { + randomHashBytes := GenRandomLastCommitHash(r) + randomBLSSig := GenRandomBlsMultiSig(r) return &types.RawCheckpoint{ - EpochNum: GenRandomEpochNum(), + EpochNum: GenRandomEpochNum(r), LastCommitHash: &randomHashBytes, Bitmap: bitmap.New(types.BitmapBits), BlsMultiSig: &randomBLSSig, @@ -58,20 +57,23 @@ func GenRandomRawCheckpoint() *types.RawCheckpoint { } // GenRandomSequenceRawCheckpointsWithMeta generates random checkpoints from epoch 0 to a random epoch -func GenRandomSequenceRawCheckpointsWithMeta() []*types.RawCheckpointWithMeta { +func GenRandomSequenceRawCheckpointsWithMeta(r *rand.Rand) []*types.RawCheckpointWithMeta { var topEpoch, finalEpoch uint64 - epoch1 := GenRandomEpochNum() - epoch2 := GenRandomEpochNum() + epoch1 := GenRandomEpochNum(r) + epoch2 := GenRandomEpochNum(r) if epoch1 > epoch2 { topEpoch = epoch1 finalEpoch = epoch2 - } else { + } else if epoch1 < epoch2 { topEpoch = epoch2 finalEpoch = epoch1 + } else { // In the case they are equal, make the topEpoch one more + topEpoch = epoch1 + 1 + finalEpoch = epoch2 } var checkpoints []*types.RawCheckpointWithMeta for e := uint64(0); e <= topEpoch; e++ { - ckpt := GenRandomRawCheckpointWithMeta() + ckpt := GenRandomRawCheckpointWithMeta(r) ckpt.Ckpt.EpochNum = e if e <= finalEpoch { ckpt.Status = types.Finalized @@ -82,10 +84,10 @@ func GenRandomSequenceRawCheckpointsWithMeta() []*types.RawCheckpointWithMeta { return checkpoints } -func GenSequenceRawCheckpointsWithMeta(tipEpoch uint64) []*types.RawCheckpointWithMeta { +func GenSequenceRawCheckpointsWithMeta(r *rand.Rand, tipEpoch uint64) []*types.RawCheckpointWithMeta { ckpts := make([]*types.RawCheckpointWithMeta, int(tipEpoch)+1) for e := uint64(0); e <= tipEpoch; e++ { - ckpt := GenRandomRawCheckpointWithMeta() + ckpt := GenRandomRawCheckpointWithMeta(r) ckpt.Ckpt.EpochNum = e ckpts[int(e)] = ckpt } @@ -102,14 +104,14 @@ func GenerateBLSSigs(keys []bls12381.PrivateKey, msg []byte) []bls12381.Signatur return sigs } -func GenerateLegitimateRawCheckpoint(privKeys []bls12381.PrivateKey) *types.RawCheckpoint { +func GenerateLegitimateRawCheckpoint(r *rand.Rand, privKeys []bls12381.PrivateKey) *types.RawCheckpoint { // number of validators, at least 4 n := len(privKeys) // ensure sufficient signers signerNum := n/3 + 1 - epochNum := GenRandomEpochNum() - lch := GenRandomLastCommitHash() - msgBytes := append(sdk.Uint64ToBigEndian(epochNum), lch.MustMarshal()...) + epochNum := GenRandomEpochNum(r) + lch := GenRandomLastCommitHash(r) + msgBytes := types.GetSignBytes(epochNum, lch) sigs := GenerateBLSSigs(privKeys[:signerNum], msgBytes) multiSig, _ := bls12381.AggrSigList(sigs) bm := bitmap.New(types.BitmapBits) @@ -126,15 +128,15 @@ func GenerateLegitimateRawCheckpoint(privKeys []bls12381.PrivateKey) *types.RawC return btcCheckpoint } -func GenRandomLastCommitHash() types.LastCommitHash { - return GenRandomByteArray(types.HashSize) +func GenRandomLastCommitHash(r *rand.Rand) types.LastCommitHash { + return GenRandomByteArray(r, types.HashSize) } -func GenRandomBlsMultiSig() bls12381.Signature { - return GenRandomByteArray(bls12381.SignatureSize) +func GenRandomBlsMultiSig(r *rand.Rand) bls12381.Signature { + return GenRandomByteArray(r, bls12381.SignatureSize) } // GenRandomStatus generates random status except for Finalized -func GenRandomStatus() types.CheckpointStatus { - return types.CheckpointStatus(rand.Int31n(int32(len(types.CheckpointStatus_name) - 1))) +func GenRandomStatus(r *rand.Rand) types.CheckpointStatus { + return types.CheckpointStatus(r.Int31n(int32(len(types.CheckpointStatus_name) - 1))) } diff --git a/testutil/datagen/tendermint.go b/testutil/datagen/tendermint.go index 0a1193d31..928bb3f4f 100644 --- a/testutil/datagen/tendermint.go +++ b/testutil/datagen/tendermint.go @@ -1,29 +1,39 @@ package datagen import ( + "math/rand" "time" - ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + extendedkeeper "github.com/babylonchain/babylon/x/zoneconcierge/extended-client-keeper" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" ) -func GenRandomTMHeader(chainID string, height uint64) *tmproto.Header { +func GenRandomTMHeader(r *rand.Rand, chainID string, height uint64) *tmproto.Header { return &tmproto.Header{ ChainID: chainID, Height: int64(height), Time: time.Now(), - LastCommitHash: GenRandomByteArray(32), + LastCommitHash: GenRandomByteArray(r, 32), } } -func GenRandomIBCTMHeader(chainID string, height uint64) *ibctmtypes.Header { +func GenRandomIBCTMHeader(r *rand.Rand, chainID string, height uint64) *ibctmtypes.Header { return &ibctmtypes.Header{ SignedHeader: &tmproto.SignedHeader{ Header: &tmproto.Header{ ChainID: chainID, Height: int64(height), - LastCommitHash: GenRandomByteArray(32), + LastCommitHash: GenRandomByteArray(r, 32), }, }, } } + +func HeaderToHeaderInfo(header *ibctmtypes.Header) *extendedkeeper.HeaderInfo { + return &extendedkeeper.HeaderInfo{ + Hash: header.Header.LastCommitHash, + ChaindId: header.Header.ChainID, + Height: uint64(header.Header.Height), + } +} diff --git a/testutil/datagen/val_set.go b/testutil/datagen/val_set.go index e468332b7..8c55f9bec 100644 --- a/testutil/datagen/val_set.go +++ b/testutil/datagen/val_set.go @@ -1,19 +1,20 @@ package datagen import ( - "github.com/babylonchain/babylon/crypto/bls12381" - checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" - epochingtypes "github.com/babylonchain/babylon/x/epoching/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/babylonchain/babylon/crypto/bls12381" + checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" + epochingtypes "github.com/babylonchain/babylon/x/epoching/types" ) func GenRandomValSet(n int) epochingtypes.ValidatorSet { power := int64(10) var valSet []epochingtypes.Validator for i := 0; i < n; i++ { - address := sdk.ValAddress(ed25519.GenPrivKey().PubKey().Address()) + address := GenRandomValidatorAddress() val := epochingtypes.Validator{ Addr: address, Power: power, @@ -24,6 +25,10 @@ func GenRandomValSet(n int) epochingtypes.ValidatorSet { return epochingtypes.NewSortedValidatorSet(valSet) } +func GenRandomValidatorAddress() sdk.ValAddress { + return sdk.ValAddress(ed25519.GenPrivKey().PubKey().Address()) +} + func GenRandomPubkeysAndSigs(n int, msg []byte) ([]bls12381.PublicKey, []bls12381.Signature) { var blsPubkeys []bls12381.PublicKey var blsSigs []bls12381.Signature diff --git a/testutil/keeper/btccheckpoint.go b/testutil/keeper/btccheckpoint.go index e106a43c5..ecd1f7c4f 100644 --- a/testutil/keeper/btccheckpoint.go +++ b/testutil/keeper/btccheckpoint.go @@ -5,19 +5,19 @@ import ( "math/big" - txformat "github.com/babylonchain/babylon/btctxformatter" "github.com/babylonchain/babylon/x/btccheckpoint/keeper" btcctypes "github.com/babylonchain/babylon/x/btccheckpoint/types" + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) func NewBTCCheckpointKeeper( @@ -26,6 +26,7 @@ func NewBTCCheckpointKeeper( ek btcctypes.CheckpointingKeeper, powLimit *big.Int) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(btcctypes.StoreKey) + tstoreKey := sdk.NewTransientStoreKey(btcctypes.TStoreKey) memStoreKey := storetypes.NewMemoryStoreKey(btcctypes.MemStoreKey) db := tmdb.NewMemDB() @@ -37,29 +38,23 @@ func NewBTCCheckpointKeeper( registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - paramsSubspace := typesparams.NewSubspace(cdc, - btcctypes.Amino, - storeKey, - memStoreKey, - "BTCCheckpointParams", - ) - k := keeper.NewKeeper( cdc, storeKey, + tstoreKey, memStoreKey, - paramsSubspace, lk, ek, powLimit, - // use MainTag tests - txformat.MainTag(0), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, btcctypes.DefaultParams()) + if err := k.SetParams(ctx, btcctypes.DefaultParams()); err != nil { + panic(err) + } return &k, ctx } diff --git a/testutil/keeper/btclightclient.go b/testutil/keeper/btclightclient.go index e68657b1d..90d5ba44d 100644 --- a/testutil/keeper/btclightclient.go +++ b/testutil/keeper/btclightclient.go @@ -7,16 +7,15 @@ import ( bbn "github.com/babylonchain/babylon/types" "github.com/babylonchain/babylon/x/btclightclient/keeper" "github.com/babylonchain/babylon/x/btclightclient/types" + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) func BTCLightClientKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { @@ -32,27 +31,16 @@ func BTCLightClientKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "BTCLightClientParams", - ) - testCfg := bbn.ParseBtcOptionsFromConfig(bapp.EmptyAppOptions{}) k := keeper.NewKeeper( cdc, storeKey, memStoreKey, - paramsSubspace, testCfg, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - return k, ctx } diff --git a/testutil/keeper/checkpointing.go b/testutil/keeper/checkpointing.go index 2a2ea7c96..895ae3ead 100644 --- a/testutil/keeper/checkpointing.go +++ b/testutil/keeper/checkpointing.go @@ -5,17 +5,16 @@ import ( "github.com/babylonchain/babylon/x/checkpointing/keeper" "github.com/babylonchain/babylon/x/checkpointing/types" + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) func CheckpointingKeeper(t testing.TB, ek types.EpochingKeeper, signer keeper.BlsSigner, cliCtx client.Context) (*keeper.Keeper, sdk.Context, *codec.ProtoCodec) { @@ -32,28 +31,16 @@ func CheckpointingKeeper(t testing.TB, ek types.EpochingKeeper, signer keeper.Bl types.RegisterInterfaces(registry) cdc := codec.NewProtoCodec(registry) - paramsSubspace := typesparams.NewSubspace( - cdc, - types.Amino, - storeKey, - memStoreKey, - "CheckpointingParams", - ) - k := keeper.NewKeeper( cdc, storeKey, memStoreKey, signer, ek, - paramsSubspace, cliCtx, ) ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - return &k, ctx, cdc } diff --git a/testutil/keeper/epoching.go b/testutil/keeper/epoching.go index bbfc150b4..d1dab7cdc 100644 --- a/testutil/keeper/epoching.go +++ b/testutil/keeper/epoching.go @@ -3,18 +3,20 @@ package keeper import ( "testing" - "github.com/babylonchain/babylon/x/epoching/keeper" - "github.com/babylonchain/babylon/x/epoching/types" + tmdb "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/libs/log" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" + + "github.com/babylonchain/babylon/x/epoching/keeper" + "github.com/babylonchain/babylon/x/epoching/types" ) func EpochingKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { @@ -30,19 +32,14 @@ func EpochingKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { registry := codectypes.NewInterfaceRegistry() cdc := codec.NewProtoCodec(registry) - paramsSubspace := typesparams.NewSubspace(cdc, - types.Amino, - storeKey, - memStoreKey, - "EpochingParams", - ) k := keeper.NewKeeper( cdc, storeKey, memStoreKey, - paramsSubspace, // TODO: make this compile at the moment, will fix for integrated testing nil, + nil, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // TODO: add msgServiceRouter? @@ -50,7 +47,9 @@ func EpochingKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, log.NewNopLogger()) // Initialize params - k.SetParams(ctx, types.DefaultParams()) + if err := k.SetParams(ctx, types.DefaultParams()); err != nil { + panic(err) + } return &k, ctx } diff --git a/testutil/keeper/zoneconcierge.go b/testutil/keeper/zoneconcierge.go index 23ed4d2db..d4b6e67b0 100644 --- a/testutil/keeper/zoneconcierge.go +++ b/testutil/keeper/zoneconcierge.go @@ -5,6 +5,11 @@ import ( "github.com/babylonchain/babylon/x/zoneconcierge/keeper" "github.com/babylonchain/babylon/x/zoneconcierge/types" + tmdb "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/libs/log" + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/store" @@ -12,15 +17,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - typesparams "github.com/cosmos/cosmos-sdk/x/params/types" - channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" "github.com/stretchr/testify/require" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/libs/log" - tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmdb "github.com/tendermint/tm-db" ) // zoneconciergeChannelKeeper is a stub of ChannelKeeper @@ -77,18 +76,10 @@ func ZoneConciergeKeeper(t testing.TB, checkpointingKeeper types.CheckpointingKe registry := codectypes.NewInterfaceRegistry() appCodec := codec.NewProtoCodec(registry) capabilityKeeper := capabilitykeeper.NewKeeper(appCodec, storeKey, memStoreKey) - - paramsSubspace := typesparams.NewSubspace(appCodec, - types.Amino, - storeKey, - memStoreKey, - "ZoneconciergeParams", - ) k := keeper.NewKeeper( appCodec, storeKey, memStoreKey, - paramsSubspace, nil, // TODO: mock this keeper zoneconciergeChannelKeeper{}, zoneconciergePortKeeper{}, @@ -104,8 +95,5 @@ func ZoneConciergeKeeper(t testing.TB, checkpointingKeeper types.CheckpointingKe ctx := sdk.NewContext(stateStore, tmproto.Header{}, false, logger) - // Initialize params - k.SetParams(ctx, types.DefaultParams()) - return k, ctx } diff --git a/testutil/mocks/checkpointing_expected_keepers.go b/testutil/mocks/checkpointing_expected_keepers.go index 3c13ba778..2c7327500 100644 --- a/testutil/mocks/checkpointing_expected_keepers.go +++ b/testutil/mocks/checkpointing_expected_keepers.go @@ -7,9 +7,11 @@ package mocks import ( reflect "reflect" - types "github.com/babylonchain/babylon/x/epoching/types" - types0 "github.com/cosmos/cosmos-sdk/types" - types1 "github.com/cosmos/cosmos-sdk/x/auth/types" + types "github.com/babylonchain/babylon/x/checkpointing/types" + types0 "github.com/babylonchain/babylon/x/epoching/types" + types1 "github.com/cosmos/cosmos-sdk/types" + types2 "github.com/cosmos/cosmos-sdk/x/auth/types" + types3 "github.com/cosmos/cosmos-sdk/x/staking/types" gomock "github.com/golang/mock/gomock" ) @@ -37,10 +39,10 @@ func (m *MockAccountKeeper) EXPECT() *MockAccountKeeperMockRecorder { } // GetAccount mocks base method. -func (m *MockAccountKeeper) GetAccount(ctx types0.Context, addr types0.AccAddress) types1.AccountI { +func (m *MockAccountKeeper) GetAccount(ctx types1.Context, addr types1.AccAddress) types2.AccountI { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetAccount", ctx, addr) - ret0, _ := ret[0].(types1.AccountI) + ret0, _ := ret[0].(types2.AccountI) return ret0 } @@ -74,10 +76,10 @@ func (m *MockBankKeeper) EXPECT() *MockBankKeeperMockRecorder { } // SpendableCoins mocks base method. -func (m *MockBankKeeper) SpendableCoins(ctx types0.Context, addr types0.AccAddress) types0.Coins { +func (m *MockBankKeeper) SpendableCoins(ctx types1.Context, addr types1.AccAddress) types1.Coins { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "SpendableCoins", ctx, addr) - ret0, _ := ret[0].(types0.Coins) + ret0, _ := ret[0].(types1.Coins) return ret0 } @@ -110,8 +112,22 @@ func (m *MockEpochingKeeper) EXPECT() *MockEpochingKeeperMockRecorder { return m.recorder } +// CheckMsgCreateValidator mocks base method. +func (m *MockEpochingKeeper) CheckMsgCreateValidator(ctx types1.Context, msg *types3.MsgCreateValidator) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "CheckMsgCreateValidator", ctx, msg) + ret0, _ := ret[0].(error) + return ret0 +} + +// CheckMsgCreateValidator indicates an expected call of CheckMsgCreateValidator. +func (mr *MockEpochingKeeperMockRecorder) CheckMsgCreateValidator(ctx, msg interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CheckMsgCreateValidator", reflect.TypeOf((*MockEpochingKeeper)(nil).CheckMsgCreateValidator), ctx, msg) +} + // EnqueueMsg mocks base method. -func (m *MockEpochingKeeper) EnqueueMsg(ctx types0.Context, msg types.QueuedMessage) { +func (m *MockEpochingKeeper) EnqueueMsg(ctx types1.Context, msg types0.QueuedMessage) { m.ctrl.T.Helper() m.ctrl.Call(m, "EnqueueMsg", ctx, msg) } @@ -123,10 +139,10 @@ func (mr *MockEpochingKeeperMockRecorder) EnqueueMsg(ctx, msg interface{}) *gomo } // GetEpoch mocks base method. -func (m *MockEpochingKeeper) GetEpoch(ctx types0.Context) *types.Epoch { +func (m *MockEpochingKeeper) GetEpoch(ctx types1.Context) *types0.Epoch { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetEpoch", ctx) - ret0, _ := ret[0].(*types.Epoch) + ret0, _ := ret[0].(*types0.Epoch) return ret0 } @@ -137,7 +153,7 @@ func (mr *MockEpochingKeeperMockRecorder) GetEpoch(ctx interface{}) *gomock.Call } // GetTotalVotingPower mocks base method. -func (m *MockEpochingKeeper) GetTotalVotingPower(ctx types0.Context, epochNumber uint64) int64 { +func (m *MockEpochingKeeper) GetTotalVotingPower(ctx types1.Context, epochNumber uint64) int64 { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetTotalVotingPower", ctx, epochNumber) ret0, _ := ret[0].(int64) @@ -151,10 +167,10 @@ func (mr *MockEpochingKeeperMockRecorder) GetTotalVotingPower(ctx, epochNumber i } // GetValidatorSet mocks base method. -func (m *MockEpochingKeeper) GetValidatorSet(ctx types0.Context, epochNumer uint64) types.ValidatorSet { +func (m *MockEpochingKeeper) GetValidatorSet(ctx types1.Context, epochNumer uint64) types0.ValidatorSet { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "GetValidatorSet", ctx, epochNumer) - ret0, _ := ret[0].(types.ValidatorSet) + ret0, _ := ret[0].(types0.ValidatorSet) return ret0 } @@ -188,7 +204,7 @@ func (m *MockCheckpointingHooks) EXPECT() *MockCheckpointingHooksMockRecorder { } // AfterBlsKeyRegistered mocks base method. -func (m *MockCheckpointingHooks) AfterBlsKeyRegistered(ctx types0.Context, valAddr types0.ValAddress) error { +func (m *MockCheckpointingHooks) AfterBlsKeyRegistered(ctx types1.Context, valAddr types1.ValAddress) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AfterBlsKeyRegistered", ctx, valAddr) ret0, _ := ret[0].(error) @@ -201,8 +217,22 @@ func (mr *MockCheckpointingHooksMockRecorder) AfterBlsKeyRegistered(ctx, valAddr return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterBlsKeyRegistered", reflect.TypeOf((*MockCheckpointingHooks)(nil).AfterBlsKeyRegistered), ctx, valAddr) } +// AfterRawCheckpointBlsSigVerified mocks base method. +func (m *MockCheckpointingHooks) AfterRawCheckpointBlsSigVerified(ctx types1.Context, ckpt *types.RawCheckpoint) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AfterRawCheckpointBlsSigVerified", ctx, ckpt) + ret0, _ := ret[0].(error) + return ret0 +} + +// AfterRawCheckpointBlsSigVerified indicates an expected call of AfterRawCheckpointBlsSigVerified. +func (mr *MockCheckpointingHooksMockRecorder) AfterRawCheckpointBlsSigVerified(ctx, ckpt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterRawCheckpointBlsSigVerified", reflect.TypeOf((*MockCheckpointingHooks)(nil).AfterRawCheckpointBlsSigVerified), ctx, ckpt) +} + // AfterRawCheckpointConfirmed mocks base method. -func (m *MockCheckpointingHooks) AfterRawCheckpointConfirmed(ctx types0.Context, epoch uint64) error { +func (m *MockCheckpointingHooks) AfterRawCheckpointConfirmed(ctx types1.Context, epoch uint64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AfterRawCheckpointConfirmed", ctx, epoch) ret0, _ := ret[0].(error) @@ -216,7 +246,7 @@ func (mr *MockCheckpointingHooksMockRecorder) AfterRawCheckpointConfirmed(ctx, e } // AfterRawCheckpointFinalized mocks base method. -func (m *MockCheckpointingHooks) AfterRawCheckpointFinalized(ctx types0.Context, epoch uint64) error { +func (m *MockCheckpointingHooks) AfterRawCheckpointFinalized(ctx types1.Context, epoch uint64) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AfterRawCheckpointFinalized", ctx, epoch) ret0, _ := ret[0].(error) @@ -228,3 +258,17 @@ func (mr *MockCheckpointingHooksMockRecorder) AfterRawCheckpointFinalized(ctx, e mr.mock.ctrl.T.Helper() return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterRawCheckpointFinalized", reflect.TypeOf((*MockCheckpointingHooks)(nil).AfterRawCheckpointFinalized), ctx, epoch) } + +// AfterRawCheckpointForgotten mocks base method. +func (m *MockCheckpointingHooks) AfterRawCheckpointForgotten(ctx types1.Context, ckpt *types.RawCheckpoint) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AfterRawCheckpointForgotten", ctx, ckpt) + ret0, _ := ret[0].(error) + return ret0 +} + +// AfterRawCheckpointForgotten indicates an expected call of AfterRawCheckpointForgotten. +func (mr *MockCheckpointingHooksMockRecorder) AfterRawCheckpointForgotten(ctx, ckpt interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AfterRawCheckpointForgotten", reflect.TypeOf((*MockCheckpointingHooks)(nil).AfterRawCheckpointForgotten), ctx, ckpt) +} diff --git a/types/btc_config.go b/types/btc_config.go index 43a93f13b..ad24a4014 100644 --- a/types/btc_config.go +++ b/types/btc_config.go @@ -3,7 +3,6 @@ package types import ( "math/big" - txformat "github.com/babylonchain/babylon/btctxformatter" "github.com/btcsuite/btcd/chaincfg" servertypes "github.com/cosmos/cosmos-sdk/server/types" "github.com/spf13/cast" @@ -13,7 +12,6 @@ type SupportedBtcNetwork string type BtcConfig struct { powLimit *big.Int - checkPointTag txformat.BabylonTag retargetAdjustmentFactor int64 reduceMinDifficulty bool } @@ -63,38 +61,14 @@ func parseReduceMinDifficulty(opts servertypes.AppOptions) bool { return getParams(opts).ReduceMinDifficulty } -func parseCheckpointTag(opts servertypes.AppOptions) txformat.BabylonTag { - valueInterface := opts.Get("btc-config.checkpoint-tag") - - if valueInterface == nil { - panic("Bitcoin network should be provided in options") - } - - tag, err := cast.ToStringE(valueInterface) - - if err != nil { - panic("checkpoint-tag should be valid string") - } - - tagBytes := []byte(tag) - - if len(tagBytes) != txformat.TagLength { - panic("provided tag should have exactly 4 bytes") - } - - return txformat.BabylonTag(tagBytes) -} - func ParseBtcOptionsFromConfig(opts servertypes.AppOptions) BtcConfig { powLimit := parsePowLimit(opts) - tag := parseCheckpointTag(opts) retargetAdjustmentFactor := parseRetargetAdjustmentFactor(opts) reduceMinDifficulty := parseReduceMinDifficulty(opts) return BtcConfig{ powLimit: powLimit, retargetAdjustmentFactor: retargetAdjustmentFactor, reduceMinDifficulty: reduceMinDifficulty, - checkPointTag: tag, } } @@ -102,10 +76,6 @@ func (c *BtcConfig) PowLimit() big.Int { return *c.powLimit } -func (c *BtcConfig) CheckpointTag() txformat.BabylonTag { - return c.checkPointTag -} - func (c *BtcConfig) RetargetAdjustmentFactor() int64 { return c.retargetAdjustmentFactor } diff --git a/types/btc_header_bytes_test.go b/types/btc_header_bytes_test.go index 9093c671a..df0b00dcd 100644 --- a/types/btc_header_bytes_test.go +++ b/types/btc_header_bytes_test.go @@ -11,15 +11,15 @@ import ( ) func FuzzBTCHeaderBytesBytesOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) invalidHeader := false - bz := datagen.GenRandomByteArray(types.BTCHeaderLen) - if datagen.OneInN(10) { - bz = datagen.GenRandomByteArray(datagen.RandomIntOtherThan(types.BTCHeaderLen, 10*types.BTCHeaderLen)) + bz := datagen.GenRandomByteArray(r, types.BTCHeaderLen) + if datagen.OneInN(r, 10) { + bz = datagen.GenRandomByteArray(r, datagen.RandomIntOtherThan(r, types.BTCHeaderLen, 10*types.BTCHeaderLen)) invalidHeader = true } @@ -77,19 +77,19 @@ func FuzzBTCHeaderBytesBytesOps(f *testing.F) { } func FuzzBTCHeaderBytesHexOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) invalidHeader := false // 2 hex chars per byte - hex := datagen.GenRandomHexStr(types.BTCHeaderLen) - if datagen.OneInN(10) { - if datagen.OneInN(2) { - hex = datagen.GenRandomHexStr(datagen.RandomIntOtherThan(types.BTCHeaderLen, 10*types.BTCHeaderLen)) + hex := datagen.GenRandomHexStr(r, types.BTCHeaderLen) + if datagen.OneInN(r, 10) { + if datagen.OneInN(r, 2) { + hex = datagen.GenRandomHexStr(r, datagen.RandomIntOtherThan(r, types.BTCHeaderLen, 10*types.BTCHeaderLen)) } else { - hex = string(datagen.GenRandomByteArray(types.BTCHeaderLen * 2)) + hex = string(datagen.GenRandomByteArray(r, types.BTCHeaderLen*2)) } invalidHeader = true } @@ -120,19 +120,19 @@ func FuzzBTCHeaderBytesHexOps(f *testing.F) { } func FuzzBTCHeaderBytesJSONOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) invalidHeader := false // 2 hex chars per byte - hex := datagen.GenRandomHexStr(types.BTCHeaderLen) - if datagen.OneInN(10) { - if datagen.OneInN(2) { - hex = datagen.GenRandomHexStr(datagen.RandomIntOtherThan(types.BTCHeaderLen, 10*types.BTCHeaderLen)) + hex := datagen.GenRandomHexStr(r, types.BTCHeaderLen) + if datagen.OneInN(r, 10) { + if datagen.OneInN(r, 2) { + hex = datagen.GenRandomHexStr(r, datagen.RandomIntOtherThan(r, types.BTCHeaderLen, 10*types.BTCHeaderLen)) } else { - hex = string(datagen.GenRandomByteArray(types.BTCHeaderLen * 2)) + hex = string(datagen.GenRandomByteArray(r, types.BTCHeaderLen*2)) } invalidHeader = true } @@ -171,11 +171,11 @@ func FuzzBTCHeaderBytesJSONOps(f *testing.F) { } func FuzzBTCHeaderBytesBtcdBlockOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - btcdHeader := datagen.GenRandomBtcdHeader() + r := rand.New(rand.NewSource(seed)) + btcdHeader := datagen.GenRandomBtcdHeader(r) var hb types.BTCHeaderBytes hb.FromBlockHeader(btcdHeader) @@ -193,14 +193,14 @@ func FuzzBTCHeaderBytesBtcdBlockOps(f *testing.F) { } func FuzzBTCHeaderBytesOperators(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) - parent := datagen.GenRandomBTCHeaderInfo() + parent := datagen.GenRandomBTCHeaderInfo(r) hb := parent.Header hb2 := types.NewBTCHeaderBytesFromBlockHeader(hb.ToBlockHeader()) - hbChild := datagen.GenRandomBTCHeaderBytes(parent, nil) + hbChild := datagen.GenRandomBTCHeaderBytes(r, parent, nil) if !hb.Eq(hb) { t.Errorf("BTCHeaderBytes object does not equal itself") diff --git a/types/btc_header_hash_bytes_test.go b/types/btc_header_hash_bytes_test.go index 7395bf936..83305e969 100644 --- a/types/btc_header_hash_bytes_test.go +++ b/types/btc_header_hash_bytes_test.go @@ -12,17 +12,17 @@ import ( ) func FuzzBTCHeaderHashBytesBytesOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) invalidHash := false - bz := datagen.GenRandomByteArray(types.BTCHeaderHashLen) + bz := datagen.GenRandomByteArray(r, types.BTCHeaderHashLen) // 1/10 times generate an invalid size - if datagen.OneInN(10) { - bzSz := datagen.RandomIntOtherThan(types.BTCHeaderHashLen, types.BTCHeaderHashLen*10) - bz = datagen.GenRandomByteArray(bzSz) + if datagen.OneInN(r, 10) { + bzSz := datagen.RandomIntOtherThan(r, types.BTCHeaderHashLen, types.BTCHeaderHashLen*10) + bz = datagen.GenRandomByteArray(r, bzSz) invalidHash = true } @@ -80,22 +80,22 @@ func FuzzBTCHeaderHashBytesBytesOps(f *testing.F) { } func FuzzBTCHeaderHashBytesHexOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) invalidHash := false - hex := datagen.GenRandomHexStr(types.BTCHeaderHashLen) + hex := datagen.GenRandomHexStr(r, types.BTCHeaderHashLen) // 1/4 times generate an invalid hash - if datagen.OneInN(10) { - if datagen.OneInN(2) { + if datagen.OneInN(r, 10) { + if datagen.OneInN(r, 2) { // 1/4 times generate an invalid hash size - bzSz := datagen.RandomIntOtherThan(types.BTCHeaderHashLen, types.BTCHeaderHashLen*20) - hex = datagen.GenRandomHexStr(bzSz) + bzSz := datagen.RandomIntOtherThan(r, types.BTCHeaderHashLen, types.BTCHeaderHashLen*20) + hex = datagen.GenRandomHexStr(r, bzSz) } else { // 1/4 times generate an invalid hex - hex = string(datagen.GenRandomByteArray(types.BTCHeaderHashLen * 2)) + hex = string(datagen.GenRandomByteArray(r, types.BTCHeaderHashLen*2)) } invalidHash = true } @@ -126,22 +126,22 @@ func FuzzBTCHeaderHashBytesHexOps(f *testing.F) { } func FuzzBTCHeaderHashBytesJSONOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) invalidHash := false - hex := datagen.GenRandomHexStr(types.BTCHeaderHashLen) + hex := datagen.GenRandomHexStr(r, types.BTCHeaderHashLen) // 1/4 times generate an invalid hash - if datagen.OneInN(10) { - if datagen.OneInN(2) { + if datagen.OneInN(r, 10) { + if datagen.OneInN(r, 2) { // 1/4 times generate an invalid hash size - bzSz := datagen.RandomIntOtherThan(types.BTCHeaderHashLen, types.BTCHeaderHashLen*20) - hex = datagen.GenRandomHexStr(bzSz) + bzSz := datagen.RandomIntOtherThan(r, types.BTCHeaderHashLen, types.BTCHeaderHashLen*20) + hex = datagen.GenRandomHexStr(r, bzSz) } else { // 1/4 times generate an invalid hex - hex = string(datagen.GenRandomByteArray(types.BTCHeaderHashLen * 2)) + hex = string(datagen.GenRandomByteArray(r, types.BTCHeaderHashLen*2)) } invalidHash = true } @@ -181,11 +181,11 @@ func FuzzBTCHeaderHashBytesJSONOps(f *testing.F) { } func FuzzHeaderHashBytesChainhashOps(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) - hexHash := datagen.GenRandomHexStr(types.BTCHeaderHashLen) + hexHash := datagen.GenRandomHexStr(r, types.BTCHeaderHashLen) chHash, _ := chainhash.NewHashFromStr(hexHash) var hbb types.BTCHeaderHashBytes @@ -204,12 +204,12 @@ func FuzzHeaderHashBytesChainhashOps(f *testing.F) { } func FuzzHeaderHashBytesOperators(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) - hexHash := datagen.GenRandomHexStr(types.BTCHeaderHashLen) - hexHash2 := datagen.GenRandomHexStr(types.BTCHeaderHashLen) + hexHash := datagen.GenRandomHexStr(r, types.BTCHeaderHashLen) + hexHash2 := datagen.GenRandomHexStr(r, types.BTCHeaderHashLen) chHash, _ := chainhash.NewHashFromStr(hexHash) var hbb, hbb2 types.BTCHeaderHashBytes diff --git a/types/btcutils.go b/types/btcutils.go index 7c82c68be..4f4c08540 100644 --- a/types/btcutils.go +++ b/types/btcutils.go @@ -8,7 +8,7 @@ import ( "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" + "github.com/btcsuite/btcd/btcutil" ) // ValidateBTCHeader diff --git a/types/retry/log.go b/types/retry/log.go index 9ce022033..55c07f6bf 100644 --- a/types/retry/log.go +++ b/types/retry/log.go @@ -1,7 +1,7 @@ package retry import ( - "github.com/tendermint/tendermint/libs/log" + "github.com/cometbft/cometbft/libs/log" "os" ) diff --git a/types/signer_config.go b/types/signer_config.go index 0b82f3615..0ad3298cf 100644 --- a/types/signer_config.go +++ b/types/signer_config.go @@ -1,8 +1,12 @@ package types import ( + "errors" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cast" + "github.com/spf13/viper" ) func ParseKeyNameFromConfig(opts servertypes.AppOptions) string { @@ -17,3 +21,71 @@ func ParseKeyNameFromConfig(opts servertypes.AppOptions) string { return keyName } + +func parseGasPriceFromConfig(opts servertypes.AppOptions) (string, error) { + valueInterface := opts.Get("signer-config.gas-price") + if valueInterface == nil { + return "", errors.New("signer gas price should be provided in options") + } + gasPrice, err := cast.ToStringE(valueInterface) + if err != nil { + return "", errors.New("signer gas price should be valid string") + } + + coin, err := sdk.ParseDecCoin(gasPrice) + if err != nil { + return "", errors.New("signer gas price is invalid") + } + + if !coin.Amount.IsPositive() { + return "", errors.New("gas price should be positive") + } + + return gasPrice, nil +} + +func parseGasAdjustmentFromConfig(opts servertypes.AppOptions) (float64, error) { + valueInterface := opts.Get("signer-config.gas-adjustment") + if valueInterface == nil { + return 0, errors.New("signer gas adjustment should be provided in options") + } + gasAdjustment, err := cast.ToFloat64E(valueInterface) + if err != nil { + return 0, errors.New("signer gas adjustment should be valid float number") + } + + if gasAdjustment <= 1 { + return 0, errors.New("signer gas adjustment should be more than 1") + } + + return gasAdjustment, nil +} + +// MustGetGasSettings reads GasPrice and GasAdjustment from app.toml file +func MustGetGasSettings(configPath string, v *viper.Viper) (string, float64) { + var ( + gasPrice string + gasAdjustment float64 + err error + ) + + v.AddConfigPath(configPath) + v.SetConfigName("app") + v.SetConfigType("toml") + + if err := v.ReadInConfig(); err != nil { + panic("failed to read app.toml") + } + + gasPrice, err = parseGasPriceFromConfig(v) + if err != nil { + panic(err) + } + + gasAdjustment, err = parseGasAdjustmentFromConfig(v) + if err != nil { + panic(err) + } + + return gasPrice, gasAdjustment +} diff --git a/types/utils.go b/types/utils.go index 0f8145042..59d9eb82c 100644 --- a/types/utils.go +++ b/types/utils.go @@ -1,6 +1,7 @@ package types import ( + "fmt" "reflect" ) @@ -11,3 +12,20 @@ func Reverse(s interface{}) { swap(i, j) } } + +func CheckForDuplicatesAndEmptyStrings(input []string) error { + encountered := map[string]bool{} + for _, str := range input { + if len(str) == 0 { + return fmt.Errorf("empty string is not allowed") + } + + if encountered[str] { + return fmt.Errorf("duplicate entry found: %s", str) + } + + encountered[str] = true + } + + return nil +} diff --git a/wasmbinding/bindings/query.go b/wasmbinding/bindings/query.go new file mode 100644 index 000000000..7bef9606f --- /dev/null +++ b/wasmbinding/bindings/query.go @@ -0,0 +1,57 @@ +package bindings + +type BabylonQuery struct { + Epoch *struct{} `json:"epoch,omitempty"` + LatestFinalizedEpochInfo *struct{} `json:"latest_finalized_epoch_info,omitempty"` + BtcTip *struct{} `json:"btc_tip,omitempty"` + BtcBaseHeader *struct{} `json:"btc_base_header,omitempty"` + BtcHeaderByHash *BtcHeaderByHash `json:"btc_header_by_hash,omitempty"` + BtcHeaderByHeight *BtcHeaderByHeight `json:"btc_header_by_height,omitempty"` +} + +type BtcHeaderByHash struct { + Hash string `json:"hash,omitempty"` +} + +type BtcHeaderByHeight struct { + Height uint64 `json:"height,omitempty"` +} + +type CurrentEpochResponse struct { + Epoch uint64 `json:"epoch"` +} + +type LatestFinalizedEpochInfoResponse struct { + EpochInfo *FinalizedEpochInfo `json:"epoch_info,omitempty"` +} + +type FinalizedEpochInfo struct { + EpochNumber uint64 `json:"epoch_number"` + LastBlockHeight uint64 `json:"last_block_height"` +} + +type BtcBlockHeader struct { + Version int32 `json:"version,omitempty"` + PrevBlockhash string `json:"prev_blockhash,omitempty"` + MerkleRoot string `json:"merkle_root,omitempty"` + Time uint32 `json:"time,omitempty"` + Bits uint32 `json:"bits,omitempty"` + Nonce uint32 `json:"nonce,omitempty"` +} + +type BtcBlockHeaderInfo struct { + Header *BtcBlockHeader `json:"header,omitempty"` + Height uint64 `json:"height,omitempty"` +} + +type BtcTipResponse struct { + HeaderInfo *BtcBlockHeaderInfo `json:"header_info,omitempty"` +} + +type BtcBaseHeaderResponse struct { + HeaderInfo *BtcBlockHeaderInfo `json:"header_info,omitempty"` +} + +type BtcHeaderQueryResponse struct { + HeaderInfo *BtcBlockHeaderInfo `json:"header_info,omitempty"` +} diff --git a/wasmbinding/bindings/utils.go b/wasmbinding/bindings/utils.go new file mode 100644 index 000000000..14f90d3f4 --- /dev/null +++ b/wasmbinding/bindings/utils.go @@ -0,0 +1,27 @@ +package bindings + +import ( + lcTypes "github.com/babylonchain/babylon/x/btclightclient/types" +) + +// translate BTCHeaderInfo to BtcBlockHeaderInfo +func AsBtcBlockHeaderInfo(info *lcTypes.BTCHeaderInfo) *BtcBlockHeaderInfo { + if info == nil { + return nil + } + + header := info.Header.ToBlockHeader() + return &BtcBlockHeaderInfo{ + Header: &BtcBlockHeader{ + Version: header.Version, + Time: uint32(header.Timestamp.Unix()), + Bits: header.Bits, + Nonce: header.Nonce, + // for compatibility with all btc infra we are returning the hex encoded bytes + // in reversed order + MerkleRoot: header.MerkleRoot.String(), + PrevBlockhash: header.PrevBlock.String(), + }, + Height: info.Height, + } +} diff --git a/wasmbinding/test/custom_query_test.go b/wasmbinding/test/custom_query_test.go new file mode 100644 index 000000000..359da5b20 --- /dev/null +++ b/wasmbinding/test/custom_query_test.go @@ -0,0 +1,347 @@ +package wasmbinding + +import ( + "encoding/json" + "math/rand" + "os" + "runtime" + "testing" + "time" + + "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + "github.com/babylonchain/babylon/app" + "github.com/babylonchain/babylon/testutil/datagen" + "github.com/babylonchain/babylon/wasmbinding/bindings" + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/ed25519" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + sdk "github.com/cosmos/cosmos-sdk/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/stretchr/testify/require" +) + +// TODO consider doing it by enviromental variables as currently it may fail on some +// weird architectures +func getArtifactPath() string { + if runtime.GOARCH == "amd64" { + return "../testdata/artifacts/testdata.wasm" + } else if runtime.GOARCH == "arm64" { + return "../testdata/artifacts/testdata-aarch64.wasm" + } else { + panic("Unsupported architecture") + } +} + +var pathToContract = getArtifactPath() + +func TestQueryEpoch(t *testing.T) { + acc := randomAccountAddress() + babylonApp, ctx := setupAppWithContext(t) + fundAccount(t, ctx, babylonApp, acc) + + contractAddress := deployTestContract(t, ctx, babylonApp, acc, pathToContract) + + query := bindings.BabylonQuery{ + Epoch: &struct{}{}, + } + resp := bindings.CurrentEpochResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, query, &resp) + require.Equal(t, resp.Epoch, uint64(0)) + + newEpoch := babylonApp.EpochingKeeper.IncEpoch(ctx) + + resp = bindings.CurrentEpochResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, query, &resp) + require.Equal(t, resp.Epoch, newEpoch.EpochNumber) +} + +func TestFinalizedEpoch(t *testing.T) { + acc := randomAccountAddress() + babylonApp, ctx := setupAppWithContext(t) + fundAccount(t, ctx, babylonApp, acc) + + // babylonApp.ZoneConciergeKeeper + contractAddress := deployTestContract(t, ctx, babylonApp, acc, pathToContract) + + query := bindings.BabylonQuery{ + LatestFinalizedEpochInfo: &struct{}{}, + } + + // There is no finalized epoch yet so we require an error + queryCustomErr(t, ctx, babylonApp, contractAddress, query) + + epoch := babylonApp.EpochingKeeper.IncEpoch(ctx) + + _ = babylonApp.ZoneConciergeKeeper.Hooks().AfterRawCheckpointFinalized(ctx, epoch.EpochNumber) + + resp := bindings.LatestFinalizedEpochInfoResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, query, &resp) + require.Equal(t, resp.EpochInfo.EpochNumber, epoch.EpochNumber) + require.Equal(t, resp.EpochInfo.LastBlockHeight, epoch.GetLastBlockHeight()) +} + +func TestQueryBtcTip(t *testing.T) { + acc := randomAccountAddress() + babylonApp, ctx := setupAppWithContext(t) + fundAccount(t, ctx, babylonApp, acc) + + contractAddress := deployTestContract(t, ctx, babylonApp, acc, pathToContract) + + query := bindings.BabylonQuery{ + BtcTip: &struct{}{}, + } + + resp := bindings.BtcTipResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, query, &resp) + + tip := babylonApp.BTCLightClientKeeper.GetTipInfo(ctx) + tipAsInfo := bindings.AsBtcBlockHeaderInfo(tip) + + require.Equal(t, resp.HeaderInfo.Height, tip.Height) + require.Equal(t, tipAsInfo, resp.HeaderInfo) +} + +func TestQueryBtcBase(t *testing.T) { + acc := randomAccountAddress() + babylonApp, ctx := setupAppWithContext(t) + fundAccount(t, ctx, babylonApp, acc) + + contractAddress := deployTestContract(t, ctx, babylonApp, acc, pathToContract) + + query := bindings.BabylonQuery{ + BtcBaseHeader: &struct{}{}, + } + + resp := bindings.BtcBaseHeaderResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, query, &resp) + + base := babylonApp.BTCLightClientKeeper.GetBaseBTCHeader(ctx) + baseAsInfo := bindings.AsBtcBlockHeaderInfo(base) + + require.Equal(t, baseAsInfo, resp.HeaderInfo) +} + +func TestQueryBtcByHash(t *testing.T) { + acc := randomAccountAddress() + babylonApp, ctx := setupAppWithContext(t) + fundAccount(t, ctx, babylonApp, acc) + + contractAddress := deployTestContract(t, ctx, babylonApp, acc, pathToContract) + tip := babylonApp.BTCLightClientKeeper.GetTipInfo(ctx) + + query := bindings.BabylonQuery{ + BtcHeaderByHash: &bindings.BtcHeaderByHash{ + Hash: tip.Hash.String(), + }, + } + + headerAsInfo := bindings.AsBtcBlockHeaderInfo(tip) + resp := bindings.BtcHeaderQueryResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, query, &resp) + + require.Equal(t, resp.HeaderInfo, headerAsInfo) +} + +func TestQueryBtcByNumber(t *testing.T) { + acc := randomAccountAddress() + babylonApp, ctx := setupAppWithContext(t) + fundAccount(t, ctx, babylonApp, acc) + + contractAddress := deployTestContract(t, ctx, babylonApp, acc, pathToContract) + tip := babylonApp.BTCLightClientKeeper.GetTipInfo(ctx) + + query := bindings.BabylonQuery{ + BtcHeaderByHeight: &bindings.BtcHeaderByHeight{ + Height: tip.Height, + }, + } + + headerAsInfo := bindings.AsBtcBlockHeaderInfo(tip) + resp := bindings.BtcHeaderQueryResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, query, &resp) + + require.Equal(t, resp.HeaderInfo, headerAsInfo) +} + +func TestQueryNonExistingHeader(t *testing.T) { + acc := randomAccountAddress() + babylonApp, ctx := setupAppWithContext(t) + fundAccount(t, ctx, babylonApp, acc) + + contractAddress := deployTestContract(t, ctx, babylonApp, acc, pathToContract) + + queryNonExisitingHeight := bindings.BabylonQuery{ + BtcHeaderByHeight: &bindings.BtcHeaderByHeight{ + Height: 1, + }, + } + resp := bindings.BtcHeaderQueryResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, queryNonExisitingHeight, &resp) + require.Nil(t, resp.HeaderInfo) + + // Random source for the generation of BTC hash + r := rand.New(rand.NewSource(time.Now().Unix())) + queryNonExisitingHash := bindings.BabylonQuery{ + BtcHeaderByHash: &bindings.BtcHeaderByHash{ + Hash: datagen.GenRandomBtcdHash(r).String(), + }, + } + resp1 := bindings.BtcHeaderQueryResponse{} + queryCustom(t, ctx, babylonApp, contractAddress, queryNonExisitingHash, &resp1) + require.Nil(t, resp1.HeaderInfo) +} + +func setupAppWithContext(t *testing.T) (*app.BabylonApp, sdk.Context) { + return setupAppWithContextAndCustomHeight(t, 1) +} + +func setupAppWithContextAndCustomHeight(t *testing.T, height int64) (*app.BabylonApp, sdk.Context) { + babylonApp := app.Setup(t, false) + ctx := babylonApp.BaseApp.NewContext(false, tmproto.Header{Height: height, Time: time.Now().UTC()}) + return babylonApp, ctx +} + +func keyPubAddr() (crypto.PrivKey, crypto.PubKey, sdk.AccAddress) { + key := ed25519.GenPrivKey() + pub := key.PubKey() + addr := sdk.AccAddress(pub.Address()) + return key, pub, addr +} + +func randomAccountAddress() sdk.AccAddress { + _, _, addr := keyPubAddr() + return addr +} + +func mintCoinsTo( + bankKeeper bankkeeper.Keeper, + ctx sdk.Context, + addr sdk.AccAddress, + amounts sdk.Coins) error { + if err := bankKeeper.MintCoins(ctx, minttypes.ModuleName, amounts); err != nil { + return err + } + + return bankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, addr, amounts) +} + +func fundAccount( + t *testing.T, + ctx sdk.Context, + bbn *app.BabylonApp, + acc sdk.AccAddress) { + + err := mintCoinsTo(bbn.BankKeeper, ctx, acc, sdk.NewCoins( + sdk.NewCoin("ubbn", sdk.NewInt(10000000000)), + )) + require.NoError(t, err) +} + +func storeTestCodeCode( + t *testing.T, + ctx sdk.Context, + babylonApp *app.BabylonApp, + addr sdk.AccAddress, + codePath string, +) (uint64, []byte) { + wasmCode, err := os.ReadFile(codePath) + + require.NoError(t, err) + permKeeper := keeper.NewPermissionedKeeper(babylonApp.WasmKeeper, keeper.DefaultAuthorizationPolicy{}) + id, checksum, err := permKeeper.Create(ctx, addr, wasmCode, nil) + require.NoError(t, err) + return id, checksum +} + +func instantiateExampleContract( + t *testing.T, + ctx sdk.Context, + bbn *app.BabylonApp, + funder sdk.AccAddress, + codeId uint64, +) sdk.AccAddress { + initMsgBz := []byte("{}") + contractKeeper := keeper.NewDefaultPermissionKeeper(bbn.WasmKeeper) + addr, _, err := contractKeeper.Instantiate(ctx, codeId, funder, funder, initMsgBz, "demo contract", nil) + require.NoError(t, err) + return addr +} + +func deployTestContract( + t *testing.T, + ctx sdk.Context, + bbn *app.BabylonApp, + deployer sdk.AccAddress, + codePath string, +) sdk.AccAddress { + + codeId, _ := storeTestCodeCode(t, ctx, bbn, deployer, codePath) + + contractAddr := instantiateExampleContract(t, ctx, bbn, deployer, codeId) + + return contractAddr +} + +type ExampleQuery struct { + Chain *ChainRequest `json:"chain,omitempty"` +} + +type ChainRequest struct { + Request wasmvmtypes.QueryRequest `json:"request"` +} + +type ChainResponse struct { + Data []byte `json:"data"` +} + +func queryCustom( + t *testing.T, + ctx sdk.Context, + bbn *app.BabylonApp, + contract sdk.AccAddress, + request bindings.BabylonQuery, + response interface{}, +) { + msgBz, err := json.Marshal(request) + require.NoError(t, err) + + query := ExampleQuery{ + Chain: &ChainRequest{ + Request: wasmvmtypes.QueryRequest{Custom: msgBz}, + }, + } + queryBz, err := json.Marshal(query) + require.NoError(t, err) + + resBz, err := bbn.WasmKeeper.QuerySmart(ctx, contract, queryBz) + require.NoError(t, err) + var resp ChainResponse + err = json.Unmarshal(resBz, &resp) + require.NoError(t, err) + err = json.Unmarshal(resp.Data, response) + require.NoError(t, err) +} + +func queryCustomErr( + t *testing.T, + ctx sdk.Context, + bbn *app.BabylonApp, + contract sdk.AccAddress, + request bindings.BabylonQuery, +) { + msgBz, err := json.Marshal(request) + require.NoError(t, err) + + query := ExampleQuery{ + Chain: &ChainRequest{ + Request: wasmvmtypes.QueryRequest{Custom: msgBz}, + }, + } + queryBz, err := json.Marshal(query) + require.NoError(t, err) + + _, err = bbn.WasmKeeper.QuerySmart(ctx, contract, queryBz) + require.Error(t, err) +} diff --git a/wasmbinding/testdata/Cargo.lock b/wasmbinding/testdata/Cargo.lock new file mode 100644 index 000000000..920856fc1 --- /dev/null +++ b/wasmbinding/testdata/Cargo.lock @@ -0,0 +1,717 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "ahash" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +dependencies = [ + "getrandom", + "once_cell", + "version_check", +] + +[[package]] +name = "babylon-bindings" +version = "0.1.0" +source = "git+https://github.com/babylonchain/bindings?tag=v0.1.0#7c209ab2cd289b9bad57958d5bc074cb8ded5a5c" +dependencies = [ + "cosmwasm-schema", + "cosmwasm-std", + "schemars", + "serde", +] + +[[package]] +name = "babylon-example" +version = "0.1.0" +source = "git+https://github.com/babylonchain/bindings?tag=v0.1.0#7c209ab2cd289b9bad57958d5bc074cb8ded5a5c" +dependencies = [ + "babylon-bindings", + "cosmwasm-schema", + "cosmwasm-std", + "cosmwasm-storage", + "schemars", + "serde", + "thiserror", +] + +[[package]] +name = "base16ct" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "const-oid" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" + +[[package]] +name = "cosmwasm-crypto" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b76d2207945b8aa3ce0735da53ab9a74f75fe3e7794754c216a9edfa04e1e627" +dependencies = [ + "digest 0.10.6", + "ed25519-zebra", + "k256", + "rand_core 0.6.4", + "thiserror", +] + +[[package]] +name = "cosmwasm-derive" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dd07af7736164d2d8126dc67fdb33b1b5c54fb5a3190395c47f46d24fc6d592" +dependencies = [ + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-schema" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e9e92cdce475a91659d0dc4d17836a484fc534e80e787281aa4adde4cb1798b" +dependencies = [ + "cosmwasm-schema-derive", + "schemars", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cosmwasm-schema-derive" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69681bac3dbeb0b00990279e3ed39e3d4406b29f538b16b712f6771322a45048" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "cosmwasm-std" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d39f20967baeb94709123f7bba13a25ae2fa166bc5e7813f734914df3f8f6a1" +dependencies = [ + "base64", + "cosmwasm-crypto", + "cosmwasm-derive", + "derivative", + "forward_ref", + "hex", + "schemars", + "serde", + "serde-json-wasm", + "sha2 0.10.6", + "thiserror", + "uint", +] + +[[package]] +name = "cosmwasm-storage" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88f7944b5204c3a998f73248925a097ace887bdf01c2f70de00d8b92cd69e807" +dependencies = [ + "cosmwasm-std", + "serde", +] + +[[package]] +name = "cpufeatures" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" +dependencies = [ + "libc", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +dependencies = [ + "generic-array", + "rand_core 0.6.4", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "curve25519-dalek" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" +dependencies = [ + "byteorder", + "digest 0.9.0", + "rand_core 0.5.1", + "subtle", + "zeroize", +] + +[[package]] +name = "der" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +dependencies = [ + "block-buffer 0.10.4", + "crypto-common", + "subtle", +] + +[[package]] +name = "dyn-clone" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68b0cf012f1230e43cd00ebb729c6bb58707ecfa8ad08b52ef3a4ccd2697fc30" + +[[package]] +name = "ecdsa" +version = "0.14.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519-zebra" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" +dependencies = [ + "curve25519-dalek", + "hashbrown", + "hex", + "rand_core 0.6.4", + "serde", + "sha2 0.9.9", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +dependencies = [ + "base16ct", + "crypto-bigint", + "der", + "digest 0.10.6", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "ff" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "forward_ref" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8cbd1169bd7b4a0a20d92b9af7a7e0422888bd38a6f5ec29c1fd8c1558a272e" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "group" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +dependencies = [ + "ff", + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +dependencies = [ + "ahash", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.6", +] + +[[package]] +name = "itoa" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" + +[[package]] +name = "k256" +version = "0.11.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "sha2 0.10.6", +] + +[[package]] +name = "libc" +version = "0.2.142" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a987beff54b60ffa6d51982e1aa1146bc42f19bd26be28b0586f252fccf5317" + +[[package]] +name = "once_cell" +version = "1.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" + +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + +[[package]] +name = "pkcs8" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "proc-macro2" +version = "1.0.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "rand_core" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rfc6979" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +dependencies = [ + "crypto-bigint", + "hmac", + "zeroize", +] + +[[package]] +name = "ryu" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" + +[[package]] +name = "schemars" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02c613288622e5f0c3fdc5dbd4db1c5fbe752746b1d1a56a0630b78fd00de44f" +dependencies = [ + "dyn-clone", + "schemars_derive", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "109da1e6b197438deb6db99952990c7f959572794b80ff93707d55a232545e7c" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 1.0.109", +] + +[[package]] +name = "sec1" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "serde" +version = "1.0.160" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde-json-wasm" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a62a1fad1e1828b24acac8f2b468971dade7b8c3c2e672bcadefefb1f8c137" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_derive" +version = "1.0.160" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + +[[package]] +name = "serde_derive_internals" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "serde_json" +version = "1.0.96" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.6", +] + +[[package]] +name = "signature" +version = "1.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +dependencies = [ + "digest 0.10.6", + "rand_core 0.6.4", +] + +[[package]] +name = "spki" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "testdata" +version = "0.1.0" +dependencies = [ + "babylon-example", +] + +[[package]] +name = "thiserror" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.15", +] + +[[package]] +name = "typenum" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unicode-ident" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" + +[[package]] +name = "version_check" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "zeroize" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" diff --git a/wasmbinding/testdata/Cargo.toml b/wasmbinding/testdata/Cargo.toml new file mode 100644 index 000000000..bfc90296f --- /dev/null +++ b/wasmbinding/testdata/Cargo.toml @@ -0,0 +1,11 @@ +[package] +name = "testdata" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[lib] +crate-type = ["cdylib", "rlib"] + +[dependencies] +babylon-example = { git = "https://github.com/babylonchain/bindings", tag = "v0.1.0" } diff --git a/wasmbinding/testdata/README.md b/wasmbinding/testdata/README.md new file mode 100644 index 000000000..cd0a7ef09 --- /dev/null +++ b/wasmbinding/testdata/README.md @@ -0,0 +1,18 @@ +# Stub test contract + +This folder contains bogus test contract which just exposes public api from +example contract from babylon bindings repo - https://github.com/babylonchain/bindings/tree/main/contracts/example + +This approach enables us to specify which branch from bindings library we want to test/use. + +Until custom babylon api is stable this approach enables faster iteration than publishing +wasm blobs from bindings library directly. + + +## Artifacts + +We are storing current version of artifacts in repo to speed up the CI. +In principle we could use rust-optimizer in each run to build contract from sources but it would take longer +time. +Downside of this approach is than with each update of `Cargo.toml` or `lib.rs` file +wasm blobs should be regenerated by running `make build-test-wasm` command diff --git a/wasmbinding/testdata/artifacts/checksums.txt b/wasmbinding/testdata/artifacts/checksums.txt new file mode 100644 index 000000000..a7fccc780 --- /dev/null +++ b/wasmbinding/testdata/artifacts/checksums.txt @@ -0,0 +1,2 @@ +cb5724a467b45181e187768e942c0e9badaf6953fae2f5b403e61ef696d11167 testdata-aarch64.wasm +29bb4c2ef5e142e32a999132d7245ba7eae385091bd5e5fc2cd0bb818ae2539e testdata.wasm diff --git a/wasmbinding/testdata/artifacts/checksums_intermediate.txt b/wasmbinding/testdata/artifacts/checksums_intermediate.txt new file mode 100644 index 000000000..962182268 --- /dev/null +++ b/wasmbinding/testdata/artifacts/checksums_intermediate.txt @@ -0,0 +1 @@ +16e2b22ad2769ae68243d509a88925d0bdcbf9ba916df6c357f9acfc97365984 ./target/wasm32-unknown-unknown/release/testdata.wasm diff --git a/wasmbinding/testdata/artifacts/testdata-aarch64.wasm b/wasmbinding/testdata/artifacts/testdata-aarch64.wasm new file mode 100644 index 000000000..2379ef56f Binary files /dev/null and b/wasmbinding/testdata/artifacts/testdata-aarch64.wasm differ diff --git a/wasmbinding/testdata/artifacts/testdata.wasm b/wasmbinding/testdata/artifacts/testdata.wasm new file mode 100644 index 000000000..75ff0e9c0 Binary files /dev/null and b/wasmbinding/testdata/artifacts/testdata.wasm differ diff --git a/wasmbinding/testdata/src/lib.rs b/wasmbinding/testdata/src/lib.rs new file mode 100644 index 000000000..96149e55e --- /dev/null +++ b/wasmbinding/testdata/src/lib.rs @@ -0,0 +1,4 @@ +use babylon_example::contract; + +pub use contract::instantiate; +pub use contract::query; diff --git a/wasmbinding/wasm.go b/wasmbinding/wasm.go new file mode 100644 index 000000000..41e78cff5 --- /dev/null +++ b/wasmbinding/wasm.go @@ -0,0 +1,174 @@ +package wasmbinding + +import ( + "encoding/json" + "fmt" + + errorsmod "cosmossdk.io/errors" + "github.com/CosmWasm/wasmd/x/wasm" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" + wasmvmtypes "github.com/CosmWasm/wasmvm/types" + bbn "github.com/babylonchain/babylon/types" + "github.com/babylonchain/babylon/wasmbinding/bindings" + lcKeeper "github.com/babylonchain/babylon/x/btclightclient/keeper" + epochingkeeper "github.com/babylonchain/babylon/x/epoching/keeper" + zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type QueryPlugin struct { + epochingKeeper *epochingkeeper.Keeper + zcKeeper *zckeeper.Keeper + lcKeeper *lcKeeper.Keeper +} + +// NewQueryPlugin returns a reference to a new QueryPlugin. +func NewQueryPlugin( + ek *epochingkeeper.Keeper, + zcKeeper *zckeeper.Keeper, + lcKeeper *lcKeeper.Keeper, +) *QueryPlugin { + return &QueryPlugin{ + epochingKeeper: ek, + zcKeeper: zcKeeper, + lcKeeper: lcKeeper, + } +} + +// CustomQuerier dispatches custom CosmWasm bindings queries. +func CustomQuerier(qp *QueryPlugin) func(ctx sdk.Context, request json.RawMessage) ([]byte, error) { + return func(ctx sdk.Context, request json.RawMessage) ([]byte, error) { + var contractQuery bindings.BabylonQuery + if err := json.Unmarshal(request, &contractQuery); err != nil { + return nil, errorsmod.Wrap(err, "failed to unarshall request ") + } + + switch { + case contractQuery.Epoch != nil: + epoch := qp.epochingKeeper.GetEpoch(ctx) + res := bindings.CurrentEpochResponse{ + Epoch: epoch.EpochNumber, + } + + bz, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed marshaling") + } + + return bz, nil + case contractQuery.LatestFinalizedEpochInfo != nil: + epoch, err := qp.zcKeeper.GetFinalizedEpoch(ctx) + + if err != nil { + return nil, err + } + + epochInfo, err := qp.epochingKeeper.GetHistoricalEpoch(ctx, epoch) + + if err != nil { + // Here something went really wrong with our data model. If epoch is finalized + // it should always be known by epoching module + panic(fmt.Sprintf("Finalized epoch %d not known by epoching module", epoch)) + } + + res := bindings.LatestFinalizedEpochInfoResponse{ + EpochInfo: &bindings.FinalizedEpochInfo{ + EpochNumber: epoch, + LastBlockHeight: epochInfo.GetLastBlockHeight(), + }, + } + + bz, err := json.Marshal(res) + if err != nil { + return nil, errorsmod.Wrap(err, "failed marshaling") + } + + return bz, nil + case contractQuery.BtcTip != nil: + tip := qp.lcKeeper.GetTipInfo(ctx) + if tip == nil { + return nil, fmt.Errorf("no tip info found") + } + + res := bindings.BtcTipResponse{ + HeaderInfo: bindings.AsBtcBlockHeaderInfo(tip), + } + + bz, err := json.Marshal(res) + + if err != nil { + return nil, errorsmod.Wrap(err, "failed marshaling") + } + + return bz, nil + case contractQuery.BtcBaseHeader != nil: + baseHeader := qp.lcKeeper.GetBaseBTCHeader(ctx) + + if baseHeader == nil { + return nil, fmt.Errorf("no base header found") + } + + res := bindings.BtcBaseHeaderResponse{ + HeaderInfo: bindings.AsBtcBlockHeaderInfo(baseHeader), + } + + bz, err := json.Marshal(res) + + if err != nil { + return nil, errorsmod.Wrap(err, "failed marshaling") + } + + return bz, nil + case contractQuery.BtcHeaderByHash != nil: + headerHash, err := bbn.NewBTCHeaderHashBytesFromHex(contractQuery.BtcHeaderByHash.Hash) + + if err != nil { + return nil, errorsmod.Wrap(err, "failed to parse header hash") + } + + headerInfo := qp.lcKeeper.GetHeaderByHash(ctx, &headerHash) + + res := bindings.BtcHeaderQueryResponse{ + HeaderInfo: bindings.AsBtcBlockHeaderInfo(headerInfo), + } + bz, err := json.Marshal(res) + + if err != nil { + return nil, errorsmod.Wrap(err, "failed marshaling") + } + + return bz, nil + case contractQuery.BtcHeaderByHeight != nil: + headerInfo := qp.lcKeeper.GetHeaderByHeight(ctx, contractQuery.BtcHeaderByHeight.Height) + + res := bindings.BtcHeaderQueryResponse{ + HeaderInfo: bindings.AsBtcBlockHeaderInfo(headerInfo), + } + bz, err := json.Marshal(res) + + if err != nil { + return nil, errorsmod.Wrap(err, "failed marshaling") + } + + return bz, nil + default: + return nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown babylon query variant"} + } + } +} + +func RegisterCustomPlugins( + ek *epochingkeeper.Keeper, + zcKeeper *zckeeper.Keeper, + lcKeeper *lcKeeper.Keeper, +) []wasmkeeper.Option { + wasmQueryPlugin := NewQueryPlugin(ek, zcKeeper, lcKeeper) + + queryPluginOpt := wasmkeeper.WithQueryPlugins(&wasmkeeper.QueryPlugins{ + Custom: CustomQuerier(wasmQueryPlugin), + }) + + return []wasm.Option{ + queryPluginOpt, + } +} diff --git a/x/btccheckpoint/abci.go b/x/btccheckpoint/abci.go new file mode 100644 index 000000000..34136c669 --- /dev/null +++ b/x/btccheckpoint/abci.go @@ -0,0 +1,16 @@ +package btccheckpoint + +import ( + "github.com/babylonchain/babylon/x/btccheckpoint/keeper" + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// EndBlocker checks if during block execution btc light client head had been +// updated. If the head had been updated, status of all available checkpoints +// is checked to determine if any of them became confirmed/finalized/abandonded. +func EndBlocker(ctx sdk.Context, k keeper.Keeper, req abci.RequestEndBlock) { + if k.BtcLightClientUpdated(ctx) { + k.OnTipChange(ctx) + } +} diff --git a/x/btccheckpoint/genesis.go b/x/btccheckpoint/genesis.go index c74293d2e..a5246537b 100644 --- a/x/btccheckpoint/genesis.go +++ b/x/btccheckpoint/genesis.go @@ -9,7 +9,10 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) + // set params for this module + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } } // ExportGenesis returns the capability module's exported genesis. diff --git a/x/btccheckpoint/genesis_test.go b/x/btccheckpoint/genesis_test.go index 61bdb1227..da1d512d9 100644 --- a/x/btccheckpoint/genesis_test.go +++ b/x/btccheckpoint/genesis_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/babylonchain/babylon/x/btccheckpoint" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" simapp "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/x/btccheckpoint/types" @@ -15,7 +15,10 @@ func TestExportGenesis(t *testing.T) { app := simapp.Setup(t, false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - app.BtcCheckpointKeeper.SetParams(ctx, types.DefaultParams()) + if err := app.BtcCheckpointKeeper.SetParams(ctx, types.DefaultParams()); err != nil { + panic(err) + } + genesisState := btccheckpoint.ExportGenesis(ctx, app.BtcCheckpointKeeper) require.Equal(t, genesisState.Params, types.DefaultParams()) } @@ -26,12 +29,13 @@ func TestInitGenesis(t *testing.T) { genesisState := types.GenesisState{ Params: types.Params{ - BtcConfirmationDepth: 999, - CheckpointFinalizationTimeout: 888, + BtcConfirmationDepth: 888, + CheckpointFinalizationTimeout: 999, + CheckpointTag: types.DefaultCheckpointTag, }, } btccheckpoint.InitGenesis(ctx, app.BtcCheckpointKeeper, genesisState) - require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).BtcConfirmationDepth, uint64(999)) - require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).CheckpointFinalizationTimeout, uint64(888)) + require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).BtcConfirmationDepth, uint64(888)) + require.Equal(t, app.BtcCheckpointKeeper.GetParams(ctx).CheckpointFinalizationTimeout, uint64(999)) } diff --git a/x/btccheckpoint/handler.go b/x/btccheckpoint/handler.go deleted file mode 100644 index 4882127c9..000000000 --- a/x/btccheckpoint/handler.go +++ /dev/null @@ -1,23 +0,0 @@ -package btccheckpoint - -import ( - "fmt" - - "github.com/babylonchain/babylon/x/btccheckpoint/keeper" - "github.com/babylonchain/babylon/x/btccheckpoint/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - - switch msg := msg.(type) { - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/btccheckpoint/keeper/grpc_query.go b/x/btccheckpoint/keeper/grpc_query.go index 3b1834d51..19c038344 100644 --- a/x/btccheckpoint/keeper/grpc_query.go +++ b/x/btccheckpoint/keeper/grpc_query.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "math" "github.com/babylonchain/babylon/x/btccheckpoint/types" "github.com/cosmos/cosmos-sdk/store/prefix" @@ -16,75 +15,28 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) lowestBtcHeightAndHash(ctx sdk.Context, subKey *types.SubmissionKey) (uint64, []byte, error) { - // initializing to max, as then every header height will be smaller - var lowestHeaderNumber uint64 = math.MaxUint64 - var lowestHeaderHash []byte +func (k Keeper) getCheckpointInfo(ctx sdk.Context, epochNum uint64, epochData *types.EpochData) (*types.BTCCheckpointInfo, error) { + bestSubmission := k.GetEpochBestSubmissionBtcInfo(ctx, epochData) - for _, tk := range subKey.Key { - - if !k.CheckHeaderIsOnMainChain(ctx, tk.Hash) { - return 0, nil, errors.New("one of submission headers not on main chain") - } - - headerNumber, err := k.GetBlockHeight(ctx, tk.Hash) - - if err != nil { - // CheckHeaderIsOnMainChain (which uses main chain depth) returned true which - // means header should be saved and we should know its heigh but GetBlockHeight - // returned error. Something is really bad, panic. - panic("Inconsistent data model in btc light client") - } - - if headerNumber < lowestHeaderNumber { - lowestHeaderNumber = headerNumber - lowestHeaderHash = *tk.Hash - } - } - - return lowestHeaderNumber, lowestHeaderHash, nil -} - -func (k Keeper) getCheckpointInfo(ctx sdk.Context, epochNum uint64, subKeys []*types.SubmissionKey) (*types.BTCCheckpointInfo, error) { - if len(subKeys) == 0 { - return nil, errors.New("empty subKeys") - } - - info := types.BTCCheckpointInfo{ - EpochNumber: epochNum, - EarliestBtcBlockNumber: math.MaxUint64, // initializing to max, as then every header height will be smaller - VigilanteAddressList: []*types.CheckpointAddresses{}, + if bestSubmission == nil { + return nil, errors.New("checkpoint for given epoch not yet submitted") } - for _, subKey := range subKeys { - headerNumber, headerHash, err := k.lowestBtcHeightAndHash(ctx, subKey) - if err != nil { - // submission is not valid for some reason, ignore it - continue - } + bestSubmissionHeight, err := k.GetBlockHeight(ctx, &bestSubmission.YoungestBlockHash) - // get vigilante address - sd := k.GetSubmissionData(ctx, *subKey) - if sd == nil { - // submission is not valid for some reason, ignore it - continue - } - - // ensure lowest header number and hash - if headerNumber < info.EarliestBtcBlockNumber { - info.EarliestBtcBlockNumber = headerNumber - info.EarliestBtcBlockHash = headerHash - } - // append vigilante addresses - vAddrs := *sd.VigilanteAddresses // make a new copy - info.VigilanteAddressList = append(info.VigilanteAddressList, &vAddrs) + if err != nil { + return nil, fmt.Errorf("error getting best submission height: %w", err) } - if info.EarliestBtcBlockNumber == math.MaxUint64 { - return nil, errors.New("there is no valid submission for given raw checkpoint") - } + bestSubmissionData := k.GetSubmissionData(ctx, bestSubmission.SubmissionKey) - return &info, nil + return &types.BTCCheckpointInfo{ + EpochNumber: epochNum, + BestSubmissionBtcBlockHeight: bestSubmissionHeight, + BestSubmissionBtcBlockHash: &bestSubmission.YoungestBlockHash, + BestSubmissionTransactions: bestSubmissionData.TxsInfo, + BestSubmissionVigilanteAddressList: []*types.CheckpointAddresses{bestSubmissionData.VigilanteAddresses}, + }, nil } func (k Keeper) BtcCheckpointInfo(c context.Context, req *types.QueryBtcCheckpointInfoRequest) (*types.QueryBtcCheckpointInfoResponse, error) { @@ -96,14 +48,10 @@ func (k Keeper) BtcCheckpointInfo(c context.Context, req *types.QueryBtcCheckpoi checkpointEpoch := req.GetEpochNum() - epochData := k.GetEpochData(ctx, checkpointEpoch) + ed := k.GetEpochData(ctx, checkpointEpoch) - // Check if we have any submission for given epoch - if epochData == nil || len(epochData.Key) == 0 { - return nil, errors.New("checkpoint for given epoch not yet submitted") - } + ckptInfo, err := k.getCheckpointInfo(ctx, checkpointEpoch, ed) - ckptInfo, err := k.getCheckpointInfo(ctx, checkpointEpoch, epochData.Key) if err != nil { return nil, fmt.Errorf("failed to get lowest BTC height and hash in keys of epoch %d: %w", req.EpochNum, err) } @@ -121,19 +69,6 @@ func (k Keeper) BtcCheckpointsInfo(c context.Context, req *types.QueryBtcCheckpo ctx := sdk.UnwrapSDKContext(c) - // parse start_epoch and end_epoch and forward to the pagination request - if req.EndEpoch > 0 { - // this query uses start_epoch and end_epoch to specify range - if req.StartEpoch > req.EndEpoch { - return nil, fmt.Errorf("StartEpoch (%d) should not be larger than EndEpoch (%d)", req.StartEpoch, req.EndEpoch) - } - req.Pagination = &query.PageRequest{ - Key: sdk.Uint64ToBigEndian(req.StartEpoch), - Limit: req.EndEpoch - req.StartEpoch + 1, - Reverse: false, - } - } - store := ctx.KVStore(k.storeKey) epochDataStore := prefix.NewStore(store, types.EpochDataPrefix) @@ -144,16 +79,11 @@ func (k Keeper) BtcCheckpointsInfo(c context.Context, req *types.QueryBtcCheckpo var epochData types.EpochData k.cdc.MustUnmarshal(value, &epochData) - // Check if we have any submission for given epoch - if len(epochData.Key) == 0 { - return errors.New("checkpoint for given epoch not yet submitted") - } + ckptInfo, err := k.getCheckpointInfo(ctx, epochNum, &epochData) - ckptInfo, err := k.getCheckpointInfo(ctx, epochNum, epochData.Key) if err != nil { return fmt.Errorf("failed to get lowest BTC height and hash in keys of epoch %d: %w", epochNum, err) } - // append ckpt info ckptInfoList = append(ckptInfoList, ckptInfo) diff --git a/x/btccheckpoint/keeper/grpc_query_params_test.go b/x/btccheckpoint/keeper/grpc_query_params_test.go index 31d8af6a0..ac8e19de5 100644 --- a/x/btccheckpoint/keeper/grpc_query_params_test.go +++ b/x/btccheckpoint/keeper/grpc_query_params_test.go @@ -20,7 +20,7 @@ func FuzzParamsQuery(f *testing.F) { f.Add(uint64(22222), uint64(12333), int64(101)) f.Fuzz(func(t *testing.T, btcConfirmationDepth uint64, checkpointFinalizationTimeout uint64, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // params generated by fuzzer params := types.DefaultParams() @@ -32,7 +32,7 @@ func FuzzParamsQuery(f *testing.F) { if btcConfirmationDepth == 0 { // validation should not pass with zero EpochInterval require.Error(t, params.Validate()) - params.BtcConfirmationDepth = uint64(rand.Int()) + params.BtcConfirmationDepth = uint64(r.Int()) } // test the case of CheckpointFinalizationTimeout == 0 @@ -40,16 +40,27 @@ func FuzzParamsQuery(f *testing.F) { if checkpointFinalizationTimeout == 0 { // validation should not pass with zero EpochInterval require.Error(t, params.Validate()) - params.CheckpointFinalizationTimeout = uint64(rand.Int()) + params.CheckpointFinalizationTimeout = uint64(r.Int()) + } + + if btcConfirmationDepth >= checkpointFinalizationTimeout { + // validation should not pass with BtcConfirmationDepth >= CheckpointFinalizationTimeout + require.Error(t, params.Validate()) + + // swap the values so we can continue the test + params.CheckpointFinalizationTimeout = btcConfirmationDepth + params.BtcConfirmationDepth = checkpointFinalizationTimeout } keeper, ctx := testkeeper.NewBTCCheckpointKeeper(t, nil, nil, nil) wctx := sdk.WrapSDKContext(ctx) // if setParamsFlag == 0, set params - setParamsFlag := rand.Intn(2) + setParamsFlag := r.Intn(2) if setParamsFlag == 0 { - keeper.SetParams(ctx, params) + if err := keeper.SetParams(ctx, params); err != nil { + panic(err) + } } req := types.QueryParamsRequest{} resp, err := keeper.Params(wctx, &req) diff --git a/x/btccheckpoint/keeper/hooks.go b/x/btccheckpoint/keeper/hooks.go index c70d2654d..126e49fbd 100644 --- a/x/btccheckpoint/keeper/hooks.go +++ b/x/btccheckpoint/keeper/hooks.go @@ -21,11 +21,11 @@ var _ HandledHooks = Hooks{} func (k Keeper) Hooks() Hooks { return Hooks{k} } func (h Hooks) AfterBTCRollBack(ctx sdk.Context, headerInfo *ltypes.BTCHeaderInfo) { - h.k.OnTipChange(ctx) + h.k.setBtcLightClientUpdated(ctx) } func (h Hooks) AfterBTCRollForward(ctx sdk.Context, headerInfo *ltypes.BTCHeaderInfo) { - h.k.OnTipChange(ctx) + h.k.setBtcLightClientUpdated(ctx) } func (h Hooks) AfterBTCHeaderInserted(ctx sdk.Context, headerInfo *ltypes.BTCHeaderInfo) {} diff --git a/x/btccheckpoint/keeper/keeper.go b/x/btccheckpoint/keeper/keeper.go index d49b87b1c..10753584a 100644 --- a/x/btccheckpoint/keeper/keeper.go +++ b/x/btccheckpoint/keeper/keeper.go @@ -1,6 +1,7 @@ package keeper import ( + "encoding/hex" "fmt" "math" "math/big" @@ -8,24 +9,23 @@ import ( txformat "github.com/babylonchain/babylon/btctxformatter" bbn "github.com/babylonchain/babylon/types" "github.com/babylonchain/babylon/x/btccheckpoint/types" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/libs/log" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace - btcLightClientKeeper types.BTCLightClientKeeper - checkpointingKeeper types.CheckpointingKeeper - powLimit *big.Int - expectedCheckpointTag txformat.BabylonTag + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + tstoreKey storetypes.StoreKey + memKey storetypes.StoreKey + btcLightClientKeeper types.BTCLightClientKeeper + checkpointingKeeper types.CheckpointingKeeper + powLimit *big.Int + authority string } submissionBtcError string @@ -60,27 +60,23 @@ const ( func NewKeeper( cdc codec.BinaryCodec, storeKey, + tstoreKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, bk types.BTCLightClientKeeper, ck types.CheckpointingKeeper, powLimit *big.Int, - expectedTag txformat.BabylonTag, + authority string, ) Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - btcLightClientKeeper: bk, - checkpointingKeeper: ck, - powLimit: powLimit, - expectedCheckpointTag: expectedTag, + cdc: cdc, + storeKey: storeKey, + tstoreKey: tstoreKey, + memKey: memKey, + btcLightClientKeeper: bk, + checkpointingKeeper: ck, + powLimit: powLimit, + authority: authority, } } @@ -88,8 +84,20 @@ func (k Keeper) GetPowLimit() *big.Int { return k.powLimit } -func (k Keeper) GetExpectedTag() txformat.BabylonTag { - return k.expectedCheckpointTag +// GetExpectedTag retrerieves checkpoint tag from params and decodes it from +// hex string to bytes. +// NOTE: keeper could probably cache decoded tag, but it is rather improbable this function +// will ever be a bottleneck so it is not worth it. +func (k Keeper) GetExpectedTag(ctx sdk.Context) txformat.BabylonTag { + tag := k.GetParams(ctx).CheckpointTag + + tagAsBytes, err := hex.DecodeString(tag) + + if err != nil { + panic("Tag should always be valid") + } + + return txformat.BabylonTag(tagAsBytes) } func (k Keeper) Logger(ctx sdk.Context) log.Logger { @@ -100,11 +108,6 @@ func (k Keeper) GetBlockHeight(ctx sdk.Context, b *bbn.BTCHeaderHashBytes) (uint return k.btcLightClientKeeper.BlockHeight(ctx, b) } -func (k Keeper) CheckHeaderIsOnMainChain(ctx sdk.Context, hash *bbn.BTCHeaderHashBytes) bool { - depth, err := k.btcLightClientKeeper.MainChainDepth(ctx, hash) - return err == nil && depth >= 0 -} - func (k Keeper) headerDepth(ctx sdk.Context, headerHash *bbn.BTCHeaderHashBytes) (uint64, error) { blockDepth, err := k.btcLightClientKeeper.MainChainDepth(ctx, headerHash) @@ -134,34 +137,60 @@ func (k Keeper) checkSubmissionStatus(ctx sdk.Context, info *types.SubmissionBtc func (k Keeper) GetSubmissionBtcInfo(ctx sdk.Context, sk types.SubmissionKey) (*types.SubmissionBtcInfo, error) { - var lowest uint64 = math.MaxUint64 - var highest uint64 = uint64(0) - var lowestIndestInMostFreshBlock uint32 = math.MaxUint32 + var youngestBlockDepth uint64 = math.MaxUint64 + var youngestBlockHash *bbn.BTCHeaderHashBytes + + var lowestIndexInMostFreshBlock uint32 = math.MaxUint32 + + var oldestBlockDepth uint64 = uint64(0) for _, tk := range sk.Key { - d, err := k.headerDepth(ctx, tk.Hash) + currentBlockDepth, err := k.headerDepth(ctx, tk.Hash) if err != nil { return nil, err } - if d <= lowest { - lowest = d - if tk.Index < lowestIndestInMostFreshBlock { - lowestIndestInMostFreshBlock = tk.Index - } + if currentBlockDepth < youngestBlockDepth { + youngestBlockDepth = currentBlockDepth + lowestIndexInMostFreshBlock = tk.Index + youngestBlockHash = tk.Hash } - if d > highest { - highest = d + // This case happens when we have two submissions in the same block. + if currentBlockDepth == youngestBlockDepth && tk.Index < lowestIndexInMostFreshBlock { + // This is something which needs a bit more careful thinking as it is used + // to determine which submission is better. + // Currently if two submissions of one checkpoint are in the same block, + // we pick tx with lower index as the point at which checkpoint happened. + // This is in line with the logic that if two submission are in the same block, + // they are esentially happening at the same time, so it does not really matter + // which index pick, and for possibble tie breaks it is better to pick lower one. + // This means in case when we have: + // Checkpoint submission `x` for epoch 5, both tx in same block at height 100, with indexes 1 and 10 + // and + // Checkpoint submission `y` for epoch 5, both tx in same block at height 100, with indexes 3 and 9 + // we will chose submission `x` as the better one. + // This good enough solution, but it is not perfect and leads to some edge cases like: + // Checkpoint submission `x` for epoch 5, one tx in block 99 with index 1, and second tx in block 100 with index 4 + // and + // Checkpoint submission `y` for epoch 5, both tx in same block at height 100, with indexes 3 and 9 + // In this case submission `y` will be better as it `earliest` tx in most fresh block is first. But at first glance + // submission `x` seems better. + lowestIndexInMostFreshBlock = tk.Index + } + + if currentBlockDepth > oldestBlockDepth { + oldestBlockDepth = currentBlockDepth } } return &types.SubmissionBtcInfo{ - SubmissionKey: sk, - OldestBlockDepth: highest, - YoungestBlockDepth: lowest, - LatestTxIndex: lowestIndestInMostFreshBlock, + SubmissionKey: sk, + OldestBlockDepth: oldestBlockDepth, + YoungestBlockDepth: youngestBlockDepth, + YoungestBlockHash: *youngestBlockHash, + YoungestBlockLowestTxIdx: lowestIndexInMostFreshBlock, }, nil } @@ -203,6 +232,35 @@ func (k Keeper) GetBestSubmission(ctx sdk.Context, epochNumber uint64) (types.Bt return ed.Status, bestSubmissionKey, nil } +func (k Keeper) GetEpochBestSubmissionBtcInfo(ctx sdk.Context, ed *types.EpochData) *types.SubmissionBtcInfo { + // there is no submissions for this epoch, so transitivly there is no best submission + if ed == nil || len(ed.Key) == 0 { + return nil + } + + // There is only one submission for this epoch: + // - either epoch is already finalized and we already chosen the best submission + // - or we only received one submission for this epoch + // Either way, we do not need to decide which submission is the best one. + if len(ed.Key) == 1 { + sk := *ed.Key[0] + btcInfo, err := k.GetSubmissionBtcInfo(ctx, sk) + + if err != nil { + k.Logger(ctx).Debug("Previously stored submission is not valid anymore. Submission key: %+v", sk) + } + + // we only log error, as the only error which we can receive here is that submission + // is not longer on btc canoncial chain, which essentially means that there is no valid submission + return btcInfo + } + + // We have more that one valid submission. We need to chose the best one. + epochSummary := k.getEpochChanges(ctx, nil, ed) + + return epochSummary.EpochBestSubmission +} + // 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 @@ -326,8 +384,8 @@ func (k Keeper) deleteSubmission(ctx sdk.Context, sk types.SubmissionKey) { store.Delete(kBytes) } -// GetSubmissionData return submission data for given key, return nil if there is not data -// under givem key +// GetSubmissionData returns submission data for a given key or nil if there is no data +// under the given key func (k Keeper) GetSubmissionData(ctx sdk.Context, sk types.SubmissionKey) *types.SubmissionData { store := ctx.KVStore(k.storeKey) kBytes := types.PrefixedSubmisionKey(k.cdc, &sk) @@ -342,11 +400,26 @@ func (k Keeper) GetSubmissionData(ctx sdk.Context, sk types.SubmissionKey) *type return &sd } -// Callback to be called when btc light client tip change +// Callback to be called when btc light client tip changes func (k Keeper) OnTipChange(ctx sdk.Context) { k.checkCheckpoints(ctx) } +func (k Keeper) setBtcLightClientUpdated(ctx sdk.Context) { + store := ctx.TransientStore(k.tstoreKey) + store.Set(types.GetBtcLightClientUpdatedKey(), []byte{1}) +} + +// BtcLightClientUpdated checks if btc light client was updated during block execution +func (k Keeper) BtcLightClientUpdated(ctx sdk.Context) bool { + // transient store is cleared after each block execution, therfore if + // BtcLightClientKey is set, it means setBtcLightClientUpdated was called during + // current block execution + store := ctx.TransientStore(k.tstoreKey) + lcUpdated := store.Get(types.GetBtcLightClientUpdatedKey()) + return len(lcUpdated) > 0 +} + func (k Keeper) getLastFinalizedEpochNumber(ctx sdk.Context) uint64 { store := ctx.KVStore(k.storeKey) epoch := store.Get(types.GetLatestFinalizedEpochKey()) @@ -574,10 +647,11 @@ func (k Keeper) checkCheckpoints(ctx sdk.Context) { if i != epochChanges.BestSubmissionIdx { k.deleteSubmission(ctx, *sk) } - currentEpoch.Key = []*types.SubmissionKey{&epochChanges.EpochBestSubmission.SubmissionKey} } + // leave only best submission key + currentEpoch.Key = []*types.SubmissionKey{&epochChanges.EpochBestSubmission.SubmissionKey} } else { - // applay changes to epoch according to changes + // apply changes to epoch according to changes for _, sk := range epochChanges.SubmissionsToDelete { k.deleteSubmission(ctx, *sk) } diff --git a/x/btccheckpoint/keeper/keeper_test.go b/x/btccheckpoint/keeper/keeper_test.go new file mode 100644 index 000000000..97a360232 --- /dev/null +++ b/x/btccheckpoint/keeper/keeper_test.go @@ -0,0 +1,125 @@ +package keeper_test + +import ( + "math/rand" + "testing" + "time" + + "github.com/babylonchain/babylon/testutil/datagen" + "github.com/babylonchain/babylon/x/btccheckpoint/types" + "github.com/stretchr/testify/require" +) + +func TestKeeper_GetSubmissionBtcInfo(t *testing.T) { + type TxKeyDesc struct { + TxIdx uint32 + Depth uint64 + } + + type args struct { + Key1 TxKeyDesc + Key2 TxKeyDesc + } + + tests := []struct { + name string + args args + expectedYoungestBlockDepth uint64 + expectedTxIndex uint32 + expectedOldestBlockDepth uint64 + }{ + {"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}, + {"Second header older. TxIndex larger in older header.", args{TxKeyDesc{TxIdx: 1, Depth: 0}, TxKeyDesc{TxIdx: 5, Depth: 10}}, 0, 1, 10}, + {"Second header older. TxIndex larger in younger header.", args{TxKeyDesc{TxIdx: 5, Depth: 0}, TxKeyDesc{TxIdx: 1, Depth: 10}}, 0, 5, 10}, + {"Same block. TxIndex larger in first transaction key.", args{TxKeyDesc{TxIdx: 5, Depth: 10}, TxKeyDesc{TxIdx: 1, Depth: 10}}, 10, 1, 10}, + {"Same block. TxIndex larger in second transaction key.", args{TxKeyDesc{TxIdx: 1, Depth: 10}, TxKeyDesc{TxIdx: 5, Depth: 10}}, 10, 1, 10}, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + r := rand.New(rand.NewSource(time.Now().Unix())) + + k := InitTestKeepers(t) + + hash1 := datagen.GenRandomBTCHeaderPrevBlock(r) + hash2 := datagen.GenRandomBTCHeaderPrevBlock(r) + + sk := types.SubmissionKey{Key: []*types.TransactionKey{ + {Index: tt.args.Key1.TxIdx, Hash: hash1}, + {Index: tt.args.Key2.TxIdx, Hash: hash2}, + }} + + k.BTCLightClient.SetDepth(hash1, int64(tt.args.Key1.Depth)) + k.BTCLightClient.SetDepth(hash2, int64(tt.args.Key2.Depth)) + + info, err := k.BTCCheckpoint.GetSubmissionBtcInfo(k.SdkCtx, sk) + + require.NoError(t, err) + + require.Equal(t, info.YoungestBlockDepth, tt.expectedYoungestBlockDepth, tt.name) + require.Equal(t, info.YoungestBlockLowestTxIdx, tt.expectedTxIndex, tt.name) + require.Equal(t, info.OldestBlockDepth, tt.expectedOldestBlockDepth, tt.name) + }) + } +} + +func FuzzGetSubmissionBtcInfo(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 10) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + + depth1 := r.Uint32() + txidx1 := r.Uint32() + depth2 := r.Uint32() + txidx2 := r.Uint32() + + if txidx1 == txidx2 { + // transaction indexes must be different to cover the case where transactions are + // in the same block. + txidx1 = txidx1 + 1 + } + + k := InitTestKeepers(t) + + hash1 := datagen.GenRandomBTCHeaderPrevBlock(r) + hash2 := datagen.GenRandomBTCHeaderPrevBlock(r) + + sk := types.SubmissionKey{Key: []*types.TransactionKey{ + {Index: txidx1, Hash: hash1}, + {Index: txidx2, Hash: hash2}, + }} + + k.BTCLightClient.SetDepth(hash1, int64(depth1)) + k.BTCLightClient.SetDepth(hash2, int64(depth2)) + + info, err := k.BTCCheckpoint.GetSubmissionBtcInfo(k.SdkCtx, sk) + require.NoError(t, err) + + var expectedOldestDepth uint64 + var expectedYoungestDepth uint64 + var expectedTxIdx uint32 + + if depth1 > depth2 { + expectedOldestDepth = uint64(depth1) + expectedYoungestDepth = uint64(depth2) + expectedTxIdx = txidx2 + } else if depth1 < depth2 { + expectedOldestDepth = uint64(depth2) + expectedYoungestDepth = uint64(depth1) + expectedTxIdx = txidx1 + } else { + if txidx1 > txidx2 { + expectedTxIdx = txidx2 + } else { + expectedTxIdx = txidx1 + } + expectedOldestDepth = uint64(depth1) + expectedYoungestDepth = uint64(depth1) + } + + require.Equal(t, info.YoungestBlockDepth, expectedYoungestDepth) + require.Equal(t, info.YoungestBlockLowestTxIdx, expectedTxIdx) + require.Equal(t, info.OldestBlockDepth, expectedOldestDepth) + }) +} diff --git a/x/btccheckpoint/keeper/msg_server.go b/x/btccheckpoint/keeper/msg_server.go index 69ae6e0d3..08906227e 100644 --- a/x/btccheckpoint/keeper/msg_server.go +++ b/x/btccheckpoint/keeper/msg_server.go @@ -3,8 +3,10 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" "github.com/babylonchain/babylon/x/btccheckpoint/types" sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) var _ types.MsgServer = msgServer{} @@ -23,15 +25,16 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { // TODO emit some events for external consumers. Those should be probably emited // at EndBlockerCallback func (m msgServer) InsertBTCSpvProof(ctx context.Context, req *types.MsgInsertBTCSpvProof) (*types.MsgInsertBTCSpvProofResponse, error) { - rawSubmission, err := types.ParseSubmission(req, m.k.GetPowLimit(), m.k.GetExpectedTag()) + + // Get the SDK wrapped context + sdkCtx := sdk.UnwrapSDKContext(ctx) + + rawSubmission, err := types.ParseSubmission(req, m.k.GetPowLimit(), m.k.GetExpectedTag(sdkCtx)) if err != nil { return nil, types.ErrInvalidCheckpointProof.Wrap(err.Error()) } - // Get the SDK wrapped context - sdkCtx := sdk.UnwrapSDKContext(ctx) - submissionKey := rawSubmission.GetSubmissionKey() if m.k.SubmissionExists(sdkCtx, submissionKey) { @@ -91,3 +94,17 @@ func (m msgServer) InsertBTCSpvProof(ctx context.Context, req *types.MsgInsertBT return &types.MsgInsertBTCSpvProofResponse{}, nil } + +// UpdateParams updates the params. +func (ms msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if ms.k.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := ms.k.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/btccheckpoint/keeper/msg_server_test.go b/x/btccheckpoint/keeper/msg_server_test.go index d473af083..b621d444b 100644 --- a/x/btccheckpoint/keeper/msg_server_test.go +++ b/x/btccheckpoint/keeper/msg_server_test.go @@ -3,10 +3,13 @@ package keeper_test import ( "bytes" "context" + "math" "math/rand" "testing" "time" + "github.com/babylonchain/babylon/testutil/datagen" + dg "github.com/babylonchain/babylon/testutil/datagen" keepertest "github.com/babylonchain/babylon/testutil/keeper" bbn "github.com/babylonchain/babylon/types" @@ -81,13 +84,13 @@ func (k *TestKeepers) onTipChange() { } func TestRejectDuplicatedSubmission(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) epoch := uint64(1) - raw, _ := dg.RandomRawCheckpointDataForEpoch(epoch) + raw, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch) - blck1 := dg.CreateBlock(1, 7, 7, raw.FirstPart) + blck1 := dg.CreateBlock(r, 1, 7, 7, raw.FirstPart) - blck2 := dg.CreateBlock(2, 14, 3, raw.SecondPart) + blck2 := dg.CreateBlock(r, 2, 14, 3, raw.SecondPart) tk := InitTestKeepers(t) @@ -116,12 +119,12 @@ func TestRejectDuplicatedSubmission(t *testing.T) { } func TestRejectUnknownToBtcLightClient(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) epoch := uint64(1) - raw, _ := dg.RandomRawCheckpointDataForEpoch(epoch) + raw, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch) - blck1 := dg.CreateBlock(1, 7, 7, raw.FirstPart) - blck2 := dg.CreateBlock(2, 14, 3, raw.SecondPart) + blck1 := dg.CreateBlock(r, 1, 7, 7, raw.FirstPart) + blck2 := dg.CreateBlock(r, 2, 14, 3, raw.SecondPart) tk := InitTestKeepers(t) @@ -140,12 +143,12 @@ func TestRejectUnknownToBtcLightClient(t *testing.T) { } func TestRejectSubmissionsNotOnMainchain(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) epoch := uint64(1) - raw, _ := dg.RandomRawCheckpointDataForEpoch(epoch) + raw, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch) - blck1 := dg.CreateBlock(1, 7, 7, raw.FirstPart) - blck2 := dg.CreateBlock(2, 14, 3, raw.SecondPart) + blck1 := dg.CreateBlock(r, 1, 7, 7, raw.FirstPart) + blck2 := dg.CreateBlock(r, 2, 14, 3, raw.SecondPart) tk := InitTestKeepers(t) @@ -177,11 +180,11 @@ func TestRejectSubmissionsNotOnMainchain(t *testing.T) { } func TestSubmitValidNewCheckpoint(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) epoch := uint64(1) - raw, rawBtcCheckpoint := dg.RandomRawCheckpointDataForEpoch(epoch) - blck1 := dg.CreateBlock(1, 7, 7, raw.FirstPart) - blck2 := dg.CreateBlock(2, 14, 3, raw.SecondPart) + raw, rawBtcCheckpoint := dg.RandomRawCheckpointDataForEpoch(r, epoch) + blck1 := dg.CreateBlock(r, 1, 7, 7, raw.FirstPart) + blck2 := dg.CreateBlock(r, 2, 14, 3, raw.SecondPart) // here we will only have valid unconfirmed submissions tk := InitTestKeepers(t) @@ -243,11 +246,11 @@ func TestSubmitValidNewCheckpoint(t *testing.T) { } func TestRejectSubmissionWithoutSubmissionsForPreviousEpoch(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) epoch := uint64(2) - raw, _ := dg.RandomRawCheckpointDataForEpoch(epoch) - blck1 := dg.CreateBlock(1, 7, 7, raw.FirstPart) - blck2 := dg.CreateBlock(2, 14, 3, raw.SecondPart) + raw, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch) + blck1 := dg.CreateBlock(r, 1, 7, 7, raw.FirstPart) + blck2 := dg.CreateBlock(r, 2, 14, 3, raw.SecondPart) // here we will only have valid unconfirmed submissions tk := InitTestKeepers(t) @@ -269,11 +272,11 @@ func TestRejectSubmissionWithoutSubmissionsForPreviousEpoch(t *testing.T) { } func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) epoch := uint64(1) - raw, _ := dg.RandomRawCheckpointDataForEpoch(epoch) - epoch1Block1 := dg.CreateBlock(1, 7, 7, raw.FirstPart) - epoch1Block2 := dg.CreateBlock(2, 14, 3, raw.SecondPart) + raw, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch) + epoch1Block1 := dg.CreateBlock(r, 1, 7, 7, raw.FirstPart) + epoch1Block2 := dg.CreateBlock(r, 2, 14, 3, raw.SecondPart) // here we will only have valid unconfirmed submissions tk := InitTestKeepers(t) @@ -288,9 +291,9 @@ func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T require.NoErrorf(t, err, "Unexpected message processing error: %v", err) epoch2 := uint64(2) - raw2, _ := dg.RandomRawCheckpointDataForEpoch(epoch2) - epoch2Block1 := dg.CreateBlock(1, 19, 2, raw2.FirstPart) - epoch2Block2 := dg.CreateBlock(2, 14, 7, raw2.SecondPart) + raw2, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch2) + epoch2Block1 := dg.CreateBlock(r, 1, 19, 2, raw2.FirstPart) + epoch2Block2 := dg.CreateBlock(r, 2, 14, 7, raw2.SecondPart) msg2 := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{epoch2Block1, epoch2Block2}) // Both headers are deeper than epoch 1 submission, fail @@ -343,40 +346,40 @@ func TestRejectSubmissionWithoutAncestorsOnMainchainInPreviousEpoch(t *testing.T } func TestClearChildEpochsWhenNoParenNotOnMainChain(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) tk := InitTestKeepers(t) - msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(1) + msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) tk.BTCLightClient.SetDepth(b1Hash(msg1), int64(5)) tk.BTCLightClient.SetDepth(b2Hash(msg1), int64(4)) _, err := tk.insertProofMsg(msg1) require.NoError(t, err, "failed to insert submission for epoch 1") - msg1a := dg.GenerateMessageWithRandomSubmitterForEpoch(1) + msg1a := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) tk.BTCLightClient.SetDepth(b1Hash(msg1a), int64(4)) tk.BTCLightClient.SetDepth(b2Hash(msg1a), int64(5)) _, err = tk.insertProofMsg(msg1a) require.NoError(t, err, "failed to insert submission for epoch 1") - msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(2) + msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 2) tk.BTCLightClient.SetDepth(b1Hash(msg2), int64(3)) tk.BTCLightClient.SetDepth(b2Hash(msg2), int64(2)) _, err = tk.insertProofMsg(msg2) require.NoError(t, err, "failed to insert submission for epoch 2") - msg2a := dg.GenerateMessageWithRandomSubmitterForEpoch(2) + msg2a := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 2) tk.BTCLightClient.SetDepth(b1Hash(msg2a), int64(3)) tk.BTCLightClient.SetDepth(b2Hash(msg2a), int64(2)) _, err = tk.insertProofMsg(msg2a) require.NoError(t, err, "failed to insert submission for epoch 2") - msg3 := dg.GenerateMessageWithRandomSubmitterForEpoch(3) + msg3 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 3) tk.BTCLightClient.SetDepth(b1Hash(msg3), int64(1)) tk.BTCLightClient.SetDepth(b2Hash(msg3), int64(0)) _, err = tk.insertProofMsg(msg3) require.NoError(t, err, "failed to insert submission for epoch 3") - msg3a := dg.GenerateMessageWithRandomSubmitterForEpoch(3) + msg3a := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 3) tk.BTCLightClient.SetDepth(b1Hash(msg3a), int64(1)) tk.BTCLightClient.SetDepth(b2Hash(msg3a), int64(0)) _, err = tk.insertProofMsg(msg3a) @@ -427,24 +430,24 @@ func TestClearChildEpochsWhenNoParenNotOnMainChain(t *testing.T) { } func TestLeaveOnlyBestSubmissionWhenEpochFinalized(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) tk := InitTestKeepers(t) defaultParams := btcctypes.DefaultParams() wDeep := defaultParams.CheckpointFinalizationTimeout - msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(1) + msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) tk.BTCLightClient.SetDepth(b1Hash(msg1), int64(1)) tk.BTCLightClient.SetDepth(b2Hash(msg1), int64(0)) _, err := tk.insertProofMsg(msg1) require.NoError(t, err, "failed to insert submission") - msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(1) + msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) tk.BTCLightClient.SetDepth(b1Hash(msg2), int64(1)) tk.BTCLightClient.SetDepth(b2Hash(msg2), int64(0)) _, err = tk.insertProofMsg(msg2) require.NoError(t, err, "failed to insert submission") - msg3 := dg.GenerateMessageWithRandomSubmitterForEpoch(1) + msg3 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) tk.BTCLightClient.SetDepth(b1Hash(msg3), int64(1)) tk.BTCLightClient.SetDepth(b2Hash(msg3), int64(0)) _, err = tk.insertProofMsg(msg3) @@ -476,18 +479,18 @@ func TestLeaveOnlyBestSubmissionWhenEpochFinalized(t *testing.T) { } func TestTxIdxShouldBreakTies(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) tk := InitTestKeepers(t) defaultParams := btcctypes.DefaultParams() wDeep := defaultParams.CheckpointFinalizationTimeout - msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(1) + msg1 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) tk.BTCLightClient.SetDepth(b1Hash(msg1), int64(1)) tk.BTCLightClient.SetDepth(b2Hash(msg1), int64(0)) _, err := tk.insertProofMsg(msg1) require.NoError(t, err, "failed to insert submission") - msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(1) + msg2 := dg.GenerateMessageWithRandomSubmitterForEpoch(r, 1) tk.BTCLightClient.SetDepth(b1Hash(msg2), int64(1)) tk.BTCLightClient.SetDepth(b2Hash(msg2), int64(0)) _, err = tk.insertProofMsg(msg2) @@ -525,15 +528,15 @@ func TestTxIdxShouldBreakTies(t *testing.T) { } func TestStateTransitionOfValidSubmission(t *testing.T) { - rand.Seed(time.Now().Unix()) + r := rand.New(rand.NewSource(time.Now().Unix())) epoch := uint64(1) defaultParams := btcctypes.DefaultParams() kDeep := defaultParams.BtcConfirmationDepth wDeep := defaultParams.CheckpointFinalizationTimeout - raw, _ := dg.RandomRawCheckpointDataForEpoch(epoch) + raw, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch) - blck1 := dg.CreateBlock(1, 7, 7, raw.FirstPart) - blck2 := dg.CreateBlock(2, 14, 3, raw.SecondPart) + blck1 := dg.CreateBlock(r, 1, 7, 7, raw.FirstPart) + blck2 := dg.CreateBlock(r, 2, 14, 3, raw.SecondPart) tk := InitTestKeepers(t) @@ -589,3 +592,107 @@ func TestStateTransitionOfValidSubmission(t *testing.T) { t.Errorf("Epoch Data missing of in unexpected state") } } + +func FuzzConfirmAndDinalizeManyEpochs(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 20) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + tk := InitTestKeepers(t) + defaultParams := btcctypes.DefaultParams() + kDeep := defaultParams.BtcConfirmationDepth + wDeep := defaultParams.CheckpointFinalizationTimeout + + numFinalizedEpochs := r.Intn(10) + 1 + numConfirmedEpochs := r.Intn(5) + 1 + numSubmittedEpochs := 1 + + finalizationDepth := math.MaxUint32 + confirmationDepth := wDeep - 1 + sumbissionDepth := kDeep - 1 + + numOfEpochs := numFinalizedEpochs + numConfirmedEpochs + numSubmittedEpochs + + bestSumbissionInfos := make(map[uint64]uint64) + + for i := 1; i <= numOfEpochs; i++ { + epoch := uint64(i) + raw, _ := dg.RandomRawCheckpointDataForEpoch(r, epoch) + numSubmissionsPerEpoch := r.Intn(3) + 1 + + for j := 1; j <= numSubmissionsPerEpoch; j++ { + numTx1 := uint32(r.Intn(30) + 10) + numTx2 := uint32(r.Intn(30) + 10) + blck1 := dg.CreateBlock(r, 0, numTx1, 1, raw.FirstPart) + blck2 := dg.CreateBlock(r, 0, numTx2, 2, raw.SecondPart) + + msg := dg.GenerateMessageWithRandomSubmitter([]*dg.BlockCreationResult{blck1, blck2}) + + if epoch <= uint64(numFinalizedEpochs) { + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), int64(finalizationDepth)) + finalizationDepth = finalizationDepth - 1 + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), int64(finalizationDepth)) + + // first submission is always deepest one, and second block is the most recent one + if j == 1 { + bestSumbissionInfos[epoch] = uint64(finalizationDepth) + } + finalizationDepth = finalizationDepth - 1 + } else if epoch <= uint64(numFinalizedEpochs+numConfirmedEpochs) { + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), int64(confirmationDepth)) + confirmationDepth = confirmationDepth - 1 + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), int64(confirmationDepth)) + // first submission is always deepest one, and second block is the most recent one + if j == 1 { + bestSumbissionInfos[epoch] = uint64(confirmationDepth) + } + confirmationDepth = confirmationDepth - 1 + } else { + tk.BTCLightClient.SetDepth(blck1.HeaderBytes.Hash(), int64(sumbissionDepth)) + sumbissionDepth = sumbissionDepth - 1 + tk.BTCLightClient.SetDepth(blck2.HeaderBytes.Hash(), int64(sumbissionDepth)) + // first submission is always deepest one, and second block is the most recent one + if j == 1 { + bestSumbissionInfos[epoch] = uint64(sumbissionDepth) + } + sumbissionDepth = sumbissionDepth - 1 + } + + _, err := tk.insertProofMsg(msg) + require.NoError(t, err, "failed to insert submission for epoch %d", epoch) + } + } + + // Check that all epochs are in submitted state + for i := 1; i <= numOfEpochs; i++ { + epoch := uint64(i) + ed := tk.GetEpochData(epoch) + require.NotNil(t, ed) + require.Equal(t, ed.Status, btcctypes.Submitted) + } + + // Fire up tip change callback. All epochs should reach their correct state + tk.onTipChange() + + for i := 1; i <= numOfEpochs; i++ { + epoch := uint64(i) + ed := tk.GetEpochData(epoch) + require.NotNil(t, ed) + + if epoch <= uint64(numFinalizedEpochs) { + require.Equal(t, ed.Status, btcctypes.Finalized) + // finalized epochs should have only best submission + require.Equal(t, len(ed.Key), 1) + } else if epoch <= uint64(numFinalizedEpochs+numConfirmedEpochs) { + require.Equal(t, ed.Status, btcctypes.Confirmed) + } else { + require.Equal(t, ed.Status, btcctypes.Submitted) + } + + bestSubInfo := tk.BTCCheckpoint.GetEpochBestSubmissionBtcInfo(tk.SdkCtx, ed) + require.NotNil(t, bestSubInfo) + expectedBestSubmissionDepth := bestSumbissionInfos[epoch] + require.Equal(t, bestSubInfo.SubmissionDepth(), expectedBestSubmissionDepth) + } + }) +} diff --git a/x/btccheckpoint/keeper/params.go b/x/btccheckpoint/keeper/params.go index e3202978d..c69f94aa2 100644 --- a/x/btccheckpoint/keeper/params.go +++ b/x/btccheckpoint/keeper/params.go @@ -5,13 +5,24 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) - return params +// SetParams sets the x/btccheckpoint module parameters. +func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { + if err := p.Validate(); err != nil { + return err + } + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&p) + store.Set(types.ParamsKey, bz) + return nil } -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) +// GetParams returns the current x/btccheckpoint module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return p + } + k.cdc.MustUnmarshal(bz, &p) + return p } diff --git a/x/btccheckpoint/keeper/params_test.go b/x/btccheckpoint/keeper/params_test.go index 8f0dc7dce..d690964a2 100644 --- a/x/btccheckpoint/keeper/params_test.go +++ b/x/btccheckpoint/keeper/params_test.go @@ -10,9 +10,12 @@ import ( func TestGetParams(t *testing.T) { k, ctx := testkeeper.NewBTCCheckpointKeeper(t, nil, nil, nil) + params := types.DefaultParams() - k.SetParams(ctx, params) + if err := k.SetParams(ctx, params); err != nil { + panic(err) + } require.EqualValues(t, params, k.GetParams(ctx)) } diff --git a/x/btccheckpoint/module.go b/x/btccheckpoint/module.go index debdbf97b..879902e9a 100644 --- a/x/btccheckpoint/module.go +++ b/x/btccheckpoint/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/babylonchain/babylon/x/btccheckpoint/client/cli" "github.com/babylonchain/babylon/x/btccheckpoint/keeper" @@ -123,19 +123,9 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the capability module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} - // QuerierRoute returns the capability module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// LegacyQuerierHandler returns the capability module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { @@ -165,13 +155,14 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock executes all ABCI EndBlock logic respective to the capability module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { + EndBlocker(ctx, am.keeper, req) return []abci.ValidatorUpdate{} } diff --git a/x/btccheckpoint/module_simulation.go b/x/btccheckpoint/module_simulation.go index cae0f3fd7..804960957 100644 --- a/x/btccheckpoint/module_simulation.go +++ b/x/btccheckpoint/module_simulation.go @@ -1,12 +1,10 @@ package btccheckpoint import ( - "math/rand" - + simappparams "github.com/babylonchain/babylon/app/params" btccheckpointsimulation "github.com/babylonchain/babylon/x/btccheckpoint/simulation" "github.com/babylonchain/babylon/x/btccheckpoint/types" "github.com/cosmos/cosmos-sdk/baseapp" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -34,16 +32,10 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } -// RandomizedParams creates randomized param changes for the simulator -func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} diff --git a/x/btccheckpoint/types/btccheckpoint.pb.go b/x/btccheckpoint/types/btccheckpoint.pb.go index f85ff42ef..2c5545b37 100644 --- a/x/btccheckpoint/types/btccheckpoint.pb.go +++ b/x/btccheckpoint/types/btccheckpoint.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btccheckpoint/btccheckpoint.proto +// source: babylon/btccheckpoint/v1/btccheckpoint.proto package types import ( fmt "fmt" github_com_babylonchain_babylon_types "github.com/babylonchain/babylon/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -24,6 +24,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// BtcStatus is an enum describing the current btc status of the checkpoint type BtcStatus int32 const ( @@ -55,16 +56,18 @@ func (x BtcStatus) String() string { } func (BtcStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{0} + return fileDescriptor_e096cac78d49b0a6, []int{0} } // Consider we have a Merkle tree with following structure: -// ROOT -// / \ -// H1234 H5555 -// / \ \ -// H12 H34 H55 -// / \ / \ / +// +// ROOT +// / \ +// H1234 H5555 +// / \ \ +// H12 H34 H55 +// / \ / \ / +// // H1 H2 H3 H4 H5 // L1 L2 L3 L4 L5 // To prove L3 was part of ROOT we need: @@ -94,7 +97,7 @@ func (m *BTCSpvProof) Reset() { *m = BTCSpvProof{} } func (m *BTCSpvProof) String() string { return proto.CompactTextString(m) } func (*BTCSpvProof) ProtoMessage() {} func (*BTCSpvProof) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{0} + return fileDescriptor_e096cac78d49b0a6, []int{0} } func (m *BTCSpvProof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -155,7 +158,7 @@ func (m *TransactionKey) Reset() { *m = TransactionKey{} } func (m *TransactionKey) String() string { return proto.CompactTextString(m) } func (*TransactionKey) ProtoMessage() {} func (*TransactionKey) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{1} + return fileDescriptor_e096cac78d49b0a6, []int{1} } func (m *TransactionKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -193,12 +196,11 @@ func (m *TransactionKey) GetIndex() uint32 { // 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 +// 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 type SubmissionKey struct { Key []*TransactionKey `protobuf:"bytes,1,rep,name=key,proto3" json:"key,omitempty"` } @@ -207,7 +209,7 @@ func (m *SubmissionKey) Reset() { *m = SubmissionKey{} } func (m *SubmissionKey) String() string { return proto.CompactTextString(m) } func (*SubmissionKey) ProtoMessage() {} func (*SubmissionKey) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{2} + return fileDescriptor_e096cac78d49b0a6, []int{2} } func (m *SubmissionKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -243,7 +245,8 @@ func (m *SubmissionKey) GetKey() []*TransactionKey { return nil } -// TransactionInfo is the info of a tx that contains Babylon checkpoint, including +// TransactionInfo is the info of a tx that contains Babylon checkpoint, +// including // - the position of the tx on BTC blockchain // - the full tx content // - the Merkle proof that this tx is on the above position @@ -267,7 +270,7 @@ func (m *TransactionInfo) Reset() { *m = TransactionInfo{} } func (m *TransactionInfo) String() string { return proto.CompactTextString(m) } func (*TransactionInfo) ProtoMessage() {} func (*TransactionInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{3} + return fileDescriptor_e096cac78d49b0a6, []int{3} } func (m *TransactionInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -318,16 +321,17 @@ func (m *TransactionInfo) GetProof() []byte { } // TODO: Determine if we should keep any block number or depth info. -// On one hand it may be usefull to determine if block is stable or not, on other -// depth/block number info, without context (i.e info about chain) is pretty useless -// and blockshash in enough to retrieve is from lightclient +// On one hand it may be usefull to determine if block is stable or not, on +// other depth/block number info, without context (i.e info about chain) is +// pretty useless and blockshash in enough to retrieve is from lightclient type SubmissionData struct { // address of the submitter and reporter VigilanteAddresses *CheckpointAddresses `protobuf:"bytes,1,opt,name=vigilante_addresses,json=vigilanteAddresses,proto3" json:"vigilante_addresses,omitempty"` // txs_info is the two `TransactionInfo`s corresponding to the submission // It is used for // - recovering address of sender of btc transction to payup the reward. - // - allowing the ZoneConcierge module to prove the checkpoint is submitted to BTC + // - allowing the ZoneConcierge module to prove the checkpoint is submitted to + // BTC TxsInfo []*TransactionInfo `protobuf:"bytes,2,rep,name=txs_info,json=txsInfo,proto3" json:"txs_info,omitempty"` Epoch uint64 `protobuf:"varint,3,opt,name=epoch,proto3" json:"epoch,omitempty"` } @@ -336,7 +340,7 @@ func (m *SubmissionData) Reset() { *m = SubmissionData{} } func (m *SubmissionData) String() string { return proto.CompactTextString(m) } func (*SubmissionData) ProtoMessage() {} func (*SubmissionData) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{4} + return fileDescriptor_e096cac78d49b0a6, []int{4} } func (m *SubmissionData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -387,7 +391,8 @@ func (m *SubmissionData) GetEpoch() uint64 { } // Data stored in db and indexed by epoch number -// TODO: Add btc blockheight at epooch end, when adding hadnling of epoching callbacks +// TODO: Add btc blockheight at epooch end, when adding hadnling of epoching +// callbacks type EpochData struct { // List of all received checkpoints during this epoch, sorted by order of // submission. @@ -400,7 +405,7 @@ func (m *EpochData) Reset() { *m = EpochData{} } func (m *EpochData) String() string { return proto.CompactTextString(m) } func (*EpochData) ProtoMessage() {} func (*EpochData) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{5} + return fileDescriptor_e096cac78d49b0a6, []int{5} } func (m *EpochData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -443,12 +448,15 @@ func (m *EpochData) GetStatus() BtcStatus { return Submitted } +// CheckpointAddresses contains the addresses of the submitter and reporter of a +// given checkpoint type CheckpointAddresses struct { // TODO: this could probably be better typed - // Address of the checkpoint submitter, extracted from the checkpoint itself. + // submitter is the address of the checkpoint submitter to BTC, extracted from + // the checkpoint itself. Submitter []byte `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,omitempty"` - // Address of the reporter which reported the submissions, calculated from - // submission message MsgInsertBTCSpvProof itself + // reporter is the address of the reporter who reported the submissions, + // calculated from submission message MsgInsertBTCSpvProof itself Reporter []byte `protobuf:"bytes,2,opt,name=reporter,proto3" json:"reporter,omitempty"` } @@ -456,7 +464,7 @@ func (m *CheckpointAddresses) Reset() { *m = CheckpointAddresses{} } func (m *CheckpointAddresses) String() string { return proto.CompactTextString(m) } func (*CheckpointAddresses) ProtoMessage() {} func (*CheckpointAddresses) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{6} + return fileDescriptor_e096cac78d49b0a6, []int{6} } func (m *CheckpointAddresses) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -499,22 +507,27 @@ func (m *CheckpointAddresses) GetReporter() []byte { return nil } +// BTCCheckpointInfo contains all data about best submission of checkpoint for +// given epoch. Best submission is the submission which is deeper in btc ledger type BTCCheckpointInfo struct { // epoch number of this checkpoint EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` - // height of earliest BTC block that includes this checkpoint - EarliestBtcBlockNumber uint64 `protobuf:"varint,2,opt,name=earliest_btc_block_number,json=earliestBtcBlockNumber,proto3" json:"earliest_btc_block_number,omitempty"` - // hash of earliest BTC block that includes this checkpoint - EarliestBtcBlockHash []byte `protobuf:"bytes,3,opt,name=earliest_btc_block_hash,json=earliestBtcBlockHash,proto3" json:"earliest_btc_block_hash,omitempty"` - // list of vigilantes' addresses - VigilanteAddressList []*CheckpointAddresses `protobuf:"bytes,4,rep,name=vigilante_address_list,json=vigilanteAddressList,proto3" json:"vigilante_address_list,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"` + // hash of the btc block which determines checkpoint btc block height i.e. + // youngest block of best submission + BestSubmissionBtcBlockHash *github_com_babylonchain_babylon_types.BTCHeaderHashBytes `protobuf:"bytes,3,opt,name=best_submission_btc_block_hash,json=bestSubmissionBtcBlockHash,proto3,customtype=github.com/babylonchain/babylon/types.BTCHeaderHashBytes" json:"best_submission_btc_block_hash,omitempty"` + // the BTC checkpoint transactions of the best submission + BestSubmissionTransactions []*TransactionInfo `protobuf:"bytes,4,rep,name=best_submission_transactions,json=bestSubmissionTransactions,proto3" json:"best_submission_transactions,omitempty"` + // list of vigilantes' addresses of the best submission + BestSubmissionVigilanteAddressList []*CheckpointAddresses `protobuf:"bytes,5,rep,name=best_submission_vigilante_address_list,json=bestSubmissionVigilanteAddressList,proto3" json:"best_submission_vigilante_address_list,omitempty"` } func (m *BTCCheckpointInfo) Reset() { *m = BTCCheckpointInfo{} } func (m *BTCCheckpointInfo) String() string { return proto.CompactTextString(m) } func (*BTCCheckpointInfo) ProtoMessage() {} func (*BTCCheckpointInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_da8b9af3dbd18a36, []int{7} + return fileDescriptor_e096cac78d49b0a6, []int{7} } func (m *BTCCheckpointInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -550,23 +563,23 @@ func (m *BTCCheckpointInfo) GetEpochNumber() uint64 { return 0 } -func (m *BTCCheckpointInfo) GetEarliestBtcBlockNumber() uint64 { +func (m *BTCCheckpointInfo) GetBestSubmissionBtcBlockHeight() uint64 { if m != nil { - return m.EarliestBtcBlockNumber + return m.BestSubmissionBtcBlockHeight } return 0 } -func (m *BTCCheckpointInfo) GetEarliestBtcBlockHash() []byte { +func (m *BTCCheckpointInfo) GetBestSubmissionTransactions() []*TransactionInfo { if m != nil { - return m.EarliestBtcBlockHash + return m.BestSubmissionTransactions } return nil } -func (m *BTCCheckpointInfo) GetVigilanteAddressList() []*CheckpointAddresses { +func (m *BTCCheckpointInfo) GetBestSubmissionVigilanteAddressList() []*CheckpointAddresses { if m != nil { - return m.VigilanteAddressList + return m.BestSubmissionVigilanteAddressList } return nil } @@ -584,59 +597,62 @@ func init() { } func init() { - proto.RegisterFile("babylon/btccheckpoint/btccheckpoint.proto", fileDescriptor_da8b9af3dbd18a36) -} - -var fileDescriptor_da8b9af3dbd18a36 = []byte{ - // 768 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xcf, 0x4f, 0xdb, 0x48, - 0x14, 0x8e, 0x43, 0x60, 0xc9, 0x24, 0x04, 0x76, 0x12, 0x58, 0x6f, 0xb4, 0x0a, 0xc1, 0x7b, 0x20, - 0xac, 0xb4, 0x89, 0x96, 0x5d, 0x24, 0xd8, 0xdd, 0x0b, 0x4e, 0x82, 0x88, 0x80, 0x04, 0x39, 0xe6, - 0xc2, 0xa1, 0x96, 0xed, 0x4c, 0xe2, 0x51, 0x1c, 0x4f, 0xe4, 0x99, 0xa0, 0xa4, 0xd7, 0xaa, 0x52, - 0x55, 0xa9, 0x52, 0xd5, 0x7b, 0x4f, 0xfd, 0x67, 0x7a, 0xe8, 0x81, 0x63, 0xc5, 0x01, 0x55, 0xf0, - 0x67, 0xf4, 0x52, 0x79, 0xec, 0xfc, 0x84, 0xa8, 0xe5, 0xe6, 0xf7, 0xde, 0xf7, 0xde, 0xbc, 0xef, - 0x7b, 0x6f, 0xc6, 0x60, 0xc7, 0xd0, 0x8d, 0x81, 0x4d, 0x9c, 0x82, 0xc1, 0x4c, 0xd3, 0x42, 0x66, - 0xbb, 0x4b, 0xb0, 0xc3, 0xa6, 0xad, 0x7c, 0xd7, 0x25, 0x8c, 0x40, 0x31, 0x80, 0xe6, 0xa7, 0x83, - 0x57, 0x7f, 0xa5, 0x53, 0x2d, 0xd2, 0x22, 0x1c, 0x54, 0xf0, 0xbe, 0x7c, 0xbc, 0xf4, 0x55, 0x00, - 0x31, 0x59, 0x2d, 0xd6, 0xbb, 0x57, 0xe7, 0x2e, 0x21, 0x4d, 0xb8, 0x0d, 0x56, 0x0d, 0x66, 0x6a, - 0xcc, 0xd5, 0x1d, 0xaa, 0x9b, 0x0c, 0x13, 0x47, 0x14, 0xb2, 0x42, 0x2e, 0xae, 0x24, 0x0c, 0x66, - 0xaa, 0x63, 0x2f, 0xdc, 0x05, 0xeb, 0x33, 0x40, 0x0d, 0x3b, 0x0d, 0xd4, 0x17, 0xc3, 0x59, 0x21, - 0xb7, 0xa2, 0x24, 0xa7, 0xe1, 0x15, 0x2f, 0x04, 0xb7, 0x40, 0xbc, 0x83, 0xdc, 0xb6, 0x8d, 0x34, - 0x87, 0x34, 0x10, 0x15, 0x17, 0x78, 0xe5, 0x98, 0xef, 0xab, 0x7a, 0x2e, 0x68, 0x83, 0x75, 0x93, - 0x38, 0x4d, 0xec, 0x76, 0xb0, 0xd3, 0xd2, 0xbc, 0x13, 0x2c, 0xa4, 0x37, 0x90, 0x2b, 0x46, 0x3c, - 0xac, 0xbc, 0x7f, 0x73, 0xbb, 0xf9, 0x4f, 0x0b, 0x33, 0xab, 0x67, 0xe4, 0x4d, 0xd2, 0x29, 0x04, - 0x6c, 0x4d, 0x4b, 0xc7, 0xce, 0xd0, 0x28, 0xb0, 0x41, 0x17, 0xd1, 0xbc, 0xac, 0x16, 0x8f, 0x79, - 0xaa, 0x3c, 0x60, 0x88, 0x2a, 0xc9, 0x71, 0x59, 0x99, 0x99, 0x7e, 0x44, 0xea, 0x83, 0xc4, 0x44, - 0x93, 0x27, 0x68, 0x00, 0x53, 0x60, 0xd1, 0xa7, 0x21, 0x70, 0x1a, 0xbe, 0x01, 0xcf, 0x41, 0xc4, - 0xd2, 0xa9, 0xc5, 0xb9, 0xc5, 0xe5, 0xff, 0x6f, 0x6e, 0x37, 0xf7, 0x9f, 0xd8, 0xc4, 0xb1, 0x4e, - 0x2d, 0xbf, 0x11, 0x5e, 0x49, 0x3a, 0x01, 0x2b, 0xf5, 0x9e, 0xd1, 0xc1, 0x94, 0x06, 0x07, 0xff, - 0x0b, 0x16, 0xda, 0x68, 0x20, 0x0a, 0xd9, 0x85, 0x5c, 0x6c, 0x37, 0x97, 0x9f, 0x37, 0xc6, 0xfc, - 0x74, 0xbf, 0x8a, 0x97, 0x24, 0xbd, 0x14, 0xc0, 0xea, 0x94, 0xd8, 0x4d, 0x32, 0xae, 0x27, 0x3c, - 0xb9, 0x1e, 0xcc, 0x82, 0xd8, 0xe4, 0x02, 0x84, 0xfd, 0x31, 0x4d, 0xb8, 0x3c, 0x99, 0xba, 0xde, - 0xbe, 0x04, 0x23, 0xf4, 0x0d, 0xe9, 0x93, 0x00, 0x12, 0x63, 0x56, 0x25, 0x9d, 0xe9, 0xf0, 0x19, - 0x48, 0x5e, 0xe1, 0x16, 0xb6, 0x75, 0x87, 0x21, 0x4d, 0x6f, 0x34, 0x5c, 0x44, 0x29, 0xa2, 0x41, - 0x5b, 0x7f, 0xce, 0x6f, 0xab, 0x38, 0xb2, 0x0e, 0x87, 0x49, 0x0a, 0x1c, 0x55, 0x1a, 0xf9, 0x60, - 0x09, 0x2c, 0xb3, 0x3e, 0xd5, 0xb0, 0xd3, 0x24, 0x62, 0x98, 0x6b, 0xb7, 0xf3, 0x43, 0x5c, 0x3d, - 0x8d, 0x94, 0x9f, 0x58, 0x9f, 0x72, 0xb1, 0x52, 0x60, 0x11, 0x75, 0x89, 0x69, 0x71, 0x3a, 0x11, - 0xc5, 0x37, 0xa4, 0x17, 0x02, 0x88, 0x96, 0xbd, 0x2f, 0xce, 0xe4, 0x60, 0x72, 0x40, 0xdb, 0xf3, - 0x0f, 0x99, 0x1a, 0xab, 0xaf, 0xe7, 0x7f, 0x60, 0x89, 0x32, 0x9d, 0xf5, 0x28, 0x97, 0x32, 0xb1, - 0xfb, 0xfb, 0xfc, 0x6c, 0x99, 0x99, 0x75, 0x0e, 0x55, 0x82, 0x14, 0xa9, 0x06, 0x92, 0x8f, 0x88, - 0x01, 0x7f, 0x03, 0x51, 0xea, 0x9d, 0xc4, 0x18, 0x72, 0x83, 0x2b, 0x3a, 0x76, 0xc0, 0x34, 0x58, - 0x76, 0x51, 0x97, 0xb8, 0x5e, 0xd0, 0x1f, 0xdf, 0xc8, 0x96, 0xde, 0x84, 0xc1, 0xcf, 0xb2, 0x5a, - 0x1c, 0x17, 0xe5, 0x12, 0x6c, 0x81, 0x38, 0x67, 0xad, 0x39, 0xbd, 0x8e, 0x11, 0x94, 0x8c, 0x28, - 0x31, 0xee, 0xab, 0x72, 0x17, 0x3c, 0x00, 0xbf, 0x22, 0xdd, 0xb5, 0x31, 0xa2, 0x8c, 0xdf, 0x4c, - 0xc3, 0x26, 0x66, 0x7b, 0x88, 0x0f, 0x73, 0xfc, 0xc6, 0x10, 0x20, 0x33, 0x53, 0xf6, 0xc2, 0x41, - 0xea, 0x1e, 0xf8, 0xe5, 0x91, 0x54, 0x7e, 0xa7, 0xfc, 0x0d, 0x4a, 0xcd, 0x26, 0x7a, 0x17, 0x06, - 0x9a, 0x60, 0xe3, 0xc1, 0xf6, 0x68, 0x36, 0xa6, 0x4c, 0x8c, 0xf0, 0x31, 0x3c, 0x71, 0x81, 0x52, - 0xb3, 0x0b, 0x74, 0x8a, 0x29, 0xfb, 0xe3, 0x9d, 0x00, 0xa2, 0x23, 0xd9, 0xe1, 0x0e, 0xd8, 0x28, - 0x9f, 0xd7, 0x8a, 0xc7, 0x5a, 0x5d, 0x3d, 0x54, 0x2f, 0xea, 0x5a, 0xfd, 0x42, 0x3e, 0xab, 0xa8, - 0x6a, 0xb9, 0xb4, 0x16, 0x4a, 0xaf, 0xbc, 0x7e, 0x9f, 0x8d, 0xd6, 0x03, 0x91, 0x1b, 0x0f, 0xa0, - 0xc5, 0x5a, 0xf5, 0xa8, 0xa2, 0x9c, 0x95, 0x4b, 0x6b, 0x82, 0x0f, 0x2d, 0xfa, 0x4f, 0xce, 0x23, - 0xd0, 0xa3, 0x4a, 0xf5, 0xf0, 0xb4, 0x72, 0x59, 0x2e, 0xad, 0x85, 0x7d, 0xe8, 0x11, 0x76, 0x74, - 0x1b, 0x3f, 0x47, 0x8d, 0x74, 0xe4, 0xd5, 0x87, 0x4c, 0x48, 0xae, 0x7d, 0xbc, 0xcb, 0x08, 0xd7, - 0x77, 0x19, 0xe1, 0xcb, 0x5d, 0x46, 0x78, 0x7b, 0x9f, 0x09, 0x5d, 0xdf, 0x67, 0x42, 0x9f, 0xef, - 0x33, 0xa1, 0xcb, 0xbd, 0xef, 0xbd, 0x3c, 0xfd, 0x99, 0xdf, 0x04, 0x7f, 0x89, 0x8c, 0x25, 0xfe, - 0xde, 0xff, 0xfd, 0x2d, 0x00, 0x00, 0xff, 0xff, 0xc6, 0x76, 0xd4, 0x3c, 0x4c, 0x06, 0x00, 0x00, + proto.RegisterFile("babylon/btccheckpoint/v1/btccheckpoint.proto", fileDescriptor_e096cac78d49b0a6) +} + +var fileDescriptor_e096cac78d49b0a6 = []byte{ + // 809 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0x4b, 0x6f, 0xea, 0x46, + 0x14, 0x66, 0x80, 0xdc, 0x5e, 0x06, 0xc2, 0x4d, 0x87, 0xdc, 0xca, 0x42, 0x91, 0x2f, 0xd7, 0x95, + 0x1a, 0x52, 0xb5, 0xa0, 0xa4, 0xad, 0x94, 0x3e, 0x36, 0x31, 0x0f, 0x81, 0x92, 0x40, 0x64, 0x9c, + 0x2e, 0xb2, 0xa8, 0x65, 0x9b, 0x01, 0x8f, 0x00, 0x0f, 0xf2, 0x0c, 0x08, 0xba, 0x6a, 0x55, 0x55, + 0xaa, 0xba, 0xaa, 0xba, 0xef, 0xaa, 0x7f, 0xa6, 0x8b, 0x2e, 0xb2, 0xac, 0xb2, 0x88, 0xaa, 0xe4, + 0x1f, 0x74, 0xdb, 0x4d, 0xe5, 0xb1, 0xc3, 0x2b, 0xa1, 0x2d, 0xd2, 0xdd, 0x71, 0xce, 0x7c, 0xe7, + 0xf1, 0x7d, 0xe7, 0x1c, 0x0c, 0x3f, 0xb0, 0x4c, 0x6b, 0xda, 0xa7, 0x6e, 0xd1, 0xe2, 0xb6, 0xed, + 0x60, 0xbb, 0x37, 0xa4, 0xc4, 0xe5, 0xc5, 0xf1, 0xe1, 0xb2, 0xa3, 0x30, 0xf4, 0x28, 0xa7, 0x48, + 0x0a, 0xd1, 0x85, 0xe5, 0xc7, 0xf1, 0x61, 0x76, 0xb7, 0x4b, 0xbb, 0x54, 0x80, 0x8a, 0xfe, 0xaf, + 0x00, 0xaf, 0xfc, 0x0d, 0x60, 0x52, 0xd5, 0x4b, 0xad, 0xe1, 0xf8, 0xc2, 0xa3, 0xb4, 0x83, 0xf6, + 0xe1, 0x0b, 0x8b, 0xdb, 0x06, 0xf7, 0x4c, 0x97, 0x99, 0x36, 0x27, 0xd4, 0x95, 0x40, 0x0e, 0xe4, + 0x53, 0x5a, 0xda, 0xe2, 0xb6, 0x3e, 0xf7, 0xa2, 0x23, 0xf8, 0x72, 0x05, 0x68, 0x10, 0xb7, 0x8d, + 0x27, 0x52, 0x34, 0x07, 0xf2, 0xdb, 0x5a, 0x66, 0x19, 0x5e, 0xf7, 0x9f, 0xd0, 0x6b, 0x98, 0x1a, + 0x60, 0xaf, 0xd7, 0xc7, 0x86, 0x4b, 0xdb, 0x98, 0x49, 0x31, 0x91, 0x39, 0x19, 0xf8, 0x1a, 0xbe, + 0x0b, 0xf5, 0xe1, 0x4b, 0x9b, 0xba, 0x1d, 0xe2, 0x0d, 0x88, 0xdb, 0x35, 0xfc, 0x0a, 0x0e, 0x36, + 0xdb, 0xd8, 0x93, 0xe2, 0x3e, 0x56, 0x3d, 0xbe, 0xb9, 0x7d, 0xf5, 0x71, 0x97, 0x70, 0x67, 0x64, + 0x15, 0x6c, 0x3a, 0x28, 0x86, 0x6c, 0x6d, 0xc7, 0x24, 0xee, 0x83, 0x51, 0xe4, 0xd3, 0x21, 0x66, + 0x05, 0x55, 0x2f, 0xd5, 0x44, 0xa8, 0x3a, 0xe5, 0x98, 0x69, 0x99, 0x79, 0x5a, 0x95, 0xdb, 0xc1, + 0x8b, 0x32, 0x81, 0xe9, 0x85, 0x26, 0x4f, 0xf1, 0x14, 0xed, 0xc2, 0xad, 0x80, 0x06, 0x10, 0x34, + 0x02, 0x03, 0x5d, 0xc0, 0xb8, 0x63, 0x32, 0x47, 0x70, 0x4b, 0xa9, 0x5f, 0xdc, 0xdc, 0xbe, 0x3a, + 0xde, 0xb0, 0x89, 0x9a, 0xc9, 0x9c, 0xa0, 0x11, 0x91, 0x49, 0x39, 0x85, 0xdb, 0xad, 0x91, 0x35, + 0x20, 0x8c, 0x85, 0x85, 0x3f, 0x83, 0xb1, 0x1e, 0x9e, 0x4a, 0x20, 0x17, 0xcb, 0x27, 0x8f, 0xf2, + 0x85, 0x75, 0x63, 0x2c, 0x2c, 0xf7, 0xab, 0xf9, 0x41, 0xca, 0xf7, 0x00, 0xbe, 0x58, 0x12, 0xbb, + 0x43, 0xe7, 0xf9, 0xc0, 0xc6, 0xf9, 0x50, 0x0e, 0x26, 0x17, 0x17, 0x20, 0x1a, 0x8c, 0x69, 0xc1, + 0xe5, 0xcb, 0x34, 0xf4, 0xf7, 0x25, 0x1c, 0x61, 0x60, 0x28, 0xbf, 0x03, 0x98, 0x9e, 0xb3, 0x2a, + 0x9b, 0xdc, 0x44, 0x5f, 0xc1, 0xcc, 0x98, 0x74, 0x49, 0xdf, 0x74, 0x39, 0x36, 0xcc, 0x76, 0xdb, + 0xc3, 0x8c, 0x61, 0x16, 0xb6, 0xf5, 0xe1, 0xfa, 0xb6, 0x4a, 0x33, 0xeb, 0xe4, 0x21, 0x48, 0x43, + 0xb3, 0x4c, 0x33, 0x1f, 0x2a, 0xc3, 0xe7, 0x7c, 0xc2, 0x0c, 0xe2, 0x76, 0xa8, 0x14, 0x15, 0xda, + 0x1d, 0xfc, 0x2f, 0xae, 0xbe, 0x46, 0xda, 0x5b, 0x7c, 0xc2, 0x84, 0x58, 0xbb, 0x70, 0x0b, 0x0f, + 0xa9, 0xed, 0x08, 0x3a, 0x71, 0x2d, 0x30, 0x94, 0xef, 0x00, 0x4c, 0x54, 0xfc, 0x5f, 0x82, 0xc9, + 0xa7, 0x8b, 0x03, 0xda, 0x5f, 0x5f, 0x64, 0x69, 0xac, 0x81, 0x9e, 0x9f, 0xc3, 0x67, 0x8c, 0x9b, + 0x7c, 0xc4, 0x84, 0x94, 0xe9, 0xa3, 0x77, 0xd7, 0x47, 0xab, 0xdc, 0x6e, 0x09, 0xa8, 0x16, 0x86, + 0x28, 0x4d, 0x98, 0x79, 0x42, 0x0c, 0xb4, 0x07, 0x13, 0xcc, 0xaf, 0xc4, 0x39, 0xf6, 0xc2, 0x13, + 0x9d, 0x3b, 0x50, 0x16, 0x3e, 0xf7, 0xf0, 0x90, 0x7a, 0xfe, 0x63, 0x30, 0xbe, 0x99, 0xad, 0xfc, + 0x15, 0x83, 0x6f, 0xab, 0x7a, 0x69, 0x9e, 0x54, 0x48, 0xf0, 0x1a, 0xa6, 0x04, 0x6b, 0xc3, 0x1d, + 0x0d, 0xac, 0x30, 0x65, 0x5c, 0x4b, 0x0a, 0x5f, 0x43, 0xb8, 0x50, 0x15, 0xe6, 0x2c, 0xcc, 0xb8, + 0xc1, 0x66, 0x0c, 0xc5, 0x81, 0x5a, 0x7d, 0x6a, 0xf7, 0x0c, 0x07, 0x93, 0xae, 0xc3, 0x45, 0xb1, + 0xb8, 0xb6, 0xe7, 0xe3, 0xe6, 0x42, 0xa8, 0xdc, 0x56, 0x7d, 0x50, 0x4d, 0x60, 0xd0, 0x37, 0x00, + 0xca, 0xff, 0x92, 0xc8, 0x3f, 0xb4, 0xd8, 0x1b, 0x38, 0xb4, 0xec, 0x9a, 0x26, 0x4c, 0xe6, 0xa0, + 0x1e, 0xdc, 0x5b, 0xed, 0x60, 0x61, 0xbd, 0x99, 0x14, 0xdf, 0x74, 0x95, 0x56, 0x8a, 0x2d, 0x3c, + 0x33, 0xf4, 0x2d, 0x80, 0xef, 0xad, 0x56, 0x7b, 0x74, 0x14, 0x46, 0x9f, 0x30, 0x2e, 0x6d, 0x89, + 0xba, 0x1b, 0xde, 0x85, 0xb2, 0x5c, 0xfb, 0xcb, 0x95, 0x2b, 0x39, 0x23, 0x8c, 0xbf, 0xff, 0x33, + 0x80, 0x89, 0xd9, 0x6e, 0xa1, 0x03, 0xf8, 0x4e, 0xe5, 0xa2, 0x59, 0xaa, 0x19, 0x2d, 0xfd, 0x44, + 0xbf, 0x6c, 0x19, 0xad, 0x4b, 0xf5, 0xbc, 0xae, 0xeb, 0x95, 0xf2, 0x4e, 0x24, 0xbb, 0xfd, 0xe3, + 0x2f, 0xb9, 0x44, 0x2b, 0xdc, 0xa4, 0xf6, 0x23, 0x68, 0xa9, 0xd9, 0xa8, 0xd6, 0xb5, 0xf3, 0x4a, + 0x79, 0x07, 0x04, 0xd0, 0x52, 0xf0, 0xbf, 0xfa, 0x04, 0xb4, 0x5a, 0x6f, 0x9c, 0x9c, 0xd5, 0xaf, + 0x2a, 0xe5, 0x9d, 0x68, 0x00, 0xad, 0x12, 0xd7, 0xec, 0x93, 0xaf, 0x71, 0x3b, 0x1b, 0xff, 0xe1, + 0x57, 0x39, 0xa2, 0x36, 0x7f, 0xbb, 0x93, 0xc1, 0xf5, 0x9d, 0x0c, 0xfe, 0xbc, 0x93, 0xc1, 0x4f, + 0xf7, 0x72, 0xe4, 0xfa, 0x5e, 0x8e, 0xfc, 0x71, 0x2f, 0x47, 0xae, 0x3e, 0xf9, 0xaf, 0xa9, 0x4f, + 0x56, 0x3e, 0x87, 0x62, 0x0b, 0xac, 0x67, 0xe2, 0xa3, 0xf6, 0xd1, 0x3f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0xa5, 0xcd, 0xc5, 0xce, 0x34, 0x07, 0x00, 0x00, } func (m *BTCSpvProof) Marshal() (dAtA []byte, err error) { @@ -972,10 +988,24 @@ func (m *BTCCheckpointInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.VigilanteAddressList) > 0 { - for iNdEx := len(m.VigilanteAddressList) - 1; iNdEx >= 0; iNdEx-- { + if len(m.BestSubmissionVigilanteAddressList) > 0 { + for iNdEx := len(m.BestSubmissionVigilanteAddressList) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.VigilanteAddressList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.BestSubmissionVigilanteAddressList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintBtccheckpoint(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.BestSubmissionTransactions) > 0 { + for iNdEx := len(m.BestSubmissionTransactions) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.BestSubmissionTransactions[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -986,15 +1016,20 @@ func (m *BTCCheckpointInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } } - if len(m.EarliestBtcBlockHash) > 0 { - i -= len(m.EarliestBtcBlockHash) - copy(dAtA[i:], m.EarliestBtcBlockHash) - i = encodeVarintBtccheckpoint(dAtA, i, uint64(len(m.EarliestBtcBlockHash))) + if m.BestSubmissionBtcBlockHash != nil { + { + size := m.BestSubmissionBtcBlockHash.Size() + i -= size + if _, err := m.BestSubmissionBtcBlockHash.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintBtccheckpoint(dAtA, i, uint64(size)) + } i-- dAtA[i] = 0x1a } - if m.EarliestBtcBlockNumber != 0 { - i = encodeVarintBtccheckpoint(dAtA, i, uint64(m.EarliestBtcBlockNumber)) + if m.BestSubmissionBtcBlockHeight != 0 { + i = encodeVarintBtccheckpoint(dAtA, i, uint64(m.BestSubmissionBtcBlockHeight)) i-- dAtA[i] = 0x10 } @@ -1159,15 +1194,21 @@ func (m *BTCCheckpointInfo) Size() (n int) { if m.EpochNumber != 0 { n += 1 + sovBtccheckpoint(uint64(m.EpochNumber)) } - if m.EarliestBtcBlockNumber != 0 { - n += 1 + sovBtccheckpoint(uint64(m.EarliestBtcBlockNumber)) + if m.BestSubmissionBtcBlockHeight != 0 { + n += 1 + sovBtccheckpoint(uint64(m.BestSubmissionBtcBlockHeight)) } - l = len(m.EarliestBtcBlockHash) - if l > 0 { + if m.BestSubmissionBtcBlockHash != nil { + l = m.BestSubmissionBtcBlockHash.Size() n += 1 + l + sovBtccheckpoint(uint64(l)) } - if len(m.VigilanteAddressList) > 0 { - for _, e := range m.VigilanteAddressList { + if len(m.BestSubmissionTransactions) > 0 { + for _, e := range m.BestSubmissionTransactions { + l = e.Size() + n += 1 + l + sovBtccheckpoint(uint64(l)) + } + } + if len(m.BestSubmissionVigilanteAddressList) > 0 { + for _, e := range m.BestSubmissionVigilanteAddressList { l = e.Size() n += 1 + l + sovBtccheckpoint(uint64(l)) } @@ -2105,9 +2146,9 @@ func (m *BTCCheckpointInfo) Unmarshal(dAtA []byte) error { } case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EarliestBtcBlockNumber", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BestSubmissionBtcBlockHeight", wireType) } - m.EarliestBtcBlockNumber = 0 + m.BestSubmissionBtcBlockHeight = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowBtccheckpoint @@ -2117,14 +2158,14 @@ func (m *BTCCheckpointInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EarliestBtcBlockNumber |= uint64(b&0x7F) << shift + m.BestSubmissionBtcBlockHeight |= uint64(b&0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EarliestBtcBlockHash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BestSubmissionBtcBlockHash", wireType) } var byteLen int for shift := uint(0); ; shift += 7 { @@ -2151,14 +2192,49 @@ func (m *BTCCheckpointInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.EarliestBtcBlockHash = append(m.EarliestBtcBlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.EarliestBtcBlockHash == nil { - m.EarliestBtcBlockHash = []byte{} + var v github_com_babylonchain_babylon_types.BTCHeaderHashBytes + m.BestSubmissionBtcBlockHash = &v + if err := m.BestSubmissionBtcBlockHash.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } iNdEx = postIndex case 4: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VigilanteAddressList", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BestSubmissionTransactions", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowBtccheckpoint + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthBtccheckpoint + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthBtccheckpoint + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.BestSubmissionTransactions = append(m.BestSubmissionTransactions, &TransactionInfo{}) + if err := m.BestSubmissionTransactions[len(m.BestSubmissionTransactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BestSubmissionVigilanteAddressList", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2185,8 +2261,8 @@ func (m *BTCCheckpointInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VigilanteAddressList = append(m.VigilanteAddressList, &CheckpointAddresses{}) - if err := m.VigilanteAddressList[len(m.VigilanteAddressList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.BestSubmissionVigilanteAddressList = append(m.BestSubmissionVigilanteAddressList, &CheckpointAddresses{}) + if err := m.BestSubmissionVigilanteAddressList[len(m.BestSubmissionVigilanteAddressList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/btccheckpoint/types/btcutils.go b/x/btccheckpoint/types/btcutils.go index dddf397c0..ce34fda7e 100644 --- a/x/btccheckpoint/types/btcutils.go +++ b/x/btccheckpoint/types/btcutils.go @@ -10,7 +10,7 @@ import ( "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/txscript" - "github.com/btcsuite/btcutil" + "github.com/btcsuite/btcd/btcutil" ) const ( diff --git a/x/btccheckpoint/types/codec.go b/x/btccheckpoint/types/codec.go index 27b141d5a..c5140de50 100644 --- a/x/btccheckpoint/types/codec.go +++ b/x/btccheckpoint/types/codec.go @@ -9,14 +9,18 @@ import ( ) func RegisterCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgInsertBTCSpvProof{}, "btccheckpoint/MsgInsertBTCSpvProof", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "btccheckpoint/MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*sdk.Msg)(nil), &MsgInsertBTCSpvProof{}, ) - + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/btccheckpoint/types/errors.go b/x/btccheckpoint/types/errors.go index 74f85c81c..37318dce5 100644 --- a/x/btccheckpoint/types/errors.go +++ b/x/btccheckpoint/types/errors.go @@ -3,16 +3,16 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/btccheckpoint module sentinel errors var ( - ErrInvalidCheckpointProof = sdkerrors.Register(ModuleName, 1100, "Invalid checkpoint proof") - ErrDuplicatedSubmission = sdkerrors.Register(ModuleName, 1101, "Duplicated submission") - ErrNoCheckpointsForPreviousEpoch = sdkerrors.Register(ModuleName, 1102, "No checkpoints for previous epoch") - ErrInvalidHeader = sdkerrors.Register(ModuleName, 1103, "Proof headers are invalid") - ErrProvidedHeaderFromDifferentForks = sdkerrors.Register(ModuleName, 1104, "Proof header from different forks") - ErrProvidedHeaderDoesNotHaveAncestor = sdkerrors.Register(ModuleName, 1105, "Proof header does not have ancestor in previous epoch") - ErrEpochAlreadyFinalized = sdkerrors.Register(ModuleName, 1106, "Submission denied. Epoch already finalized") + ErrInvalidCheckpointProof = errorsmod.Register(ModuleName, 1100, "Invalid checkpoint proof") + ErrDuplicatedSubmission = errorsmod.Register(ModuleName, 1101, "Duplicated submission") + ErrNoCheckpointsForPreviousEpoch = errorsmod.Register(ModuleName, 1102, "No checkpoints for previous epoch") + ErrInvalidHeader = errorsmod.Register(ModuleName, 1103, "Proof headers are invalid") + ErrProvidedHeaderFromDifferentForks = errorsmod.Register(ModuleName, 1104, "Proof header from different forks") + ErrProvidedHeaderDoesNotHaveAncestor = errorsmod.Register(ModuleName, 1105, "Proof header does not have ancestor in previous epoch") + ErrEpochAlreadyFinalized = errorsmod.Register(ModuleName, 1106, "Submission denied. Epoch already finalized") ) diff --git a/x/btccheckpoint/types/genesis.pb.go b/x/btccheckpoint/types/genesis.pb.go index 86a1fb9c8..a99ce5d8d 100644 --- a/x/btccheckpoint/types/genesis.pb.go +++ b/x/btccheckpoint/types/genesis.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btccheckpoint/genesis.proto +// source: babylon/btccheckpoint/v1/genesis.proto package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -32,7 +32,7 @@ func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_bf9801ce688057b7, []int{0} + return fileDescriptor_9776220697c13f63, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -73,24 +73,24 @@ func init() { } func init() { - proto.RegisterFile("babylon/btccheckpoint/genesis.proto", fileDescriptor_bf9801ce688057b7) + proto.RegisterFile("babylon/btccheckpoint/v1/genesis.proto", fileDescriptor_9776220697c13f63) } -var fileDescriptor_bf9801ce688057b7 = []byte{ - // 202 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x4a, 0x4c, 0xaa, +var fileDescriptor_9776220697c13f63 = []byte{ + // 205 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0x4e, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, - 0x2b, 0xd1, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x92, 0x80, 0x2a, 0xd2, 0x43, 0x51, 0xa4, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, - 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x4b, 0x29, 0x61, 0x37, 0xb4, 0x20, 0xb1, 0x28, 0x31, 0x17, - 0x6a, 0xa6, 0x92, 0x1f, 0x17, 0x8f, 0x3b, 0xc4, 0x92, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x3b, - 0x2e, 0x36, 0x88, 0xbc, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x82, 0x1e, 0x2e, 0x4b, 0xf5, - 0x02, 0xc0, 0xea, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xea, 0x72, 0xf2, 0x3f, 0xf1, - 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, - 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xd3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, - 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x99, 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, 0x8e, 0x7e, 0x05, - 0x9a, 0x3b, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xee, 0x34, 0x06, 0x04, 0x00, 0x00, - 0xff, 0xff, 0x8b, 0xb4, 0x95, 0x7a, 0x22, 0x01, 0x00, 0x00, + 0x2b, 0xd1, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0x92, 0x80, 0xaa, 0xd3, 0x43, 0x51, 0xa7, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, + 0x9f, 0x9e, 0x0f, 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x4b, 0xa9, 0xe2, 0x34, 0xb7, 0x20, 0xb1, + 0x28, 0x31, 0x17, 0x6a, 0xac, 0x92, 0x1f, 0x17, 0x8f, 0x3b, 0xc4, 0x9e, 0xe0, 0x92, 0xc4, 0x92, + 0x54, 0x21, 0x3b, 0x2e, 0x36, 0x88, 0xbc, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x82, 0x1e, + 0x2e, 0x7b, 0xf5, 0x02, 0xc0, 0xea, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xea, 0x72, + 0xf2, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, + 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xd3, 0xf4, 0xcc, 0x92, + 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x99, 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, + 0x8e, 0x7e, 0x05, 0x9a, 0x53, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0xee, 0x34, 0x06, + 0x04, 0x00, 0x00, 0xff, 0xff, 0x60, 0x50, 0x97, 0x1e, 0x28, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/x/btccheckpoint/types/genesis_test.go b/x/btccheckpoint/types/genesis_test.go index 2b24794ac..068fd4e15 100644 --- a/x/btccheckpoint/types/genesis_test.go +++ b/x/btccheckpoint/types/genesis_test.go @@ -24,6 +24,7 @@ func TestGenesisState_Validate(t *testing.T) { Params: types.Params{ BtcConfirmationDepth: 124, CheckpointFinalizationTimeout: 12222, + CheckpointTag: types.DefaultCheckpointTag, }, }, valid: true, diff --git a/x/btccheckpoint/types/keys.go b/x/btccheckpoint/types/keys.go index 138778787..5c002734d 100644 --- a/x/btccheckpoint/types/keys.go +++ b/x/btccheckpoint/types/keys.go @@ -18,16 +18,22 @@ const ( // QuerierRoute defines the module's query routing key QuerierRoute = ModuleName + TStoreKey = "transient_btccheckpoint" + // MemStoreKey defines the in-memory store key MemStoreKey = "mem_btccheckpoint" LatestFinalizedEpochKey = "latestFinalizedEpoch" + + btcLightClientUpdated = "btcLightClientUpdated" ) var ( - SubmisionKeyPrefix = []byte{3} - EpochDataPrefix = []byte{4} - LastFinalizedEpochKey = append([]byte{5}, []byte(LatestFinalizedEpochKey)...) + SubmisionKeyPrefix = []byte{3} + EpochDataPrefix = []byte{4} + LastFinalizedEpochKey = append([]byte{5}, []byte(LatestFinalizedEpochKey)...) + BtcLightClientUpdatedKey = append([]byte{6}, []byte(btcLightClientUpdated)...) + ParamsKey = []byte{7} ) func KeyPrefix(p string) []byte { @@ -45,3 +51,7 @@ func GetEpochIndexKey(e uint64) []byte { func GetLatestFinalizedEpochKey() []byte { return LastFinalizedEpochKey } + +func GetBtcLightClientUpdatedKey() []byte { + return BtcLightClientUpdatedKey +} diff --git a/x/btccheckpoint/types/msgs.go b/x/btccheckpoint/types/msgs.go index 9c4fccf06..8ddca7c89 100644 --- a/x/btccheckpoint/types/msgs.go +++ b/x/btccheckpoint/types/msgs.go @@ -5,6 +5,8 @@ import ( fmt "fmt" "math/big" + errorsmod "cosmossdk.io/errors" + txformat "github.com/babylonchain/babylon/btctxformatter" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -13,6 +15,7 @@ import ( var ( // Ensure that MsgInsertBTCSpvProof implements all functions of the Msg interface _ sdk.Msg = (*MsgInsertBTCSpvProof)(nil) + _ sdk.Msg = (*MsgUpdateParams)(nil) ) // Parse and Validate transactions which should contain OP_RETURN data. @@ -130,3 +133,22 @@ func (m *MsgInsertBTCSpvProof) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{submitter} } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/btccheckpoint/types/params.go b/x/btccheckpoint/types/params.go index aa0bef50f..0a33579d6 100644 --- a/x/btccheckpoint/types/params.go +++ b/x/btccheckpoint/types/params.go @@ -1,33 +1,24 @@ package types import ( + "encoding/hex" fmt "fmt" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + txformat "github.com/babylonchain/babylon/btctxformatter" ) const ( DefaultBtcConfirmationDepth uint64 = 10 DefaultCheckpointFinalizationTimeout uint64 = 100 + DefaultCheckpointTag = "01020304" ) -var ( - KeyBtcConfirmationDepth = []byte("BtcConfirmationDepth") - KeyCheckpointFinalizationTimeout = []byte("CheckpointFinalizationTimeout") -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance -func NewParams(btcConfirmationDepth uint64, checkpointFinalizationTimeout uint64) Params { +func NewParams(btcConfirmationDepth uint64, checkpointFinalizationTimeout uint64, checkpointTag string) Params { return Params{ BtcConfirmationDepth: btcConfirmationDepth, CheckpointFinalizationTimeout: checkpointFinalizationTimeout, + CheckpointTag: checkpointTag, } } @@ -36,17 +27,10 @@ func DefaultParams() Params { return NewParams( DefaultBtcConfirmationDepth, DefaultCheckpointFinalizationTimeout, + DefaultCheckpointTag, ) } -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyBtcConfirmationDepth, &p.BtcConfirmationDepth, validateBtcConfirmationDepth), - paramtypes.NewParamSetPair(KeyCheckpointFinalizationTimeout, &p.CheckpointFinalizationTimeout, validateCheckpointFinalizationTimeout), - } -} - // Validate validates the set of params func (p Params) Validate() error { if err := validateBtcConfirmationDepth(p.BtcConfirmationDepth); err != nil { @@ -55,6 +39,11 @@ func (p Params) Validate() error { if err := validateCheckpointFinalizationTimeout(p.CheckpointFinalizationTimeout); err != nil { return err } + + if err := validateCheckpointTag(p.CheckpointTag); err != nil { + return err + } + if p.BtcConfirmationDepth >= p.CheckpointFinalizationTimeout { return fmt.Errorf("BtcConfirmationDepth should be smaller than CheckpointFinalizationTimeout") } @@ -87,3 +76,23 @@ func validateCheckpointFinalizationTimeout(i interface{}) error { return nil } + +func validateCheckpointTag(i interface{}) error { + t, ok := i.(string) + + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + decoded, err := hex.DecodeString(t) + + if err != nil { + return fmt.Errorf("checkpoint tag should be in valid hex format") + } + + if len(decoded) != txformat.TagLength { + return fmt.Errorf("checkpoint tag should have exactly %d bytes", txformat.TagLength) + } + + return nil +} diff --git a/x/btccheckpoint/types/params.pb.go b/x/btccheckpoint/types/params.pb.go index ba63c5006..4f6d10a6c 100644 --- a/x/btccheckpoint/types/params.pb.go +++ b/x/btccheckpoint/types/params.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btccheckpoint/params.proto +// source: babylon/btccheckpoint/v1/params.proto package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -29,19 +29,23 @@ type Params struct { // 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"` - // checkpoint_finalization_timeout is the maximum time window (measured in BTC blocks) between a checkpoint + // 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) + // 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"` + // 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"` } func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_4beca7ec42c8d1bd, []int{0} + return fileDescriptor_5445a19005ae983c, []int{0} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -84,33 +88,43 @@ func (m *Params) GetCheckpointFinalizationTimeout() uint64 { return 0 } +func (m *Params) GetCheckpointTag() string { + if m != nil { + return m.CheckpointTag + } + return "" +} + func init() { proto.RegisterType((*Params)(nil), "babylon.btccheckpoint.v1.Params") } func init() { - proto.RegisterFile("babylon/btccheckpoint/params.proto", fileDescriptor_4beca7ec42c8d1bd) + proto.RegisterFile("babylon/btccheckpoint/v1/params.proto", fileDescriptor_5445a19005ae983c) } -var fileDescriptor_4beca7ec42c8d1bd = []byte{ - // 268 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, +var fileDescriptor_5445a19005ae983c = []byte{ + // 306 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0x4e, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, - 0x2b, 0xd1, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, - 0x80, 0xaa, 0xd1, 0x43, 0x51, 0xa3, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, - 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0xdd, 0x66, 0xe4, 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, 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, 0xa5, 0x20, 0x59, - 0x84, 0x0a, 0x37, 0x24, 0x05, 0x21, 0x10, 0x79, 0x2b, 0x96, 0x17, 0x0b, 0xe4, 0x19, 0x9d, 0xfc, - 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, - 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x34, 0x3d, 0xb3, 0x24, 0xa3, - 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x1a, 0x64, 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, 0x8e, - 0x7e, 0x05, 0x5a, 0x28, 0x97, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0x43, 0xcd, 0x18, 0x10, - 0x00, 0x00, 0xff, 0xff, 0xd8, 0x05, 0x8f, 0x44, 0x8b, 0x01, 0x00, 0x00, + 0x2b, 0xd1, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x92, 0x80, 0x2a, 0xd3, 0x43, 0x51, 0xa6, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, + 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, + 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, + 0xa5, 0x20, 0x59, 0x84, 0x0a, 0x37, 0x24, 0x05, 0x21, 0x10, 0x79, 0x21, 0x07, 0x2e, 0x3e, 0x24, + 0x23, 0x4a, 0x12, 0xd3, 0x25, 0x98, 0x15, 0x18, 0x35, 0x38, 0x9d, 0x24, 0x3f, 0xdd, 0x93, 0x17, + 0xc5, 0xb0, 0xa2, 0x24, 0x31, 0x5d, 0x29, 0x88, 0x17, 0x21, 0x10, 0x92, 0x98, 0x6e, 0xc5, 0xf2, + 0x62, 0x81, 0x3c, 0xa3, 0x93, 0xff, 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, + 0x99, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x03, 0x3d, 0x39, + 0x23, 0x31, 0x33, 0x0f, 0xc6, 0xd1, 0xaf, 0x40, 0x8b, 0xaa, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, + 0x36, 0x70, 0xb8, 0x1b, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x78, 0xcb, 0x81, 0xd0, 0x01, + 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -138,6 +152,9 @@ func (this *Params) Equal(that interface{}) bool { if this.CheckpointFinalizationTimeout != that1.CheckpointFinalizationTimeout { return false } + if this.CheckpointTag != that1.CheckpointTag { + return false + } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -160,6 +177,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.CheckpointTag) > 0 { + i -= len(m.CheckpointTag) + copy(dAtA[i:], m.CheckpointTag) + i = encodeVarintParams(dAtA, i, uint64(len(m.CheckpointTag))) + i-- + dAtA[i] = 0x1a + } if m.CheckpointFinalizationTimeout != 0 { i = encodeVarintParams(dAtA, i, uint64(m.CheckpointFinalizationTimeout)) i-- @@ -196,6 +220,10 @@ func (m *Params) Size() (n int) { if m.CheckpointFinalizationTimeout != 0 { n += 1 + sovParams(uint64(m.CheckpointFinalizationTimeout)) } + l = len(m.CheckpointTag) + if l > 0 { + n += 1 + l + sovParams(uint64(l)) + } return n } @@ -272,6 +300,38 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CheckpointTag", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + 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 ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CheckpointTag = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/btccheckpoint/types/query.pb.go b/x/btccheckpoint/types/query.pb.go index c1227dbfd..65b155490 100644 --- a/x/btccheckpoint/types/query.pb.go +++ b/x/btccheckpoint/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btccheckpoint/query.proto +// source: babylon/btccheckpoint/v1/query.proto package types @@ -7,9 +7,9 @@ import ( context "context" fmt "fmt" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -38,7 +38,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{0} + return fileDescriptor_6b9a2f46ada7d854, []int{0} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -77,7 +77,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{1} + return fileDescriptor_6b9a2f46ada7d854, []int{1} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -113,8 +113,11 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// QueryBtcCheckpointInfoRequest defines the query to get the best checkpoint +// for a given epoch type QueryBtcCheckpointInfoRequest struct { - // Number of epoch for which the earliest checkpointing btc height is requested + // Number of epoch for which the earliest checkpointing btc height is + // requested EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` } @@ -122,7 +125,7 @@ func (m *QueryBtcCheckpointInfoRequest) Reset() { *m = QueryBtcCheckpoin func (m *QueryBtcCheckpointInfoRequest) String() string { return proto.CompactTextString(m) } func (*QueryBtcCheckpointInfoRequest) ProtoMessage() {} func (*QueryBtcCheckpointInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{2} + return fileDescriptor_6b9a2f46ada7d854, []int{2} } func (m *QueryBtcCheckpointInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -158,7 +161,8 @@ func (m *QueryBtcCheckpointInfoRequest) GetEpochNum() uint64 { return 0 } -// QueryBtcCheckpointInfoResponse is response type for the Query/BtcCheckpointInfo RPC method +// QueryBtcCheckpointInfoResponse is response type for the +// Query/BtcCheckpointInfo RPC method type QueryBtcCheckpointInfoResponse struct { Info *BTCCheckpointInfo `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"` } @@ -167,7 +171,7 @@ func (m *QueryBtcCheckpointInfoResponse) Reset() { *m = QueryBtcCheckpoi func (m *QueryBtcCheckpointInfoResponse) String() string { return proto.CompactTextString(m) } func (*QueryBtcCheckpointInfoResponse) ProtoMessage() {} func (*QueryBtcCheckpointInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{3} + return fileDescriptor_6b9a2f46ada7d854, []int{3} } func (m *QueryBtcCheckpointInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -203,19 +207,18 @@ func (m *QueryBtcCheckpointInfoResponse) GetInfo() *BTCCheckpointInfo { return nil } -// QueryBtcCheckpointsInfoRequest is request type for the Query/BtcCheckpointsInfo RPC method +// QueryBtcCheckpointsInfoRequest is request type for the +// Query/BtcCheckpointsInfo RPC method type QueryBtcCheckpointsInfoRequest struct { - StartEpoch uint64 `protobuf:"varint,1,opt,name=start_epoch,json=startEpoch,proto3" json:"start_epoch,omitempty"` - EndEpoch uint64 `protobuf:"varint,2,opt,name=end_epoch,json=endEpoch,proto3" json:"end_epoch,omitempty"` // pagination defines whether to have the pagination in the request - Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryBtcCheckpointsInfoRequest) Reset() { *m = QueryBtcCheckpointsInfoRequest{} } func (m *QueryBtcCheckpointsInfoRequest) String() string { return proto.CompactTextString(m) } func (*QueryBtcCheckpointsInfoRequest) ProtoMessage() {} func (*QueryBtcCheckpointsInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{4} + return fileDescriptor_6b9a2f46ada7d854, []int{4} } func (m *QueryBtcCheckpointsInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -244,20 +247,6 @@ func (m *QueryBtcCheckpointsInfoRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBtcCheckpointsInfoRequest proto.InternalMessageInfo -func (m *QueryBtcCheckpointsInfoRequest) GetStartEpoch() uint64 { - if m != nil { - return m.StartEpoch - } - return 0 -} - -func (m *QueryBtcCheckpointsInfoRequest) GetEndEpoch() uint64 { - if m != nil { - return m.EndEpoch - } - return 0 -} - func (m *QueryBtcCheckpointsInfoRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination @@ -265,7 +254,8 @@ func (m *QueryBtcCheckpointsInfoRequest) GetPagination() *query.PageRequest { return nil } -// QueryBtcCheckpointsInfoResponse is response type for the Query/BtcCheckpointsInfo RPC method +// QueryBtcCheckpointsInfoResponse is response type for the +// Query/BtcCheckpointsInfo RPC method type QueryBtcCheckpointsInfoResponse struct { InfoList []*BTCCheckpointInfo `protobuf:"bytes,1,rep,name=info_list,json=infoList,proto3" json:"info_list,omitempty"` // pagination defines the pagination in the response @@ -276,7 +266,7 @@ func (m *QueryBtcCheckpointsInfoResponse) Reset() { *m = QueryBtcCheckpo func (m *QueryBtcCheckpointsInfoResponse) String() string { return proto.CompactTextString(m) } func (*QueryBtcCheckpointsInfoResponse) ProtoMessage() {} func (*QueryBtcCheckpointsInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{5} + return fileDescriptor_6b9a2f46ada7d854, []int{5} } func (m *QueryBtcCheckpointsInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -319,6 +309,8 @@ func (m *QueryBtcCheckpointsInfoResponse) GetPagination() *query.PageResponse { return nil } +// QueryEpochSubmissionsRequest defines a request to get all submissions in +// given epoch type QueryEpochSubmissionsRequest struct { // Number of epoch for which submissions are requested EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` @@ -329,7 +321,7 @@ func (m *QueryEpochSubmissionsRequest) Reset() { *m = QueryEpochSubmissi func (m *QueryEpochSubmissionsRequest) String() string { return proto.CompactTextString(m) } func (*QueryEpochSubmissionsRequest) ProtoMessage() {} func (*QueryEpochSubmissionsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{6} + return fileDescriptor_6b9a2f46ada7d854, []int{6} } func (m *QueryEpochSubmissionsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -372,6 +364,8 @@ func (m *QueryEpochSubmissionsRequest) GetPagination() *query.PageRequest { return nil } +// QueryEpochSubmissionsResponse defines a response to get all submissions in +// given epoch (QueryEpochSubmissionsRequest) type QueryEpochSubmissionsResponse struct { // All submissions saved during an epoch. Keys []*SubmissionKey `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"` @@ -382,7 +376,7 @@ func (m *QueryEpochSubmissionsResponse) Reset() { *m = QueryEpochSubmiss func (m *QueryEpochSubmissionsResponse) String() string { return proto.CompactTextString(m) } func (*QueryEpochSubmissionsResponse) ProtoMessage() {} func (*QueryEpochSubmissionsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_009c1165ec392ace, []int{7} + return fileDescriptor_6b9a2f46ada7d854, []int{7} } func (m *QueryEpochSubmissionsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -436,51 +430,51 @@ func init() { proto.RegisterType((*QueryEpochSubmissionsResponse)(nil), "babylon.btccheckpoint.v1.QueryEpochSubmissionsResponse") } -func init() { proto.RegisterFile("babylon/btccheckpoint/query.proto", fileDescriptor_009c1165ec392ace) } - -var fileDescriptor_009c1165ec392ace = []byte{ - // 653 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4d, 0x6f, 0xd3, 0x30, - 0x18, 0xc7, 0xeb, 0xae, 0x9b, 0x36, 0xef, 0x02, 0x66, 0x87, 0x92, 0x8d, 0xac, 0x8b, 0x04, 0x1d, - 0x2f, 0x4b, 0xd4, 0x4d, 0x30, 0x26, 0x10, 0x48, 0x9d, 0x78, 0x13, 0x08, 0x46, 0x81, 0x0b, 0x97, - 0xca, 0xc9, 0xbc, 0x34, 0x5a, 0x63, 0x67, 0xb5, 0x53, 0x51, 0x21, 0x2e, 0xf0, 0x01, 0x40, 0xe2, - 0x33, 0xc0, 0x89, 0x23, 0x5c, 0x91, 0xb8, 0xed, 0x38, 0x89, 0x0b, 0x27, 0x84, 0x5a, 0x3e, 0x08, - 0x8a, 0xe3, 0xf5, 0x3d, 0x6a, 0x3b, 0x71, 0xab, 0x9c, 0xe7, 0xef, 0xff, 0xcf, 0x7f, 0x3f, 0x8f, - 0x0b, 0x57, 0x6c, 0x6c, 0x37, 0xaa, 0x8c, 0x5a, 0xb6, 0x70, 0x9c, 0x0a, 0x71, 0xf6, 0x03, 0xe6, - 0x51, 0x61, 0x1d, 0x84, 0xa4, 0xd6, 0x30, 0x83, 0x1a, 0x13, 0x0c, 0x65, 0x55, 0x89, 0xd9, 0x53, - 0x62, 0xd6, 0x0b, 0xda, 0x82, 0xcb, 0x5c, 0x26, 0x8b, 0xac, 0xe8, 0x57, 0x5c, 0xaf, 0x2d, 0xb9, - 0x8c, 0xb9, 0x55, 0x62, 0xe1, 0xc0, 0xb3, 0x30, 0xa5, 0x4c, 0x60, 0xe1, 0x31, 0xca, 0xd5, 0xd7, - 0x4b, 0x0e, 0xe3, 0x3e, 0xe3, 0x96, 0x8d, 0x39, 0x89, 0x6d, 0xac, 0x7a, 0xc1, 0x26, 0x02, 0x17, - 0xac, 0x00, 0xbb, 0x1e, 0x95, 0xc5, 0xaa, 0xd6, 0x18, 0x0e, 0x17, 0xe0, 0x1a, 0xf6, 0x8f, 0xf7, - 0xbb, 0x38, 0xbc, 0xa6, 0x97, 0x55, 0x96, 0x1a, 0x0b, 0x10, 0x3d, 0x8d, 0x0c, 0x77, 0xa4, 0xbe, - 0x44, 0x0e, 0x42, 0xc2, 0x85, 0xf1, 0x02, 0x9e, 0xe9, 0x59, 0xe5, 0x01, 0xa3, 0x9c, 0xa0, 0x5b, - 0x70, 0x26, 0xf6, 0xc9, 0x82, 0x1c, 0x58, 0x9d, 0x5f, 0xcf, 0x99, 0x49, 0x31, 0x98, 0xb1, 0xb2, - 0x98, 0x39, 0xfc, 0xbd, 0x9c, 0x2a, 0x29, 0x95, 0x71, 0x13, 0x9e, 0x93, 0xdb, 0x16, 0x85, 0xb3, - 0xdd, 0xae, 0x7e, 0x40, 0xf7, 0x98, 0xf2, 0x45, 0x8b, 0x70, 0x8e, 0x04, 0xcc, 0xa9, 0x94, 0x69, - 0xe8, 0x4b, 0x8f, 0x4c, 0x69, 0x56, 0x2e, 0x3c, 0x0e, 0x7d, 0x03, 0x43, 0x3d, 0x49, 0xad, 0xf8, - 0x6e, 0xc3, 0x8c, 0x47, 0xf7, 0x98, 0xa2, 0xbb, 0x9c, 0x4c, 0x57, 0x7c, 0xbe, 0xdd, 0xb7, 0x85, - 0x14, 0x1a, 0x9f, 0xc1, 0x30, 0x0f, 0xde, 0x8d, 0xb8, 0x0c, 0xe7, 0xb9, 0xc0, 0x35, 0x51, 0x96, - 0x5c, 0x0a, 0x12, 0xca, 0xa5, 0x3b, 0xd1, 0x8a, 0x3c, 0x03, 0xdd, 0x55, 0x9f, 0xd3, 0xea, 0x0c, - 0x74, 0x37, 0xfe, 0x78, 0x17, 0xc2, 0xce, 0x8d, 0x66, 0xa7, 0x24, 0xe7, 0x05, 0x33, 0xbe, 0x7e, - 0x33, 0xba, 0x7e, 0x33, 0xee, 0x32, 0x75, 0xfd, 0xe6, 0x0e, 0x76, 0x89, 0x72, 0x2e, 0x75, 0x29, - 0x8d, 0xaf, 0x00, 0x2e, 0x27, 0x82, 0xaa, 0x34, 0xee, 0xc3, 0xb9, 0xe8, 0x50, 0xe5, 0xaa, 0xc7, - 0x45, 0x16, 0xe4, 0xa6, 0x26, 0x8d, 0x64, 0x36, 0x52, 0x3f, 0xf2, 0xb8, 0x40, 0xf7, 0x7a, 0xa8, - 0xd3, 0x92, 0x3a, 0x3f, 0x92, 0x3a, 0xc6, 0xe8, 0xc1, 0x7e, 0x07, 0xe0, 0x92, 0xc4, 0x96, 0x69, - 0x3c, 0x0b, 0x6d, 0xdf, 0xe3, 0x3c, 0x1a, 0x84, 0x71, 0x1a, 0xa0, 0x2f, 0xbc, 0xf4, 0x89, 0xc3, - 0xfb, 0x04, 0x54, 0x1f, 0x0e, 0x52, 0xa8, 0xe8, 0x6e, 0xc0, 0xcc, 0x3e, 0x69, 0x70, 0x95, 0x5a, - 0x3e, 0x39, 0xb5, 0x8e, 0xf8, 0x21, 0x69, 0x94, 0xa4, 0xe8, 0xbf, 0xa5, 0xb5, 0xfe, 0x63, 0x1a, - 0x4e, 0x4b, 0x4e, 0xf4, 0x1e, 0xc0, 0x99, 0x78, 0xa2, 0xd0, 0x95, 0x64, 0x98, 0xc1, 0x41, 0xd6, - 0xd6, 0xc6, 0xac, 0x8e, 0xdd, 0x8d, 0xd5, 0xb7, 0x3f, 0xff, 0x7e, 0x4c, 0x1b, 0x28, 0x67, 0x0d, - 0x7f, 0x41, 0xea, 0x05, 0xf5, 0xd0, 0xa0, 0x6f, 0x00, 0x9e, 0x1e, 0x18, 0x44, 0xb4, 0x39, 0xc2, - 0x2e, 0x69, 0xf0, 0xb5, 0xeb, 0x93, 0x0b, 0x15, 0xf2, 0x9a, 0x44, 0xce, 0xa3, 0xf3, 0xc9, 0xc8, - 0xaf, 0xdb, 0x2d, 0xf5, 0x06, 0x7d, 0x01, 0x10, 0x0d, 0xce, 0x0c, 0x9a, 0xc8, 0xbf, 0xfb, 0x3d, - 0xd0, 0xb6, 0x4e, 0xa0, 0x54, 0xe8, 0x2b, 0x12, 0x7d, 0x11, 0x9d, 0x4d, 0x44, 0x47, 0xdf, 0x01, - 0x3c, 0xd5, 0xdf, 0xa5, 0xe8, 0xda, 0x08, 0xcb, 0x84, 0xe1, 0xd2, 0x36, 0x27, 0xd6, 0x29, 0xd0, - 0x2d, 0x09, 0xba, 0x81, 0x0a, 0x63, 0x65, 0x6c, 0xf1, 0xce, 0x16, 0xc5, 0x27, 0x87, 0x4d, 0x1d, - 0x1c, 0x35, 0x75, 0xf0, 0xa7, 0xa9, 0x83, 0x0f, 0x2d, 0x3d, 0x75, 0xd4, 0xd2, 0x53, 0xbf, 0x5a, - 0x7a, 0xea, 0xe5, 0x55, 0xd7, 0x13, 0x95, 0xd0, 0x36, 0x1d, 0xe6, 0x1f, 0x6f, 0xeb, 0x54, 0xb0, - 0x47, 0xdb, 0x1e, 0xaf, 0xfa, 0x5c, 0x44, 0x23, 0x20, 0xdc, 0x9e, 0x91, 0xff, 0x5b, 0x1b, 0xff, - 0x02, 0x00, 0x00, 0xff, 0xff, 0xb5, 0x86, 0x0a, 0xe9, 0xa5, 0x07, 0x00, 0x00, +func init() { + proto.RegisterFile("babylon/btccheckpoint/v1/query.proto", fileDescriptor_6b9a2f46ada7d854) +} + +var fileDescriptor_6b9a2f46ada7d854 = []byte{ + // 621 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0x4d, 0x6b, 0x13, 0x4f, + 0x1c, 0xc7, 0x33, 0xf9, 0xa7, 0xa1, 0x9d, 0xff, 0x45, 0xc7, 0x1e, 0xe2, 0xb6, 0x6e, 0xe3, 0x62, + 0x4d, 0xd1, 0x76, 0x97, 0xb4, 0x68, 0x2d, 0x8a, 0x42, 0x8a, 0x4f, 0x28, 0x5a, 0xa3, 0x5e, 0xbc, + 0x94, 0xd9, 0x65, 0xba, 0x59, 0x9a, 0x9d, 0xd9, 0x66, 0x66, 0x83, 0x41, 0xbc, 0xe8, 0x0b, 0x50, + 0xf0, 0x35, 0x78, 0xf3, 0xa8, 0x57, 0xc1, 0x5b, 0x8f, 0x05, 0x2f, 0x9e, 0x44, 0x12, 0x5f, 0x88, + 0xec, 0xec, 0x34, 0x8f, 0x0e, 0x49, 0x8a, 0xb7, 0xb0, 0xf9, 0x7e, 0x7f, 0xdf, 0xcf, 0xfe, 0x1e, + 0x12, 0x78, 0xc1, 0xc5, 0x6e, 0xab, 0xce, 0xa8, 0xe3, 0x0a, 0xcf, 0xab, 0x11, 0x6f, 0x3f, 0x62, + 0x01, 0x15, 0x4e, 0xb3, 0xec, 0x1c, 0xc4, 0xa4, 0xd1, 0xb2, 0xa3, 0x06, 0x13, 0x0c, 0x15, 0x94, + 0xca, 0x1e, 0x50, 0xd9, 0xcd, 0xb2, 0x31, 0xef, 0x33, 0x9f, 0x49, 0x91, 0x93, 0x7c, 0x4a, 0xf5, + 0xc6, 0xa2, 0xcf, 0x98, 0x5f, 0x27, 0x0e, 0x8e, 0x02, 0x07, 0x53, 0xca, 0x04, 0x16, 0x01, 0xa3, + 0x5c, 0x7d, 0x7b, 0xc9, 0x63, 0x3c, 0x64, 0xdc, 0x71, 0x31, 0x27, 0x69, 0x8c, 0xd3, 0x2c, 0xbb, + 0x44, 0xe0, 0xb2, 0x13, 0x61, 0x3f, 0xa0, 0x52, 0xac, 0xb4, 0xcb, 0x5a, 0xbe, 0x08, 0x37, 0x70, + 0x78, 0x5c, 0x72, 0x55, 0x2b, 0x1b, 0x24, 0x96, 0x6a, 0x6b, 0x1e, 0xa2, 0x27, 0x49, 0xec, 0x8e, + 0x2c, 0x51, 0x25, 0x07, 0x31, 0xe1, 0xc2, 0x7a, 0x0e, 0xcf, 0x0c, 0x3c, 0xe5, 0x11, 0xa3, 0x9c, + 0xa0, 0x9b, 0x30, 0x9f, 0x46, 0x15, 0x40, 0x11, 0xac, 0xfc, 0xbf, 0x5e, 0xb4, 0x75, 0xcd, 0xb0, + 0x53, 0x67, 0x25, 0x77, 0xf8, 0x73, 0x29, 0x53, 0x55, 0x2e, 0xeb, 0x06, 0x3c, 0x27, 0xcb, 0x56, + 0x84, 0xb7, 0xdd, 0x55, 0xdf, 0xa7, 0x7b, 0x4c, 0xe5, 0xa2, 0x05, 0x38, 0x47, 0x22, 0xe6, 0xd5, + 0x76, 0x69, 0x1c, 0xca, 0x8c, 0x5c, 0x75, 0x56, 0x3e, 0x78, 0x14, 0x87, 0x16, 0x86, 0xa6, 0xce, + 0xad, 0xf8, 0x6e, 0xc1, 0x5c, 0x40, 0xf7, 0x98, 0xa2, 0xbb, 0xac, 0xa7, 0xab, 0x3c, 0xdb, 0x1e, + 0x2a, 0x21, 0x8d, 0x56, 0xed, 0x6f, 0x11, 0xbc, 0x9f, 0xf0, 0x0e, 0x84, 0xbd, 0xc1, 0xa8, 0xa0, + 0x8b, 0x76, 0x3a, 0x45, 0x3b, 0x99, 0xa2, 0x9d, 0x2e, 0x8b, 0x9a, 0xa2, 0xbd, 0x83, 0x7d, 0xa2, + 0xbc, 0xd5, 0x3e, 0xa7, 0xf5, 0x19, 0xc0, 0x25, 0x6d, 0x94, 0x7a, 0x9d, 0x7b, 0x70, 0x2e, 0xa1, + 0xda, 0xad, 0x07, 0x5c, 0x14, 0x40, 0xf1, 0xbf, 0x69, 0xdf, 0x69, 0x36, 0x71, 0x3f, 0x0c, 0xb8, + 0x40, 0x77, 0x07, 0xa8, 0xb3, 0x92, 0xba, 0x34, 0x96, 0x3a, 0xc5, 0x18, 0xc0, 0x7e, 0x0b, 0xe0, + 0xa2, 0xc4, 0xbe, 0x9d, 0x4c, 0xe5, 0x69, 0xec, 0x86, 0x01, 0xe7, 0xc9, 0x3e, 0x4f, 0x32, 0xc1, + 0xa1, 0xe6, 0x65, 0x4f, 0xdc, 0xbc, 0x8f, 0x40, 0x2d, 0xd2, 0x28, 0x85, 0x6a, 0xdd, 0x75, 0x98, + 0xdb, 0x27, 0x2d, 0xae, 0xba, 0x56, 0xd2, 0x77, 0xad, 0x67, 0x7e, 0x40, 0x5a, 0x55, 0x69, 0xfa, + 0x67, 0xdd, 0x5a, 0xff, 0x36, 0x03, 0x67, 0x24, 0x27, 0x7a, 0x07, 0x60, 0x3e, 0x3d, 0x09, 0xb4, + 0xaa, 0x87, 0x19, 0xbd, 0x44, 0x63, 0x6d, 0x42, 0x75, 0x9a, 0x6e, 0xad, 0xbc, 0xf9, 0xfe, 0xfb, + 0x43, 0xd6, 0x42, 0x45, 0x67, 0xcc, 0x8f, 0x05, 0xfa, 0x02, 0xe0, 0xe9, 0x91, 0x4b, 0x42, 0x9b, + 0x63, 0xe2, 0x74, 0x97, 0x6b, 0x5c, 0x9b, 0xde, 0xa8, 0x90, 0xd7, 0x24, 0x72, 0x09, 0x2d, 0xeb, + 0x91, 0x5f, 0x75, 0x57, 0xea, 0x35, 0xfa, 0x04, 0x20, 0x1a, 0xbd, 0x19, 0x34, 0x55, 0x7e, 0xff, + 0x45, 0x1b, 0x5b, 0x27, 0x70, 0x2a, 0xf4, 0xf3, 0x12, 0x7d, 0x01, 0x9d, 0xd5, 0xa2, 0xa3, 0xaf, + 0x00, 0x9e, 0x1a, 0xde, 0x52, 0x74, 0x75, 0x4c, 0xa4, 0xe6, 0xb8, 0x8c, 0xcd, 0xa9, 0x7d, 0x0a, + 0x74, 0x4b, 0x82, 0x6e, 0xa0, 0xf2, 0x44, 0x3d, 0x76, 0x78, 0xaf, 0x44, 0xe5, 0xf1, 0x61, 0xdb, + 0x04, 0x47, 0x6d, 0x13, 0xfc, 0x6a, 0x9b, 0xe0, 0x7d, 0xc7, 0xcc, 0x1c, 0x75, 0xcc, 0xcc, 0x8f, + 0x8e, 0x99, 0x79, 0x71, 0xc5, 0x0f, 0x44, 0x2d, 0x76, 0x6d, 0x8f, 0x85, 0xc7, 0x65, 0xbd, 0x1a, + 0x0e, 0x68, 0x37, 0xe3, 0xe5, 0x50, 0x8a, 0x68, 0x45, 0x84, 0xbb, 0x79, 0xf9, 0xc7, 0xb3, 0xf1, + 0x27, 0x00, 0x00, 0xff, 0xff, 0x19, 0x16, 0x59, 0xdc, 0x6f, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -501,6 +495,7 @@ type QueryClient interface { BtcCheckpointInfo(ctx context.Context, in *QueryBtcCheckpointInfoRequest, opts ...grpc.CallOption) (*QueryBtcCheckpointInfoResponse, error) // BtcCheckpointsInfo returns checkpoint info for a range of epochs BtcCheckpointsInfo(ctx context.Context, in *QueryBtcCheckpointsInfoRequest, opts ...grpc.CallOption) (*QueryBtcCheckpointsInfoResponse, error) + // EpochSubmissions returns all submissions for a given epoch EpochSubmissions(ctx context.Context, in *QueryEpochSubmissionsRequest, opts ...grpc.CallOption) (*QueryEpochSubmissionsResponse, error) } @@ -556,6 +551,7 @@ type QueryServer interface { BtcCheckpointInfo(context.Context, *QueryBtcCheckpointInfoRequest) (*QueryBtcCheckpointInfoResponse, error) // BtcCheckpointsInfo returns checkpoint info for a range of epochs BtcCheckpointsInfo(context.Context, *QueryBtcCheckpointsInfoRequest) (*QueryBtcCheckpointsInfoResponse, error) + // EpochSubmissions returns all submissions for a given epoch EpochSubmissions(context.Context, *QueryEpochSubmissionsRequest) (*QueryEpochSubmissionsResponse, error) } @@ -674,7 +670,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/btccheckpoint/query.proto", + Metadata: "babylon/btccheckpoint/v1/query.proto", } func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { @@ -826,17 +822,7 @@ func (m *QueryBtcCheckpointsInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - } - if m.EndEpoch != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.EndEpoch)) - i-- - dAtA[i] = 0x10 - } - if m.StartEpoch != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.StartEpoch)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -1041,12 +1027,6 @@ func (m *QueryBtcCheckpointsInfoRequest) Size() (n int) { } var l int _ = l - if m.StartEpoch != 0 { - n += 1 + sovQuery(uint64(m.StartEpoch)) - } - if m.EndEpoch != 0 { - n += 1 + sovQuery(uint64(m.EndEpoch)) - } if m.Pagination != nil { l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) @@ -1432,44 +1412,6 @@ func (m *QueryBtcCheckpointsInfoRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartEpoch", wireType) - } - m.StartEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndEpoch", wireType) - } - m.EndEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EndEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } diff --git a/x/btccheckpoint/types/query.pb.gw.go b/x/btccheckpoint/types/query.pb.gw.go index 06ee42575..87a078f9e 100644 --- a/x/btccheckpoint/types/query.pb.gw.go +++ b/x/btccheckpoint/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: babylon/btccheckpoint/query.proto +// source: babylon/btccheckpoint/v1/query.proto /* Package types is a reverse proxy. diff --git a/x/btccheckpoint/types/tx.pb.go b/x/btccheckpoint/types/tx.pb.go index 654faf41a..d36a3a6ba 100644 --- a/x/btccheckpoint/types/tx.pb.go +++ b/x/btccheckpoint/types/tx.pb.go @@ -1,14 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btccheckpoint/tx.proto +// source: babylon/btccheckpoint/v1/tx.proto package types import ( context "context" fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -28,6 +30,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgInsertBTCSpvProof defines resquest to insert a new checkpoint into the +// store type MsgInsertBTCSpvProof struct { Submitter string `protobuf:"bytes,1,opt,name=submitter,proto3" json:"submitter,omitempty"` Proofs []*BTCSpvProof `protobuf:"bytes,2,rep,name=proofs,proto3" json:"proofs,omitempty"` @@ -37,7 +41,7 @@ func (m *MsgInsertBTCSpvProof) Reset() { *m = MsgInsertBTCSpvProof{} } func (m *MsgInsertBTCSpvProof) String() string { return proto.CompactTextString(m) } func (*MsgInsertBTCSpvProof) ProtoMessage() {} func (*MsgInsertBTCSpvProof) Descriptor() ([]byte, []int) { - return fileDescriptor_aeec89810b39ea83, []int{0} + return fileDescriptor_69a562325f8b35c5, []int{0} } func (m *MsgInsertBTCSpvProof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -80,6 +84,8 @@ func (m *MsgInsertBTCSpvProof) GetProofs() []*BTCSpvProof { return nil } +// MsgInsertBTCSpvProofResponse defines the response for the +// MsgInsertBTCSpvProof message type MsgInsertBTCSpvProofResponse struct { } @@ -87,7 +93,7 @@ func (m *MsgInsertBTCSpvProofResponse) Reset() { *m = MsgInsertBTCSpvPro func (m *MsgInsertBTCSpvProofResponse) String() string { return proto.CompactTextString(m) } func (*MsgInsertBTCSpvProofResponse) ProtoMessage() {} func (*MsgInsertBTCSpvProofResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_aeec89810b39ea83, []int{1} + return fileDescriptor_69a562325f8b35c5, []int{1} } func (m *MsgInsertBTCSpvProofResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -116,32 +122,141 @@ func (m *MsgInsertBTCSpvProofResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgInsertBTCSpvProofResponse proto.InternalMessageInfo +// MsgUpdateParams defines a message to update the btccheckpoint module params. +type MsgUpdateParams struct { + // authority is the address of the governance account. + // just FYI: cosmos.AddressString marks that this field should use type alias + // for AddressString instead of string, but the functionality is not yet implemented + // in cosmos-proto + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the btccheckpoint parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_69a562325f8b35c5, []int{2} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse defines the response to the MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_69a562325f8b35c5, []int{3} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgInsertBTCSpvProof)(nil), "babylon.btccheckpoint.v1.MsgInsertBTCSpvProof") proto.RegisterType((*MsgInsertBTCSpvProofResponse)(nil), "babylon.btccheckpoint.v1.MsgInsertBTCSpvProofResponse") -} - -func init() { proto.RegisterFile("babylon/btccheckpoint/tx.proto", fileDescriptor_aeec89810b39ea83) } - -var fileDescriptor_aeec89810b39ea83 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0x4e, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, - 0x2b, 0xd1, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80, 0xca, 0xeb, 0xa1, - 0xc8, 0xeb, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x15, 0xe9, 0x83, 0x58, 0x10, - 0xf5, 0x52, 0x9a, 0xd8, 0xcd, 0x43, 0xd5, 0x0d, 0x56, 0xaa, 0x54, 0xcc, 0x25, 0xe2, 0x5b, 0x9c, - 0xee, 0x99, 0x57, 0x9c, 0x5a, 0x54, 0xe2, 0x14, 0xe2, 0x1c, 0x5c, 0x50, 0x16, 0x50, 0x94, 0x9f, - 0x9f, 0x26, 0x24, 0xc3, 0xc5, 0x59, 0x5c, 0x9a, 0x94, 0x9b, 0x59, 0x52, 0x92, 0x5a, 0x24, 0xc1, - 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0x84, 0x10, 0x10, 0xb2, 0xe5, 0x62, 0x2b, 0x00, 0x29, 0x2b, 0x96, - 0x60, 0x52, 0x60, 0xd6, 0xe0, 0x36, 0x52, 0xd5, 0xc3, 0xe5, 0x42, 0x3d, 0x24, 0x43, 0x83, 0xa0, - 0x9a, 0x94, 0xe4, 0xb8, 0x64, 0xb0, 0x59, 0x1a, 0x94, 0x5a, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x6a, - 0xd4, 0xc4, 0xc8, 0xc5, 0xec, 0x5b, 0x9c, 0x2e, 0x54, 0xcd, 0x25, 0x88, 0xe9, 0x32, 0x3d, 0xdc, - 0x76, 0x61, 0x33, 0x54, 0xca, 0x8c, 0x34, 0xf5, 0x30, 0x47, 0x38, 0xf9, 0x9f, 0x78, 0x24, 0xc7, - 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, - 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x69, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, - 0x7e, 0xae, 0x3e, 0xd4, 0xec, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x18, 0x47, 0xbf, 0x02, 0x3d, 0x22, - 0x2b, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x21, 0x6e, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xc2, - 0x5a, 0x56, 0xbd, 0xee, 0x01, 0x00, 0x00, + proto.RegisterType((*MsgUpdateParams)(nil), "babylon.btccheckpoint.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "babylon.btccheckpoint.v1.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("babylon/btccheckpoint/v1/tx.proto", fileDescriptor_69a562325f8b35c5) } + +var fileDescriptor_69a562325f8b35c5 = []byte{ + // 425 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0xcb, 0xaa, 0xd3, 0x40, + 0x18, 0xce, 0x9c, 0x23, 0x85, 0xce, 0x11, 0xc5, 0x50, 0x38, 0x69, 0x28, 0x31, 0x06, 0x0a, 0x55, + 0x34, 0xa1, 0x15, 0xbb, 0x10, 0x14, 0x8c, 0x2b, 0x17, 0xc5, 0x92, 0xea, 0xc6, 0x8d, 0x24, 0xe9, + 0x38, 0x09, 0x36, 0x99, 0x61, 0xfe, 0x69, 0x69, 0x71, 0xe7, 0x13, 0xb8, 0xf5, 0x2d, 0x5c, 0xf8, + 0x10, 0x5d, 0x16, 0x57, 0xae, 0x44, 0xda, 0x85, 0x5b, 0x1f, 0x41, 0x9a, 0x0b, 0xbd, 0xd8, 0x88, + 0x67, 0x37, 0xff, 0xcc, 0x77, 0x9b, 0x8f, 0x1f, 0xdf, 0x09, 0xfc, 0x60, 0x31, 0x61, 0xa9, 0x13, + 0xc8, 0x30, 0x8c, 0x48, 0xf8, 0x9e, 0xb3, 0x38, 0x95, 0xce, 0xac, 0xeb, 0xc8, 0xb9, 0xcd, 0x05, + 0x93, 0x4c, 0xd5, 0x0a, 0x88, 0x7d, 0x00, 0xb1, 0x67, 0x5d, 0xfd, 0x7e, 0x25, 0xf9, 0x10, 0x9a, + 0xe9, 0xe8, 0xcd, 0x90, 0x41, 0xc2, 0xe0, 0x6d, 0x36, 0x39, 0xf9, 0x50, 0x3c, 0x5d, 0xe6, 0x93, + 0x93, 0x00, 0xdd, 0xb2, 0x13, 0xa0, 0xc5, 0x43, 0xbb, 0xd2, 0x81, 0xfb, 0xc2, 0x4f, 0x4a, 0x7e, + 0x83, 0x32, 0xca, 0x72, 0xdd, 0xed, 0x29, 0xbf, 0xb5, 0x00, 0x37, 0x06, 0x40, 0x5f, 0xa4, 0x40, + 0x84, 0x74, 0x5f, 0x3d, 0x1f, 0xf1, 0xd9, 0x50, 0x30, 0xf6, 0x4e, 0x6d, 0xe1, 0x3a, 0x4c, 0x83, + 0x24, 0x96, 0x92, 0x08, 0x0d, 0x99, 0xa8, 0x53, 0xf7, 0x76, 0x17, 0xea, 0x13, 0x5c, 0xe3, 0x5b, + 0x18, 0x68, 0x67, 0xe6, 0x79, 0xe7, 0xa2, 0xd7, 0xb6, 0xab, 0xfe, 0x6f, 0xef, 0x89, 0x7a, 0x05, + 0xc9, 0x32, 0x70, 0xeb, 0x94, 0xa9, 0x47, 0x80, 0xb3, 0x14, 0x88, 0xf5, 0x19, 0xe1, 0x9b, 0x03, + 0xa0, 0xaf, 0xf9, 0xd8, 0x97, 0x64, 0x98, 0x7d, 0x42, 0xed, 0xe3, 0xba, 0x3f, 0x95, 0x11, 0x13, + 0xb1, 0x5c, 0xe4, 0x81, 0x5c, 0xed, 0xdb, 0xd7, 0x07, 0x8d, 0xa2, 0xa3, 0x67, 0xe3, 0xb1, 0x20, + 0x00, 0x23, 0x29, 0xe2, 0x94, 0x7a, 0x3b, 0xa8, 0xfa, 0x14, 0xd7, 0xf2, 0x1a, 0xb4, 0x33, 0x13, + 0x75, 0x2e, 0x7a, 0x66, 0x75, 0xd4, 0xdc, 0xc9, 0xbd, 0xb6, 0xfc, 0x71, 0x5b, 0xf1, 0x0a, 0xd6, + 0xe3, 0x1b, 0x1f, 0x7f, 0x7d, 0xb9, 0xb7, 0xd3, 0xb3, 0x9a, 0xf8, 0xf2, 0x28, 0x5a, 0x19, 0xbb, + 0xf7, 0x1b, 0xe1, 0xf3, 0x01, 0x50, 0xf5, 0x03, 0xbe, 0xf5, 0x77, 0xa1, 0x76, 0xb5, 0xef, 0xa9, + 0x2e, 0xf4, 0xfe, 0xd5, 0xf0, 0x65, 0x08, 0x75, 0x82, 0xaf, 0x1f, 0xf4, 0x76, 0xf7, 0x9f, 0x3a, + 0xfb, 0x50, 0xbd, 0xfb, 0xdf, 0xd0, 0xd2, 0xcd, 0x7d, 0xb9, 0x5c, 0x1b, 0x68, 0xb5, 0x36, 0xd0, + 0xcf, 0xb5, 0x81, 0x3e, 0x6d, 0x0c, 0x65, 0xb5, 0x31, 0x94, 0xef, 0x1b, 0x43, 0x79, 0xf3, 0x88, + 0xc6, 0x32, 0x9a, 0x06, 0x76, 0xc8, 0x12, 0xa7, 0x90, 0x0d, 0x23, 0x3f, 0x4e, 0xcb, 0xc1, 0x99, + 0x1f, 0xed, 0xab, 0x5c, 0x70, 0x02, 0x41, 0x2d, 0x5b, 0xcb, 0x87, 0x7f, 0x02, 0x00, 0x00, 0xff, + 0xff, 0x53, 0xca, 0xbd, 0x84, 0x74, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -156,7 +271,10 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // InsertBTCSpvProof tries to insert a new checkpoint into the store. InsertBTCSpvProof(ctx context.Context, in *MsgInsertBTCSpvProof, opts ...grpc.CallOption) (*MsgInsertBTCSpvProofResponse, error) + // UpdateParams updates the btccheckpoint module parameters. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -176,9 +294,21 @@ func (c *msgClient) InsertBTCSpvProof(ctx context.Context, in *MsgInsertBTCSpvPr return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/babylon.btccheckpoint.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { + // InsertBTCSpvProof tries to insert a new checkpoint into the store. InsertBTCSpvProof(context.Context, *MsgInsertBTCSpvProof) (*MsgInsertBTCSpvProofResponse, error) + // UpdateParams updates the btccheckpoint module parameters. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -188,6 +318,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) InsertBTCSpvProof(ctx context.Context, req *MsgInsertBTCSpvProof) (*MsgInsertBTCSpvProofResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method InsertBTCSpvProof not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -211,6 +344,24 @@ func _Msg_InsertBTCSpvProof_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.btccheckpoint.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.btccheckpoint.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -219,9 +370,13 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "InsertBTCSpvProof", Handler: _Msg_InsertBTCSpvProof_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/btccheckpoint/tx.proto", + Metadata: "babylon/btccheckpoint/v1/tx.proto", } func (m *MsgInsertBTCSpvProof) Marshal() (dAtA []byte, err error) { @@ -291,6 +446,69 @@ func (m *MsgInsertBTCSpvProofResponse) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -330,6 +548,30 @@ func (m *MsgInsertBTCSpvProofResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -502,6 +744,171 @@ func (m *MsgInsertBTCSpvProofResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/btccheckpoint/types/types.go b/x/btccheckpoint/types/types.go index 97dfc1211..bec28894e 100644 --- a/x/btccheckpoint/types/types.go +++ b/x/btccheckpoint/types/types.go @@ -32,8 +32,11 @@ type SubmissionBtcInfo struct { // Depth of the youngest btc header of the submission YoungestBlockDepth uint64 - // Index of the latest transaction in youngest submission block - LatestTxIndex uint32 + // Hash of the youngest btc header of the submission + YoungestBlockHash types.BTCHeaderHashBytes + + // Index of the lowest index transaction in youngest submission block + YoungestBlockLowestTxIdx uint32 } func NewRawCheckpointSubmission( @@ -147,7 +150,7 @@ func (newSubmission *SubmissionBtcInfo) IsBetterThan(currentBestSubmission *Subm // at this point we know that both submissions youngest part happens to be in // the same block. To resolve the tie we need to take into account index of // latest transaction of the submissions - return newSubmission.LatestTxIndex < currentBestSubmission.LatestTxIndex + return newSubmission.YoungestBlockLowestTxIdx < currentBestSubmission.YoungestBlockLowestTxIdx } func NewTransactionInfo(txKey *TransactionKey, txBytes []byte, proof []byte) *TransactionInfo { diff --git a/x/btclightclient/client/cli/query.go b/x/btclightclient/client/cli/query.go index 0cb3e0622..98360a8d0 100644 --- a/x/btclightclient/client/cli/query.go +++ b/x/btclightclient/client/cli/query.go @@ -21,7 +21,6 @@ func GetQueryCmd(queryRoute string) *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdQueryParams()) cmd.AddCommand(CmdHashes()) cmd.AddCommand(CmdContains()) cmd.AddCommand(CmdMainChain()) @@ -31,31 +30,6 @@ func GetQueryCmd(queryRoute string) *cobra.Command { return cmd } -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - params := types.NewQueryParamsRequest() - res, err := queryClient.Params(context.Background(), params) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} - func CmdHashes() *cobra.Command { cmd := &cobra.Command{ Use: "hashes", diff --git a/x/btclightclient/genesis.go b/x/btclightclient/genesis.go index 41c718632..3230a5052 100644 --- a/x/btclightclient/genesis.go +++ b/x/btclightclient/genesis.go @@ -9,14 +9,12 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) k.SetBaseBTCHeader(ctx, genState.BaseBtcHeader) } // ExportGenesis returns the capability module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) baseBTCHeader := k.GetBaseBTCHeader(ctx) if baseBTCHeader == nil { panic("A base BTC Header has not been set") diff --git a/x/btclightclient/genesis_test.go b/x/btclightclient/genesis_test.go index b252f61c7..89e2b8b99 100644 --- a/x/btclightclient/genesis_test.go +++ b/x/btclightclient/genesis_test.go @@ -1,9 +1,10 @@ package btclightclient_test import ( - bbn "github.com/babylonchain/babylon/types" "testing" + bbn "github.com/babylonchain/babylon/types" + keepertest "github.com/babylonchain/babylon/testutil/keeper" "github.com/babylonchain/babylon/testutil/nullify" "github.com/babylonchain/babylon/x/btclightclient" @@ -19,7 +20,6 @@ func TestGenesis(t *testing.T) { baseHeaderInfo := types.NewBTCHeaderInfo(&headerBytes, headerHash, headerHeight, &headerWork) genesisState := types.GenesisState{ - Params: types.DefaultParams(), BaseBtcHeader: *baseHeaderInfo, } diff --git a/x/btclightclient/handler.go b/x/btclightclient/handler.go deleted file mode 100644 index 5f6d8b152..000000000 --- a/x/btclightclient/handler.go +++ /dev/null @@ -1,23 +0,0 @@ -package btclightclient - -import ( - "fmt" - - "github.com/babylonchain/babylon/x/btclightclient/keeper" - "github.com/babylonchain/babylon/x/btclightclient/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - _ = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/btclightclient/keeper/base_btc_header_test.go b/x/btclightclient/keeper/base_btc_header_test.go index a7c2bdd86..8fa2eca7f 100644 --- a/x/btclightclient/keeper/base_btc_header_test.go +++ b/x/btclightclient/keeper/base_btc_header_test.go @@ -17,15 +17,15 @@ func FuzzKeeperBaseBTCHeader(f *testing.F) { Data generation: - Create a header. Use it as a parameter to SetBaseBTCHeader */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := keeper.BTCLightClientKeeper(t) retrievedHeaderInfo := blcKeeper.GetBaseBTCHeader(ctx) if retrievedHeaderInfo != nil { t.Errorf("GetBaseBTCHeader returned a header without one being set") } - headerInfo1 := datagen.GenRandomBTCHeaderInfo() + headerInfo1 := datagen.GenRandomBTCHeaderInfo(r) blcKeeper.SetBaseBTCHeader(ctx, *headerInfo1) retrievedHeaderInfo = blcKeeper.GetBaseBTCHeader(ctx) if retrievedHeaderInfo == nil { diff --git a/x/btclightclient/keeper/grpc_query.go b/x/btclightclient/keeper/grpc_query.go index 293d912dc..edd0d1369 100644 --- a/x/btclightclient/keeper/grpc_query.go +++ b/x/btclightclient/keeper/grpc_query.go @@ -13,15 +13,6 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} - func (k Keeper) Hashes(ctx context.Context, req *types.QueryHashesRequest) (*types.QueryHashesResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") diff --git a/x/btclightclient/keeper/grpc_query_test.go b/x/btclightclient/keeper/grpc_query_test.go index e8c25630b..98f02cdaa 100644 --- a/x/btclightclient/keeper/grpc_query_test.go +++ b/x/btclightclient/keeper/grpc_query_test.go @@ -11,20 +11,8 @@ import ( testkeeper "github.com/babylonchain/babylon/testutil/keeper" "github.com/babylonchain/babylon/x/btclightclient/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" ) -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.BTCLightClientKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} - func FuzzHashesQuery(f *testing.F) { /* Checks: @@ -45,9 +33,9 @@ func FuzzHashesQuery(f *testing.F) { Do checks 2-4 by initially querying without a key and then querying with the nextKey attribute. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) sdkCtx := sdk.WrapSDKContext(ctx) @@ -62,9 +50,9 @@ func FuzzHashesQuery(f *testing.F) { // Test pagination key being invalid // We want the key to have a positive length - bzSz := datagen.RandomIntOtherThan(bbn.BTCHeaderHashLen-1, bbn.BTCHeaderHashLen*10) + 1 - key := datagen.GenRandomByteArray(bzSz) - pagination := constructRequestWithKey(key) + bzSz := datagen.RandomIntOtherThan(r, bbn.BTCHeaderHashLen-1, bbn.BTCHeaderHashLen*10) + 1 + key := datagen.GenRandomByteArray(r, bzSz) + pagination := constructRequestWithKey(r, key) hashesRequest := types.NewQueryHashesRequest(pagination) resp, err = blcKeeper.Hashes(sdkCtx, hashesRequest) if resp != nil { @@ -75,14 +63,14 @@ func FuzzHashesQuery(f *testing.F) { } // Generate a random tree of headers - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Get the headers map headersMap := tree.GetHeadersMap() // Generate a random limit treeSize := uint64(tree.Size()) - limit := uint64(rand.Int63n(int64(tree.Size())) + 1) + limit := uint64(r.Int63n(int64(tree.Size())) + 1) // Generate a page request with a limit and a nil key - pagination = constructRequestWithLimit(limit) + pagination = constructRequestWithLimit(r, limit) // Generate the initial query hashesRequest = types.NewQueryHashesRequest(pagination) // Construct a mapping from the hashes found to a boolean value @@ -115,7 +103,7 @@ func FuzzHashesQuery(f *testing.F) { } // Construct the next page request - pagination = constructRequestWithKeyAndLimit(resp.Pagination.NextKey, limit) + pagination = constructRequestWithKeyAndLimit(r, resp.Pagination.NextKey, limit) hashesRequest = types.NewQueryHashesRequest(pagination) } @@ -135,9 +123,9 @@ func FuzzContainsQuery(f *testing.F) { - Generate a random tree of headers and insert into storage. - Generate a random header but do not insert it into storage. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) sdkCtx := sdk.WrapSDKContext(ctx) @@ -151,10 +139,10 @@ func FuzzContainsQuery(f *testing.F) { } // Generate a random tree of headers and insert it into storage - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Test with a non-existent header - query, _ := types.NewQueryContainsRequest(datagen.GenRandomBTCHeaderInfo().Hash.MarshalHex()) + query, _ := types.NewQueryContainsRequest(datagen.GenRandomBTCHeaderInfo(r).Hash.MarshalHex()) resp, err = blcKeeper.Contains(sdkCtx, query) if err != nil { t.Errorf("Valid input let to an error: %s", err) @@ -167,7 +155,7 @@ func FuzzContainsQuery(f *testing.F) { } // Test with an existing header - query, _ = types.NewQueryContainsRequest(tree.RandomNode().Hash.MarshalHex()) + query, _ = types.NewQueryContainsRequest(tree.RandomNode(r).Hash.MarshalHex()) resp, err = blcKeeper.Contains(sdkCtx, query) if err != nil { t.Errorf("Valid input let to an error: %s", err) @@ -197,9 +185,9 @@ func FuzzMainChainQuery(f *testing.F) { - Generate a random tree of headers with different PoW and insert them into the headers storage. - Calculate the main chain using the `HeadersState().MainChain()` function (here we only test the query) */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) sdkCtx := sdk.WrapSDKContext(ctx) @@ -214,9 +202,9 @@ func FuzzMainChainQuery(f *testing.F) { // Test pagination key being invalid // We want the key to have a positive length - bzSz := datagen.RandomIntOtherThan(bbn.BTCHeaderHashLen-1, bbn.BTCHeaderHashLen*10) + 1 - key := datagen.GenRandomByteArray(bzSz) - pagination := constructRequestWithKey(key) + bzSz := datagen.RandomIntOtherThan(r, bbn.BTCHeaderHashLen-1, bbn.BTCHeaderHashLen*10) + 1 + key := datagen.GenRandomByteArray(r, bzSz) + pagination := constructRequestWithKey(r, key) mainchainRequest := types.NewQueryMainChainRequest(pagination) resp, err = blcKeeper.MainChain(sdkCtx, mainchainRequest) if resp != nil { @@ -227,10 +215,10 @@ func FuzzMainChainQuery(f *testing.F) { } // Generate a random tree of headers and insert it into storage - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Check whether the key being set to an element that does not exist leads to an error - pagination = constructRequestWithKey(datagen.GenRandomBTCHeaderInfo().Hash.MustMarshal()) + pagination = constructRequestWithKey(r, datagen.GenRandomBTCHeaderInfo(r).Hash.MustMarshal()) mainchainRequest = types.NewQueryMainChainRequest(pagination) resp, err = blcKeeper.MainChain(sdkCtx, mainchainRequest) if resp != nil { @@ -245,13 +233,13 @@ func FuzzMainChainQuery(f *testing.F) { // Check whether the key being set to a non-mainchain element leads to an error // Select a random header - header := tree.RandomNode() + header := tree.RandomNode(r) // Get the tip tip := tree.GetTip() // if the header is not on the mainchain, we can test our assumption // if it is, randomness will ensure that it does on another test case if !tree.IsOnNodeChain(tip, header) { - pagination = constructRequestWithKeyAndLimit(header.Hash.MustMarshal(), uint64(len(mainchain))) + pagination = constructRequestWithKeyAndLimit(r, header.Hash.MustMarshal(), uint64(len(mainchain))) mainchainRequest = types.NewQueryMainChainRequest(pagination) resp, err = blcKeeper.MainChain(sdkCtx, mainchainRequest) if resp != nil { @@ -266,13 +254,13 @@ func FuzzMainChainQuery(f *testing.F) { mcIdx := 0 // Generate a random limit mcSize := uint64(len(mainchain)) - limit := uint64(rand.Int63n(int64(len(mainchain))) + 1) + limit := uint64(r.Int63n(int64(len(mainchain))) + 1) // 50% of the time, do a reverse request // Generate a page request with a limit and a nil key - pagination = constructRequestWithLimit(limit) + pagination = constructRequestWithLimit(r, limit) reverse := false - if datagen.OneInN(2) { + if datagen.OneInN(r, 2) { reverse = true pagination.Reverse = true } @@ -310,7 +298,7 @@ func FuzzMainChainQuery(f *testing.F) { } // Construct the next page request - pagination = constructRequestWithKeyAndLimit(resp.Pagination.NextKey, limit) + pagination = constructRequestWithKeyAndLimit(r, resp.Pagination.NextKey, limit) if reverse { pagination.Reverse = true } @@ -328,9 +316,9 @@ func FuzzTipQuery(f *testing.F) { Data generation: - Generate a random tree of headers and insert into storage */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) sdkCtx := sdk.WrapSDKContext(ctx) @@ -343,10 +331,9 @@ func FuzzTipQuery(f *testing.F) { t.Errorf("Nil input led to a nil error") } - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) - query := types.NewQueryTipRequest() - resp, err = blcKeeper.Tip(sdkCtx, query) + resp, err = blcKeeper.Tip(sdkCtx, types.NewQueryTipRequest()) if err != nil { t.Errorf("valid input led to an error: %s", err) } @@ -368,9 +355,9 @@ func FuzzBaseHeaderQuery(f *testing.F) { Data generation: - Generate a random tree of headers and insert into storage. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) sdkCtx := sdk.WrapSDKContext(ctx) @@ -383,11 +370,9 @@ func FuzzBaseHeaderQuery(f *testing.F) { t.Errorf("Nil input led to a nil error") } - tree := genRandomTree(blcKeeper, ctx, 1, 10) - - query := types.NewQueryBaseHeaderRequest() + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) - resp, err = blcKeeper.BaseHeader(sdkCtx, query) + resp, err = blcKeeper.BaseHeader(sdkCtx, types.NewQueryBaseHeaderRequest()) if err != nil { t.Errorf("valid input led to an error: %s", err) } @@ -401,10 +386,10 @@ func FuzzBaseHeaderQuery(f *testing.F) { } // Constructors for PageRequest objects -func constructRequestWithKeyAndLimit(key []byte, limit uint64) *query.PageRequest { +func constructRequestWithKeyAndLimit(r *rand.Rand, key []byte, limit uint64) *query.PageRequest { // If limit is 0, set one randomly if limit == 0 { - limit = uint64(rand.Int63() + 1) // Use Int63 instead of Uint64 to avoid overflows + limit = uint64(r.Int63() + 1) // Use Int63 instead of Uint64 to avoid overflows } return &query.PageRequest{ Key: key, @@ -415,10 +400,10 @@ func constructRequestWithKeyAndLimit(key []byte, limit uint64) *query.PageReques } } -func constructRequestWithLimit(limit uint64) *query.PageRequest { - return constructRequestWithKeyAndLimit(nil, limit) +func constructRequestWithLimit(r *rand.Rand, limit uint64) *query.PageRequest { + return constructRequestWithKeyAndLimit(r, nil, limit) } -func constructRequestWithKey(key []byte) *query.PageRequest { - return constructRequestWithKeyAndLimit(key, 0) +func constructRequestWithKey(r *rand.Rand, key []byte) *query.PageRequest { + return constructRequestWithKeyAndLimit(r, key, 0) } diff --git a/x/btclightclient/keeper/keeper.go b/x/btclightclient/keeper/keeper.go index 59792d21d..da92aff54 100644 --- a/x/btclightclient/keeper/keeper.go +++ b/x/btclightclient/keeper/keeper.go @@ -4,23 +4,21 @@ import ( "fmt" bbn "github.com/babylonchain/babylon/types" + "github.com/cometbft/cometbft/libs/log" storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/tendermint/tendermint/libs/log" "github.com/babylonchain/babylon/x/btclightclient/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - hooks types.BTCLightClientHooks - paramstore paramtypes.Subspace - btcConfig bbn.BtcConfig + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + hooks types.BTCLightClientHooks + btcConfig bbn.BtcConfig } ) @@ -28,21 +26,15 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, btcConfig bbn.BtcConfig, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } return &Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - hooks: nil, - paramstore: ps, - btcConfig: btcConfig, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + hooks: nil, + btcConfig: btcConfig, } } @@ -240,3 +232,42 @@ func (k Keeper) IsAncestor(ctx sdk.Context, parentHashBytes *bbn.BTCHeaderHashBy func (k Keeper) GetTipInfo(ctx sdk.Context) *types.BTCHeaderInfo { return k.headersState(ctx).GetTip() } + +// TODO: The following functions, GetHeaderByHash and GetHeaderByHeight, are super inefficient +// and should be replaced with a better implementation. This requires changing the +// underlying data model for the whole btclightclient module. +// GetHeaderByHash returns header with given hash from main chain or returns nil if such header is not found +// or is not on main chain +func (k Keeper) GetHeaderByHash(ctx sdk.Context, hash *bbn.BTCHeaderHashBytes) *types.BTCHeaderInfo { + depth, err := k.MainChainDepth(ctx, hash) + + if depth < 0 || err != nil { + return nil + } + + info, err := k.headersState(ctx).GetHeaderByHash(hash) + + if err != nil { + return nil + } + + return info +} + +// GetHeaderByHeight returns header with given height from main chain, returns nil if such header is not found +func (k Keeper) GetHeaderByHeight(ctx sdk.Context, height uint64) *types.BTCHeaderInfo { + var info *types.BTCHeaderInfo + + k.headersState(ctx).HeadersByHeight(height, func(hi *types.BTCHeaderInfo) bool { + depth, err := k.MainChainDepth(ctx, hi.Hash) + + if depth < 0 || err != nil { + return false + } + + info = hi + return true + }) + + return info +} diff --git a/x/btclightclient/keeper/keeper_test.go b/x/btclightclient/keeper/keeper_test.go index 9b785f75c..b510be086 100644 --- a/x/btclightclient/keeper/keeper_test.go +++ b/x/btclightclient/keeper/keeper_test.go @@ -1,13 +1,13 @@ package keeper_test import ( + "math/rand" + "testing" + "github.com/babylonchain/babylon/testutil/datagen" testkeeper "github.com/babylonchain/babylon/testutil/keeper" "github.com/babylonchain/babylon/x/btclightclient/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/gogo/protobuf/proto" - "math/rand" - "testing" ) func FuzzKeeperIsHeaderKDeep(f *testing.F) { @@ -24,12 +24,12 @@ func FuzzKeeperIsHeaderKDeep(f *testing.F) { - Generate a random tree of headers. - Get the mainchain and select appropriate headers. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) - depth := rand.Uint64() + depth := r.Uint64() // Test nil input isDeep, err := blcKeeper.IsHeaderKDeep(ctx, nil, depth) @@ -41,7 +41,7 @@ func FuzzKeeperIsHeaderKDeep(f *testing.F) { } // Test header not existing - nonExistentHeader := datagen.GenRandomBTCHeaderBytes(nil, nil) + nonExistentHeader := datagen.GenRandomBTCHeaderBytes(r, nil, nil) isDeep, err = blcKeeper.IsHeaderKDeep(ctx, nonExistentHeader.Hash(), depth) if err == nil { t.Errorf("Non existent header led to nil error") @@ -51,9 +51,9 @@ func FuzzKeeperIsHeaderKDeep(f *testing.F) { } // Generate a random tree of headers with at least one node - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Get a random header from the tree - header := tree.RandomNode() + header := tree.RandomNode(r) // Get the tip of the chain and check whether the header is on the chain that it defines // In that case, the true/false result depends on the depth parameter that we provide. // Otherwise, the result should always be false, regardless of the parameter. @@ -61,7 +61,7 @@ func FuzzKeeperIsHeaderKDeep(f *testing.F) { if tree.IsOnNodeChain(tip, header) { mainchain := tree.GetMainChain() // Select a random depth based on the main-chain length - randDepth := uint64(rand.Int63n(int64(len(mainchain)))) + randDepth := uint64(r.Int63n(int64(len(mainchain)))) isDeep, err = blcKeeper.IsHeaderKDeep(ctx, header.Hash, randDepth) // Identify whether the function should return true or false headerDepth := tip.Height - header.Height @@ -75,7 +75,7 @@ func FuzzKeeperIsHeaderKDeep(f *testing.F) { } } else { // The depth provided does not matter, we should always get false. - randDepth := rand.Uint64() + randDepth := r.Uint64() isDeep, err = blcKeeper.IsHeaderKDeep(ctx, header.Hash, randDepth) if err != nil { t.Errorf("Existent header led to a non-nil error %s", err) @@ -101,9 +101,9 @@ func FuzzKeeperMainChainDepth(f *testing.F) { - Random generation of a header that is not inserted into storage. - Random selection of a header from the main chain and outside of it. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) // Test nil input @@ -116,7 +116,7 @@ func FuzzKeeperMainChainDepth(f *testing.F) { } // Test header not existing - nonExistentHeader := datagen.GenRandomBTCHeaderBytes(nil, nil) + nonExistentHeader := datagen.GenRandomBTCHeaderBytes(r, nil, nil) depth, err = blcKeeper.MainChainDepth(ctx, nonExistentHeader.Hash()) if err == nil { t.Errorf("Non existent header led to nil error") @@ -126,9 +126,9 @@ func FuzzKeeperMainChainDepth(f *testing.F) { } // Generate a random tree of headers with at least one node - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Get a random header from the tree - header := tree.RandomNode() + header := tree.RandomNode(r) // Get the tip of the chain and check whether the header is on the chain that it defines // In that case, the depth result depends on the depth of the header on the mainchain. // Otherwise, the result should always be -1 @@ -166,9 +166,9 @@ func FuzzKeeperBlockHeight(f *testing.F) { - Random generation of a header that is not inserted into storage. - Random selection of a header from the main chain and outside of it. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) // Test nil input @@ -181,7 +181,7 @@ func FuzzKeeperBlockHeight(f *testing.F) { } // Test header not existing - nonExistentHeader := datagen.GenRandomBTCHeaderBytes(nil, nil) + nonExistentHeader := datagen.GenRandomBTCHeaderBytes(r, nil, nil) height, err = blcKeeper.BlockHeight(ctx, nonExistentHeader.Hash()) if err == nil { t.Errorf("Non existent header led to nil error") @@ -190,8 +190,8 @@ func FuzzKeeperBlockHeight(f *testing.F) { t.Errorf("Non existing header led to a result that is not -1") } - tree := genRandomTree(blcKeeper, ctx, 1, 10) - header := tree.RandomNode() + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) + header := tree.RandomNode(r) height, err = blcKeeper.BlockHeight(ctx, header.Hash) if err != nil { t.Errorf("Existent header led to an error") @@ -214,13 +214,13 @@ func FuzzKeeperIsAncestor(f *testing.F) { - Generate a random tree of headers and insert it into storage. - Select a random header and select a random descendant and a random ancestor to test (2-4). */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) - nonExistentParent := datagen.GenRandomBTCHeaderInfo() - nonExistentChild := datagen.GenRandomBTCHeaderInfo() + nonExistentParent := datagen.GenRandomBTCHeaderInfo(r) + nonExistentChild := datagen.GenRandomBTCHeaderInfo(r) // nil inputs test isAncestor, err := blcKeeper.IsAncestor(ctx, nil, nil) @@ -255,9 +255,9 @@ func FuzzKeeperIsAncestor(f *testing.F) { } // Generate random tree of headers - tree := genRandomTree(blcKeeper, ctx, 1, 10) - header := tree.RandomNode() - ancestor := tree.RandomNode() + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) + header := tree.RandomNode(r) + ancestor := tree.RandomNode(r) if ancestor.Eq(header) { // Same headers test @@ -320,11 +320,11 @@ func FuzzKeeperInsertHeader(f *testing.F) { * Build on top of a header that is `rand.Intn(tipHeight)` headers back from the tip. - This should emulate both 4e2 and 4e3. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Test nil input err := blcKeeper.InsertHeader(ctx, nil) @@ -332,13 +332,13 @@ func FuzzKeeperInsertHeader(f *testing.F) { t.Errorf("Nil input led to nil error") } - existingHeader := tree.RandomNode() + existingHeader := tree.RandomNode(r) err = blcKeeper.InsertHeader(ctx, existingHeader.Header) if err == nil { t.Errorf("Existing header led to nil error") } - nonExistentHeader := datagen.GenRandomBTCHeaderInfo() + nonExistentHeader := datagen.GenRandomBTCHeaderInfo(r) err = blcKeeper.InsertHeader(ctx, nonExistentHeader.Header) if err == nil { t.Errorf("Header with non-existent parent led to nil error") @@ -349,8 +349,8 @@ func FuzzKeeperInsertHeader(f *testing.F) { blcKeeper.SetHooks(mockHooks) // Select a random header and build a header on top of it - parentHeader := tree.RandomNode() - header := datagen.GenRandomBTCHeaderInfoWithParent(parentHeader) + parentHeader := tree.RandomNode(r) + header := datagen.GenRandomBTCHeaderInfoWithParent(r, parentHeader) // Assign a new event manager // We do this because the tree building might have led to events getting sent @@ -369,10 +369,10 @@ func FuzzKeeperInsertHeader(f *testing.F) { // Get the new tip newTip := blcKeeper.HeadersState(ctx).GetTip() - // Get event names. Those will be useful to test the types of the emitted events - rollForwardName := proto.MessageName(&types.EventBTCRollForward{}) - rollBackName := proto.MessageName(&types.EventBTCRollBack{}) - headerInsertedName := proto.MessageName(&types.EventBTCHeaderInserted{}) + // Get event types. Those will be useful to test the types of the emitted events + rollForwadType, _ := sdk.TypedEventToEvent(&types.EventBTCRollForward{}) + rollBackType, _ := sdk.TypedEventToEvent(&types.EventBTCRollBack{}) + headerInsertedType, _ := sdk.TypedEventToEvent(&types.EventBTCHeaderInserted{}) // The headerInserted hook call should contain the new header if len(mockHooks.AfterBTCHeaderInsertedStore) != 1 { @@ -385,8 +385,9 @@ func FuzzKeeperInsertHeader(f *testing.F) { if len(ctx.EventManager().Events()) == 0 { t.Fatalf("No events were triggered") } + // The header creation event should have been the one that was first generated - if ctx.EventManager().Events()[0].Type != headerInsertedName { + if ctx.EventManager().Events()[0].Type != headerInsertedType.Type { t.Errorf("The first event does not have the BTCHeaderInserted type") } @@ -413,7 +414,7 @@ func FuzzKeeperInsertHeader(f *testing.F) { t.Fatalf("We expected only two events. One for header creation and one for rolling forward.") } // The second event should be the roll forward one - if ctx.EventManager().Events()[1].Type != rollForwardName { + if ctx.EventManager().Events()[1].Type != rollForwadType.Type { t.Errorf("The second event does not have the roll forward type") } } else if oldTip.Work.GT(*header.Work) { @@ -474,10 +475,10 @@ func FuzzKeeperInsertHeader(f *testing.F) { rollForwardCnt := 0 rollBackCnt := 0 for i := 0; i < len(invokedEvents); i++ { - if invokedEvents[i].Type == rollForwardName { + if invokedEvents[i].Type == rollForwadType.Type { rollForwardCnt += 1 } - if invokedEvents[i].Type == rollBackName { + if invokedEvents[i].Type == rollBackType.Type { rollBackCnt += 1 } } diff --git a/x/btclightclient/keeper/msg_server.go b/x/btclightclient/keeper/msg_server.go index c59245335..2956332f0 100644 --- a/x/btclightclient/keeper/msg_server.go +++ b/x/btclightclient/keeper/msg_server.go @@ -7,7 +7,7 @@ import ( "github.com/babylonchain/babylon/x/btclightclient/types" "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/wire" - "github.com/btcsuite/btcutil" + "github.com/btcsuite/btcd/btcutil" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/x/btclightclient/keeper/msg_server_test.go b/x/btclightclient/keeper/msg_server_test.go index d600d59f1..b3fa85907 100644 --- a/x/btclightclient/keeper/msg_server_test.go +++ b/x/btclightclient/keeper/msg_server_test.go @@ -41,9 +41,9 @@ func FuzzMsgServerInsertHeader(f *testing.F) { 5. parent 1 < work < 4 times the work of the header 6. parent > 4 times the work of the header */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, blcKeeper, sdkCtx := setupMsgServer(t) defaultParams := chaincfg.MainNetParams @@ -74,7 +74,7 @@ func FuzzMsgServerInsertHeader(f *testing.F) { } // If the header has a parent that does not exist, (nil, error) is returned - headerParentNotExists := datagen.GenRandomBTCHeaderInfo().Header + headerParentNotExists := datagen.GenRandomBTCHeaderInfo(r).Header msg = &types.MsgInsertHeader{Header: headerParentNotExists} resp, err = keeper.MsgInsertHeaderWrapped(sdkCtx, *blcKeeper, msg, *powLimit, reduceMinDifficulty, retargetAdjustmentFactor, false) @@ -87,21 +87,21 @@ func FuzzMsgServerInsertHeader(f *testing.F) { ctx := sdk.UnwrapSDKContext(sdkCtx) // Construct a tree and insert it into storage - tree := genRandomTree(blcKeeper, ctx, uint64(2), 10) - parentHeader := tree.RandomNode() + tree := genRandomTree(r, blcKeeper, ctx, uint64(2), 10) + parentHeader := tree.RandomNode(r) // Do not work with different cases. Select a random integer between 1-retargetAdjustmentFactor+1 // 1/retargetAdjustmentFactor times, the work is going to be invalid parentHeaderDifficulty := parentHeader.Header.Difficulty() // Avoid retargetAdjustmentFactor itself, since the many conversions might lead to inconsistencies - mul := datagen.RandomInt(int(retargetAdjustmentFactor-1)) + 1 - if datagen.OneInN(10) { // Give an invalid mul sometimes + mul := datagen.RandomInt(r, int(retargetAdjustmentFactor-1)) + 1 + if datagen.OneInN(r, 10) { // Give an invalid mul sometimes mul = uint64(retargetAdjustmentFactor + 1) } headerDifficultyMul := sdkmath.NewUintFromBigInt(new(big.Int).Mul(parentHeaderDifficulty, big.NewInt(int64(mul)))) headerDifficultyDiv := sdkmath.NewUintFromBigInt(new(big.Int).Div(parentHeaderDifficulty, big.NewInt(int64(mul)))) // Do tests - headerMoreWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(parentHeader, &headerDifficultyMul) + headerMoreWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(r, parentHeader, &headerDifficultyMul) msg = &types.MsgInsertHeader{Header: headerMoreWork.Header} resp, err = keeper.MsgInsertHeaderWrapped(sdkCtx, *blcKeeper, msg, *powLimit, reduceMinDifficulty, retargetAdjustmentFactor, false) @@ -115,7 +115,7 @@ func FuzzMsgServerInsertHeader(f *testing.F) { t.Errorf("Valid header work led to an error") } - headerLessWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(parentHeader, &headerDifficultyDiv) + headerLessWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(r, parentHeader, &headerDifficultyDiv) msg = &types.MsgInsertHeader{Header: headerLessWork.Header} resp, err = keeper.MsgInsertHeaderWrapped(sdkCtx, *blcKeeper, msg, *powLimit, reduceMinDifficulty, retargetAdjustmentFactor, false) diff --git a/x/btclightclient/keeper/params.go b/x/btclightclient/keeper/params.go deleted file mode 100644 index d85d8d586..000000000 --- a/x/btclightclient/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - "github.com/babylonchain/babylon/x/btclightclient/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/btclightclient/keeper/params_test.go b/x/btclightclient/keeper/params_test.go deleted file mode 100644 index a8821e95e..000000000 --- a/x/btclightclient/keeper/params_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package keeper_test - -import ( - "testing" - - testkeeper "github.com/babylonchain/babylon/testutil/keeper" - "github.com/babylonchain/babylon/x/btclightclient/types" - "github.com/stretchr/testify/require" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.BTCLightClientKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/btclightclient/keeper/state.go b/x/btclightclient/keeper/state.go index 775cea792..cc3c19767 100644 --- a/x/btclightclient/keeper/state.go +++ b/x/btclightclient/keeper/state.go @@ -1,6 +1,7 @@ package keeper import ( + sdkmath "cosmossdk.io/math" bbn "github.com/babylonchain/babylon/types" "github.com/babylonchain/babylon/x/btclightclient/types" "github.com/cosmos/cosmos-sdk/codec" @@ -94,7 +95,7 @@ func (s headersState) GetHeaderHeight(hash *bbn.BTCHeaderHashBytes) (uint64, err } // GetHeaderWork Retrieve the work of a header -func (s headersState) GetHeaderWork(hash *bbn.BTCHeaderHashBytes) (*sdk.Uint, error) { +func (s headersState) GetHeaderWork(hash *bbn.BTCHeaderHashBytes) (*sdkmath.Uint, error) { // Keyed by hash hashKey := types.HeadersObjectHeightKey(hash) // Retrieve the raw bytes for the work @@ -104,7 +105,7 @@ func (s headersState) GetHeaderWork(hash *bbn.BTCHeaderHashBytes) (*sdk.Uint, er } // Convert to *big.Int form - work := new(sdk.Uint) + work := new(sdkmath.Uint) err := work.Unmarshal(bz) if err != nil { panic("Stored header cannot be unmarshalled to sdk.Uint") @@ -140,7 +141,6 @@ func (s headersState) GetTip() *types.BTCHeaderInfo { if !s.TipExists() { return nil } - // Get the key to the tip storage tipKey := types.TipKey() return headerInfoFromStoredBytes(s.cdc, s.tip.Get(tipKey)) @@ -185,7 +185,8 @@ func (s headersState) getDescendingHeadersUpTo(startHeight uint64, depth uint64) } // GetHeaderAncestryUpTo returns a list of headers starting from the header parameter and leading to -// the header that has a `depth` distance from it. +// +// the header that has a `depth` distance from it. func (s headersState) GetHeaderAncestryUpTo(currentHeader *types.BTCHeaderInfo, depth uint64) []*types.BTCHeaderInfo { // Retrieve a collection of headers in descending height order // Use depth+1 since we want all headers at the depth height. @@ -209,7 +210,8 @@ func (s headersState) GetHeaderAncestryUpTo(currentHeader *types.BTCHeaderInfo, } // GetMainChainUpTo returns the current canonical chain as a collection of block headers -// starting from the tip and ending on the header that has a depth distance from it. +// +// starting from the tip and ending on the header that has a depth distance from it. func (s headersState) GetMainChainUpTo(depth uint64) []*types.BTCHeaderInfo { // If there is no tip, there is no base header if !s.TipExists() { @@ -219,7 +221,8 @@ func (s headersState) GetMainChainUpTo(depth uint64) []*types.BTCHeaderInfo { } // GetMainChain retrieves the main chain as a collection of block headers starting from the tip -// and ending on the base BTC header. +// +// and ending on the base BTC header. func (s headersState) GetMainChain() []*types.BTCHeaderInfo { if !s.TipExists() { return nil @@ -230,7 +233,7 @@ func (s headersState) GetMainChain() []*types.BTCHeaderInfo { } // GetHighestCommonAncestor traverses the ancestors of both headers -// to identify the common ancestor with the highest height +// to identify the common ancestor with the highest height func (s headersState) GetHighestCommonAncestor(header1 *types.BTCHeaderInfo, header2 *types.BTCHeaderInfo) *types.BTCHeaderInfo { // The algorithm works as follows: // 1. Initialize a hashmap hash -> bool denoting whether the hash diff --git a/x/btclightclient/keeper/state_test.go b/x/btclightclient/keeper/state_test.go index 37f77e9b7..f7b2aecc4 100644 --- a/x/btclightclient/keeper/state_test.go +++ b/x/btclightclient/keeper/state_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "fmt" "math/rand" "testing" @@ -34,13 +33,13 @@ func FuzzHeadersStateCreateHeader(f *testing.F) { - No need to create a tree, since this function does not consider the existence or the chain, it just inserts into state and updates the tip based on a simple work comparison. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) // Generate a tree with a single root node - tree := genRandomTree(blcKeeper, ctx, 1, 1) + tree := genRandomTree(r, blcKeeper, ctx, 1, 1) baseHeader := tree.GetRoot() // Test whether the tip and storages are set @@ -78,7 +77,7 @@ func FuzzHeadersStateCreateHeader(f *testing.F) { mostDifficulty := sdk.NewUint(10) lessDifficulty := mostDifficulty.Add(sdk.NewUint(1)) // Create an object that builds on top of base header - childMostWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(baseHeader, &mostDifficulty) + childMostWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(r, baseHeader, &mostDifficulty) blcKeeper.HeadersState(ctx).CreateHeader(childMostWork) // Check whether the tip was updated tip = blcKeeper.HeadersState(ctx).GetTip() @@ -89,7 +88,7 @@ func FuzzHeadersStateCreateHeader(f *testing.F) { t.Errorf("Tip did not get properly updated") } - childEqualWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(baseHeader, &mostDifficulty) + childEqualWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(r, baseHeader, &mostDifficulty) blcKeeper.HeadersState(ctx).CreateHeader(childEqualWork) // Check whether the tip was updated tip = blcKeeper.HeadersState(ctx).GetTip() @@ -97,7 +96,7 @@ func FuzzHeadersStateCreateHeader(f *testing.F) { t.Errorf("Tip got updated when it shouldn't") } - childLessWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(baseHeader, &lessDifficulty) + childLessWork := datagen.GenRandomBTCHeaderInfoWithParentAndBits(r, baseHeader, &lessDifficulty) blcKeeper.HeadersState(ctx).CreateHeader(childLessWork) // Check whether the tip was updated tip = blcKeeper.HeadersState(ctx).GetTip() @@ -129,13 +128,13 @@ func FuzzHeadersStateTipOps(f *testing.F) { 1. A header that will be set as the tip. 2. A header that will override it. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) - headerInfo1 := datagen.GenRandomBTCHeaderInfo() - headerInfo2 := datagen.GenRandomBTCHeaderInfo() + headerInfo1 := datagen.GenRandomBTCHeaderInfo(r) + headerInfo2 := datagen.GenRandomBTCHeaderInfo(r) retrievedHeaderInfo := blcKeeper.HeadersState(ctx).GetTip() if retrievedHeaderInfo != nil { @@ -197,13 +196,13 @@ func FuzzHeadersStateGetHeaderOps(f *testing.F) { Data generation: - Create a header and store it using the `CreateHeader` method. Do retrievals to check conditions. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) - headerInfo := datagen.GenRandomBTCHeaderInfo() - wrongHash := datagen.MutateHash(headerInfo.Hash) - wrongHeight := headerInfo.Height + datagen.RandomInt(10) + 1 + headerInfo := datagen.GenRandomBTCHeaderInfo(r) + wrongHash := datagen.MutateHash(r, headerInfo.Hash) + wrongHeight := headerInfo.Height + datagen.RandomInt(r, 10) + 1 // ****** HeaderExists tests ****** if blcKeeper.HeadersState(ctx).HeaderExists(nil) { @@ -291,9 +290,9 @@ func FuzzHeadersStateGetBaseBTCHeader(f *testing.F) { Data generation: - Generate a random tree and retrieve the main chain from it. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) nilBaseHeader := blcKeeper.HeadersState(ctx).GetBaseBTCHeader() @@ -301,7 +300,7 @@ func FuzzHeadersStateGetBaseBTCHeader(f *testing.F) { t.Errorf("Non-existent base BTC header led to non-nil return") } - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) expectedBaseHeader := tree.GetRoot() gotBaseHeader := blcKeeper.HeadersState(ctx).GetBaseBTCHeader() @@ -324,25 +323,25 @@ func FuzzHeadersStateHeadersByHeight(f *testing.F) { - The randomness of the number of headers should guarantee that (1) and (2) are observed. - Generate a random stop signal 1/N times. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) maxHeaders := 256 // maximum 255 headers with particular height - numHeaders := datagen.RandomInt(maxHeaders) + numHeaders := datagen.RandomInt(r, maxHeaders) // This will contain a mapping between all the header hashes that were created // and a boolean value. hashCount := make(map[string]bool) // Setup a tree with a single header - tree := genRandomTree(blcKeeper, ctx, 1, 1) + tree := genRandomTree(r, blcKeeper, ctx, 1, 1) baseHeader := tree.GetRoot() height := baseHeader.Height + 1 // Generate numHeaders with particular height var i uint64 for i = 0; i < numHeaders; i++ { - headerInfo := datagen.GenRandomBTCHeaderInfoWithParent(baseHeader) + headerInfo := datagen.GenRandomBTCHeaderInfoWithParent(r, baseHeader) hashCount[headerInfo.Hash.MarshalHex()] = true blcKeeper.InsertHeader(ctx, headerInfo.Header) //nolint:errcheck } @@ -355,7 +354,7 @@ func FuzzHeadersStateHeadersByHeight(f *testing.F) { t.Errorf("HeadersByHeight returned header that was not created") } hashCount[header.Hash.MarshalHex()] = true - if datagen.OneInN(maxHeaders) { + if datagen.OneInN(r, maxHeaders) { // Only set it once if stopHeight != 0 { stopHeight = headersAdded @@ -394,12 +393,12 @@ func FuzzHeadersStateGetMainChain(f *testing.F) { - Generate a random tree and retrieve the main chain from it. - Randomly generate the depth */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) expectedMainChain := tree.GetMainChain() gotMainChain := blcKeeper.HeadersState(ctx).GetMainChain() @@ -414,7 +413,7 @@ func FuzzHeadersStateGetMainChain(f *testing.F) { } // depth is a random integer - upToDepth := datagen.RandomInt(len(expectedMainChain)) + upToDepth := datagen.RandomInt(r, len(expectedMainChain)) expectedMainChainUpTo := expectedMainChain[:upToDepth+1] gotMainChainUpTo := blcKeeper.HeadersState(ctx).GetMainChainUpTo(upToDepth) if len(expectedMainChainUpTo) != len(gotMainChainUpTo) { @@ -441,18 +440,18 @@ func FuzzHeadersStateGetHighestCommonAncestor(f *testing.F) { - Generate a random tree of headers and store it. - Select two random headers and call `GetHighestCommonAncestor` for them. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) // Generate a random tree with at least one node - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Retrieve a random common ancestor - commonAncestor := tree.RandomNode() + commonAncestor := tree.RandomNode(r) // Generate two child nodes for the common ancestor - childRoot1 := datagen.GenRandomBTCHeaderInfoWithParent(commonAncestor) - childRoot2 := datagen.GenRandomBTCHeaderInfoWithParent(commonAncestor) + childRoot1 := datagen.GenRandomBTCHeaderInfoWithParent(r, commonAncestor) + childRoot2 := datagen.GenRandomBTCHeaderInfoWithParent(r, commonAncestor) if tree.Contains(childRoot1) || tree.Contains(childRoot2) { // Unlucky case where we get the same hash. Should be extremely rare. // Instead of adding extra complexity to this test case, just skip it @@ -466,19 +465,18 @@ func FuzzHeadersStateGetHighestCommonAncestor(f *testing.F) { tree.Add(childRoot2, commonAncestor) // Generate subtrees rooted at the descendant nodes - genRandomTreeWithParent(blcKeeper, ctx, 1, 10, childRoot1, tree) - genRandomTreeWithParent(blcKeeper, ctx, 1, 10, childRoot2, tree) + genRandomTreeWithParent(r, blcKeeper, ctx, 1, 10, childRoot1, tree) + genRandomTreeWithParent(r, blcKeeper, ctx, 1, 10, childRoot2, tree) // Get a random descendant from each of the subtrees - descendant1 := tree.RandomDescendant(childRoot1) - descendant2 := tree.RandomDescendant(childRoot2) + descendant1 := tree.RandomDescendant(r, childRoot1) + descendant2 := tree.RandomDescendant(r, childRoot2) retrievedHighestCommonAncestor := blcKeeper.HeadersState(ctx).GetHighestCommonAncestor(descendant1, descendant2) if retrievedHighestCommonAncestor == nil { t.Fatalf("No common ancestor found between the nodes %s and %s. Expected ancestor: %s", descendant1.Hash, descendant2.Hash, commonAncestor.Hash) } if !commonAncestor.Eq(retrievedHighestCommonAncestor) { - fmt.Println("Failed") t.Errorf("Did not retrieve the correct highest common ancestor. Got %s, expected %s", retrievedHighestCommonAncestor.Hash, commonAncestor.Hash) } }) @@ -496,19 +494,19 @@ func FuzzHeadersStateGetInOrderAncestorsUntil(f *testing.F) { - Select a random header which will serve as the `descendant`. Cannot be the base header. - Select a random header that is an ancestor of `descendant`. */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) // Generate a tree of any size. // We can work with even one header, since this should lead to an empty result. - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) // Get a random header from the tree - descendant := tree.RandomNode() + descendant := tree.RandomNode(r) // Get a random ancestor from it - ancestor := tree.RandomAncestor(descendant) + ancestor := tree.RandomAncestor(r, descendant) // Get the ancestry of the descendant. // It is in reverse order from the one that GetInOrderAncestorsUntil returns, since it starts with the descendant. expectedAncestorsReverse := tree.GetNodeAncestryUpTo(descendant, ancestor) @@ -537,14 +535,14 @@ func FuzzHeadersStateGetHeaderAncestryUpTo(f *testing.F) { - Select a random header which will serve as the `header` parameter. - Select a random depth in the range of [0, header.Height-baseHeader.Height] */ - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) blcKeeper, ctx := testkeeper.BTCLightClientKeeper(t) - tree := genRandomTree(blcKeeper, ctx, 1, 10) + tree := genRandomTree(r, blcKeeper, ctx, 1, 10) - descendant := tree.RandomNode() - ancestor := tree.RandomAncestor(descendant) + descendant := tree.RandomNode(r) + ancestor := tree.RandomAncestor(r, descendant) ancestors := blcKeeper.HeadersState(ctx).GetHeaderAncestryUpTo(descendant, descendant.Height-ancestor.Height) // Use the parent of the ancestor since UpTo does not include the ancestor in the result diff --git a/x/btclightclient/keeper/utils_test.go b/x/btclightclient/keeper/utils_test.go index cb26b33a9..e8cab00ea 100644 --- a/x/btclightclient/keeper/utils_test.go +++ b/x/btclightclient/keeper/utils_test.go @@ -6,6 +6,7 @@ import ( "github.com/babylonchain/babylon/x/btclightclient/keeper" "github.com/babylonchain/babylon/x/btclightclient/types" sdk "github.com/cosmos/cosmos-sdk/types" + "math/rand" ) // Mock hooks interface @@ -50,28 +51,28 @@ func (m *MockHooks) AfterBTCHeaderInserted(_ sdk.Context, headerInfo *types.BTCH // of the tree that is generated. For example, a `minTreeHeight` of 1, // means that the tree should have at least one node (the root), while // a `maxTreeHeight` of 4, denotes that the maximum height of the tree should be 4. -func genRandomTree(k *keeper.Keeper, ctx sdk.Context, minHeight uint64, maxHeight uint64) *datagen.BTCHeaderTree { +func genRandomTree(r *rand.Rand, k *keeper.Keeper, ctx sdk.Context, minHeight uint64, maxHeight uint64) *datagen.BTCHeaderTree { tree := datagen.NewBTCHeaderTree() // Generate the root for the tree - root := datagen.GenRandomBTCHeaderInfo() + root := datagen.GenRandomBTCHeaderInfo(r) tree.Add(root, nil) k.SetBaseBTCHeader(ctx, *root) - genRandomTreeWithParent(k, ctx, minHeight-1, maxHeight-1, root, tree) + genRandomTreeWithParent(r, k, ctx, minHeight-1, maxHeight-1, root, tree) return tree } // genRandomTreeWithParent is a utility function for inserting the headers // While the tree is generated, the headers that are generated for it are inserted into storage. -func genRandomTreeWithParent(k *keeper.Keeper, ctx sdk.Context, minHeight uint64, +func genRandomTreeWithParent(r *rand.Rand, k *keeper.Keeper, ctx sdk.Context, minHeight uint64, maxHeight uint64, root *types.BTCHeaderInfo, tree *datagen.BTCHeaderTree) { if minHeight > maxHeight { panic("Min height more than max height") } - tree.GenRandomBTCHeaderTree(minHeight, maxHeight, root, func(header *types.BTCHeaderInfo) bool { + tree.GenRandomBTCHeaderTree(r, minHeight, maxHeight, root, func(header *types.BTCHeaderInfo) bool { err := k.InsertHeader(ctx, header.Header) if err != nil { panic(fmt.Sprintf("header insertion failed: %s", err)) diff --git a/x/btclightclient/module.go b/x/btclightclient/module.go index f84dd82a6..ba1fd57be 100644 --- a/x/btclightclient/module.go +++ b/x/btclightclient/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/babylonchain/babylon/x/btclightclient/client/cli" "github.com/babylonchain/babylon/x/btclightclient/keeper" @@ -122,19 +122,9 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the capability module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} - // QuerierRoute returns the capability module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// LegacyQuerierHandler returns the capability module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { @@ -164,7 +154,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/btclightclient/module_simulation.go b/x/btclightclient/module_simulation.go index ac0b0d351..1de351013 100644 --- a/x/btclightclient/module_simulation.go +++ b/x/btclightclient/module_simulation.go @@ -1,13 +1,11 @@ package btclightclient import ( - "math/rand" - + simappparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/testutil/sample" btclightclientsimulation "github.com/babylonchain/babylon/x/btclightclient/simulation" "github.com/babylonchain/babylon/x/btclightclient/types" "github.com/cosmos/cosmos-sdk/baseapp" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -34,16 +32,10 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } -// RandomizedParams creates randomized param changes for the simulator -func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} diff --git a/x/btclightclient/types/btc_header_info.go b/x/btclightclient/types/btc_header_info.go index 46f7ceea5..baabc45a0 100644 --- a/x/btclightclient/types/btc_header_info.go +++ b/x/btclightclient/types/btc_header_info.go @@ -1,11 +1,11 @@ package types import ( + sdkmath "cosmossdk.io/math" bbn "github.com/babylonchain/babylon/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) -func NewBTCHeaderInfo(header *bbn.BTCHeaderBytes, headerHash *bbn.BTCHeaderHashBytes, height uint64, work *sdk.Uint) *BTCHeaderInfo { +func NewBTCHeaderInfo(header *bbn.BTCHeaderBytes, headerHash *bbn.BTCHeaderHashBytes, height uint64, work *sdkmath.Uint) *BTCHeaderInfo { return &BTCHeaderInfo{ Header: header, Hash: headerHash, diff --git a/x/btclightclient/types/btc_header_info_test.go b/x/btclightclient/types/btc_header_info_test.go index eb82a5021..cd523563a 100644 --- a/x/btclightclient/types/btc_header_info_test.go +++ b/x/btclightclient/types/btc_header_info_test.go @@ -12,16 +12,16 @@ import ( ) func FuzzNewHeaderInfo(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { // If either of the hash strings is not of appropriate length // or not valid hex, generate a random hex randomly - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // Get the expected header bytes - expectedHeaderBytes := datagen.GenRandomBTCHeaderInfo().Header + expectedHeaderBytes := datagen.GenRandomBTCHeaderInfo(r).Header expectedHeaderHashBytes := expectedHeaderBytes.Hash() - height := datagen.GenRandomBTCHeight() + height := datagen.GenRandomBTCHeight(r) work := sdkmath.NewUintFromBigInt(expectedHeaderBytes.Difficulty()) headerInfo := types.NewBTCHeaderInfo(expectedHeaderBytes, expectedHeaderHashBytes, height, &work) diff --git a/x/btclightclient/types/btclightclient.pb.go b/x/btclightclient/types/btclightclient.pb.go index 4cea909ea..d4dc5f187 100644 --- a/x/btclightclient/types/btclightclient.pb.go +++ b/x/btclightclient/types/btclightclient.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btclightclient/btclightclient.proto +// source: babylon/btclightclient/v1/btclightclient.proto package types @@ -7,8 +7,8 @@ import ( fmt "fmt" github_com_babylonchain_babylon_types "github.com/babylonchain/babylon/types" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -25,6 +25,14 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// BTCHeaderInfo is a structure that contains all relevant information about a +// BTC header +// - Full header bytes +// - Header hash for easy retrieval +// - 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. type BTCHeaderInfo struct { Header *github_com_babylonchain_babylon_types.BTCHeaderBytes `protobuf:"bytes,1,opt,name=header,proto3,customtype=github.com/babylonchain/babylon/types.BTCHeaderBytes" json:"header,omitempty"` Hash *github_com_babylonchain_babylon_types.BTCHeaderHashBytes `protobuf:"bytes,2,opt,name=hash,proto3,customtype=github.com/babylonchain/babylon/types.BTCHeaderHashBytes" json:"hash,omitempty"` @@ -36,7 +44,7 @@ func (m *BTCHeaderInfo) Reset() { *m = BTCHeaderInfo{} } func (m *BTCHeaderInfo) String() string { return proto.CompactTextString(m) } func (*BTCHeaderInfo) ProtoMessage() {} func (*BTCHeaderInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_3313d955a6cadef2, []int{0} + return fileDescriptor_84bf438d909b681d, []int{0} } func (m *BTCHeaderInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -77,29 +85,29 @@ func init() { } func init() { - proto.RegisterFile("babylon/btclightclient/btclightclient.proto", fileDescriptor_3313d955a6cadef2) + proto.RegisterFile("babylon/btclightclient/v1/btclightclient.proto", fileDescriptor_84bf438d909b681d) } -var fileDescriptor_3313d955a6cadef2 = []byte{ - // 276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4e, 0x4a, 0x4c, 0xaa, +var fileDescriptor_84bf438d909b681d = []byte{ + // 279 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0x4b, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0xce, 0xc9, 0x4c, 0xcf, 0x00, 0x91, 0xa9, 0x79, 0x25, - 0x68, 0x5c, 0xbd, 0x82, 0xa2, 0xfc, 0x92, 0x7c, 0x21, 0x49, 0xa8, 0x62, 0x3d, 0x34, 0xd9, 0x32, - 0x43, 0x29, 0x91, 0xf4, 0xfc, 0xf4, 0x7c, 0xb0, 0x2a, 0x7d, 0x10, 0x0b, 0xa2, 0x41, 0xa9, 0x87, - 0x89, 0x8b, 0xd7, 0x29, 0xc4, 0xd9, 0x23, 0x35, 0x31, 0x25, 0xb5, 0xc8, 0x33, 0x2f, 0x2d, 0x5f, - 0x28, 0x80, 0x8b, 0x2d, 0x03, 0xcc, 0x93, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x71, 0xb2, 0xb8, 0x75, - 0x4f, 0xde, 0x24, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x6a, 0x43, - 0x72, 0x46, 0x62, 0x66, 0x1e, 0x8c, 0xa3, 0x5f, 0x52, 0x59, 0x90, 0x5a, 0xac, 0x07, 0x37, 0xc8, - 0xa9, 0xb2, 0x24, 0xb5, 0x38, 0x08, 0x6a, 0x8e, 0x50, 0x00, 0x17, 0x4b, 0x46, 0x62, 0x71, 0x86, - 0x04, 0x13, 0xd8, 0x3c, 0x9b, 0x5b, 0xf7, 0xe4, 0x2d, 0x48, 0x34, 0xcf, 0x23, 0xb1, 0x38, 0x03, - 0x62, 0x26, 0xd8, 0x24, 0x21, 0x31, 0x90, 0x1b, 0x41, 0xde, 0x93, 0x60, 0x56, 0x60, 0xd4, 0x60, - 0x09, 0x82, 0xf2, 0x84, 0xec, 0xb9, 0x58, 0xca, 0xf3, 0x8b, 0xb2, 0x25, 0x58, 0xc0, 0x36, 0x69, - 0xdf, 0xba, 0x27, 0xaf, 0x8e, 0x64, 0x53, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0x31, 0x94, 0xd2, 0x2d, - 0x4e, 0xc9, 0x86, 0x5a, 0x13, 0x9a, 0x99, 0x57, 0x12, 0x04, 0xd6, 0xe8, 0x14, 0x70, 0xe2, 0x91, - 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, - 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x66, 0x84, 0x9c, 0x5c, 0x81, 0x1e, 0x41, 0x60, - 0xc3, 0x93, 0xd8, 0xc0, 0xe1, 0x6c, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x41, 0x6a, 0x8d, 0xae, - 0xc7, 0x01, 0x00, 0x00, + 0xfa, 0x65, 0x86, 0x68, 0x22, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x92, 0x50, 0xf5, 0x7a, + 0x68, 0xb2, 0x65, 0x86, 0x52, 0x22, 0xe9, 0xf9, 0xe9, 0xf9, 0x60, 0x55, 0xfa, 0x20, 0x16, 0x44, + 0x83, 0x52, 0x0f, 0x13, 0x17, 0xaf, 0x53, 0x88, 0xb3, 0x47, 0x6a, 0x62, 0x4a, 0x6a, 0x91, 0x67, + 0x5e, 0x5a, 0xbe, 0x50, 0x00, 0x17, 0x5b, 0x06, 0x98, 0x27, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0xe3, + 0x64, 0x71, 0xeb, 0x9e, 0xbc, 0x49, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, + 0x3e, 0xd4, 0x86, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x18, 0x47, 0xbf, 0xa4, 0xb2, 0x20, 0xb5, 0x58, + 0x0f, 0x6e, 0x90, 0x53, 0x65, 0x49, 0x6a, 0x71, 0x10, 0xd4, 0x1c, 0xa1, 0x00, 0x2e, 0x96, 0x8c, + 0xc4, 0xe2, 0x0c, 0x09, 0x26, 0xb0, 0x79, 0x36, 0xb7, 0xee, 0xc9, 0x5b, 0x90, 0x68, 0x9e, 0x47, + 0x62, 0x71, 0x06, 0xc4, 0x4c, 0xb0, 0x49, 0x42, 0x62, 0x20, 0x37, 0x82, 0xbc, 0x27, 0xc1, 0xac, + 0xc0, 0xa8, 0xc1, 0x12, 0x04, 0xe5, 0x09, 0xd9, 0x73, 0xb1, 0x94, 0xe7, 0x17, 0x65, 0x4b, 0xb0, + 0x80, 0x6d, 0xd2, 0xbe, 0x75, 0x4f, 0x5e, 0x1d, 0xc9, 0xa6, 0xe4, 0xfc, 0xe2, 0xdc, 0xfc, 0x62, + 0x28, 0xa5, 0x5b, 0x9c, 0x92, 0x0d, 0xb5, 0x26, 0x34, 0x33, 0xaf, 0x24, 0x08, 0xac, 0xd1, 0x29, + 0xe0, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, + 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0xcc, 0x08, 0x39, 0xb9, 0x02, + 0x3d, 0x8e, 0xc0, 0x86, 0x27, 0xb1, 0x81, 0xc3, 0xd9, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x8a, + 0x8d, 0x9c, 0x25, 0xca, 0x01, 0x00, 0x00, } func (m *BTCHeaderInfo) Marshal() (dAtA []byte, err error) { diff --git a/x/btclightclient/types/errors.go b/x/btclightclient/types/errors.go index dced77ae7..4ff8ee786 100644 --- a/x/btclightclient/types/errors.go +++ b/x/btclightclient/types/errors.go @@ -3,15 +3,15 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/btclightclient module sentinel errors var ( - ErrHeaderDoesNotExist = sdkerrors.Register(ModuleName, 1100, "header does not exist") - ErrDuplicateHeader = sdkerrors.Register(ModuleName, 1101, "header with provided hash already exists") - ErrHeaderParentDoesNotExist = sdkerrors.Register(ModuleName, 1102, "parent for provided hash is not maintained") - ErrInvalidDifficulty = sdkerrors.Register(ModuleName, 1103, "invalid difficulty bits") - ErrEmptyMessage = sdkerrors.Register(ModuleName, 1104, "empty message provided") - ErrInvalidProofOfWOrk = sdkerrors.Register(ModuleName, 1105, "provided header has invalid proof of work") + ErrHeaderDoesNotExist = errorsmod.Register(ModuleName, 1100, "header does not exist") + ErrDuplicateHeader = errorsmod.Register(ModuleName, 1101, "header with provided hash already exists") + ErrHeaderParentDoesNotExist = errorsmod.Register(ModuleName, 1102, "parent for provided hash is not maintained") + ErrInvalidDifficulty = errorsmod.Register(ModuleName, 1103, "invalid difficulty bits") + ErrEmptyMessage = errorsmod.Register(ModuleName, 1104, "empty message provided") + ErrInvalidProofOfWOrk = errorsmod.Register(ModuleName, 1105, "provided header has invalid proof of work") ) diff --git a/x/btclightclient/types/event.pb.go b/x/btclightclient/types/event.pb.go index b3d08685a..71f8fcda3 100644 --- a/x/btclightclient/types/event.pb.go +++ b/x/btclightclient/types/event.pb.go @@ -1,12 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btclightclient/event.proto +// source: babylon/btclightclient/v1/event.proto package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -35,7 +34,7 @@ func (m *EventBTCRollBack) Reset() { *m = EventBTCRollBack{} } func (m *EventBTCRollBack) String() string { return proto.CompactTextString(m) } func (*EventBTCRollBack) ProtoMessage() {} func (*EventBTCRollBack) Descriptor() ([]byte, []int) { - return fileDescriptor_dbeb7d7d6407e7ec, []int{0} + return fileDescriptor_519f2d655b639c5a, []int{0} } func (m *EventBTCRollBack) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -83,7 +82,7 @@ func (m *EventBTCRollForward) Reset() { *m = EventBTCRollForward{} } func (m *EventBTCRollForward) String() string { return proto.CompactTextString(m) } func (*EventBTCRollForward) ProtoMessage() {} func (*EventBTCRollForward) Descriptor() ([]byte, []int) { - return fileDescriptor_dbeb7d7d6407e7ec, []int{1} + return fileDescriptor_519f2d655b639c5a, []int{1} } func (m *EventBTCRollForward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -130,7 +129,7 @@ func (m *EventBTCHeaderInserted) Reset() { *m = EventBTCHeaderInserted{} func (m *EventBTCHeaderInserted) String() string { return proto.CompactTextString(m) } func (*EventBTCHeaderInserted) ProtoMessage() {} func (*EventBTCHeaderInserted) Descriptor() ([]byte, []int) { - return fileDescriptor_dbeb7d7d6407e7ec, []int{2} + return fileDescriptor_519f2d655b639c5a, []int{2} } func (m *EventBTCHeaderInserted) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -173,26 +172,26 @@ func init() { } func init() { - proto.RegisterFile("babylon/btclightclient/event.proto", fileDescriptor_dbeb7d7d6407e7ec) + proto.RegisterFile("babylon/btclightclient/v1/event.proto", fileDescriptor_519f2d655b639c5a) } -var fileDescriptor_dbeb7d7d6407e7ec = []byte{ - // 237 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, +var fileDescriptor_519f2d655b639c5a = []byte{ + // 228 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0xce, 0xc9, 0x4c, 0xcf, 0x00, 0x91, 0xa9, 0x79, 0x25, - 0xfa, 0xa9, 0x65, 0xa9, 0x79, 0x25, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x92, 0x50, 0x35, - 0x7a, 0xa8, 0x6a, 0xf4, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xaa, 0xf4, 0x41, - 0x2c, 0x88, 0x06, 0x29, 0x6d, 0x1c, 0x86, 0xa2, 0xe9, 0x07, 0x2b, 0x56, 0x0a, 0xe1, 0x12, 0x70, - 0x05, 0x59, 0xe6, 0x14, 0xe2, 0x1c, 0x94, 0x9f, 0x93, 0xe3, 0x94, 0x98, 0x9c, 0x2d, 0xe4, 0xc0, - 0xc5, 0x96, 0x91, 0x9a, 0x98, 0x92, 0x5a, 0x24, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, 0xa1, - 0x87, 0xd3, 0x09, 0x7a, 0x4e, 0x21, 0xce, 0x1e, 0x60, 0xb5, 0x9e, 0x79, 0x69, 0xf9, 0x41, 0x50, - 0x7d, 0x4a, 0xe1, 0x5c, 0xc2, 0xc8, 0xa6, 0xba, 0xe5, 0x17, 0x95, 0x27, 0x16, 0xa5, 0x50, 0xc1, - 0xe0, 0x28, 0x2e, 0x31, 0x98, 0xc1, 0x30, 0xd9, 0xe2, 0xd4, 0xa2, 0x92, 0x54, 0x2a, 0x98, 0xed, - 0x14, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, - 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x66, 0xe9, 0x99, 0x25, - 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0x53, 0x93, 0x33, 0x12, 0x33, 0xf3, 0x60, - 0x1c, 0xfd, 0x0a, 0xf4, 0xb0, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x87, 0xb1, 0x31, - 0x20, 0x00, 0x00, 0xff, 0xff, 0x90, 0xd1, 0x66, 0xcc, 0xe7, 0x01, 0x00, 0x00, + 0xfa, 0x65, 0x86, 0xfa, 0xa9, 0x65, 0xa9, 0x79, 0x25, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, + 0x92, 0x50, 0x65, 0x7a, 0xa8, 0xca, 0xf4, 0xca, 0x0c, 0xa5, 0xf4, 0x70, 0x9b, 0x80, 0xa6, 0x18, + 0x6c, 0x94, 0x52, 0x08, 0x97, 0x80, 0x2b, 0xc8, 0x64, 0xa7, 0x10, 0xe7, 0xa0, 0xfc, 0x9c, 0x1c, + 0xa7, 0xc4, 0xe4, 0x6c, 0x21, 0x07, 0x2e, 0xb6, 0x8c, 0xd4, 0xc4, 0x94, 0xd4, 0x22, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x0d, 0x3d, 0x9c, 0xf6, 0xe9, 0x39, 0x85, 0x38, 0x7b, 0x80, 0xd5, + 0x7a, 0xe6, 0xa5, 0xe5, 0x07, 0x41, 0xf5, 0x29, 0x85, 0x73, 0x09, 0x23, 0x9b, 0xea, 0x96, 0x5f, + 0x54, 0x9e, 0x58, 0x94, 0x42, 0x05, 0x83, 0xa3, 0xb8, 0xc4, 0x60, 0x06, 0xc3, 0x64, 0x8b, 0x53, + 0x8b, 0x4a, 0x52, 0xa9, 0x60, 0xb6, 0x53, 0xc0, 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, 0x99, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0x4d, + 0x4d, 0xce, 0x48, 0xcc, 0xcc, 0x83, 0x71, 0xf4, 0x2b, 0xd0, 0x83, 0xbb, 0xa4, 0xb2, 0x20, 0xb5, + 0x38, 0x89, 0x0d, 0x1c, 0xc6, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x16, 0x0b, 0x33, 0xea, + 0xd7, 0x01, 0x00, 0x00, } func (m *EventBTCRollBack) Marshal() (dAtA []byte, err error) { diff --git a/x/btclightclient/types/genesis.go b/x/btclightclient/types/genesis.go index e7ea69f81..f9e5226f9 100644 --- a/x/btclightclient/types/genesis.go +++ b/x/btclightclient/types/genesis.go @@ -18,7 +18,6 @@ func DefaultGenesis() *GenesisState { baseHeaderInfo := NewBTCHeaderInfo(&headerBytes, headerHash, headerHeight, &headerWork) return &GenesisState{ - Params: DefaultParams(), BaseBtcHeader: *baseHeaderInfo, } } @@ -26,12 +25,7 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - err := gs.Params.Validate() - if err != nil { - return err - } - - err = gs.BaseBtcHeader.Validate() + err := gs.BaseBtcHeader.Validate() if err != nil { return err } diff --git a/x/btclightclient/types/genesis.pb.go b/x/btclightclient/types/genesis.pb.go index 09cc75a3f..096396119 100644 --- a/x/btclightclient/types/genesis.pb.go +++ b/x/btclightclient/types/genesis.pb.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btclightclient/genesis.proto +// source: babylon/btclightclient/v1/genesis.proto package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -25,15 +25,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the btclightclient module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - BaseBtcHeader BTCHeaderInfo `protobuf:"bytes,2,opt,name=base_btc_header,json=baseBtcHeader,proto3" json:"base_btc_header"` + BaseBtcHeader BTCHeaderInfo `protobuf:"bytes,1,opt,name=base_btc_header,json=baseBtcHeader,proto3" json:"base_btc_header"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_723ed9409b965050, []int{0} + return fileDescriptor_4f95902e4096217a, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -62,13 +61,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func (m *GenesisState) GetBaseBtcHeader() BTCHeaderInfo { if m != nil { return m.BaseBtcHeader @@ -81,28 +73,26 @@ func init() { } func init() { - proto.RegisterFile("babylon/btclightclient/genesis.proto", fileDescriptor_723ed9409b965050) + proto.RegisterFile("babylon/btclightclient/v1/genesis.proto", fileDescriptor_4f95902e4096217a) } -var fileDescriptor_723ed9409b965050 = []byte{ - // 258 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x49, 0x4a, 0x4c, 0xaa, +var fileDescriptor_4f95902e4096217a = []byte{ + // 227 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4f, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0xce, 0xc9, 0x4c, 0xcf, 0x00, 0x91, 0xa9, 0x79, 0x25, - 0xfa, 0xe9, 0xa9, 0x79, 0xa9, 0xc5, 0x99, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x92, - 0x50, 0x55, 0x7a, 0xa8, 0xaa, 0xf4, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xaa, - 0xf4, 0x41, 0x2c, 0x88, 0x06, 0x29, 0x65, 0x1c, 0xc6, 0x16, 0x24, 0x16, 0x25, 0xe6, 0x42, 0x4d, - 0x95, 0xd2, 0xc6, 0xa1, 0x08, 0xcd, 0x12, 0xb0, 0x62, 0xa5, 0xe5, 0x8c, 0x5c, 0x3c, 0xee, 0x10, - 0x47, 0x05, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0xd9, 0x73, 0xb1, 0x41, 0x4c, 0x93, 0x60, 0x54, 0x60, - 0xd4, 0xe0, 0x36, 0x52, 0xd4, 0xc3, 0xe9, 0x48, 0xbd, 0x00, 0xb0, 0x42, 0x27, 0x96, 0x13, 0xf7, - 0xe4, 0x19, 0x82, 0xa0, 0xda, 0x84, 0xc2, 0xb8, 0xf8, 0x93, 0x12, 0x8b, 0x53, 0xe3, 0x93, 0x4a, - 0x92, 0xe3, 0x33, 0x52, 0x13, 0x53, 0x52, 0x8b, 0x24, 0x98, 0xc0, 0x26, 0x69, 0xe0, 0x31, 0xc9, - 0x29, 0xc4, 0xd9, 0x03, 0xac, 0xd6, 0x33, 0x2f, 0x2d, 0x1f, 0x6a, 0x20, 0x2f, 0xc8, 0x18, 0xa7, - 0x92, 0x64, 0x88, 0x84, 0x53, 0xc0, 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, - 0x99, 0xa5, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xad, 0x48, 0xce, - 0x48, 0xcc, 0xcc, 0x83, 0x71, 0xf4, 0x2b, 0xd0, 0x83, 0xa2, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, - 0x0d, 0x1c, 0x04, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x20, 0xd6, 0xaf, 0x9a, 0xad, 0x01, - 0x00, 0x00, + 0xfa, 0x65, 0x86, 0xfa, 0xe9, 0xa9, 0x79, 0xa9, 0xc5, 0x99, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, + 0xf9, 0x42, 0x92, 0x50, 0x85, 0x7a, 0xa8, 0x0a, 0xf5, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, + 0xf3, 0xc1, 0xaa, 0xf4, 0x41, 0x2c, 0x88, 0x06, 0x29, 0x3d, 0xdc, 0x26, 0xa3, 0x19, 0x01, 0x56, + 0xaf, 0x94, 0xc6, 0xc5, 0xe3, 0x0e, 0xb1, 0x31, 0xb8, 0x24, 0xb1, 0x24, 0x55, 0x28, 0x8c, 0x8b, + 0x3f, 0x29, 0xb1, 0x38, 0x35, 0x3e, 0xa9, 0x24, 0x39, 0x3e, 0x23, 0x35, 0x31, 0x25, 0xb5, 0x48, + 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x43, 0x0f, 0xa7, 0x53, 0xf4, 0x9c, 0x42, 0x9c, 0x3d, + 0xc0, 0x6a, 0x3d, 0xf3, 0xd2, 0xf2, 0x9d, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0xe2, 0x05, 0x19, + 0xe3, 0x54, 0x92, 0x0c, 0x91, 0x70, 0x0a, 0x38, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, + 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, + 0x86, 0x28, 0xb3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x15, + 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, 0x8e, 0x7e, 0x05, 0xba, 0x5f, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, + 0x93, 0xd8, 0xc0, 0x1e, 0x30, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x13, 0xa2, 0xce, 0xd4, 0x4c, + 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -134,16 +124,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -165,8 +145,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) l = m.BaseBtcHeader.Size() n += 1 + l + sovGenesis(uint64(l)) return n @@ -208,39 +186,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BaseBtcHeader", wireType) } diff --git a/x/btclightclient/types/keys_test.go b/x/btclightclient/types/keys_test.go index 39d4d2bc9..7c1530abf 100644 --- a/x/btclightclient/types/keys_test.go +++ b/x/btclightclient/types/keys_test.go @@ -12,12 +12,12 @@ import ( ) func FuzzHeadersObjectKey(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - hexHash := datagen.GenRandomHexStr(bbn.BTCHeaderHashLen) - height := rand.Uint64() + r := rand.New(rand.NewSource(seed)) + hexHash := datagen.GenRandomHexStr(r, bbn.BTCHeaderHashLen) + height := r.Uint64() // get chainhash and height heightBytes := sdk.Uint64ToBigEndian(height) headerHash, _ := bbn.NewBTCHeaderHashBytesFromHex(hexHash) @@ -36,11 +36,11 @@ func FuzzHeadersObjectKey(f *testing.F) { } func FuzzHeadersObjectHeightAndWorkKey(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - hexHash := datagen.GenRandomHexStr(bbn.BTCHeaderHashLen) + r := rand.New(rand.NewSource(seed)) + hexHash := datagen.GenRandomHexStr(r, bbn.BTCHeaderHashLen) headerHash, _ := bbn.NewBTCHeaderHashBytesFromHex(hexHash) headerHashBytes := headerHash.MustMarshal() diff --git a/x/btclightclient/types/msgs_test.go b/x/btclightclient/types/msgs_test.go index f6a9769a3..27641d364 100644 --- a/x/btclightclient/types/msgs_test.go +++ b/x/btclightclient/types/msgs_test.go @@ -16,14 +16,14 @@ import ( func FuzzMsgInsertHeader(f *testing.F) { maxDifficulty := bbn.GetMaxDifficulty() - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) errorKind := 0 - addressBytes := datagen.GenRandomByteArray(1 + uint64(rand.Intn(255))) - headerBytes := datagen.GenRandomBTCHeaderInfo().Header + addressBytes := datagen.GenRandomByteArray(r, 1+uint64(r.Intn(255))) + headerBytes := datagen.GenRandomBTCHeaderInfo(r).Header headerHex := headerBytes.MarshalHex() // Get the signer structure @@ -31,8 +31,8 @@ func FuzzMsgInsertHeader(f *testing.F) { signer.Unmarshal(addressBytes) //nolint:errcheck // this is a test // Perform modifications on the header - errorKind = rand.Intn(2) - var bitsBig sdk.Uint + errorKind = r.Intn(2) + var bitsBig sdkmath.Uint switch errorKind { case 0: // Valid input @@ -46,7 +46,7 @@ func FuzzMsgInsertHeader(f *testing.F) { } // Generate a header with the provided modifications - newHeader := datagen.GenRandomBTCHeaderInfoWithBits(&bitsBig).Header + newHeader := datagen.GenRandomBTCHeaderInfoWithBits(r, &bitsBig).Header newHeaderHex := newHeader.MarshalHex() // Check whether the hash is still bigger than the maximum allowed diff --git a/x/btclightclient/types/params.go b/x/btclightclient/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/btclightclient/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/btclightclient/types/params.pb.go b/x/btclightclient/types/params.pb.go deleted file mode 100644 index ec3e11789..000000000 --- a/x/btclightclient/types/params.pb.go +++ /dev/null @@ -1,266 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btclightclient/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_a02d211bdb249bb3, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Params)(nil), "babylon.btclightclient.v1.Params") -} - -func init() { - proto.RegisterFile("babylon/btclightclient/params.proto", fileDescriptor_a02d211bdb249bb3) -} - -var fileDescriptor_a02d211bdb249bb3 = []byte{ - // 159 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0xce, 0xc9, 0x4c, 0xcf, 0x00, 0x91, 0xa9, 0x79, 0x25, - 0xfa, 0x05, 0x89, 0x45, 0x89, 0xb9, 0xc5, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x92, 0x50, - 0x45, 0x7a, 0xa8, 0x8a, 0xf4, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xaa, 0xf4, - 0x41, 0x2c, 0x88, 0x06, 0x25, 0x3e, 0x2e, 0xb6, 0x00, 0xb0, 0x01, 0x56, 0x2c, 0x33, 0x16, 0xc8, - 0x33, 0x38, 0x05, 0x9c, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, - 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x59, 0x7a, - 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x96, 0xe4, 0x8c, 0xc4, 0xcc, - 0x3c, 0x18, 0x47, 0xbf, 0x02, 0xdd, 0x65, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0x8b, - 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x89, 0x16, 0x8f, 0x17, 0xc0, 0x00, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/btclightclient/types/querier.go b/x/btclightclient/types/querier.go index 57065a3cb..51537d46c 100644 --- a/x/btclightclient/types/querier.go +++ b/x/btclightclient/types/querier.go @@ -5,11 +5,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" ) -// NewQueryParamsRequest creates a new instance of QueryParamsRequest. -func NewQueryParamsRequest() *QueryParamsRequest { - return &QueryParamsRequest{} -} - // NewQueryHashesRequest creates a new instance of QueryHashesRequest. func NewQueryHashesRequest(req *query.PageRequest) *QueryHashesRequest { return &QueryHashesRequest{Pagination: req} diff --git a/x/btclightclient/types/querier_test.go b/x/btclightclient/types/querier_test.go index 064f3a12f..e659a1041 100644 --- a/x/btclightclient/types/querier_test.go +++ b/x/btclightclient/types/querier_test.go @@ -11,18 +11,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/query" ) -func TestNewQueryParamsRequest(t *testing.T) { - newQueryParams := types.NewQueryParamsRequest() - if newQueryParams == nil { - t.Fatalf("A nil object was returned") - } - - emptyQueryParams := types.QueryParamsRequest{} - if *newQueryParams != emptyQueryParams { - t.Errorf("expected an empty QueryParamsRequest") - } -} - func TestNewQueryHashesRequest(t *testing.T) { headerBytes := bbn.GetBaseBTCHeaderBytes() headerHashBytes := headerBytes.Hash() @@ -43,10 +31,10 @@ func TestNewQueryHashesRequest(t *testing.T) { } func FuzzNewQueryContainsRequest(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - hexHash := datagen.GenRandomHexStr(bbn.BTCHeaderHashLen) + r := rand.New(rand.NewSource(seed)) + hexHash := datagen.GenRandomHexStr(r, bbn.BTCHeaderHashLen) btcHeaderHashBytes, _ := bbn.NewBTCHeaderHashBytesFromHex(hexHash) diff --git a/x/btclightclient/types/query.pb.go b/x/btclightclient/types/query.pb.go index fcaff17f8..123bb92d6 100644 --- a/x/btclightclient/types/query.pb.go +++ b/x/btclightclient/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btclightclient/query.proto +// source: babylon/btclightclient/v1/query.proto package types @@ -8,9 +8,9 @@ import ( fmt "fmt" github_com_babylonchain_babylon_types "github.com/babylonchain/babylon/types" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -31,89 +31,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - // QueryHashesRequest is request type for the Query/Hashes RPC method. // It involves retrieving all hashes that are maintained by the module. type QueryHashesRequest struct { @@ -124,7 +41,7 @@ func (m *QueryHashesRequest) Reset() { *m = QueryHashesRequest{} } func (m *QueryHashesRequest) String() string { return proto.CompactTextString(m) } func (*QueryHashesRequest) ProtoMessage() {} func (*QueryHashesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{2} + return fileDescriptor_3961270631e52721, []int{0} } func (m *QueryHashesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -170,7 +87,7 @@ func (m *QueryHashesResponse) Reset() { *m = QueryHashesResponse{} } func (m *QueryHashesResponse) String() string { return proto.CompactTextString(m) } func (*QueryHashesResponse) ProtoMessage() {} func (*QueryHashesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{3} + return fileDescriptor_3961270631e52721, []int{1} } func (m *QueryHashesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -216,7 +133,7 @@ func (m *QueryContainsRequest) Reset() { *m = QueryContainsRequest{} } func (m *QueryContainsRequest) String() string { return proto.CompactTextString(m) } func (*QueryContainsRequest) ProtoMessage() {} func (*QueryContainsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{4} + return fileDescriptor_3961270631e52721, []int{2} } func (m *QueryContainsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -254,7 +171,7 @@ func (m *QueryContainsResponse) Reset() { *m = QueryContainsResponse{} } func (m *QueryContainsResponse) String() string { return proto.CompactTextString(m) } func (*QueryContainsResponse) ProtoMessage() {} func (*QueryContainsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{5} + return fileDescriptor_3961270631e52721, []int{3} } func (m *QueryContainsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -290,8 +207,8 @@ func (m *QueryContainsResponse) GetContains() bool { return false } -// QueryContainsRequest is request type for the temporary Query/ContainsBytes RPC method. -// It involves checking whether a hash is maintained by the module. +// QueryContainsRequest is request type for the temporary Query/ContainsBytes +// RPC method. It involves checking whether a hash is maintained by the module. type QueryContainsBytesRequest struct { Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` } @@ -300,7 +217,7 @@ func (m *QueryContainsBytesRequest) Reset() { *m = QueryContainsBytesReq func (m *QueryContainsBytesRequest) String() string { return proto.CompactTextString(m) } func (*QueryContainsBytesRequest) ProtoMessage() {} func (*QueryContainsBytesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{6} + return fileDescriptor_3961270631e52721, []int{4} } func (m *QueryContainsBytesRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -336,7 +253,8 @@ func (m *QueryContainsBytesRequest) GetHash() []byte { return nil } -// QueryContainsResponse is response type for the temporary Query/ContainsBytes RPC method. +// QueryContainsResponse is response type for the temporary Query/ContainsBytes +// RPC method. type QueryContainsBytesResponse struct { Contains bool `protobuf:"varint,1,opt,name=contains,proto3" json:"contains,omitempty"` } @@ -345,7 +263,7 @@ func (m *QueryContainsBytesResponse) Reset() { *m = QueryContainsBytesRe func (m *QueryContainsBytesResponse) String() string { return proto.CompactTextString(m) } func (*QueryContainsBytesResponse) ProtoMessage() {} func (*QueryContainsBytesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{7} + return fileDescriptor_3961270631e52721, []int{5} } func (m *QueryContainsBytesResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -391,7 +309,7 @@ func (m *QueryMainChainRequest) Reset() { *m = QueryMainChainRequest{} } func (m *QueryMainChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryMainChainRequest) ProtoMessage() {} func (*QueryMainChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{8} + return fileDescriptor_3961270631e52721, []int{6} } func (m *QueryMainChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -437,7 +355,7 @@ func (m *QueryMainChainResponse) Reset() { *m = QueryMainChainResponse{} func (m *QueryMainChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryMainChainResponse) ProtoMessage() {} func (*QueryMainChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{9} + return fileDescriptor_3961270631e52721, []int{7} } func (m *QueryMainChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -480,6 +398,7 @@ func (m *QueryMainChainResponse) GetPagination() *query.PageResponse { return nil } +// QueryTipRequest is the request type for the Query/Tip RPC method. type QueryTipRequest struct { } @@ -487,7 +406,7 @@ func (m *QueryTipRequest) Reset() { *m = QueryTipRequest{} } func (m *QueryTipRequest) String() string { return proto.CompactTextString(m) } func (*QueryTipRequest) ProtoMessage() {} func (*QueryTipRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{10} + return fileDescriptor_3961270631e52721, []int{8} } func (m *QueryTipRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -516,6 +435,7 @@ func (m *QueryTipRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryTipRequest proto.InternalMessageInfo +// QueryTipResponse is the response type for the Query/Tip RPC method. type QueryTipResponse struct { Header *BTCHeaderInfo `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` } @@ -524,7 +444,7 @@ func (m *QueryTipResponse) Reset() { *m = QueryTipResponse{} } func (m *QueryTipResponse) String() string { return proto.CompactTextString(m) } func (*QueryTipResponse) ProtoMessage() {} func (*QueryTipResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{11} + return fileDescriptor_3961270631e52721, []int{9} } func (m *QueryTipResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -560,6 +480,8 @@ func (m *QueryTipResponse) GetHeader() *BTCHeaderInfo { return nil } +// QueryBaseHeaderRequest is the request type for the Query/BaseHeader RPC +// method. type QueryBaseHeaderRequest struct { } @@ -567,7 +489,7 @@ func (m *QueryBaseHeaderRequest) Reset() { *m = QueryBaseHeaderRequest{} func (m *QueryBaseHeaderRequest) String() string { return proto.CompactTextString(m) } func (*QueryBaseHeaderRequest) ProtoMessage() {} func (*QueryBaseHeaderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{12} + return fileDescriptor_3961270631e52721, []int{10} } func (m *QueryBaseHeaderRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -596,6 +518,8 @@ func (m *QueryBaseHeaderRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryBaseHeaderRequest proto.InternalMessageInfo +// QueryBaseHeaderResponse is the response type for the Query/BaseHeader RPC +// method. type QueryBaseHeaderResponse struct { Header *BTCHeaderInfo `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` } @@ -604,7 +528,7 @@ func (m *QueryBaseHeaderResponse) Reset() { *m = QueryBaseHeaderResponse func (m *QueryBaseHeaderResponse) String() string { return proto.CompactTextString(m) } func (*QueryBaseHeaderResponse) ProtoMessage() {} func (*QueryBaseHeaderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_6293be71fb7ba6c4, []int{13} + return fileDescriptor_3961270631e52721, []int{11} } func (m *QueryBaseHeaderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -641,8 +565,6 @@ func (m *QueryBaseHeaderResponse) GetHeader() *BTCHeaderInfo { } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "babylon.btclightclient.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "babylon.btclightclient.v1.QueryParamsResponse") proto.RegisterType((*QueryHashesRequest)(nil), "babylon.btclightclient.v1.QueryHashesRequest") proto.RegisterType((*QueryHashesResponse)(nil), "babylon.btclightclient.v1.QueryHashesResponse") proto.RegisterType((*QueryContainsRequest)(nil), "babylon.btclightclient.v1.QueryContainsRequest") @@ -658,59 +580,55 @@ func init() { } func init() { - proto.RegisterFile("babylon/btclightclient/query.proto", fileDescriptor_6293be71fb7ba6c4) -} - -var fileDescriptor_6293be71fb7ba6c4 = []byte{ - // 757 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xc1, 0x4f, 0x13, 0x4f, - 0x14, 0xc7, 0x3b, 0xc0, 0xaf, 0xbf, 0xfa, 0xd0, 0xa8, 0x23, 0x2a, 0x6c, 0x4c, 0x81, 0x45, 0xa0, - 0x82, 0xec, 0xd2, 0xa2, 0x86, 0x83, 0x89, 0xa6, 0x24, 0x8a, 0x07, 0x93, 0xda, 0x34, 0x1e, 0xd4, - 0xc4, 0x4c, 0xeb, 0xb8, 0xbb, 0x09, 0xdd, 0x59, 0xba, 0x0b, 0xb1, 0x57, 0x0f, 0x9e, 0x8d, 0xde, - 0x3c, 0x78, 0x30, 0xf1, 0xea, 0xc9, 0x3f, 0x82, 0x93, 0x21, 0xf1, 0x62, 0x3c, 0x10, 0x03, 0xfe, - 0x21, 0x66, 0x67, 0xde, 0xb6, 0x6c, 0xb1, 0xdd, 0x25, 0x72, 0x21, 0xec, 0xec, 0x7b, 0xef, 0xfb, - 0x99, 0x6f, 0x66, 0xbe, 0x5b, 0xd0, 0xeb, 0xac, 0xde, 0xde, 0x10, 0xae, 0x59, 0x0f, 0x1a, 0x1b, - 0x8e, 0x65, 0x87, 0x7f, 0xb9, 0x1b, 0x98, 0x9b, 0x5b, 0xbc, 0xd5, 0x36, 0xbc, 0x96, 0x08, 0x04, - 0x9d, 0xc0, 0x1a, 0x23, 0x5e, 0x63, 0x6c, 0x17, 0xb5, 0x31, 0x4b, 0x58, 0x42, 0x56, 0x99, 0xe1, - 0x7f, 0xaa, 0x41, 0xbb, 0x62, 0x09, 0x61, 0x6d, 0x70, 0x93, 0x79, 0x8e, 0xc9, 0x5c, 0x57, 0x04, - 0x2c, 0x70, 0x84, 0xeb, 0xe3, 0xdb, 0x85, 0x86, 0xf0, 0x9b, 0xc2, 0x37, 0xeb, 0xcc, 0xe7, 0x4a, - 0xc7, 0xdc, 0x2e, 0xd6, 0x79, 0xc0, 0x8a, 0xa6, 0xc7, 0x2c, 0xc7, 0x95, 0xc5, 0x58, 0x3b, 0xd3, - 0x07, 0xcf, 0x63, 0x2d, 0xd6, 0x8c, 0x06, 0x2e, 0xf6, 0x29, 0xea, 0xc1, 0x95, 0xc5, 0xfa, 0x18, - 0xd0, 0x47, 0xa1, 0x66, 0x45, 0x4e, 0xa8, 0xf2, 0xcd, 0x2d, 0xee, 0x07, 0xfa, 0x63, 0xb8, 0x10, - 0x5b, 0xf5, 0x3d, 0xe1, 0xfa, 0x9c, 0xde, 0x81, 0xac, 0x52, 0x1a, 0x27, 0x53, 0xa4, 0x30, 0x5a, - 0x9a, 0x36, 0xfa, 0x5a, 0x61, 0xa8, 0xd6, 0xf2, 0xc8, 0xce, 0xde, 0x64, 0xa6, 0x8a, 0x6d, 0xfa, - 0x33, 0x54, 0x5b, 0x67, 0xbe, 0xcd, 0x23, 0x35, 0x7a, 0x0f, 0xa0, 0xbb, 0x53, 0x1c, 0x3d, 0x67, - 0x28, 0x5b, 0x8c, 0xd0, 0x16, 0x43, 0xd9, 0x8f, 0xb6, 0x18, 0x15, 0x66, 0x71, 0xec, 0xad, 0x1e, - 0xea, 0xd4, 0xbf, 0x12, 0xc4, 0x8e, 0xc6, 0x23, 0x76, 0x0d, 0xb2, 0xb6, 0x5c, 0x19, 0x27, 0x53, - 0xc3, 0x85, 0xd3, 0xe5, 0xdb, 0x3f, 0xf7, 0x26, 0x57, 0x2d, 0x27, 0xb0, 0xb7, 0xea, 0x46, 0x43, - 0x34, 0x4d, 0xdc, 0x44, 0xc3, 0x66, 0x8e, 0x1b, 0x3d, 0x98, 0x41, 0xdb, 0xe3, 0xbe, 0x51, 0xae, - 0xad, 0xad, 0x73, 0xf6, 0x82, 0xb7, 0xc2, 0x91, 0xe5, 0x76, 0xc0, 0xfd, 0x2a, 0xce, 0xa2, 0xf7, - 0x63, 0xd4, 0x43, 0x92, 0x7a, 0x3e, 0x91, 0x5a, 0x21, 0xc5, 0xb0, 0x6d, 0x18, 0x93, 0xd4, 0x6b, - 0xc2, 0x0d, 0x98, 0xe3, 0x76, 0x6c, 0xa9, 0xc0, 0x48, 0x28, 0x25, 0x0d, 0xf9, 0x57, 0x68, 0x39, - 0x49, 0x5f, 0x81, 0x8b, 0x3d, 0x4a, 0xe8, 0x90, 0x06, 0xb9, 0x06, 0xae, 0x49, 0xb9, 0x5c, 0xb5, - 0xf3, 0xac, 0x9b, 0x30, 0x11, 0x6b, 0x52, 0x03, 0x91, 0x91, 0x1e, 0x66, 0x44, 0x95, 0x55, 0xd0, - 0xfe, 0xd6, 0x90, 0x42, 0xea, 0x39, 0xf2, 0x3d, 0x64, 0x8e, 0xbb, 0x16, 0x6e, 0xec, 0xa4, 0x4f, - 0xc8, 0x67, 0x02, 0x97, 0x7a, 0x15, 0x90, 0xab, 0x0c, 0xff, 0xdb, 0xd2, 0x34, 0x75, 0x4a, 0x46, - 0x4b, 0x85, 0x01, 0x87, 0xbb, 0xe3, 0xf0, 0x03, 0xf7, 0xa5, 0xa8, 0x46, 0x8d, 0x27, 0x77, 0x24, - 0xce, 0xc3, 0x59, 0x89, 0x59, 0x73, 0xbc, 0xe8, 0x4a, 0xd6, 0xe0, 0x5c, 0x77, 0x09, 0x99, 0xef, - 0x42, 0x56, 0x49, 0xa3, 0x25, 0xe9, 0x91, 0xb1, 0x4f, 0x1f, 0x47, 0x3f, 0xca, 0xcc, 0xe7, 0xea, - 0x75, 0xa4, 0xf7, 0x14, 0x2e, 0x1f, 0x79, 0x73, 0x52, 0xb2, 0xa5, 0x6f, 0x39, 0xf8, 0x4f, 0x4e, - 0xa7, 0xef, 0x08, 0x64, 0x55, 0x54, 0xd0, 0xa5, 0x01, 0x63, 0x8e, 0x66, 0x94, 0x66, 0xa4, 0x2d, - 0x57, 0xd4, 0xfa, 0xb5, 0xd7, 0xdf, 0x7f, 0xbf, 0x1f, 0x9a, 0xa1, 0xd3, 0x66, 0x9f, 0x7c, 0xdc, - 0x2e, 0x62, 0x8e, 0x4a, 0x28, 0x95, 0x21, 0xc9, 0x50, 0xb1, 0x28, 0x4b, 0x86, 0x8a, 0x47, 0x53, - 0x2a, 0x28, 0xcc, 0x9b, 0x0f, 0x04, 0x72, 0xd1, 0x95, 0xa2, 0x66, 0x92, 0x4e, 0x4f, 0x98, 0x68, - 0xcb, 0xe9, 0x1b, 0x10, 0x6d, 0x51, 0xa2, 0xcd, 0xd2, 0x99, 0x01, 0x68, 0xd1, 0xcd, 0xa5, 0x5f, - 0x08, 0x9c, 0x89, 0xdd, 0x77, 0x7a, 0x23, 0xad, 0xe0, 0xe1, 0x3c, 0xd1, 0x6e, 0x1e, 0xb3, 0x0b, - 0x59, 0x97, 0x25, 0xeb, 0x02, 0x2d, 0xa4, 0x60, 0x55, 0x78, 0x1f, 0x09, 0x9c, 0xea, 0x84, 0x00, - 0x4d, 0x74, 0xa7, 0x37, 0x91, 0xb4, 0xe2, 0x31, 0x3a, 0x10, 0xf2, 0xba, 0x84, 0x9c, 0xa3, 0x57, - 0x07, 0x40, 0x36, 0x99, 0xa3, 0x22, 0x9d, 0xbe, 0x21, 0x30, 0x5c, 0x73, 0x3c, 0xba, 0x90, 0x24, - 0xd4, 0xcd, 0x08, 0x6d, 0x31, 0x55, 0x2d, 0xe2, 0xcc, 0x49, 0x9c, 0x29, 0x9a, 0x1f, 0x80, 0x13, - 0x38, 0x1e, 0xfd, 0x44, 0x00, 0xba, 0x21, 0x40, 0x13, 0x37, 0x7e, 0x24, 0x4a, 0xb4, 0xd2, 0x71, - 0x5a, 0x90, 0x6e, 0x49, 0xd2, 0xcd, 0xd3, 0xd9, 0x01, 0x74, 0x61, 0xa2, 0xaa, 0x40, 0x29, 0x57, - 0x76, 0xf6, 0xf3, 0x64, 0x77, 0x3f, 0x4f, 0x7e, 0xed, 0xe7, 0xc9, 0xdb, 0x83, 0x7c, 0x66, 0xf7, - 0x20, 0x9f, 0xf9, 0x71, 0x90, 0xcf, 0x3c, 0xb9, 0x95, 0xf4, 0xcd, 0x7c, 0xd5, 0x3b, 0x59, 0x7e, - 0x44, 0xeb, 0x59, 0xf9, 0xfb, 0x68, 0xe5, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x2b, 0x69, 0xef, - 0x32, 0x12, 0x0a, 0x00, 0x00, + proto.RegisterFile("babylon/btclightclient/v1/query.proto", fileDescriptor_3961270631e52721) +} + +var fileDescriptor_3961270631e52721 = []byte{ + // 694 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x96, 0xb1, 0x4f, 0x14, 0x4f, + 0x14, 0xc7, 0x19, 0xf8, 0xfd, 0x0e, 0x7c, 0x68, 0xd4, 0x11, 0x15, 0x36, 0x66, 0xc5, 0x45, 0xe0, + 0x04, 0xd9, 0xe1, 0x0e, 0x35, 0x14, 0x16, 0xe6, 0x48, 0x14, 0x0b, 0x13, 0xbc, 0x5c, 0xa5, 0x26, + 0x66, 0xf6, 0x1c, 0x77, 0x37, 0x81, 0x9d, 0x85, 0x19, 0x88, 0xd7, 0x5a, 0x58, 0x1b, 0xed, 0x2c, + 0x2c, 0x4c, 0x6c, 0xad, 0x6c, 0xfc, 0x0f, 0x2c, 0x49, 0x6c, 0x8c, 0x85, 0x31, 0xe0, 0x1f, 0x62, + 0x76, 0xe6, 0x1d, 0xc7, 0x1d, 0x72, 0xb7, 0x44, 0x1a, 0xc2, 0xee, 0xbc, 0xef, 0xfb, 0x7e, 0xe6, + 0x65, 0xbe, 0xb3, 0x07, 0x93, 0x01, 0x0f, 0x1a, 0xab, 0x32, 0x61, 0x81, 0xae, 0xaf, 0xc6, 0x61, + 0x94, 0xfd, 0x15, 0x89, 0x66, 0x5b, 0x25, 0xb6, 0xbe, 0x29, 0x36, 0x1a, 0x7e, 0xba, 0x21, 0xb5, + 0xa4, 0x63, 0x58, 0xe6, 0xb7, 0x97, 0xf9, 0x5b, 0x25, 0x67, 0x24, 0x94, 0xa1, 0x34, 0x55, 0x2c, + 0xfb, 0xcf, 0x0a, 0x9c, 0x4b, 0xa1, 0x94, 0xe1, 0xaa, 0x60, 0x3c, 0x8d, 0x19, 0x4f, 0x12, 0xa9, + 0xb9, 0x8e, 0x65, 0xa2, 0x70, 0x75, 0xa6, 0x2e, 0xd5, 0x9a, 0x54, 0x2c, 0xe0, 0x4a, 0x58, 0x1f, + 0xb6, 0x55, 0x0a, 0x84, 0xe6, 0x25, 0x96, 0xf2, 0x30, 0x4e, 0x4c, 0x31, 0xd6, 0xfa, 0x87, 0x13, + 0x76, 0xc0, 0x98, 0x7a, 0xef, 0x09, 0xd0, 0x87, 0x59, 0xc7, 0x65, 0xae, 0x22, 0xa1, 0xaa, 0x62, + 0x7d, 0x53, 0x28, 0x4d, 0xef, 0x02, 0xb4, 0x3a, 0x8f, 0x92, 0x71, 0x52, 0x1c, 0x2e, 0x4f, 0xf9, + 0x16, 0xc3, 0xcf, 0x30, 0x7c, 0xbb, 0x5d, 0xc4, 0xf0, 0x57, 0x78, 0x28, 0x50, 0x5b, 0xdd, 0xa7, + 0xf4, 0x3e, 0x13, 0x38, 0xd7, 0xd6, 0x5e, 0xa5, 0x32, 0x51, 0x82, 0xd6, 0xa0, 0x10, 0x99, 0x37, + 0xa3, 0x64, 0x7c, 0xa0, 0x78, 0xb2, 0x72, 0xfb, 0xc7, 0xcf, 0xcb, 0x8b, 0x61, 0xac, 0xa3, 0xcd, + 0xc0, 0xaf, 0xcb, 0x35, 0x86, 0x9b, 0xa8, 0x47, 0x3c, 0x4e, 0x9a, 0x0f, 0x4c, 0x37, 0x52, 0xa1, + 0xfc, 0x4a, 0x6d, 0x69, 0x59, 0xf0, 0x67, 0x62, 0x23, 0x6b, 0x59, 0x69, 0x68, 0xa1, 0xaa, 0xd8, + 0x8b, 0xde, 0x6b, 0xa3, 0xee, 0x37, 0xd4, 0xd3, 0x3d, 0xa9, 0x2d, 0x52, 0x1b, 0x76, 0x04, 0x23, + 0x86, 0x7a, 0x49, 0x26, 0x9a, 0xc7, 0xc9, 0xde, 0x58, 0x56, 0xe0, 0xbf, 0xcc, 0xca, 0x0c, 0xe4, + 0x5f, 0xa1, 0x4d, 0x27, 0x6f, 0x01, 0xce, 0x77, 0x38, 0xe1, 0x84, 0x1c, 0x18, 0xaa, 0xe3, 0x3b, + 0x63, 0x37, 0x54, 0xdd, 0x7b, 0xf6, 0x18, 0x8c, 0xb5, 0x89, 0x6c, 0x43, 0x64, 0xa4, 0xfb, 0x19, + 0xd1, 0x65, 0x11, 0x9c, 0xbf, 0x09, 0x72, 0x58, 0x3d, 0x45, 0xbe, 0x07, 0x3c, 0x4e, 0x96, 0xb2, + 0x8d, 0x1d, 0xf7, 0x09, 0xf9, 0x48, 0xe0, 0x42, 0xa7, 0x03, 0x72, 0x55, 0x60, 0x30, 0x32, 0x43, + 0xb3, 0xa7, 0x64, 0xb8, 0x5c, 0xf4, 0x0f, 0xcd, 0x55, 0x6b, 0xc2, 0xf7, 0x93, 0xe7, 0xb2, 0xda, + 0x14, 0x1e, 0xdf, 0x91, 0x38, 0x0b, 0xa7, 0x0d, 0x66, 0x2d, 0x4e, 0x71, 0x1b, 0x5e, 0x0d, 0xce, + 0xb4, 0x5e, 0x21, 0xf3, 0x1d, 0x28, 0x58, 0x6b, 0x1c, 0x49, 0x7e, 0x64, 0xd4, 0x79, 0xa3, 0x38, + 0x8f, 0x0a, 0x57, 0xc2, 0x2e, 0x37, 0xfd, 0x1e, 0xc3, 0xc5, 0x03, 0x2b, 0xc7, 0x65, 0x5b, 0xfe, + 0x32, 0x08, 0xff, 0x9b, 0xee, 0xf4, 0x0d, 0x81, 0x82, 0x8d, 0x2b, 0x9d, 0xeb, 0xd2, 0xe6, 0xe0, + 0xad, 0xe1, 0xf8, 0x79, 0xcb, 0x2d, 0xb5, 0x77, 0xed, 0xe5, 0xb7, 0xdf, 0x6f, 0xfb, 0x27, 0xe8, + 0x15, 0x76, 0xf8, 0xa5, 0x85, 0xd1, 0x7e, 0x47, 0x60, 0xa8, 0x79, 0x7a, 0x29, 0xeb, 0xe5, 0xd3, + 0x91, 0x5b, 0x67, 0x3e, 0xbf, 0x00, 0xd1, 0x66, 0x0d, 0xda, 0x24, 0x9d, 0xe8, 0x82, 0xd6, 0x0c, + 0x09, 0xfd, 0x44, 0xe0, 0x54, 0x5b, 0xb4, 0xe8, 0x8d, 0xbc, 0x86, 0xfb, 0xa3, 0xeb, 0xdc, 0x3c, + 0xa2, 0x0a, 0x59, 0xe7, 0x0d, 0xeb, 0x0c, 0x2d, 0xe6, 0x60, 0xb5, 0x78, 0xef, 0x09, 0x9c, 0xd8, + 0xcb, 0x1b, 0xed, 0x39, 0x9d, 0xce, 0xf0, 0x3b, 0xa5, 0x23, 0x28, 0x10, 0xf2, 0xba, 0x81, 0x9c, + 0xa2, 0x57, 0xbb, 0x40, 0xae, 0xf1, 0xd8, 0xde, 0x9e, 0xf4, 0x15, 0x81, 0x81, 0x5a, 0x9c, 0xd2, + 0x99, 0x5e, 0x46, 0xad, 0x38, 0x3a, 0xb3, 0xb9, 0x6a, 0x11, 0x67, 0xca, 0xe0, 0x8c, 0x53, 0xb7, + 0x0b, 0x8e, 0x8e, 0x53, 0xfa, 0x81, 0x00, 0xb4, 0xf2, 0x46, 0x7b, 0x6e, 0xfc, 0x40, 0x6a, 0x9d, + 0xf2, 0x51, 0x24, 0x48, 0x37, 0x67, 0xe8, 0xa6, 0xe9, 0x64, 0x17, 0xba, 0xec, 0xf2, 0xb2, 0xd9, + 0xad, 0xac, 0x7c, 0xdd, 0x71, 0xc9, 0xf6, 0x8e, 0x4b, 0x7e, 0xed, 0xb8, 0xe4, 0xf5, 0xae, 0xdb, + 0xb7, 0xbd, 0xeb, 0xf6, 0x7d, 0xdf, 0x75, 0xfb, 0x1e, 0xdd, 0xea, 0xf5, 0x79, 0x7a, 0xd1, 0xd9, + 0xd9, 0x7c, 0xaf, 0x82, 0x82, 0xf9, 0x71, 0xb0, 0xf0, 0x27, 0x00, 0x00, 0xff, 0xff, 0x88, 0x96, + 0xa9, 0x76, 0xf0, 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -725,8 +643,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Hashes retrieves the hashes maintained by the module. Hashes(ctx context.Context, in *QueryHashesRequest, opts ...grpc.CallOption) (*QueryHashesResponse, error) // Contains checks whether a hash is maintained by the module. @@ -740,6 +656,8 @@ type QueryClient interface { MainChain(ctx context.Context, in *QueryMainChainRequest, opts ...grpc.CallOption) (*QueryMainChainResponse, error) // Tip return best header on canonical chain Tip(ctx context.Context, in *QueryTipRequest, opts ...grpc.CallOption) (*QueryTipResponse, error) + // BaseHeader returns the base BTC header of the chain. This header is defined + // on genesis. BaseHeader(ctx context.Context, in *QueryBaseHeaderRequest, opts ...grpc.CallOption) (*QueryBaseHeaderResponse, error) } @@ -751,15 +669,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/babylon.btclightclient.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) Hashes(ctx context.Context, in *QueryHashesRequest, opts ...grpc.CallOption) (*QueryHashesResponse, error) { out := new(QueryHashesResponse) err := c.cc.Invoke(ctx, "/babylon.btclightclient.v1.Query/Hashes", in, out, opts...) @@ -816,8 +725,6 @@ func (c *queryClient) BaseHeader(ctx context.Context, in *QueryBaseHeaderRequest // QueryServer is the server API for Query service. type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Hashes retrieves the hashes maintained by the module. Hashes(context.Context, *QueryHashesRequest) (*QueryHashesResponse, error) // Contains checks whether a hash is maintained by the module. @@ -831,6 +738,8 @@ type QueryServer interface { MainChain(context.Context, *QueryMainChainRequest) (*QueryMainChainResponse, error) // Tip return best header on canonical chain Tip(context.Context, *QueryTipRequest) (*QueryTipResponse, error) + // BaseHeader returns the base BTC header of the chain. This header is defined + // on genesis. BaseHeader(context.Context, *QueryBaseHeaderRequest) (*QueryBaseHeaderResponse, error) } @@ -838,9 +747,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func (*UnimplementedQueryServer) Hashes(ctx context.Context, req *QueryHashesRequest) (*QueryHashesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Hashes not implemented") } @@ -864,24 +770,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/babylon.btclightclient.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_Hashes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryHashesRequest) if err := dec(in); err != nil { @@ -994,10 +882,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.btclightclient.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, { MethodName: "Hashes", Handler: _Query_Hashes_Handler, @@ -1024,63 +908,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/btclightclient/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + Metadata: "babylon/btclightclient/v1/query.proto", } func (m *QueryHashesRequest) Marshal() (dAtA []byte, err error) { @@ -1509,26 +1337,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryHashesRequest) Size() (n int) { if m == nil { return 0 @@ -1693,139 +1501,6 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryHashesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/btclightclient/types/query.pb.gw.go b/x/btclightclient/types/query.pb.gw.go index 5e200d278..14fc314c2 100644 --- a/x/btclightclient/types/query.pb.gw.go +++ b/x/btclightclient/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: babylon/btclightclient/query.proto +// source: babylon/btclightclient/v1/query.proto /* Package types is a reverse proxy. @@ -33,24 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - var ( filter_Query_Hashes_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) @@ -237,29 +219,6 @@ func local_request_Query_BaseHeader_0(ctx context.Context, marshaler runtime.Mar // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Hashes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -439,26 +398,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Hashes_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -583,8 +522,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "btclightclient", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Hashes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "btclightclient", "v1", "hashes"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Contains_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "btclightclient", "v1", "contains"}, "", runtime.AssumeColonVerbOpt(false))) @@ -599,8 +536,6 @@ var ( ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_Hashes_0 = runtime.ForwardResponseMessage forward_Query_Contains_0 = runtime.ForwardResponseMessage diff --git a/x/btclightclient/types/tx.pb.go b/x/btclightclient/types/tx.pb.go index 229dcefb4..4790b7e81 100644 --- a/x/btclightclient/types/tx.pb.go +++ b/x/btclightclient/types/tx.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/btclightclient/tx.proto +// source: babylon/btclightclient/v1/tx.proto package types @@ -7,9 +7,9 @@ import ( context "context" fmt "fmt" github_com_babylonchain_babylon_types "github.com/babylonchain/babylon/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -39,7 +39,7 @@ func (m *MsgInsertHeader) Reset() { *m = MsgInsertHeader{} } func (m *MsgInsertHeader) String() string { return proto.CompactTextString(m) } func (*MsgInsertHeader) ProtoMessage() {} func (*MsgInsertHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_84e67479ce863198, []int{0} + return fileDescriptor_5f638eee60234021, []int{0} } func (m *MsgInsertHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -75,6 +75,7 @@ func (m *MsgInsertHeader) GetSigner() string { return "" } +// MsgInsertHeaderResponse defines the response for the InsertHeader transaction type MsgInsertHeaderResponse struct { } @@ -82,7 +83,7 @@ func (m *MsgInsertHeaderResponse) Reset() { *m = MsgInsertHeaderResponse func (m *MsgInsertHeaderResponse) String() string { return proto.CompactTextString(m) } func (*MsgInsertHeaderResponse) ProtoMessage() {} func (*MsgInsertHeaderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_84e67479ce863198, []int{1} + return fileDescriptor_5f638eee60234021, []int{1} } func (m *MsgInsertHeaderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -116,27 +117,29 @@ func init() { proto.RegisterType((*MsgInsertHeaderResponse)(nil), "babylon.btclightclient.v1.MsgInsertHeaderResponse") } -func init() { proto.RegisterFile("babylon/btclightclient/tx.proto", fileDescriptor_84e67479ce863198) } +func init() { + proto.RegisterFile("babylon/btclightclient/v1/tx.proto", fileDescriptor_5f638eee60234021) +} -var fileDescriptor_84e67479ce863198 = []byte{ - // 270 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0x4a, 0x4c, 0xaa, +var fileDescriptor_5f638eee60234021 = []byte{ + // 265 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2a, 0x49, 0xce, 0xc9, 0x4c, 0xcf, 0x00, 0x91, 0xa9, 0x79, 0x25, - 0xfa, 0x25, 0x15, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x92, 0x50, 0x05, 0x7a, 0xa8, 0x0a, - 0xf4, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xaa, 0xf4, 0x41, 0x2c, 0x88, 0x06, - 0x29, 0x6d, 0x1c, 0x26, 0xa2, 0xe9, 0x07, 0x2b, 0x56, 0xaa, 0xe6, 0xe2, 0xf7, 0x2d, 0x4e, 0xf7, - 0xcc, 0x2b, 0x4e, 0x2d, 0x2a, 0xf1, 0x48, 0x4d, 0x4c, 0x49, 0x2d, 0x12, 0x12, 0xe3, 0x62, 0x2b, - 0xce, 0x4c, 0xcf, 0x4b, 0x2d, 0x92, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, 0x82, 0xf2, 0x84, 0x02, - 0xb8, 0xd8, 0x32, 0xc0, 0x2a, 0x24, 0x98, 0x14, 0x18, 0x35, 0x78, 0x9c, 0x2c, 0x6e, 0xdd, 0x93, - 0x37, 0x49, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0x87, 0x5a, 0x9b, 0x9c, - 0x91, 0x98, 0x99, 0x07, 0xe3, 0xe8, 0x97, 0x54, 0x16, 0xa4, 0x16, 0xeb, 0x39, 0x85, 0x38, 0x43, - 0x0c, 0x77, 0xaa, 0x2c, 0x49, 0x2d, 0x0e, 0x82, 0x9a, 0xa3, 0x24, 0xc9, 0x25, 0x8e, 0x66, 0x79, - 0x50, 0x6a, 0x71, 0x41, 0x7e, 0x5e, 0x71, 0xaa, 0x51, 0x39, 0x17, 0xb3, 0x6f, 0x71, 0xba, 0x50, - 0x01, 0x17, 0x0f, 0x8a, 0xdb, 0xb4, 0xf4, 0x70, 0x86, 0x86, 0x1e, 0x9a, 0x51, 0x52, 0x46, 0xc4, - 0xab, 0x85, 0x59, 0xab, 0xc4, 0xe0, 0x14, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, - 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, - 0x0c, 0x51, 0x66, 0x84, 0xfc, 0x5a, 0x81, 0x11, 0x87, 0x20, 0xcf, 0x27, 0xb1, 0x81, 0x43, 0xda, - 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x26, 0xac, 0x10, 0xa6, 0xea, 0x01, 0x00, 0x00, + 0xfa, 0x65, 0x86, 0xfa, 0x25, 0x15, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x92, 0x50, 0x35, + 0x7a, 0xa8, 0x6a, 0xf4, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xaa, 0xf4, 0x41, + 0x2c, 0x88, 0x06, 0xa5, 0x6a, 0x2e, 0x7e, 0xdf, 0xe2, 0x74, 0xcf, 0xbc, 0xe2, 0xd4, 0xa2, 0x12, + 0x8f, 0xd4, 0xc4, 0x94, 0xd4, 0x22, 0x21, 0x31, 0x2e, 0xb6, 0xe2, 0xcc, 0xf4, 0xbc, 0xd4, 0x22, + 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x28, 0x4f, 0x28, 0x80, 0x8b, 0x2d, 0x03, 0xac, 0x42, + 0x82, 0x49, 0x81, 0x51, 0x83, 0xc7, 0xc9, 0xe2, 0xd6, 0x3d, 0x79, 0x93, 0xf4, 0xcc, 0x92, 0x8c, + 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0xd5, 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, 0x8e, + 0x7e, 0x49, 0x65, 0x41, 0x6a, 0xb1, 0x9e, 0x53, 0x88, 0x33, 0xc4, 0x70, 0xa7, 0xca, 0x92, 0xd4, + 0xe2, 0x20, 0xa8, 0x39, 0x4a, 0x92, 0x5c, 0xe2, 0x68, 0x96, 0x07, 0xa5, 0x16, 0x17, 0xe4, 0xe7, + 0x15, 0xa7, 0x1a, 0x95, 0x73, 0x31, 0xfb, 0x16, 0xa7, 0x0b, 0x15, 0x70, 0xf1, 0xa0, 0xb8, 0x4d, + 0x4b, 0x0f, 0xa7, 0x07, 0xf5, 0xd0, 0x8c, 0x92, 0x32, 0x22, 0x5e, 0x2d, 0xcc, 0x5a, 0x25, 0x06, + 0xa7, 0x80, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, + 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x23, 0xe4, 0xd7, + 0x0a, 0xf4, 0x98, 0x01, 0x7b, 0x3e, 0x89, 0x0d, 0x1c, 0xd2, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x26, 0x30, 0x43, 0x4d, 0xc0, 0x01, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -151,6 +154,8 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + // InsertHeader adds a header to the BTC light client chain maintained by + // Babylon. InsertHeader(ctx context.Context, in *MsgInsertHeader, opts ...grpc.CallOption) (*MsgInsertHeaderResponse, error) } @@ -173,6 +178,8 @@ func (c *msgClient) InsertHeader(ctx context.Context, in *MsgInsertHeader, opts // MsgServer is the server API for Msg service. type MsgServer interface { + // InsertHeader adds a header to the BTC light client chain maintained by + // Babylon. InsertHeader(context.Context, *MsgInsertHeader) (*MsgInsertHeaderResponse, error) } @@ -216,7 +223,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/btclightclient/tx.proto", + Metadata: "babylon/btclightclient/v1/tx.proto", } func (m *MsgInsertHeader) Marshal() (dAtA []byte, err error) { diff --git a/x/btclightclient/types/work_test.go b/x/btclightclient/types/work_test.go index df694329e..e4e20a458 100644 --- a/x/btclightclient/types/work_test.go +++ b/x/btclightclient/types/work_test.go @@ -9,11 +9,11 @@ import ( ) func FuzzCumulativeWork(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 100) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - numa := rand.Uint64() - numb := rand.Uint64() + r := rand.New(rand.NewSource(seed)) + numa := r.Uint64() + numb := r.Uint64() biga := sdk.NewUint(numa) bigb := sdk.NewUint(numb) diff --git a/x/checkpointing/abci.go b/x/checkpointing/abci.go index c7348f161..eee07578d 100644 --- a/x/checkpointing/abci.go +++ b/x/checkpointing/abci.go @@ -8,9 +8,9 @@ import ( "github.com/babylonchain/babylon/x/checkpointing/keeper" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" ) // BeginBlocker is called at the beginning of every block. diff --git a/x/checkpointing/client/cli/query.go b/x/checkpointing/client/cli/query.go index 78a0b3daf..76b89bb05 100644 --- a/x/checkpointing/client/cli/query.go +++ b/x/checkpointing/client/cli/query.go @@ -4,9 +4,10 @@ import ( "context" "errors" "fmt" - "github.com/cosmos/cosmos-sdk/client/flags" "strconv" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -24,10 +25,9 @@ func GetQueryCmd(queryRoute string) *cobra.Command { SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } - - cmd.AddCommand(CmdQueryParams()) cmd.AddCommand(CmdRawCheckpoint()) cmd.AddCommand(CmdRawCheckpointList()) + cmd.AddCommand(CmdRawCheckpoints()) return cmd } @@ -98,3 +98,36 @@ func CmdRawCheckpoint() *cobra.Command { return cmd } + +// CmdRawCheckpoints defines the cobra command to query the raw checkpoints +func CmdRawCheckpoints() *cobra.Command { + cmd := &cobra.Command{ + Use: "raw-checkpoints", + Short: "retrieve the checkpoints for a epoch range", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + pageReq, err := client.ReadPageRequest(cmd.Flags()) + if err != nil { + return err + } + + res, err := queryClient.RawCheckpoints(context.Background(), &types.QueryRawCheckpointsRequest{ + Pagination: pageReq, + }) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + flags.AddPaginationFlagsToCmd(cmd, "raw-checkpoints") + + return cmd +} diff --git a/x/checkpointing/client/cli/query_params.go b/x/checkpointing/client/cli/query_params.go deleted file mode 100644 index 64405737f..000000000 --- a/x/checkpointing/client/cli/query_params.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "context" - - "github.com/babylonchain/babylon/x/checkpointing/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/checkpointing/client/cli/tx.go b/x/checkpointing/client/cli/tx.go index d4986d8cb..f309c0654 100644 --- a/x/checkpointing/client/cli/tx.go +++ b/x/checkpointing/client/cli/tx.go @@ -72,7 +72,7 @@ func CmdTxAddBlsSig() *cobra.Command { return err } - msg := types.NewMsgAddBlsSig(epoch_num, lch, blsSig, addr) + msg := types.NewMsgAddBlsSig(clientCtx.GetFromAddress(), epoch_num, lch, blsSig, addr) return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, @@ -98,8 +98,14 @@ before running the command (e.g., via babylond create-bls-key).`)) return err } - txf := tx.NewFactoryCLI(clientCtx, cmd.Flags()). - WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, err := tx.NewFactoryCLI(clientCtx, cmd.Flags()) + + if err != nil { + return err + } + + txf = txf.WithTxConfig(clientCtx.TxConfig).WithAccountRetriever(clientCtx.AccountRetriever) + txf, msg, err := buildWrappedCreateValidatorMsg(clientCtx, txf, cmd.Flags()) if err != nil { return err diff --git a/x/checkpointing/client/cli/tx_test.go b/x/checkpointing/client/cli/tx_test.go index c7150d3cc..98452e3bd 100644 --- a/x/checkpointing/client/cli/tx_test.go +++ b/x/checkpointing/client/cli/tx_test.go @@ -10,10 +10,10 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/crypto/hd" - "github.com/cosmos/cosmos-sdk/tests/mocks" + "github.com/cosmos/cosmos-sdk/testutil/mock" "github.com/golang/mock/gomock" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" "github.com/cosmos/cosmos-sdk/client" @@ -22,19 +22,20 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/staking/client/cli" + abci "github.com/cometbft/cometbft/abci/types" + tmconfig "github.com/cometbft/cometbft/config" + tmbytes "github.com/cometbft/cometbft/libs/bytes" + tmos "github.com/cometbft/cometbft/libs/os" + rpcclient "github.com/cometbft/cometbft/rpc/client" + rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock" + coretypes "github.com/cometbft/cometbft/rpc/core/types" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/privval" testutilcli "github.com/babylonchain/babylon/testutil/cli" checkpointcli "github.com/babylonchain/babylon/x/checkpointing/client/cli" - abci "github.com/tendermint/tendermint/abci/types" - tmconfig "github.com/tendermint/tendermint/config" - tmbytes "github.com/tendermint/tendermint/libs/bytes" - tmos "github.com/tendermint/tendermint/libs/os" - rpcclient "github.com/tendermint/tendermint/rpc/client" - rpcclientmock "github.com/tendermint/tendermint/rpc/client/mock" - coretypes "github.com/tendermint/tendermint/rpc/core/types" - tmtypes "github.com/tendermint/tendermint/types" ) type mockTendermintRPC struct { @@ -70,10 +71,10 @@ type CLITestSuite struct { } func (s *CLITestSuite) SetupSuite() { - s.encCfg = app.MakeTestEncodingConfig() + s.encCfg = app.GetEncodingConfig() s.kr = keyring.NewInMemory(s.encCfg.Marshaler) ctrl := gomock.NewController(s.T()) - mockAccountRetriever := mocks.NewMockAccountRetriever(ctrl) + mockAccountRetriever := mock.NewMockAccountRetriever(ctrl) mockAccountRetriever.EXPECT().EnsureExists(gomock.Any(), gomock.Any()).Return(nil) mockAccountRetriever.EXPECT().GetAccountNumberSequence(gomock.Any(), gomock.Any()).Return(uint64(0), uint64(0), nil) s.baseCtx = client.Context{}. diff --git a/x/checkpointing/client/cli/utils.go b/x/checkpointing/client/cli/utils.go index a29c89903..6a0f1479e 100644 --- a/x/checkpointing/client/cli/utils.go +++ b/x/checkpointing/client/cli/utils.go @@ -9,6 +9,11 @@ import ( flag "github.com/spf13/pflag" + errorsmod "cosmossdk.io/errors" + "github.com/babylonchain/babylon/privval" + "github.com/babylonchain/babylon/x/checkpointing/types" + tmconfig "github.com/cometbft/cometbft/config" + tmos "github.com/cometbft/cometbft/libs/os" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" @@ -16,11 +21,6 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" cosmoscli "github.com/cosmos/cosmos-sdk/x/staking/client/cli" staketypes "github.com/cosmos/cosmos-sdk/x/staking/types" - tmconfig "github.com/tendermint/tendermint/config" - tmos "github.com/tendermint/tendermint/libs/os" - - "github.com/babylonchain/babylon/privval" - "github.com/babylonchain/babylon/x/checkpointing/types" ) // copied from https://github.com/cosmos/cosmos-sdk/blob/7167371f87ae641012549922a292050562821dce/x/staking/client/cli/tx.go#L340 @@ -70,7 +70,7 @@ func newBuildCreateValidatorMsg(clientCtx client.Context, txf tx.Factory, fs *fl minSelfDelegation, ok := sdk.NewIntFromString(msbStr) if !ok { - return txf, nil, sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") + return txf, nil, errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "minimum self delegation must be a positive integer") } msg, err := staketypes.NewMsgCreateValidator( diff --git a/x/checkpointing/genesis.go b/x/checkpointing/genesis.go index 35760b00f..60bbca23f 100644 --- a/x/checkpointing/genesis.go +++ b/x/checkpointing/genesis.go @@ -9,15 +9,11 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) - k.SetGenBlsKeys(ctx, genState.GenesisKeys) } // ExportGenesis returns the capability module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - return genesis } diff --git a/x/checkpointing/genesis_test.go b/x/checkpointing/genesis_test.go index 542177053..5fdc738c9 100644 --- a/x/checkpointing/genesis_test.go +++ b/x/checkpointing/genesis_test.go @@ -6,15 +6,15 @@ import ( "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/privval" "github.com/babylonchain/babylon/x/checkpointing" + "github.com/cometbft/cometbft/crypto/ed25519" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" cosmosed "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/ed25519" simapp "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/x/checkpointing/types" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" ) func TestInitGenesis(t *testing.T) { @@ -39,7 +39,6 @@ func TestInitGenesis(t *testing.T) { genKeys[i] = genKey } genesisState := types.GenesisState{ - Params: types.Params{}, GenesisKeys: genKeys, } diff --git a/x/checkpointing/handler.go b/x/checkpointing/handler.go deleted file mode 100644 index a939e5a03..000000000 --- a/x/checkpointing/handler.go +++ /dev/null @@ -1,23 +0,0 @@ -package checkpointing - -import ( - "fmt" - - "github.com/babylonchain/babylon/x/checkpointing/keeper" - "github.com/babylonchain/babylon/x/checkpointing/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - _ = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/checkpointing/keeper/bls_signer.go b/x/checkpointing/keeper/bls_signer.go index 56009ccad..e6d432316 100644 --- a/x/checkpointing/keeper/bls_signer.go +++ b/x/checkpointing/keeper/bls_signer.go @@ -6,11 +6,12 @@ import ( epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/babylonchain/babylon/client/tx" "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/types/retry" "github.com/babylonchain/babylon/x/checkpointing/types" - sdk "github.com/cosmos/cosmos-sdk/types" ) type BlsSigner interface { @@ -32,19 +33,20 @@ func (k Keeper) SendBlsSig(ctx sdk.Context, epochNum uint64, lch types.LastCommi } // get BLS signature by signing - signBytes := append(sdk.Uint64ToBigEndian(epochNum), lch...) + signBytes := types.GetSignBytes(epochNum, lch) blsSig, err := k.blsSigner.SignMsgWithBls(signBytes) if err != nil { return err } // create MsgAddBlsSig message - msg := types.NewMsgAddBlsSig(epochNum, lch, blsSig, addr) + msg := types.NewMsgAddBlsSig(k.clientCtx.GetFromAddress(), epochNum, lch, blsSig, addr) // keep sending the message to Tendermint until success or timeout // TODO should read the parameters from config file + var res *sdk.TxResponse err = retry.Do(1*time.Second, 1*time.Minute, func() error { - _, err := tx.SendMsgToTendermint(k.clientCtx, msg) + res, err = tx.SendMsgToTendermint(k.clientCtx, msg) if err != nil { return err } @@ -55,7 +57,7 @@ func (k Keeper) SendBlsSig(ctx sdk.Context, epochNum uint64, lch types.LastCommi return err } - ctx.Logger().Info(fmt.Sprintf("Successfully sent BLS-sig tx for epoch %v", epochNum)) + ctx.Logger().Info(fmt.Sprintf("Successfully sent BLS-sig tx for epoch %d, tx hash: %s, gas used: %d, gas wanted: %d", epochNum, res.TxHash, res.GasUsed, res.GasWanted)) return nil } diff --git a/x/checkpointing/keeper/bls_signer_test.go b/x/checkpointing/keeper/bls_signer_test.go index b204c667a..a6b367238 100644 --- a/x/checkpointing/keeper/bls_signer_test.go +++ b/x/checkpointing/keeper/bls_signer_test.go @@ -1,21 +1,11 @@ package keeper_test import ( - "fmt" - "testing" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/crypto/bls12381" - testkeeper "github.com/babylonchain/babylon/testutil/keeper" - "github.com/babylonchain/babylon/testutil/mocks" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - "github.com/cosmos/cosmos-sdk/testutil/network" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/tmhash" ) var ( @@ -38,38 +28,3 @@ var ( blsPubKey2 = blsPrivKey2.PubKey() pubkeys = []bls12381.PublicKey{blsPubKey1, blsPubKey2} ) - -func TestKeeper_SendBlsSig(t *testing.T) { - cfg := network.DefaultConfig() - encodingCfg := app.MakeTestEncodingConfig() - cfg.InterfaceRegistry = encodingCfg.InterfaceRegistry - cfg.TxConfig = encodingCfg.TxConfig - cfg.NumValidators = 1 - - testNetwork, err := network.New(t, t.TempDir(), cfg) - require.NoError(t, err) - defer testNetwork.Cleanup() - - val := testNetwork.Validators[0] - nodeDirName := fmt.Sprintf("node%d", 0) - clientCtx := val.ClientCtx.WithHeight(2). - WithFromAddress(val.Address). - WithFromName(nodeDirName). - WithBroadcastMode(flags.BroadcastAsync) - clientCtx.SkipConfirm = true - - epochNum := uint64(10) - lch := tmhash.Sum([]byte("last_commit_hash")) - signBytes := append(sdk.Uint64ToBigEndian(epochNum), lch...) - - ctrl := gomock.NewController(t) - defer ctrl.Finish() - ek := mocks.NewMockEpochingKeeper(ctrl) - signer := mocks.NewMockBlsSigner(ctrl) - ckptkeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, ek, signer, clientCtx) - - signer.EXPECT().GetAddress().Return(addr1) - signer.EXPECT().SignMsgWithBls(gomock.Eq(signBytes)).Return(bls12381.Sign(blsPrivKey1, signBytes), nil) - err = ckptkeeper.SendBlsSig(ctx, epochNum, lch, valSet) - require.NoError(t, err) -} diff --git a/x/checkpointing/keeper/grpc_query_bls_test.go b/x/checkpointing/keeper/grpc_query_bls_test.go index e6e3e264d..322d7eb32 100644 --- a/x/checkpointing/keeper/grpc_query_bls_test.go +++ b/x/checkpointing/keeper/grpc_query_bls_test.go @@ -22,14 +22,13 @@ import ( func FuzzQueryBLSKeySet(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // a genesis validator is generated for setup helper := testepoching.NewHelper(t) ek := helper.EpochingKeeper ck := helper.App.CheckpointingKeeper - querier := checkpointingkeeper.Querier{Keeper: ck} queryHelper := baseapp.NewQueryServerTestHelper(helper.Ctx, helper.App.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, querier) + types.RegisterQueryServer(queryHelper, ck) queryClient := types.NewQueryClient(queryHelper) msgServer := checkpointingkeeper.NewMsgServerImpl(ck) genesisVal := ek.GetValidatorSet(helper.Ctx, 0)[0] @@ -37,7 +36,7 @@ func FuzzQueryBLSKeySet(f *testing.F) { require.NoError(t, err) // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := ek.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) @@ -53,7 +52,7 @@ func FuzzQueryBLSKeySet(f *testing.F) { require.Equal(t, res.ValidatorWithBlsKeys[0].ValidatorAddress, genesisVal.GetValAddressStr()) // add n new validators via MsgWrappedCreateValidator - n := rand.Intn(3) + 1 + n := r.Intn(3) + 1 addrs := app.AddTestAddrs(helper.App, helper.Ctx, n, sdk.NewInt(100000000)) wcvMsgs := make([]*types.MsgWrappedCreateValidator, n) @@ -70,7 +69,7 @@ func FuzzQueryBLSKeySet(f *testing.F) { // go to BeginBlock of block 11, and thus entering epoch 2 for i := uint64(0); i < ek.GetParams(ctx).EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = ek.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) diff --git a/x/checkpointing/keeper/grpc_query_checkpoint.go b/x/checkpointing/keeper/grpc_query_checkpoint.go index 120a03f6d..94107561e 100644 --- a/x/checkpointing/keeper/grpc_query_checkpoint.go +++ b/x/checkpointing/keeper/grpc_query_checkpoint.go @@ -4,11 +4,12 @@ import ( "context" "fmt" - "github.com/babylonchain/babylon/x/checkpointing/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + "github.com/babylonchain/babylon/x/checkpointing/types" ) var _ types.QueryServer = Keeper{} @@ -60,6 +61,29 @@ func (k Keeper) RawCheckpoint(ctx context.Context, req *types.QueryRawCheckpoint return &types.QueryRawCheckpointResponse{RawCheckpoint: ckptWithMeta}, nil } +// RawCheckpoints returns checkpoints for given epoch range specified in pagination params +func (k Keeper) RawCheckpoints(ctx context.Context, req *types.QueryRawCheckpointsRequest) (*types.QueryRawCheckpointsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + sdkCtx := sdk.UnwrapSDKContext(ctx) + store := k.CheckpointsState(sdkCtx).checkpoints + + var checkpointList []*types.RawCheckpointWithMeta + pageRes, err := query.Paginate(store, req.Pagination, func(key, value []byte) error { + var ckptWithMeta types.RawCheckpointWithMeta + k.cdc.MustUnmarshal(value, &ckptWithMeta) + checkpointList = append(checkpointList, &ckptWithMeta) + return nil + }) + if err != nil { + return nil, err + } + + return &types.QueryRawCheckpointsResponse{RawCheckpoints: checkpointList, Pagination: pageRes}, nil +} + // EpochStatus returns the status of the checkpoint at a given epoch func (k Keeper) EpochStatus(ctx context.Context, req *types.QueryEpochStatusRequest) (*types.QueryEpochStatusResponse, error) { if req == nil { diff --git a/x/checkpointing/keeper/grpc_query_checkpoint_test.go b/x/checkpointing/keeper/grpc_query_checkpoint_test.go index 6f6f08e54..39a029973 100644 --- a/x/checkpointing/keeper/grpc_query_checkpoint_test.go +++ b/x/checkpointing/keeper/grpc_query_checkpoint_test.go @@ -2,32 +2,36 @@ package keeper_test import ( "context" - "github.com/babylonchain/babylon/x/checkpointing/keeper" - "github.com/cosmos/cosmos-sdk/types/query" "math/rand" "testing" + "github.com/cosmos/cosmos-sdk/types/query" + + "github.com/babylonchain/babylon/x/checkpointing/keeper" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/golang/mock/gomock" + "github.com/babylonchain/babylon/testutil/mocks" "github.com/babylonchain/babylon/x/checkpointing/types" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/golang/mock/gomock" - "github.com/babylonchain/babylon/testutil/datagen" - testkeeper "github.com/babylonchain/babylon/testutil/keeper" "github.com/cosmos/cosmos-sdk/client" "github.com/stretchr/testify/require" + + "github.com/babylonchain/babylon/testutil/datagen" + testkeeper "github.com/babylonchain/babylon/testutil/keeper" ) func FuzzQueryEpoch(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 1) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) ckptKeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, nil, nil, client.Context{}) sdkCtx := sdk.WrapSDKContext(ctx) // test querying a raw checkpoint with epoch number - mockCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta() + mockCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta(r) err := ckptKeeper.AddRawCheckpoint( ctx, mockCkptWithMeta, @@ -47,13 +51,46 @@ func FuzzQueryEpoch(f *testing.F) { }) } +func FuzzQueryRawCheckpoints(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 10) + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + ckptKeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, nil, nil, client.Context{}) + sdkCtx := sdk.WrapSDKContext(ctx) + + // add a random number of checkpoints + checkpoints := datagen.GenRandomSequenceRawCheckpointsWithMeta(r) + for _, ckpt := range checkpoints { + err := ckptKeeper.AddRawCheckpoint( + ctx, + ckpt, + ) + require.NoError(t, err) + } + + // test querying raw checkpoints with epoch range in pagination params + startEpoch := checkpoints[0].Ckpt.EpochNum + endEpoch := checkpoints[len(checkpoints)-1].Ckpt.EpochNum + pageLimit := endEpoch - startEpoch + 1 + + pagination := &query.PageRequest{Key: types.CkptsObjectKey(startEpoch), Limit: pageLimit} + ckptResp, err := ckptKeeper.RawCheckpoints(sdkCtx, &types.QueryRawCheckpointsRequest{Pagination: pagination}) + require.NoError(t, err) + require.Equal(t, int(pageLimit), len(ckptResp.RawCheckpoints)) + require.Nil(t, ckptResp.Pagination.NextKey) + for i, ckpt := range ckptResp.RawCheckpoints { + require.Equal(t, checkpoints[i], ckpt) + } + }) +} + func FuzzQueryStatusCount(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 1) + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // test querying recent epoch counts with each status in recent epochs - checkpoints := datagen.GenRandomSequenceRawCheckpointsWithMeta() + checkpoints := datagen.GenRandomSequenceRawCheckpointsWithMeta(r) tipEpoch := checkpoints[len(checkpoints)-1].Ckpt.EpochNum ctrl := gomock.NewController(t) defer ctrl.Finish() @@ -62,7 +99,7 @@ func FuzzQueryStatusCount(f *testing.F) { ckptKeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, ek, nil, client.Context{}) sdkCtx := sdk.WrapSDKContext(ctx) expectedCounts := make(map[string]uint64) - epochCount := uint64(rand.Int63n(int64(tipEpoch))) + epochCount := uint64(r.Int63n(int64(tipEpoch))) for e, ckpt := range checkpoints { err := ckptKeeper.AddRawCheckpoint( ctx, @@ -89,17 +126,17 @@ func FuzzQueryStatusCount(f *testing.F) { func FuzzQueryLastCheckpointWithStatus(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // test querying recent epoch counts with each status in recent epochs - tipEpoch := datagen.RandomInt(100) + 10 + tipEpoch := datagen.RandomInt(r, 100) + 10 ctrl := gomock.NewController(t) defer ctrl.Finish() ek := mocks.NewMockEpochingKeeper(ctrl) ek.EXPECT().GetEpoch(gomock.Any()).Return(&epochingtypes.Epoch{EpochNumber: tipEpoch}).AnyTimes() ckptKeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, ek, nil, client.Context{}) - checkpoints := datagen.GenSequenceRawCheckpointsWithMeta(tipEpoch) - finalizedEpoch := datagen.RandomInt(int(tipEpoch)) + checkpoints := datagen.GenSequenceRawCheckpointsWithMeta(r, tipEpoch) + finalizedEpoch := datagen.RandomInt(r, int(tipEpoch)) for e := uint64(0); e < tipEpoch; e++ { if e <= finalizedEpoch { checkpoints[int(e)].Status = types.Finalized @@ -129,20 +166,20 @@ func FuzzQueryLastCheckpointWithStatus(f *testing.F) { }) } -//func TestQueryRawCheckpointList(t *testing.T) { +// func TestQueryRawCheckpointList(t *testing.T) { func FuzzQueryRawCheckpointList(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) - tipEpoch := datagen.RandomInt(10) + 10 + tipEpoch := datagen.RandomInt(r, 10) + 10 ctrl := gomock.NewController(t) defer ctrl.Finish() ek := mocks.NewMockEpochingKeeper(ctrl) ek.EXPECT().GetEpoch(gomock.Any()).Return(&epochingtypes.Epoch{EpochNumber: tipEpoch}).AnyTimes() ckptKeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, ek, nil, client.Context{}) - checkpoints := datagen.GenSequenceRawCheckpointsWithMeta(tipEpoch) - finalizedEpoch := datagen.RandomInt(int(tipEpoch)) + checkpoints := datagen.GenSequenceRawCheckpointsWithMeta(r, tipEpoch) + finalizedEpoch := datagen.RandomInt(r, int(tipEpoch)) // add Sealed and Finalized checkpoints for e := uint64(0); e <= tipEpoch; e++ { @@ -156,21 +193,22 @@ func FuzzQueryRawCheckpointList(f *testing.F) { } finalizedCheckpoints := checkpoints[:finalizedEpoch+1] - testRawCheckpointListWithType(t, ckptKeeper, ctx, finalizedCheckpoints, 0, types.Finalized) + testRawCheckpointListWithType(t, r, ckptKeeper, ctx, finalizedCheckpoints, 0, types.Finalized) sealedCheckpoints := checkpoints[finalizedEpoch+1:] - testRawCheckpointListWithType(t, ckptKeeper, ctx, sealedCheckpoints, finalizedEpoch+1, types.Sealed) + testRawCheckpointListWithType(t, r, ckptKeeper, ctx, sealedCheckpoints, finalizedEpoch+1, types.Sealed) }) } func testRawCheckpointListWithType( t *testing.T, + r *rand.Rand, ckptKeeper *keeper.Keeper, ctx context.Context, checkpointList []*types.RawCheckpointWithMeta, baseEpoch uint64, status types.CheckpointStatus, ) { - limit := datagen.RandomInt(len(checkpointList)+1) + 1 + limit := datagen.RandomInt(r, len(checkpointList)+1) + 1 pagination := &query.PageRequest{Limit: limit, CountTotal: true} req := types.NewQueryRawCheckpointListRequest(pagination, status) diff --git a/x/checkpointing/keeper/grpc_query_params.go b/x/checkpointing/keeper/grpc_query_params.go deleted file mode 100644 index 85bcc8f55..000000000 --- a/x/checkpointing/keeper/grpc_query_params.go +++ /dev/null @@ -1,26 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/babylonchain/babylon/x/checkpointing/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper -type Querier struct { - Keeper -} - -var _ types.QueryServer = Querier{} - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/checkpointing/keeper/keeper.go b/x/checkpointing/keeper/keeper.go index 69c0e0647..1de85b530 100644 --- a/x/checkpointing/keeper/keeper.go +++ b/x/checkpointing/keeper/keeper.go @@ -3,17 +3,18 @@ package keeper import ( "errors" "fmt" + txformat "github.com/babylonchain/babylon/btctxformatter" - "github.com/babylonchain/babylon/crypto/bls12381" - "github.com/babylonchain/babylon/x/checkpointing/types" - epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/libs/log" + + "github.com/babylonchain/babylon/crypto/bls12381" + "github.com/babylonchain/babylon/x/checkpointing/types" + epochingtypes "github.com/babylonchain/babylon/x/epoching/types" ) type ( @@ -24,7 +25,6 @@ type ( blsSigner BlsSigner epochingKeeper types.EpochingKeeper hooks types.CheckpointingHooks - paramstore paramtypes.Subspace clientCtx client.Context } ) @@ -35,21 +35,14 @@ func NewKeeper( memKey storetypes.StoreKey, signer BlsSigner, ek types.EpochingKeeper, - ps paramtypes.Subspace, clientCtx client.Context, ) Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, blsSigner: signer, epochingKeeper: ek, - paramstore: ps, hooks: nil, clientCtx: clientCtx, } @@ -105,13 +98,13 @@ func (k Keeper) addBlsSig(ctx sdk.Context, sig *types.BlsSig) error { } // verify BLS sig - msgBytes := append(sdk.Uint64ToBigEndian(sig.GetEpochNum()), *sig.LastCommitHash...) - ok, err := bls12381.Verify(*sig.BlsSig, signerBlsKey, msgBytes) + signBytes := types.GetSignBytes(sig.GetEpochNum(), *sig.LastCommitHash) + ok, err := bls12381.Verify(*sig.BlsSig, signerBlsKey, signBytes) if err != nil { return err } if !ok { - return errors.New("BLS signature does not match the public key") + return types.ErrInvalidBlsSignature } // accumulate BLS signatures @@ -136,7 +129,7 @@ func (k Keeper) addBlsSig(ctx sdk.Context, sig *types.BlsSig) error { // if reaching this line, it means ckptWithMeta is updated, // and we need to write the updated ckptWithMeta back to KVStore - if err := k.UpdateCheckpoint(ctx, ckptWithMeta); err != nil { + if err = k.UpdateCheckpoint(ctx, ckptWithMeta); err != nil { return err } @@ -236,7 +229,7 @@ func (k Keeper) verifyCkptBytes(ctx sdk.Context, rawCheckpoint *txformat.RawBtcC if sum <= totalPower*1/3 { return nil, types.ErrInvalidRawCheckpoint.Wrap("insufficient voting power") } - msgBytes := append(sdk.Uint64ToBigEndian(ckpt.GetEpochNum()), *ckpt.LastCommitHash...) + msgBytes := types.GetSignBytes(ckpt.GetEpochNum(), *ckpt.LastCommitHash) ok, err := bls12381.VerifyMultiSig(*ckpt.BlsMultiSig, signersPubKeys, msgBytes) if err != nil { return nil, err diff --git a/x/checkpointing/keeper/keeper_test.go b/x/checkpointing/keeper/keeper_test.go index 37eebec6d..84c3ec822 100644 --- a/x/checkpointing/keeper/keeper_test.go +++ b/x/checkpointing/keeper/keeper_test.go @@ -4,18 +4,20 @@ import ( "math/rand" "testing" - "github.com/babylonchain/babylon/btctxformatter" - "github.com/babylonchain/babylon/crypto/bls12381" "github.com/boljen/go-bitmap" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/babylonchain/babylon/btctxformatter" + "github.com/babylonchain/babylon/crypto/bls12381" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/babylonchain/babylon/testutil/datagen" testkeeper "github.com/babylonchain/babylon/testutil/keeper" "github.com/babylonchain/babylon/testutil/mocks" "github.com/babylonchain/babylon/x/checkpointing/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" ) // FuzzKeeperAddRawCheckpoint checks @@ -25,7 +27,7 @@ import ( func FuzzKeeperAddRawCheckpoint(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 1) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) ckptKeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, nil, nil, client.Context{}) // test nil raw checkpoint @@ -33,7 +35,7 @@ func FuzzKeeperAddRawCheckpoint(f *testing.F) { require.Errorf(t, err, "add a nil raw checkpoint") // test random raw checkpoint - mockCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta() + mockCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta(r) ckpt, err := ckptKeeper.GetRawCheckpoint(ctx, mockCkptWithMeta.Ckpt.EpochNum) require.Nil(t, ckpt) require.Errorf(t, err, "raw checkpoint does not exist") @@ -51,7 +53,7 @@ func FuzzKeeperAddRawCheckpoint(f *testing.F) { _, err = ckptKeeper.BuildRawCheckpoint( ctx, mockCkptWithMeta.Ckpt.EpochNum, - datagen.GenRandomLastCommitHash(), + datagen.GenRandomLastCommitHash(r), ) require.Errorf(t, err, "raw checkpoint with the same epoch already exists") }) @@ -62,7 +64,7 @@ func FuzzKeeperAddRawCheckpoint(f *testing.F) { func FuzzKeeperSetCheckpointStatus(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 1) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) ctrl := gomock.NewController(t) defer ctrl.Finish() @@ -70,7 +72,7 @@ func FuzzKeeperSetCheckpointStatus(f *testing.F) { ckptKeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, ek, nil, client.Context{}) /* new accumulating checkpoint*/ - mockCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta() + mockCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta(r) mockCkptWithMeta.Status = types.Accumulating mockCkptWithMeta.RecordStateUpdate(ctx, types.Accumulating) epoch := mockCkptWithMeta.Ckpt.EpochNum @@ -96,7 +98,7 @@ func FuzzKeeperSetCheckpointStatus(f *testing.F) { require.Equal(t, curStateUpdate(ctx, types.Accumulating), mockCkptWithMeta.Lifecycle[0]) /* Accumulating -> Sealed */ - ctx = updateRandomCtx(ctx) + ctx = updateRandomCtx(r, ctx) mockCkptWithMeta.Status = types.Sealed mockCkptWithMeta.RecordStateUpdate(ctx, types.Sealed) err = ckptKeeper.UpdateCheckpoint(ctx, mockCkptWithMeta) @@ -112,7 +114,7 @@ func FuzzKeeperSetCheckpointStatus(f *testing.F) { require.Equal(t, curStateUpdate(ctx, types.Sealed), mockCkptWithMeta.Lifecycle[1]) /* Sealed -> Submitted */ - ctx = updateRandomCtx(ctx) + ctx = updateRandomCtx(r, ctx) ckptKeeper.SetCheckpointSubmitted(ctx, epoch) // ensure status is updated status, err = ckptKeeper.GetStatus(ctx, epoch) @@ -125,7 +127,7 @@ func FuzzKeeperSetCheckpointStatus(f *testing.F) { require.Equal(t, curStateUpdate(ctx, types.Submitted), mockCkptWithMeta.Lifecycle[2]) /* Submitted -> Confirmed */ - ctx = updateRandomCtx(ctx) + ctx = updateRandomCtx(r, ctx) ckptKeeper.SetCheckpointConfirmed(ctx, epoch) // ensure status is updated status, err = ckptKeeper.GetStatus(ctx, epoch) @@ -138,7 +140,7 @@ func FuzzKeeperSetCheckpointStatus(f *testing.F) { require.Equal(t, curStateUpdate(ctx, types.Confirmed), mockCkptWithMeta.Lifecycle[3]) /* Confirmed -> Finalized */ - ctx = updateRandomCtx(ctx) + ctx = updateRandomCtx(r, ctx) ckptKeeper.SetCheckpointFinalized(ctx, epoch) // ensure status is updated status, err = ckptKeeper.GetStatus(ctx, epoch) @@ -159,7 +161,7 @@ func FuzzKeeperSetCheckpointStatus(f *testing.F) { func FuzzKeeperCheckpointEpoch(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 1) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) ctrl := gomock.NewController(t) defer ctrl.Finish() @@ -175,11 +177,11 @@ func FuzzKeeperCheckpointEpoch(f *testing.F) { // add local checkpoint, signed by the first validator bm := bitmap.New(types.BitmapBits) bm.Set(0, true) - localCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta() + localCkptWithMeta := datagen.GenRandomRawCheckpointWithMeta(r) localCkptWithMeta.Status = types.Sealed localCkptWithMeta.PowerSum = 10 localCkptWithMeta.Ckpt.Bitmap = bm - msgBytes := append(sdk.Uint64ToBigEndian(localCkptWithMeta.Ckpt.EpochNum), *localCkptWithMeta.Ckpt.LastCommitHash...) + msgBytes := types.GetSignBytes(localCkptWithMeta.Ckpt.EpochNum, *localCkptWithMeta.Ckpt.LastCommitHash) sig := bls12381.Sign(blsPrivKey1, msgBytes) localCkptWithMeta.Ckpt.BlsMultiSig = &sig _ = ckptKeeper.AddRawCheckpoint( @@ -189,6 +191,7 @@ func FuzzKeeperCheckpointEpoch(f *testing.F) { // 1. check valid checkpoint rawBtcCheckpoint := makeBtcCkptBytes( + r, localCkptWithMeta.Ckpt.EpochNum, localCkptWithMeta.Ckpt.LastCommitHash.MustMarshal(), localCkptWithMeta.Ckpt.Bitmap, @@ -201,19 +204,21 @@ func FuzzKeeperCheckpointEpoch(f *testing.F) { // 2. check a checkpoint with invalid sig rawBtcCheckpoint = makeBtcCkptBytes( + r, localCkptWithMeta.Ckpt.EpochNum, localCkptWithMeta.Ckpt.LastCommitHash.MustMarshal(), localCkptWithMeta.Ckpt.Bitmap, - datagen.GenRandomByteArray(btctxformatter.BlsSigLength), + datagen.GenRandomByteArray(r, btctxformatter.BlsSigLength), t, ) err = ckptKeeper.VerifyCheckpoint(ctx, *rawBtcCheckpoint) require.ErrorIs(t, err, types.ErrInvalidRawCheckpoint) // 3. check a conflicting checkpoint; signed on a random lastcommithash - conflictLastCommitHash := datagen.GenRandomByteArray(btctxformatter.LastCommitHashLength) - msgBytes = append(sdk.Uint64ToBigEndian(localCkptWithMeta.Ckpt.EpochNum), conflictLastCommitHash...) + conflictLastCommitHash := datagen.GenRandomByteArray(r, btctxformatter.LastCommitHashLength) + msgBytes = types.GetSignBytes(localCkptWithMeta.Ckpt.EpochNum, conflictLastCommitHash) rawBtcCheckpoint = makeBtcCkptBytes( + r, localCkptWithMeta.Ckpt.EpochNum, conflictLastCommitHash, localCkptWithMeta.Ckpt.Bitmap, @@ -221,15 +226,15 @@ func FuzzKeeperCheckpointEpoch(f *testing.F) { t, ) require.Panics(t, func() { - _ = ckptKeeper.VerifyCheckpoint(ctx, *rawBtcCheckpoint) + _ = ckptKeeper.VerifyCheckpoint(ctx, *rawBtcCheckpoint) }) }) } -func makeBtcCkptBytes(epoch uint64, lch []byte, bitmap []byte, blsSig []byte, t *testing.T) *btctxformatter.RawBtcCheckpoint { - tag := datagen.GenRandomByteArray(btctxformatter.TagLength) +func makeBtcCkptBytes(r *rand.Rand, epoch uint64, lch []byte, bitmap []byte, blsSig []byte, t *testing.T) *btctxformatter.RawBtcCheckpoint { + tag := datagen.GenRandomByteArray(r, btctxformatter.TagLength) babylonTag := btctxformatter.BabylonTag(tag[:btctxformatter.TagLength]) - address := datagen.GenRandomByteArray(btctxformatter.AddressLength) + address := datagen.GenRandomByteArray(r, btctxformatter.AddressLength) rawBTCCkpt := &btctxformatter.RawBtcCheckpoint{ Epoch: epoch, @@ -266,7 +271,7 @@ func curStateUpdate(ctx sdk.Context, status types.CheckpointStatus) *types.Check } } -func updateRandomCtx(ctx sdk.Context) sdk.Context { - header := datagen.GenRandomTMHeader("test", datagen.RandomInt(1000)) +func updateRandomCtx(r *rand.Rand, ctx sdk.Context) sdk.Context { + header := datagen.GenRandomTMHeader(r, "test", datagen.RandomInt(r, 1000)) return ctx.WithBlockHeader(*header) } diff --git a/x/checkpointing/keeper/msg_server.go b/x/checkpointing/keeper/msg_server.go index 15e0a446e..70baa36a5 100644 --- a/x/checkpointing/keeper/msg_server.go +++ b/x/checkpointing/keeper/msg_server.go @@ -2,9 +2,12 @@ package keeper import ( "context" - epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + "github.com/babylonchain/babylon/x/checkpointing/types" ) @@ -24,6 +27,8 @@ var _ types.MsgServer = msgServer{} func (m msgServer) AddBlsSig(goCtx context.Context, msg *types.MsgAddBlsSig) (*types.MsgAddBlsSigResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + ctx.Logger().Info(fmt.Sprintf("received BLS sig for epoch %d from %s", msg.BlsSig.EpochNum, msg.GetSigners())) + err := m.k.addBlsSig(ctx, msg.BlsSig) if err != nil { return nil, err @@ -38,6 +43,11 @@ func (m msgServer) AddBlsSig(goCtx context.Context, msg *types.MsgAddBlsSig) (*t func (m msgServer) WrappedCreateValidator(goCtx context.Context, msg *types.MsgWrappedCreateValidator) (*types.MsgWrappedCreateValidatorResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) + // stateless checks on the inside `MsgCreateValidator` msg + if err := m.k.epochingKeeper.CheckMsgCreateValidator(ctx, msg.MsgCreateValidator); err != nil { + return nil, err + } + valAddr, err := sdk.ValAddressFromBech32(msg.MsgCreateValidator.ValidatorAddress) if err != nil { return nil, err diff --git a/x/checkpointing/keeper/msg_server_test.go b/x/checkpointing/keeper/msg_server_test.go index 786b93a1a..cf68639f3 100644 --- a/x/checkpointing/keeper/msg_server_test.go +++ b/x/checkpointing/keeper/msg_server_test.go @@ -5,6 +5,12 @@ import ( "testing" "cosmossdk.io/math" + "github.com/cometbft/cometbft/crypto/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" + "github.com/babylonchain/babylon/app" appparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/crypto/bls12381" @@ -13,11 +19,7 @@ import ( checkpointingkeeper "github.com/babylonchain/babylon/x/checkpointing/keeper" "github.com/babylonchain/babylon/x/checkpointing/types" "github.com/babylonchain/babylon/x/epoching/testepoching" - "github.com/cosmos/cosmos-sdk/crypto/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/ed25519" + epochingtypes "github.com/babylonchain/babylon/x/epoching/types" ) // FuzzWrappedCreateValidator_InsufficientTokens tests adding new validators with zero voting power @@ -27,7 +29,7 @@ func FuzzWrappedCreateValidator_InsufficientTokens(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 4) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // a genesis validator is generate for setup helper := testepoching.NewHelper(t) @@ -36,11 +38,11 @@ func FuzzWrappedCreateValidator_InsufficientTokens(f *testing.F) { msgServer := checkpointingkeeper.NewMsgServerImpl(ck) // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := ek.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) - n := rand.Intn(3) + 1 + n := r.Intn(3) + 1 addrs := app.AddTestAddrs(helper.App, helper.Ctx, n, sdk.NewInt(100000000)) // add n new validators with zero voting power via MsgWrappedCreateValidator @@ -62,7 +64,7 @@ func FuzzWrappedCreateValidator_InsufficientTokens(f *testing.F) { // go to BeginBlock of block 11, and thus entering epoch 2 for i := uint64(0); i < ek.GetParams(ctx).EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = ek.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) @@ -96,6 +98,43 @@ func FuzzWrappedCreateValidator_InsufficientTokens(f *testing.F) { }) } +// FuzzWrappedCreateValidator_InsufficientBalance tests adding a new validator +// but the delegator has insufficient balance to perform delegating +func FuzzWrappedCreateValidator_InsufficientBalance(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 4) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + + // a genesis validator is generate for setup + helper := testepoching.NewHelper(t) + ek := helper.EpochingKeeper + ck := helper.App.CheckpointingKeeper + msgServer := checkpointingkeeper.NewMsgServerImpl(ck) + + // BeginBlock of block 1, and thus entering epoch 1 + ctx := helper.BeginBlock(r) + epoch := ek.GetEpoch(ctx) + require.Equal(t, uint64(1), epoch.EpochNumber) + + n := r.Intn(3) + 1 + balance := r.Int63n(100) + addrs := app.AddTestAddrs(helper.App, helper.Ctx, n, sdk.NewInt(balance)) + + // add n new validators with value more than the delegator balance via MsgWrappedCreateValidator + wcvMsgs := make([]*types.MsgWrappedCreateValidator, n) + for i := 0; i < n; i++ { + // make sure the value is more than the balance + value := sdk.NewInt(balance).Add(sdk.NewInt(r.Int63n(100))) + msg, err := buildMsgWrappedCreateValidatorWithAmount(addrs[i], value) + require.NoError(t, err) + wcvMsgs[i] = msg + _, err = msgServer.WrappedCreateValidator(ctx, msg) + require.ErrorIs(t, err, epochingtypes.ErrInsufficientBalance) + } + }) +} + // FuzzWrappedCreateValidator tests adding new validators via // MsgWrappedCreateValidator, which first registers BLS pubkey // and then unwrapped into MsgCreateValidator and enqueued into @@ -105,7 +144,7 @@ func FuzzWrappedCreateValidator(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 4) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // a genesis validator is generate for setup helper := testepoching.NewHelper(t) @@ -114,12 +153,12 @@ func FuzzWrappedCreateValidator(f *testing.F) { msgServer := checkpointingkeeper.NewMsgServerImpl(ck) // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := ek.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) // add n new validators via MsgWrappedCreateValidator - n := rand.Intn(3) + n := r.Intn(3) addrs := app.AddTestAddrs(helper.App, helper.Ctx, n, sdk.NewInt(100000000)) wcvMsgs := make([]*types.MsgWrappedCreateValidator, n) @@ -140,7 +179,7 @@ func FuzzWrappedCreateValidator(f *testing.F) { // go to BeginBlock of block 11, and thus entering epoch 2 for i := uint64(0); i < ek.GetParams(ctx).EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = ek.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) @@ -163,57 +202,216 @@ func FuzzWrappedCreateValidator(f *testing.F) { }) } -func TestInvalidLastCommitHash(t *testing.T) { - helper := testepoching.NewHelperWithValSet(t) - ck := helper.App.CheckpointingKeeper - msgServer := checkpointingkeeper.NewMsgServerImpl(ck) - // needed to init total voting power - helper.BeginBlock() - - epoch := uint64(1) - validLch := datagen.GenRandomByteArray(32) - // correct checkpoint for epoch 1 - _, err := ck.BuildRawCheckpoint(helper.Ctx, epoch, validLch) - require.NoError(t, err) - - // Malicious validator created message with valid bls signature but for invalid - // commit hash - invalidLch := datagen.GenRandomByteArray(32) - val0Info := helper.ValBlsPrivKeys[0] - signBytes := append(sdk.Uint64ToBigEndian(epoch), invalidLch...) - sig := bls12381.Sign(val0Info.BlsKey, signBytes) - msg := types.NewMsgAddBlsSig(epoch, invalidLch, sig, val0Info.Address) - - _, err = msgServer.AddBlsSig(helper.Ctx, msg) - require.ErrorIs(t, err, types.ErrInvalidLastCommitHash) +// FuzzAddBlsSig_NoError tests adding BLS signatures via MsgAddBlsSig +// it covers the following scenarios that would not cause errors: +// 1. a BLS signature is successfully accumulated and the checkpoint remains ACCUMULATING +// 2. a BLS signature is successfully accumulated and the checkpoint is changed to SEALED +// 3. a BLS signature is rejected if the checkpoint is not ACCUMULATING +func FuzzAddBlsSig_NoError(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 4) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + + helper := testepoching.NewHelperWithValSet(t) + ek := helper.EpochingKeeper + ck := helper.App.CheckpointingKeeper + msgServer := checkpointingkeeper.NewMsgServerImpl(ck) + + // BeginBlock of block 1, and thus entering epoch 1 + ctx := helper.BeginBlock(r) + epoch := ek.GetEpoch(ctx) + require.Equal(t, uint64(1), epoch.EpochNumber) + + // apply 2 blocks to ensure that a raw checkpoint for the previous epoch is built + for i := uint64(0); i < 2; i++ { + ctx = helper.GenAndApplyEmptyBlock(r) + } + endingEpoch := ek.GetEpoch(ctx).EpochNumber - 1 + _, err := ck.GetRawCheckpoint(ctx, endingEpoch) + require.NoError(t, err) + + // add BLS signatures + n := len(helper.ValBlsPrivKeys) + totalPower := uint64(ck.GetTotalVotingPower(ctx, endingEpoch)) + for i := 0; i < n; i++ { + lch := ctx.BlockHeader().LastCommitHash + blsPrivKey := helper.ValBlsPrivKeys[i].BlsKey + addr := helper.ValBlsPrivKeys[i].Address + signBytes := types.GetSignBytes(endingEpoch, lch) + blsSig := bls12381.Sign(blsPrivKey, signBytes) + + // create MsgAddBlsSig message + msg := types.NewMsgAddBlsSig(sdk.AccAddress(addr), endingEpoch, lch, blsSig, addr) + _, err = msgServer.AddBlsSig(ctx, msg) + require.NoError(t, err) + afterCkpt, err := ck.GetRawCheckpoint(ctx, endingEpoch) + require.NoError(t, err) + if afterCkpt.PowerSum <= totalPower/3 { + require.True(t, afterCkpt.Status == types.Accumulating) + } else { + require.True(t, afterCkpt.Status == types.Sealed) + } + } + }) } -func buildMsgWrappedCreateValidator(addr sdk.AccAddress) (*types.MsgWrappedCreateValidator, error) { - tmValPrivkey := ed25519.GenPrivKey() - bondTokens := sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) - bondCoin := sdk.NewCoin(appparams.DefaultBondDenom, bondTokens) - description := stakingtypes.NewDescription("foo_moniker", "", "", "", "") - commission := stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) +// FuzzAddBlsSig_Error tests adding BLS signatures via MsgAddBlsSig +// in a scenario where the signer is not in the checkpoint's validator set +func FuzzAddBlsSig_NotInValSet(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 4) - pk, err := codec.FromTmPubKeyInterface(tmValPrivkey.PubKey()) - if err != nil { - return nil, err - } + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) - createValidatorMsg, err := stakingtypes.NewMsgCreateValidator( - sdk.ValAddress(addr), pk, bondCoin, description, commission, sdk.OneInt(), - ) - if err != nil { - return nil, err - } - blsPrivKey := bls12381.GenPrivKey() - pop, err := privval.BuildPoP(tmValPrivkey, blsPrivKey) - if err != nil { - return nil, err - } - blsPubKey := blsPrivKey.PubKey() + helper := testepoching.NewHelperWithValSet(t) + ek := helper.EpochingKeeper + ck := helper.App.CheckpointingKeeper + msgServer := checkpointingkeeper.NewMsgServerImpl(ck) - return types.NewMsgWrappedCreateValidator(createValidatorMsg, &blsPubKey, pop) + // BeginBlock of block 1, and thus entering epoch 1 + ctx := helper.BeginBlock(r) + // apply 2 blocks to ensure that a raw checkpoint for the previous epoch is built + for i := uint64(0); i < 2; i++ { + ctx = helper.GenAndApplyEmptyBlock(r) + } + endingEpoch := ek.GetEpoch(ctx).EpochNumber - 1 + _, err := ck.GetRawCheckpoint(ctx, endingEpoch) + require.NoError(t, err) + + // build BLS sig from a random validator (not in the validator set) + lch := ctx.BlockHeader().LastCommitHash + blsPrivKey := bls12381.GenPrivKey() + valAddr := datagen.GenRandomValidatorAddress() + signBytes := types.GetSignBytes(endingEpoch, lch) + blsSig := bls12381.Sign(blsPrivKey, signBytes) + msg := types.NewMsgAddBlsSig(sdk.AccAddress(valAddr), endingEpoch, lch, blsSig, valAddr) + + _, err = msgServer.AddBlsSig(ctx, msg) + require.Error(t, err, types.ErrCkptDoesNotExist) + }) +} + +// FuzzAddBlsSig_CkptNotExist tests adding BLS signatures via MsgAddBlsSig +// in a scenario where the corresponding checkpoint does not exist +func FuzzAddBlsSig_CkptNotExist(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 4) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + + helper := testepoching.NewHelperWithValSet(t) + ek := helper.EpochingKeeper + ck := helper.App.CheckpointingKeeper + msgServer := checkpointingkeeper.NewMsgServerImpl(ck) + + // BeginBlock of block 1, and thus entering epoch 1 + ctx := helper.BeginBlock(r) + epoch := ek.GetEpoch(ctx) + require.Equal(t, uint64(1), epoch.EpochNumber) + + // build BLS signature from a random validator of the validator set + n := len(helper.ValBlsPrivKeys) + i := r.Intn(n) + lch := ctx.BlockHeader().LastCommitHash + blsPrivKey := helper.ValBlsPrivKeys[i].BlsKey + addr := helper.ValBlsPrivKeys[i].Address + signBytes := types.GetSignBytes(epoch.EpochNumber-1, lch) + blsSig := bls12381.Sign(blsPrivKey, signBytes) + msg := types.NewMsgAddBlsSig(sdk.AccAddress(addr), epoch.EpochNumber-1, lch, blsSig, addr) + + // add the BLS signature + _, err := msgServer.AddBlsSig(ctx, msg) + require.Error(t, err, types.ErrCkptDoesNotExist) + }) +} + +// FuzzAddBlsSig_WrongLastCommitHash tests adding BLS signatures via MsgAddBlsSig +// in a scenario where the signature is signed over wrong last_commit_hash +// 4. a BLS signature is rejected if the signature is invalid +func FuzzAddBlsSig_WrongLastCommitHash(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 4) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + + helper := testepoching.NewHelperWithValSet(t) + ek := helper.EpochingKeeper + ck := helper.App.CheckpointingKeeper + msgServer := checkpointingkeeper.NewMsgServerImpl(ck) + + // BeginBlock of block 1, and thus entering epoch 1 + ctx := helper.BeginBlock(r) + epoch := ek.GetEpoch(ctx) + require.Equal(t, uint64(1), epoch.EpochNumber) + // apply 2 blocks to ensure that a raw checkpoint for the previous epoch is built + for i := uint64(0); i < 2; i++ { + ctx = helper.GenAndApplyEmptyBlock(r) + } + endingEpoch := ek.GetEpoch(ctx).EpochNumber - 1 + _, err := ck.GetRawCheckpoint(ctx, endingEpoch) + require.NoError(t, err) + + // build BLS sig from a random validator + n := len(helper.ValBlsPrivKeys) + i := r.Intn(n) + // inject random last commit hash + lch := datagen.GenRandomLastCommitHash(r) + blsPrivKey := helper.ValBlsPrivKeys[i].BlsKey + addr := helper.ValBlsPrivKeys[i].Address + signBytes := types.GetSignBytes(endingEpoch, lch) + blsSig := bls12381.Sign(blsPrivKey, signBytes) + msg := types.NewMsgAddBlsSig(sdk.AccAddress(addr), endingEpoch, lch, blsSig, addr) + + // add the BLS signature + _, err = msgServer.AddBlsSig(ctx, msg) + require.Error(t, err, types.ErrInvalidLastCommitHash) + }) +} + +// FuzzAddBlsSig_InvalidSignature tests adding BLS signatures via MsgAddBlsSig +// in a scenario where the signature is invalid +func FuzzAddBlsSig_InvalidSignature(f *testing.F) { + datagen.AddRandomSeedsToFuzzer(f, 4) + + f.Fuzz(func(t *testing.T, seed int64) { + r := rand.New(rand.NewSource(seed)) + + helper := testepoching.NewHelperWithValSet(t) + ek := helper.EpochingKeeper + ck := helper.App.CheckpointingKeeper + msgServer := checkpointingkeeper.NewMsgServerImpl(ck) + + // BeginBlock of block 1, and thus entering epoch 1 + ctx := helper.BeginBlock(r) + epoch := ek.GetEpoch(ctx) + require.Equal(t, uint64(1), epoch.EpochNumber) + // apply 2 blocks to ensure that a raw checkpoint for the previous epoch is built + for i := uint64(0); i < 2; i++ { + ctx = helper.GenAndApplyEmptyBlock(r) + } + endingEpoch := ek.GetEpoch(ctx).EpochNumber - 1 + _, err := ck.GetRawCheckpoint(ctx, endingEpoch) + require.NoError(t, err) + + // build BLS sig from a random validator + n := len(helper.ValBlsPrivKeys) + i := r.Intn(n) + // inject random last commit hash + lch := ctx.BlockHeader().LastCommitHash + addr := helper.ValBlsPrivKeys[i].Address + blsSig := datagen.GenRandomBlsMultiSig(r) + msg := types.NewMsgAddBlsSig(sdk.AccAddress(addr), endingEpoch, lch, blsSig, addr) + + // add the BLS signature message + _, err = msgServer.AddBlsSig(ctx, msg) + require.Error(t, err, types.ErrInvalidBlsSignature) + }) +} + +func buildMsgWrappedCreateValidator(addr sdk.AccAddress) (*types.MsgWrappedCreateValidator, error) { + bondTokens := sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) + return buildMsgWrappedCreateValidatorWithAmount(addr, bondTokens) } func buildMsgWrappedCreateValidatorWithAmount(addr sdk.AccAddress, bondTokens math.Int) (*types.MsgWrappedCreateValidator, error) { diff --git a/x/checkpointing/keeper/params.go b/x/checkpointing/keeper/params.go deleted file mode 100644 index 489692a8b..000000000 --- a/x/checkpointing/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - "github.com/babylonchain/babylon/x/checkpointing/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/checkpointing/keeper/val_bls_set_test.go b/x/checkpointing/keeper/val_bls_set_test.go index 4d36f074f..13aaa7939 100644 --- a/x/checkpointing/keeper/val_bls_set_test.go +++ b/x/checkpointing/keeper/val_bls_set_test.go @@ -17,21 +17,20 @@ import ( func FuzzGetValidatorBlsKeySet(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // a genesis validator is generated for setup helper := testepoching.NewHelper(t) ek := helper.EpochingKeeper ck := helper.App.CheckpointingKeeper - querier := checkpointingkeeper.Querier{Keeper: ck} queryHelper := baseapp.NewQueryServerTestHelper(helper.Ctx, helper.App.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, querier) + types.RegisterQueryServer(queryHelper, ck) msgServer := checkpointingkeeper.NewMsgServerImpl(ck) genesisVal := ek.GetValidatorSet(helper.Ctx, 0)[0] genesisBLSPubkey, err := ck.GetBlsPubKey(helper.Ctx, genesisVal.Addr) require.NoError(t, err) // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := ek.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) @@ -42,7 +41,7 @@ func FuzzGetValidatorBlsKeySet(f *testing.F) { require.Equal(t, uint64(genesisVal.Power), valBlsSet.ValSet[0].VotingPower) // add n new validators via MsgWrappedCreateValidator - n := rand.Intn(10) + 1 + n := r.Intn(10) + 1 addrs := app.AddTestAddrs(helper.App, helper.Ctx, n, sdk.NewInt(100000000)) wcvMsgs := make([]*types.MsgWrappedCreateValidator, n) @@ -59,7 +58,7 @@ func FuzzGetValidatorBlsKeySet(f *testing.F) { // go to BeginBlock of block 11, and thus entering epoch 2 for i := uint64(0); i < ek.GetParams(ctx).EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = ek.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) diff --git a/x/checkpointing/module.go b/x/checkpointing/module.go index 9531c2c3e..3e9db023e 100644 --- a/x/checkpointing/module.go +++ b/x/checkpointing/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/babylonchain/babylon/x/checkpointing/client/cli" "github.com/babylonchain/babylon/x/checkpointing/keeper" @@ -123,19 +123,9 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the capability module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} - // QuerierRoute returns the capability module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// LegacyQuerierHandler returns the capability module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { @@ -165,7 +155,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { diff --git a/x/checkpointing/module_simulation.go b/x/checkpointing/module_simulation.go index 932686a2a..db476aa0d 100644 --- a/x/checkpointing/module_simulation.go +++ b/x/checkpointing/module_simulation.go @@ -1,13 +1,11 @@ package checkpointing import ( - "math/rand" - + simappparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/testutil/sample" checkpointingsimulation "github.com/babylonchain/babylon/x/checkpointing/simulation" "github.com/babylonchain/babylon/x/checkpointing/types" "github.com/cosmos/cosmos-sdk/baseapp" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -31,23 +29,15 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { for i, acc := range simState.Accounts { accs[i] = acc.Address.String() } - headeroracleGenesis := types.GenesisState{ - Params: types.DefaultParams(), - } + headeroracleGenesis := types.GenesisState{} simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&headeroracleGenesis) } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } -// RandomizedParams creates randomized param changes for the simulator -func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} diff --git a/x/checkpointing/testckpt/helper.go b/x/checkpointing/testckpt/helper.go index b30e68b24..9f57a1311 100644 --- a/x/checkpointing/testckpt/helper.go +++ b/x/checkpointing/testckpt/helper.go @@ -10,16 +10,16 @@ import ( "github.com/babylonchain/babylon/testutil/datagen" "github.com/babylonchain/babylon/x/checkpointing/keeper" "github.com/babylonchain/babylon/x/checkpointing/types" - "github.com/babylonchain/babylon/x/epoching" epochingkeeper "github.com/babylonchain/babylon/x/epoching/keeper" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + proto "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) // Helper is a structure which wraps the entire app and exposes functionalities for testing the epoching module @@ -46,9 +46,8 @@ func NewHelper(t *testing.T, n int) *Helper { checkpointingKeeper := app.CheckpointingKeeper epochingKeeper := app.EpochingKeeper stakingKeeper := app.StakingKeeper - querier := keeper.Querier{Keeper: checkpointingKeeper} queryHelper := baseapp.NewQueryServerTestHelper(ctx, app.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, querier) + types.RegisterQueryServer(queryHelper, checkpointingKeeper) queryClient := types.NewQueryClient(queryHelper) msgSrvr := keeper.NewMsgServerImpl(checkpointingKeeper) @@ -59,7 +58,7 @@ func NewHelper(t *testing.T, n int) *Helper { CheckpointingKeeper: &checkpointingKeeper, MsgSrvr: msgSrvr, QueryClient: queryClient, - StakingKeeper: &stakingKeeper, + StakingKeeper: stakingKeeper, EpochingKeeper: &epochingKeeper, GenAccs: accs, } @@ -90,22 +89,18 @@ func (h *Helper) CreateValidatorMsg(addr sdk.ValAddress, pk cryptotypes.PubKey, } func (h *Helper) createValidator(addr sdk.ValAddress, pk cryptotypes.PubKey, blsPK *bls12381.PublicKey, pop *types.ProofOfPossession, coin sdk.Coin, ok bool) { - msg := h.CreateValidatorMsg(addr, pk, blsPK, pop, coin.Amount) - h.Handle(msg, ok) + h.Handle(func(ctx sdk.Context) (proto.Message, error) { + return h.CreateValidatorMsg(addr, pk, blsPK, pop, coin.Amount), nil + }) } -// Handle calls epoching handler on a given message -func (h *Helper) Handle(msg sdk.Msg, ok bool) *sdk.Result { - handler := epoching.NewHandler(*h.EpochingKeeper) - res, err := handler(h.Ctx, msg) - if ok { - require.NoError(h.t, err) - require.NotNil(h.t, res) - } else { - require.Error(h.t, err) - require.Nil(h.t, res) - } - return res +// Handle executes an action function with the Helper's context, wraps the result into an SDK service result, and performs two assertions before returning it +func (h *Helper) Handle(action func(sdk.Context) (proto.Message, error)) *sdk.Result { + res, err := action(h.Ctx) + r, _ := sdk.WrapServiceResult(h.Ctx, res, err) + require.NotNil(h.t, r) + require.NoError(h.t, err) + return r } // ZeroCommission constructs a commission rates with all zeros. diff --git a/x/checkpointing/types/bls_key.pb.go b/x/checkpointing/types/bls_key.pb.go index b3addcff0..d42efd40d 100644 --- a/x/checkpointing/types/bls_key.pb.go +++ b/x/checkpointing/types/bls_key.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/checkpointing/bls_key.proto +// source: babylon/checkpointing/v1/bls_key.proto package types import ( fmt "fmt" github_com_babylonchain_babylon_crypto_bls12381 "github.com/babylonchain/babylon/crypto/bls12381" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -36,7 +36,7 @@ func (m *BlsKey) Reset() { *m = BlsKey{} } func (m *BlsKey) String() string { return proto.CompactTextString(m) } func (*BlsKey) ProtoMessage() {} func (*BlsKey) Descriptor() ([]byte, []int) { - return fileDescriptor_a7e926461cc70111, []int{0} + return fileDescriptor_3a8c0d37ce63f038, []int{0} } func (m *BlsKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -72,11 +72,14 @@ func (m *BlsKey) GetPop() *ProofOfPossession { return nil } -// ProofOfPossession defines proof for the ownership of Ed25519 and BLS private keys +// ProofOfPossession defines proof for the ownership of Ed25519 and BLS private +// keys type ProofOfPossession struct { - // ed25519_sig is used for verification, ed25519_sig = sign(key = Ed25519_sk, data = BLS_pk) + // ed25519_sig is used for verification, ed25519_sig = sign(key = Ed25519_sk, + // data = BLS_pk) Ed25519Sig []byte `protobuf:"bytes,2,opt,name=ed25519_sig,json=ed25519Sig,proto3" json:"ed25519_sig,omitempty"` - // bls_sig is the result of PoP, bls_sig = sign(key = BLS_sk, data = ed25519_sig) + // bls_sig is the result of PoP, bls_sig = sign(key = BLS_sk, data = + // ed25519_sig) BlsSig *github_com_babylonchain_babylon_crypto_bls12381.Signature `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3,customtype=github.com/babylonchain/babylon/crypto/bls12381.Signature" json:"bls_sig,omitempty"` } @@ -84,7 +87,7 @@ func (m *ProofOfPossession) Reset() { *m = ProofOfPossession{} } func (m *ProofOfPossession) String() string { return proto.CompactTextString(m) } func (*ProofOfPossession) ProtoMessage() {} func (*ProofOfPossession) Descriptor() ([]byte, []int) { - return fileDescriptor_a7e926461cc70111, []int{1} + return fileDescriptor_3a8c0d37ce63f038, []int{1} } func (m *ProofOfPossession) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -129,7 +132,7 @@ func (m *ValidatorWithBlsKeySet) Reset() { *m = ValidatorWithBlsKeySet{} func (m *ValidatorWithBlsKeySet) String() string { return proto.CompactTextString(m) } func (*ValidatorWithBlsKeySet) ProtoMessage() {} func (*ValidatorWithBlsKeySet) Descriptor() ([]byte, []int) { - return fileDescriptor_a7e926461cc70111, []int{2} + return fileDescriptor_3a8c0d37ce63f038, []int{2} } func (m *ValidatorWithBlsKeySet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -165,7 +168,8 @@ func (m *ValidatorWithBlsKeySet) GetValSet() []*ValidatorWithBlsKey { return nil } -// ValidatorWithBlsKey couples validator address, voting power, and its bls public key +// ValidatorWithBlsKey couples validator address, voting power, and its bls +// public key type ValidatorWithBlsKey struct { ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` BlsPubKey []byte `protobuf:"bytes,2,opt,name=bls_pub_key,json=blsPubKey,proto3" json:"bls_pub_key,omitempty"` @@ -176,7 +180,7 @@ func (m *ValidatorWithBlsKey) Reset() { *m = ValidatorWithBlsKey{} } func (m *ValidatorWithBlsKey) String() string { return proto.CompactTextString(m) } func (*ValidatorWithBlsKey) ProtoMessage() {} func (*ValidatorWithBlsKey) Descriptor() ([]byte, []int) { - return fileDescriptor_a7e926461cc70111, []int{3} + return fileDescriptor_3a8c0d37ce63f038, []int{3} } func (m *ValidatorWithBlsKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -234,38 +238,39 @@ func init() { } func init() { - proto.RegisterFile("babylon/checkpointing/bls_key.proto", fileDescriptor_a7e926461cc70111) + proto.RegisterFile("babylon/checkpointing/v1/bls_key.proto", fileDescriptor_3a8c0d37ce63f038) } -var fileDescriptor_a7e926461cc70111 = []byte{ - // 430 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x31, 0x6f, 0xd3, 0x40, - 0x18, 0xcd, 0x11, 0xe4, 0xaa, 0xe7, 0x0e, 0xd4, 0x20, 0x64, 0x31, 0xb8, 0x21, 0x2c, 0x91, 0x2a, - 0x6c, 0x25, 0x55, 0x24, 0x3a, 0x74, 0x20, 0x03, 0x4b, 0x87, 0x5a, 0x67, 0x51, 0x24, 0x16, 0x73, - 0xe7, 0x5c, 0x2f, 0xa7, 0x1c, 0xfe, 0x4e, 0xbe, 0xb3, 0xc1, 0x3f, 0x80, 0x8d, 0x81, 0x5f, 0xc0, - 0xef, 0x61, 0xec, 0x88, 0x18, 0x10, 0x4a, 0xfe, 0x08, 0xba, 0x38, 0x44, 0x02, 0x5a, 0x21, 0xb1, - 0x59, 0xef, 0x3d, 0x3f, 0xbd, 0xf7, 0xee, 0xc3, 0x4f, 0x18, 0x65, 0xad, 0x82, 0x32, 0x29, 0x16, - 0xbc, 0x58, 0x6a, 0x90, 0xa5, 0x95, 0xa5, 0x48, 0x98, 0x32, 0xf9, 0x92, 0xb7, 0xb1, 0xae, 0xc0, - 0x42, 0x10, 0x6e, 0x45, 0xf1, 0x6f, 0xa2, 0xb8, 0x19, 0x3f, 0x7a, 0x20, 0x40, 0xc0, 0x46, 0x94, - 0xb8, 0xaf, 0x4e, 0x3f, 0xfc, 0x8c, 0xb0, 0x37, 0x53, 0xe6, 0x9c, 0xb7, 0xc1, 0x4b, 0xec, 0xe9, - 0x9a, 0x2d, 0x79, 0x1b, 0xde, 0x19, 0xa0, 0xd1, 0xc1, 0xec, 0xec, 0xdb, 0xf7, 0xa3, 0x53, 0x21, - 0xed, 0xa2, 0x66, 0x71, 0x01, 0x6f, 0x93, 0xad, 0x73, 0xb1, 0xa0, 0xb2, 0x4c, 0x76, 0x59, 0xaa, - 0x56, 0x5b, 0x70, 0x21, 0xc6, 0x93, 0x93, 0x67, 0xe3, 0x38, 0xad, 0x99, 0x92, 0xc5, 0x39, 0x6f, - 0xc9, 0xd6, 0x2c, 0x38, 0xc3, 0x7d, 0x0d, 0x3a, 0xec, 0x0f, 0xd0, 0xc8, 0x9f, 0x1c, 0xc7, 0xb7, - 0xe5, 0x8b, 0xd3, 0x0a, 0xe0, 0xea, 0xe2, 0x2a, 0x05, 0x63, 0xb8, 0x31, 0x12, 0x4a, 0xe2, 0xfe, - 0x1b, 0x7e, 0x44, 0xf8, 0xf0, 0x2f, 0x2a, 0x38, 0xc2, 0x3e, 0x9f, 0x4f, 0xa6, 0xd3, 0xf1, 0x69, - 0x6e, 0xa4, 0xe8, 0x02, 0x13, 0xbc, 0x85, 0x32, 0x29, 0x82, 0x4b, 0xbc, 0xe7, 0x86, 0x71, 0x64, - 0xff, 0xff, 0xdb, 0x64, 0x52, 0x94, 0xd4, 0xd6, 0x15, 0x27, 0x1e, 0x53, 0x26, 0x93, 0x62, 0xf8, - 0x06, 0x3f, 0xbc, 0xa4, 0x4a, 0xce, 0xa9, 0x85, 0xea, 0x95, 0xb4, 0x8b, 0x6e, 0xbb, 0x8c, 0xdb, - 0xe0, 0x05, 0xde, 0x6b, 0xa8, 0xca, 0x0d, 0xb7, 0x21, 0x1a, 0xf4, 0x47, 0xfe, 0xe4, 0xe9, 0xed, - 0x5d, 0x6f, 0xb0, 0x20, 0x5e, 0x43, 0x55, 0xc6, 0xed, 0xf0, 0x03, 0xc2, 0xf7, 0x6f, 0xe0, 0x83, - 0x63, 0x7c, 0xd8, 0xfc, 0x82, 0x73, 0x3a, 0x9f, 0x57, 0xdc, 0x98, 0x10, 0x0d, 0xd0, 0x68, 0x9f, - 0xdc, 0xdb, 0x11, 0xcf, 0x3b, 0x3c, 0x88, 0xb0, 0xef, 0xea, 0xeb, 0x9a, 0xe5, 0xbb, 0x07, 0x25, - 0xfb, 0x4c, 0x99, 0xb4, 0x66, 0xce, 0xec, 0x31, 0x3e, 0x68, 0xc0, 0xa5, 0xc9, 0x35, 0xbc, 0xe3, - 0xd5, 0x66, 0xa3, 0xbb, 0xc4, 0xef, 0xb0, 0xd4, 0x41, 0xb3, 0x8b, 0x2f, 0xab, 0x08, 0x5d, 0xaf, - 0x22, 0xf4, 0x63, 0x15, 0xa1, 0x4f, 0xeb, 0xa8, 0x77, 0xbd, 0x8e, 0x7a, 0x5f, 0xd7, 0x51, 0xef, - 0xf5, 0xf4, 0x5f, 0x33, 0xbe, 0xff, 0xe3, 0x44, 0x6d, 0xab, 0xb9, 0x61, 0xde, 0xe6, 0xe2, 0x4e, - 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe5, 0xcd, 0xcb, 0x00, 0xc8, 0x02, 0x00, 0x00, +var fileDescriptor_3a8c0d37ce63f038 = []byte{ + // 433 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x52, 0x41, 0x6b, 0xd4, 0x40, + 0x18, 0xdd, 0x71, 0x25, 0xa5, 0x93, 0x1e, 0x6c, 0x14, 0x09, 0x1e, 0xd2, 0x75, 0x0f, 0xb2, 0x50, + 0x4c, 0xc8, 0x96, 0x05, 0x7b, 0xe8, 0xc1, 0x3d, 0x78, 0xe9, 0xa1, 0x21, 0xc1, 0x0a, 0x5e, 0xe2, + 0x4c, 0x76, 0x3a, 0x3b, 0xec, 0x98, 0x6f, 0xc8, 0x4c, 0xa2, 0xf9, 0x01, 0xde, 0x3c, 0xf8, 0x0b, + 0xfc, 0x3d, 0x1e, 0x7b, 0x14, 0x0f, 0x22, 0xbb, 0x7f, 0x44, 0x66, 0x13, 0x17, 0xd4, 0x16, 0xc1, + 0x5b, 0x78, 0xef, 0xe5, 0xf1, 0xde, 0x9b, 0x0f, 0x3f, 0xa1, 0x84, 0xb6, 0x12, 0xca, 0xa8, 0x58, + 0xb2, 0x62, 0xa5, 0x40, 0x94, 0x46, 0x94, 0x3c, 0x6a, 0xe2, 0x88, 0x4a, 0x9d, 0xaf, 0x58, 0x1b, + 0xaa, 0x0a, 0x0c, 0x78, 0x7e, 0xaf, 0x0b, 0x7f, 0xd3, 0x85, 0x4d, 0xfc, 0xe8, 0x01, 0x07, 0x0e, + 0x5b, 0x51, 0x64, 0xbf, 0x3a, 0xfd, 0xf8, 0x33, 0xc2, 0xce, 0x5c, 0xea, 0x73, 0xd6, 0x7a, 0x2f, + 0xb1, 0xa3, 0x6a, 0xba, 0x62, 0xad, 0x7f, 0x67, 0x84, 0x26, 0x07, 0xf3, 0xb3, 0x6f, 0xdf, 0x8f, + 0x4e, 0xb9, 0x30, 0xcb, 0x9a, 0x86, 0x05, 0xbc, 0x8d, 0x7a, 0xe7, 0x62, 0x49, 0x44, 0x19, 0xed, + 0xe2, 0x54, 0xad, 0x32, 0x60, 0x43, 0xc4, 0xd3, 0x93, 0x67, 0x71, 0x98, 0xd4, 0x54, 0x8a, 0xe2, + 0x9c, 0xb5, 0x69, 0x6f, 0xe6, 0x9d, 0xe1, 0xa1, 0x02, 0xe5, 0x0f, 0x47, 0x68, 0xe2, 0x4e, 0x8f, + 0xc3, 0xdb, 0xf2, 0x85, 0x49, 0x05, 0x70, 0x75, 0x71, 0x95, 0x80, 0xd6, 0x4c, 0x6b, 0x01, 0x65, + 0x6a, 0xff, 0x1b, 0x7f, 0x44, 0xf8, 0xf0, 0x2f, 0xca, 0x3b, 0xc2, 0x2e, 0x5b, 0x4c, 0x67, 0xb3, + 0xf8, 0x34, 0xd7, 0x82, 0x77, 0x81, 0x53, 0xdc, 0x43, 0x99, 0xe0, 0xde, 0x25, 0xde, 0xb3, 0xc3, + 0x58, 0x72, 0xf8, 0xff, 0x6d, 0x32, 0xc1, 0x4b, 0x62, 0xea, 0x8a, 0xa5, 0x0e, 0x95, 0x3a, 0x13, + 0x7c, 0xfc, 0x06, 0x3f, 0xbc, 0x24, 0x52, 0x2c, 0x88, 0x81, 0xea, 0x95, 0x30, 0xcb, 0x6e, 0xbb, + 0x8c, 0x19, 0xef, 0x05, 0xde, 0x6b, 0x88, 0xcc, 0x35, 0x33, 0x3e, 0x1a, 0x0d, 0x27, 0xee, 0xf4, + 0xe9, 0xed, 0x5d, 0x6f, 0xb0, 0x48, 0x9d, 0x86, 0xc8, 0x8c, 0x99, 0xf1, 0x07, 0x84, 0xef, 0xdf, + 0xc0, 0x7b, 0xc7, 0xf8, 0xb0, 0xf9, 0x05, 0xe7, 0x64, 0xb1, 0xa8, 0x98, 0xd6, 0x3e, 0x1a, 0xa1, + 0xc9, 0x7e, 0x7a, 0x6f, 0x47, 0x3c, 0xef, 0x70, 0x2f, 0xc0, 0xae, 0xad, 0xaf, 0x6a, 0x9a, 0xef, + 0x1e, 0x34, 0xdd, 0xa7, 0x52, 0x27, 0x35, 0xb5, 0x66, 0x8f, 0xf1, 0x41, 0x03, 0x36, 0x4d, 0xae, + 0xe0, 0x1d, 0xab, 0xb6, 0x1b, 0xdd, 0x4d, 0xdd, 0x0e, 0x4b, 0x2c, 0x34, 0xbf, 0xf8, 0xb2, 0x0e, + 0xd0, 0xf5, 0x3a, 0x40, 0x3f, 0xd6, 0x01, 0xfa, 0xb4, 0x09, 0x06, 0xd7, 0x9b, 0x60, 0xf0, 0x75, + 0x13, 0x0c, 0x5e, 0xcf, 0xfe, 0x35, 0xe3, 0xfb, 0x3f, 0xae, 0xd4, 0xb4, 0x8a, 0x69, 0xea, 0x6c, + 0x2f, 0xee, 0xe4, 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb8, 0x90, 0xb1, 0x5b, 0xcb, 0x02, 0x00, + 0x00, } func (m *BlsKey) Marshal() (dAtA []byte, err error) { diff --git a/x/checkpointing/types/checkpoint.pb.go b/x/checkpointing/types/checkpoint.pb.go index 7754a8e5b..587a53aaa 100644 --- a/x/checkpointing/types/checkpoint.pb.go +++ b/x/checkpointing/types/checkpoint.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/checkpointing/checkpoint.proto +// source: babylon/checkpointing/v1/checkpoint.proto package types @@ -7,10 +7,9 @@ import ( bytes "bytes" fmt "fmt" github_com_babylonchain_babylon_crypto_bls12381 "github.com/babylonchain/babylon/crypto/bls12381" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" @@ -30,7 +29,7 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// CkptStatus is the status of a checkpoint. +// CheckpointStatus is the status of a checkpoint. type CheckpointStatus int32 const ( @@ -67,18 +66,20 @@ func (x CheckpointStatus) String() string { } func (CheckpointStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{0} + return fileDescriptor_73996df9c6aabde4, []int{0} } // RawCheckpoint wraps the BLS multi sig with meta data type RawCheckpoint struct { // epoch_num defines the epoch number the raw checkpoint is for EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - // last_commit_hash defines the 'LastCommitHash' that individual BLS sigs are signed on + // last_commit_hash defines the 'LastCommitHash' that individual BLS sigs are + // signed on LastCommitHash *LastCommitHash `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3,customtype=LastCommitHash" json:"last_commit_hash,omitempty"` // bitmap defines the bitmap that indicates the signers of the BLS multi sig Bitmap []byte `protobuf:"bytes,3,opt,name=bitmap,proto3" json:"bitmap,omitempty"` - // bls_multi_sig defines the multi sig that is aggregated from individual BLS sigs + // bls_multi_sig defines the multi sig that is aggregated from individual BLS + // sigs BlsMultiSig *github_com_babylonchain_babylon_crypto_bls12381.Signature `protobuf:"bytes,4,opt,name=bls_multi_sig,json=blsMultiSig,proto3,customtype=github.com/babylonchain/babylon/crypto/bls12381.Signature" json:"bls_multi_sig,omitempty"` } @@ -86,7 +87,7 @@ func (m *RawCheckpoint) Reset() { *m = RawCheckpoint{} } func (m *RawCheckpoint) String() string { return proto.CompactTextString(m) } func (*RawCheckpoint) ProtoMessage() {} func (*RawCheckpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{0} + return fileDescriptor_73996df9c6aabde4, []int{0} } func (m *RawCheckpoint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -138,8 +139,9 @@ type RawCheckpointWithMeta struct { BlsAggrPk *github_com_babylonchain_babylon_crypto_bls12381.PublicKey `protobuf:"bytes,3,opt,name=bls_aggr_pk,json=blsAggrPk,proto3,customtype=github.com/babylonchain/babylon/crypto/bls12381.PublicKey" json:"bls_aggr_pk,omitempty"` // power_sum defines the accumulated voting power for the checkpoint PowerSum uint64 `protobuf:"varint,4,opt,name=power_sum,json=powerSum,proto3" json:"power_sum,omitempty"` - // lifecycle defines the lifecycle of this checkpoint, i.e., each state transition and - // the time (in both timestamp and block height) of this transition. + // lifecycle defines the lifecycle of this checkpoint, i.e., each state + // transition and the time (in both timestamp and block height) of this + // transition. Lifecycle []*CheckpointStateUpdate `protobuf:"bytes,5,rep,name=lifecycle,proto3" json:"lifecycle,omitempty"` } @@ -147,7 +149,7 @@ func (m *RawCheckpointWithMeta) Reset() { *m = RawCheckpointWithMeta{} } func (m *RawCheckpointWithMeta) String() string { return proto.CompactTextString(m) } func (*RawCheckpointWithMeta) ProtoMessage() {} func (*RawCheckpointWithMeta) Descriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{1} + return fileDescriptor_73996df9c6aabde4, []int{1} } func (m *RawCheckpointWithMeta) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -204,12 +206,15 @@ func (m *RawCheckpointWithMeta) GetLifecycle() []*CheckpointStateUpdate { return nil } +// CheckpointStateUpdate defines a state transition on the checkpoint. type CheckpointStateUpdate struct { // state defines the event of a state transition towards this state State CheckpointStatus `protobuf:"varint,1,opt,name=state,proto3,enum=babylon.checkpointing.v1.CheckpointStatus" json:"state,omitempty"` - // block_height is the height of the Babylon block that triggers the state update + // block_height is the height of the Babylon block that triggers the state + // update BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` - // block_time is the timestamp in the Babylon block that triggers the state update + // block_time is the timestamp in the Babylon block that triggers the state + // update BlockTime *time.Time `protobuf:"bytes,3,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time,omitempty"` } @@ -217,7 +222,7 @@ func (m *CheckpointStateUpdate) Reset() { *m = CheckpointStateUpdate{} } func (m *CheckpointStateUpdate) String() string { return proto.CompactTextString(m) } func (*CheckpointStateUpdate) ProtoMessage() {} func (*CheckpointStateUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{2} + return fileDescriptor_73996df9c6aabde4, []int{2} } func (m *CheckpointStateUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -274,9 +279,10 @@ type BlsSig struct { // last_commit_hash defines the 'LastCommitHash' that the BLS sig is signed on LastCommitHash *LastCommitHash `protobuf:"bytes,2,opt,name=last_commit_hash,json=lastCommitHash,proto3,customtype=LastCommitHash" json:"last_commit_hash,omitempty"` BlsSig *github_com_babylonchain_babylon_crypto_bls12381.Signature `protobuf:"bytes,3,opt,name=bls_sig,json=blsSig,proto3,customtype=github.com/babylonchain/babylon/crypto/bls12381.Signature" json:"bls_sig,omitempty"` - // can't find cosmos_proto.scalar when compiling due to cosmos v0.45.4 does not support scalar - // string signer_address = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // the signer_address defines the address of the signer + // can't find cosmos_proto.scalar when compiling due to cosmos v0.45.4 does + // not support scalar string signer_address = 4 [(cosmos_proto.scalar) = + // "cosmos.AddressString"]; the signer_address defines the address of the + // signer SignerAddress string `protobuf:"bytes,4,opt,name=signer_address,json=signerAddress,proto3" json:"signer_address,omitempty"` } @@ -284,7 +290,7 @@ func (m *BlsSig) Reset() { *m = BlsSig{} } func (m *BlsSig) String() string { return proto.CompactTextString(m) } func (*BlsSig) ProtoMessage() {} func (*BlsSig) Descriptor() ([]byte, []int) { - return fileDescriptor_63ff05f0a47b36f7, []int{3} + return fileDescriptor_73996df9c6aabde4, []int{3} } func (m *BlsSig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -336,60 +342,59 @@ func init() { } func init() { - proto.RegisterFile("babylon/checkpointing/checkpoint.proto", fileDescriptor_63ff05f0a47b36f7) + proto.RegisterFile("babylon/checkpointing/v1/checkpoint.proto", fileDescriptor_73996df9c6aabde4) } -var fileDescriptor_63ff05f0a47b36f7 = []byte{ - // 773 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xdb, 0x8e, 0xdb, 0x44, - 0x18, 0xc7, 0xe3, 0x5d, 0x37, 0x34, 0xb3, 0x07, 0x59, 0x23, 0x16, 0x85, 0x20, 0x25, 0x61, 0x25, - 0x20, 0xea, 0x85, 0xad, 0x4d, 0x85, 0xc4, 0x51, 0xe0, 0x1c, 0x96, 0x46, 0x4d, 0xd2, 0x95, 0x9d, - 0x80, 0x54, 0x09, 0x59, 0xe3, 0xc9, 0xec, 0x78, 0x94, 0xb1, 0xc7, 0xf2, 0x8c, 0x29, 0xe1, 0x09, - 0xd0, 0x5e, 0xf5, 0x05, 0x56, 0x42, 0xe2, 0x51, 0xb8, 0xe1, 0xb2, 0x97, 0xa8, 0x17, 0x05, 0xed, - 0xde, 0x14, 0x78, 0x09, 0xe4, 0x71, 0x7a, 0x48, 0xcb, 0x8a, 0x83, 0xe0, 0x2e, 0xdf, 0xdf, 0xff, - 0xff, 0xc4, 0xdf, 0xef, 0x9b, 0xcf, 0xe0, 0xed, 0x10, 0x85, 0x2b, 0x2e, 0x12, 0x07, 0x47, 0x04, - 0x2f, 0x53, 0xc1, 0x12, 0xc5, 0x12, 0xfa, 0x5c, 0x65, 0xa7, 0x99, 0x50, 0x02, 0xd6, 0xd7, 0x3e, - 0x7b, 0xc3, 0x67, 0x7f, 0x75, 0xd4, 0x68, 0x51, 0x21, 0x28, 0x27, 0x8e, 0xf6, 0x85, 0xf9, 0xa9, - 0xa3, 0x58, 0x4c, 0xa4, 0x42, 0x71, 0x5a, 0x46, 0x1b, 0xaf, 0x63, 0x21, 0x63, 0x21, 0x03, 0x5d, - 0x39, 0x65, 0xb1, 0x7e, 0xf4, 0x2a, 0x15, 0x54, 0x94, 0x7a, 0xf1, 0xab, 0x54, 0x0f, 0x7f, 0x37, - 0xc0, 0x9e, 0x87, 0xee, 0xf5, 0x9f, 0xfe, 0x13, 0x7c, 0x03, 0xd4, 0x48, 0x2a, 0x70, 0x14, 0x24, - 0x79, 0x5c, 0x37, 0xda, 0x46, 0xc7, 0xf4, 0xae, 0x6b, 0x61, 0x9a, 0xc7, 0xf0, 0x23, 0x60, 0x71, - 0x24, 0x55, 0x80, 0x45, 0x1c, 0x33, 0x15, 0x44, 0x48, 0x46, 0xf5, 0xad, 0xb6, 0xd1, 0xd9, 0xed, - 0xc1, 0x87, 0x8f, 0x5a, 0xfb, 0x63, 0x24, 0x55, 0x5f, 0x3f, 0xba, 0x85, 0x64, 0xe4, 0xed, 0xf3, - 0x8d, 0x1a, 0xbe, 0x06, 0xaa, 0x21, 0x53, 0x31, 0x4a, 0xeb, 0xdb, 0x45, 0xc6, 0x5b, 0x57, 0x10, - 0x81, 0xbd, 0x90, 0xcb, 0x20, 0xce, 0xb9, 0x62, 0x81, 0x64, 0xb4, 0x6e, 0xea, 0x23, 0x3f, 0x7e, - 0xf8, 0xa8, 0xf5, 0x3e, 0x65, 0x2a, 0xca, 0x43, 0x1b, 0x8b, 0xd8, 0x59, 0x63, 0xc1, 0x11, 0x62, - 0x89, 0xf3, 0x94, 0x65, 0xb6, 0x4a, 0x95, 0x70, 0x42, 0x2e, 0x8f, 0xba, 0x37, 0xdf, 0x3b, 0xb2, - 0x7d, 0x46, 0x13, 0xa4, 0xf2, 0x8c, 0x78, 0x3b, 0x21, 0x97, 0x93, 0xe2, 0x48, 0x9f, 0xd1, 0x0f, - 0xcc, 0xc7, 0xdf, 0xb5, 0x8c, 0xc3, 0x5f, 0xb7, 0xc0, 0xc1, 0x46, 0xb7, 0x5f, 0x30, 0x15, 0x4d, - 0x88, 0x42, 0xf0, 0x43, 0x60, 0xe2, 0x65, 0xaa, 0x74, 0xc3, 0x3b, 0xdd, 0x77, 0xec, 0xab, 0x46, - 0x60, 0x6f, 0xc4, 0x3d, 0x1d, 0x82, 0x3d, 0x50, 0x95, 0x0a, 0xa9, 0x5c, 0x6a, 0x16, 0xfb, 0xdd, - 0x1b, 0x57, 0xc7, 0x9f, 0x65, 0x7d, 0x9d, 0xf0, 0xd6, 0x49, 0xf8, 0x25, 0x28, 0xde, 0x37, 0x40, - 0x94, 0x66, 0x41, 0xba, 0x2c, 0x01, 0xfd, 0x3b, 0x02, 0x27, 0x79, 0xc8, 0x19, 0xbe, 0x4d, 0x56, - 0x5e, 0x2d, 0xe4, 0xd2, 0xa5, 0x34, 0x3b, 0x59, 0x16, 0x53, 0x4d, 0xc5, 0x3d, 0x92, 0x05, 0x32, - 0x8f, 0x35, 0x5e, 0xd3, 0xbb, 0xae, 0x05, 0x3f, 0x8f, 0xe1, 0x04, 0xd4, 0x38, 0x3b, 0x25, 0x78, - 0x85, 0x39, 0xa9, 0x5f, 0x6b, 0x6f, 0x77, 0x76, 0xba, 0xce, 0xdf, 0x6d, 0x81, 0xcc, 0xd3, 0x05, - 0x52, 0xc4, 0x7b, 0x76, 0xc2, 0x9a, 0xf5, 0x0f, 0x06, 0x38, 0xf8, 0x53, 0x2b, 0xfc, 0x14, 0x5c, - 0x2b, 0x9a, 0x26, 0x1a, 0xf6, 0x3f, 0xa3, 0x55, 0x06, 0xe1, 0x9b, 0x60, 0x37, 0xe4, 0x02, 0x2f, - 0x83, 0x88, 0x30, 0x1a, 0x29, 0x8d, 0xdd, 0x2c, 0x06, 0x2e, 0xf0, 0xf2, 0x96, 0x96, 0xe0, 0x27, - 0x00, 0x94, 0x96, 0x62, 0x45, 0x34, 0xce, 0x9d, 0x6e, 0xc3, 0x2e, 0xf7, 0xc7, 0x7e, 0xb2, 0x3f, - 0xf6, 0xec, 0xc9, 0xfe, 0xf4, 0xcc, 0xfb, 0x3f, 0xb7, 0x8c, 0x82, 0x98, 0xc0, 0xcb, 0x42, 0x5d, - 0x77, 0xf1, 0xd8, 0x00, 0xd5, 0x1e, 0x97, 0x3e, 0xa3, 0xff, 0xe7, 0x62, 0x7c, 0x0e, 0x5e, 0x29, - 0x86, 0x5f, 0x5c, 0xfd, 0xed, 0xff, 0xe2, 0xea, 0x57, 0xc3, 0xf2, 0x95, 0xdf, 0x02, 0xfb, 0x92, - 0xd1, 0x84, 0x64, 0x01, 0x5a, 0x2c, 0x32, 0x22, 0xa5, 0x1e, 0x7d, 0xcd, 0xdb, 0x2b, 0x55, 0xb7, - 0x14, 0x75, 0xab, 0x95, 0x1b, 0xbf, 0x19, 0xc0, 0x7a, 0x11, 0x38, 0xb4, 0x41, 0xbd, 0x7f, 0xfb, - 0x64, 0x16, 0xf8, 0x33, 0x77, 0x36, 0xf7, 0x03, 0xb7, 0xdf, 0x9f, 0x4f, 0xe6, 0x63, 0x77, 0x36, - 0x9a, 0x7e, 0x66, 0x55, 0x1a, 0xd6, 0xd9, 0x79, 0x7b, 0xd7, 0xc5, 0x38, 0x8f, 0x73, 0x8e, 0x8a, - 0xa1, 0xc1, 0x43, 0x00, 0x9f, 0xf7, 0xfb, 0x43, 0x77, 0x3c, 0x1c, 0x58, 0x46, 0x03, 0x9c, 0x9d, - 0xb7, 0xab, 0x3e, 0x41, 0x9c, 0x2c, 0x60, 0x07, 0x1c, 0x6c, 0x78, 0xe6, 0xbd, 0xc9, 0x68, 0x36, - 0x1b, 0x0e, 0xac, 0xad, 0xc6, 0xde, 0xd9, 0x79, 0xbb, 0xe6, 0xe7, 0x61, 0xcc, 0x94, 0x7a, 0xd9, - 0xd9, 0xbf, 0x33, 0x3d, 0x1e, 0x79, 0x93, 0xe1, 0xc0, 0xda, 0x2e, 0x9d, 0x7d, 0x91, 0x9c, 0xb2, - 0x2c, 0x7e, 0xd9, 0x79, 0x3c, 0x9a, 0xba, 0xe3, 0xd1, 0xdd, 0xe1, 0xc0, 0x32, 0x4b, 0xe7, 0x31, - 0x4b, 0x10, 0x67, 0xdf, 0x90, 0x45, 0xc3, 0xfc, 0xf6, 0xfb, 0x66, 0xa5, 0x77, 0xe7, 0xc7, 0x8b, - 0xa6, 0xf1, 0xe0, 0xa2, 0x69, 0xfc, 0x72, 0xd1, 0x34, 0xee, 0x5f, 0x36, 0x2b, 0x0f, 0x2e, 0x9b, - 0x95, 0x9f, 0x2e, 0x9b, 0x95, 0xbb, 0xef, 0xfe, 0x15, 0xf6, 0xaf, 0x5f, 0xf8, 0x7e, 0xab, 0x55, - 0x4a, 0x64, 0x58, 0xd5, 0x77, 0xea, 0xe6, 0x1f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xf4, 0xd0, 0xbc, - 0xe5, 0xe5, 0x05, 0x00, 0x00, +var fileDescriptor_73996df9c6aabde4 = []byte{ + // 764 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x4d, 0x8b, 0xdb, 0x46, + 0x18, 0xc7, 0xad, 0x5d, 0xc5, 0x8d, 0xc7, 0x6b, 0x23, 0x86, 0x6e, 0x31, 0x2e, 0xd8, 0xee, 0x42, + 0xa9, 0x9b, 0x83, 0x84, 0x1d, 0x0a, 0x7d, 0xa5, 0x95, 0x5f, 0xb6, 0x31, 0xb1, 0x9d, 0x45, 0xb2, + 0x5b, 0x08, 0x14, 0x31, 0x92, 0x67, 0x47, 0x83, 0x47, 0x1a, 0xa1, 0x19, 0x25, 0x75, 0x3f, 0x41, + 0xd9, 0x53, 0xbe, 0xc0, 0x42, 0xa1, 0x1f, 0xa5, 0x97, 0x1e, 0x73, 0x2c, 0x39, 0xa4, 0x65, 0xf7, + 0x92, 0xb6, 0x5f, 0xa2, 0x68, 0xe4, 0xbc, 0x38, 0xe9, 0xd2, 0x17, 0xda, 0x9b, 0xe6, 0xef, 0xff, + 0xff, 0x61, 0x9e, 0xdf, 0x33, 0x8f, 0xc1, 0xbb, 0x3e, 0xf2, 0x37, 0x8c, 0xc7, 0x56, 0x10, 0xe2, + 0x60, 0x9d, 0x70, 0x1a, 0x4b, 0x1a, 0x13, 0xeb, 0x5e, 0xef, 0x05, 0xc1, 0x4c, 0x52, 0x2e, 0x39, + 0x6c, 0x6c, 0xad, 0xe6, 0x8e, 0xd5, 0xbc, 0xd7, 0x6b, 0xb6, 0x09, 0xe7, 0x84, 0x61, 0x4b, 0xf9, + 0xfc, 0xec, 0xd4, 0x92, 0x34, 0xc2, 0x42, 0xa2, 0x28, 0x29, 0xa2, 0xcd, 0xd7, 0x09, 0x27, 0x5c, + 0x7d, 0x5a, 0xf9, 0x57, 0xa1, 0x1e, 0xfd, 0xae, 0x81, 0x9a, 0x83, 0xee, 0x0f, 0x9f, 0x95, 0x83, + 0x6f, 0x82, 0x0a, 0x4e, 0x78, 0x10, 0x7a, 0x71, 0x16, 0x35, 0xb4, 0x8e, 0xd6, 0xd5, 0x9d, 0xeb, + 0x4a, 0x98, 0x67, 0x11, 0xfc, 0x18, 0x18, 0x0c, 0x09, 0xe9, 0x05, 0x3c, 0x8a, 0xa8, 0xf4, 0x42, + 0x24, 0xc2, 0xc6, 0x5e, 0x47, 0xeb, 0x1e, 0x0c, 0xe0, 0xa3, 0xc7, 0xed, 0xfa, 0x14, 0x09, 0x39, + 0x54, 0x3f, 0xdd, 0x42, 0x22, 0x74, 0xea, 0x6c, 0xe7, 0x0c, 0xdf, 0x00, 0x65, 0x9f, 0xca, 0x08, + 0x25, 0x8d, 0xfd, 0x3c, 0xe3, 0x6c, 0x4f, 0x10, 0x81, 0x9a, 0xcf, 0x84, 0x17, 0x65, 0x4c, 0x52, + 0x4f, 0x50, 0xd2, 0xd0, 0x55, 0xc9, 0x4f, 0x1e, 0x3d, 0x6e, 0x7f, 0x40, 0xa8, 0x0c, 0x33, 0xdf, + 0x0c, 0x78, 0x64, 0x6d, 0x7b, 0x0f, 0x42, 0x44, 0x63, 0xeb, 0x19, 0xb3, 0x74, 0x93, 0x48, 0x6e, + 0xf9, 0x4c, 0xf4, 0xfa, 0x37, 0xdf, 0xef, 0x99, 0x2e, 0x25, 0x31, 0x92, 0x59, 0x8a, 0x9d, 0xaa, + 0xcf, 0xc4, 0x2c, 0x2f, 0xe9, 0x52, 0xf2, 0xa1, 0xfe, 0xe4, 0xbb, 0xb6, 0x76, 0xf4, 0xeb, 0x1e, + 0x38, 0xdc, 0xe9, 0xf6, 0x4b, 0x2a, 0xc3, 0x19, 0x96, 0x08, 0x7e, 0x04, 0xf4, 0x60, 0x9d, 0x48, + 0xd5, 0x70, 0xb5, 0xff, 0x8e, 0x79, 0x15, 0x67, 0x73, 0x27, 0xee, 0xa8, 0x10, 0x1c, 0x80, 0xb2, + 0x90, 0x48, 0x66, 0x42, 0xb1, 0xa8, 0xf7, 0x6f, 0x5c, 0x1d, 0x7f, 0x9e, 0x75, 0x55, 0xc2, 0xd9, + 0x26, 0xe1, 0x57, 0x20, 0xbf, 0xaf, 0x87, 0x08, 0x49, 0xbd, 0x64, 0x5d, 0x00, 0xfa, 0x77, 0x04, + 0x4e, 0x32, 0x9f, 0xd1, 0xe0, 0x36, 0xde, 0x38, 0x15, 0x9f, 0x09, 0x9b, 0x90, 0xf4, 0x64, 0x9d, + 0x4f, 0x35, 0xe1, 0xf7, 0x71, 0xea, 0x89, 0x2c, 0x52, 0x78, 0x75, 0xe7, 0xba, 0x12, 0xdc, 0x2c, + 0x82, 0x33, 0x50, 0x61, 0xf4, 0x14, 0x07, 0x9b, 0x80, 0xe1, 0xc6, 0xb5, 0xce, 0x7e, 0xb7, 0xda, + 0xb7, 0xfe, 0x6e, 0x0b, 0x78, 0x99, 0xac, 0x90, 0xc4, 0xce, 0xf3, 0x0a, 0x5b, 0xd6, 0x3f, 0x68, + 0xe0, 0xf0, 0x4f, 0xad, 0xf0, 0x33, 0x70, 0x2d, 0x6f, 0x1a, 0x2b, 0xd8, 0xff, 0x8c, 0x56, 0x11, + 0x84, 0x6f, 0x81, 0x03, 0x9f, 0xf1, 0x60, 0xed, 0x85, 0x98, 0x92, 0x50, 0x2a, 0xec, 0x7a, 0x3e, + 0x70, 0x1e, 0xac, 0x6f, 0x29, 0x09, 0x7e, 0x0a, 0x40, 0x61, 0xc9, 0xf7, 0x40, 0xe1, 0xac, 0xf6, + 0x9b, 0x66, 0xb1, 0x24, 0xe6, 0xd3, 0x25, 0x31, 0x17, 0x4f, 0x97, 0x64, 0xa0, 0x3f, 0xf8, 0xb9, + 0xad, 0xe5, 0xc4, 0x78, 0xb0, 0xce, 0xd5, 0x6d, 0x17, 0x4f, 0x34, 0x50, 0x1e, 0x30, 0xe1, 0x52, + 0xf2, 0x7f, 0x2e, 0xc6, 0x17, 0xe0, 0xb5, 0x7c, 0xf8, 0xf9, 0xd3, 0xdf, 0xff, 0x2f, 0x9e, 0x7e, + 0xd9, 0x2f, 0xae, 0xfc, 0x36, 0xa8, 0x0b, 0x4a, 0x62, 0x9c, 0x7a, 0x68, 0xb5, 0x4a, 0xb1, 0x10, + 0x6a, 0xf4, 0x15, 0xa7, 0x56, 0xa8, 0x76, 0x21, 0xaa, 0x56, 0x4b, 0x37, 0x7e, 0xd3, 0x80, 0xf1, + 0x32, 0x70, 0x68, 0x82, 0xc6, 0xf0, 0xf6, 0xc9, 0xc2, 0x73, 0x17, 0xf6, 0x62, 0xe9, 0x7a, 0xf6, + 0x70, 0xb8, 0x9c, 0x2d, 0xa7, 0xf6, 0x62, 0x32, 0xff, 0xdc, 0x28, 0x35, 0x8d, 0xb3, 0xf3, 0xce, + 0x81, 0x1d, 0x04, 0x59, 0x94, 0x31, 0x94, 0x0f, 0x0d, 0x1e, 0x01, 0xf8, 0xa2, 0xdf, 0x1d, 0xdb, + 0xd3, 0xf1, 0xc8, 0xd0, 0x9a, 0xe0, 0xec, 0xbc, 0x53, 0x76, 0x31, 0x62, 0x78, 0x05, 0xbb, 0xe0, + 0x70, 0xc7, 0xb3, 0x1c, 0xcc, 0x26, 0x8b, 0xc5, 0x78, 0x64, 0xec, 0x35, 0x6b, 0x67, 0xe7, 0x9d, + 0x8a, 0x9b, 0xf9, 0x11, 0x95, 0xf2, 0x55, 0xe7, 0xf0, 0xce, 0xfc, 0x78, 0xe2, 0xcc, 0xc6, 0x23, + 0x63, 0xbf, 0x70, 0x0e, 0x79, 0x7c, 0x4a, 0xd3, 0xe8, 0x55, 0xe7, 0xf1, 0x64, 0x6e, 0x4f, 0x27, + 0x77, 0xc7, 0x23, 0x43, 0x2f, 0x9c, 0xc7, 0x34, 0x46, 0x8c, 0x7e, 0x83, 0x57, 0x4d, 0xfd, 0xdb, + 0xef, 0x5b, 0xa5, 0xc1, 0x9d, 0x1f, 0x2f, 0x5a, 0xda, 0xc3, 0x8b, 0x96, 0xf6, 0xcb, 0x45, 0x4b, + 0x7b, 0x70, 0xd9, 0x2a, 0x3d, 0xbc, 0x6c, 0x95, 0x7e, 0xba, 0x6c, 0x95, 0xee, 0xbe, 0xf7, 0x57, + 0xd8, 0xbf, 0x7e, 0xe9, 0x7f, 0x5a, 0x6e, 0x12, 0x2c, 0xfc, 0xb2, 0x7a, 0x53, 0x37, 0xff, 0x08, + 0x00, 0x00, 0xff, 0xff, 0xad, 0xde, 0x97, 0x7b, 0xcd, 0x05, 0x00, 0x00, } func (this *RawCheckpoint) Equal(that interface{}) bool { @@ -663,7 +668,7 @@ func (m *CheckpointStateUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.BlockTime != nil { - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime):]) + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime):]) if err2 != nil { return 0, err2 } @@ -821,7 +826,7 @@ func (m *CheckpointStateUpdate) Size() (n int) { n += 1 + sovCheckpoint(uint64(m.BlockHeight)) } if m.BlockTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime) n += 1 + l + sovCheckpoint(uint64(l)) } return n @@ -1322,7 +1327,7 @@ func (m *CheckpointStateUpdate) Unmarshal(dAtA []byte) error { if m.BlockTime == nil { m.BlockTime = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/checkpointing/types/errors.go b/x/checkpointing/types/errors.go index 95fd9cdcb..722b11db7 100644 --- a/x/checkpointing/types/errors.go +++ b/x/checkpointing/types/errors.go @@ -1,20 +1,21 @@ package types -import sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +import errorsmod "cosmossdk.io/errors" // x/checkpointing module sentinel errors var ( - ErrCkptDoesNotExist = sdkerrors.Register(ModuleName, 1201, "raw checkpoint does not exist") - ErrCkptAlreadyExist = sdkerrors.Register(ModuleName, 1202, "raw checkpoint already exists") - ErrCkptHashNotEqual = sdkerrors.Register(ModuleName, 1203, "hash does not equal to raw checkpoint") - ErrCkptNotAccumulating = sdkerrors.Register(ModuleName, 1204, "raw checkpoint is no longer accumulating BLS sigs") - ErrCkptAlreadyVoted = sdkerrors.Register(ModuleName, 1205, "raw checkpoint already accumulated the validator") - ErrInvalidRawCheckpoint = sdkerrors.Register(ModuleName, 1206, "raw checkpoint is invalid") - ErrInvalidCkptStatus = sdkerrors.Register(ModuleName, 1207, "raw checkpoint's status is invalid") - ErrInvalidPoP = sdkerrors.Register(ModuleName, 1208, "proof-of-possession is invalid") - ErrBlsKeyDoesNotExist = sdkerrors.Register(ModuleName, 1209, "BLS public key does not exist") - ErrBlsKeyAlreadyExist = sdkerrors.Register(ModuleName, 1210, "BLS public key already exists") - ErrBlsPrivKeyDoesNotExist = sdkerrors.Register(ModuleName, 1211, "BLS private key does not exist") - ErrConflictingCheckpoint = sdkerrors.Register(ModuleName, 1212, "Conflicting checkpoint is found") - ErrInvalidLastCommitHash = sdkerrors.Register(ModuleName, 1213, "Provided last commit hash is Invalid") + ErrCkptDoesNotExist = errorsmod.Register(ModuleName, 1201, "raw checkpoint does not exist") + ErrCkptAlreadyExist = errorsmod.Register(ModuleName, 1202, "raw checkpoint already exists") + ErrCkptHashNotEqual = errorsmod.Register(ModuleName, 1203, "hash does not equal to raw checkpoint") + ErrCkptNotAccumulating = errorsmod.Register(ModuleName, 1204, "raw checkpoint is no longer accumulating BLS sigs") + ErrCkptAlreadyVoted = errorsmod.Register(ModuleName, 1205, "raw checkpoint already accumulated the validator") + ErrInvalidRawCheckpoint = errorsmod.Register(ModuleName, 1206, "raw checkpoint is invalid") + ErrInvalidCkptStatus = errorsmod.Register(ModuleName, 1207, "raw checkpoint's status is invalid") + ErrInvalidPoP = errorsmod.Register(ModuleName, 1208, "proof-of-possession is invalid") + ErrBlsKeyDoesNotExist = errorsmod.Register(ModuleName, 1209, "BLS public key does not exist") + ErrBlsKeyAlreadyExist = errorsmod.Register(ModuleName, 1210, "BLS public key already exists") + ErrBlsPrivKeyDoesNotExist = errorsmod.Register(ModuleName, 1211, "BLS private key does not exist") + ErrInvalidBlsSignature = errorsmod.Register(ModuleName, 1212, "BLS signature is invalid") + ErrConflictingCheckpoint = errorsmod.Register(ModuleName, 1213, "Conflicting checkpoint is found") + ErrInvalidLastCommitHash = errorsmod.Register(ModuleName, 1214, "Provided last commit hash is Invalid") ) diff --git a/x/checkpointing/types/events.pb.go b/x/checkpointing/types/events.pb.go index 9c1c9f01f..10e283497 100644 --- a/x/checkpointing/types/events.pb.go +++ b/x/checkpointing/types/events.pb.go @@ -1,11 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/checkpointing/events.proto +// source: babylon/checkpointing/v1/events.proto package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -22,6 +22,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// EventCheckpointAccumulating is emitted when a checkpoint reaches the +// `Accumulating` state. type EventCheckpointAccumulating struct { Checkpoint *RawCheckpointWithMeta `protobuf:"bytes,1,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` } @@ -30,7 +32,7 @@ func (m *EventCheckpointAccumulating) Reset() { *m = EventCheckpointAccu func (m *EventCheckpointAccumulating) String() string { return proto.CompactTextString(m) } func (*EventCheckpointAccumulating) ProtoMessage() {} func (*EventCheckpointAccumulating) Descriptor() ([]byte, []int) { - return fileDescriptor_9d41a0fa2283f67f, []int{0} + return fileDescriptor_950b7bd81c59f78a, []int{0} } func (m *EventCheckpointAccumulating) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -66,6 +68,8 @@ func (m *EventCheckpointAccumulating) GetCheckpoint() *RawCheckpointWithMeta { return nil } +// EventCheckpointSealed is emitted when a checkpoint reaches the `Sealed` +// state. type EventCheckpointSealed struct { Checkpoint *RawCheckpointWithMeta `protobuf:"bytes,1,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` } @@ -74,7 +78,7 @@ func (m *EventCheckpointSealed) Reset() { *m = EventCheckpointSealed{} } func (m *EventCheckpointSealed) String() string { return proto.CompactTextString(m) } func (*EventCheckpointSealed) ProtoMessage() {} func (*EventCheckpointSealed) Descriptor() ([]byte, []int) { - return fileDescriptor_9d41a0fa2283f67f, []int{1} + return fileDescriptor_950b7bd81c59f78a, []int{1} } func (m *EventCheckpointSealed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -110,6 +114,8 @@ func (m *EventCheckpointSealed) GetCheckpoint() *RawCheckpointWithMeta { return nil } +// EventCheckpointSubmitted is emitted when a checkpoint reaches the `Submitted` +// state. type EventCheckpointSubmitted struct { Checkpoint *RawCheckpointWithMeta `protobuf:"bytes,1,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` } @@ -118,7 +124,7 @@ func (m *EventCheckpointSubmitted) Reset() { *m = EventCheckpointSubmitt func (m *EventCheckpointSubmitted) String() string { return proto.CompactTextString(m) } func (*EventCheckpointSubmitted) ProtoMessage() {} func (*EventCheckpointSubmitted) Descriptor() ([]byte, []int) { - return fileDescriptor_9d41a0fa2283f67f, []int{2} + return fileDescriptor_950b7bd81c59f78a, []int{2} } func (m *EventCheckpointSubmitted) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -154,6 +160,8 @@ func (m *EventCheckpointSubmitted) GetCheckpoint() *RawCheckpointWithMeta { return nil } +// EventCheckpointConfirmed is emitted when a checkpoint reaches the `Confirmed` +// state. type EventCheckpointConfirmed struct { Checkpoint *RawCheckpointWithMeta `protobuf:"bytes,1,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` } @@ -162,7 +170,7 @@ func (m *EventCheckpointConfirmed) Reset() { *m = EventCheckpointConfirm func (m *EventCheckpointConfirmed) String() string { return proto.CompactTextString(m) } func (*EventCheckpointConfirmed) ProtoMessage() {} func (*EventCheckpointConfirmed) Descriptor() ([]byte, []int) { - return fileDescriptor_9d41a0fa2283f67f, []int{3} + return fileDescriptor_950b7bd81c59f78a, []int{3} } func (m *EventCheckpointConfirmed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -198,6 +206,8 @@ func (m *EventCheckpointConfirmed) GetCheckpoint() *RawCheckpointWithMeta { return nil } +// EventCheckpointFinalized is emitted when a checkpoint reaches the `Finalized` +// state. type EventCheckpointFinalized struct { Checkpoint *RawCheckpointWithMeta `protobuf:"bytes,1,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` } @@ -206,7 +216,7 @@ func (m *EventCheckpointFinalized) Reset() { *m = EventCheckpointFinaliz func (m *EventCheckpointFinalized) String() string { return proto.CompactTextString(m) } func (*EventCheckpointFinalized) ProtoMessage() {} func (*EventCheckpointFinalized) Descriptor() ([]byte, []int) { - return fileDescriptor_9d41a0fa2283f67f, []int{4} + return fileDescriptor_950b7bd81c59f78a, []int{4} } func (m *EventCheckpointFinalized) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -242,6 +252,8 @@ func (m *EventCheckpointFinalized) GetCheckpoint() *RawCheckpointWithMeta { return nil } +// EventCheckpointForgotten is emitted when a checkpoint switches to a +// `Forgotten` state. type EventCheckpointForgotten struct { Checkpoint *RawCheckpointWithMeta `protobuf:"bytes,1,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"` } @@ -250,7 +262,7 @@ func (m *EventCheckpointForgotten) Reset() { *m = EventCheckpointForgott func (m *EventCheckpointForgotten) String() string { return proto.CompactTextString(m) } func (*EventCheckpointForgotten) ProtoMessage() {} func (*EventCheckpointForgotten) Descriptor() ([]byte, []int) { - return fileDescriptor_9d41a0fa2283f67f, []int{5} + return fileDescriptor_950b7bd81c59f78a, []int{5} } func (m *EventCheckpointForgotten) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -286,6 +298,8 @@ func (m *EventCheckpointForgotten) GetCheckpoint() *RawCheckpointWithMeta { return nil } +// EventConflictingCheckpoint is emitted when two conflicting checkpoints are +// found. type EventConflictingCheckpoint struct { ConflictingCheckpoint *RawCheckpoint `protobuf:"bytes,1,opt,name=conflicting_checkpoint,json=conflictingCheckpoint,proto3" json:"conflicting_checkpoint,omitempty"` LocalCheckpoint *RawCheckpointWithMeta `protobuf:"bytes,2,opt,name=local_checkpoint,json=localCheckpoint,proto3" json:"local_checkpoint,omitempty"` @@ -295,7 +309,7 @@ func (m *EventConflictingCheckpoint) Reset() { *m = EventConflictingChec func (m *EventConflictingCheckpoint) String() string { return proto.CompactTextString(m) } func (*EventConflictingCheckpoint) ProtoMessage() {} func (*EventConflictingCheckpoint) Descriptor() ([]byte, []int) { - return fileDescriptor_9d41a0fa2283f67f, []int{6} + return fileDescriptor_950b7bd81c59f78a, []int{6} } func (m *EventConflictingCheckpoint) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -349,31 +363,31 @@ func init() { } func init() { - proto.RegisterFile("babylon/checkpointing/events.proto", fileDescriptor_9d41a0fa2283f67f) + proto.RegisterFile("babylon/checkpointing/v1/events.proto", fileDescriptor_950b7bd81c59f78a) } -var fileDescriptor_9d41a0fa2283f67f = []byte{ - // 310 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, +var fileDescriptor_950b7bd81c59f78a = []byte{ + // 314 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, 0x2b, 0xc9, 0xcc, - 0x4b, 0xd7, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, - 0x80, 0xaa, 0xd1, 0x43, 0x51, 0xa3, 0x57, 0x66, 0x28, 0xa5, 0x86, 0x5d, 0x37, 0x82, 0x07, 0x31, - 0x41, 0x29, 0x8f, 0x4b, 0xda, 0x15, 0x64, 0xa2, 0x33, 0x5c, 0xc2, 0x31, 0x39, 0xb9, 0x34, 0xb7, - 0x34, 0x27, 0x11, 0xa4, 0x5e, 0xc8, 0x9f, 0x8b, 0x0b, 0xa1, 0x45, 0x82, 0x51, 0x81, 0x51, 0x83, - 0xdb, 0x48, 0x5f, 0x0f, 0x97, 0xad, 0x7a, 0x41, 0x89, 0xe5, 0x08, 0x83, 0xc2, 0x33, 0x4b, 0x32, - 0x7c, 0x53, 0x4b, 0x12, 0x83, 0x90, 0x8c, 0x50, 0xca, 0xe0, 0x12, 0x45, 0xb3, 0x2f, 0x38, 0x35, - 0x31, 0x27, 0x35, 0x85, 0xfa, 0x36, 0x65, 0x73, 0x49, 0xa0, 0xdb, 0x54, 0x9a, 0x94, 0x9b, 0x59, - 0x52, 0x42, 0x1f, 0xcb, 0x9c, 0xf3, 0xf3, 0xd2, 0x32, 0x8b, 0x72, 0xe9, 0x63, 0x99, 0x5b, 0x66, - 0x5e, 0x62, 0x4e, 0x66, 0x15, 0x9d, 0x2c, 0xcb, 0x2f, 0x4a, 0xcf, 0x2f, 0x29, 0x49, 0xcd, 0xa3, - 0xbe, 0x65, 0x37, 0x18, 0xb9, 0xa4, 0x20, 0xb6, 0xe5, 0xe7, 0xa5, 0xe5, 0x64, 0x26, 0x83, 0x74, - 0x22, 0xb4, 0x08, 0xc5, 0x71, 0x89, 0x25, 0x23, 0x24, 0xe2, 0x31, 0xec, 0x56, 0x27, 0xd2, 0xee, - 0x20, 0xd1, 0x64, 0xac, 0xe6, 0x47, 0x71, 0x09, 0xe4, 0xe4, 0x27, 0x27, 0xe6, 0x20, 0x9b, 0xcc, - 0x44, 0x9e, 0xaf, 0xf8, 0xc1, 0x06, 0x21, 0x24, 0x9c, 0xfc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, - 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, - 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x34, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, - 0x1f, 0x6a, 0x4b, 0x72, 0x46, 0x62, 0x66, 0x1e, 0x8c, 0xa3, 0x5f, 0x81, 0x96, 0x89, 0x4b, 0x2a, - 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x19, 0xd8, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0x28, 0x52, - 0x61, 0xb1, 0x28, 0x04, 0x00, 0x00, + 0x4b, 0xd7, 0x2f, 0x33, 0xd4, 0x4f, 0x2d, 0x4b, 0xcd, 0x2b, 0x29, 0xd6, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x92, 0x80, 0x2a, 0xd3, 0x43, 0x51, 0xa6, 0x57, 0x66, 0x28, 0xa5, 0x89, 0xd3, 0x00, + 0x84, 0x00, 0xc4, 0x10, 0xa5, 0x3c, 0x2e, 0x69, 0x57, 0x90, 0xa1, 0xce, 0x70, 0x09, 0xc7, 0xe4, + 0xe4, 0xd2, 0xdc, 0xd2, 0x9c, 0x44, 0x90, 0x16, 0x21, 0x7f, 0x2e, 0x2e, 0x84, 0x16, 0x09, 0x46, + 0x05, 0x46, 0x0d, 0x6e, 0x23, 0x7d, 0x3d, 0x5c, 0x16, 0xeb, 0x05, 0x25, 0x96, 0x23, 0x0c, 0x0a, + 0xcf, 0x2c, 0xc9, 0xf0, 0x4d, 0x2d, 0x49, 0x0c, 0x42, 0x32, 0x42, 0x29, 0x83, 0x4b, 0x14, 0xcd, + 0xbe, 0xe0, 0xd4, 0xc4, 0x9c, 0xd4, 0x14, 0xea, 0xdb, 0x94, 0xcd, 0x25, 0x81, 0x6e, 0x53, 0x69, + 0x52, 0x6e, 0x66, 0x49, 0x09, 0x7d, 0x2c, 0x73, 0xce, 0xcf, 0x4b, 0xcb, 0x2c, 0xca, 0xa5, 0x8f, + 0x65, 0x6e, 0x99, 0x79, 0x89, 0x39, 0x99, 0x55, 0x74, 0xb2, 0x2c, 0xbf, 0x28, 0x3d, 0xbf, 0xa4, + 0x24, 0x35, 0x8f, 0xfa, 0x96, 0xdd, 0x60, 0xe4, 0x92, 0x82, 0xd8, 0x96, 0x9f, 0x97, 0x96, 0x93, + 0x99, 0x0c, 0xd2, 0x89, 0xd0, 0x22, 0x14, 0xc7, 0x25, 0x96, 0x8c, 0x90, 0x88, 0xc7, 0xb0, 0x5b, + 0x9d, 0x48, 0xbb, 0x83, 0x44, 0x93, 0xb1, 0x9a, 0x1f, 0xc5, 0x25, 0x90, 0x93, 0x9f, 0x9c, 0x98, + 0x83, 0x6c, 0x32, 0x13, 0x79, 0xbe, 0xe2, 0x07, 0x1b, 0x84, 0x90, 0x70, 0xf2, 0x3f, 0xf1, 0x48, + 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, + 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xd3, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, + 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x2d, 0xc9, 0x19, 0x89, 0x99, 0x79, 0x30, 0x8e, 0x7e, 0x05, 0x5a, + 0x3e, 0x2e, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0x67, 0x60, 0x63, 0x40, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x47, 0xbc, 0x3a, 0x24, 0x2e, 0x04, 0x00, 0x00, } func (m *EventCheckpointAccumulating) Marshal() (dAtA []byte, err error) { diff --git a/x/checkpointing/types/expected_keepers.go b/x/checkpointing/types/expected_keepers.go index 2d3645970..36eda39a8 100644 --- a/x/checkpointing/types/expected_keepers.go +++ b/x/checkpointing/types/expected_keepers.go @@ -4,6 +4,7 @@ import ( epochingtypes "github.com/babylonchain/babylon/x/epoching/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // AccountKeeper defines the expected account keeper used for simulations (noalias) @@ -24,6 +25,7 @@ type EpochingKeeper interface { EnqueueMsg(ctx sdk.Context, msg epochingtypes.QueuedMessage) GetValidatorSet(ctx sdk.Context, epochNumer uint64) epochingtypes.ValidatorSet GetTotalVotingPower(ctx sdk.Context, epochNumber uint64) int64 + CheckMsgCreateValidator(ctx sdk.Context, msg *stakingtypes.MsgCreateValidator) error } // Event Hooks diff --git a/x/checkpointing/types/genesis.go b/x/checkpointing/types/genesis.go index da816d210..0f00a9af9 100644 --- a/x/checkpointing/types/genesis.go +++ b/x/checkpointing/types/genesis.go @@ -5,11 +5,11 @@ import ( "errors" "os" + tmjson "github.com/cometbft/cometbft/libs/json" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" - tmjson "github.com/tendermint/tendermint/libs/json" "github.com/babylonchain/babylon/crypto/bls12381" ) @@ -19,9 +19,7 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - } + return &GenesisState{} } // Validate performs basic genesis state validation returning an error upon any @@ -39,7 +37,7 @@ func (gs GenesisState) Validate() error { } } - return gs.Params.Validate() + return nil } func NewGenesisKey(delAddr sdk.ValAddress, blsPubKey *bls12381.PublicKey, pop *ProofOfPossession, pubkey cryptotypes.PubKey) (*GenesisKey, error) { diff --git a/x/checkpointing/types/genesis.pb.go b/x/checkpointing/types/genesis.pb.go index a5147303d..380afef3d 100644 --- a/x/checkpointing/types/genesis.pb.go +++ b/x/checkpointing/types/genesis.pb.go @@ -1,14 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/checkpointing/genesis.proto +// source: babylon/checkpointing/v1/genesis.proto package types import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" ed25519 "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -27,16 +25,15 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the checkpointing module's genesis state. type GenesisState struct { - // params defines all the paramaters of related to checkpointing - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - GenesisKeys []*GenesisKey `protobuf:"bytes,2,rep,name=genesis_keys,json=genesisKeys,proto3" json:"genesis_keys,omitempty"` + // genesis_keys defines the public keys for the genesis validators + GenesisKeys []*GenesisKey `protobuf:"bytes,1,rep,name=genesis_keys,json=genesisKeys,proto3" json:"genesis_keys,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_cdd0fb065da1de51, []int{0} + return fileDescriptor_bf2c524ebc9800de, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -65,13 +62,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func (m *GenesisState) GetGenesisKeys() []*GenesisKey { if m != nil { return m.GenesisKeys @@ -79,6 +69,7 @@ func (m *GenesisState) GetGenesisKeys() []*GenesisKey { return nil } +// GenesisKey defines public key information about the genesis validators type GenesisKey struct { // validator_address is the address corresponding to a validator ValidatorAddress string `protobuf:"bytes,1,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` @@ -92,7 +83,7 @@ func (m *GenesisKey) Reset() { *m = GenesisKey{} } func (m *GenesisKey) String() string { return proto.CompactTextString(m) } func (*GenesisKey) ProtoMessage() {} func (*GenesisKey) Descriptor() ([]byte, []int) { - return fileDescriptor_cdd0fb065da1de51, []int{1} + return fileDescriptor_bf2c524ebc9800de, []int{1} } func (m *GenesisKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -148,35 +139,32 @@ func init() { } func init() { - proto.RegisterFile("babylon/checkpointing/genesis.proto", fileDescriptor_cdd0fb065da1de51) + proto.RegisterFile("babylon/checkpointing/v1/genesis.proto", fileDescriptor_bf2c524ebc9800de) } -var fileDescriptor_cdd0fb065da1de51 = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x91, 0xc1, 0x4a, 0xc3, 0x30, - 0x18, 0xc7, 0xdb, 0x4d, 0x26, 0xcb, 0x76, 0xd0, 0xe2, 0xa1, 0x0e, 0xac, 0x65, 0x7a, 0x18, 0x08, - 0x09, 0x9b, 0xec, 0x30, 0x10, 0xc1, 0x5d, 0x76, 0xf0, 0xe0, 0x98, 0x37, 0x2f, 0x25, 0x69, 0x43, - 0x57, 0xd6, 0x35, 0xa5, 0xc9, 0x8a, 0x7d, 0x0b, 0x6f, 0xbe, 0x87, 0x4f, 0xb1, 0xe3, 0x8e, 0x9e, - 0x44, 0xb6, 0x17, 0x91, 0x26, 0xd9, 0x44, 0x71, 0x78, 0x6a, 0xf2, 0xe5, 0xf7, 0xff, 0xbe, 0xef, - 0xdf, 0x3f, 0xb8, 0x20, 0x98, 0x14, 0x31, 0x4b, 0x90, 0x3f, 0xa5, 0xfe, 0x2c, 0x65, 0x51, 0x22, - 0xa2, 0x24, 0x44, 0x21, 0x4d, 0x28, 0x8f, 0x38, 0x4c, 0x33, 0x26, 0x98, 0x65, 0x6b, 0x08, 0xfe, - 0x80, 0x60, 0xde, 0x6d, 0x9d, 0xfa, 0x8c, 0xcf, 0x19, 0xf7, 0x24, 0x87, 0xd4, 0x45, 0x89, 0x5a, - 0x27, 0x21, 0x0b, 0x99, 0xaa, 0x97, 0x27, 0x5d, 0x75, 0x15, 0x83, 0xfc, 0xac, 0x48, 0x05, 0x43, - 0x34, 0xe8, 0xf5, 0xfb, 0xdd, 0x01, 0x9a, 0xd1, 0x62, 0xab, 0x6b, 0xff, 0xbd, 0x51, 0x8a, 0x33, - 0x3c, 0xdf, 0x32, 0x7b, 0xb6, 0x26, 0x31, 0xf7, 0x66, 0xb4, 0x50, 0x50, 0xfb, 0xd5, 0x04, 0xcd, - 0x91, 0xf2, 0xf1, 0x28, 0xb0, 0xa0, 0xd6, 0x2d, 0xa8, 0xa9, 0x2e, 0xb6, 0xe9, 0x9a, 0x9d, 0x46, - 0xcf, 0x85, 0xfb, 0x7c, 0xc1, 0xb1, 0xe4, 0x86, 0x07, 0xcb, 0x8f, 0x73, 0x63, 0xa2, 0x55, 0xd6, - 0x08, 0x34, 0xf5, 0x7f, 0x29, 0xa7, 0x70, 0xbb, 0xe2, 0x56, 0x3b, 0x8d, 0xde, 0xe5, 0xfe, 0x2e, - 0x7a, 0xfa, 0x3d, 0x2d, 0x26, 0x8d, 0x70, 0x77, 0xe6, 0xed, 0x37, 0x13, 0x80, 0xef, 0x37, 0xeb, - 0x0a, 0x1c, 0xe7, 0x38, 0x8e, 0x02, 0x2c, 0x58, 0xe6, 0xe1, 0x20, 0xc8, 0x28, 0x57, 0x2b, 0xd6, - 0x27, 0x47, 0xbb, 0x87, 0x3b, 0x55, 0xb7, 0x06, 0xe0, 0x50, 0xdb, 0xb4, 0x2b, 0xff, 0xb9, 0x18, - 0xc6, 0x72, 0x76, 0x8d, 0xc8, 0xaf, 0x75, 0x03, 0x40, 0x8e, 0x63, 0x2f, 0x5d, 0x90, 0x52, 0x5d, - 0x95, 0xea, 0x33, 0xa8, 0x43, 0x53, 0x81, 0x40, 0x1d, 0x08, 0x1c, 0x2f, 0x48, 0x29, 0xad, 0xe7, - 0x38, 0x1e, 0x4b, 0x7e, 0xf8, 0xb0, 0x5c, 0x3b, 0xe6, 0x6a, 0xed, 0x98, 0x9f, 0x6b, 0xc7, 0x7c, - 0xd9, 0x38, 0xc6, 0x6a, 0xe3, 0x18, 0xef, 0x1b, 0xc7, 0x78, 0xea, 0x87, 0x91, 0x98, 0x2e, 0x08, - 0xf4, 0xd9, 0x1c, 0xe9, 0x5d, 0xfc, 0x29, 0x8e, 0x92, 0xed, 0x05, 0x3d, 0xff, 0xca, 0x49, 0x14, - 0x29, 0xe5, 0xa4, 0x26, 0x63, 0xba, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x5d, 0xd1, 0xac, 0x82, - 0x83, 0x02, 0x00, 0x00, +var fileDescriptor_bf2c524ebc9800de = []byte{ + // 325 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x90, 0xcf, 0x6a, 0x2a, 0x31, + 0x18, 0xc5, 0xcd, 0x15, 0xbc, 0x18, 0x5d, 0xb4, 0xb3, 0x12, 0xa1, 0x61, 0x90, 0x52, 0x84, 0x42, + 0x82, 0x16, 0x17, 0x42, 0x37, 0x75, 0xe3, 0xa2, 0x8b, 0x8a, 0x5d, 0x14, 0xba, 0x91, 0x24, 0x13, + 0xc6, 0x60, 0x9c, 0x0c, 0x93, 0x38, 0x34, 0x6f, 0xd1, 0x67, 0xe9, 0x53, 0x74, 0xe9, 0xb2, 0xcb, + 0xa2, 0x2f, 0x52, 0x66, 0x26, 0xb5, 0xb4, 0x30, 0xab, 0xfc, 0xf9, 0xce, 0xf9, 0xce, 0xe1, 0x07, + 0xaf, 0x18, 0x65, 0x4e, 0xe9, 0x84, 0xf0, 0xb5, 0xe0, 0x9b, 0x54, 0xcb, 0xc4, 0xca, 0x24, 0x26, + 0xf9, 0x88, 0xc4, 0x22, 0x11, 0x46, 0x1a, 0x9c, 0x66, 0xda, 0xea, 0xa0, 0xe7, 0x75, 0xf8, 0x97, + 0x0e, 0xe7, 0xa3, 0x7e, 0xc8, 0xb5, 0xd9, 0x6a, 0x43, 0x78, 0xe6, 0x52, 0xab, 0x89, 0x88, 0xc6, + 0x93, 0xc9, 0x68, 0x4a, 0x36, 0xc2, 0x79, 0x6f, 0xbf, 0x3e, 0x83, 0x29, 0xb3, 0xda, 0x08, 0x57, + 0xe9, 0x06, 0x4f, 0xb0, 0x3b, 0xaf, 0x42, 0x1f, 0x2d, 0xb5, 0x22, 0x98, 0xc3, 0xae, 0x2f, 0x51, + 0x88, 0x4c, 0x0f, 0x84, 0xcd, 0x61, 0x67, 0x7c, 0x89, 0xeb, 0xaa, 0x60, 0xef, 0xbe, 0x17, 0x6e, + 0xd9, 0x89, 0x4f, 0x77, 0x33, 0x78, 0x03, 0x10, 0xfe, 0xcc, 0x82, 0x6b, 0x78, 0x9e, 0x53, 0x25, + 0x23, 0x6a, 0x75, 0xb6, 0xa2, 0x51, 0x94, 0x09, 0x53, 0x2c, 0x07, 0xc3, 0xf6, 0xf2, 0xec, 0x34, + 0xb8, 0xab, 0xfe, 0x83, 0x29, 0xfc, 0xef, 0x5b, 0xf6, 0xfe, 0x85, 0x60, 0xd8, 0x19, 0x87, 0xf5, + 0xf9, 0x33, 0x55, 0x66, 0xb7, 0x58, 0x79, 0x06, 0xb7, 0x10, 0xe6, 0x54, 0xad, 0xd2, 0x1d, 0x2b, + 0xdc, 0xcd, 0xd2, 0x7d, 0x81, 0x2b, 0x5c, 0xb8, 0xc2, 0x85, 0x3d, 0x2e, 0xbc, 0xd8, 0xb1, 0xc2, + 0xda, 0xce, 0xa9, 0x5a, 0x94, 0xfa, 0xd9, 0xc3, 0xfb, 0x01, 0x81, 0xfd, 0x01, 0x81, 0xcf, 0x03, + 0x02, 0xaf, 0x47, 0xd4, 0xd8, 0x1f, 0x51, 0xe3, 0xe3, 0x88, 0x1a, 0xcf, 0x93, 0x58, 0xda, 0xf5, + 0x8e, 0x61, 0xae, 0xb7, 0xc4, 0x77, 0xe1, 0x6b, 0x2a, 0x93, 0xef, 0x07, 0x79, 0xf9, 0x43, 0xda, + 0xba, 0x54, 0x18, 0xd6, 0x2a, 0x29, 0xdf, 0x7c, 0x05, 0x00, 0x00, 0xff, 0xff, 0x1c, 0xab, 0xd1, + 0x3a, 0xf3, 0x01, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -210,19 +198,9 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + dAtA[i] = 0xa } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -297,8 +275,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) if len(m.GenesisKeys) > 0 { for _, e := range m.GenesisKeys { l = e.Size() @@ -365,39 +341,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field GenesisKeys", wireType) } diff --git a/x/checkpointing/types/msgs.go b/x/checkpointing/types/msgs.go index aee1604ab..aee9efd03 100644 --- a/x/checkpointing/types/msgs.go +++ b/x/checkpointing/types/msgs.go @@ -16,13 +16,16 @@ var ( _ sdk.Msg = (*MsgAddBlsSig)(nil) ) -func NewMsgAddBlsSig(epochNum uint64, lch LastCommitHash, sig bls12381.Signature, addr sdk.ValAddress) *MsgAddBlsSig { - return &MsgAddBlsSig{BlsSig: &BlsSig{ - EpochNum: epochNum, - LastCommitHash: &lch, - BlsSig: &sig, - SignerAddress: addr.String(), - }} +func NewMsgAddBlsSig(signer sdk.AccAddress, epochNum uint64, lch LastCommitHash, sig bls12381.Signature, addr sdk.ValAddress) *MsgAddBlsSig { + return &MsgAddBlsSig{ + Signer: signer.String(), + BlsSig: &BlsSig{ + EpochNum: epochNum, + LastCommitHash: &lch, + BlsSig: &sig, + SignerAddress: addr.String(), + }, + } } func NewMsgWrappedCreateValidator(msgCreateVal *stakingtypes.MsgCreateValidator, blsPK *bls12381.PublicKey, pop *ProofOfPossession) (*MsgWrappedCreateValidator, error) { @@ -56,12 +59,14 @@ func (m *MsgAddBlsSig) ValidateBasic() error { } func (m *MsgAddBlsSig) GetSigners() []sdk.AccAddress { - signer, err := sdk.ValAddressFromBech32(m.BlsSig.SignerAddress) + signer, err := sdk.AccAddressFromBech32(m.Signer) if err != nil { + // Panic, since the GetSigners method is called after ValidateBasic + // which performs the same check. panic(err) } - return []sdk.AccAddress{sdk.AccAddress(signer)} + return []sdk.AccAddress{signer} } func (m *MsgWrappedCreateValidator) VerifyPoP(valPubkey cryptotypes.PubKey) bool { diff --git a/x/checkpointing/types/params.go b/x/checkpointing/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/checkpointing/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/checkpointing/types/params.pb.go b/x/checkpointing/types/params.pb.go deleted file mode 100644 index 4ede32150..000000000 --- a/x/checkpointing/types/params.pb.go +++ /dev/null @@ -1,266 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/checkpointing/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_3587fe7b22c0f5bb, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Params)(nil), "babylon.checkpointing.v1.Params") -} - -func init() { - proto.RegisterFile("babylon/checkpointing/params.proto", fileDescriptor_3587fe7b22c0f5bb) -} - -var fileDescriptor_3587fe7b22c0f5bb = []byte{ - // 160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, 0x2b, 0xc9, 0xcc, - 0x4b, 0xd7, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, - 0x80, 0xaa, 0xd1, 0x43, 0x51, 0xa3, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, - 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0xf1, 0x71, 0xb1, 0x05, 0x80, 0xf5, 0x5b, 0xb1, 0xcc, 0x58, - 0x20, 0xcf, 0xe0, 0xe4, 0x7f, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, - 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xa6, - 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0x4b, 0x92, 0x33, 0x12, - 0x33, 0xf3, 0x60, 0x1c, 0xfd, 0x0a, 0x34, 0x77, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, - 0xed, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x15, 0x10, 0xfe, 0xa5, 0xbd, 0x00, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/checkpointing/types/pop.go b/x/checkpointing/types/pop.go index 65aa6bc96..6e7586157 100644 --- a/x/checkpointing/types/pop.go +++ b/x/checkpointing/types/pop.go @@ -2,8 +2,8 @@ package types import ( "github.com/babylonchain/babylon/crypto/bls12381" + "github.com/cometbft/cometbft/crypto/ed25519" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/tendermint/tendermint/crypto/ed25519" ) // IsValid verifies the validity of PoP diff --git a/x/checkpointing/types/pop_test.go b/x/checkpointing/types/pop_test.go index 742aec90d..3beeca1aa 100644 --- a/x/checkpointing/types/pop_test.go +++ b/x/checkpointing/types/pop_test.go @@ -3,9 +3,9 @@ package types_test import ( "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/privval" + "github.com/cometbft/cometbft/crypto/ed25519" "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/ed25519" "testing" ) diff --git a/x/checkpointing/types/query.pb.go b/x/checkpointing/types/query.pb.go index 5450cf6a9..96dcf8fc1 100644 --- a/x/checkpointing/types/query.pb.go +++ b/x/checkpointing/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/checkpointing/query.proto +// source: babylon/checkpointing/v1/query.proto package types @@ -7,9 +7,8 @@ import ( context "context" fmt "fmt" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -30,8 +29,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryRawCheckpointListRequest is the request type for the Query/RawCheckpoints -// RPC method. +// QueryRawCheckpointListRequest is the request type for the +// Query/RawCheckpoints RPC method. type QueryRawCheckpointListRequest struct { // status defines the status of the raw checkpoints of the query Status CheckpointStatus `protobuf:"varint,1,opt,name=status,proto3,enum=babylon.checkpointing.v1.CheckpointStatus" json:"status,omitempty"` @@ -43,7 +42,7 @@ func (m *QueryRawCheckpointListRequest) Reset() { *m = QueryRawCheckpoin func (m *QueryRawCheckpointListRequest) String() string { return proto.CompactTextString(m) } func (*QueryRawCheckpointListRequest) ProtoMessage() {} func (*QueryRawCheckpointListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{0} + return fileDescriptor_113f1ca5c3c2ca44, []int{0} } func (m *QueryRawCheckpointListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -86,8 +85,8 @@ func (m *QueryRawCheckpointListRequest) GetPagination() *query.PageRequest { return nil } -// QueryRawCheckpointListResponse is the response type for the Query/RawCheckpoints -// RPC method. +// QueryRawCheckpointListResponse is the response type for the +// Query/RawCheckpoints RPC method. type QueryRawCheckpointListResponse struct { // the order is going from the newest to oldest based on the epoch number RawCheckpoints []*RawCheckpointWithMeta `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` @@ -99,7 +98,7 @@ func (m *QueryRawCheckpointListResponse) Reset() { *m = QueryRawCheckpoi func (m *QueryRawCheckpointListResponse) String() string { return proto.CompactTextString(m) } func (*QueryRawCheckpointListResponse) ProtoMessage() {} func (*QueryRawCheckpointListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{1} + return fileDescriptor_113f1ca5c3c2ca44, []int{1} } func (m *QueryRawCheckpointListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -153,7 +152,7 @@ func (m *QueryRawCheckpointRequest) Reset() { *m = QueryRawCheckpointReq func (m *QueryRawCheckpointRequest) String() string { return proto.CompactTextString(m) } func (*QueryRawCheckpointRequest) ProtoMessage() {} func (*QueryRawCheckpointRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{2} + return fileDescriptor_113f1ca5c3c2ca44, []int{2} } func (m *QueryRawCheckpointRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -199,7 +198,7 @@ func (m *QueryRawCheckpointResponse) Reset() { *m = QueryRawCheckpointRe func (m *QueryRawCheckpointResponse) String() string { return proto.CompactTextString(m) } func (*QueryRawCheckpointResponse) ProtoMessage() {} func (*QueryRawCheckpointResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{3} + return fileDescriptor_113f1ca5c3c2ca44, []int{3} } func (m *QueryRawCheckpointResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -235,6 +234,109 @@ func (m *QueryRawCheckpointResponse) GetRawCheckpoint() *RawCheckpointWithMeta { return nil } +// QueryRawCheckpointsRequest is the request type for the Query/RawCheckpoints +// RPC method. +type QueryRawCheckpointsRequest struct { + // pagination defines whether to have the pagination in the request + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRawCheckpointsRequest) Reset() { *m = QueryRawCheckpointsRequest{} } +func (m *QueryRawCheckpointsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointsRequest) ProtoMessage() {} +func (*QueryRawCheckpointsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_113f1ca5c3c2ca44, []int{4} +} +func (m *QueryRawCheckpointsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRawCheckpointsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRawCheckpointsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryRawCheckpointsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointsRequest.Merge(m, src) +} +func (m *QueryRawCheckpointsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryRawCheckpointsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRawCheckpointsRequest proto.InternalMessageInfo + +func (m *QueryRawCheckpointsRequest) GetPagination() *query.PageRequest { + if m != nil { + return m.Pagination + } + return nil +} + +// QueryRawCheckpointsResponse is the response type for the Query/RawCheckpoints +// RPC method. +type QueryRawCheckpointsResponse struct { + // the order is going from the newest to oldest based on the epoch number + RawCheckpoints []*RawCheckpointWithMeta `protobuf:"bytes,1,rep,name=raw_checkpoints,json=rawCheckpoints,proto3" json:"raw_checkpoints,omitempty"` + // pagination defines the pagination in the response. + Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` +} + +func (m *QueryRawCheckpointsResponse) Reset() { *m = QueryRawCheckpointsResponse{} } +func (m *QueryRawCheckpointsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryRawCheckpointsResponse) ProtoMessage() {} +func (*QueryRawCheckpointsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_113f1ca5c3c2ca44, []int{5} +} +func (m *QueryRawCheckpointsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryRawCheckpointsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryRawCheckpointsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryRawCheckpointsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryRawCheckpointsResponse.Merge(m, src) +} +func (m *QueryRawCheckpointsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryRawCheckpointsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryRawCheckpointsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryRawCheckpointsResponse proto.InternalMessageInfo + +func (m *QueryRawCheckpointsResponse) GetRawCheckpoints() []*RawCheckpointWithMeta { + if m != nil { + return m.RawCheckpoints + } + return nil +} + +func (m *QueryRawCheckpointsResponse) GetPagination() *query.PageResponse { + if m != nil { + return m.Pagination + } + return nil +} + // QueryBlsPublicKeyListRequest is the request type for the Query/BlsPublicKeys // RPC method. type QueryBlsPublicKeyListRequest struct { @@ -248,7 +350,7 @@ func (m *QueryBlsPublicKeyListRequest) Reset() { *m = QueryBlsPublicKeyL func (m *QueryBlsPublicKeyListRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlsPublicKeyListRequest) ProtoMessage() {} func (*QueryBlsPublicKeyListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{4} + return fileDescriptor_113f1ca5c3c2ca44, []int{6} } func (m *QueryBlsPublicKeyListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -291,8 +393,8 @@ func (m *QueryBlsPublicKeyListRequest) GetPagination() *query.PageRequest { return nil } -// QueryBlsPublicKeyListResponse is the response type for the Query/BlsPublicKeys -// RPC method. +// QueryBlsPublicKeyListResponse is the response type for the +// Query/BlsPublicKeys RPC method. type QueryBlsPublicKeyListResponse struct { ValidatorWithBlsKeys []*ValidatorWithBlsKey `protobuf:"bytes,1,rep,name=validator_with_bls_keys,json=validatorWithBlsKeys,proto3" json:"validator_with_bls_keys,omitempty"` // pagination defines the pagination in the response. @@ -303,7 +405,7 @@ func (m *QueryBlsPublicKeyListResponse) Reset() { *m = QueryBlsPublicKey func (m *QueryBlsPublicKeyListResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlsPublicKeyListResponse) ProtoMessage() {} func (*QueryBlsPublicKeyListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{5} + return fileDescriptor_113f1ca5c3c2ca44, []int{7} } func (m *QueryBlsPublicKeyListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -356,7 +458,7 @@ func (m *QueryEpochStatusRequest) Reset() { *m = QueryEpochStatusRequest func (m *QueryEpochStatusRequest) String() string { return proto.CompactTextString(m) } func (*QueryEpochStatusRequest) ProtoMessage() {} func (*QueryEpochStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{6} + return fileDescriptor_113f1ca5c3c2ca44, []int{8} } func (m *QueryEpochStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -402,7 +504,7 @@ func (m *QueryEpochStatusResponse) Reset() { *m = QueryEpochStatusRespon func (m *QueryEpochStatusResponse) String() string { return proto.CompactTextString(m) } func (*QueryEpochStatusResponse) ProtoMessage() {} func (*QueryEpochStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{7} + return fileDescriptor_113f1ca5c3c2ca44, []int{9} } func (m *QueryEpochStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -438,10 +540,11 @@ func (m *QueryEpochStatusResponse) GetStatus() CheckpointStatus { return Accumulating } -// QueryRecentEpochStatusCountRequest is the request type for the Query/EpochStatusCount -// RPC method. +// QueryRecentEpochStatusCountRequest is the request type for the +// Query/EpochStatusCount RPC method. type QueryRecentEpochStatusCountRequest struct { - // epoch_count is the number of the most recent epochs to include in the aggregation + // epoch_count is the number of the most recent epochs to include in the + // aggregation EpochCount uint64 `protobuf:"varint,1,opt,name=epoch_count,json=epochCount,proto3" json:"epoch_count,omitempty"` } @@ -449,7 +552,7 @@ func (m *QueryRecentEpochStatusCountRequest) Reset() { *m = QueryRecentE func (m *QueryRecentEpochStatusCountRequest) String() string { return proto.CompactTextString(m) } func (*QueryRecentEpochStatusCountRequest) ProtoMessage() {} func (*QueryRecentEpochStatusCountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{8} + return fileDescriptor_113f1ca5c3c2ca44, []int{10} } func (m *QueryRecentEpochStatusCountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -485,8 +588,8 @@ func (m *QueryRecentEpochStatusCountRequest) GetEpochCount() uint64 { return 0 } -// QueryRecentEpochStatusCountResponse is the response type for the Query/EpochStatusCount -// RPC method. +// QueryRecentEpochStatusCountResponse is the response type for the +// Query/EpochStatusCount RPC method. type QueryRecentEpochStatusCountResponse struct { TipEpoch uint64 `protobuf:"varint,1,opt,name=tip_epoch,json=tipEpoch,proto3" json:"tip_epoch,omitempty"` EpochCount uint64 `protobuf:"varint,2,opt,name=epoch_count,json=epochCount,proto3" json:"epoch_count,omitempty"` @@ -497,7 +600,7 @@ func (m *QueryRecentEpochStatusCountResponse) Reset() { *m = QueryRecent func (m *QueryRecentEpochStatusCountResponse) String() string { return proto.CompactTextString(m) } func (*QueryRecentEpochStatusCountResponse) ProtoMessage() {} func (*QueryRecentEpochStatusCountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{9} + return fileDescriptor_113f1ca5c3c2ca44, []int{11} } func (m *QueryRecentEpochStatusCountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -547,6 +650,8 @@ func (m *QueryRecentEpochStatusCountResponse) GetStatusCount() map[string]uint64 return nil } +// QueryLastCheckpointWithStatusRequest is the request type for the +// Query/LastCheckpointWithStatus RPC method. type QueryLastCheckpointWithStatusRequest struct { Status CheckpointStatus `protobuf:"varint,1,opt,name=status,proto3,enum=babylon.checkpointing.v1.CheckpointStatus" json:"status,omitempty"` } @@ -555,7 +660,7 @@ func (m *QueryLastCheckpointWithStatusRequest) Reset() { *m = QueryLastC func (m *QueryLastCheckpointWithStatusRequest) String() string { return proto.CompactTextString(m) } func (*QueryLastCheckpointWithStatusRequest) ProtoMessage() {} func (*QueryLastCheckpointWithStatusRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{10} + return fileDescriptor_113f1ca5c3c2ca44, []int{12} } func (m *QueryLastCheckpointWithStatusRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -591,6 +696,8 @@ func (m *QueryLastCheckpointWithStatusRequest) GetStatus() CheckpointStatus { return Accumulating } +// QueryLastCheckpointWithStatusResponse is the response type for the +// Query/LastCheckpointWithStatus RPC method. type QueryLastCheckpointWithStatusResponse struct { RawCheckpoint *RawCheckpoint `protobuf:"bytes,1,opt,name=raw_checkpoint,json=rawCheckpoint,proto3" json:"raw_checkpoint,omitempty"` } @@ -599,7 +706,7 @@ func (m *QueryLastCheckpointWithStatusResponse) Reset() { *m = QueryLast func (m *QueryLastCheckpointWithStatusResponse) String() string { return proto.CompactTextString(m) } func (*QueryLastCheckpointWithStatusResponse) ProtoMessage() {} func (*QueryLastCheckpointWithStatusResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{11} + return fileDescriptor_113f1ca5c3c2ca44, []int{13} } func (m *QueryLastCheckpointWithStatusResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -635,94 +742,13 @@ func (m *QueryLastCheckpointWithStatusResponse) GetRawCheckpoint() *RawCheckpoin return nil } -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{12} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a0fdb8f0f85bb51e, []int{13} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func init() { proto.RegisterType((*QueryRawCheckpointListRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointListRequest") proto.RegisterType((*QueryRawCheckpointListResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointListResponse") proto.RegisterType((*QueryRawCheckpointRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointRequest") proto.RegisterType((*QueryRawCheckpointResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointResponse") + proto.RegisterType((*QueryRawCheckpointsRequest)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsRequest") + proto.RegisterType((*QueryRawCheckpointsResponse)(nil), "babylon.checkpointing.v1.QueryRawCheckpointsResponse") proto.RegisterType((*QueryBlsPublicKeyListRequest)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeyListRequest") proto.RegisterType((*QueryBlsPublicKeyListResponse)(nil), "babylon.checkpointing.v1.QueryBlsPublicKeyListResponse") proto.RegisterType((*QueryEpochStatusRequest)(nil), "babylon.checkpointing.v1.QueryEpochStatusRequest") @@ -732,75 +758,73 @@ func init() { proto.RegisterMapType((map[string]uint64)(nil), "babylon.checkpointing.v1.QueryRecentEpochStatusCountResponse.StatusCountEntry") proto.RegisterType((*QueryLastCheckpointWithStatusRequest)(nil), "babylon.checkpointing.v1.QueryLastCheckpointWithStatusRequest") proto.RegisterType((*QueryLastCheckpointWithStatusResponse)(nil), "babylon.checkpointing.v1.QueryLastCheckpointWithStatusResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "babylon.checkpointing.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "babylon.checkpointing.v1.QueryParamsResponse") -} - -func init() { proto.RegisterFile("babylon/checkpointing/query.proto", fileDescriptor_a0fdb8f0f85bb51e) } - -var fileDescriptor_a0fdb8f0f85bb51e = []byte{ - // 974 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x5f, 0x6f, 0xdb, 0x54, - 0x14, 0xaf, 0xd3, 0xad, 0xa2, 0x27, 0xac, 0x94, 0x4b, 0xc5, 0x82, 0x37, 0xb2, 0xe2, 0xc1, 0x56, - 0x4d, 0xd4, 0x56, 0xd2, 0xbf, 0x2a, 0x5b, 0x91, 0x32, 0x15, 0x1e, 0x36, 0x4a, 0x31, 0x62, 0x20, - 0x1e, 0x88, 0x6e, 0xbc, 0xab, 0xc4, 0xd4, 0xf1, 0x75, 0x73, 0xaf, 0x53, 0xa2, 0x69, 0x2f, 0xf0, - 0x01, 0x40, 0x42, 0xe2, 0x4b, 0xf0, 0xc4, 0x1b, 0x6f, 0x48, 0xf0, 0xb2, 0x07, 0x84, 0x26, 0xf1, - 0x82, 0x84, 0x84, 0x50, 0xcb, 0x07, 0x41, 0xbe, 0xf7, 0xba, 0x89, 0x9d, 0x78, 0x4e, 0xba, 0xbc, - 0xd9, 0xc7, 0xe7, 0x77, 0xce, 0xef, 0x77, 0xee, 0xb9, 0xe7, 0x24, 0xf0, 0x46, 0x03, 0x37, 0x7a, - 0x1e, 0xf5, 0x2d, 0xa7, 0x45, 0x9c, 0xc3, 0x80, 0xba, 0x3e, 0x77, 0xfd, 0xa6, 0x75, 0x14, 0x92, - 0x4e, 0xcf, 0x0c, 0x3a, 0x94, 0x53, 0x54, 0x52, 0x2e, 0x66, 0xc2, 0xc5, 0xec, 0x56, 0xf4, 0xeb, - 0xa3, 0xc1, 0x0d, 0x8f, 0xd5, 0x0f, 0x89, 0x82, 0xeb, 0xb7, 0x1c, 0xca, 0xda, 0x94, 0x59, 0x0d, - 0xcc, 0x88, 0x8c, 0x6b, 0x75, 0x2b, 0x0d, 0xc2, 0x71, 0xc5, 0x0a, 0x70, 0xd3, 0xf5, 0x31, 0x77, - 0xa9, 0xaf, 0x7c, 0x97, 0x9a, 0xb4, 0x49, 0xc5, 0xa3, 0x15, 0x3d, 0x29, 0xeb, 0xd5, 0x26, 0xa5, - 0x4d, 0x8f, 0x58, 0x38, 0x70, 0x2d, 0xec, 0xfb, 0x94, 0x0b, 0x08, 0x53, 0x5f, 0x8d, 0xd1, 0x24, - 0x02, 0xdc, 0xc1, 0xed, 0xd8, 0xe7, 0xc6, 0x68, 0x9f, 0xfe, 0x9b, 0xf4, 0x33, 0x7e, 0xd4, 0xe0, - 0xf5, 0x8f, 0x22, 0x8a, 0x36, 0x3e, 0xbe, 0x7b, 0xf6, 0xf1, 0xbe, 0xcb, 0xb8, 0x4d, 0x8e, 0x42, - 0xc2, 0x38, 0xaa, 0xc1, 0x1c, 0xe3, 0x98, 0x87, 0xac, 0xa4, 0x2d, 0x6b, 0x2b, 0x0b, 0xd5, 0x5b, - 0x66, 0x56, 0x75, 0xcc, 0x7e, 0x80, 0x8f, 0x05, 0xc2, 0x56, 0x48, 0xf4, 0x1e, 0x40, 0x5f, 0x79, - 0xa9, 0xb0, 0xac, 0xad, 0x14, 0xab, 0x37, 0x4c, 0x59, 0x26, 0x33, 0x2a, 0x93, 0x29, 0xcb, 0xaf, - 0xca, 0x64, 0x1e, 0xe0, 0x26, 0x51, 0xf9, 0xed, 0x01, 0xa4, 0xf1, 0x9b, 0x06, 0xe5, 0x2c, 0xb6, - 0x2c, 0xa0, 0x3e, 0x23, 0xe8, 0x33, 0x78, 0xa9, 0x83, 0x8f, 0xeb, 0x7d, 0x6e, 0x11, 0xef, 0xd9, - 0x95, 0x62, 0xd5, 0xca, 0xe6, 0x9d, 0x88, 0xf6, 0xa9, 0xcb, 0x5b, 0x1f, 0x10, 0x8e, 0xed, 0x85, - 0xce, 0xa0, 0x99, 0xa1, 0xf7, 0x47, 0x88, 0xb8, 0x99, 0x2b, 0x42, 0xd2, 0x4a, 0xa8, 0xd8, 0x86, - 0xd7, 0x86, 0x45, 0xc4, 0xe5, 0xbe, 0x02, 0xf3, 0x24, 0xa0, 0x4e, 0xab, 0xee, 0x87, 0x6d, 0x51, - 0xf1, 0x0b, 0xf6, 0x0b, 0xc2, 0xb0, 0x1f, 0xb6, 0x0d, 0x0e, 0xfa, 0x28, 0xa4, 0x92, 0xfe, 0x00, - 0x16, 0x92, 0xd2, 0x05, 0xfe, 0x1c, 0xca, 0x2f, 0x25, 0x94, 0x1b, 0xdf, 0x68, 0x70, 0x55, 0xa4, - 0xad, 0x79, 0xec, 0x20, 0x6c, 0x78, 0xae, 0x73, 0x8f, 0xf4, 0x06, 0x5b, 0xe4, 0x59, 0x9c, 0xa7, - 0x76, 0xf6, 0x7f, 0xc4, 0x9d, 0x3a, 0xcc, 0x42, 0xe9, 0x7f, 0x08, 0x97, 0xbb, 0xd8, 0x73, 0x1f, - 0x62, 0x4e, 0x3b, 0xf5, 0x63, 0x97, 0xb7, 0xea, 0xea, 0x5e, 0xc6, 0x2d, 0xb0, 0x9a, 0x5d, 0x88, - 0x07, 0x31, 0x30, 0x2a, 0x42, 0xcd, 0x63, 0xf7, 0x48, 0xcf, 0x5e, 0xea, 0x0e, 0x1b, 0xa7, 0xd8, - 0x06, 0x9b, 0x70, 0x59, 0xe8, 0xd9, 0x8b, 0x2a, 0xa5, 0x2e, 0xcc, 0x38, 0x4d, 0xf0, 0x05, 0x94, - 0x86, 0x71, 0xaa, 0x04, 0x53, 0xb8, 0xac, 0xc6, 0x1e, 0x18, 0xb2, 0xc9, 0x88, 0x43, 0x7c, 0x3e, - 0x90, 0xe5, 0x2e, 0x0d, 0xfb, 0x7d, 0x7a, 0x0d, 0x8a, 0x92, 0xa2, 0x13, 0x59, 0x15, 0x49, 0x10, - 0x26, 0xe1, 0x67, 0xfc, 0x50, 0x80, 0xeb, 0xcf, 0x8c, 0xa3, 0x28, 0x5f, 0x81, 0x79, 0xee, 0x06, - 0x75, 0x81, 0x8c, 0xb5, 0x72, 0x37, 0x10, 0xfe, 0xe9, 0x2c, 0x85, 0x74, 0x16, 0x74, 0x04, 0x2f, - 0x4a, 0xda, 0xca, 0x63, 0x56, 0x1c, 0xf4, 0x7e, 0xb6, 0xec, 0x31, 0x28, 0x99, 0x03, 0xb6, 0x3d, - 0x9f, 0x77, 0x7a, 0x76, 0x91, 0xf5, 0x2d, 0xfa, 0x2e, 0x2c, 0xa6, 0x1d, 0xd0, 0x22, 0xcc, 0x1e, - 0x92, 0x9e, 0xa0, 0x3f, 0x6f, 0x47, 0x8f, 0x68, 0x09, 0x2e, 0x76, 0xb1, 0x17, 0x12, 0xc5, 0x59, - 0xbe, 0xec, 0x14, 0xb6, 0x35, 0xe3, 0x4b, 0x78, 0x53, 0x90, 0xb8, 0x8f, 0x19, 0x4f, 0x5e, 0xbe, - 0x64, 0x13, 0x4c, 0xe3, 0x2c, 0x8f, 0xe1, 0xad, 0x9c, 0x5c, 0xea, 0x14, 0xf6, 0x33, 0x66, 0xc7, - 0xcd, 0x31, 0x67, 0x47, 0x7a, 0x66, 0x2c, 0x01, 0x12, 0x89, 0x0f, 0xc4, 0x52, 0x52, 0x92, 0x8c, - 0x4f, 0xe0, 0x95, 0x84, 0x55, 0x25, 0xdf, 0x85, 0x39, 0xb9, 0xbc, 0x54, 0xd2, 0xe5, 0xec, 0xa4, - 0x12, 0x59, 0xbb, 0xf0, 0xe4, 0x9f, 0x6b, 0x33, 0xb6, 0x42, 0x55, 0x7f, 0x01, 0xb8, 0x28, 0xe2, - 0xa2, 0x5f, 0x35, 0x78, 0x79, 0x68, 0x37, 0xa0, 0xad, 0xbc, 0x76, 0xc8, 0xd8, 0x7d, 0xfa, 0xf6, - 0xe4, 0x40, 0x29, 0xc9, 0xd8, 0xf9, 0xfa, 0xcf, 0xff, 0xbe, 0x2f, 0xac, 0xa3, 0xaa, 0x35, 0x7a, - 0x11, 0x77, 0x2b, 0x56, 0x6a, 0x4d, 0x59, 0x8f, 0xe4, 0x99, 0x3d, 0x46, 0x3f, 0x6b, 0x70, 0x29, - 0x11, 0x19, 0xad, 0x4d, 0xc2, 0x23, 0x26, 0xbf, 0x3e, 0x19, 0x48, 0x11, 0xbf, 0x2d, 0x88, 0x6f, - 0xa2, 0xf5, 0x71, 0x89, 0x5b, 0x8f, 0xce, 0x46, 0xd5, 0xe3, 0xa8, 0xfe, 0x8b, 0xe9, 0xf9, 0x8c, - 0x36, 0x73, 0x88, 0x64, 0xac, 0x15, 0x7d, 0x6b, 0x62, 0x9c, 0xd2, 0x70, 0x47, 0x68, 0xd8, 0x42, - 0x1b, 0xd9, 0x1a, 0xa2, 0xcd, 0x10, 0x08, 0xb0, 0x58, 0x10, 0x09, 0x11, 0x3f, 0x69, 0x50, 0x1c, - 0x98, 0x0d, 0xa8, 0x92, 0xc3, 0x63, 0x78, 0x80, 0xeb, 0xd5, 0x49, 0x20, 0x8a, 0xf5, 0x3b, 0x82, - 0xf5, 0x06, 0x5a, 0xcb, 0x66, 0x2d, 0x48, 0x26, 0xc8, 0x5a, 0xea, 0x17, 0xd6, 0xef, 0x1a, 0xbc, - 0x3a, 0x7a, 0xaa, 0xa1, 0xdb, 0xe7, 0x1c, 0x86, 0x52, 0xc9, 0x9d, 0xe7, 0x1a, 0xa5, 0xc6, 0x86, - 0x10, 0x65, 0xa1, 0xd5, 0x3c, 0x51, 0x3b, 0x83, 0x63, 0x1c, 0xfd, 0xad, 0x41, 0x29, 0x6b, 0x66, - 0xa1, 0xdd, 0x1c, 0x4a, 0x39, 0x83, 0x55, 0x7f, 0xf7, 0xdc, 0x78, 0x25, 0x6a, 0x57, 0x88, 0xda, - 0x46, 0x9b, 0xd9, 0xa2, 0x3c, 0xcc, 0x78, 0x3d, 0x7d, 0x51, 0xe2, 0x0b, 0xfe, 0xad, 0x06, 0x73, - 0x72, 0x90, 0xa1, 0xb7, 0x73, 0xb8, 0x24, 0xe6, 0xa7, 0xbe, 0x3a, 0xa6, 0xb7, 0xe2, 0xb9, 0x22, - 0x78, 0x1a, 0x68, 0x39, 0x9b, 0xa7, 0x9c, 0xa0, 0xb5, 0x0f, 0x9f, 0x9c, 0x94, 0xb5, 0xa7, 0x27, - 0x65, 0xed, 0xdf, 0x93, 0xb2, 0xf6, 0xdd, 0x69, 0x79, 0xe6, 0xe9, 0x69, 0x79, 0xe6, 0xaf, 0xd3, - 0xf2, 0xcc, 0xe7, 0x1b, 0x4d, 0x97, 0xb7, 0xc2, 0x86, 0xe9, 0xd0, 0x76, 0x1c, 0xc5, 0x69, 0x61, - 0xd7, 0x3f, 0x0b, 0xf9, 0x55, 0x2a, 0x28, 0xef, 0x05, 0x84, 0x35, 0xe6, 0xc4, 0xdf, 0x8b, 0xb5, - 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x28, 0x98, 0x2f, 0x2c, 0x6e, 0x0d, 0x00, 0x00, +} + +func init() { + proto.RegisterFile("babylon/checkpointing/v1/query.proto", fileDescriptor_113f1ca5c3c2ca44) +} + +var fileDescriptor_113f1ca5c3c2ca44 = []byte{ + // 938 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x97, 0xd1, 0x6f, 0xdb, 0x44, + 0x1c, 0xc7, 0x7b, 0x29, 0x9b, 0xe8, 0x2f, 0xac, 0x94, 0xd3, 0xc4, 0x82, 0x3b, 0xc2, 0x64, 0xc6, + 0xd6, 0x0d, 0xcd, 0x56, 0xd2, 0xa6, 0x8d, 0xca, 0x56, 0xa4, 0x4c, 0x85, 0x87, 0x8d, 0x32, 0x8c, + 0x34, 0x10, 0x0f, 0x44, 0x67, 0xf7, 0x94, 0x98, 0x3a, 0xb6, 0x9b, 0x3b, 0x27, 0x44, 0xd3, 0x5e, + 0xe0, 0x1f, 0x40, 0x42, 0xe2, 0x9f, 0xe0, 0x05, 0xde, 0x78, 0x44, 0xf0, 0xc2, 0x03, 0x42, 0x93, + 0x78, 0x41, 0xe2, 0x65, 0x6a, 0xf9, 0x43, 0x90, 0xcf, 0xe7, 0x26, 0x76, 0xe2, 0x3a, 0x09, 0x79, + 0xe1, 0xad, 0x3d, 0xdf, 0xf7, 0x7e, 0x9f, 0xef, 0xef, 0x7c, 0xdf, 0x73, 0xe0, 0xba, 0x49, 0xcc, + 0x81, 0xe3, 0xb9, 0xba, 0xd5, 0xa6, 0xd6, 0x91, 0xef, 0xd9, 0x2e, 0xb7, 0xdd, 0x96, 0xde, 0xab, + 0xe8, 0xc7, 0x01, 0xed, 0x0e, 0x34, 0xbf, 0xeb, 0x71, 0x0f, 0x97, 0xe4, 0x2c, 0x2d, 0x31, 0x4b, + 0xeb, 0x55, 0x94, 0x1b, 0x99, 0x7a, 0xd3, 0x61, 0xcd, 0x23, 0x2a, 0x57, 0x50, 0x6e, 0x5b, 0x1e, + 0xeb, 0x78, 0x4c, 0x37, 0x09, 0xa3, 0xd1, 0xd2, 0x7a, 0xaf, 0x62, 0x52, 0x4e, 0x2a, 0xba, 0x4f, + 0x5a, 0xb6, 0x4b, 0xb8, 0xed, 0xb9, 0x72, 0xee, 0xd5, 0x96, 0xe7, 0xb5, 0x1c, 0xaa, 0x13, 0xdf, + 0xd6, 0x89, 0xeb, 0x7a, 0x5c, 0x3c, 0x64, 0xf2, 0xe9, 0xad, 0xcc, 0x8a, 0xc3, 0x81, 0x68, 0xaa, + 0xfa, 0x3d, 0x82, 0xd7, 0x3f, 0x0a, 0x6b, 0x19, 0xa4, 0x7f, 0xff, 0xec, 0xe1, 0x43, 0x9b, 0x71, + 0x83, 0x1e, 0x07, 0x94, 0x71, 0xdc, 0x80, 0x8b, 0x8c, 0x13, 0x1e, 0xb0, 0x12, 0xba, 0x86, 0x36, + 0x56, 0xab, 0xb7, 0xb5, 0x2c, 0xa7, 0xda, 0x70, 0x81, 0x8f, 0x85, 0xc2, 0x90, 0x4a, 0xfc, 0x1e, + 0xc0, 0xd0, 0x42, 0xa9, 0x70, 0x0d, 0x6d, 0x14, 0xab, 0x37, 0xb4, 0xc8, 0xaf, 0x16, 0xfa, 0xd5, + 0xa2, 0x56, 0x4a, 0xbf, 0xda, 0x23, 0xd2, 0xa2, 0xb2, 0xbe, 0x31, 0xa2, 0x54, 0x7f, 0x45, 0x50, + 0xce, 0xa2, 0x65, 0xbe, 0xe7, 0x32, 0x8a, 0x3f, 0x85, 0x97, 0xbb, 0xa4, 0xdf, 0x1c, 0xb2, 0x85, + 0xdc, 0xcb, 0x1b, 0xc5, 0xaa, 0x9e, 0xcd, 0x9d, 0x58, 0xed, 0x13, 0x9b, 0xb7, 0x3f, 0xa0, 0x9c, + 0x18, 0xab, 0xdd, 0xd1, 0x61, 0x86, 0xdf, 0x9f, 0x60, 0xe2, 0x66, 0xae, 0x89, 0x08, 0x2b, 0xe1, + 0xa2, 0x0e, 0xaf, 0x8d, 0x9b, 0x88, 0xdb, 0xbd, 0x0e, 0x2b, 0xd4, 0xf7, 0xac, 0x76, 0xd3, 0x0d, + 0x3a, 0xa2, 0xe3, 0x2f, 0x18, 0x2f, 0x8a, 0x81, 0x83, 0xa0, 0xa3, 0x72, 0x50, 0x26, 0x29, 0xa5, + 0xf5, 0xc7, 0xb0, 0x9a, 0xb4, 0x2e, 0xf4, 0x73, 0x38, 0xbf, 0x94, 0x70, 0xae, 0x1e, 0x4e, 0xaa, + 0xca, 0x62, 0xe0, 0xe4, 0xde, 0xa2, 0xb9, 0xf7, 0xf6, 0x67, 0x04, 0xeb, 0x13, 0xcb, 0xfc, 0x7f, + 0x36, 0xf6, 0x6b, 0x04, 0x57, 0x85, 0x85, 0x86, 0xc3, 0x1e, 0x05, 0xa6, 0x63, 0x5b, 0x0f, 0xe8, + 0x60, 0xf4, 0x2c, 0x9d, 0xb7, 0xb9, 0x0b, 0x3b, 0x24, 0x7f, 0xc4, 0x47, 0x7a, 0x9c, 0x42, 0xb6, + 0xf2, 0x10, 0xae, 0xf4, 0x88, 0x63, 0x1f, 0x12, 0xee, 0x75, 0x9b, 0x7d, 0x9b, 0xb7, 0x9b, 0x32, + 0x89, 0xe2, 0x96, 0xde, 0xc9, 0x6e, 0xe9, 0xe3, 0x58, 0x18, 0xb6, 0xb3, 0xe1, 0xb0, 0x07, 0x74, + 0x60, 0x5c, 0xee, 0x8d, 0x0f, 0x2e, 0xb0, 0xad, 0xdb, 0x70, 0x45, 0xf8, 0xd9, 0x0f, 0x3b, 0x25, + 0x93, 0x65, 0x9a, 0xd3, 0xf2, 0x39, 0x94, 0xc6, 0x75, 0xb2, 0x05, 0x0b, 0x48, 0x35, 0x75, 0x1f, + 0xd4, 0xe8, 0x85, 0xa5, 0x16, 0x75, 0xf9, 0x48, 0x95, 0xfb, 0x5e, 0x30, 0x3c, 0xd0, 0x6f, 0x40, + 0x31, 0x42, 0xb4, 0xc2, 0x51, 0x09, 0x09, 0x62, 0x48, 0xcc, 0x53, 0xbf, 0x2b, 0xc0, 0x9b, 0xe7, + 0xae, 0x23, 0x91, 0xd7, 0x61, 0x85, 0xdb, 0x7e, 0x53, 0x28, 0x63, 0xaf, 0xdc, 0xf6, 0xc5, 0xfc, + 0x74, 0x95, 0x42, 0xba, 0x0a, 0x3e, 0x86, 0x97, 0x22, 0x6c, 0x39, 0x63, 0x59, 0x6c, 0xf4, 0x41, + 0xb6, 0xed, 0x29, 0x90, 0xb4, 0x91, 0xb1, 0x7d, 0x97, 0x77, 0x07, 0x46, 0x91, 0x0d, 0x47, 0x94, + 0x3d, 0x58, 0x4b, 0x4f, 0xc0, 0x6b, 0xb0, 0x7c, 0x44, 0x07, 0x02, 0x7f, 0xc5, 0x08, 0xff, 0xc4, + 0x97, 0xe1, 0x42, 0x8f, 0x38, 0x01, 0x95, 0xcc, 0xd1, 0x3f, 0xbb, 0x85, 0x3a, 0x52, 0xbf, 0x80, + 0xeb, 0x02, 0xe2, 0x21, 0x61, 0x3c, 0x79, 0x8c, 0x93, 0x2f, 0xc1, 0x22, 0xf6, 0xb2, 0x0f, 0x6f, + 0xe5, 0xd4, 0x92, 0xbb, 0x70, 0x90, 0x11, 0xb2, 0x37, 0xa7, 0x4c, 0xa1, 0x54, 0xb8, 0x56, 0x9f, + 0x03, 0x5c, 0x10, 0x95, 0xf1, 0x2f, 0x08, 0x5e, 0x19, 0xbb, 0xd7, 0xf0, 0x4e, 0xde, 0x0e, 0x65, + 0xdc, 0xdb, 0x4a, 0x7d, 0x76, 0x61, 0x64, 0x51, 0xdd, 0xfd, 0xea, 0xcf, 0x7f, 0xbe, 0x2d, 0x6c, + 0xe1, 0xaa, 0x9e, 0xf9, 0x1d, 0x91, 0x4a, 0x62, 0xfd, 0x49, 0xd4, 0xc6, 0xa7, 0xf8, 0x27, 0x04, + 0x97, 0x12, 0x2b, 0xe3, 0xcd, 0x59, 0x38, 0x62, 0xf8, 0xad, 0xd9, 0x44, 0x12, 0xfc, 0xae, 0x00, + 0xdf, 0xc6, 0x5b, 0xd3, 0x82, 0xeb, 0x4f, 0xce, 0xd2, 0xe3, 0x29, 0xfe, 0x01, 0xc1, 0x6a, 0xf2, + 0xee, 0xc1, 0x33, 0x61, 0xc4, 0xef, 0xa3, 0x52, 0x9b, 0x51, 0x25, 0xe9, 0x2b, 0x82, 0xfe, 0x6d, + 0x7c, 0x6b, 0xea, 0xb6, 0x87, 0xaf, 0xcc, 0x5a, 0x3a, 0xe5, 0xf1, 0x76, 0x4e, 0xf9, 0x8c, 0xcb, + 0x49, 0xd9, 0x99, 0x59, 0x27, 0xc1, 0xef, 0x09, 0xf0, 0x1d, 0x5c, 0xd3, 0xcf, 0xfd, 0xd2, 0xf5, + 0x85, 0x58, 0x5c, 0x33, 0x89, 0xbe, 0xff, 0x88, 0xa0, 0x38, 0x92, 0x30, 0xb8, 0x92, 0xc3, 0x31, + 0x7e, 0x0d, 0x28, 0xd5, 0x59, 0x24, 0x92, 0xfa, 0x1d, 0x41, 0x5d, 0xc3, 0x9b, 0xd9, 0xd4, 0x02, + 0x32, 0x01, 0xab, 0xcb, 0x0f, 0xda, 0xdf, 0x11, 0xbc, 0x3a, 0x39, 0x1b, 0xf1, 0xdd, 0x39, 0x23, + 0x35, 0x72, 0x72, 0xef, 0x3f, 0x05, 0xb2, 0x5a, 0x13, 0xa6, 0x74, 0x7c, 0x27, 0xcf, 0xd4, 0xee, + 0xe8, 0x65, 0x80, 0xff, 0x46, 0x50, 0xca, 0x4a, 0x3e, 0xbc, 0x97, 0x83, 0x94, 0x13, 0xcf, 0xca, + 0xbb, 0x73, 0xeb, 0xa5, 0xa9, 0x3d, 0x61, 0xaa, 0x8e, 0xb7, 0xb3, 0x4d, 0x39, 0x84, 0xf1, 0x66, + 0xfa, 0x6c, 0xcb, 0x4c, 0x6a, 0x7c, 0xf8, 0xdb, 0x49, 0x19, 0x3d, 0x3b, 0x29, 0xa3, 0xe7, 0x27, + 0x65, 0xf4, 0xcd, 0x69, 0x79, 0xe9, 0xd9, 0x69, 0x79, 0xe9, 0xaf, 0xd3, 0xf2, 0xd2, 0x67, 0xb5, + 0x96, 0xcd, 0xdb, 0x81, 0xa9, 0x59, 0x5e, 0x27, 0x5e, 0xdb, 0x6a, 0x13, 0xdb, 0x3d, 0x2b, 0xf4, + 0x65, 0xaa, 0x14, 0x1f, 0xf8, 0x94, 0x99, 0x17, 0xc5, 0x6f, 0xa7, 0xcd, 0x7f, 0x03, 0x00, 0x00, + 0xff, 0xff, 0x27, 0x4c, 0x94, 0xaf, 0x1a, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -819,16 +843,19 @@ type QueryClient interface { RawCheckpointList(ctx context.Context, in *QueryRawCheckpointListRequest, opts ...grpc.CallOption) (*QueryRawCheckpointListResponse, error) // RawCheckpoint queries a checkpoints at a given epoch number. RawCheckpoint(ctx context.Context, in *QueryRawCheckpointRequest, opts ...grpc.CallOption) (*QueryRawCheckpointResponse, error) - // BlsPublicKeyList queries a list of bls public keys of the validators at a given epoch number. + // RawCheckpoints queries checkpoints for a epoch range specified in pagination params. + RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) + // BlsPublicKeyList queries a list of bls public keys of the validators at a + // given epoch number. BlsPublicKeyList(ctx context.Context, in *QueryBlsPublicKeyListRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeyListResponse, error) // EpochStatus queries the status of the checkpoint at a given epoch EpochStatus(ctx context.Context, in *QueryEpochStatusRequest, opts ...grpc.CallOption) (*QueryEpochStatusResponse, error) - // RecentEpochStatusCount queries the number of epochs with each status in recent epochs + // RecentEpochStatusCount queries the number of epochs with each status in + // recent epochs RecentEpochStatusCount(ctx context.Context, in *QueryRecentEpochStatusCountRequest, opts ...grpc.CallOption) (*QueryRecentEpochStatusCountResponse, error) - // LastCheckpointWithStatus queries the last checkpoint with a given status or a more matured status + // LastCheckpointWithStatus queries the last checkpoint with a given status or + // a more matured status LastCheckpointWithStatus(ctx context.Context, in *QueryLastCheckpointWithStatusRequest, opts ...grpc.CallOption) (*QueryLastCheckpointWithStatusResponse, error) - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } type queryClient struct { @@ -857,6 +884,15 @@ func (c *queryClient) RawCheckpoint(ctx context.Context, in *QueryRawCheckpointR return out, nil } +func (c *queryClient) RawCheckpoints(ctx context.Context, in *QueryRawCheckpointsRequest, opts ...grpc.CallOption) (*QueryRawCheckpointsResponse, error) { + out := new(QueryRawCheckpointsResponse) + err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/RawCheckpoints", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) BlsPublicKeyList(ctx context.Context, in *QueryBlsPublicKeyListRequest, opts ...grpc.CallOption) (*QueryBlsPublicKeyListResponse, error) { out := new(QueryBlsPublicKeyListResponse) err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/BlsPublicKeyList", in, out, opts...) @@ -893,31 +929,25 @@ func (c *queryClient) LastCheckpointWithStatus(ctx context.Context, in *QueryLas return out, nil } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/babylon.checkpointing.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - // QueryServer is the server API for Query service. type QueryServer interface { // RawCheckpointList queries all checkpoints that match the given status. RawCheckpointList(context.Context, *QueryRawCheckpointListRequest) (*QueryRawCheckpointListResponse, error) // RawCheckpoint queries a checkpoints at a given epoch number. RawCheckpoint(context.Context, *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) - // BlsPublicKeyList queries a list of bls public keys of the validators at a given epoch number. + // RawCheckpoints queries checkpoints for a epoch range specified in pagination params. + RawCheckpoints(context.Context, *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) + // BlsPublicKeyList queries a list of bls public keys of the validators at a + // given epoch number. BlsPublicKeyList(context.Context, *QueryBlsPublicKeyListRequest) (*QueryBlsPublicKeyListResponse, error) // EpochStatus queries the status of the checkpoint at a given epoch EpochStatus(context.Context, *QueryEpochStatusRequest) (*QueryEpochStatusResponse, error) - // RecentEpochStatusCount queries the number of epochs with each status in recent epochs + // RecentEpochStatusCount queries the number of epochs with each status in + // recent epochs RecentEpochStatusCount(context.Context, *QueryRecentEpochStatusCountRequest) (*QueryRecentEpochStatusCountResponse, error) - // LastCheckpointWithStatus queries the last checkpoint with a given status or a more matured status + // LastCheckpointWithStatus queries the last checkpoint with a given status or + // a more matured status LastCheckpointWithStatus(context.Context, *QueryLastCheckpointWithStatusRequest) (*QueryLastCheckpointWithStatusResponse, error) - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -930,6 +960,9 @@ func (*UnimplementedQueryServer) RawCheckpointList(ctx context.Context, req *Que func (*UnimplementedQueryServer) RawCheckpoint(ctx context.Context, req *QueryRawCheckpointRequest) (*QueryRawCheckpointResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoint not implemented") } +func (*UnimplementedQueryServer) RawCheckpoints(ctx context.Context, req *QueryRawCheckpointsRequest) (*QueryRawCheckpointsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RawCheckpoints not implemented") +} func (*UnimplementedQueryServer) BlsPublicKeyList(ctx context.Context, req *QueryBlsPublicKeyListRequest) (*QueryBlsPublicKeyListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method BlsPublicKeyList not implemented") } @@ -942,9 +975,6 @@ func (*UnimplementedQueryServer) RecentEpochStatusCount(ctx context.Context, req func (*UnimplementedQueryServer) LastCheckpointWithStatus(ctx context.Context, req *QueryLastCheckpointWithStatusRequest) (*QueryLastCheckpointWithStatusResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LastCheckpointWithStatus not implemented") } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -986,6 +1016,24 @@ func _Query_RawCheckpoint_Handler(srv interface{}, ctx context.Context, dec func return interceptor(ctx, in, info, handler) } +func _Query_RawCheckpoints_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryRawCheckpointsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).RawCheckpoints(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.checkpointing.v1.Query/RawCheckpoints", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).RawCheckpoints(ctx, req.(*QueryRawCheckpointsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_BlsPublicKeyList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryBlsPublicKeyListRequest) if err := dec(in); err != nil { @@ -1058,24 +1106,6 @@ func _Query_LastCheckpointWithStatus_Handler(srv interface{}, ctx context.Contex return interceptor(ctx, in, info, handler) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/babylon.checkpointing.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.checkpointing.v1.Query", HandlerType: (*QueryServer)(nil), @@ -1088,6 +1118,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "RawCheckpoint", Handler: _Query_RawCheckpoint_Handler, }, + { + MethodName: "RawCheckpoints", + Handler: _Query_RawCheckpoints_Handler, + }, { MethodName: "BlsPublicKeyList", Handler: _Query_BlsPublicKeyList_Handler, @@ -1104,13 +1138,9 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "LastCheckpointWithStatus", Handler: _Query_LastCheckpointWithStatus_Handler, }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/checkpointing/query.proto", + Metadata: "babylon/checkpointing/v1/query.proto", } func (m *QueryRawCheckpointListRequest) Marshal() (dAtA []byte, err error) { @@ -1265,6 +1295,90 @@ func (m *QueryRawCheckpointResponse) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } +func (m *QueryRawCheckpointsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryRawCheckpointsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *QueryRawCheckpointsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryRawCheckpointsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryRawCheckpointsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Pagination != nil { + { + size, err := m.Pagination.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.RawCheckpoints) > 0 { + for iNdEx := len(m.RawCheckpoints) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.RawCheckpoints[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + func (m *QueryBlsPublicKeyListRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1551,69 +1665,13 @@ func (m *QueryLastCheckpointWithStatusResponse) MarshalToSizedBuffer(dAtA []byte return len(dAtA) - i, nil } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } dAtA[offset] = uint8(v) return base @@ -1678,6 +1736,38 @@ func (m *QueryRawCheckpointResponse) Size() (n int) { return n } +func (m *QueryRawCheckpointsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + +func (m *QueryRawCheckpointsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.RawCheckpoints) > 0 { + for _, e := range m.RawCheckpoints { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + if m.Pagination != nil { + l = m.Pagination.Size() + n += 1 + l + sovQuery(uint64(l)) + } + return n +} + func (m *QueryBlsPublicKeyListRequest) Size() (n int) { if m == nil { return 0 @@ -1797,26 +1887,6 @@ func (m *QueryLastCheckpointWithStatusResponse) Size() (n int) { return n } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2203,6 +2273,212 @@ func (m *QueryRawCheckpointResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryRawCheckpointsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryRawCheckpointsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageRequest{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryRawCheckpointsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryRawCheckpointsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryRawCheckpointsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoints", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RawCheckpoints = append(m.RawCheckpoints, &RawCheckpointWithMeta{}) + if err := m.RawCheckpoints[len(m.RawCheckpoints)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Pagination == nil { + m.Pagination = &query.PageResponse{} + } + if err := m.Pagination.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryBlsPublicKeyListRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2991,139 +3267,6 @@ func (m *QueryLastCheckpointWithStatusResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/checkpointing/types/query.pb.gw.go b/x/checkpointing/types/query.pb.gw.go index 833886136..7914c5bba 100644 --- a/x/checkpointing/types/query.pb.gw.go +++ b/x/checkpointing/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: babylon/checkpointing/query.proto +// source: babylon/checkpointing/v1/query.proto /* Package types is a reverse proxy. @@ -165,6 +165,42 @@ func local_request_Query_RawCheckpoint_0(ctx context.Context, marshaler runtime. } +var ( + filter_Query_RawCheckpoints_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.RawCheckpoints(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_RawCheckpoints_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryRawCheckpointsRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_RawCheckpoints_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.RawCheckpoints(ctx, &protoReq) + return msg, metadata, err + +} + var ( filter_Query_BlsPublicKeyList_0 = &utilities.DoubleArray{Encoding: map[string]int{"epoch_num": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} ) @@ -387,24 +423,6 @@ func local_request_Query_LastCheckpointWithStatus_0(ctx context.Context, marshal } -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -457,7 +475,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_BlsPublicKeyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -468,7 +486,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_BlsPublicKeyList_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RawCheckpoints_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -476,11 +494,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_BlsPublicKeyList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_EpochStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlsPublicKeyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -491,7 +509,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_EpochStatus_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_BlsPublicKeyList_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -499,11 +517,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_EpochStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlsPublicKeyList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RecentEpochStatusCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EpochStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -514,7 +532,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_RecentEpochStatusCount_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EpochStatus_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -522,11 +540,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_RecentEpochStatusCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EpochStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_LastCheckpointWithStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RecentEpochStatusCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -537,7 +555,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_LastCheckpointWithStatus_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_RecentEpochStatusCount_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -545,11 +563,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_LastCheckpointWithStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RecentEpochStatusCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LastCheckpointWithStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -560,7 +578,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_LastCheckpointWithStatus_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -568,7 +586,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LastCheckpointWithStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -653,7 +671,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_BlsPublicKeyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RawCheckpoints_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -662,18 +680,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_BlsPublicKeyList_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RawCheckpoints_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_BlsPublicKeyList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RawCheckpoints_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_EpochStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_BlsPublicKeyList_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -682,18 +700,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_EpochStatus_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_BlsPublicKeyList_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_EpochStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_BlsPublicKeyList_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_RecentEpochStatusCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EpochStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -702,18 +720,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_RecentEpochStatusCount_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_EpochStatus_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_RecentEpochStatusCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EpochStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_LastCheckpointWithStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_RecentEpochStatusCount_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -722,18 +740,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_LastCheckpointWithStatus_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_RecentEpochStatusCount_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_LastCheckpointWithStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_RecentEpochStatusCount_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_LastCheckpointWithStatus_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -742,14 +760,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_LastCheckpointWithStatus_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_LastCheckpointWithStatus_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -761,6 +779,8 @@ var ( pattern_Query_RawCheckpoint_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "raw_checkpoint", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_RawCheckpoints_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "raw_checkpoints"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_BlsPublicKeyList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "bls_public_keys", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_EpochStatus_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", "checkpointing", "v1", "epochs", "epoch_num", "status"}, "", runtime.AssumeColonVerbOpt(false))) @@ -768,8 +788,6 @@ var ( pattern_Query_RecentEpochStatusCount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "epochs"}, "status_count", runtime.AssumeColonVerbOpt(false))) pattern_Query_LastCheckpointWithStatus_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "checkpointing", "v1", "last_raw_checkpoint", "status"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "checkpointing", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( @@ -777,6 +795,8 @@ var ( forward_Query_RawCheckpoint_0 = runtime.ForwardResponseMessage + forward_Query_RawCheckpoints_0 = runtime.ForwardResponseMessage + forward_Query_BlsPublicKeyList_0 = runtime.ForwardResponseMessage forward_Query_EpochStatus_0 = runtime.ForwardResponseMessage @@ -784,6 +804,4 @@ var ( forward_Query_RecentEpochStatusCount_0 = runtime.ForwardResponseMessage forward_Query_LastCheckpointWithStatus_0 = runtime.ForwardResponseMessage - - forward_Query_Params_0 = runtime.ForwardResponseMessage ) diff --git a/x/checkpointing/types/tx.pb.go b/x/checkpointing/types/tx.pb.go index 2fab4a133..83b25f08a 100644 --- a/x/checkpointing/types/tx.pb.go +++ b/x/checkpointing/types/tx.pb.go @@ -1,15 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/checkpointing/tx.proto +// source: babylon/checkpointing/v1/tx.proto package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/x/staking/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -32,14 +33,18 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgAddBlsSig defines a message to add a bls signature from a // validator type MsgAddBlsSig struct { - BlsSig *BlsSig `protobuf:"bytes,1,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` + // signer corresponds to the submitter of the transaction + // This might be a different entity compared to the one that created the BLS signature + // (i.e. the validator owner of the BLS key which is specified by the `bls_sig.signer_address`) + Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + BlsSig *BlsSig `protobuf:"bytes,2,opt,name=bls_sig,json=blsSig,proto3" json:"bls_sig,omitempty"` } func (m *MsgAddBlsSig) Reset() { *m = MsgAddBlsSig{} } func (m *MsgAddBlsSig) String() string { return proto.CompactTextString(m) } func (*MsgAddBlsSig) ProtoMessage() {} func (*MsgAddBlsSig) Descriptor() ([]byte, []int) { - return fileDescriptor_24b023a97b92daa6, []int{0} + return fileDescriptor_6b16c54750152c21, []int{0} } func (m *MsgAddBlsSig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -76,7 +81,7 @@ func (m *MsgAddBlsSigResponse) Reset() { *m = MsgAddBlsSigResponse{} } func (m *MsgAddBlsSigResponse) String() string { return proto.CompactTextString(m) } func (*MsgAddBlsSigResponse) ProtoMessage() {} func (*MsgAddBlsSigResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_24b023a97b92daa6, []int{1} + return fileDescriptor_6b16c54750152c21, []int{1} } func (m *MsgAddBlsSigResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -115,7 +120,7 @@ func (m *MsgWrappedCreateValidator) Reset() { *m = MsgWrappedCreateValid func (m *MsgWrappedCreateValidator) String() string { return proto.CompactTextString(m) } func (*MsgWrappedCreateValidator) ProtoMessage() {} func (*MsgWrappedCreateValidator) Descriptor() ([]byte, []int) { - return fileDescriptor_24b023a97b92daa6, []int{2} + return fileDescriptor_6b16c54750152c21, []int{2} } func (m *MsgWrappedCreateValidator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -144,7 +149,8 @@ func (m *MsgWrappedCreateValidator) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWrappedCreateValidator proto.InternalMessageInfo -// MsgWrappedCreateValidatorResponse defines the MsgWrappedCreateValidator response type +// MsgWrappedCreateValidatorResponse defines the MsgWrappedCreateValidator +// response type type MsgWrappedCreateValidatorResponse struct { } @@ -152,7 +158,7 @@ func (m *MsgWrappedCreateValidatorResponse) Reset() { *m = MsgWrappedCre func (m *MsgWrappedCreateValidatorResponse) String() string { return proto.CompactTextString(m) } func (*MsgWrappedCreateValidatorResponse) ProtoMessage() {} func (*MsgWrappedCreateValidatorResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_24b023a97b92daa6, []int{3} + return fileDescriptor_6b16c54750152c21, []int{3} } func (m *MsgWrappedCreateValidatorResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -188,35 +194,38 @@ func init() { proto.RegisterType((*MsgWrappedCreateValidatorResponse)(nil), "babylon.checkpointing.v1.MsgWrappedCreateValidatorResponse") } -func init() { proto.RegisterFile("babylon/checkpointing/tx.proto", fileDescriptor_24b023a97b92daa6) } - -var fileDescriptor_24b023a97b92daa6 = []byte{ - // 399 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0xce, 0x48, 0x4d, 0xce, 0x2e, 0xc8, 0xcf, 0xcc, 0x2b, 0xc9, 0xcc, - 0x4b, 0xd7, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80, 0xca, 0xeb, 0xa1, - 0xc8, 0xeb, 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x15, 0xe9, 0x83, 0x58, 0x10, - 0xf5, 0x52, 0x6a, 0xd8, 0xcd, 0x43, 0xf0, 0xa0, 0xea, 0x94, 0xb1, 0xab, 0x4b, 0xca, 0x29, 0x8e, - 0xcf, 0x4e, 0xad, 0x84, 0x2a, 0x92, 0x4f, 0xce, 0x2f, 0xce, 0xcd, 0x2f, 0xd6, 0x2f, 0x2e, 0x49, - 0xcc, 0x06, 0xc9, 0x96, 0x19, 0x26, 0xa5, 0x96, 0x24, 0x1a, 0xc2, 0x5d, 0xa7, 0x14, 0xcc, 0xc5, - 0xe3, 0x5b, 0x9c, 0xee, 0x98, 0x92, 0xe2, 0x94, 0x53, 0x1c, 0x9c, 0x99, 0x2e, 0x64, 0xc9, 0xc5, - 0x0e, 0x32, 0xa1, 0x38, 0x33, 0x5d, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x41, 0x0f, 0x97, - 0xfb, 0xf5, 0x20, 0x5a, 0x82, 0xd8, 0x92, 0xc0, 0xb4, 0x15, 0x47, 0xc7, 0x02, 0x79, 0x86, 0x17, - 0x0b, 0xe4, 0x19, 0x94, 0xc4, 0xb8, 0x44, 0x90, 0x0d, 0x0d, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, - 0x4e, 0x55, 0xda, 0xce, 0xc8, 0x25, 0xe9, 0x5b, 0x9c, 0x1e, 0x5e, 0x94, 0x58, 0x50, 0x90, 0x9a, - 0xe2, 0x5c, 0x94, 0x9a, 0x58, 0x92, 0x1a, 0x96, 0x98, 0x93, 0x99, 0x92, 0x58, 0x92, 0x5f, 0x24, - 0x64, 0xc4, 0xc5, 0x9c, 0x9d, 0x5a, 0x49, 0x94, 0xb5, 0xde, 0xa9, 0x95, 0x41, 0x20, 0xc5, 0x42, - 0x31, 0x5c, 0x22, 0xb9, 0xc5, 0xe9, 0xf1, 0xc9, 0x60, 0xa3, 0xe2, 0xcb, 0x60, 0x66, 0x49, 0x30, - 0x81, 0x0d, 0xd1, 0xd2, 0x83, 0x78, 0x5f, 0x0f, 0xea, 0x7d, 0x3d, 0xa8, 0xf7, 0xf5, 0x7c, 0x8b, - 0xd3, 0xd1, 0x6c, 0x0f, 0x12, 0xca, 0xc5, 0x10, 0x43, 0xf2, 0x91, 0x32, 0x97, 0x22, 0x4e, 0x87, - 0xc3, 0xbc, 0x67, 0xf4, 0x9d, 0x91, 0x8b, 0xd9, 0xb7, 0x38, 0x5d, 0x28, 0x99, 0x8b, 0x13, 0x11, - 0xa0, 0x6a, 0xb8, 0x3d, 0x82, 0x1c, 0x46, 0x52, 0x7a, 0xc4, 0xa9, 0x83, 0x59, 0x26, 0xd4, 0xc5, - 0xc8, 0x25, 0x86, 0x23, 0x20, 0x8d, 0xf1, 0x1a, 0x85, 0x5d, 0x93, 0x94, 0x35, 0x19, 0x9a, 0x60, - 0x8e, 0x71, 0xf2, 0x3f, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, - 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xd3, 0xf4, - 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x05, 0xc9, 0x19, 0x89, 0x99, - 0x79, 0x30, 0x8e, 0x7e, 0x05, 0x7a, 0xbe, 0xa9, 0x2c, 0x48, 0x2d, 0x4e, 0x62, 0x03, 0xa7, 0x4e, - 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x0a, 0xe9, 0x81, 0x51, 0x5d, 0x03, 0x00, 0x00, +func init() { proto.RegisterFile("babylon/checkpointing/v1/tx.proto", fileDescriptor_6b16c54750152c21) } + +var fileDescriptor_6b16c54750152c21 = []byte{ + // 447 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x93, 0x4f, 0x6b, 0xd4, 0x40, + 0x18, 0xc6, 0x33, 0x16, 0x56, 0x3b, 0x7a, 0x1a, 0x96, 0x92, 0xe6, 0x90, 0xdd, 0xae, 0x50, 0xaa, + 0xe0, 0xc4, 0x6e, 0xf1, 0xa0, 0x9e, 0xba, 0x1e, 0x25, 0x08, 0x29, 0x28, 0x88, 0x10, 0x26, 0xc9, + 0x30, 0x3b, 0xe4, 0xcf, 0x84, 0xbc, 0xe3, 0xd2, 0x7c, 0x00, 0x41, 0x3c, 0xf9, 0x11, 0xfa, 0x21, + 0x04, 0xbf, 0x82, 0xc7, 0xe2, 0xc9, 0xa3, 0xec, 0x5e, 0xfc, 0x06, 0x5e, 0x65, 0x93, 0x09, 0xbb, + 0x56, 0xa3, 0xe2, 0x29, 0x99, 0x37, 0xbf, 0xf7, 0x7d, 0x9e, 0xf7, 0x49, 0x82, 0x0f, 0x22, 0x16, + 0xd5, 0x99, 0x2a, 0xbc, 0x78, 0xce, 0xe3, 0xb4, 0x54, 0xb2, 0xd0, 0xb2, 0x10, 0xde, 0xe2, 0xd8, + 0xd3, 0xe7, 0xb4, 0xac, 0x94, 0x56, 0xc4, 0x36, 0x08, 0xfd, 0x09, 0xa1, 0x8b, 0x63, 0x67, 0x28, + 0x94, 0x50, 0x0d, 0xe4, 0xad, 0xef, 0x5a, 0xde, 0xb9, 0xd3, 0x3b, 0x72, 0x53, 0x30, 0xe8, 0x61, + 0x2f, 0x1a, 0x65, 0x10, 0xa6, 0xbc, 0x36, 0xdc, 0x28, 0x56, 0x90, 0x2b, 0xf0, 0x40, 0xb3, 0xb4, + 0x05, 0x22, 0xae, 0xd9, 0xc6, 0xa3, 0xb3, 0xdf, 0x02, 0x61, 0x6b, 0xa6, 0x3d, 0xb4, 0x8f, 0x26, + 0x6f, 0x10, 0xbe, 0xe5, 0x83, 0x38, 0x4d, 0x92, 0x59, 0x06, 0x67, 0x52, 0x90, 0xfb, 0x78, 0x00, + 0x52, 0x14, 0xbc, 0xb2, 0xd1, 0x18, 0x1d, 0xed, 0xce, 0xec, 0xcf, 0x1f, 0xee, 0x0d, 0x4d, 0xcb, + 0x69, 0x92, 0x54, 0x1c, 0xe0, 0x4c, 0x57, 0xb2, 0x10, 0x81, 0xe1, 0xc8, 0x43, 0x7c, 0x7d, 0xed, + 0x07, 0xa4, 0xb0, 0xaf, 0x8d, 0xd1, 0xd1, 0xcd, 0xe9, 0x98, 0xf6, 0x65, 0x42, 0x5b, 0x91, 0x60, + 0x10, 0x35, 0xd7, 0x47, 0x37, 0xde, 0x5e, 0x8c, 0xac, 0x6f, 0x17, 0x23, 0x6b, 0xb2, 0x87, 0x87, + 0xdb, 0x36, 0x02, 0x0e, 0xa5, 0x2a, 0x80, 0x4f, 0x3e, 0x22, 0xbc, 0xef, 0x83, 0x78, 0x51, 0xb1, + 0xb2, 0xe4, 0xc9, 0x93, 0x8a, 0x33, 0xcd, 0x9f, 0xb3, 0x4c, 0x26, 0x4c, 0xab, 0x8a, 0x4c, 0xf1, + 0x4e, 0xca, 0xeb, 0xc6, 0xe9, 0xdf, 0x64, 0x9f, 0xf2, 0x3a, 0x58, 0xc3, 0xe4, 0x15, 0x1e, 0xe6, + 0x20, 0xc2, 0xb8, 0x19, 0x15, 0x2e, 0xba, 0x59, 0xc6, 0xfb, 0x5d, 0x6a, 0x76, 0x35, 0x61, 0x52, + 0x13, 0x26, 0xf5, 0x41, 0x5c, 0x51, 0x0f, 0x48, 0xfe, 0x4b, 0x6d, 0x6b, 0xa3, 0xdb, 0xf8, 0xa0, + 0xd7, 0x78, 0xb7, 0xde, 0xf4, 0x3b, 0xc2, 0x3b, 0x3e, 0x08, 0x12, 0xe3, 0xdd, 0xcd, 0x2b, 0x38, + 0xec, 0x5f, 0x64, 0x3b, 0x23, 0x87, 0xfe, 0x1b, 0xd7, 0x89, 0x91, 0x77, 0x08, 0xef, 0xf5, 0x04, + 0x79, 0xf2, 0xc7, 0x51, 0xbf, 0x6f, 0x72, 0x1e, 0xff, 0x47, 0x53, 0x67, 0x66, 0xf6, 0xec, 0xd3, + 0xd2, 0x45, 0x97, 0x4b, 0x17, 0x7d, 0x5d, 0xba, 0xe8, 0xfd, 0xca, 0xb5, 0x2e, 0x57, 0xae, 0xf5, + 0x65, 0xe5, 0x5a, 0x2f, 0x1f, 0x08, 0xa9, 0xe7, 0xaf, 0x23, 0x1a, 0xab, 0xdc, 0x33, 0x02, 0xf1, + 0x9c, 0xc9, 0xa2, 0x3b, 0x78, 0xe7, 0x57, 0x7e, 0x08, 0x5d, 0x97, 0x1c, 0xa2, 0x41, 0xf3, 0x41, + 0x9f, 0xfc, 0x08, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xef, 0x32, 0xf7, 0xb4, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -336,7 +345,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/checkpointing/tx.proto", + Metadata: "babylon/checkpointing/v1/tx.proto", } func (m *MsgAddBlsSig) Marshal() (dAtA []byte, err error) { @@ -369,6 +378,13 @@ func (m *MsgAddBlsSig) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintTx(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + } + if len(m.Signer) > 0 { + i -= len(m.Signer) + copy(dAtA[i:], m.Signer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + i-- dAtA[i] = 0xa } return len(dAtA) - i, nil @@ -484,6 +500,10 @@ func (m *MsgAddBlsSig) Size() (n int) { } var l int _ = l + l = len(m.Signer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } if m.BlsSig != nil { l = m.BlsSig.Size() n += 1 + l + sovTx(uint64(l)) @@ -562,6 +582,38 @@ func (m *MsgAddBlsSig) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Signer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field BlsSig", wireType) } diff --git a/x/checkpointing/types/types_test.go b/x/checkpointing/types/types_test.go index 3bfe4aa33..d6d06a1f3 100644 --- a/x/checkpointing/types/types_test.go +++ b/x/checkpointing/types/types_test.go @@ -1,24 +1,27 @@ package types_test import ( + "math/rand" "testing" + "time" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/stretchr/testify/require" "github.com/babylonchain/babylon/testutil/datagen" testkeeper "github.com/babylonchain/babylon/testutil/keeper" "github.com/babylonchain/babylon/x/checkpointing/types" - "github.com/cosmos/cosmos-sdk/client" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" ) // a single validator func TestRawCheckpointWithMeta_Accumulate1(t *testing.T) { + r := rand.New(rand.NewSource(time.Now().Unix())) epochNum := uint64(2) n := 1 totalPower := int64(10) ckptkeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, nil, nil, client.Context{}) - lch := datagen.GenRandomLastCommitHash() - msg := append(sdk.Uint64ToBigEndian(epochNum), lch...) + lch := datagen.GenRandomLastCommitHash(r) + msg := types.GetSignBytes(epochNum, lch) blsPubkeys, blsSigs := datagen.GenRandomPubkeysAndSigs(n, msg) ckpt, err := ckptkeeper.BuildRawCheckpoint(ctx, epochNum, lch) require.NoError(t, err) @@ -35,12 +38,13 @@ func TestRawCheckpointWithMeta_Accumulate1(t *testing.T) { // 4 validators func TestRawCheckpointWithMeta_Accumulate4(t *testing.T) { + r := rand.New(rand.NewSource(time.Now().Unix())) epochNum := uint64(2) n := 4 totalPower := int64(10) * int64(n) ckptkeeper, ctx, _ := testkeeper.CheckpointingKeeper(t, nil, nil, client.Context{}) - lch := datagen.GenRandomLastCommitHash() - msg := append(sdk.Uint64ToBigEndian(epochNum), lch...) + lch := datagen.GenRandomLastCommitHash(r) + msg := types.GetSignBytes(epochNum, lch) blsPubkeys, blsSigs := datagen.GenRandomPubkeysAndSigs(n, msg) ckpt, err := ckptkeeper.BuildRawCheckpoint(ctx, epochNum, lch) require.NoError(t, err) diff --git a/x/checkpointing/types/utils.go b/x/checkpointing/types/utils.go index 584037089..54b8b9dfd 100644 --- a/x/checkpointing/types/utils.go +++ b/x/checkpointing/types/utils.go @@ -3,10 +3,12 @@ package types import ( "bytes" "encoding/hex" + + "github.com/cometbft/cometbft/crypto/tmhash" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/babylonchain/babylon/btctxformatter" "github.com/babylonchain/babylon/crypto/bls12381" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto/tmhash" ) func (m BlsSig) Hash() BlsSigHash { @@ -116,3 +118,7 @@ func FromRawCkptToBTCCkpt(rawCkpt *RawCheckpoint, address []byte) (*btctxformatt return btcCkpt, nil } + +func GetSignBytes(epoch uint64, hash []byte) []byte { + return append(sdk.Uint64ToBigEndian(epoch), hash...) +} diff --git a/x/epoching/abci.go b/x/epoching/abci.go index e9e279eb7..a41acd104 100644 --- a/x/epoching/abci.go +++ b/x/epoching/abci.go @@ -7,20 +7,22 @@ import ( "github.com/babylonchain/babylon/x/epoching/keeper" "github.com/babylonchain/babylon/x/epoching/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" ) // BeginBlocker is called at the beginning of every block. // Upon each BeginBlock, // - record the current AppHash // - if reaching the epoch beginning, then -// - increment epoch number -// - trigger AfterEpochBegins hook -// - emit BeginEpoch event +// - increment epoch number +// - trigger AfterEpochBegins hook +// - emit BeginEpoch event +// // - if reaching the sealer header, i.e., the 2nd header of a non-zero epoch, then -// - record the sealer header for the previous epoch +// - record the sealer header for the previous epoch +// // NOTE: we follow Cosmos SDK's slashing/evidence modules for MVP. No need to modify them at the moment. func BeginBlocker(ctx sdk.Context, k keeper.Keeper, req abci.RequestBeginBlock) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) diff --git a/x/epoching/genesis.go b/x/epoching/genesis.go index 4176246b0..9cd920c89 100644 --- a/x/epoching/genesis.go +++ b/x/epoching/genesis.go @@ -10,7 +10,10 @@ import ( // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { // set params for this module - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(err) + } + // init epoch number k.InitEpoch(ctx) // init msg queue diff --git a/x/epoching/genesis_test.go b/x/epoching/genesis_test.go index d22687614..85a21d31f 100644 --- a/x/epoching/genesis_test.go +++ b/x/epoching/genesis_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/babylonchain/babylon/x/epoching" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" simapp "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/x/epoching/types" @@ -15,7 +15,10 @@ func TestExportGenesis(t *testing.T) { app := simapp.Setup(t, false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - app.EpochingKeeper.SetParams(ctx, types.DefaultParams()) + if err := app.EpochingKeeper.SetParams(ctx, types.DefaultParams()); err != nil { + panic(err) + } + genesisState := epoching.ExportGenesis(ctx, app.EpochingKeeper) require.Equal(t, genesisState.Params, types.DefaultParams()) } diff --git a/x/epoching/handler.go b/x/epoching/handler.go deleted file mode 100644 index 68539c222..000000000 --- a/x/epoching/handler.go +++ /dev/null @@ -1,35 +0,0 @@ -package epoching - -import ( - "fmt" - - "github.com/babylonchain/babylon/x/epoching/keeper" - "github.com/babylonchain/babylon/x/epoching/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewHandler handles messages for the epoching module -// TODO (non-urgent): after we bump to Cosmos SDK v0.46, add MsgCancelUnbondingDelegation -func NewHandler(k keeper.Keeper) sdk.Handler { - msgServer := keeper.NewMsgServerImpl(k) - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - ctx = ctx.WithEventManager(sdk.NewEventManager()) - - switch msg := msg.(type) { - case *types.MsgWrappedDelegate: - res, err := msgServer.WrappedDelegate(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgWrappedBeginRedelegate: - res, err := msgServer.WrappedBeginRedelegate(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - case *types.MsgWrappedUndelegate: - res, err := msgServer.WrappedUndelegate(sdk.WrapSDKContext(ctx), msg) - return sdk.WrapServiceResult(ctx, res, err) - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/epoching/keeper/apphash_chain.go b/x/epoching/keeper/apphash_chain.go index 1dae6cf57..511ebe336 100644 --- a/x/epoching/keeper/apphash_chain.go +++ b/x/epoching/keeper/apphash_chain.go @@ -4,12 +4,12 @@ import ( "crypto/sha256" "fmt" + errorsmod "cosmossdk.io/errors" "github.com/babylonchain/babylon/x/epoching/types" + "github.com/cometbft/cometbft/crypto/merkle" + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/tendermint/tendermint/crypto/merkle" - tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" ) func (k Keeper) setAppHash(ctx sdk.Context, height uint64, appHash []byte) { @@ -24,7 +24,7 @@ func (k Keeper) GetAppHash(ctx sdk.Context, height uint64) ([]byte, error) { heightBytes := sdk.Uint64ToBigEndian(height) appHash := store.Get(heightBytes) if appHash == nil { - return nil, sdkerrors.Wrapf(types.ErrInvalidHeight, "height %d is now known in DB yet", height) + return nil, errorsmod.Wrapf(types.ErrInvalidHeight, "height %d is now known in DB yet", height) } return appHash, nil } @@ -40,7 +40,7 @@ func (k Keeper) RecordAppHash(ctx sdk.Context) { func (k Keeper) GetAllAppHashsForEpoch(ctx sdk.Context, epoch *types.Epoch) ([][]byte, error) { // if this epoch is the most recent AND has not ended, then we cannot get all AppHashs for this epoch if k.GetEpoch(ctx).EpochNumber == epoch.EpochNumber && !epoch.IsLastBlock(ctx) { - return nil, sdkerrors.Wrapf(types.ErrInvalidHeight, "GetAllAppHashsForEpoch can only be invoked when this epoch has ended") + return nil, errorsmod.Wrapf(types.ErrInvalidHeight, "GetAllAppHashsForEpoch can only be invoked when this epoch has ended") } // fetch each AppHash in this epoch @@ -64,7 +64,7 @@ func (k Keeper) ProveAppHashInEpoch(ctx sdk.Context, height uint64, epochNumber return nil, err } if !epoch.WithinBoundary(height) { - return nil, sdkerrors.Wrapf(types.ErrInvalidHeight, "the given height %d is not in epoch %d (interval [%d, %d])", height, epoch.EpochNumber, epoch.FirstBlockHeight, uint64(epoch.LastBlockHeader.Height)) + return nil, errorsmod.Wrapf(types.ErrInvalidHeight, "the given height %d is not in epoch %d (interval [%d, %d])", height, epoch.EpochNumber, epoch.FirstBlockHeight, uint64(epoch.LastBlockHeader.Height)) } // calculate index of this height in this epoch diff --git a/x/epoching/keeper/apphash_chain_test.go b/x/epoching/keeper/apphash_chain_test.go index b852bf270..15cae8998 100644 --- a/x/epoching/keeper/apphash_chain_test.go +++ b/x/epoching/keeper/apphash_chain_test.go @@ -15,7 +15,7 @@ func FuzzAppHashChain(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelper(t) ctx, k := helper.Ctx, helper.EpochingKeeper @@ -25,16 +25,21 @@ func FuzzAppHashChain(f *testing.F) { require.Equal(t, epoch.FirstBlockHeight, uint64(0)) // set a random epoch interval - epochInterval := rand.Uint64()%100 + 2 // the epoch interval should at at least 2 - k.SetParams(ctx, types.Params{ + epochInterval := r.Uint64()%100 + 2 // the epoch interval should at at least 2 + + params := types.Params{ EpochInterval: epochInterval, - }) + } + + if err := k.SetParams(ctx, params); err != nil { + panic(err) + } // reach the end of the 1st epoch expectedHeight := epochInterval expectedAppHashs := [][]byte{} for i := uint64(0); i < expectedHeight; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) expectedAppHashs = append(expectedAppHashs, ctx.BlockHeader().AppHash) } // ensure epoch number is 1 @@ -47,7 +52,7 @@ func FuzzAppHashChain(f *testing.F) { require.Equal(t, expectedAppHashs, appHashs) // ensure prover and verifier are correct - randomHeightInEpoch := uint64(rand.Intn(int(expectedHeight)) + 1) + randomHeightInEpoch := uint64(r.Intn(int(expectedHeight)) + 1) randomAppHash, err := k.GetAppHash(ctx, randomHeightInEpoch) require.NoError(t, err) proof, err := k.ProveAppHashInEpoch(ctx, randomHeightInEpoch, epoch.EpochNumber) diff --git a/x/epoching/keeper/epoch_msg_queue.go b/x/epoching/keeper/epoch_msg_queue.go index b370ba500..e2dbd4426 100644 --- a/x/epoching/keeper/epoch_msg_queue.go +++ b/x/epoching/keeper/epoch_msg_queue.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" + errorsmod "cosmossdk.io/errors" "github.com/babylonchain/babylon/x/epoching/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // InitMsgQueue initialises the msg queue length of the current epoch to 0 @@ -64,7 +64,7 @@ func (k Keeper) EnqueueMsg(ctx sdk.Context, msg types.QueuedMessage) { // value: msgBytes msgBytes, err := k.cdc.MarshalInterface(&msg) if err != nil { - panic(sdkerrors.Wrap(types.ErrMarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrMarshal, err.Error())) } store.Set(queueLenBytes, msgBytes) @@ -84,7 +84,7 @@ func (k Keeper) GetEpochMsgs(ctx sdk.Context, epochNumber uint64) []*types.Queue queuedMsgBytes := iterator.Value() var sdkMsg sdk.Msg if err := k.cdc.UnmarshalInterface(queuedMsgBytes, &sdkMsg); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } queuedMsg, ok := sdkMsg.(*types.QueuedMessage) if !ok { @@ -195,7 +195,7 @@ func (k Keeper) HandleQueuedMsg(ctx sdk.Context, msg *types.QueuedMessage) (*sdk return nil, err } default: - panic(sdkerrors.Wrap(types.ErrInvalidQueuedMessageType, msg.String())) + panic(errorsmod.Wrap(types.ErrInvalidQueuedMessageType, msg.String())) } return result, nil diff --git a/x/epoching/keeper/epoch_msg_queue_test.go b/x/epoching/keeper/epoch_msg_queue_test.go index 6ca85d841..8d41bd685 100644 --- a/x/epoching/keeper/epoch_msg_queue_test.go +++ b/x/epoching/keeper/epoch_msg_queue_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/babylonchain/babylon/testutil/datagen" "math/rand" "testing" @@ -19,13 +20,9 @@ var ( // FuzzEnqueueMsg tests EnqueueMsg. It enqueues some wrapped msgs, and check if the message queue includes the enqueued msgs or not func FuzzEnqueueMsg(f *testing.F) { - f.Add(int64(11111)) - f.Add(int64(22222)) - f.Add(int64(55555)) - f.Add(int64(12312)) - + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelper(t) ctx, keeper := helper.Ctx, helper.EpochingKeeper @@ -35,7 +32,7 @@ func FuzzEnqueueMsg(f *testing.F) { // enter the 1st block and thus epoch 1 // Note that the genesis block does not trigger BeginBlock or EndBlock - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) epoch := keeper.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) // ensure that the epoch msg queue is correct at epoch 1 @@ -43,7 +40,7 @@ func FuzzEnqueueMsg(f *testing.F) { require.Equal(t, uint64(0), keeper.GetCurrentQueueLength(ctx)) // Enqueue a random number of msgs - numQueuedMsgs := rand.Uint64() % 100 + numQueuedMsgs := datagen.RandomInt(r, 100) for i := uint64(0); i < numQueuedMsgs; i++ { msg := types.QueuedMessage{ TxId: sdk.Uint64ToBigEndian(i), @@ -66,13 +63,9 @@ func FuzzEnqueueMsg(f *testing.F) { // FuzzHandleQueuedMsg_MsgWrappedDelegate tests HandleQueueMsg over MsgWrappedDelegate. // It enqueues some MsgWrappedDelegate, enters a new epoch (which triggers HandleQueueMsg), and check if the newly delegated tokens take effect or not func FuzzHandleQueuedMsg_MsgWrappedDelegate(f *testing.F) { - f.Add(int64(11111)) - f.Add(int64(22222)) - f.Add(int64(55555)) - f.Add(int64(12312)) - + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelperWithValSet(t) ctx, keeper, genAccs := helper.Ctx, helper.EpochingKeeper, helper.GenAccs @@ -84,7 +77,7 @@ func FuzzHandleQueuedMsg_MsgWrappedDelegate(f *testing.F) { genAddr := genAccs[0].GetAddress() // BeginBlock of block 1, and thus entering epoch 1 - ctx = helper.BeginBlock() + ctx = helper.BeginBlock(r) epoch := keeper.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) @@ -102,7 +95,7 @@ func FuzzHandleQueuedMsg_MsgWrappedDelegate(f *testing.F) { require.Equal(t, uint64(0), lc.ValLife[0].BlockHeight) // delegate a random amount of tokens to the validator - numNewDels := rand.Int63n(1000) + 1 + numNewDels := r.Int63n(1000) + 1 for i := int64(0); i < numNewDels; i++ { helper.WrappedDelegate(genAddr, val, coinWithOnePower.Amount) } @@ -115,7 +108,7 @@ func FuzzHandleQueuedMsg_MsgWrappedDelegate(f *testing.F) { // go to BeginBlock of block 11, and thus entering epoch 2 for i := uint64(0); i < params.EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = keeper.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) @@ -134,13 +127,9 @@ func FuzzHandleQueuedMsg_MsgWrappedDelegate(f *testing.F) { // FuzzHandleQueuedMsg_MsgWrappedUndelegate tests HandleQueueMsg over MsgWrappedUndelegate. // It enqueues some MsgWrappedUndelegate, enters a new epoch (which triggers HandleQueueMsg), and check if the tokens become unbonding or not func FuzzHandleQueuedMsg_MsgWrappedUndelegate(f *testing.F) { - f.Add(int64(11111)) - f.Add(int64(22222)) - f.Add(int64(55555)) - f.Add(int64(12312)) - + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelperWithValSet(t) _, keeper, genAccs := helper.Ctx, helper.EpochingKeeper, helper.GenAccs @@ -151,7 +140,7 @@ func FuzzHandleQueuedMsg_MsgWrappedUndelegate(f *testing.F) { genAddr := genAccs[0].GetAddress() // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := keeper.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) @@ -171,7 +160,7 @@ func FuzzHandleQueuedMsg_MsgWrappedUndelegate(f *testing.F) { // Note that for any pair of delegator and validator, there can be `<=DefaultMaxEntries=7` concurrent undelegations at any time slot // Otherwise, only `DefaultMaxEntries` undelegations will be processed at this height and the rest will be rejected // See https://github.com/cosmos/cosmos-sdk/blob/v0.45.5/x/staking/keeper/delegation.go#L814-L816 - numNewUndels := rand.Int63n(7) + 1 + numNewUndels := r.Int63n(7) + 1 for i := int64(0); i < numNewUndels; i++ { helper.WrappedUndelegate(genAddr, val, coinWithOnePower.Amount) } @@ -184,7 +173,7 @@ func FuzzHandleQueuedMsg_MsgWrappedUndelegate(f *testing.F) { // enter epoch 2 for i := uint64(0); i < keeper.GetParams(ctx).EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = keeper.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) @@ -200,24 +189,21 @@ func FuzzHandleQueuedMsg_MsgWrappedUndelegate(f *testing.F) { // ensure the genesis account has these unbonding tokens unbondingDels := helper.StakingKeeper.GetAllUnbondingDelegations(ctx, genAddr) - require.Equal(t, 1, len(unbondingDels)) // there is only 1 type of tokens - require.Equal(t, numNewUndels, int64(len(unbondingDels[0].Entries))) // there are numNewUndels entries - for _, entry := range unbondingDels[0].Entries { - require.Equal(t, coinWithOnePower.Amount, entry.Balance) // each unbonding delegation entry has tokens of 1 voting power - } + require.Equal(t, 1, len(unbondingDels)) // there is only 1 type of tokens + + // from cosmos v47, all undelegations made at the same height are represented + // by one entry see: https://github.com/cosmos/cosmos-sdk/pull/12967 + require.Equal(t, 1, len(unbondingDels[0].Entries)) + require.Equal(t, unbondingDels[0].Entries[0].Balance, coinWithOnePower.Amount.MulRaw(numNewUndels)) }) } // FuzzHandleQueuedMsg_MsgWrappedBeginRedelegate tests HandleQueueMsg over MsgWrappedBeginRedelegate. // It enqueues some MsgWrappedBeginRedelegate, enters a new epoch (which triggers HandleQueueMsg), and check if the tokens become unbonding or not func FuzzHandleQueuedMsg_MsgWrappedBeginRedelegate(f *testing.F) { - f.Add(int64(11111)) - f.Add(int64(22222)) - f.Add(int64(55555)) - f.Add(int64(12312)) - + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelperWithValSet(t) _, keeper, genAccs := helper.Ctx, helper.EpochingKeeper, helper.GenAccs @@ -228,7 +214,7 @@ func FuzzHandleQueuedMsg_MsgWrappedBeginRedelegate(f *testing.F) { genAddr := genAccs[0].GetAddress() // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := keeper.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) @@ -255,7 +241,7 @@ func FuzzHandleQueuedMsg_MsgWrappedBeginRedelegate(f *testing.F) { // redelegate a random amount of tokens from val1 to val2 // same as undelegation, there can be `<=DefaultMaxEntries=7` concurrent redelegation requests for any tuple (delegatorAddr, srcValidatorAddr, dstValidatorAddr) // See https://github.com/cosmos/cosmos-sdk/blob/v0.45.5/x/staking/keeper/delegation.go#L908-L910 - numNewRedels := rand.Int63n(7) + 1 + numNewRedels := r.Int63n(7) + 1 for i := int64(0); i < numNewRedels; i++ { helper.WrappedBeginRedelegate(genAddr, val1, val2, coinWithOnePower.Amount) } @@ -268,7 +254,7 @@ func FuzzHandleQueuedMsg_MsgWrappedBeginRedelegate(f *testing.F) { // enter epoch 2 for i := uint64(0); i < keeper.GetParams(ctx).EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = keeper.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) diff --git a/x/epoching/keeper/epoch_slashed_val_set.go b/x/epoching/keeper/epoch_slashed_val_set.go index d5ccc7600..71feae801 100644 --- a/x/epoching/keeper/epoch_slashed_val_set.go +++ b/x/epoching/keeper/epoch_slashed_val_set.go @@ -1,11 +1,11 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" "github.com/babylonchain/babylon/x/epoching/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // setSlashedVotingPower sets the total amount of voting power that has been slashed in the epoch @@ -17,7 +17,7 @@ func (k Keeper) setSlashedVotingPower(ctx sdk.Context, epochNumber uint64, power // value: power powerBytes, err := sdk.NewInt(power).Marshal() if err != nil { - panic(sdkerrors.Wrap(types.ErrMarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrMarshal, err.Error())) } store.Set(epochNumberBytes, powerBytes) @@ -43,7 +43,7 @@ func (k Keeper) GetSlashedVotingPower(ctx sdk.Context, epochNumber uint64) int64 // get value var slashedVotingPower math.Int if err := slashedVotingPower.Unmarshal(bz); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } return slashedVotingPower.Int64() @@ -56,11 +56,11 @@ func (k Keeper) AddSlashedValidator(ctx sdk.Context, valAddr sdk.ValAddress) err store := k.slashedValSetStore(ctx, epochNumber) thisVotingPower, err := k.GetValidatorVotingPower(ctx, epochNumber, valAddr) if err != nil { - panic(sdkerrors.Wrap(types.ErrMarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrMarshal, err.Error())) } thisVotingPowerBytes, err := sdk.NewInt(thisVotingPower).Marshal() if err != nil { - panic(sdkerrors.Wrap(types.ErrMarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrMarshal, err.Error())) } // insert into "set of slashed addresses" as KV pair, where @@ -93,7 +93,7 @@ func (k Keeper) GetSlashedValidators(ctx sdk.Context, epochNumber uint64) types. } var power math.Int if err := power.Unmarshal(powerBytes); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } val := types.Validator{Addr: addr, Power: power.Int64()} valSet = append(valSet, val) diff --git a/x/epoching/keeper/epoch_slashed_val_set_test.go b/x/epoching/keeper/epoch_slashed_val_set_test.go index d7e8d2d01..9c6b9cb33 100644 --- a/x/epoching/keeper/epoch_slashed_val_set_test.go +++ b/x/epoching/keeper/epoch_slashed_val_set_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/babylonchain/babylon/testutil/datagen" "math/rand" "sort" "testing" @@ -12,23 +13,19 @@ import ( ) func FuzzSlashedValSet(f *testing.F) { - f.Add(int64(11111)) - f.Add(int64(22222)) - f.Add(int64(55555)) - f.Add(int64(12312)) - + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelperWithValSet(t) ctx, keeper, stakingKeeper := helper.Ctx, helper.EpochingKeeper, helper.StakingKeeper getValSet := keeper.GetValidatorSet(ctx, 0) // slash a random subset of validators - numSlashed := rand.Intn(len(getValSet)) + numSlashed := r.Intn(len(getValSet)) excpectedSlashedVals := []sdk.ValAddress{} for i := 0; i < numSlashed; i++ { - idx := rand.Intn(len(getValSet)) + idx := r.Intn(len(getValSet)) slashedVal := getValSet[idx] stakingKeeper.Slash(ctx, sdk.ConsAddress(slashedVal.Addr), 0, slashedVal.Power, sdk.OneDec()) // add the slashed validator to the slashed validator set @@ -47,7 +44,7 @@ func FuzzSlashedValSet(f *testing.F) { } // go to the 1st block and thus epoch 1 - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) epochNumber := keeper.GetEpoch(ctx).EpochNumber require.Equal(t, uint64(1), epochNumber) // no validator is slashed in epoch 1 diff --git a/x/epoching/keeper/epoch_val_set.go b/x/epoching/keeper/epoch_val_set.go index 32c8a9f12..8f7de9a85 100644 --- a/x/epoching/keeper/epoch_val_set.go +++ b/x/epoching/keeper/epoch_val_set.go @@ -1,12 +1,12 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" "github.com/babylonchain/babylon/x/epoching/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) // GetValidatorSet returns the set of validators of a given epoch, where the validators are ordered by their address in ascending order @@ -21,7 +21,7 @@ func (k Keeper) GetValidatorSet(ctx sdk.Context, epochNumber uint64) types.Valid powerBytes := iterator.Value() var power math.Int if err := power.Unmarshal(powerBytes); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } val := types.Validator{ Addr: addr, @@ -61,7 +61,7 @@ func (k Keeper) InitValidatorSet(ctx sdk.Context) { addrBytes := []byte(addr) powerBytes, err := sdk.NewInt(power).Marshal() if err != nil { - panic(sdkerrors.Wrap(types.ErrMarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrMarshal, err.Error())) } store.Set(addrBytes, powerBytes) totalPower += power @@ -73,7 +73,7 @@ func (k Keeper) InitValidatorSet(ctx sdk.Context) { epochNumberBytes := sdk.Uint64ToBigEndian(epochNumber) totalPowerBytes, err := sdk.NewInt(totalPower).Marshal() if err != nil { - panic(sdkerrors.Wrap(types.ErrMarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrMarshal, err.Error())) } k.votingPowerStore(ctx).Set(epochNumberBytes, totalPowerBytes) } @@ -105,7 +105,7 @@ func (k Keeper) GetValidatorVotingPower(ctx sdk.Context, epochNumber uint64, val } var power math.Int if err := power.Unmarshal(powerBytes); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } return power.Int64(), nil @@ -126,7 +126,7 @@ func (k Keeper) GetTotalVotingPower(ctx sdk.Context, epochNumber uint64) int64 { } var power math.Int if err := power.Unmarshal(powerBytes); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } return power.Int64() } diff --git a/x/epoching/keeper/epoch_val_set_test.go b/x/epoching/keeper/epoch_val_set_test.go index 59bf4b3fe..842330805 100644 --- a/x/epoching/keeper/epoch_val_set_test.go +++ b/x/epoching/keeper/epoch_val_set_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "github.com/babylonchain/babylon/testutil/datagen" "math/rand" "testing" @@ -10,13 +11,9 @@ import ( ) func FuzzEpochValSet(f *testing.F) { - f.Add(int64(11111)) - f.Add(int64(22222)) - f.Add(int64(55555)) - f.Add(int64(12312)) - + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelperWithValSet(t) ctx, keeper := helper.Ctx, helper.EpochingKeeper @@ -30,9 +27,9 @@ func FuzzEpochValSet(f *testing.F) { } // generate a random number of new blocks - numIncBlocks := rand.Uint64()%1000 + 1 + numIncBlocks := r.Uint64()%1000 + 1 for i := uint64(0); i < numIncBlocks; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } // check whether the validator set remains the same or not diff --git a/x/epoching/keeper/epochs.go b/x/epoching/keeper/epochs.go index 93be60372..7e8cba969 100644 --- a/x/epoching/keeper/epochs.go +++ b/x/epoching/keeper/epochs.go @@ -1,11 +1,11 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" "github.com/babylonchain/babylon/x/epoching/types" + "github.com/cometbft/cometbft/crypto/merkle" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/tendermint/tendermint/crypto/merkle" ) const ( @@ -82,7 +82,7 @@ func (k Keeper) GetHistoricalEpoch(ctx sdk.Context, epochNumber uint64) (*types. func (k Keeper) RecordLastHeaderAndAppHashRoot(ctx sdk.Context) error { epoch := k.GetEpoch(ctx) if !epoch.IsLastBlock(ctx) { - return sdkerrors.Wrapf(types.ErrInvalidHeight, "RecordLastBlockHeader can only be invoked at the last block of an epoch") + return errorsmod.Wrapf(types.ErrInvalidHeight, "RecordLastBlockHeader can only be invoked at the last block of an epoch") } // record last block header header := ctx.BlockHeader() diff --git a/x/epoching/keeper/epochs_test.go b/x/epoching/keeper/epochs_test.go index 4720807ec..3a864a5ea 100644 --- a/x/epoching/keeper/epochs_test.go +++ b/x/epoching/keeper/epochs_test.go @@ -14,7 +14,7 @@ func FuzzEpochs(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelper(t) ctx, keeper := helper.Ctx, helper.EpochingKeeper @@ -24,14 +24,20 @@ func FuzzEpochs(f *testing.F) { require.Equal(t, epoch.FirstBlockHeight, uint64(0)) // set a random epoch interval - epochInterval := rand.Uint64()%100 + 2 // the epoch interval should at at least 2 - keeper.SetParams(ctx, types.Params{ + epochInterval := r.Uint64()%100 + 2 // the epoch interval should at at least 2 + + params := types.Params{ EpochInterval: epochInterval, - }) + } + + if err := keeper.SetParams(ctx, params); err != nil { + panic(err) + } + // increment a random number of new blocks - numIncBlocks := rand.Uint64()%1000 + 1 + numIncBlocks := r.Uint64()%1000 + 1 for i := uint64(0); i < numIncBlocks; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } // ensure that the epoch info is still correct diff --git a/x/epoching/keeper/grpc_query.go b/x/epoching/keeper/grpc_query.go index f76c5f81a..dfd8f8447 100644 --- a/x/epoching/keeper/grpc_query.go +++ b/x/epoching/keeper/grpc_query.go @@ -3,10 +3,10 @@ package keeper import ( "context" "errors" - "fmt" "cosmossdk.io/math" + errorsmod "cosmossdk.io/errors" "github.com/babylonchain/babylon/x/epoching/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -59,19 +59,6 @@ func (k Keeper) EpochInfo(c context.Context, req *types.QueryEpochInfoRequest) ( func (k Keeper) EpochsInfo(c context.Context, req *types.QueryEpochsInfoRequest) (*types.QueryEpochsInfoResponse, error) { ctx := sdk.UnwrapSDKContext(c) - // parse start_epoch and end_epoch and forward to the pagination request - if req.EndEpoch > 0 { - // this query uses start_epoch and end_epoch to specify range - if req.StartEpoch > req.EndEpoch { - return nil, fmt.Errorf("StartEpoch (%d) should not be larger than EndEpoch (%d)", req.StartEpoch, req.EndEpoch) - } - req.Pagination = &query.PageRequest{ - Key: sdk.Uint64ToBigEndian(req.StartEpoch), - Limit: req.EndEpoch - req.StartEpoch + 1, - Reverse: false, - } - } - epochInfoStore := k.epochInfoStore(ctx) epochs := []*types.Epoch{} pageRes, err := query.Paginate(epochInfoStore, req.Pagination, func(key, value []byte) error { @@ -143,7 +130,7 @@ func (k Keeper) LatestEpochMsgs(c context.Context, req *types.QueryLatestEpochMs ctx := sdk.UnwrapSDKContext(c) if req.EpochCount == 0 { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "epoch_count should be specified and be larger than zero", ) } @@ -236,7 +223,7 @@ func (k Keeper) EpochValSet(c context.Context, req *types.QueryEpochValSetReques // Here key is the validator's ValAddress, and value is the voting power var power math.Int if err := power.Unmarshal(value); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) // this only happens upon a programming error + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) // this only happens upon a programming error } val := types.Validator{ Addr: key, diff --git a/x/epoching/keeper/grpc_query_test.go b/x/epoching/keeper/grpc_query_test.go index 2f3f2a10e..6689b04ea 100644 --- a/x/epoching/keeper/grpc_query_test.go +++ b/x/epoching/keeper/grpc_query_test.go @@ -22,11 +22,11 @@ func FuzzParamsQuery(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // params generated by fuzzer params := types.DefaultParams() - epochInterval := datagen.RandomInt(20) + epochInterval := datagen.RandomInt(r, 20) params.EpochInterval = epochInterval // test the case of EpochInterval < 2 @@ -34,16 +34,18 @@ func FuzzParamsQuery(f *testing.F) { if epochInterval < 2 { // validation should not pass with EpochInterval < 2 require.Error(t, params.Validate()) - params.EpochInterval = uint64(rand.Int()) + params.EpochInterval = uint64(r.Int()) } helper := testepoching.NewHelper(t) ctx, keeper, queryClient := helper.Ctx, helper.EpochingKeeper, helper.QueryClient wctx := sdk.WrapSDKContext(ctx) // if setParamsFlag == 0, set params - setParamsFlag := rand.Intn(2) + setParamsFlag := r.Intn(2) if setParamsFlag == 0 { - keeper.SetParams(ctx, params) + if err := keeper.SetParams(ctx, params); err != nil { + panic(err) + } } req := types.QueryParamsRequest{} resp, err := queryClient.Params(wctx, &req) @@ -65,9 +67,9 @@ func FuzzCurrentEpoch(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) - increment := datagen.RandomInt(100) + increment := datagen.RandomInt(r, 100) helper := testepoching.NewHelper(t) ctx, keeper, queryClient := helper.Ctx, helper.EpochingKeeper, helper.QueryClient @@ -76,7 +78,7 @@ func FuzzCurrentEpoch(f *testing.F) { epochInterval := keeper.GetParams(ctx).EpochInterval for i := uint64(0); i < increment; i++ { // this ensures that IncEpoch is invoked only at the first header of each epoch - ctx = ctx.WithBlockHeader(*datagen.GenRandomTMHeader("chain-test", i*epochInterval+1)) + ctx = ctx.WithBlockHeader(*datagen.GenRandomTMHeader(r, "chain-test", i*epochInterval+1)) wctx = sdk.WrapSDKContext(ctx) keeper.IncEpoch(ctx) } @@ -92,9 +94,9 @@ func FuzzEpochsInfo(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - numEpochs := datagen.RandomInt(10) + 1 - limit := datagen.RandomInt(10) + 1 + r := rand.New(rand.NewSource(seed)) + numEpochs := datagen.RandomInt(r, 10) + 1 + limit := datagen.RandomInt(r, 10) + 1 helper := testepoching.NewHelper(t) ctx, keeper, queryClient := helper.Ctx, helper.EpochingKeeper, helper.QueryClient @@ -104,7 +106,7 @@ func FuzzEpochsInfo(f *testing.F) { epochInterval := keeper.GetParams(ctx).EpochInterval for i := uint64(0); i < numEpochs-1; i++ { for j := uint64(0); j < epochInterval; j++ { - helper.GenAndApplyEmptyBlock() + helper.GenAndApplyEmptyBlock(r) } } @@ -124,43 +126,6 @@ func FuzzEpochsInfo(f *testing.F) { }) } -func FuzzEpochsInfo_QueryParams(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 10) - - f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - numEpochs := datagen.RandomInt(10) + 2 - - endEpoch := rand.Uint64()%(numEpochs-1) + 1 - startEpoch := rand.Uint64() % endEpoch - - helper := testepoching.NewHelper(t) - ctx, keeper, queryClient := helper.Ctx, helper.EpochingKeeper, helper.QueryClient - wctx := sdk.WrapSDKContext(ctx) - - // enque the first block of the numEpochs'th epoch - epochInterval := keeper.GetParams(ctx).EpochInterval - for i := uint64(0); i < numEpochs-1; i++ { - for j := uint64(0); j < epochInterval; j++ { - helper.GenAndApplyEmptyBlock() - } - } - - // get epoch msgs - req := types.QueryEpochsInfoRequest{ - StartEpoch: startEpoch, - EndEpoch: endEpoch, - } - resp, err := queryClient.EpochsInfo(wctx, &req) - require.NoError(t, err) - - require.Equal(t, endEpoch-startEpoch+1, uint64(len(resp.Epochs))) - for i, epoch := range resp.Epochs { - require.Equal(t, uint64(i)+startEpoch, epoch.EpochNumber) - } - }) -} - // FuzzEpochMsgsQuery fuzzes queryClient.EpochMsgs // 1. randomly generate msgs and limit in pagination // 2. check the returned msg was previously enqueued @@ -169,9 +134,9 @@ func FuzzEpochMsgsQuery(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - numMsgs := uint64(rand.Int() % 100) - limit := uint64(rand.Int()%100) + 1 + r := rand.New(rand.NewSource(seed)) + numMsgs := uint64(r.Int() % 100) + limit := uint64(r.Int()%100) + 1 txidsMap := map[string]bool{} helper := testepoching.NewHelper(t) @@ -179,7 +144,7 @@ func FuzzEpochMsgsQuery(f *testing.F) { wctx := sdk.WrapSDKContext(ctx) // enque a random number of msgs with random txids for i := uint64(0); i < numMsgs; i++ { - txid := datagen.GenRandomByteArray(32) + txid := datagen.GenRandomByteArray(r, 32) txidsMap[string(txid)] = true queuedMsg := types.QueuedMessage{ TxId: txid, @@ -221,12 +186,12 @@ func FuzzEpochValSetQuery(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) helper := testepoching.NewHelperWithValSet(t) ctx, queryClient := helper.Ctx, helper.QueryClient - limit := uint64(rand.Int() % 100) + limit := uint64(r.Int() % 100) req := &types.QueryEpochValSetRequest{ EpochNum: 0, Pagination: &query.PageRequest{ @@ -238,9 +203,9 @@ func FuzzEpochValSetQuery(f *testing.F) { require.NoError(t, err) // generate a random number of new blocks - numIncBlocks := rand.Uint64()%1000 + 1 + numIncBlocks := r.Uint64()%1000 + 1 for i := uint64(0); i < numIncBlocks; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } // check whether the validator set remains the same or not diff --git a/x/epoching/keeper/hooks.go b/x/epoching/keeper/hooks.go index 7117d4a13..a30ab69e6 100644 --- a/x/epoching/keeper/hooks.go +++ b/x/epoching/keeper/hooks.go @@ -134,3 +134,7 @@ func (h Hooks) AfterRawCheckpointForgotten(ctx sdk.Context, ckpt *checkpointingt func (h Hooks) AfterRawCheckpointBlsSigVerified(ctx sdk.Context, ckpt *checkpointingtypes.RawCheckpoint) error { return nil } + +func (h Hooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error { + return nil +} diff --git a/x/epoching/keeper/keeper.go b/x/epoching/keeper/keeper.go index f663d54c7..dbe78f4f9 100644 --- a/x/epoching/keeper/keeper.go +++ b/x/epoching/keeper/keeper.go @@ -3,24 +3,27 @@ package keeper import ( "fmt" - "github.com/babylonchain/babylon/x/epoching/types" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/libs/log" + + "github.com/babylonchain/babylon/x/epoching/types" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - hooks types.EpochingHooks - paramstore paramtypes.Subspace - stk types.StakingKeeper - router *baseapp.MsgServiceRouter + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey + hooks types.EpochingHooks + bk types.BankKeeper + stk types.StakingKeeper + router *baseapp.MsgServiceRouter + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } ) @@ -28,21 +31,19 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, + bk types.BankKeeper, stk types.StakingKeeper, + authority string, ) Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } return Keeper{ - cdc: cdc, - storeKey: storeKey, - memKey: memKey, - paramstore: ps, - hooks: nil, - stk: stk, + cdc: cdc, + storeKey: storeKey, + memKey: memKey, + hooks: nil, + bk: bk, + stk: stk, + authority: authority, } } diff --git a/x/epoching/keeper/keeper_test.go b/x/epoching/keeper/keeper_test.go index 3ed8ed1d2..64a9aae1c 100644 --- a/x/epoching/keeper/keeper_test.go +++ b/x/epoching/keeper/keeper_test.go @@ -22,7 +22,11 @@ func TestParams(t *testing.T) { //modify a params, save, and retrieve expParams.EpochInterval = 777 - keeper.SetParams(ctx, expParams) + + if err := keeper.SetParams(ctx, expParams); err != nil { + panic(err) + } + resParams = keeper.GetParams(ctx) require.True(t, expParams.Equal(resParams)) } diff --git a/x/epoching/keeper/modified_staking.go b/x/epoching/keeper/modified_staking.go index e07074821..b68b1c22f 100644 --- a/x/epoching/keeper/modified_staking.go +++ b/x/epoching/keeper/modified_staking.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/babylonchain/babylon/x/epoching/types" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" diff --git a/x/epoching/keeper/msg_server.go b/x/epoching/keeper/msg_server.go index 0e96d7f38..17c2e1dec 100644 --- a/x/epoching/keeper/msg_server.go +++ b/x/epoching/keeper/msg_server.go @@ -3,11 +3,13 @@ package keeper import ( "context" + errorsmod "cosmossdk.io/errors" "github.com/babylonchain/babylon/x/epoching/types" + "github.com/cometbft/cometbft/crypto/tmhash" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/tendermint/tendermint/crypto/tmhash" ) type msgServer struct { @@ -39,7 +41,7 @@ func (k msgServer) WrappedDelegate(goCtx context.Context, msg *types.MsgWrappedD } bondDenom := k.stk.BondDenom(ctx) if msg.Msg.Amount.Denom != bondDenom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Msg.Amount.Denom, bondDenom, ) } @@ -92,7 +94,7 @@ func (k msgServer) WrappedUndelegate(goCtx context.Context, msg *types.MsgWrappe } bondDenom := k.stk.BondDenom(ctx) if msg.Msg.Amount.Denom != bondDenom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Msg.Amount.Denom, bondDenom, ) } @@ -145,7 +147,7 @@ func (k msgServer) WrappedBeginRedelegate(goCtx context.Context, msg *types.MsgW } bondDenom := k.stk.BondDenom(ctx) if msg.Msg.Amount.Denom != bondDenom { - return nil, sdkerrors.Wrapf( + return nil, errorsmod.Wrapf( sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Msg.Amount.Denom, bondDenom, ) } @@ -182,3 +184,20 @@ func (k msgServer) WrappedBeginRedelegate(goCtx context.Context, msg *types.MsgW return &types.MsgWrappedBeginRedelegateResponse{}, nil } + +// UpdateParams updates the params. +// TODO investigate when it is the best time to update the params. We can update them +// when the epoch changes, but we can also update them during the epoch and extend +// the epoch duration. +func (ms msgServer) UpdateParams(goCtx context.Context, req *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if ms.authority != req.Authority { + return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, req.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := ms.SetParams(ctx, req.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/epoching/keeper/msg_server_test.go b/x/epoching/keeper/msg_server_test.go index cf77d4c8d..46057efe5 100644 --- a/x/epoching/keeper/msg_server_test.go +++ b/x/epoching/keeper/msg_server_test.go @@ -1,7 +1,9 @@ package keeper_test import ( + "math/rand" "testing" + "time" "github.com/babylonchain/babylon/x/epoching/testepoching" "github.com/babylonchain/babylon/x/epoching/types" @@ -12,10 +14,11 @@ import ( // TODO (fuzz tests): replace the following tests with fuzz ones func TestMsgWrappedDelegate(t *testing.T) { + r := rand.New(rand.NewSource(time.Now().Unix())) helper := testepoching.NewHelper(t) msgSrvr := helper.MsgSrvr // enter 1st epoch, in which BBN starts handling validator-related msgs - ctx := helper.GenAndApplyEmptyBlock() + ctx := helper.GenAndApplyEmptyBlock(r) wctx := sdk.WrapSDKContext(ctx) testCases := []struct { @@ -41,10 +44,11 @@ func TestMsgWrappedDelegate(t *testing.T) { } func TestMsgWrappedUndelegate(t *testing.T) { + r := rand.New(rand.NewSource(time.Now().Unix())) helper := testepoching.NewHelper(t) msgSrvr := helper.MsgSrvr // enter 1st epoch, in which BBN starts handling validator-related msgs - ctx := helper.GenAndApplyEmptyBlock() + ctx := helper.GenAndApplyEmptyBlock(r) wctx := sdk.WrapSDKContext(ctx) testCases := []struct { @@ -70,10 +74,11 @@ func TestMsgWrappedUndelegate(t *testing.T) { } func TestMsgWrappedBeginRedelegate(t *testing.T) { + r := rand.New(rand.NewSource(time.Now().Unix())) helper := testepoching.NewHelper(t) msgSrvr := helper.MsgSrvr // enter 1st epoch, in which BBN starts handling validator-related msgs - ctx := helper.GenAndApplyEmptyBlock() + ctx := helper.GenAndApplyEmptyBlock(r) wctx := sdk.WrapSDKContext(ctx) testCases := []struct { diff --git a/x/epoching/keeper/params.go b/x/epoching/keeper/params.go index a365fa055..255ea6b27 100644 --- a/x/epoching/keeper/params.go +++ b/x/epoching/keeper/params.go @@ -6,12 +6,27 @@ import ( ) // GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) - return params +// SetParams sets the x/epoching module parameters. +func (k Keeper) SetParams(ctx sdk.Context, p types.Params) error { + if err := p.Validate(); err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + bz := k.cdc.MustMarshal(&p) + store.Set(types.ParamsKey, bz) + + return nil } -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) +// GetParams returns the current x/epoching module parameters. +func (k Keeper) GetParams(ctx sdk.Context) (p types.Params) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return p + } + + k.cdc.MustUnmarshal(bz, &p) + return p } diff --git a/x/epoching/keeper/params_test.go b/x/epoching/keeper/params_test.go index 4294a7eea..01ff49ae6 100644 --- a/x/epoching/keeper/params_test.go +++ b/x/epoching/keeper/params_test.go @@ -12,7 +12,9 @@ func TestGetParams(t *testing.T) { k, ctx := testkeeper.EpochingKeeper(t) params := types.DefaultParams() - k.SetParams(ctx, params) + if err := k.SetParams(ctx, params); err != nil { + panic(err) + } require.EqualValues(t, params, k.GetParams(ctx)) } diff --git a/x/epoching/keeper/staking_functions.go b/x/epoching/keeper/staking_functions.go new file mode 100644 index 000000000..3ff138444 --- /dev/null +++ b/x/epoching/keeper/staking_functions.go @@ -0,0 +1,106 @@ +package keeper + +import ( + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + errorsmod "cosmossdk.io/errors" + + "github.com/babylonchain/babylon/x/epoching/types" +) + +// CheckMsgCreateValidator performs checks on a given `MsgCreateValidator` message +// The checkpointing module will use this function to verify the `MsgCreateValidator` message +// inside a `MsgWrappedCreateValidator` message. +// (adapted from https://github.com/cosmos/cosmos-sdk/blob/v0.46.10/x/staking/keeper/msg_server.go#L34-L108) +func (k Keeper) CheckMsgCreateValidator(ctx sdk.Context, msg *stakingtypes.MsgCreateValidator) error { + // ensure validator address is correctly encoded + valAddr, err := sdk.ValAddressFromBech32(msg.ValidatorAddress) + if err != nil { + return err + } + + // get parameters of the staking module + sParams := k.stk.GetParams(ctx) + + // check commission rate + if msg.Commission.Rate.LT(sParams.MinCommissionRate) { + return errorsmod.Wrapf(stakingtypes.ErrCommissionLTMinRate, "cannot set validator commission to less than minimum rate of %s", sParams.MinCommissionRate) + } + + // ensure the validator operator was not registered before + if _, found := k.stk.GetValidator(ctx, valAddr); found { + return stakingtypes.ErrValidatorOwnerExists + } + + // check if the pubkey is correctly encoded + pk, ok := msg.Pubkey.GetCachedValue().(cryptotypes.PubKey) + if !ok { + return errorsmod.Wrapf(sdkerrors.ErrInvalidType, "Expecting cryptotypes.PubKey, got %T", pk) + } + + // ensure the validator was not registered before + if _, found := k.stk.GetValidatorByConsAddr(ctx, sdk.GetConsAddress(pk)); found { + return stakingtypes.ErrValidatorPubKeyExists + } + + // ensure BondDemon is correct + if msg.Value.Denom != sParams.BondDenom { + return errorsmod.Wrapf( + sdkerrors.ErrInvalidRequest, "invalid coin denomination: got %s, expected %s", msg.Value.Denom, sParams.BondDenom, + ) + } + + // ensure description's length is valid + if _, err := msg.Description.EnsureLength(); err != nil { + return err + } + + // ensure public key type is supported + cp := ctx.ConsensusParams() + if cp != nil && cp.Validator != nil { + pkType := pk.Type() + hasKeyType := false + for _, keyType := range cp.Validator.PubKeyTypes { + if pkType == keyType { + hasKeyType = true + break + } + } + if !hasKeyType { + return errorsmod.Wrapf( + stakingtypes.ErrValidatorPubKeyTypeNotSupported, + "got: %s, expected: %s", pk.Type(), cp.Validator.PubKeyTypes, + ) + } + } + + // check validator + validator, err := stakingtypes.NewValidator(valAddr, pk, msg.Description) + if err != nil { + return err + } + + // check if SetInitialCommission fails or not + commission := stakingtypes.NewCommissionWithTime( + msg.Commission.Rate, msg.Commission.MaxRate, + msg.Commission.MaxChangeRate, ctx.BlockHeader().Time, + ) + if _, err := validator.SetInitialCommission(commission); err != nil { + return err + } + + // sanity check on delegator address + delegatorAddr, err := sdk.AccAddressFromBech32(msg.DelegatorAddress) + if err != nil { + return err + } + + balance := k.bk.GetBalance(ctx, delegatorAddr, msg.Value.GetDenom()) + if msg.Value.IsGTE(balance) { + return types.ErrInsufficientBalance + } + + return nil +} diff --git a/x/epoching/module.go b/x/epoching/module.go index 77ad84fe9..f8215345c 100644 --- a/x/epoching/module.go +++ b/x/epoching/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/babylonchain/babylon/x/epoching/client/cli" "github.com/babylonchain/babylon/x/epoching/keeper" @@ -126,19 +126,9 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the capability module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} - // QuerierRoute returns the capability module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// LegacyQuerierHandler returns the capability module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { @@ -168,7 +158,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 1 } func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { BeginBlocker(ctx, am.keeper, req) diff --git a/x/epoching/module_simulation.go b/x/epoching/module_simulation.go index 40bfc890d..f5591fede 100644 --- a/x/epoching/module_simulation.go +++ b/x/epoching/module_simulation.go @@ -1,12 +1,10 @@ package epoching import ( - "math/rand" - + simappparams "github.com/babylonchain/babylon/app/params" epochingsimulation "github.com/babylonchain/babylon/x/epoching/simulation" "github.com/babylonchain/babylon/x/epoching/types" "github.com/cosmos/cosmos-sdk/baseapp" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -27,15 +25,10 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } -// RandomizedParams creates randomized param changes for the simulator -func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { - return epochingsimulation.ParamChanges(r) -} - // RegisterStoreDecoder registers a decoder func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { sdr[types.StoreKey] = epochingsimulation.NewDecodeStore(am.cdc) diff --git a/x/epoching/simulation/decoder.go b/x/epoching/simulation/decoder.go index 6346110b9..9c3bccc45 100644 --- a/x/epoching/simulation/decoder.go +++ b/x/epoching/simulation/decoder.go @@ -4,11 +4,11 @@ import ( "bytes" "fmt" + errorsmod "cosmossdk.io/errors" "cosmossdk.io/math" "github.com/babylonchain/babylon/x/epoching/types" "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/kv" ) @@ -37,11 +37,11 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { bytes.Equal(kvA.Key[:1], types.SlashedValidatorSetKey): valSetA, err := types.NewValidatorSetFromBytes(kvA.Value) if err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } valSetB, err := types.NewValidatorSetFromBytes(kvB.Value) if err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } return fmt.Sprintf("%v\n%v", valSetA, valSetB) @@ -49,10 +49,10 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { bytes.Equal(kvA.Key[:1], types.SlashedVotingPowerKey): var powerA, powerB math.Int if err := powerA.Unmarshal(kvA.Value); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } if err := powerB.Unmarshal(kvA.Value); err != nil { - panic(sdkerrors.Wrap(types.ErrUnmarshal, err.Error())) + panic(errorsmod.Wrap(types.ErrUnmarshal, err.Error())) } return fmt.Sprintf("%v\n%v", powerA, powerB) diff --git a/x/epoching/simulation/decoder_test.go b/x/epoching/simulation/decoder_test.go index f8fc723d6..79f173215 100644 --- a/x/epoching/simulation/decoder_test.go +++ b/x/epoching/simulation/decoder_test.go @@ -2,17 +2,19 @@ package simulation_test import ( "fmt" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "testing" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/stretchr/testify/require" - "github.com/babylonchain/babylon/app" - "github.com/babylonchain/babylon/x/epoching/simulation" - "github.com/babylonchain/babylon/x/epoching/types" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" + + "github.com/babylonchain/babylon/app" + "github.com/babylonchain/babylon/x/epoching/simulation" + "github.com/babylonchain/babylon/x/epoching/types" ) // nolint:deadcode,unused,varcheck @@ -25,7 +27,7 @@ var ( ) func TestDecodeStore(t *testing.T) { - cdc := app.MakeTestEncodingConfig().Marshaler + cdc := app.GetEncodingConfig().Marshaler dec := simulation.NewDecodeStore(cdc) epochNumber := uint64(123) diff --git a/x/epoching/simulation/operations.go b/x/epoching/simulation/operations.go index 31760584b..e338bde0a 100644 --- a/x/epoching/simulation/operations.go +++ b/x/epoching/simulation/operations.go @@ -8,10 +8,11 @@ import ( "github.com/babylonchain/babylon/x/epoching/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + simappparams "github.com/cosmos/cosmos-sdk/x/staking/simulation" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -114,10 +115,9 @@ func SimulateMsgWrappedDelegate(ak types.AccountKeeper, bk types.BankKeeper, stk msg := stakingtypes.NewMsgDelegate(simAccount.Address, val.GetOperator(), bondAmt) wmsg := types.NewMsgWrappedDelegate(msg) - txCtx := simulation.OperationInput{ App: app, - TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: wmsg, MsgType: wmsg.Type(), @@ -203,7 +203,7 @@ func SimulateMsgWrappedUndelegate(ak types.AccountKeeper, bk types.BankKeeper, s txCtx := simulation.OperationInput{ R: r, App: app, - TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: wmsg, MsgType: wmsg.Type(), @@ -312,7 +312,7 @@ func SimulateMsgWrappedBeginRedelegate(ak types.AccountKeeper, bk types.BankKeep txCtx := simulation.OperationInput{ R: r, App: app, - TxGen: simappparams.MakeTestEncodingConfig().TxConfig, + TxGen: moduletestutil.MakeTestEncodingConfig().TxConfig, Cdc: nil, Msg: wmsg, MsgType: wmsg.Type(), diff --git a/x/epoching/simulation/params.go b/x/epoching/simulation/params.go deleted file mode 100644 index c0a8c4336..000000000 --- a/x/epoching/simulation/params.go +++ /dev/null @@ -1,21 +0,0 @@ -package simulation - -// DONTCOVER - -import ( - "math/rand" - - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" -) - -// ParamChanges defines the parameters that can be modified by param change proposals on the simulation -// TODO: add support of changing EpochInterval on-the-fly -func ParamChanges(r *rand.Rand) []simtypes.ParamChange { - return []simtypes.ParamChange{ - // simulation.NewSimParamChange(types.ModuleName, string(types.KeyEpochInterval), - // func(r *rand.Rand) string { - // return fmt.Sprintf("%d", genEpochInterval(r)) - // }, - // ), - } -} diff --git a/x/epoching/simulation/params_test.go b/x/epoching/simulation/params_test.go deleted file mode 100644 index afd2e3307..000000000 --- a/x/epoching/simulation/params_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package simulation_test - -import ( - "math/rand" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/babylonchain/babylon/x/epoching/simulation" -) - -func TestParamChanges(t *testing.T) { - t.Skip("TODO: support changing epoch interval on-the-fly") - - s := rand.NewSource(1) - r := rand.New(s) - - expected := []struct { - composedKey string - key string - simValue string - subspace string - }{ - {"epoching/EpochInterval", "EpochInterval", "82", "epoching"}, - } - - paramChanges := simulation.ParamChanges(r) - - require.Len(t, paramChanges, 1) - - for i, p := range paramChanges { - require.Equal(t, expected[i].composedKey, p.ComposedKey()) - require.Equal(t, expected[i].key, p.Key()) - require.Equal(t, expected[i].simValue, p.SimValue()(r)) - require.Equal(t, expected[i].subspace, p.Subspace()) - } -} diff --git a/x/epoching/testepoching/helper.go b/x/epoching/testepoching/helper.go index 56c401b98..44ac8672f 100644 --- a/x/epoching/testepoching/helper.go +++ b/x/epoching/testepoching/helper.go @@ -1,19 +1,20 @@ package testepoching import ( + "math/rand" "testing" "github.com/babylonchain/babylon/crypto/bls12381" "github.com/babylonchain/babylon/testutil/datagen" "cosmossdk.io/math" - appparams "github.com/babylonchain/babylon/app/params" + proto "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" - "github.com/babylonchain/babylon/app" - "github.com/babylonchain/babylon/x/epoching" - "github.com/babylonchain/babylon/x/epoching/keeper" - "github.com/babylonchain/babylon/x/epoching/types" + appparams "github.com/babylonchain/babylon/app/params" + + abci "github.com/cometbft/cometbft/abci/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" @@ -21,8 +22,10 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - abci "github.com/tendermint/tendermint/abci/types" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" + + "github.com/babylonchain/babylon/app" + "github.com/babylonchain/babylon/x/epoching/keeper" + "github.com/babylonchain/babylon/x/epoching/types" ) type ValidatorInfo struct { @@ -74,7 +77,7 @@ func NewHelper(t *testing.T) *Helper { &epochingKeeper, msgSrvr, queryClient, - &app.StakingKeeper, + app.StakingKeeper, nil, []ValidatorInfo{ValidatorInfo{ blsPrivKey, @@ -121,19 +124,20 @@ func NewHelperWithValSet(t *testing.T) *Helper { queryClient := types.NewQueryClient(queryHelper) msgSrvr := keeper.NewMsgServerImpl(epochingKeeper) - return &Helper{t, ctx, app, &epochingKeeper, msgSrvr, queryClient, &app.StakingKeeper, GenAccs, valInfos} + return &Helper{t, ctx, app, &epochingKeeper, msgSrvr, queryClient, app.StakingKeeper, GenAccs, valInfos} } // GenAndApplyEmptyBlock generates a new empty block and appends it to the current blockchain -func (h *Helper) GenAndApplyEmptyBlock() sdk.Context { +func (h *Helper) GenAndApplyEmptyBlock(r *rand.Rand) sdk.Context { newHeight := h.App.LastBlockHeight() + 1 valSet := h.StakingKeeper.GetLastValidators(h.Ctx) valhash := CalculateValHash(valSet) newHeader := tmproto.Header{ Height: newHeight, - AppHash: datagen.GenRandomByteArray(32), ValidatorsHash: valhash, NextValidatorsHash: valhash, + AppHash: datagen.GenRandomByteArray(r, 32), + LastCommitHash: datagen.GenRandomLastCommitHash(r), } h.App.BeginBlock(abci.RequestBeginBlock{Header: newHeader}) @@ -144,13 +148,13 @@ func (h *Helper) GenAndApplyEmptyBlock() sdk.Context { return h.Ctx } -func (h *Helper) BeginBlock() sdk.Context { +func (h *Helper) BeginBlock(r *rand.Rand) sdk.Context { newHeight := h.App.LastBlockHeight() + 1 valSet := h.StakingKeeper.GetLastValidators(h.Ctx) valhash := CalculateValHash(valSet) newHeader := tmproto.Header{ Height: newHeight, - AppHash: datagen.GenRandomByteArray(32), + AppHash: datagen.GenRandomByteArray(r, 32), ValidatorsHash: valhash, NextValidatorsHash: valhash, } @@ -171,7 +175,9 @@ func (h *Helper) WrappedDelegate(delegator sdk.AccAddress, val sdk.ValAddress, a coin := sdk.NewCoin(appparams.DefaultBondDenom, amount) msg := stakingtypes.NewMsgDelegate(delegator, val, coin) wmsg := types.NewMsgWrappedDelegate(msg) - return h.Handle(wmsg, true) + return h.Handle(func(ctx sdk.Context) (proto.Message, error) { + return h.MsgSrvr.WrappedDelegate(ctx, wmsg) + }) } // WrappedDelegateWithPower calls handler to delegate stake for a validator @@ -179,7 +185,9 @@ func (h *Helper) WrappedDelegateWithPower(delegator sdk.AccAddress, val sdk.ValA coin := sdk.NewCoin(appparams.DefaultBondDenom, h.StakingKeeper.TokensFromConsensusPower(h.Ctx, power)) msg := stakingtypes.NewMsgDelegate(delegator, val, coin) wmsg := types.NewMsgWrappedDelegate(msg) - return h.Handle(wmsg, true) + return h.Handle(func(ctx sdk.Context) (proto.Message, error) { + return h.MsgSrvr.WrappedDelegate(ctx, wmsg) + }) } // WrappedUndelegate calls handler to unbound some stake from a validator. @@ -187,7 +195,9 @@ func (h *Helper) WrappedUndelegate(delegator sdk.AccAddress, val sdk.ValAddress, unbondAmt := sdk.NewCoin(appparams.DefaultBondDenom, amount) msg := stakingtypes.NewMsgUndelegate(delegator, val, unbondAmt) wmsg := types.NewMsgWrappedUndelegate(msg) - return h.Handle(wmsg, true) + return h.Handle(func(ctx sdk.Context) (proto.Message, error) { + return h.MsgSrvr.WrappedUndelegate(ctx, wmsg) + }) } // WrappedBeginRedelegate calls handler to redelegate some stake from a validator to another @@ -195,21 +205,18 @@ func (h *Helper) WrappedBeginRedelegate(delegator sdk.AccAddress, srcVal sdk.Val unbondAmt := sdk.NewCoin(appparams.DefaultBondDenom, amount) msg := stakingtypes.NewMsgBeginRedelegate(delegator, srcVal, dstVal, unbondAmt) wmsg := types.NewMsgWrappedBeginRedelegate(msg) - return h.Handle(wmsg, true) + return h.Handle(func(ctx sdk.Context) (proto.Message, error) { + return h.MsgSrvr.WrappedBeginRedelegate(ctx, wmsg) + }) } -// Handle calls epoching handler on a given message -func (h *Helper) Handle(msg sdk.Msg, ok bool) *sdk.Result { - handler := epoching.NewHandler(*h.EpochingKeeper) - res, err := handler(h.Ctx, msg) - if ok { - require.NoError(h.t, err) - require.NotNil(h.t, res) - } else { - require.Error(h.t, err) - require.Nil(h.t, res) - } - return res +// Handle executes an action function with the Helper's context, wraps the result into an SDK service result, and performs two assertions before returning it +func (h *Helper) Handle(action func(sdk.Context) (proto.Message, error)) *sdk.Result { + res, err := action(h.Ctx) + r, _ := sdk.WrapServiceResult(h.Ctx, res, err) + require.NotNil(h.t, r) + require.NoError(h.t, err) + return r } // CheckValidator asserts that a validor exists and has a given status (if status!="") diff --git a/x/epoching/testepoching/tm.go b/x/epoching/testepoching/tm.go index 4427b57c1..c7cc83b08 100644 --- a/x/epoching/testepoching/tm.go +++ b/x/epoching/testepoching/tm.go @@ -3,10 +3,10 @@ package testepoching import ( "cosmossdk.io/math" "github.com/babylonchain/babylon/testutil/datagen" + tmcrypto "github.com/cometbft/cometbft/crypto" + tmtypes "github.com/cometbft/cometbft/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - tmcrypto "github.com/tendermint/tendermint/crypto" - tmtypes "github.com/tendermint/tendermint/types" ) // GetTmConsPubKey gets the validator's public key as a tmcrypto.PubKey. diff --git a/x/epoching/testepoching/validator.go b/x/epoching/testepoching/validator.go index 0deb0de29..30400f002 100644 --- a/x/epoching/testepoching/validator.go +++ b/x/epoching/testepoching/validator.go @@ -3,8 +3,8 @@ package testepoching import ( "testing" + "github.com/cometbft/cometbft/crypto/merkle" "github.com/stretchr/testify/require" - "github.com/tendermint/tendermint/crypto/merkle" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/epoching/types/codec.go b/x/epoching/types/codec.go index 99c0144fb..cb32c4dae 100644 --- a/x/epoching/types/codec.go +++ b/x/epoching/types/codec.go @@ -12,6 +12,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgWrappedUndelegate{}, "epoching/WrappedUndelegate", nil) cdc.RegisterConcrete(&MsgWrappedBeginRedelegate{}, "epoching/WrappedBeginRedelegate", nil) cdc.RegisterConcrete(&QueuedMessage{}, "epoching/QueuedMessage", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "epoching/MsgUpdateParams", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -32,6 +33,10 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { (*sdk.Msg)(nil), &QueuedMessage{}, ) + registry.RegisterImplementations( + (*sdk.Msg)(nil), + &MsgUpdateParams{}, + ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } diff --git a/x/epoching/types/epoching.go b/x/epoching/types/epoching.go index 2f222fd4c..bed9745dc 100644 --- a/x/epoching/types/epoching.go +++ b/x/epoching/types/epoching.go @@ -3,14 +3,14 @@ package types import ( "time" + errorsmod "cosmossdk.io/errors" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/cometbft/cometbft/crypto/tmhash" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto/tmhash" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) // NewEpoch constructs a new Epoch object @@ -170,7 +170,7 @@ func (qm *QueuedMessage) UnwrapToSdkMsg() sdk.Msg { case *QueuedMessage_MsgBeginRedelegate: unwrappedMsgWithType = unwrappedMsg.MsgBeginRedelegate default: - panic(sdkerrors.Wrap(ErrInvalidQueuedMessageType, qm.String())) + panic(errorsmod.Wrap(ErrInvalidQueuedMessageType, qm.String())) } return unwrappedMsgWithType } diff --git a/x/epoching/types/epoching.pb.go b/x/epoching/types/epoching.pb.go index a2681aef8..ffa316a79 100644 --- a/x/epoching/types/epoching.pb.go +++ b/x/epoching/types/epoching.pb.go @@ -5,11 +5,11 @@ package types import ( fmt "fmt" + types "github.com/cometbft/cometbft/proto/tendermint/types" types1 "github.com/cosmos/cosmos-sdk/x/staking/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - types "github.com/tendermint/tendermint/proto/tendermint/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "google.golang.org/protobuf/types/known/timestamppb" io "io" math "math" @@ -29,14 +29,20 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// BondState is the bond state of a validator or delegation type BondState int32 const ( - BondState_CREATED BondState = 0 - BondState_BONDED BondState = 1 + // CREATED is when the validator/delegation has been created + BondState_CREATED BondState = 0 + // CREATED is when the validator/delegation has become bonded + BondState_BONDED BondState = 1 + // CREATED is when the validator/delegation has become unbonding BondState_UNBONDING BondState = 2 - BondState_UNBONDED BondState = 3 - BondState_REMOVED BondState = 4 + // CREATED is when the validator/delegation has become unbonded + BondState_UNBONDED BondState = 3 + // CREATED is when the validator/delegation has been removed + BondState_REMOVED BondState = 4 ) var BondState_name = map[int32]string{ @@ -63,19 +69,23 @@ func (BondState) EnumDescriptor() ([]byte, []int) { return fileDescriptor_2f2f209d5311f84c, []int{0} } +// Epoch is a structure that contains the metadata of an epoch type Epoch struct { EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` CurrentEpochInterval uint64 `protobuf:"varint,2,opt,name=current_epoch_interval,json=currentEpochInterval,proto3" json:"current_epoch_interval,omitempty"` FirstBlockHeight uint64 `protobuf:"varint,3,opt,name=first_block_height,json=firstBlockHeight,proto3" json:"first_block_height,omitempty"` // last_block_header is the header of the last block in this epoch. - // Babylon needs to remember the last header of each epoch to complete unbonding validators/delegations when a previous epoch's checkpoint is finalised. - // The last_block_header field is nil in the epoch's beginning, and is set upon the end of this epoch. + // Babylon needs to remember the last header of each epoch to complete + // unbonding validators/delegations when a previous epoch's checkpoint is + // finalised. The last_block_header field is nil in the epoch's beginning, and + // is set upon the end of this epoch. LastBlockHeader *types.Header `protobuf:"bytes,4,opt,name=last_block_header,json=lastBlockHeader,proto3" json:"last_block_header,omitempty"` // app_hash_root is the Merkle root of all AppHashs in this epoch // It will be used for proving a block is in an epoch AppHashRoot []byte `protobuf:"bytes,5,opt,name=app_hash_root,json=appHashRoot,proto3" json:"app_hash_root,omitempty"` // sealer_header is the 2nd header of the next epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of the sealer header + // This validator set has generated a BLS multisig on `last_commit_hash` of + // the sealer header SealerHeader *types.Header `protobuf:"bytes,6,opt,name=sealer_header,json=sealerHeader,proto3" json:"sealer_header,omitempty"` } @@ -154,7 +164,8 @@ func (m *Epoch) GetSealerHeader() *types.Header { return nil } -// QueuedMessage is a message that can change the validator set and is delayed to the epoch boundary +// QueuedMessage is a message that can change the validator set and is delayed +// to the epoch boundary type QueuedMessage struct { // tx_id is the ID of the tx that contains the message TxId []byte `protobuf:"bytes,1,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` @@ -164,7 +175,8 @@ type QueuedMessage struct { BlockHeight uint64 `protobuf:"varint,3,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` // block_time is the timestamp when this msg is submitted to Babylon BlockTime *time.Time `protobuf:"bytes,4,opt,name=block_time,json=blockTime,proto3,stdtime" json:"block_time,omitempty"` - // msg is the actual message that is sent by a user and is queued by the epoching module + // msg is the actual message that is sent by a user and is queued by the + // epoching module // // Types that are valid to be assigned to Msg: // *QueuedMessage_MsgCreateValidator @@ -304,6 +316,8 @@ func (*QueuedMessage) XXX_OneofWrappers() []interface{} { } } +// QueuedMessageList is a message that contains a list of staking-related +// messages queued for an epoch type QueuedMessageList struct { EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` Msgs []*QueuedMessage `protobuf:"bytes,2,rep,name=msgs,proto3" json:"msgs,omitempty"` @@ -356,6 +370,7 @@ func (m *QueuedMessageList) GetMsgs() []*QueuedMessage { return nil } +// ValStateUpdate is a messages that records a state update of a validator type ValStateUpdate struct { State BondState `protobuf:"varint,1,opt,name=state,proto3,enum=babylon.epoching.v1.BondState" json:"state,omitempty"` BlockHeight uint64 `protobuf:"varint,2,opt,name=block_height,json=blockHeight,proto3" json:"block_height,omitempty"` @@ -416,6 +431,8 @@ func (m *ValStateUpdate) GetBlockTime() *time.Time { return nil } +// ValidatorLifecycle is a message that records records the lifecycle of +// a validator type ValidatorLifecycle struct { ValAddr string `protobuf:"bytes,1,opt,name=val_addr,json=valAddr,proto3" json:"val_addr,omitempty"` ValLife []*ValStateUpdate `protobuf:"bytes,2,rep,name=val_life,json=valLife,proto3" json:"val_life,omitempty"` @@ -468,6 +485,8 @@ func (m *ValidatorLifecycle) GetValLife() []*ValStateUpdate { return nil } +// DelegationStateUpdate is the message that records a state update of a +// delegation type DelegationStateUpdate struct { State BondState `protobuf:"varint,1,opt,name=state,proto3,enum=babylon.epoching.v1.BondState" json:"state,omitempty"` ValAddr string `protobuf:"bytes,2,opt,name=val_addr,json=valAddr,proto3" json:"val_addr,omitempty"` @@ -536,6 +555,8 @@ func (m *DelegationStateUpdate) GetBlockTime() *time.Time { return nil } +// ValidatorLifecycle is a message that records records the lifecycle of +// a delegation type DelegationLifecycle struct { DelAddr string `protobuf:"bytes,1,opt,name=del_addr,json=delAddr,proto3" json:"del_addr,omitempty"` DelLife []*DelegationStateUpdate `protobuf:"bytes,2,rep,name=del_life,json=delLife,proto3" json:"del_life,omitempty"` @@ -588,6 +609,7 @@ func (m *DelegationLifecycle) GetDelLife() []*DelegationStateUpdate { return nil } +// Validator is a message that denotes a validator type Validator struct { // addr is the validator's address (in sdk.ValAddress) Addr []byte `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"` @@ -815,7 +837,7 @@ func (m *QueuedMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { } } if m.BlockTime != nil { - n3, err3 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime):]) + n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime):]) if err3 != nil { return 0, err3 } @@ -993,7 +1015,7 @@ func (m *ValStateUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.BlockTime != nil { - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime):]) + n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime):]) if err8 != nil { return 0, err8 } @@ -1080,7 +1102,7 @@ func (m *DelegationStateUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.BlockTime != nil { - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime):]) + n9, err9 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.BlockTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime):]) if err9 != nil { return 0, err9 } @@ -1247,7 +1269,7 @@ func (m *QueuedMessage) Size() (n int) { n += 1 + sovEpoching(uint64(m.BlockHeight)) } if m.BlockTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime) n += 1 + l + sovEpoching(uint64(l)) } if m.Msg != nil { @@ -1335,7 +1357,7 @@ func (m *ValStateUpdate) Size() (n int) { n += 1 + sovEpoching(uint64(m.BlockHeight)) } if m.BlockTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime) n += 1 + l + sovEpoching(uint64(l)) } return n @@ -1377,7 +1399,7 @@ func (m *DelegationStateUpdate) Size() (n int) { n += 1 + sovEpoching(uint64(m.BlockHeight)) } if m.BlockTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.BlockTime) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.BlockTime) n += 1 + l + sovEpoching(uint64(l)) } return n @@ -1785,7 +1807,7 @@ func (m *QueuedMessage) Unmarshal(dAtA []byte) error { if m.BlockTime == nil { m.BlockTime = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2152,7 +2174,7 @@ func (m *ValStateUpdate) Unmarshal(dAtA []byte) error { if m.BlockTime == nil { m.BlockTime = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2424,7 +2446,7 @@ func (m *DelegationStateUpdate) Unmarshal(dAtA []byte) error { if m.BlockTime == nil { m.BlockTime = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.BlockTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/epoching/types/epoching_test.go b/x/epoching/types/epoching_test.go index 8d663a188..a82e9e303 100644 --- a/x/epoching/types/epoching_test.go +++ b/x/epoching/types/epoching_test.go @@ -1,6 +1,7 @@ package types_test import ( + "github.com/babylonchain/babylon/testutil/datagen" "math/rand" "testing" @@ -9,24 +10,14 @@ import ( ) func FuzzEpoch(f *testing.F) { - f.Add(int64(11111)) - f.Add(int64(22222)) - f.Add(int64(55555)) - + datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // generate a random epoch - epochNumber := rand.Uint64() + 1 - curEpochInterval := rand.Uint64()%100 + 2 - firstBlockHeight := rand.Uint64() + 1 - - // genesis block case with some probability - genesisFlag := rand.Uint64()%100 < 10 - if genesisFlag { - epochNumber = 0 - firstBlockHeight = 0 - } + epochNumber := uint64(r.Int63()) + 1 + curEpochInterval := r.Uint64()%100 + 2 + firstBlockHeight := r.Uint64() + 1 e := types.Epoch{ EpochNumber: epochNumber, @@ -34,14 +25,9 @@ func FuzzEpoch(f *testing.F) { FirstBlockHeight: firstBlockHeight, } - if genesisFlag { - require.Equal(t, uint64(0), e.GetLastBlockHeight()) - require.Equal(t, uint64(0), e.GetSecondBlockHeight()) - } else { - lastBlockHeight := firstBlockHeight + curEpochInterval - 1 - require.Equal(t, lastBlockHeight, e.GetLastBlockHeight()) - secondBlockheight := firstBlockHeight + 1 - require.Equal(t, secondBlockheight, e.GetSecondBlockHeight()) - } + lastBlockHeight := firstBlockHeight + curEpochInterval - 1 + require.Equal(t, lastBlockHeight, e.GetLastBlockHeight()) + secondBlockheight := firstBlockHeight + 1 + require.Equal(t, secondBlockheight, e.GetSecondBlockHeight()) }) } diff --git a/x/epoching/types/errors.go b/x/epoching/types/errors.go index a2fc6a004..bd1028ef3 100644 --- a/x/epoching/types/errors.go +++ b/x/epoching/types/errors.go @@ -3,22 +3,24 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) -// x/epoching module sentinel errors var ( - ErrUnwrappedMsgType = sdkerrors.Register(ModuleName, 1, "invalid message type in {MsgCreateValidator, MsgDelegate, MsgUndelegate, MsgBeginRedelegate} messages. use wrapped versions instead") - ErrInvalidQueuedMessageType = sdkerrors.Register(ModuleName, 2, "invalid message type of a QueuedMessage") - ErrUnknownEpochNumber = sdkerrors.Register(ModuleName, 3, "the epoch number is not known in DB") - ErrUnknownQueueLen = sdkerrors.Register(ModuleName, 4, "the msg queue length is not known in DB") - ErrUnknownSlashedVotingPower = sdkerrors.Register(ModuleName, 5, "the slashed voting power is not known in DB. Maybe the epoch has been checkpointed?") - ErrUnknownValidator = sdkerrors.Register(ModuleName, 6, "the validator is not known in the validator set.") - ErrUnknownTotalVotingPower = sdkerrors.Register(ModuleName, 7, "the total voting power is not known in DB.") - ErrMarshal = sdkerrors.Register(ModuleName, 8, "marshal error.") - ErrUnmarshal = sdkerrors.Register(ModuleName, 9, "unmarshal error.") - ErrNoWrappedMsg = sdkerrors.Register(ModuleName, 10, "the wrapped msg contains no msg inside.") - ErrZeroEpochMsg = sdkerrors.Register(ModuleName, 11, "the 0-th epoch does not handle messages") - ErrInvalidEpoch = sdkerrors.Register(ModuleName, 12, "the epoch is invalid") - ErrInvalidHeight = sdkerrors.Register(ModuleName, 13, "the height is invalid") + ErrUnwrappedMsgType = errorsmod.Register(ModuleName, 1, ` + invalid message type in {MsgCreateValidator, MsgDelegate, MsgUndelegate, MsgBeginRedelegate} + messages. For creating a validator use the wrapped version under 'tx checkpointing create-validator' + and for the other messages use the wrapped versions under 'tx epoching {delegate,undelegate,redelegate}'`) + ErrInvalidQueuedMessageType = errorsmod.Register(ModuleName, 2, "invalid message type of a QueuedMessage") + ErrUnknownEpochNumber = errorsmod.Register(ModuleName, 3, "the epoch number is not known in DB") + ErrUnknownSlashedVotingPower = errorsmod.Register(ModuleName, 5, "the slashed voting power is not known in DB. Maybe the epoch has been checkpointed?") + ErrUnknownValidator = errorsmod.Register(ModuleName, 6, "the validator is not known in the validator set.") + ErrUnknownTotalVotingPower = errorsmod.Register(ModuleName, 7, "the total voting power is not known in DB.") + ErrMarshal = errorsmod.Register(ModuleName, 8, "marshal error.") + ErrUnmarshal = errorsmod.Register(ModuleName, 9, "unmarshal error.") + ErrNoWrappedMsg = errorsmod.Register(ModuleName, 10, "the wrapped msg contains no msg inside.") + ErrZeroEpochMsg = errorsmod.Register(ModuleName, 11, "the 0-th epoch does not handle messages") + ErrInvalidEpoch = errorsmod.Register(ModuleName, 12, "the epoch is invalid") + ErrInvalidHeight = errorsmod.Register(ModuleName, 13, "the height is invalid") + ErrInsufficientBalance = errorsmod.Register(ModuleName, 14, "the delegator has insufficient balance to perform delegate") ) diff --git a/x/epoching/types/events.pb.go b/x/epoching/types/events.pb.go index 63842f488..5037813b2 100644 --- a/x/epoching/types/events.pb.go +++ b/x/epoching/types/events.pb.go @@ -5,9 +5,9 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_tendermint_tendermint_abci_types "github.com/tendermint/tendermint/abci/types" + github_com_cometbft_cometbft_abci_types "github.com/cometbft/cometbft/abci/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -24,6 +24,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// EventBeginEpoch is the event emitted when an epoch has started type EventBeginEpoch struct { EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` } @@ -68,6 +69,7 @@ func (m *EventBeginEpoch) GetEpochNumber() uint64 { return 0 } +// EventEndEpoch is the event emitted when an epoch has ended type EventEndEpoch struct { EpochNumber uint64 `protobuf:"varint,1,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` } @@ -112,14 +114,16 @@ func (m *EventEndEpoch) GetEpochNumber() uint64 { return 0 } +// EventHandleQueuedMsg is the event emitted when a queued message has been +// handled type EventHandleQueuedMsg struct { - OriginalEventType string `protobuf:"bytes,1,opt,name=original_event_type,json=originalEventType,proto3" json:"original_event_type,omitempty"` - EpochNumber uint64 `protobuf:"varint,2,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` - Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` - TxId []byte `protobuf:"bytes,4,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` - MsgId []byte `protobuf:"bytes,5,opt,name=msg_id,json=msgId,proto3" json:"msg_id,omitempty"` - OriginalAttributes []github_com_tendermint_tendermint_abci_types.EventAttribute `protobuf:"bytes,6,rep,name=original_attributes,json=originalAttributes,proto3,customtype=github.com/tendermint/tendermint/abci/types.EventAttribute" json:"original_attributes,omitempty"` - Error string `protobuf:"bytes,7,opt,name=error,proto3" json:"error,omitempty"` + OriginalEventType string `protobuf:"bytes,1,opt,name=original_event_type,json=originalEventType,proto3" json:"original_event_type,omitempty"` + EpochNumber uint64 `protobuf:"varint,2,opt,name=epoch_number,json=epochNumber,proto3" json:"epoch_number,omitempty"` + Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + TxId []byte `protobuf:"bytes,4,opt,name=tx_id,json=txId,proto3" json:"tx_id,omitempty"` + MsgId []byte `protobuf:"bytes,5,opt,name=msg_id,json=msgId,proto3" json:"msg_id,omitempty"` + OriginalAttributes []github_com_cometbft_cometbft_abci_types.EventAttribute `protobuf:"bytes,6,rep,name=original_attributes,json=originalAttributes,proto3,customtype=github.com/cometbft/cometbft/abci/types.EventAttribute" json:"original_attributes,omitempty"` + Error string `protobuf:"bytes,7,opt,name=error,proto3" json:"error,omitempty"` } func (m *EventHandleQueuedMsg) Reset() { *m = EventHandleQueuedMsg{} } @@ -197,6 +201,8 @@ func (m *EventHandleQueuedMsg) GetError() string { return "" } +// EventSlashThreshold is the event emitted when a set of validators have been +// slashed type EventSlashThreshold struct { SlashedVotingPower int64 `protobuf:"varint,1,opt,name=slashed_voting_power,json=slashedVotingPower,proto3" json:"slashed_voting_power,omitempty"` TotalVotingPower int64 `protobuf:"varint,2,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` @@ -257,6 +263,8 @@ func (m *EventSlashThreshold) GetSlashedValidators() [][]byte { return nil } +// EventWrappedDelegate is the event emitted when a MsgWrappedDelegate has been +// queued type EventWrappedDelegate struct { DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` @@ -333,6 +341,8 @@ func (m *EventWrappedDelegate) GetEpochBoundary() uint64 { return 0 } +// EventWrappedUndelegate is the event emitted when a MsgWrappedUndelegate has +// been queued type EventWrappedUndelegate struct { DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` ValidatorAddress string `protobuf:"bytes,2,opt,name=validator_address,json=validatorAddress,proto3" json:"validator_address,omitempty"` @@ -409,6 +419,8 @@ func (m *EventWrappedUndelegate) GetEpochBoundary() uint64 { return 0 } +// EventWrappedBeginRedelegate is the event emitted when a +// MsgWrappedBeginRedelegate has been queued type EventWrappedBeginRedelegate struct { DelegatorAddress string `protobuf:"bytes,1,opt,name=delegator_address,json=delegatorAddress,proto3" json:"delegator_address,omitempty"` SourceValidatorAddress string `protobuf:"bytes,2,opt,name=source_validator_address,json=sourceValidatorAddress,proto3" json:"source_validator_address,omitempty"` @@ -506,46 +518,46 @@ func init() { func init() { proto.RegisterFile("babylon/epoching/v1/events.proto", fileDescriptor_2f0a2c43c7aaeb43) } var fileDescriptor_2f0a2c43c7aaeb43 = []byte{ - // 623 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xcf, 0x6a, 0xd4, 0x40, - 0x18, 0x6f, 0xf6, 0x9f, 0x74, 0x6c, 0xb5, 0x9d, 0x5d, 0x97, 0x60, 0x71, 0x5d, 0x17, 0x84, 0x82, - 0xba, 0x69, 0xd5, 0x83, 0x78, 0x10, 0xba, 0x58, 0xb0, 0x82, 0xa2, 0xb1, 0x56, 0xf0, 0x12, 0x26, - 0x3b, 0x1f, 0xc9, 0x40, 0x32, 0x13, 0x66, 0x26, 0x6b, 0xf7, 0x2d, 0x7c, 0x01, 0x6f, 0x3e, 0x82, - 0xaf, 0x20, 0x7a, 0xec, 0x51, 0x3c, 0x88, 0xb4, 0x2f, 0x22, 0x99, 0xfc, 0x31, 0xda, 0xad, 0x88, - 0x37, 0x6f, 0x33, 0xbf, 0x3f, 0xdf, 0xe4, 0xf7, 0x7d, 0x99, 0x41, 0x43, 0x9f, 0xf8, 0xf3, 0x48, - 0x70, 0x07, 0x12, 0x31, 0x0d, 0x19, 0x0f, 0x9c, 0xd9, 0xb6, 0x03, 0x33, 0xe0, 0x5a, 0x8d, 0x13, - 0x29, 0xb4, 0xc0, 0xdd, 0x42, 0x31, 0x2e, 0x15, 0xe3, 0xd9, 0xf6, 0xe5, 0x5e, 0x20, 0x02, 0x61, - 0x78, 0x27, 0x5b, 0xe5, 0xd2, 0xd1, 0x5d, 0x74, 0x71, 0x37, 0xb3, 0x4e, 0x20, 0x60, 0x7c, 0x37, - 0x93, 0xe3, 0x6b, 0x68, 0xc5, 0xf8, 0x3c, 0x9e, 0xc6, 0x3e, 0x48, 0xdb, 0x1a, 0x5a, 0x9b, 0x2d, - 0xf7, 0xbc, 0xc1, 0x9e, 0x1a, 0x68, 0x74, 0x1b, 0xad, 0x1a, 0xd7, 0x2e, 0xa7, 0x7f, 0xed, 0xf9, - 0xd0, 0x40, 0x3d, 0x63, 0x7a, 0x44, 0x38, 0x8d, 0xe0, 0x79, 0x0a, 0x29, 0xd0, 0x27, 0x2a, 0xc0, - 0x63, 0xd4, 0x15, 0x92, 0x05, 0x8c, 0x93, 0xc8, 0x33, 0x31, 0x3c, 0x3d, 0x4f, 0xc0, 0x94, 0x58, - 0x76, 0xd7, 0x4b, 0xca, 0x58, 0xf7, 0xe7, 0x09, 0x9c, 0x3a, 0xab, 0x71, 0xea, 0x2c, 0xdc, 0x47, - 0x9d, 0x10, 0x58, 0x10, 0x6a, 0xbb, 0x69, 0xc8, 0x62, 0x87, 0xbb, 0xa8, 0xad, 0x0f, 0x3d, 0x46, - 0xed, 0xd6, 0xd0, 0xda, 0x5c, 0x71, 0x5b, 0xfa, 0x70, 0x8f, 0xe2, 0x4b, 0xa8, 0x13, 0xab, 0x20, - 0x43, 0xdb, 0x06, 0x6d, 0xc7, 0x2a, 0xd8, 0xa3, 0x58, 0xd4, 0x3e, 0x8b, 0x68, 0x2d, 0x99, 0x9f, - 0x6a, 0x50, 0x76, 0x67, 0xd8, 0xdc, 0x5c, 0x99, 0x3c, 0xf8, 0xfa, 0xed, 0xea, 0xfd, 0x80, 0xe9, - 0x30, 0xf5, 0xc7, 0x53, 0x11, 0x3b, 0x1a, 0x38, 0x05, 0x19, 0x33, 0xae, 0xeb, 0x4b, 0xe2, 0x4f, - 0x99, 0x93, 0x85, 0x51, 0x63, 0xf3, 0xf9, 0x3b, 0x65, 0x19, 0x17, 0x97, 0xa5, 0x2b, 0x48, 0xe1, - 0x1e, 0x6a, 0x83, 0x94, 0x42, 0xda, 0xe7, 0x4c, 0xf2, 0x7c, 0x33, 0x7a, 0x6f, 0xa1, 0xae, 0x31, - 0xbf, 0x88, 0x88, 0x0a, 0xf7, 0x43, 0x09, 0x2a, 0x14, 0x11, 0xc5, 0x5b, 0xa8, 0xa7, 0x32, 0x04, - 0xa8, 0x37, 0x13, 0x9a, 0xf1, 0xc0, 0x4b, 0xc4, 0x9b, 0xa2, 0xf3, 0x4d, 0x17, 0x17, 0xdc, 0x81, - 0xa1, 0x9e, 0x65, 0x0c, 0xbe, 0x89, 0xb0, 0x16, 0x9a, 0x44, 0xbf, 0xea, 0x1b, 0x46, 0xbf, 0x66, - 0x98, 0xba, 0xfa, 0x16, 0xc2, 0x55, 0x7d, 0x12, 0x31, 0x4a, 0xb4, 0x90, 0xca, 0x6e, 0x66, 0xe9, - 0xdd, 0xf5, 0xb2, 0x7a, 0x45, 0x8c, 0x3e, 0x5a, 0xc5, 0x74, 0x5f, 0x49, 0x92, 0x24, 0x40, 0x1f, - 0x42, 0x04, 0x01, 0xd1, 0x80, 0x6f, 0xa0, 0x75, 0x9a, 0xaf, 0x85, 0xf4, 0x08, 0xa5, 0x12, 0x94, - 0x2a, 0x66, 0xbb, 0x56, 0x11, 0x3b, 0x39, 0x9e, 0x89, 0xab, 0xc3, 0x2a, 0x71, 0x23, 0x17, 0x57, - 0x44, 0x29, 0xee, 0xa3, 0x0e, 0x89, 0x45, 0xca, 0xab, 0x21, 0xe7, 0xbb, 0xac, 0x8f, 0x14, 0xb8, - 0x88, 0xcd, 0x90, 0x97, 0xdd, 0x7c, 0x83, 0xaf, 0xa3, 0x0b, 0xf9, 0x5f, 0xe3, 0x8b, 0x94, 0x53, - 0x22, 0xe7, 0x66, 0xda, 0x2d, 0x77, 0xd5, 0xa0, 0x93, 0x02, 0x1c, 0x7d, 0xb2, 0x50, 0xbf, 0x9e, - 0xe3, 0x25, 0xa7, 0xff, 0x69, 0x92, 0x77, 0x0d, 0xb4, 0x51, 0x4f, 0x62, 0x6e, 0xb8, 0x0b, 0xff, - 0x16, 0xe7, 0x1e, 0xb2, 0x95, 0x48, 0xe5, 0x14, 0xbc, 0xb3, 0x52, 0xf5, 0x73, 0xfe, 0xe0, 0xf7, - 0x6c, 0x13, 0x74, 0x85, 0x82, 0xd2, 0x8c, 0x13, 0xcd, 0x04, 0x5f, 0x60, 0x6f, 0x1a, 0xfb, 0x46, - 0x4d, 0x74, 0x70, 0x76, 0x7f, 0x5a, 0x8b, 0xfb, 0xd3, 0xfe, 0x73, 0x7f, 0x3a, 0x0b, 0xfa, 0x33, - 0x79, 0xfc, 0xf9, 0x78, 0x60, 0x1d, 0x1d, 0x0f, 0xac, 0xef, 0xc7, 0x03, 0xeb, 0xed, 0xc9, 0x60, - 0xe9, 0xe8, 0x64, 0xb0, 0xf4, 0xe5, 0x64, 0xb0, 0xf4, 0x7a, 0xab, 0x76, 0xb1, 0x8b, 0x97, 0x74, - 0x1a, 0x12, 0xc6, 0xcb, 0x8d, 0x73, 0xf8, 0xf3, 0xe9, 0x35, 0xb7, 0xdb, 0xef, 0x98, 0xc7, 0xf4, - 0xce, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x98, 0x17, 0x1c, 0xc5, 0x9b, 0x05, 0x00, 0x00, + // 624 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x54, 0xdd, 0x6a, 0xd4, 0x4e, + 0x14, 0x6f, 0xf6, 0xeb, 0x4f, 0xe7, 0xdf, 0x6a, 0x3b, 0xbb, 0x2e, 0xc1, 0xe2, 0xba, 0x2e, 0x08, + 0x05, 0x75, 0xd3, 0xaa, 0x88, 0x78, 0xd7, 0xc5, 0x82, 0x15, 0x14, 0x8d, 0xb5, 0x82, 0x37, 0x61, + 0xb2, 0x73, 0x4c, 0x06, 0x93, 0x99, 0x30, 0x33, 0x59, 0xbb, 0x6f, 0xe1, 0x0b, 0x78, 0xe7, 0x03, + 0xf8, 0x12, 0xa2, 0x97, 0xbd, 0x14, 0x2f, 0x44, 0xda, 0x17, 0x91, 0x4c, 0x3e, 0x1a, 0x6d, 0x2b, + 0xe2, 0x9d, 0x77, 0x33, 0xbf, 0x8f, 0x33, 0xf9, 0x9d, 0x93, 0x19, 0x34, 0xf4, 0x89, 0x3f, 0x8f, + 0x04, 0x77, 0x20, 0x11, 0xd3, 0x90, 0xf1, 0xc0, 0x99, 0x6d, 0x3a, 0x30, 0x03, 0xae, 0xd5, 0x38, + 0x91, 0x42, 0x0b, 0xdc, 0x2d, 0x14, 0xe3, 0x52, 0x31, 0x9e, 0x6d, 0x5e, 0xec, 0x05, 0x22, 0x10, + 0x86, 0x77, 0xb2, 0x55, 0x2e, 0x1d, 0xdd, 0x46, 0xe7, 0xb7, 0x33, 0xeb, 0x04, 0x02, 0xc6, 0xb7, + 0x33, 0x39, 0xbe, 0x82, 0x96, 0x8c, 0xcf, 0xe3, 0x69, 0xec, 0x83, 0xb4, 0xad, 0xa1, 0xb5, 0xde, + 0x72, 0xff, 0x37, 0xd8, 0x63, 0x03, 0x8d, 0x6e, 0xa2, 0x65, 0xe3, 0xda, 0xe6, 0xf4, 0x8f, 0x3d, + 0x1f, 0x1a, 0xa8, 0x67, 0x4c, 0x0f, 0x08, 0xa7, 0x11, 0x3c, 0x4d, 0x21, 0x05, 0xfa, 0x48, 0x05, + 0x78, 0x8c, 0xba, 0x42, 0xb2, 0x80, 0x71, 0x12, 0x79, 0x26, 0x86, 0xa7, 0xe7, 0x09, 0x98, 0x12, + 0x8b, 0xee, 0x6a, 0x49, 0x19, 0xeb, 0xee, 0x3c, 0x81, 0x13, 0x67, 0x35, 0x4e, 0x9c, 0x85, 0xfb, + 0xa8, 0x13, 0x02, 0x0b, 0x42, 0x6d, 0x37, 0x0d, 0x59, 0xec, 0x70, 0x17, 0xb5, 0xf5, 0xbe, 0xc7, + 0xa8, 0xdd, 0x1a, 0x5a, 0xeb, 0x4b, 0x6e, 0x4b, 0xef, 0xef, 0x50, 0x7c, 0x01, 0x75, 0x62, 0x15, + 0x64, 0x68, 0xdb, 0xa0, 0xed, 0x58, 0x05, 0x3b, 0x14, 0xbf, 0xae, 0x7d, 0x16, 0xd1, 0x5a, 0x32, + 0x3f, 0xd5, 0xa0, 0xec, 0xce, 0xb0, 0xb9, 0xbe, 0x34, 0xb9, 0xf7, 0xf5, 0xdb, 0xe5, 0x3b, 0x01, + 0xd3, 0x61, 0xea, 0x8f, 0xa7, 0x22, 0x76, 0xa6, 0x22, 0x06, 0xed, 0xbf, 0xd2, 0xc7, 0x0b, 0xe2, + 0x4f, 0x99, 0x93, 0x05, 0x51, 0x63, 0xf3, 0xe9, 0x5b, 0x65, 0x09, 0x17, 0x97, 0x65, 0x2b, 0x48, + 0xe1, 0x1e, 0x6a, 0x83, 0x94, 0x42, 0xda, 0xff, 0x99, 0xd4, 0xf9, 0x66, 0xf4, 0xde, 0x42, 0x5d, + 0x63, 0x7e, 0x16, 0x11, 0x15, 0xee, 0x86, 0x12, 0x54, 0x28, 0x22, 0x8a, 0x37, 0x50, 0x4f, 0x65, + 0x08, 0x50, 0x6f, 0x26, 0x34, 0xe3, 0x81, 0x97, 0x88, 0x37, 0x45, 0xd7, 0x9b, 0x2e, 0x2e, 0xb8, + 0x3d, 0x43, 0x3d, 0xc9, 0x18, 0x7c, 0x1d, 0x61, 0x2d, 0x34, 0x89, 0x7e, 0xd6, 0x37, 0x8c, 0x7e, + 0xc5, 0x30, 0x75, 0xf5, 0x0d, 0x84, 0xab, 0xfa, 0x24, 0x62, 0x94, 0x68, 0x21, 0x95, 0xdd, 0xcc, + 0x92, 0xbb, 0xab, 0x65, 0xf5, 0x8a, 0x18, 0x7d, 0xb4, 0x8a, 0xc9, 0xbe, 0x90, 0x24, 0x49, 0x80, + 0xde, 0x87, 0x08, 0x02, 0xa2, 0x01, 0x5f, 0x43, 0xab, 0x34, 0x5f, 0x0b, 0xe9, 0x11, 0x4a, 0x25, + 0x28, 0x55, 0xcc, 0x75, 0xa5, 0x22, 0xb6, 0x72, 0x3c, 0x13, 0x57, 0x87, 0x55, 0xe2, 0x46, 0x2e, + 0xae, 0x88, 0x52, 0xdc, 0x47, 0x1d, 0x12, 0x8b, 0x94, 0x57, 0x03, 0xce, 0x77, 0x59, 0x1f, 0x29, + 0x70, 0x11, 0x9b, 0x01, 0x2f, 0xba, 0xf9, 0x06, 0x5f, 0x45, 0xe7, 0xf2, 0x3f, 0xc6, 0x17, 0x29, + 0xa7, 0x44, 0xce, 0xcd, 0xa4, 0x5b, 0xee, 0xb2, 0x41, 0x27, 0x05, 0x38, 0xfa, 0x64, 0xa1, 0x7e, + 0x3d, 0xc7, 0x73, 0x4e, 0xff, 0xd1, 0x24, 0xef, 0x1a, 0x68, 0xad, 0x9e, 0xc4, 0xdc, 0x6e, 0x17, + 0xfe, 0x2e, 0xce, 0x5d, 0x64, 0x2b, 0x91, 0xca, 0x29, 0x78, 0x67, 0xa5, 0xea, 0xe7, 0xfc, 0xde, + 0xaf, 0xd9, 0x26, 0xe8, 0x12, 0x05, 0xa5, 0x19, 0x27, 0x9a, 0x09, 0x7e, 0x8a, 0xbd, 0x69, 0xec, + 0x6b, 0x35, 0xd1, 0xde, 0xd9, 0xfd, 0x69, 0x9d, 0xde, 0x9f, 0xf6, 0xef, 0xfb, 0xd3, 0x39, 0xa5, + 0x3f, 0x93, 0x87, 0x9f, 0x0f, 0x07, 0xd6, 0xc1, 0xe1, 0xc0, 0xfa, 0x7e, 0x38, 0xb0, 0xde, 0x1e, + 0x0d, 0x16, 0x0e, 0x8e, 0x06, 0x0b, 0x5f, 0x8e, 0x06, 0x0b, 0x2f, 0x37, 0x6a, 0x97, 0xba, 0x78, + 0x45, 0xa7, 0x21, 0x61, 0xbc, 0xdc, 0x38, 0xfb, 0xc7, 0xcf, 0xae, 0xb9, 0xdd, 0x7e, 0xc7, 0x3c, + 0xa4, 0xb7, 0x7e, 0x04, 0x00, 0x00, 0xff, 0xff, 0x77, 0x37, 0xe9, 0x99, 0x97, 0x05, 0x00, 0x00, } func (m *EventBeginEpoch) Marshal() (dAtA []byte, err error) { @@ -1408,7 +1420,7 @@ func (m *EventHandleQueuedMsg) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - var v github_com_tendermint_tendermint_abci_types.EventAttribute + var v github_com_cometbft_cometbft_abci_types.EventAttribute m.OriginalAttributes = append(m.OriginalAttributes, v) if err := m.OriginalAttributes[len(m.OriginalAttributes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/epoching/types/expected_keepers.go b/x/epoching/types/expected_keepers.go index bd0e8e475..17e23b9ab 100644 --- a/x/epoching/types/expected_keepers.go +++ b/x/epoching/types/expected_keepers.go @@ -4,9 +4,9 @@ import ( "time" "cosmossdk.io/math" + abci "github.com/cometbft/cometbft/abci/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - abci "github.com/tendermint/tendermint/abci/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -45,6 +45,7 @@ type StakingKeeper interface { UnbondingToUnbonded(ctx sdk.Context, validator stakingtypes.Validator) stakingtypes.Validator RemoveValidator(ctx sdk.Context, address sdk.ValAddress) UnbondAllMatureValidators(ctx sdk.Context) + GetValidatorByConsAddr(ctx sdk.Context, consAddr sdk.ConsAddress) (stakingtypes.Validator, bool) } // Event Hooks diff --git a/x/epoching/types/genesis.pb.go b/x/epoching/types/genesis.pb.go index 3e4e6fd37..77f300cdf 100644 --- a/x/epoching/types/genesis.pb.go +++ b/x/epoching/types/genesis.pb.go @@ -5,8 +5,8 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/epoching/types/genesis_test.go b/x/epoching/types/genesis_test.go index 7f282278d..59038f82c 100644 --- a/x/epoching/types/genesis_test.go +++ b/x/epoching/types/genesis_test.go @@ -7,8 +7,8 @@ import ( "github.com/babylonchain/babylon/testutil/nullify" "github.com/babylonchain/babylon/x/epoching" "github.com/babylonchain/babylon/x/epoching/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) func TestGenesis(t *testing.T) { diff --git a/x/epoching/types/keys.go b/x/epoching/types/keys.go index a5591b643..417a3b433 100644 --- a/x/epoching/types/keys.go +++ b/x/epoching/types/keys.go @@ -29,6 +29,7 @@ var ( ValidatorLifecycleKey = []byte{0x19} // key prefix for validator life cycle DelegationLifecycleKey = []byte{0x20} // key prefix for delegation life cycle AppHashKey = []byte{0x21} // key prefix for the app hash + ParamsKey = []byte{0x22} // key prefix for the parameters ) func KeyPrefix(p string) []byte { diff --git a/x/epoching/types/message.pb.go b/x/epoching/types/message.pb.go deleted file mode 100644 index df65ac6b0..000000000 --- a/x/epoching/types/message.pb.go +++ /dev/null @@ -1,264 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/epoching/v1/message.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type Message struct { -} - -func (m *Message) Reset() { *m = Message{} } -func (m *Message) String() string { return proto.CompactTextString(m) } -func (*Message) ProtoMessage() {} -func (*Message) Descriptor() ([]byte, []int) { - return fileDescriptor_4ca8d3a37382d890, []int{0} -} -func (m *Message) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Message.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Message) XXX_Merge(src proto.Message) { - xxx_messageInfo_Message.Merge(m, src) -} -func (m *Message) XXX_Size() int { - return m.Size() -} -func (m *Message) XXX_DiscardUnknown() { - xxx_messageInfo_Message.DiscardUnknown(m) -} - -var xxx_messageInfo_Message proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Message)(nil), "babylon.epoching.v1.Message") -} - -func init() { proto.RegisterFile("babylon/epoching/v1/message.proto", fileDescriptor_4ca8d3a37382d890) } - -var fileDescriptor_4ca8d3a37382d890 = []byte{ - // 152 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0x4f, 0x2d, 0xc8, 0x4f, 0xce, 0xc8, 0xcc, 0x4b, 0xd7, 0x2f, 0x33, 0xd4, - 0xcf, 0x4d, 0x2d, 0x2e, 0x4e, 0x4c, 0x4f, 0xd5, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, - 0x2a, 0xd1, 0x83, 0x29, 0xd1, 0x2b, 0x33, 0x94, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xcb, 0xeb, - 0x83, 0x58, 0x10, 0xa5, 0x4a, 0x9c, 0x5c, 0xec, 0xbe, 0x10, 0xbd, 0x4e, 0x5e, 0x27, 0x1e, 0xc9, - 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, - 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, - 0x9c, 0x9f, 0xab, 0x0f, 0x35, 0x3a, 0x39, 0x23, 0x31, 0x33, 0x0f, 0xc6, 0xd1, 0xaf, 0x40, 0x38, - 0xa6, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0xba, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, - 0x23, 0x19, 0xba, 0x5b, 0xad, 0x00, 0x00, 0x00, -} - -func (m *Message) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Message) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintMessage(dAtA []byte, offset int, v uint64) int { - offset -= sovMessage(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Message) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovMessage(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMessage(x uint64) (n int) { - return sovMessage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Message) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Message: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Message: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipMessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMessage(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMessage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMessage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowMessage - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthMessage - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMessage - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMessage - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMessage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMessage = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMessage = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/epoching/types/msg.go b/x/epoching/types/msg.go index abc9d3144..bac4f93b5 100644 --- a/x/epoching/types/msg.go +++ b/x/epoching/types/msg.go @@ -1,6 +1,7 @@ package types import ( + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -17,6 +18,7 @@ var ( _ sdk.Msg = &MsgWrappedDelegate{} _ sdk.Msg = &MsgWrappedUndelegate{} _ sdk.Msg = &MsgWrappedBeginRedelegate{} + _ sdk.Msg = &MsgUpdateParams{} ) // NewMsgWrappedDelegate creates a new MsgWrappedDelegate instance. @@ -120,3 +122,22 @@ func (msg MsgWrappedBeginRedelegate) ValidateBasic() error { } return msg.Msg.ValidateBasic() } + +// GetSigners returns the expected signers for a MsgUpdateParams message. +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(m.Authority) + return []sdk.AccAddress{addr} +} + +// ValidateBasic does a sanity check on the provided data. +func (m *MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return errorsmod.Wrap(err, "invalid authority address") + } + + if err := m.Params.Validate(); err != nil { + return err + } + + return nil +} diff --git a/x/epoching/types/params.go b/x/epoching/types/params.go index 32c7c2276..1b14269ed 100644 --- a/x/epoching/types/params.go +++ b/x/epoching/types/params.go @@ -2,8 +2,6 @@ package types import ( fmt "fmt" - - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" ) const ( @@ -14,13 +12,6 @@ var ( KeyEpochInterval = []byte("EpochInterval") ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance func NewParams(epochInterval uint64) Params { return Params{ @@ -28,13 +19,6 @@ func NewParams(epochInterval uint64) Params { } } -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyEpochInterval, &p.EpochInterval, validateEpochInterval), - } -} - // DefaultParams returns a default set of parameters func DefaultParams() Params { return NewParams(DefaultEpochInterval) diff --git a/x/epoching/types/params.pb.go b/x/epoching/types/params.pb.go index 3fbf60413..21ae0f84b 100644 --- a/x/epoching/types/params.pb.go +++ b/x/epoching/types/params.pb.go @@ -5,8 +5,8 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/x/epoching/types/query.pb.go b/x/epoching/types/query.pb.go index 8d90b59d9..59bfc31b9 100644 --- a/x/epoching/types/query.pb.go +++ b/x/epoching/types/query.pb.go @@ -7,9 +7,9 @@ import ( context "context" fmt "fmt" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -113,6 +113,7 @@ func (m *QueryParamsResponse) GetParams() Params { return Params{} } +// QueryEpochInfoRequest is the request type for the Query/EpochInfo method type QueryEpochInfoRequest struct { EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` } @@ -157,6 +158,7 @@ func (m *QueryEpochInfoRequest) GetEpochNum() uint64 { return 0 } +// QueryEpochInfoRequest is the response type for the Query/EpochInfo method type QueryEpochInfoResponse struct { Epoch *Epoch `protobuf:"bytes,1,opt,name=epoch,proto3" json:"epoch,omitempty"` } @@ -201,11 +203,10 @@ func (m *QueryEpochInfoResponse) GetEpoch() *Epoch { return nil } +// QueryEpochInfosRequest is the request type for the Query/EpochInfos method type QueryEpochsInfoRequest struct { - StartEpoch uint64 `protobuf:"varint,1,opt,name=start_epoch,json=startEpoch,proto3" json:"start_epoch,omitempty"` - EndEpoch uint64 `protobuf:"varint,2,opt,name=end_epoch,json=endEpoch,proto3" json:"end_epoch,omitempty"` // pagination defines whether to have the pagination in the request - Pagination *query.PageRequest `protobuf:"bytes,3,opt,name=pagination,proto3" json:"pagination,omitempty"` + Pagination *query.PageRequest `protobuf:"bytes,1,opt,name=pagination,proto3" json:"pagination,omitempty"` } func (m *QueryEpochsInfoRequest) Reset() { *m = QueryEpochsInfoRequest{} } @@ -241,20 +242,6 @@ func (m *QueryEpochsInfoRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryEpochsInfoRequest proto.InternalMessageInfo -func (m *QueryEpochsInfoRequest) GetStartEpoch() uint64 { - if m != nil { - return m.StartEpoch - } - return 0 -} - -func (m *QueryEpochsInfoRequest) GetEndEpoch() uint64 { - if m != nil { - return m.EndEpoch - } - return 0 -} - func (m *QueryEpochsInfoRequest) GetPagination() *query.PageRequest { if m != nil { return m.Pagination @@ -262,6 +249,7 @@ func (m *QueryEpochsInfoRequest) GetPagination() *query.PageRequest { return nil } +// QueryEpochsInfoResponse is the response type for the Query/EpochInfos method type QueryEpochsInfoResponse struct { Epochs []*Epoch `protobuf:"bytes,1,rep,name=epochs,proto3" json:"epochs,omitempty"` // pagination defines the pagination in the response @@ -315,7 +303,8 @@ func (m *QueryEpochsInfoResponse) GetPagination() *query.PageResponse { return nil } -// QueryCurrentEpochRequest is the request type for the Query/CurrentEpoch RPC method +// QueryCurrentEpochRequest is the request type for the Query/CurrentEpoch RPC +// method type QueryCurrentEpochRequest struct { } @@ -352,7 +341,8 @@ func (m *QueryCurrentEpochRequest) XXX_DiscardUnknown() { var xxx_messageInfo_QueryCurrentEpochRequest proto.InternalMessageInfo -// QueryCurrentEpochResponse is the response type for the Query/CurrentEpoch RPC method +// QueryCurrentEpochResponse is the response type for the Query/CurrentEpoch RPC +// method type QueryCurrentEpochResponse struct { // current_epoch is the current epoch number CurrentEpoch uint64 `protobuf:"varint,1,opt,name=current_epoch,json=currentEpoch,proto3" json:"current_epoch,omitempty"` @@ -462,7 +452,8 @@ func (m *QueryEpochMsgsRequest) GetPagination() *query.PageRequest { return nil } -// QueryEpochMsgsResponse is the response type for the Query/EpochMsgs RPC method +// QueryEpochMsgsResponse is the response type for the Query/EpochMsgs RPC +// method type QueryEpochMsgsResponse struct { // msgs is the list of messages queued in the current epoch Msgs []*QueuedMessage `protobuf:"bytes,1,rep,name=msgs,proto3" json:"msgs,omitempty"` @@ -517,8 +508,9 @@ func (m *QueryEpochMsgsResponse) GetPagination() *query.PageResponse { return nil } -// QueryLatestEpochMsgsRequest is the request type for the Query/LatestEpochMsgs RPC method -// it returns epoch msgs within epoch [max(1, end_epoch-epoch_count+1), end_epoch] +// QueryLatestEpochMsgsRequest is the request type for the Query/LatestEpochMsgs +// RPC method it returns epoch msgs within epoch [max(1, +// end_epoch-epoch_count+1), end_epoch] type QueryLatestEpochMsgsRequest struct { // end_epoch is the number of the last epoch to query EndEpoch uint64 `protobuf:"varint,1,opt,name=end_epoch,json=endEpoch,proto3" json:"end_epoch,omitempty"` @@ -581,7 +573,8 @@ func (m *QueryLatestEpochMsgsRequest) GetPagination() *query.PageRequest { return nil } -// QueryLatestEpochMsgsResponse is the response type for the Query/LatestEpochMsgs RPC method +// QueryLatestEpochMsgsResponse is the response type for the +// Query/LatestEpochMsgs RPC method type QueryLatestEpochMsgsResponse struct { // epoch_msg_map is a list of QueuedMessageList // each QueuedMessageList has a field identifying the epoch number @@ -636,6 +629,8 @@ func (m *QueryLatestEpochMsgsResponse) GetPagination() *query.PageResponse { return nil } +// QueryValidatorLifecycleRequest is the request type for the +// Query/ValidatorLifecycle RPC method type QueryValidatorLifecycleRequest struct { ValAddr string `protobuf:"bytes,1,opt,name=val_addr,json=valAddr,proto3" json:"val_addr,omitempty"` } @@ -680,6 +675,8 @@ func (m *QueryValidatorLifecycleRequest) GetValAddr() string { return "" } +// QueryValidatorLifecycleResponse is the response type for the +// Query/ValidatorLifecycle RPC method type QueryValidatorLifecycleResponse struct { ValLife *ValidatorLifecycle `protobuf:"bytes,1,opt,name=val_life,json=valLife,proto3" json:"val_life,omitempty"` } @@ -724,6 +721,8 @@ func (m *QueryValidatorLifecycleResponse) GetValLife() *ValidatorLifecycle { return nil } +// QueryDelegationLifecycleRequest is the request type for the +// Query/DelegationLifecycle RPC method type QueryDelegationLifecycleRequest struct { DelAddr string `protobuf:"bytes,1,opt,name=del_addr,json=delAddr,proto3" json:"del_addr,omitempty"` } @@ -768,6 +767,8 @@ func (m *QueryDelegationLifecycleRequest) GetDelAddr() string { return "" } +// QueryDelegationLifecycleRequest is the response type for the +// Query/DelegationLifecycle RPC method type QueryDelegationLifecycleResponse struct { DelLife *DelegationLifecycle `protobuf:"bytes,1,opt,name=del_life,json=delLife,proto3" json:"del_life,omitempty"` } @@ -812,6 +813,8 @@ func (m *QueryDelegationLifecycleResponse) GetDelLife() *DelegationLifecycle { return nil } +// QueryEpochValSetRequest is the request type for the Query/EpochValSet RPC +// method type QueryEpochValSetRequest struct { EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` Pagination *query.PageRequest `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` @@ -864,6 +867,8 @@ func (m *QueryEpochValSetRequest) GetPagination() *query.PageRequest { return nil } +// QueryEpochValSetRequest is the response type for the Query/EpochValSet RPC +// method type QueryEpochValSetResponse struct { Validators []*Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` TotalVotingPower int64 `protobuf:"varint,2,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` @@ -948,75 +953,74 @@ func init() { func init() { proto.RegisterFile("babylon/epoching/v1/query.proto", fileDescriptor_1821b530f2ec2711) } var fileDescriptor_1821b530f2ec2711 = []byte{ - // 1088 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcd, 0x6f, 0xdc, 0x44, - 0x14, 0xc0, 0xe3, 0x24, 0x0d, 0xed, 0x4b, 0x4b, 0x61, 0x52, 0x20, 0x75, 0xca, 0x26, 0x72, 0xa1, - 0x09, 0x49, 0x63, 0x67, 0x93, 0xb4, 0xa8, 0x1f, 0x80, 0x48, 0xf8, 0x10, 0x55, 0x8a, 0x52, 0x23, - 0xe5, 0xc0, 0x65, 0x35, 0xbb, 0x9e, 0x38, 0x96, 0xbc, 0x9e, 0xad, 0xc7, 0x5e, 0x58, 0x95, 0x20, - 0xc4, 0x99, 0x03, 0x12, 0x12, 0xa8, 0x17, 0x84, 0xc4, 0x91, 0x3f, 0x01, 0x0e, 0x1c, 0x7b, 0x0c, - 0xe2, 0xc2, 0x09, 0xa1, 0x84, 0x3f, 0x04, 0xf9, 0xcd, 0x78, 0xd7, 0xde, 0xda, 0xd9, 0x4d, 0x15, - 0x71, 0x4b, 0x66, 0xde, 0xc7, 0xef, 0x7d, 0xf8, 0xbd, 0x59, 0x98, 0xad, 0xd3, 0x7a, 0xc7, 0xe7, - 0x81, 0xc5, 0x5a, 0xbc, 0xb1, 0xe7, 0x05, 0xae, 0xd5, 0xae, 0x5a, 0x0f, 0x63, 0x16, 0x76, 0xcc, - 0x56, 0xc8, 0x23, 0x4e, 0xa6, 0x94, 0x80, 0x99, 0x0a, 0x98, 0xed, 0xaa, 0x7e, 0xc9, 0xe5, 0x2e, - 0xc7, 0x7b, 0x2b, 0xf9, 0x4b, 0x8a, 0xea, 0x57, 0x5c, 0xce, 0x5d, 0x9f, 0x59, 0xb4, 0xe5, 0x59, - 0x34, 0x08, 0x78, 0x44, 0x23, 0x8f, 0x07, 0x42, 0xdd, 0x2e, 0x36, 0xb8, 0x68, 0x72, 0x61, 0xd5, - 0xa9, 0x60, 0xd2, 0x83, 0xd5, 0xae, 0xd6, 0x59, 0x44, 0xab, 0x56, 0x8b, 0xba, 0x5e, 0x80, 0xc2, - 0x4a, 0x76, 0xae, 0x88, 0xaa, 0x45, 0x43, 0xda, 0x4c, 0xad, 0x19, 0x45, 0x12, 0x5d, 0x44, 0x94, - 0x31, 0x2e, 0x01, 0x79, 0x90, 0xf8, 0xd9, 0x46, 0x45, 0x9b, 0x3d, 0x8c, 0x99, 0x88, 0x8c, 0x6d, - 0x98, 0xca, 0x9d, 0x8a, 0x16, 0x0f, 0x04, 0x23, 0xb7, 0x60, 0x42, 0x3a, 0x98, 0xd6, 0xe6, 0xb4, - 0x85, 0xc9, 0xd5, 0x19, 0xb3, 0x20, 0x70, 0x53, 0x2a, 0x6d, 0x8c, 0x3f, 0xf9, 0x7b, 0x76, 0xc4, - 0x56, 0x0a, 0xc6, 0x3a, 0xbc, 0x84, 0x16, 0xdf, 0x4f, 0x04, 0x3f, 0x0a, 0x76, 0xb9, 0x72, 0x45, - 0x66, 0xe0, 0x1c, 0x2a, 0xd7, 0x82, 0xb8, 0x89, 0x66, 0xc7, 0xed, 0xb3, 0x78, 0xf0, 0x71, 0xdc, - 0x34, 0xee, 0xc1, 0xcb, 0xfd, 0x5a, 0x0a, 0x65, 0x05, 0xce, 0xa0, 0x94, 0x22, 0xd1, 0x0b, 0x49, - 0x50, 0xcd, 0x96, 0x82, 0xc6, 0x8f, 0x5a, 0xd6, 0x98, 0xc8, 0x32, 0xcc, 0xc2, 0xa4, 0x88, 0x68, - 0x18, 0xd5, 0x7a, 0x26, 0xc7, 0x6d, 0xc0, 0x23, 0x14, 0x46, 0xc8, 0xc0, 0x51, 0xd7, 0xa3, 0x0a, - 0x32, 0x70, 0xe4, 0xe5, 0x07, 0x00, 0xbd, 0xe2, 0x4c, 0x8f, 0x21, 0xcf, 0x35, 0x53, 0x56, 0xd2, - 0x4c, 0x2a, 0x69, 0xca, 0x5e, 0x51, 0x95, 0x34, 0xb7, 0xa9, 0xcb, 0x94, 0x67, 0x3b, 0xa3, 0x69, - 0x7c, 0xaf, 0xc1, 0x2b, 0x4f, 0x01, 0xaa, 0x70, 0x57, 0x61, 0x02, 0x9d, 0x27, 0x99, 0x1f, 0x1b, - 0x10, 0xaf, 0x92, 0x24, 0x1f, 0xe6, 0xb8, 0x46, 0x91, 0x6b, 0x7e, 0x20, 0x97, 0x74, 0x98, 0x03, - 0xd3, 0x61, 0x1a, 0xb9, 0x36, 0xe3, 0x30, 0x64, 0x81, 0x4c, 0x49, 0xda, 0x29, 0x2e, 0x5c, 0x2e, - 0xb8, 0x53, 0xd4, 0x57, 0xe1, 0x42, 0x43, 0x9e, 0xe7, 0x32, 0x7b, 0xbe, 0x91, 0x11, 0x26, 0xaf, - 0xc3, 0xf3, 0xb2, 0x01, 0xea, 0x3c, 0x0e, 0x1c, 0x1a, 0x76, 0x54, 0x82, 0x2f, 0xe0, 0xe9, 0x86, - 0x3a, 0x34, 0xbe, 0xc8, 0x36, 0xd0, 0x7d, 0xe1, 0x8a, 0x61, 0x1a, 0xa8, 0xaf, 0x36, 0xa3, 0xcf, - 0x5c, 0x9b, 0xc7, 0xb9, 0xe6, 0x91, 0xee, 0x55, 0x90, 0x37, 0x61, 0xbc, 0x29, 0xdc, 0xb4, 0x30, - 0x46, 0x61, 0x61, 0x1e, 0xc4, 0x2c, 0x66, 0xce, 0x7d, 0x26, 0x44, 0x62, 0x1f, 0xe5, 0x4f, 0xaf, - 0x3c, 0x3f, 0x6b, 0x30, 0x83, 0x6c, 0x5b, 0x34, 0x62, 0x22, 0x2a, 0x4c, 0x50, 0xb7, 0x79, 0xb5, - 0xbe, 0xe6, 0x9d, 0x85, 0x49, 0x99, 0xbd, 0x06, 0x8f, 0x83, 0x48, 0xa5, 0x1e, 0xf0, 0x68, 0x33, - 0x39, 0x39, 0xb5, 0xee, 0xfe, 0x55, 0x83, 0x2b, 0xc5, 0x94, 0x2a, 0x8f, 0x36, 0xbc, 0xe8, 0xe3, - 0x95, 0x24, 0xad, 0x65, 0x92, 0x7a, 0x6d, 0x70, 0x52, 0xb7, 0x3c, 0x11, 0xd9, 0x17, 0xfd, 0xbc, - 0xed, 0xd3, 0xcb, 0xf1, 0x1d, 0xa8, 0x20, 0xfc, 0x0e, 0xf5, 0x3d, 0x87, 0x46, 0x3c, 0xdc, 0xf2, - 0x76, 0x59, 0xa3, 0xd3, 0xf0, 0xd3, 0x58, 0xc9, 0x65, 0x38, 0xdb, 0xa6, 0x7e, 0x8d, 0x3a, 0x4e, - 0x88, 0x49, 0x3e, 0x67, 0x3f, 0xd7, 0xa6, 0xfe, 0xbb, 0x8e, 0x13, 0x1a, 0x0c, 0x66, 0x4b, 0x95, - 0x55, 0xf0, 0x1b, 0x52, 0xdb, 0xf7, 0x76, 0x99, 0x9a, 0x68, 0xf3, 0x85, 0x31, 0x17, 0x98, 0x48, - 0xdc, 0x24, 0xff, 0x19, 0x77, 0x95, 0x9b, 0xf7, 0x98, 0xcf, 0x5c, 0xc4, 0x2e, 0x82, 0x74, 0x58, - 0x1e, 0xd2, 0x61, 0x12, 0xd2, 0x85, 0xb9, 0x72, 0x6d, 0x45, 0xb9, 0x29, 0xd5, 0x33, 0x94, 0x0b, - 0x85, 0x94, 0x45, 0x36, 0x12, 0x47, 0x88, 0xf9, 0x65, 0x76, 0xca, 0xed, 0x50, 0xff, 0x13, 0x16, - 0xfd, 0xaf, 0x9f, 0xf2, 0x1f, 0x9a, 0x1a, 0x67, 0x39, 0x00, 0x15, 0xe1, 0xdb, 0x00, 0xed, 0x34, - 0xc5, 0x69, 0xf7, 0x55, 0x8e, 0xaf, 0x84, 0x9d, 0xd1, 0x20, 0xd7, 0x81, 0x44, 0x3c, 0xa2, 0x7e, - 0xad, 0xcd, 0x23, 0x2f, 0x70, 0x6b, 0x2d, 0xfe, 0x19, 0x0b, 0x11, 0x76, 0xcc, 0x7e, 0x01, 0x6f, - 0x76, 0xf0, 0x62, 0x3b, 0x39, 0xef, 0x6b, 0xcf, 0xb1, 0x67, 0x6e, 0xcf, 0xd5, 0x83, 0x49, 0x38, - 0x83, 0x31, 0x91, 0xaf, 0x34, 0x98, 0x90, 0x0b, 0x98, 0xcc, 0x97, 0x7d, 0x35, 0x7d, 0xdb, 0x5e, - 0x5f, 0x18, 0x2c, 0x28, 0x7d, 0x1a, 0x57, 0xbf, 0xfe, 0xf3, 0xdf, 0xef, 0x46, 0x5f, 0x25, 0x33, - 0x56, 0xf9, 0xe3, 0x83, 0xfc, 0xa0, 0xc1, 0xb9, 0xee, 0xc2, 0x26, 0x8b, 0xe5, 0xc6, 0xfb, 0xdf, - 0x02, 0xfa, 0xd2, 0x50, 0xb2, 0x8a, 0xa5, 0x8a, 0x2c, 0x4b, 0xe4, 0x0d, 0xab, 0xf4, 0x99, 0x23, - 0xac, 0x47, 0xdd, 0x7e, 0x7a, 0x6b, 0x71, 0x9f, 0x7c, 0xa3, 0x01, 0xf4, 0x96, 0x2b, 0x19, 0xe4, - 0x2e, 0xfb, 0x46, 0xd0, 0xaf, 0x0f, 0x27, 0x3c, 0x54, 0xa2, 0xd4, 0x82, 0x7e, 0xac, 0xc1, 0xf9, - 0xec, 0xde, 0x24, 0xcb, 0xe5, 0x3e, 0x0a, 0x76, 0xaf, 0x6e, 0x0e, 0x2b, 0xae, 0xa0, 0x16, 0x11, - 0xea, 0x35, 0x62, 0x14, 0x42, 0xe5, 0x36, 0x35, 0xf9, 0x29, 0x2d, 0x22, 0xce, 0xd1, 0x41, 0x45, - 0xcc, 0xac, 0x9b, 0x81, 0x45, 0xcc, 0x0e, 0x7d, 0xe3, 0x36, 0x22, 0xad, 0x93, 0xd5, 0xa1, 0x8b, - 0x68, 0x35, 0xe5, 0xc0, 0x17, 0xe4, 0x17, 0x0d, 0x2e, 0xf6, 0x2d, 0x13, 0xb2, 0x52, 0xee, 0xbc, - 0x78, 0x3b, 0xea, 0xd5, 0x13, 0x68, 0x28, 0xe8, 0x35, 0x84, 0x5e, 0x26, 0x4b, 0xc7, 0x40, 0xdf, - 0x96, 0xab, 0xa8, 0x47, 0xfb, 0x9b, 0x06, 0xe4, 0xe9, 0xe9, 0x4d, 0xd6, 0xca, 0xdd, 0x97, 0xee, - 0x1a, 0x7d, 0xfd, 0x64, 0x4a, 0x0a, 0xfb, 0x0e, 0x62, 0xdf, 0x20, 0x6b, 0x85, 0xd8, 0xdd, 0x21, - 0x86, 0xe3, 0x1d, 0x35, 0xad, 0x47, 0xe9, 0x46, 0xdb, 0x27, 0xbf, 0x6b, 0x30, 0x55, 0x30, 0xd6, - 0xc9, 0x31, 0x28, 0xe5, 0x7b, 0x48, 0xbf, 0x71, 0x42, 0x2d, 0x15, 0xc1, 0x5d, 0x8c, 0xe0, 0x26, - 0x59, 0x2f, 0x8c, 0xc0, 0xe9, 0x6a, 0x66, 0x43, 0x48, 0xf7, 0xdd, 0x7e, 0xd2, 0x2f, 0x93, 0x99, - 0x99, 0x4f, 0x06, 0x7d, 0xd1, 0xb9, 0xdd, 0xa4, 0x2f, 0x0f, 0x29, 0xad, 0x50, 0xdf, 0x41, 0xd4, - 0x5b, 0xe4, 0xcd, 0xe1, 0x1b, 0xbb, 0x57, 0x01, 0xc1, 0xa2, 0x8d, 0x7b, 0x4f, 0x0e, 0x2b, 0xda, - 0xc1, 0x61, 0x45, 0xfb, 0xe7, 0xb0, 0xa2, 0x7d, 0x7b, 0x54, 0x19, 0x39, 0x38, 0xaa, 0x8c, 0xfc, - 0x75, 0x54, 0x19, 0xf9, 0x74, 0xc5, 0xf5, 0xa2, 0xbd, 0xb8, 0x6e, 0x36, 0x78, 0x33, 0x35, 0xde, - 0xd8, 0xa3, 0x5e, 0xd0, 0xf5, 0xf4, 0x79, 0xcf, 0x57, 0xd4, 0x69, 0x31, 0x51, 0x9f, 0xc0, 0xdf, - 0x7a, 0x6b, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x45, 0xf9, 0x53, 0x14, 0xc9, 0x0e, 0x00, 0x00, + // 1071 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x97, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0xb3, 0x89, 0x1b, 0x92, 0x97, 0x96, 0xc2, 0xa4, 0x40, 0xbb, 0x29, 0x4e, 0xb4, 0x85, + 0x26, 0x24, 0xcd, 0x6e, 0x9c, 0xa4, 0x45, 0xfd, 0x01, 0x88, 0x84, 0x1f, 0xa2, 0x4a, 0x51, 0xba, + 0x48, 0x39, 0x70, 0x31, 0x63, 0xef, 0x64, 0xb3, 0xd2, 0x7a, 0xc7, 0xdd, 0x1f, 0x06, 0xab, 0x04, + 0x21, 0xce, 0x1c, 0x90, 0x90, 0x40, 0xbd, 0x21, 0x71, 0xe4, 0x4f, 0x80, 0x03, 0xc7, 0x1e, 0x83, + 0xb8, 0x70, 0x42, 0x28, 0xe1, 0x0f, 0x41, 0xfb, 0x66, 0xd6, 0x5e, 0xbb, 0xb3, 0xb1, 0x13, 0x45, + 0xdc, 0xda, 0x99, 0xf7, 0xe3, 0xf3, 0xde, 0x9b, 0x7d, 0x5f, 0x07, 0x66, 0x6b, 0xb4, 0xd6, 0xf6, + 0x79, 0x60, 0xb1, 0x26, 0xaf, 0xef, 0x79, 0x81, 0x6b, 0xb5, 0x2a, 0xd6, 0xa3, 0x84, 0x85, 0x6d, + 0xb3, 0x19, 0xf2, 0x98, 0x93, 0x69, 0x69, 0x60, 0x66, 0x06, 0x66, 0xab, 0xa2, 0x5f, 0x72, 0xb9, + 0xcb, 0xf1, 0xde, 0x4a, 0xff, 0x25, 0x4c, 0xf5, 0xab, 0x2e, 0xe7, 0xae, 0xcf, 0x2c, 0xda, 0xf4, + 0x2c, 0x1a, 0x04, 0x3c, 0xa6, 0xb1, 0xc7, 0x83, 0x48, 0xde, 0x2e, 0xd6, 0x79, 0xd4, 0xe0, 0x91, + 0x55, 0xa3, 0x11, 0x13, 0x19, 0xac, 0x56, 0xa5, 0xc6, 0x62, 0x5a, 0xb1, 0x9a, 0xd4, 0xf5, 0x02, + 0x34, 0x96, 0xb6, 0x73, 0x2a, 0xaa, 0x26, 0x0d, 0x69, 0x23, 0x8b, 0x66, 0xa8, 0x2c, 0x3a, 0x88, + 0x68, 0x63, 0x5c, 0x02, 0xf2, 0x30, 0xcd, 0xb3, 0x8d, 0x8e, 0x36, 0x7b, 0x94, 0xb0, 0x28, 0x36, + 0xb6, 0x61, 0xba, 0xe7, 0x34, 0x6a, 0xf2, 0x20, 0x62, 0xe4, 0x36, 0x8c, 0x8b, 0x04, 0x97, 0xb5, + 0x39, 0x6d, 0x61, 0x6a, 0x75, 0xc6, 0x54, 0x14, 0x6e, 0x0a, 0xa7, 0x8d, 0xd2, 0xd3, 0xbf, 0x67, + 0x47, 0x6c, 0xe9, 0x60, 0xac, 0xc3, 0x4b, 0x18, 0xf1, 0xfd, 0xd4, 0xf0, 0xa3, 0x60, 0x97, 0xcb, + 0x54, 0x64, 0x06, 0x26, 0xd1, 0xb9, 0x1a, 0x24, 0x0d, 0x0c, 0x5b, 0xb2, 0x27, 0xf0, 0xe0, 0xe3, + 0xa4, 0x61, 0xdc, 0x87, 0x97, 0xfb, 0xbd, 0x24, 0xca, 0x0a, 0x9c, 0x43, 0x2b, 0x49, 0xa2, 0x2b, + 0x49, 0xd0, 0xcd, 0x16, 0x86, 0xc6, 0x67, 0xf9, 0x58, 0x51, 0x1e, 0xe1, 0x03, 0x80, 0x6e, 0x77, + 0x65, 0xc0, 0xeb, 0xa6, 0x18, 0x85, 0x99, 0x8e, 0xc2, 0x14, 0xc3, 0x96, 0xa3, 0x30, 0xb7, 0xa9, + 0xcb, 0xa4, 0xaf, 0x9d, 0xf3, 0x34, 0x7e, 0xd0, 0xe0, 0x95, 0x67, 0x52, 0x48, 0xde, 0x55, 0x18, + 0x47, 0x8c, 0xb4, 0x75, 0x63, 0x03, 0x80, 0xa5, 0x25, 0xf9, 0xb0, 0x87, 0x6b, 0x14, 0xb9, 0xe6, + 0x07, 0x72, 0x89, 0x84, 0x3d, 0x60, 0x3a, 0x5c, 0x46, 0xae, 0xcd, 0x24, 0x0c, 0x59, 0x10, 0x8b, + 0x2c, 0x72, 0xd4, 0x2e, 0x5c, 0x51, 0xdc, 0x49, 0xea, 0x6b, 0x70, 0xa1, 0x2e, 0xce, 0xab, 0xdd, + 0x6e, 0x97, 0xec, 0xf3, 0xf5, 0x9c, 0x31, 0x79, 0x1d, 0x9e, 0x17, 0x13, 0xac, 0xf1, 0x24, 0x70, + 0x68, 0xd8, 0x46, 0xd4, 0x92, 0x7d, 0x01, 0x4f, 0x37, 0xe4, 0xa1, 0xf1, 0x65, 0xfe, 0x05, 0x3c, + 0x88, 0xdc, 0x68, 0x98, 0x17, 0xd0, 0x37, 0x9b, 0xd1, 0x53, 0xcf, 0xe6, 0x89, 0x96, 0x1f, 0xbf, + 0x48, 0x2f, 0x8b, 0xbc, 0x05, 0xa5, 0x46, 0xe4, 0x66, 0x83, 0x31, 0x94, 0x83, 0x79, 0x98, 0xb0, + 0x84, 0x39, 0x0f, 0x58, 0x14, 0xa5, 0xf1, 0xd1, 0xfe, 0xec, 0xc6, 0xf3, 0xb3, 0x06, 0x33, 0xc8, + 0xb6, 0x45, 0x63, 0x16, 0xc5, 0xca, 0x06, 0x05, 0x4e, 0xcf, 0x04, 0x26, 0x58, 0xe0, 0x88, 0xee, + 0xcf, 0xc2, 0x94, 0xe8, 0x5e, 0x9d, 0x27, 0x41, 0x2c, 0x5b, 0x0f, 0x78, 0xb4, 0x99, 0x9e, 0xf4, + 0x75, 0x70, 0xec, 0xd4, 0x1d, 0xfc, 0x55, 0x83, 0xab, 0x6a, 0x4a, 0xd9, 0x47, 0x1b, 0x5e, 0xf4, + 0xf1, 0x4a, 0x90, 0x56, 0x73, 0x4d, 0xbd, 0x3e, 0xb8, 0xa9, 0x5b, 0x5e, 0x14, 0xdb, 0x17, 0xfd, + 0xde, 0xd8, 0x67, 0xd7, 0xe3, 0xbb, 0x50, 0x46, 0xf8, 0x1d, 0xea, 0x7b, 0x0e, 0x8d, 0x79, 0xb8, + 0xe5, 0xed, 0xb2, 0x7a, 0xbb, 0xee, 0x67, 0xb5, 0x92, 0x2b, 0x30, 0xd1, 0xa2, 0x7e, 0x95, 0x3a, + 0x4e, 0x88, 0x4d, 0x9e, 0xb4, 0x9f, 0x6b, 0x51, 0xff, 0x5d, 0xc7, 0x09, 0x0d, 0x06, 0xb3, 0x85, + 0xce, 0xb2, 0xf8, 0x0d, 0xe1, 0xed, 0x7b, 0xbb, 0x4c, 0x6e, 0x90, 0x79, 0x65, 0xcd, 0x8a, 0x10, + 0x69, 0x9a, 0xf4, 0x7f, 0xc6, 0x3d, 0x99, 0xe6, 0x3d, 0xe6, 0x33, 0x17, 0xb1, 0x55, 0x90, 0x0e, + 0xeb, 0x85, 0x74, 0x98, 0x80, 0x74, 0x61, 0xae, 0xd8, 0x5b, 0x52, 0x6e, 0x0a, 0xf7, 0x1c, 0xe5, + 0x82, 0x92, 0x52, 0x15, 0x23, 0x4d, 0x84, 0x98, 0x5f, 0xe5, 0xb7, 0xdc, 0x0e, 0xf5, 0x3f, 0x61, + 0xf1, 0xff, 0xfa, 0x29, 0xff, 0xa1, 0xc9, 0x75, 0xd6, 0x03, 0x20, 0x2b, 0x7c, 0x1b, 0xa0, 0x95, + 0xb5, 0x38, 0x7b, 0x7d, 0xe5, 0xe3, 0x27, 0x61, 0xe7, 0x3c, 0xc8, 0x0d, 0x20, 0x31, 0x8f, 0xa9, + 0x5f, 0x6d, 0xf1, 0xd8, 0x0b, 0xdc, 0x6a, 0x93, 0x7f, 0xce, 0x42, 0x84, 0x1d, 0xb3, 0x5f, 0xc0, + 0x9b, 0x1d, 0xbc, 0xd8, 0x4e, 0xcf, 0xfb, 0x9e, 0xe7, 0xd8, 0xa9, 0x9f, 0xe7, 0xea, 0xc1, 0x14, + 0x9c, 0xc3, 0x9a, 0xc8, 0xd7, 0x1a, 0x8c, 0x0b, 0x05, 0x25, 0xf3, 0x45, 0x5f, 0x4d, 0x9f, 0x5c, + 0xeb, 0x0b, 0x83, 0x0d, 0x45, 0x4e, 0xe3, 0xda, 0x37, 0x7f, 0xfe, 0xfb, 0xfd, 0xe8, 0xab, 0x64, + 0xc6, 0x2a, 0xfe, 0xf5, 0x40, 0x7e, 0xd4, 0x60, 0xb2, 0xa3, 0xb8, 0x64, 0xb1, 0x38, 0x78, 0xbf, + 0x98, 0xeb, 0x4b, 0x43, 0xd9, 0x4a, 0x96, 0x0a, 0xb2, 0x2c, 0x91, 0x37, 0xac, 0xc2, 0xdf, 0x29, + 0x91, 0xf5, 0xb8, 0xf3, 0x9e, 0xde, 0x5a, 0xdc, 0x27, 0xdf, 0x6a, 0x00, 0x5d, 0x71, 0x25, 0x83, + 0xd2, 0xe5, 0x55, 0x5e, 0xbf, 0x31, 0x9c, 0xf1, 0x50, 0x8d, 0x92, 0x02, 0xfd, 0x44, 0x83, 0xf3, + 0x79, 0xdd, 0x24, 0xcb, 0xc5, 0x39, 0x14, 0xda, 0xab, 0x9b, 0xc3, 0x9a, 0x4b, 0xa8, 0x45, 0x84, + 0x7a, 0x8d, 0x18, 0x4a, 0xa8, 0x1e, 0xa5, 0x26, 0x3f, 0x65, 0x43, 0xc4, 0x3d, 0x3a, 0x68, 0x88, + 0x39, 0xb9, 0x19, 0x38, 0xc4, 0xfc, 0xd2, 0x37, 0xee, 0x20, 0xd2, 0x3a, 0x59, 0x1d, 0x7a, 0x88, + 0x56, 0x43, 0x2c, 0xfc, 0x88, 0xfc, 0xa2, 0xc1, 0xc5, 0x3e, 0x31, 0x21, 0x2b, 0xc5, 0xc9, 0xd5, + 0xea, 0xa8, 0x57, 0x4e, 0xe0, 0x21, 0xa1, 0xd7, 0x10, 0x7a, 0x99, 0x2c, 0x1d, 0x03, 0x7d, 0x47, + 0x48, 0x51, 0x97, 0xf6, 0x37, 0x0d, 0xc8, 0xb3, 0xdb, 0x9b, 0xac, 0x15, 0xa7, 0x2f, 0xd4, 0x1a, + 0x7d, 0xfd, 0x64, 0x4e, 0x12, 0xfb, 0x2e, 0x62, 0xdf, 0x24, 0x6b, 0x4a, 0xec, 0xce, 0x12, 0xc3, + 0xf5, 0x8e, 0x9e, 0xd6, 0xe3, 0x4c, 0xd1, 0xf6, 0xc9, 0xef, 0x1a, 0x4c, 0x2b, 0xd6, 0x3a, 0x39, + 0x06, 0xa5, 0x58, 0x87, 0xf4, 0x9b, 0x27, 0xf4, 0x92, 0x15, 0xdc, 0xc3, 0x0a, 0x6e, 0x91, 0x75, + 0x65, 0x05, 0x4e, 0xc7, 0x33, 0x5f, 0x42, 0xa6, 0x77, 0xfb, 0xe9, 0x7b, 0x99, 0xca, 0xed, 0x7c, + 0x32, 0xe8, 0x8b, 0xee, 0xd1, 0x26, 0x7d, 0x79, 0x48, 0x6b, 0x89, 0xfa, 0x0e, 0xa2, 0xde, 0x26, + 0x6f, 0x0e, 0xff, 0xb0, 0xbb, 0x13, 0x88, 0x58, 0xbc, 0x71, 0xff, 0xe9, 0x61, 0x59, 0x3b, 0x38, + 0x2c, 0x6b, 0xff, 0x1c, 0x96, 0xb5, 0xef, 0x8e, 0xca, 0x23, 0x07, 0x47, 0xe5, 0x91, 0xbf, 0x8e, + 0xca, 0x23, 0x9f, 0xae, 0xb8, 0x5e, 0xbc, 0x97, 0xd4, 0xcc, 0x3a, 0x6f, 0x64, 0xc1, 0xeb, 0x7b, + 0xd4, 0x0b, 0x3a, 0x99, 0xbe, 0xe8, 0xe6, 0x8a, 0xdb, 0x4d, 0x16, 0xd5, 0xc6, 0xf1, 0x8f, 0xb5, + 0xb5, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x76, 0x01, 0x0c, 0x73, 0x8a, 0x0e, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1035,15 +1039,16 @@ type QueryClient interface { Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // EpochInfo queries the information of a given epoch EpochInfo(ctx context.Context, in *QueryEpochInfoRequest, opts ...grpc.CallOption) (*QueryEpochInfoResponse, error) - // EpochsInfo queries the metadata of epochs in a given range, depending on the - // parameters in the pagination request. Th main use case will be querying the - // latest epochs in time order. + // EpochsInfo queries the metadata of epochs in a given range, depending on + // the parameters in the pagination request. Th main use case will be querying + // the latest epochs in time order. EpochsInfo(ctx context.Context, in *QueryEpochsInfoRequest, opts ...grpc.CallOption) (*QueryEpochsInfoResponse, error) // CurrentEpoch queries the current epoch CurrentEpoch(ctx context.Context, in *QueryCurrentEpochRequest, opts ...grpc.CallOption) (*QueryCurrentEpochResponse, error) // EpochMsgs queries the messages of a given epoch EpochMsgs(ctx context.Context, in *QueryEpochMsgsRequest, opts ...grpc.CallOption) (*QueryEpochMsgsResponse, error) - // LatestEpochMsgs queries the messages within a given number of most recent epochs + // LatestEpochMsgs queries the messages within a given number of most recent + // epochs LatestEpochMsgs(ctx context.Context, in *QueryLatestEpochMsgsRequest, opts ...grpc.CallOption) (*QueryLatestEpochMsgsResponse, error) // ValidatorLifecycle queries the lifecycle of a given validator ValidatorLifecycle(ctx context.Context, in *QueryValidatorLifecycleRequest, opts ...grpc.CallOption) (*QueryValidatorLifecycleResponse, error) @@ -1148,15 +1153,16 @@ type QueryServer interface { Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // EpochInfo queries the information of a given epoch EpochInfo(context.Context, *QueryEpochInfoRequest) (*QueryEpochInfoResponse, error) - // EpochsInfo queries the metadata of epochs in a given range, depending on the - // parameters in the pagination request. Th main use case will be querying the - // latest epochs in time order. + // EpochsInfo queries the metadata of epochs in a given range, depending on + // the parameters in the pagination request. Th main use case will be querying + // the latest epochs in time order. EpochsInfo(context.Context, *QueryEpochsInfoRequest) (*QueryEpochsInfoResponse, error) // CurrentEpoch queries the current epoch CurrentEpoch(context.Context, *QueryCurrentEpochRequest) (*QueryCurrentEpochResponse, error) // EpochMsgs queries the messages of a given epoch EpochMsgs(context.Context, *QueryEpochMsgsRequest) (*QueryEpochMsgsResponse, error) - // LatestEpochMsgs queries the messages within a given number of most recent epochs + // LatestEpochMsgs queries the messages within a given number of most recent + // epochs LatestEpochMsgs(context.Context, *QueryLatestEpochMsgsRequest) (*QueryLatestEpochMsgsResponse, error) // ValidatorLifecycle queries the lifecycle of a given validator ValidatorLifecycle(context.Context, *QueryValidatorLifecycleRequest) (*QueryValidatorLifecycleResponse, error) @@ -1558,17 +1564,7 @@ func (m *QueryEpochsInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) i = encodeVarintQuery(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - } - if m.EndEpoch != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.EndEpoch)) - i-- - dAtA[i] = 0x10 - } - if m.StartEpoch != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.StartEpoch)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2147,12 +2143,6 @@ func (m *QueryEpochsInfoRequest) Size() (n int) { } var l int _ = l - if m.StartEpoch != 0 { - n += 1 + sovQuery(uint64(m.StartEpoch)) - } - if m.EndEpoch != 0 { - n += 1 + sovQuery(uint64(m.EndEpoch)) - } if m.Pagination != nil { l = m.Pagination.Size() n += 1 + l + sovQuery(uint64(l)) @@ -2690,44 +2680,6 @@ func (m *QueryEpochsInfoRequest) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartEpoch", wireType) - } - m.StartEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndEpoch", wireType) - } - m.EndEpoch = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EndEpoch |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Pagination", wireType) } diff --git a/x/epoching/types/tx.pb.go b/x/epoching/types/tx.pb.go index 8a6295869..56c8ce0b9 100644 --- a/x/epoching/types/tx.pb.go +++ b/x/epoching/types/tx.pb.go @@ -6,11 +6,12 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" types "github.com/cosmos/cosmos-sdk/x/staking/types" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -30,6 +31,7 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// MsgWrappedDelegate is the message for delegating stakes type MsgWrappedDelegate struct { Msg *types.MsgDelegate `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` } @@ -67,6 +69,7 @@ func (m *MsgWrappedDelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWrappedDelegate proto.InternalMessageInfo +// MsgWrappedDelegate is the response to the MsgWrappedDelegate message type MsgWrappedDelegateResponse struct { } @@ -103,6 +106,7 @@ func (m *MsgWrappedDelegateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWrappedDelegateResponse proto.InternalMessageInfo +// MsgWrappedUndelegate is the message for undelegating stakes type MsgWrappedUndelegate struct { Msg *types.MsgUndelegate `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` } @@ -140,6 +144,8 @@ func (m *MsgWrappedUndelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWrappedUndelegate proto.InternalMessageInfo +// MsgWrappedUndelegateResponse is the response to the MsgWrappedUndelegate +// message type MsgWrappedUndelegateResponse struct { } @@ -176,6 +182,8 @@ func (m *MsgWrappedUndelegateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWrappedUndelegateResponse proto.InternalMessageInfo +// MsgWrappedDelegate is the message for moving bonded stakes from a +// validator to another validator type MsgWrappedBeginRedelegate struct { Msg *types.MsgBeginRedelegate `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` } @@ -213,6 +221,8 @@ func (m *MsgWrappedBeginRedelegate) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWrappedBeginRedelegate proto.InternalMessageInfo +// MsgWrappedBeginRedelegateResponse is the response to the +// MsgWrappedBeginRedelegate message type MsgWrappedBeginRedelegateResponse struct { } @@ -249,6 +259,103 @@ func (m *MsgWrappedBeginRedelegateResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWrappedBeginRedelegateResponse proto.InternalMessageInfo +// MsgUpdateParams defines a message for updating epoching module parameters. +type MsgUpdateParams struct { + // authority is the address of the governance account. + // just FYI: cosmos.AddressString marks that this field should use type alias + // for AddressString instead of string, but the functionality is not yet implemented + // in cosmos-proto + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the epoching paramaeters parameters to update. + // + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_a5fc8fed8f4e58b6, []int{6} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +// MsgUpdateParamsResponse is the response to the MsgUpdateParams message. +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_a5fc8fed8f4e58b6, []int{7} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgWrappedDelegate)(nil), "babylon.epoching.v1.MsgWrappedDelegate") proto.RegisterType((*MsgWrappedDelegateResponse)(nil), "babylon.epoching.v1.MsgWrappedDelegateResponse") @@ -256,36 +363,47 @@ func init() { proto.RegisterType((*MsgWrappedUndelegateResponse)(nil), "babylon.epoching.v1.MsgWrappedUndelegateResponse") proto.RegisterType((*MsgWrappedBeginRedelegate)(nil), "babylon.epoching.v1.MsgWrappedBeginRedelegate") proto.RegisterType((*MsgWrappedBeginRedelegateResponse)(nil), "babylon.epoching.v1.MsgWrappedBeginRedelegateResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "babylon.epoching.v1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "babylon.epoching.v1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("babylon/epoching/v1/tx.proto", fileDescriptor_a5fc8fed8f4e58b6) } var fileDescriptor_a5fc8fed8f4e58b6 = []byte{ - // 384 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4d, 0x4b, 0x02, 0x41, - 0x18, 0xc7, 0x77, 0x13, 0x22, 0xa6, 0x43, 0xb4, 0x49, 0xe4, 0x22, 0x63, 0x29, 0xd1, 0xcb, 0x61, - 0x26, 0x8d, 0x0a, 0xa2, 0x93, 0x74, 0x0a, 0xbc, 0x08, 0x12, 0x75, 0x9b, 0x5d, 0xa7, 0x71, 0x51, - 0x67, 0x36, 0x67, 0x14, 0xbd, 0x75, 0xec, 0xd8, 0x47, 0xf0, 0xe3, 0x74, 0xf4, 0xd8, 0x31, 0xf4, - 0xe2, 0xc7, 0x08, 0x75, 0xc7, 0x95, 0xf5, 0xb5, 0xdb, 0xec, 0x3e, 0xff, 0xe7, 0xf7, 0x7b, 0x78, - 0x86, 0x01, 0x49, 0x87, 0x38, 0x9d, 0x9a, 0xe0, 0x98, 0xfa, 0xc2, 0xad, 0x78, 0x9c, 0xe1, 0x56, - 0x16, 0xab, 0x36, 0xf2, 0x1b, 0x42, 0x09, 0xeb, 0x20, 0xa8, 0x22, 0x5d, 0x45, 0xad, 0xac, 0x9d, - 0x60, 0x42, 0xb0, 0x1a, 0xc5, 0xe3, 0x88, 0xd3, 0x7c, 0xc3, 0x84, 0x77, 0x26, 0x79, 0x3b, 0xce, - 0x04, 0x13, 0xe3, 0x23, 0x1e, 0x9d, 0x82, 0xbf, 0x29, 0x57, 0xc8, 0xba, 0x90, 0x58, 0x2a, 0x52, - 0x9d, 0x18, 0x1c, 0xaa, 0x48, 0xa8, 0x49, 0x97, 0x80, 0x55, 0x90, 0xec, 0xb9, 0x41, 0x7c, 0x9f, - 0x96, 0x1f, 0x69, 0x8d, 0x32, 0xa2, 0xa8, 0x75, 0x03, 0x62, 0x75, 0xc9, 0x8e, 0xcc, 0x63, 0xf3, - 0x7c, 0x37, 0x97, 0x41, 0x13, 0x08, 0x0a, 0x20, 0x28, 0x80, 0xa0, 0x82, 0x64, 0xba, 0xa3, 0x38, - 0xca, 0xdf, 0xef, 0x7c, 0x76, 0x53, 0xc6, 0xb0, 0x9b, 0x32, 0xd2, 0x49, 0x60, 0xcf, 0x63, 0x8b, - 0x54, 0xfa, 0x82, 0x4b, 0x9a, 0x7e, 0x01, 0xf1, 0xb0, 0x5a, 0xe2, 0x65, 0xad, 0xbd, 0x9b, 0xd5, - 0x9e, 0xae, 0xd0, 0x86, 0x3d, 0x51, 0x31, 0x04, 0xc9, 0x45, 0xe8, 0xa9, 0xda, 0x05, 0x89, 0xb0, - 0x9e, 0xa7, 0xcc, 0xe3, 0x45, 0x3a, 0xf5, 0x3f, 0xcc, 0xfa, 0x2f, 0x57, 0xf8, 0x23, 0x8d, 0xd1, - 0x21, 0x32, 0xe0, 0x64, 0xa9, 0x44, 0x4f, 0x92, 0x1b, 0x6e, 0x81, 0x58, 0x41, 0x32, 0xab, 0x0a, - 0xf6, 0xa2, 0xeb, 0x3f, 0x43, 0x0b, 0x2e, 0x1f, 0xcd, 0x2f, 0xd4, 0xc6, 0x1b, 0x06, 0xb5, 0xd4, - 0x7a, 0x07, 0xfb, 0xf3, 0x6b, 0xbf, 0x58, 0x43, 0x09, 0xa3, 0x76, 0x76, 0xe3, 0xe8, 0x54, 0xf9, - 0x61, 0x82, 0xc3, 0x25, 0xfb, 0x46, 0x6b, 0x68, 0x91, 0xbc, 0x7d, 0xfb, 0xbf, 0xbc, 0x1e, 0x21, - 0xff, 0xf4, 0xdd, 0x87, 0x66, 0xaf, 0x0f, 0xcd, 0xdf, 0x3e, 0x34, 0xbf, 0x06, 0xd0, 0xe8, 0x0d, - 0xa0, 0xf1, 0x33, 0x80, 0xc6, 0xeb, 0x15, 0xf3, 0x54, 0xa5, 0xe9, 0x20, 0x57, 0xd4, 0x71, 0xc0, - 0x76, 0x2b, 0xc4, 0xe3, 0xfa, 0x03, 0xb7, 0xc3, 0xd7, 0xa9, 0x3a, 0x3e, 0x95, 0xce, 0xf6, 0xf8, - 0xdd, 0x5c, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x73, 0xc6, 0x83, 0x42, 0xbe, 0x03, 0x00, 0x00, + // 514 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x31, 0x6f, 0xd3, 0x40, + 0x1c, 0xc5, 0x6d, 0x82, 0x2a, 0xfa, 0x07, 0x51, 0x61, 0x22, 0x9a, 0x98, 0xc8, 0x29, 0x29, 0x08, + 0xa8, 0xe0, 0x4c, 0x8a, 0x28, 0xa2, 0x62, 0x21, 0x62, 0x42, 0x8a, 0x84, 0x8c, 0x2a, 0x04, 0x0b, + 0x3a, 0xdb, 0xa7, 0x8b, 0xd5, 0xda, 0x67, 0x7c, 0xd7, 0xaa, 0xd9, 0x10, 0x13, 0x23, 0x03, 0x1f, + 0xa0, 0x1f, 0x81, 0x81, 0x0f, 0xd1, 0x81, 0xa1, 0x62, 0x62, 0x42, 0x28, 0x19, 0xe0, 0x63, 0xa0, + 0xd8, 0x67, 0x5f, 0x70, 0x92, 0x26, 0xdd, 0x62, 0xbd, 0xf7, 0x7f, 0xbf, 0x17, 0xf9, 0xc9, 0xd0, + 0x70, 0xb1, 0xdb, 0xdf, 0x63, 0x91, 0x4d, 0x62, 0xe6, 0xf5, 0x82, 0x88, 0xda, 0x07, 0x6d, 0x5b, + 0x1c, 0xa2, 0x38, 0x61, 0x82, 0x19, 0x57, 0xa5, 0x8a, 0x72, 0x15, 0x1d, 0xb4, 0xcd, 0x2a, 0x65, + 0x94, 0xa5, 0xba, 0x3d, 0xfa, 0x95, 0x59, 0xcd, 0xa6, 0xc7, 0x78, 0xc8, 0xb8, 0xcd, 0x05, 0xde, + 0xcd, 0x62, 0x5c, 0x22, 0xb0, 0xca, 0x32, 0xd7, 0xa6, 0x91, 0x62, 0x9c, 0xe0, 0x90, 0x4b, 0x47, + 0x3d, 0x8b, 0x78, 0x97, 0x65, 0x67, 0x0f, 0x52, 0x5a, 0x95, 0xe9, 0x21, 0x4f, 0xcf, 0x42, 0x4e, + 0x33, 0xa1, 0xb5, 0x03, 0x46, 0x97, 0xd3, 0xd7, 0x09, 0x8e, 0x63, 0xe2, 0x3f, 0x27, 0x7b, 0x84, + 0x62, 0x41, 0x8c, 0x47, 0x50, 0x09, 0x39, 0xad, 0xe9, 0x6b, 0xfa, 0x9d, 0x8b, 0x9b, 0xeb, 0x48, + 0x46, 0xc9, 0x6a, 0x48, 0x56, 0x43, 0x5d, 0x4e, 0xf3, 0x0b, 0x67, 0xe4, 0xdf, 0xbe, 0xf0, 0xe9, + 0xa8, 0xa9, 0xfd, 0x3d, 0x6a, 0x6a, 0xad, 0x06, 0x98, 0x93, 0xb1, 0x0e, 0xe1, 0x31, 0x8b, 0x38, + 0x69, 0xbd, 0x81, 0xaa, 0x52, 0x77, 0x22, 0x3f, 0xc7, 0x3e, 0x1e, 0xc7, 0xde, 0x3a, 0x05, 0xab, + 0x6e, 0xca, 0x60, 0x0b, 0x1a, 0xd3, 0xa2, 0x0b, 0xb4, 0x07, 0x75, 0xa5, 0x77, 0x08, 0x0d, 0x22, + 0x87, 0x14, 0xfc, 0xa7, 0xe3, 0xfc, 0x8d, 0x53, 0xf8, 0xa5, 0xc3, 0x72, 0x89, 0x75, 0xb8, 0x31, + 0x13, 0x52, 0x34, 0xf9, 0xa2, 0xc3, 0xca, 0xe8, 0xaf, 0xc4, 0x3e, 0x16, 0xe4, 0x65, 0xfa, 0x1e, + 0x8d, 0x2d, 0x58, 0xc6, 0xfb, 0xa2, 0xc7, 0x92, 0x40, 0xf4, 0xd3, 0x1a, 0xcb, 0x9d, 0xda, 0x8f, + 0x6f, 0xf7, 0xab, 0xb2, 0xc9, 0x33, 0xdf, 0x4f, 0x08, 0xe7, 0xaf, 0x44, 0x12, 0x44, 0xd4, 0x51, + 0x56, 0xe3, 0x09, 0x2c, 0x65, 0x4b, 0xa8, 0x9d, 0x4b, 0xbb, 0x5f, 0x47, 0x53, 0x86, 0x87, 0x32, + 0x48, 0xe7, 0xfc, 0xf1, 0xaf, 0xa6, 0xe6, 0xc8, 0x83, 0xed, 0xcb, 0x1f, 0xff, 0x7c, 0xdd, 0x50, + 0x51, 0xad, 0x3a, 0xac, 0x96, 0x5a, 0xe5, 0x8d, 0x37, 0xbf, 0x57, 0xa0, 0xd2, 0xe5, 0xd4, 0xd8, + 0x85, 0x95, 0xf2, 0x60, 0x6e, 0x4f, 0x05, 0x4e, 0x4e, 0xc0, 0xb4, 0x17, 0x34, 0xe6, 0x50, 0xe3, + 0x3d, 0x5c, 0x99, 0x1c, 0xca, 0xdd, 0x39, 0x29, 0xca, 0x6a, 0xb6, 0x17, 0xb6, 0x16, 0xc8, 0x0f, + 0x3a, 0x5c, 0x9b, 0xb1, 0x10, 0x34, 0x27, 0xad, 0xe4, 0x37, 0xb7, 0xce, 0xe6, 0x2f, 0x2a, 0xb8, + 0x70, 0xe9, 0xbf, 0x61, 0xdc, 0x9c, 0x95, 0x33, 0xee, 0x32, 0xef, 0x2d, 0xe2, 0xca, 0x19, 0x9d, + 0x17, 0xc7, 0x03, 0x4b, 0x3f, 0x19, 0x58, 0xfa, 0xef, 0x81, 0xa5, 0x7f, 0x1e, 0x5a, 0xda, 0xc9, + 0xd0, 0xd2, 0x7e, 0x0e, 0x2d, 0xed, 0xed, 0x03, 0x1a, 0x88, 0xde, 0xbe, 0x8b, 0x3c, 0x16, 0xda, + 0x32, 0xd1, 0xeb, 0xe1, 0x20, 0xca, 0x1f, 0xec, 0x43, 0xf5, 0x11, 0x12, 0xfd, 0x98, 0x70, 0x77, + 0x29, 0xfd, 0x9a, 0x3c, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xcd, 0x69, 0x5c, 0x18, 0x0f, 0x05, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -300,12 +418,17 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // WrappedDelegate defines a method for performing a delegation of coins from a delegator to a validator. + // WrappedDelegate defines a method for performing a delegation of coins from + // a delegator to a validator. WrappedDelegate(ctx context.Context, in *MsgWrappedDelegate, opts ...grpc.CallOption) (*MsgWrappedDelegateResponse, error) - // WrappedUndelegate defines a method for performing an undelegation from a delegate and a validator. + // WrappedUndelegate defines a method for performing an undelegation from a + // delegate and a validator. WrappedUndelegate(ctx context.Context, in *MsgWrappedUndelegate, opts ...grpc.CallOption) (*MsgWrappedUndelegateResponse, error) - // WrappedBeginRedelegate defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. + // WrappedBeginRedelegate defines a method for performing a redelegation of + // coins from a delegator and source validator to a destination validator. WrappedBeginRedelegate(ctx context.Context, in *MsgWrappedBeginRedelegate, opts ...grpc.CallOption) (*MsgWrappedBeginRedelegateResponse, error) + // UpdateParams defines a method for updating epoching module parameters. + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -343,14 +466,28 @@ func (c *msgClient) WrappedBeginRedelegate(ctx context.Context, in *MsgWrappedBe return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/babylon.epoching.v1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { - // WrappedDelegate defines a method for performing a delegation of coins from a delegator to a validator. + // WrappedDelegate defines a method for performing a delegation of coins from + // a delegator to a validator. WrappedDelegate(context.Context, *MsgWrappedDelegate) (*MsgWrappedDelegateResponse, error) - // WrappedUndelegate defines a method for performing an undelegation from a delegate and a validator. + // WrappedUndelegate defines a method for performing an undelegation from a + // delegate and a validator. WrappedUndelegate(context.Context, *MsgWrappedUndelegate) (*MsgWrappedUndelegateResponse, error) - // WrappedBeginRedelegate defines a method for performing a redelegation of coins from a delegator and source validator to a destination validator. + // WrappedBeginRedelegate defines a method for performing a redelegation of + // coins from a delegator and source validator to a destination validator. WrappedBeginRedelegate(context.Context, *MsgWrappedBeginRedelegate) (*MsgWrappedBeginRedelegateResponse, error) + // UpdateParams defines a method for updating epoching module parameters. + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -366,6 +503,9 @@ func (*UnimplementedMsgServer) WrappedUndelegate(ctx context.Context, req *MsgWr func (*UnimplementedMsgServer) WrappedBeginRedelegate(ctx context.Context, req *MsgWrappedBeginRedelegate) (*MsgWrappedBeginRedelegateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WrappedBeginRedelegate not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -425,6 +565,24 @@ func _Msg_WrappedBeginRedelegate_Handler(srv interface{}, ctx context.Context, d return interceptor(ctx, in, info, handler) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/babylon.epoching.v1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.epoching.v1.Msg", HandlerType: (*MsgServer)(nil), @@ -441,6 +599,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "WrappedBeginRedelegate", Handler: _Msg_WrappedBeginRedelegate_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "babylon/epoching/v1/tx.proto", @@ -620,6 +782,69 @@ func (m *MsgWrappedBeginRedelegateResponse) MarshalToSizedBuffer(dAtA []byte) (i return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -697,6 +922,30 @@ func (m *MsgWrappedBeginRedelegateResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1111,6 +1360,171 @@ func (m *MsgWrappedBeginRedelegateResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/monitor/client/cli/query_params.go b/x/monitor/client/cli/query_params.go deleted file mode 100644 index 9578c4226..000000000 --- a/x/monitor/client/cli/query_params.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "context" - - "github.com/babylonchain/babylon/x/monitor/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/monitor/genesis.go b/x/monitor/genesis.go index 9a2cea635..3056ff875 100644 --- a/x/monitor/genesis.go +++ b/x/monitor/genesis.go @@ -9,13 +9,10 @@ import ( // InitGenesis initializes the capability module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) } // ExportGenesis returns the capability module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - return genesis } diff --git a/x/monitor/genesis_test.go b/x/monitor/genesis_test.go index a5d8dd915..11e9484a4 100644 --- a/x/monitor/genesis_test.go +++ b/x/monitor/genesis_test.go @@ -4,8 +4,8 @@ import ( "testing" "github.com/babylonchain/babylon/x/monitor" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/stretchr/testify/require" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" simapp "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/x/monitor/types" @@ -14,20 +14,6 @@ import ( func TestExportGenesis(t *testing.T) { app := simapp.Setup(t, false) ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - - app.MonitorKeeper.SetParams(ctx, types.DefaultParams()) genesisState := monitor.ExportGenesis(ctx, app.MonitorKeeper) - require.Equal(t, genesisState.Params, types.DefaultParams()) -} - -func TestInitGenesis(t *testing.T) { - app := simapp.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{}) - - genesisState := types.GenesisState{ - Params: types.Params{}, - } - - monitor.InitGenesis(ctx, app.MonitorKeeper, genesisState) - require.Equal(t, app.MonitorKeeper.GetParams(ctx), genesisState.Params) + require.Equal(t, genesisState, types.DefaultGenesis()) } diff --git a/x/monitor/handler.go b/x/monitor/handler.go deleted file mode 100644 index f9d925572..000000000 --- a/x/monitor/handler.go +++ /dev/null @@ -1,23 +0,0 @@ -package monitor - -import ( - "fmt" - - "github.com/babylonchain/babylon/x/monitor/keeper" - "github.com/babylonchain/babylon/x/monitor/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" -) - -// NewHandler ... -func NewHandler(k keeper.Keeper) sdk.Handler { - - return func(ctx sdk.Context, msg sdk.Msg) (*sdk.Result, error) { - - switch msg := msg.(type) { - default: - errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) - return nil, sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) - } - } -} diff --git a/x/monitor/keeper/grpc_query_params.go b/x/monitor/keeper/grpc_query_params.go deleted file mode 100644 index 9ba4a1b00..000000000 --- a/x/monitor/keeper/grpc_query_params.go +++ /dev/null @@ -1,26 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/babylonchain/babylon/x/monitor/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -// Querier is used as Keeper will have duplicate methods if used directly, and gRPC names take precedence over keeper -type Querier struct { - Keeper -} - -var _ types.QueryServer = Querier{} - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/monitor/keeper/grpc_query_test.go b/x/monitor/keeper/grpc_query_test.go index 44dc9ee11..c4775ddf7 100644 --- a/x/monitor/keeper/grpc_query_test.go +++ b/x/monitor/keeper/grpc_query_test.go @@ -1,6 +1,9 @@ package keeper_test import ( + "math/rand" + "testing" + "github.com/babylonchain/babylon/btctxformatter" "github.com/babylonchain/babylon/testutil/datagen" "github.com/babylonchain/babylon/testutil/mocks" @@ -8,31 +11,27 @@ import ( ckpttypes "github.com/babylonchain/babylon/x/checkpointing/types" "github.com/babylonchain/babylon/x/epoching/testepoching" types2 "github.com/babylonchain/babylon/x/epoching/types" - monitorkeeper "github.com/babylonchain/babylon/x/monitor/keeper" "github.com/babylonchain/babylon/x/monitor/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/golang/mock/gomock" "github.com/stretchr/testify/require" - "math/rand" - "testing" ) func FuzzQueryEndedEpochBtcHeight(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // a genesis validator is generated for setup helper := testepoching.NewHelper(t) lck := helper.App.BTCLightClientKeeper mk := helper.App.MonitorKeeper ek := helper.EpochingKeeper - querier := monitorkeeper.Querier{Keeper: mk} queryHelper := baseapp.NewQueryServerTestHelper(helper.Ctx, helper.App.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, querier) + types.RegisterQueryServer(queryHelper, mk) queryClient := types.NewQueryClient(queryHelper) // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := ek.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) @@ -40,7 +39,7 @@ func FuzzQueryEndedEpochBtcHeight(f *testing.F) { tree := datagen.NewBTCHeaderTree() root := lck.GetBaseBTCHeader(ctx) tree.Add(root, nil) - tree.GenRandomBTCHeaderTree(1, 10, root, func(header *btclightclienttypes.BTCHeaderInfo) bool { + tree.GenRandomBTCHeaderTree(r, 1, 10, root, func(header *btclightclienttypes.BTCHeaderInfo) bool { err := lck.InsertHeader(ctx, header.Header) require.NoError(t, err) return true @@ -51,7 +50,7 @@ func FuzzQueryEndedEpochBtcHeight(f *testing.F) { // go to BeginBlock of block 11, and thus entering epoch 2 for i := uint64(0); i < ek.GetParams(ctx).EpochInterval; i++ { - ctx = helper.GenAndApplyEmptyBlock() + ctx = helper.GenAndApplyEmptyBlock(r) } epoch = ek.GetEpoch(ctx) require.Equal(t, uint64(2), epoch.EpochNumber) @@ -77,7 +76,7 @@ func FuzzQueryEndedEpochBtcHeight(f *testing.F) { func FuzzQueryReportedCheckpointBtcHeight(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // a genesis validator is generated for setup helper := testepoching.NewHelper(t) ctl := gomock.NewController(t) @@ -88,13 +87,12 @@ func FuzzQueryReportedCheckpointBtcHeight(f *testing.F) { ck := helper.App.CheckpointingKeeper mockEk := mocks.NewMockEpochingKeeper(ctl) ck.SetEpochingKeeper(mockEk) - querier := monitorkeeper.Querier{Keeper: mk} queryHelper := baseapp.NewQueryServerTestHelper(helper.Ctx, helper.App.InterfaceRegistry()) - types.RegisterQueryServer(queryHelper, querier) + types.RegisterQueryServer(queryHelper, mk) queryClient := types.NewQueryClient(queryHelper) // BeginBlock of block 1, and thus entering epoch 1 - ctx := helper.BeginBlock() + ctx := helper.BeginBlock(r) epoch := ek.GetEpoch(ctx) require.Equal(t, uint64(1), epoch.EpochNumber) @@ -102,14 +100,14 @@ func FuzzQueryReportedCheckpointBtcHeight(f *testing.F) { tree := datagen.NewBTCHeaderTree() root := lck.GetBaseBTCHeader(ctx) tree.Add(root, nil) - tree.GenRandomBTCHeaderTree(1, 10, root, func(header *btclightclienttypes.BTCHeaderInfo) bool { + tree.GenRandomBTCHeaderTree(r, 1, 10, root, func(header *btclightclienttypes.BTCHeaderInfo) bool { err := lck.InsertHeader(ctx, header.Header) require.NoError(t, err) return true }) // Add checkpoint - valBlsSet, privKeys := datagen.GenerateValidatorSetWithBLSPrivKeys(int(datagen.RandomIntOtherThan(0, 10))) + valBlsSet, privKeys := datagen.GenerateValidatorSetWithBLSPrivKeys(int(datagen.RandomIntOtherThan(r, 0, 10))) valSet := make([]types2.Validator, len(valBlsSet.ValSet)) for i, val := range valBlsSet.ValSet { valSet[i] = types2.Validator{ @@ -119,7 +117,7 @@ func FuzzQueryReportedCheckpointBtcHeight(f *testing.F) { err := ck.CreateRegistration(ctx, val.BlsPubKey, []byte(val.ValidatorAddress)) require.NoError(t, err) } - mockCkptWithMeta := &ckpttypes.RawCheckpointWithMeta{Ckpt: datagen.GenerateLegitimateRawCheckpoint(privKeys)} + mockCkptWithMeta := &ckpttypes.RawCheckpointWithMeta{Ckpt: datagen.GenerateLegitimateRawCheckpoint(r, privKeys)} mockEk.EXPECT().GetValidatorSet(gomock.Any(), gomock.Eq(mockCkptWithMeta.Ckpt.EpochNum)).Return(valSet).AnyTimes() // make sure voting power is always sufficient mockEk.EXPECT().GetTotalVotingPower(gomock.Any(), gomock.Eq(mockCkptWithMeta.Ckpt.EpochNum)).Return(int64(0)).AnyTimes() @@ -134,7 +132,7 @@ func FuzzQueryReportedCheckpointBtcHeight(f *testing.F) { Epoch: mockCkptWithMeta.Ckpt.EpochNum, LastCommitHash: *mockCkptWithMeta.Ckpt.LastCommitHash, BitMap: mockCkptWithMeta.Ckpt.Bitmap, - SubmitterAddress: datagen.GenRandomByteArray(btctxformatter.AddressLength), + SubmitterAddress: datagen.GenRandomByteArray(r, btctxformatter.AddressLength), BlsSig: *mockCkptWithMeta.Ckpt.BlsMultiSig, } err = ck.VerifyCheckpoint(ctx, btcCkpt) @@ -150,7 +148,7 @@ func FuzzQueryReportedCheckpointBtcHeight(f *testing.F) { // query not reported checkpoint BTC light client height, should expect an ErrCheckpointNotReported req = types.QueryReportedCheckpointBtcHeightRequest{ - CkptHash: datagen.GenRandomHexStr(32), + CkptHash: datagen.GenRandomHexStr(r, 32), } _, err = queryClient.ReportedCheckpointBtcHeight(ctx, &req) require.ErrorIs(t, err, types.ErrCheckpointNotReported) diff --git a/x/monitor/keeper/keeper.go b/x/monitor/keeper/keeper.go index 308ee45e8..aa5ff716a 100644 --- a/x/monitor/keeper/keeper.go +++ b/x/monitor/keeper/keeper.go @@ -2,14 +2,14 @@ package keeper import ( "fmt" + ckpttypes "github.com/babylonchain/babylon/x/checkpointing/types" "github.com/babylonchain/babylon/x/monitor/types" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/tendermint/tendermint/libs/log" ) type ( @@ -17,7 +17,6 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey memKey storetypes.StoreKey - paramstore paramtypes.Subspace btcLightClientKeeper types.BTCLightClientKeeper } ) @@ -26,19 +25,12 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, bk types.BTCLightClientKeeper, ) Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, - paramstore: ps, btcLightClientKeeper: bk, } } diff --git a/x/monitor/keeper/params.go b/x/monitor/keeper/params.go deleted file mode 100644 index c904062ad..000000000 --- a/x/monitor/keeper/params.go +++ /dev/null @@ -1,17 +0,0 @@ -package keeper - -import ( - "github.com/babylonchain/babylon/x/monitor/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSet(ctx, ¶ms) - return params -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/monitor/module.go b/x/monitor/module.go index 337d27286..c1badb11c 100644 --- a/x/monitor/module.go +++ b/x/monitor/module.go @@ -9,7 +9,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/babylonchain/babylon/x/monitor/client/cli" "github.com/babylonchain/babylon/x/monitor/keeper" @@ -124,19 +124,9 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } -// Route returns the capability module's message routing key. -func (am AppModule) Route() sdk.Route { - return sdk.NewRoute(types.RouterKey, NewHandler(am.keeper)) -} - // QuerierRoute returns the capability module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } -// LegacyQuerierHandler returns the capability module's Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { @@ -165,7 +155,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} diff --git a/x/monitor/module_simulation.go b/x/monitor/module_simulation.go index bf642f766..3c06916db 100644 --- a/x/monitor/module_simulation.go +++ b/x/monitor/module_simulation.go @@ -1,12 +1,10 @@ package monitor import ( - "math/rand" - + simappparams "github.com/babylonchain/babylon/app/params" monitorsimulation "github.com/babylonchain/babylon/x/monitor/simulation" "github.com/babylonchain/babylon/x/monitor/types" "github.com/cosmos/cosmos-sdk/baseapp" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" @@ -27,23 +25,15 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { for i, acc := range simState.Accounts { accs[i] = acc.Address.String() } - monitorgenesis := types.GenesisState{ - Params: types.DefaultParams(), - } + monitorgenesis := types.GenesisState{} simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&monitorgenesis) } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } -// RandomizedParams creates randomized param changes for the simulator -func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} diff --git a/x/monitor/types/errors.go b/x/monitor/types/errors.go index 565387fe6..85139bba8 100644 --- a/x/monitor/types/errors.go +++ b/x/monitor/types/errors.go @@ -3,11 +3,11 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/monitor module sentinel errors var ( - ErrEpochNotEnded = sdkerrors.Register(ModuleName, 1100, "Epoch not ended yet") - ErrCheckpointNotReported = sdkerrors.Register(ModuleName, 1101, "Checkpoint not reported yet") + ErrEpochNotEnded = errorsmod.Register(ModuleName, 1100, "Epoch not ended yet") + ErrCheckpointNotReported = errorsmod.Register(ModuleName, 1101, "Checkpoint not reported yet") ) diff --git a/x/monitor/types/genesis.go b/x/monitor/types/genesis.go index a6cdfe807..094d1119c 100644 --- a/x/monitor/types/genesis.go +++ b/x/monitor/types/genesis.go @@ -5,14 +5,11 @@ const DefaultIndex uint64 = 1 // DefaultGenesis returns the default Capability genesis state func DefaultGenesis() *GenesisState { - return &GenesisState{ - Params: DefaultParams(), - } + return &GenesisState{} } // Validate performs basic genesis state validation returning an error upon any // failure. func (gs GenesisState) Validate() error { - - return gs.Params.Validate() + return nil } diff --git a/x/monitor/types/genesis.pb.go b/x/monitor/types/genesis.pb.go index 2bfeb15e0..8e2be0c21 100644 --- a/x/monitor/types/genesis.pb.go +++ b/x/monitor/types/genesis.pb.go @@ -1,12 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/monitor/genesis.proto +// source: babylon/monitor/v1/genesis.proto package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -25,14 +24,13 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the monitor module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_98b2aa1b23cbbe77, []int{0} + return fileDescriptor_fb844fd916189e7b, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -61,34 +59,23 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func init() { proto.RegisterType((*GenesisState)(nil), "babylon.monitor.v1.GenesisState") } -func init() { proto.RegisterFile("babylon/monitor/genesis.proto", fileDescriptor_98b2aa1b23cbbe77) } +func init() { proto.RegisterFile("babylon/monitor/v1/genesis.proto", fileDescriptor_fb844fd916189e7b) } -var fileDescriptor_98b2aa1b23cbbe77 = []byte{ - // 195 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4d, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0xcf, 0xcd, 0xcf, 0xcb, 0x2c, 0xc9, 0x2f, 0xd2, 0x4f, 0x4f, 0xcd, 0x4b, - 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0x4a, 0xeb, 0x41, 0xa5, - 0xf5, 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xd2, 0xfa, 0x20, 0x16, 0x44, 0xa5, - 0x94, 0x0c, 0xba, 0x41, 0x05, 0x89, 0x45, 0x89, 0xb9, 0x50, 0x73, 0x94, 0x3c, 0xb8, 0x78, 0xdc, - 0x21, 0x06, 0x07, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x59, 0x70, 0xb1, 0x41, 0xe4, 0x25, 0x18, 0x15, - 0x18, 0x35, 0xb8, 0x8d, 0xa4, 0xf4, 0x30, 0x2d, 0xd2, 0x0b, 0x00, 0xab, 0x70, 0x62, 0x39, 0x71, - 0x4f, 0x9e, 0x21, 0x08, 0xaa, 0xde, 0xc9, 0xf3, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, - 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, - 0x18, 0xa2, 0xf4, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xa1, 0xa6, - 0x25, 0x67, 0x24, 0x66, 0xe6, 0xc1, 0x38, 0xfa, 0x15, 0x70, 0xb7, 0x95, 0x54, 0x16, 0xa4, 0x16, - 0x27, 0xb1, 0x81, 0xdd, 0x66, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x87, 0x54, 0x4d, 0xde, 0x04, - 0x01, 0x00, 0x00, +var fileDescriptor_fb844fd916189e7b = []byte{ + // 144 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0x4a, 0x4c, 0xaa, + 0xcc, 0xc9, 0xcf, 0xd3, 0xcf, 0xcd, 0xcf, 0xcb, 0x2c, 0xc9, 0x2f, 0xd2, 0x2f, 0x33, 0xd4, 0x4f, + 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xaa, + 0xd0, 0x83, 0xaa, 0xd0, 0x2b, 0x33, 0x54, 0xe2, 0xe3, 0xe2, 0x71, 0x87, 0x28, 0x0a, 0x2e, 0x49, + 0x2c, 0x49, 0x75, 0xf2, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, + 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xfd, + 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0xa8, 0x41, 0xc9, 0x19, 0x89, + 0x99, 0x79, 0x30, 0x8e, 0x7e, 0x05, 0xdc, 0xe6, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, + 0xad, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb7, 0x9f, 0x6b, 0xe2, 0x99, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -111,16 +98,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -141,8 +118,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) return n } @@ -181,39 +156,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/monitor/types/params.go b/x/monitor/types/params.go deleted file mode 100644 index 4f3215e35..000000000 --- a/x/monitor/types/params.go +++ /dev/null @@ -1,32 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} diff --git a/x/monitor/types/params.pb.go b/x/monitor/types/params.pb.go deleted file mode 100644 index 70566842b..000000000 --- a/x/monitor/types/params.pb.go +++ /dev/null @@ -1,286 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/monitor/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_122b02f3f9b23cbe, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Params)(nil), "babylon.monitor.v1.Params") -} - -func init() { proto.RegisterFile("babylon/monitor/params.proto", fileDescriptor_122b02f3f9b23cbe) } - -var fileDescriptor_122b02f3f9b23cbe = []byte{ - // 153 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0xcf, 0xcd, 0xcf, 0xcb, 0x2c, 0xc9, 0x2f, 0xd2, 0x2f, 0x48, 0x2c, 0x4a, - 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xca, 0xea, 0x41, 0x65, 0xf5, - 0xca, 0x0c, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0xd2, 0xfa, 0x20, 0x16, 0x44, 0xa5, 0x12, - 0x1f, 0x17, 0x5b, 0x00, 0x58, 0xa7, 0x15, 0xcb, 0x8b, 0x05, 0xf2, 0x8c, 0x4e, 0x9e, 0x27, 0x1e, - 0xc9, 0x31, 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, - 0x1e, 0xcb, 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x9f, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, - 0x97, 0x9c, 0x9f, 0xab, 0x0f, 0x35, 0x3e, 0x39, 0x23, 0x31, 0x33, 0x0f, 0xc6, 0xd1, 0xaf, 0x80, - 0xbb, 0xa5, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0x6c, 0x83, 0x31, 0x20, 0x00, 0x00, 0xff, - 0xff, 0x3f, 0x70, 0x61, 0xbe, 0xab, 0x00, 0x00, 0x00, -} - -func (this *Params) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Params) - if !ok { - that2, ok := that.(Params) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - return true -} -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/monitor/types/params_test.go b/x/monitor/types/params_test.go deleted file mode 100644 index 53e3c1f6a..000000000 --- a/x/monitor/types/params_test.go +++ /dev/null @@ -1,16 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/babylonchain/babylon/x/monitor/types" - "github.com/stretchr/testify/require" -) - -func TestParamsEqual(t *testing.T) { - p1 := types.DefaultParams() - p2 := types.DefaultParams() - - ok := p1.Equal(p2) - require.True(t, ok) -} diff --git a/x/monitor/types/query.pb.go b/x/monitor/types/query.pb.go index 8be5efc78..210128e1c 100644 --- a/x/monitor/types/query.pb.go +++ b/x/monitor/types/query.pb.go @@ -1,15 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/monitor/query.proto +// source: babylon/monitor/v1/query.proto package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -30,89 +28,8 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3b70877a7534d1c4, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3b70877a7534d1c4, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - +// QueryEndedEpochBtcHeightRequest defines a query type for EndedEpochBtcHeight +// RPC method type QueryEndedEpochBtcHeightRequest struct { EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` } @@ -121,7 +38,7 @@ func (m *QueryEndedEpochBtcHeightRequest) Reset() { *m = QueryEndedEpoch func (m *QueryEndedEpochBtcHeightRequest) String() string { return proto.CompactTextString(m) } func (*QueryEndedEpochBtcHeightRequest) ProtoMessage() {} func (*QueryEndedEpochBtcHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3b70877a7534d1c4, []int{2} + return fileDescriptor_a8aafb034c55a8f2, []int{0} } func (m *QueryEndedEpochBtcHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -157,6 +74,8 @@ func (m *QueryEndedEpochBtcHeightRequest) GetEpochNum() uint64 { return 0 } +// QueryEndedEpochBtcHeightResponse defines a response type for +// 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"` @@ -166,7 +85,7 @@ func (m *QueryEndedEpochBtcHeightResponse) Reset() { *m = QueryEndedEpoc func (m *QueryEndedEpochBtcHeightResponse) String() string { return proto.CompactTextString(m) } func (*QueryEndedEpochBtcHeightResponse) ProtoMessage() {} func (*QueryEndedEpochBtcHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3b70877a7534d1c4, []int{3} + return fileDescriptor_a8aafb034c55a8f2, []int{1} } func (m *QueryEndedEpochBtcHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -202,6 +121,8 @@ func (m *QueryEndedEpochBtcHeightResponse) GetBtcLightClientHeight() uint64 { return 0 } +// QueryReportedCheckpointBtcHeightRequest defines a query type for +// ReportedCheckpointBtcHeight RPC method type QueryReportedCheckpointBtcHeightRequest struct { // ckpt_hash is hex encoded byte string of the hash of the checkpoint CkptHash string `protobuf:"bytes,1,opt,name=ckpt_hash,json=ckptHash,proto3" json:"ckpt_hash,omitempty"` @@ -213,7 +134,7 @@ func (m *QueryReportedCheckpointBtcHeightRequest) Reset() { func (m *QueryReportedCheckpointBtcHeightRequest) String() string { return proto.CompactTextString(m) } func (*QueryReportedCheckpointBtcHeightRequest) ProtoMessage() {} func (*QueryReportedCheckpointBtcHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_3b70877a7534d1c4, []int{4} + return fileDescriptor_a8aafb034c55a8f2, []int{2} } func (m *QueryReportedCheckpointBtcHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -249,6 +170,8 @@ func (m *QueryReportedCheckpointBtcHeightRequest) GetCkptHash() string { return "" } +// QueryReportedCheckpointBtcHeightResponse defines a response type for +// 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"` @@ -260,7 +183,7 @@ func (m *QueryReportedCheckpointBtcHeightResponse) Reset() { func (m *QueryReportedCheckpointBtcHeightResponse) String() string { return proto.CompactTextString(m) } func (*QueryReportedCheckpointBtcHeightResponse) ProtoMessage() {} func (*QueryReportedCheckpointBtcHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_3b70877a7534d1c4, []int{5} + return fileDescriptor_a8aafb034c55a8f2, []int{3} } func (m *QueryReportedCheckpointBtcHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -297,51 +220,42 @@ func (m *QueryReportedCheckpointBtcHeightResponse) GetBtcLightClientHeight() uin } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "babylon.monitor.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "babylon.monitor.v1.QueryParamsResponse") proto.RegisterType((*QueryEndedEpochBtcHeightRequest)(nil), "babylon.monitor.v1.QueryEndedEpochBtcHeightRequest") proto.RegisterType((*QueryEndedEpochBtcHeightResponse)(nil), "babylon.monitor.v1.QueryEndedEpochBtcHeightResponse") proto.RegisterType((*QueryReportedCheckpointBtcHeightRequest)(nil), "babylon.monitor.v1.QueryReportedCheckpointBtcHeightRequest") proto.RegisterType((*QueryReportedCheckpointBtcHeightResponse)(nil), "babylon.monitor.v1.QueryReportedCheckpointBtcHeightResponse") } -func init() { proto.RegisterFile("babylon/monitor/query.proto", fileDescriptor_3b70877a7534d1c4) } - -var fileDescriptor_3b70877a7534d1c4 = []byte{ - // 515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x54, 0x4f, 0x6b, 0xd4, 0x4e, - 0x18, 0xde, 0xfc, 0xd8, 0xdf, 0xd2, 0x8e, 0xb7, 0xe9, 0x82, 0x92, 0x2d, 0x69, 0xc9, 0xa1, 0x5d, - 0x14, 0x33, 0x6c, 0x57, 0x41, 0x50, 0x3c, 0x6c, 0xa9, 0x54, 0x10, 0xff, 0xe4, 0xa6, 0x97, 0x30, - 0x99, 0x1d, 0x92, 0xa1, 0x9b, 0x99, 0x69, 0x66, 0xb2, 0xb8, 0x94, 0xbd, 0x78, 0xf3, 0x26, 0xf8, - 0x45, 0xfc, 0x18, 0xbd, 0x08, 0x05, 0x2f, 0x9e, 0x44, 0x76, 0xfd, 0x20, 0x92, 0xc9, 0x34, 0x60, - 0x9b, 0x75, 0x51, 0x6f, 0xc9, 0xfb, 0xbc, 0xcf, 0xf3, 0x3e, 0x6f, 0xde, 0x87, 0x80, 0x5e, 0x8c, - 0xe3, 0xd9, 0x44, 0x70, 0x94, 0x09, 0xce, 0xb4, 0xc8, 0xd1, 0x69, 0x41, 0xf3, 0x59, 0x20, 0x73, - 0xa1, 0x05, 0x84, 0x16, 0x0c, 0x2c, 0x18, 0x4c, 0x07, 0x6e, 0x37, 0x11, 0x89, 0x30, 0x30, 0x2a, - 0x9f, 0xaa, 0x4e, 0x77, 0x3b, 0x11, 0x22, 0x99, 0x50, 0x84, 0x25, 0x43, 0x98, 0x73, 0xa1, 0xb1, - 0x66, 0x82, 0x2b, 0x8b, 0xde, 0x26, 0x42, 0x65, 0x42, 0xa1, 0x18, 0x2b, 0x5a, 0x0d, 0x40, 0xd3, - 0x41, 0x4c, 0x35, 0x1e, 0x20, 0x89, 0x13, 0xc6, 0x4d, 0xf3, 0xa5, 0xd2, 0x55, 0x43, 0x12, 0xe7, - 0x38, 0xb3, 0x4a, 0x7e, 0x17, 0xc0, 0x57, 0x25, 0xff, 0xa5, 0x29, 0x86, 0xf4, 0xb4, 0xa0, 0x4a, - 0xfb, 0x2f, 0xc0, 0xd6, 0x2f, 0x55, 0x25, 0x05, 0x57, 0x14, 0x3e, 0x00, 0x9d, 0x8a, 0x7c, 0xcb, - 0xd9, 0x75, 0xfa, 0x37, 0x0e, 0xdc, 0xe0, 0xfa, 0x3e, 0x41, 0xc5, 0x19, 0xb5, 0xcf, 0xbf, 0xed, - 0xb4, 0x42, 0xdb, 0xef, 0x3f, 0x06, 0x3b, 0x46, 0xf0, 0x88, 0x8f, 0xe9, 0xf8, 0x48, 0x0a, 0x92, - 0x8e, 0x34, 0x39, 0xa6, 0x2c, 0x49, 0xb5, 0x9d, 0x09, 0x7b, 0x60, 0x93, 0x96, 0x40, 0xc4, 0x8b, - 0xcc, 0xe8, 0xb7, 0xc3, 0x0d, 0x53, 0x78, 0x5e, 0x64, 0xfe, 0x6b, 0xb0, 0xbb, 0x9a, 0x6f, 0xdd, - 0xdd, 0x07, 0x37, 0x63, 0x4d, 0xa2, 0x49, 0x59, 0x8c, 0xc8, 0x84, 0x51, 0xae, 0xa3, 0xd4, 0xb4, - 0x58, 0xb9, 0x6e, 0xac, 0xc9, 0xb3, 0xf2, 0xfd, 0xd0, 0x80, 0x15, 0xdd, 0x7f, 0x02, 0xf6, 0x8d, - 0x74, 0x48, 0xa5, 0xc8, 0x35, 0x1d, 0x1f, 0xa6, 0x94, 0x9c, 0x48, 0xc1, 0xb8, 0x6e, 0xb2, 0x48, - 0x4e, 0xa4, 0x8e, 0x52, 0xac, 0x52, 0xa3, 0xb9, 0x19, 0x6e, 0x94, 0x85, 0x63, 0xac, 0x52, 0x1f, - 0x83, 0xfe, 0x7a, 0x9d, 0x7f, 0xb2, 0x7a, 0xf0, 0xbe, 0x0d, 0xfe, 0x37, 0x33, 0xe0, 0x1c, 0x74, - 0xaa, 0xef, 0x0c, 0xf7, 0x9a, 0x6e, 0x70, 0xfd, 0xa4, 0xee, 0xfe, 0xda, 0xbe, 0xca, 0x9b, 0xef, - 0xbf, 0xfb, 0xf2, 0xe3, 0xe3, 0x7f, 0xdb, 0xd0, 0x45, 0x57, 0x83, 0x33, 0x1d, 0xd8, 0xec, 0xc0, - 0x4f, 0x0e, 0xd8, 0x6a, 0x38, 0x05, 0x1c, 0xae, 0x1c, 0xb2, 0xfa, 0xf0, 0xee, 0xbd, 0x3f, 0x23, - 0x59, 0x9b, 0x81, 0xb1, 0xd9, 0x87, 0x7b, 0x4d, 0x36, 0x4d, 0x6e, 0x14, 0x3a, 0xab, 0x03, 0x35, - 0x87, 0x9f, 0x1d, 0xd0, 0xfb, 0xcd, 0x69, 0xe0, 0xc3, 0x95, 0x2e, 0xd6, 0x07, 0xc3, 0x7d, 0xf4, - 0x77, 0x64, 0xbb, 0xca, 0xd0, 0xac, 0x72, 0x17, 0xde, 0x69, 0x5a, 0x85, 0xd4, 0x44, 0x85, 0xce, - 0xea, 0xf4, 0xcd, 0x47, 0x4f, 0xcf, 0x17, 0x9e, 0x73, 0xb1, 0xf0, 0x9c, 0xef, 0x0b, 0xcf, 0xf9, - 0xb0, 0xf4, 0x5a, 0x17, 0x4b, 0xaf, 0xf5, 0x75, 0xe9, 0xb5, 0xde, 0xa0, 0x84, 0xe9, 0xb4, 0x88, - 0x03, 0x22, 0xb2, 0x4b, 0x41, 0x92, 0x62, 0xc6, 0x6b, 0xf5, 0xb7, 0xb5, 0xbe, 0x9e, 0x49, 0xaa, - 0xe2, 0x8e, 0xf9, 0x15, 0x0c, 0x7f, 0x06, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x8a, 0xb1, 0xb8, 0xbb, - 0x04, 0x00, 0x00, +func init() { proto.RegisterFile("babylon/monitor/v1/query.proto", fileDescriptor_a8aafb034c55a8f2) } + +var fileDescriptor_a8aafb034c55a8f2 = []byte{ + // 404 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0x4f, 0x8b, 0xd3, 0x40, + 0x18, 0xc6, 0x1b, 0xff, 0xd1, 0xce, 0x71, 0x14, 0x94, 0x56, 0x62, 0xc9, 0x41, 0x0b, 0x62, 0x86, + 0x5a, 0x3d, 0x29, 0x1e, 0x5a, 0x2a, 0x15, 0x44, 0x30, 0x37, 0xbd, 0x84, 0xc9, 0x74, 0xc8, 0x0c, + 0x4d, 0x66, 0xa6, 0x99, 0x49, 0xb1, 0x94, 0x5e, 0x3c, 0x7a, 0x12, 0xfc, 0x22, 0x7e, 0x0c, 0x2f, + 0x42, 0xc1, 0x8b, 0xc7, 0xa5, 0xdd, 0x0f, 0xb2, 0x64, 0x9a, 0xcd, 0x65, 0xd3, 0x2d, 0xbb, 0x7b, + 0xcc, 0xfb, 0xe6, 0xf9, 0xcd, 0xfb, 0xbc, 0xcf, 0x0c, 0x70, 0x23, 0x1c, 0x2d, 0x13, 0x29, 0x50, + 0x2a, 0x05, 0x37, 0x32, 0x43, 0x8b, 0x3e, 0x9a, 0xe7, 0x34, 0x5b, 0xfa, 0x2a, 0x93, 0x46, 0x42, + 0x58, 0xf6, 0xfd, 0xb2, 0xef, 0x2f, 0xfa, 0xed, 0xc7, 0xb1, 0x94, 0x71, 0x42, 0x11, 0x56, 0x1c, + 0x61, 0x21, 0xa4, 0xc1, 0x86, 0x4b, 0xa1, 0xf7, 0x0a, 0xef, 0x1d, 0x78, 0xf2, 0xb9, 0x00, 0x8c, + 0xc5, 0x94, 0x4e, 0xc7, 0x4a, 0x12, 0x36, 0x34, 0x64, 0x42, 0x79, 0xcc, 0x4c, 0x40, 0xe7, 0x39, + 0xd5, 0x06, 0x76, 0x40, 0x8b, 0x16, 0x8d, 0x50, 0xe4, 0xe9, 0x23, 0xa7, 0xeb, 0xf4, 0xee, 0x04, + 0x4d, 0x5b, 0xf8, 0x94, 0xa7, 0xde, 0x17, 0xd0, 0x3d, 0xac, 0xd7, 0x4a, 0x0a, 0x4d, 0xe1, 0x6b, + 0xf0, 0x30, 0x32, 0x24, 0x4c, 0x8a, 0x62, 0x48, 0x12, 0x4e, 0x85, 0x09, 0x99, 0xfd, 0xa5, 0xc4, + 0x3d, 0x88, 0x0c, 0xf9, 0x58, 0x7c, 0x8f, 0x6c, 0x73, 0x2f, 0xf7, 0xde, 0x83, 0x67, 0x16, 0x1d, + 0x50, 0x25, 0x33, 0x43, 0xa7, 0x23, 0x46, 0xc9, 0x4c, 0x49, 0x2e, 0x4c, 0xdd, 0x88, 0x64, 0xa6, + 0x4c, 0xc8, 0xb0, 0x66, 0x96, 0xd9, 0x0a, 0x9a, 0x45, 0x61, 0x82, 0x35, 0xf3, 0x30, 0xe8, 0x1d, + 0xe7, 0xdc, 0x68, 0xd4, 0x97, 0x3f, 0x6e, 0x83, 0xbb, 0xf6, 0x0c, 0xf8, 0xdb, 0x01, 0xf7, 0x6b, + 0x76, 0x01, 0x07, 0xfe, 0xc5, 0x68, 0xfc, 0x23, 0x9b, 0x6f, 0xbf, 0xba, 0x9a, 0x68, 0xef, 0xc1, + 0xf3, 0xbf, 0xff, 0x3b, 0xfd, 0x75, 0xab, 0x07, 0x9f, 0xa2, 0x9a, 0xdb, 0x62, 0x83, 0xd3, 0x68, + 0x55, 0x25, 0xba, 0x86, 0x7f, 0x1d, 0xd0, 0xb9, 0x64, 0x37, 0xf0, 0xcd, 0xc1, 0x29, 0x8e, 0x27, + 0xd3, 0x7e, 0x7b, 0x3d, 0x71, 0x69, 0x65, 0x60, 0xad, 0xbc, 0x80, 0xcf, 0xeb, 0xac, 0x90, 0x4a, + 0xa8, 0xd1, 0xaa, 0x8a, 0x7f, 0x3d, 0xfc, 0xf0, 0x67, 0xeb, 0x3a, 0x9b, 0xad, 0xeb, 0x9c, 0x6c, + 0x5d, 0xe7, 0xe7, 0xce, 0x6d, 0x6c, 0x76, 0x6e, 0xe3, 0xff, 0xce, 0x6d, 0x7c, 0x45, 0x31, 0x37, + 0x2c, 0x8f, 0x7c, 0x22, 0xd3, 0x73, 0x20, 0x61, 0x98, 0x8b, 0x8a, 0xfe, 0xad, 0xe2, 0x9b, 0xa5, + 0xa2, 0x3a, 0xba, 0x67, 0x1f, 0xc9, 0xe0, 0x2c, 0x00, 0x00, 0xff, 0xff, 0xf9, 0x12, 0xa1, 0x9a, + 0x78, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -356,11 +270,11 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) - // EndedEpochBtcHeight returns the BTC light client height at provided epoch finish + // EndedEpochBtcHeight returns the BTC light client height at provided epoch + // finish EndedEpochBtcHeight(ctx context.Context, in *QueryEndedEpochBtcHeightRequest, opts ...grpc.CallOption) (*QueryEndedEpochBtcHeightResponse, error) - // ReportedCheckpointBtcHeight returns the BTC light client height at which the checkpoint with the given hash is reported back to Babylon + // ReportedCheckpointBtcHeight returns the BTC light client height at which + // the checkpoint with the given hash is reported back to Babylon ReportedCheckpointBtcHeight(ctx context.Context, in *QueryReportedCheckpointBtcHeightRequest, opts ...grpc.CallOption) (*QueryReportedCheckpointBtcHeightResponse, error) } @@ -372,15 +286,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/babylon.monitor.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) EndedEpochBtcHeight(ctx context.Context, in *QueryEndedEpochBtcHeightRequest, opts ...grpc.CallOption) (*QueryEndedEpochBtcHeightResponse, error) { out := new(QueryEndedEpochBtcHeightResponse) err := c.cc.Invoke(ctx, "/babylon.monitor.v1.Query/EndedEpochBtcHeight", in, out, opts...) @@ -401,11 +306,11 @@ func (c *queryClient) ReportedCheckpointBtcHeight(ctx context.Context, in *Query // QueryServer is the server API for Query service. type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) - // EndedEpochBtcHeight returns the BTC light client height at provided epoch finish + // EndedEpochBtcHeight returns the BTC light client height at provided epoch + // finish EndedEpochBtcHeight(context.Context, *QueryEndedEpochBtcHeightRequest) (*QueryEndedEpochBtcHeightResponse, error) - // ReportedCheckpointBtcHeight returns the BTC light client height at which the checkpoint with the given hash is reported back to Babylon + // ReportedCheckpointBtcHeight returns the BTC light client height at which + // the checkpoint with the given hash is reported back to Babylon ReportedCheckpointBtcHeight(context.Context, *QueryReportedCheckpointBtcHeightRequest) (*QueryReportedCheckpointBtcHeightResponse, error) } @@ -413,9 +318,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func (*UnimplementedQueryServer) EndedEpochBtcHeight(ctx context.Context, req *QueryEndedEpochBtcHeightRequest) (*QueryEndedEpochBtcHeightResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EndedEpochBtcHeight not implemented") } @@ -427,24 +329,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/babylon.monitor.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_EndedEpochBtcHeight_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryEndedEpochBtcHeightRequest) if err := dec(in); err != nil { @@ -485,10 +369,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.monitor.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, { MethodName: "EndedEpochBtcHeight", Handler: _Query_EndedEpochBtcHeight_Handler, @@ -499,63 +379,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/monitor/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + Metadata: "babylon/monitor/v1/query.proto", } func (m *QueryEndedEpochBtcHeightRequest) Marshal() (dAtA []byte, err error) { @@ -683,26 +507,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryEndedEpochBtcHeightRequest) Size() (n int) { if m == nil { return 0 @@ -758,139 +562,6 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryEndedEpochBtcHeightRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/monitor/types/query.pb.gw.go b/x/monitor/types/query.pb.gw.go index a750169ed..37dfc78f3 100644 --- a/x/monitor/types/query.pb.gw.go +++ b/x/monitor/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: babylon/monitor/query.proto +// source: babylon/monitor/v1/query.proto /* Package types is a reverse proxy. @@ -33,24 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_EndedEpochBtcHeight_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryEndedEpochBtcHeightRequest var metadata runtime.ServerMetadata @@ -165,29 +147,6 @@ func local_request_Query_ReportedCheckpointBtcHeight_0(ctx context.Context, mars // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_EndedEpochBtcHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -275,26 +234,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_EndedEpochBtcHeight_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -339,16 +278,12 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "monitor", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_EndedEpochBtcHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "monitor", "v1", "epochs", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ReportedCheckpointBtcHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "monitor", "v1", "checkpoints", "ckpt_hash"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_EndedEpochBtcHeight_0 = runtime.ForwardResponseMessage forward_Query_ReportedCheckpointBtcHeight_0 = runtime.ForwardResponseMessage diff --git a/x/zoneconcierge/abci.go b/x/zoneconcierge/abci.go index e478d0a0e..365c01ce7 100644 --- a/x/zoneconcierge/abci.go +++ b/x/zoneconcierge/abci.go @@ -5,9 +5,9 @@ import ( "github.com/babylonchain/babylon/x/zoneconcierge/keeper" "github.com/babylonchain/babylon/x/zoneconcierge/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - abci "github.com/tendermint/tendermint/abci/types" ) // BeginBlocker sends a pending packet for every channel upon each new block, diff --git a/x/zoneconcierge/client/cli/query.go b/x/zoneconcierge/client/cli/query.go index 5ab8f5dfc..270ad106e 100644 --- a/x/zoneconcierge/client/cli/query.go +++ b/x/zoneconcierge/client/cli/query.go @@ -2,13 +2,12 @@ package cli import ( "fmt" - // "strings" + "strconv" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" "github.com/babylonchain/babylon/x/zoneconcierge/types" ) @@ -24,7 +23,79 @@ func GetQueryCmd(queryRoute string) *cobra.Command { RunE: client.ValidateCmd, } - cmd.AddCommand(CmdQueryParams()) + cmd.AddCommand(CmdChainsInfo()) + cmd.AddCommand(CmdFinalizedChainsInfo()) + cmd.AddCommand(CmdEpochChainsInfoInfo()) + return cmd +} + +func CmdChainsInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "chains-info ", + Short: "retrieve the latest info for a given list of chains", + Args: cobra.ArbitraryArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + req := types.QueryChainsInfoRequest{ChainIds: args} + resp, err := queryClient.ChainsInfo(cmd.Context(), &req) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func CmdFinalizedChainsInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "finalized-chains-info ", + Short: "retrieve the finalized info for a given list of chains", + Args: cobra.ArbitraryArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + req := types.QueryFinalizedChainsInfoRequest{ChainIds: args} + resp, err := queryClient.FinalizedChainsInfo(cmd.Context(), &req) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func CmdEpochChainsInfoInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "epoch-chains-info ", + Short: "retrieve the latest info for a list of chains in a given epoch", + Args: cobra.MinimumNArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + queryClient := types.NewQueryClient(clientCtx) + + epoch, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return err + } + req := types.QueryEpochChainsInfoRequest{EpochNum: epoch, ChainIds: args[1:]} + resp, err := queryClient.EpochChainsInfo(cmd.Context(), &req) + if err != nil { + return err + } + + return clientCtx.PrintProto(resp) + }, + } + flags.AddQueryFlagsToCmd(cmd) return cmd } diff --git a/x/zoneconcierge/client/cli/query_params.go b/x/zoneconcierge/client/cli/query_params.go deleted file mode 100644 index e1faa4fc2..000000000 --- a/x/zoneconcierge/client/cli/query_params.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "context" - - "github.com/babylonchain/babylon/x/zoneconcierge/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/zoneconcierge/extended-client-keeper/hooks.go b/x/zoneconcierge/extended-client-keeper/hooks.go new file mode 100644 index 000000000..9c0367277 --- /dev/null +++ b/x/zoneconcierge/extended-client-keeper/hooks.go @@ -0,0 +1,42 @@ +package extended_client_keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// ClientHooks defines the hook interface for client +type ClientHooks interface { + AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header *HeaderInfo, isOnFork bool) +} + +type HeaderInfo struct { + Hash []byte + ChaindId string + Height uint64 +} + +// MultiClientHooks is a concrete implementation of ClientHooks +// It allows other modules to hook onto client ExtendedKeeper +var _ ClientHooks = &MultiClientHooks{} + +type MultiClientHooks []ClientHooks + +func NewMultiClientHooks(hooks ...ClientHooks) MultiClientHooks { + return hooks +} + +// invoke hooks in each keeper that hooks onto ExtendedKeeper +func (h MultiClientHooks) AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header *HeaderInfo, isOnFork bool) { + for i := range h { + h[i].AfterHeaderWithValidCommit(ctx, txHash, header, isOnFork) + } +} + +// ensure ExtendedKeeper implements ClientHooks interfaces +var _ ClientHooks = ExtendedKeeper{} + +func (ek ExtendedKeeper) AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header *HeaderInfo, isOnFork bool) { + if ek.hooks != nil { + ek.hooks.AfterHeaderWithValidCommit(ctx, txHash, header, isOnFork) + } +} diff --git a/x/zoneconcierge/extended-client-keeper/keeper.go b/x/zoneconcierge/extended-client-keeper/keeper.go new file mode 100644 index 000000000..4c59119e9 --- /dev/null +++ b/x/zoneconcierge/extended-client-keeper/keeper.go @@ -0,0 +1,149 @@ +package extended_client_keeper + +import ( + sdkerrors "cosmossdk.io/errors" + metrics "github.com/armon/go-metrics" + "github.com/cometbft/cometbft/crypto/tmhash" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" +) + +// ExtendedKeeper is same as the original clientkeeper.Keeper, except that +// - it provides hooks for notifying other modules on received headers +// - it applies different verification rules on received headers +// (notably, intercepting headers rather than freezing clients upon errors that indicate dishonest majority) +type ExtendedKeeper struct { + clientkeeper.Keeper + cdc codec.BinaryCodec // since some code needs to use k.cdc + hooks ClientHooks +} + +// GetHeaderInfo returns the information necessary for header timestamping or nil +// if provided message is not a header +func GetHeaderInfo(ctx sdk.Context, m exported.ClientMessage) *HeaderInfo { + switch msg := m.(type) { + case *ibctmtypes.Header: + return &HeaderInfo{ + Hash: msg.Header.LastCommitHash, + ChaindId: msg.Header.ChainID, + Height: uint64(msg.Header.Height), + } + default: + return nil + } +} + +// NewExtendedKeeper creates a new NewExtendedKeeper instance +func NewExtendedKeeper(cdc codec.BinaryCodec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, sk types.StakingKeeper, uk types.UpgradeKeeper) ExtendedKeeper { + // set KeyTable if it has not already been set + if !paramSpace.HasKeyTable() { + paramSpace = paramSpace.WithKeyTable(types.ParamKeyTable()) + } + + k := clientkeeper.NewKeeper(cdc, key, paramSpace, sk, uk) + return ExtendedKeeper{ + Keeper: k, + cdc: cdc, + hooks: nil, + } +} + +// SetHooks sets the hooks for ExtendedKeeper +func (ek *ExtendedKeeper) SetHooks(ch ClientHooks) *ExtendedKeeper { + if ek.hooks != nil { + panic("cannot set hooks twice") + } + ek.hooks = ch + + return ek +} + +// UpdateClient updates the consensus state and the state root from a provided header. +// The implementation is the same as the original IBC-Go implementation, except from: +// 1. Not freezing the client when finding a misbehaviour for header message +// 2. Calling a AfterHeaderWithValidCommit callback when receiving valid header messages (either misbehaving or not) +func (k ExtendedKeeper) UpdateClient(ctx sdk.Context, clientID string, clientMsg exported.ClientMessage) error { + // In case of nil message nothing changes in comparison to the original IBC-Go implementation + if clientMsg == nil { + return k.Keeper.UpdateClient(ctx, clientID, clientMsg) + } + + clientState, found := k.GetClientState(ctx, clientID) + if !found { + return sdkerrors.Wrapf(types.ErrClientNotFound, "cannot update client with ID %s", clientID) + } + + clientStore := k.ClientStore(ctx, clientID) + + if status := clientState.Status(ctx, clientStore, k.cdc); status != exported.Active { + return sdkerrors.Wrapf(types.ErrClientNotActive, "cannot update client (%s) with status %s", clientID, status) + } + + if err := clientState.VerifyClientMessage(ctx, k.cdc, clientStore, clientMsg); err != nil { + return err + } + + foundMisbehaviour := clientState.CheckForMisbehaviour(ctx, k.cdc, clientStore, clientMsg) + + headerInfo := GetHeaderInfo(ctx, clientMsg) + + // found misbehaviour and it was not an header, freeze client + if foundMisbehaviour && headerInfo == nil { + clientState.UpdateStateOnMisbehaviour(ctx, k.cdc, clientStore, clientMsg) + + k.Logger(ctx).Info("client frozen due to misbehaviour", "client-id", clientID) + + defer telemetry.IncrCounterWithLabels( + []string{"ibc", "client", "misbehaviour"}, + 1, + []metrics.Label{ + telemetry.NewLabel(types.LabelClientType, clientState.ClientType()), + telemetry.NewLabel(types.LabelClientID, clientID), + telemetry.NewLabel(types.LabelMsgType, "update"), + }, + ) + + clientkeeper.EmitSubmitMisbehaviourEvent(ctx, clientID, clientState) + + return nil + } else if foundMisbehaviour && headerInfo != nil { + // found misbehaviour and it was an header, this is most probably means + // conflicting headers misbehaviour. + ctx.Logger().Debug("received a header that has QC but is on a fork") + txHash := tmhash.Sum(ctx.TxBytes()) + k.AfterHeaderWithValidCommit(ctx, txHash, headerInfo, true) + return nil + } + + // there was no misbehaviour and we receivied an header, call the callback + if headerInfo != nil { + txHash := tmhash.Sum(ctx.TxBytes()) // get hash of the tx that includes this header + k.AfterHeaderWithValidCommit(ctx, txHash, headerInfo, false) + } + + consensusHeights := clientState.UpdateState(ctx, k.cdc, clientStore, clientMsg) + + k.Logger(ctx).Info("client state updated", "client-id", clientID, "heights", consensusHeights) + + defer telemetry.IncrCounterWithLabels( + []string{"ibc", "client", "update"}, + 1, + []metrics.Label{ + telemetry.NewLabel(types.LabelClientType, clientState.ClientType()), + telemetry.NewLabel(types.LabelClientID, clientID), + telemetry.NewLabel(types.LabelUpdateType, "msg"), + }, + ) + + // emitting events in the keeper emits for both begin block and handler client updates + clientkeeper.EmitUpdateClientEvent(ctx, clientID, clientState.ClientType(), consensusHeights, k.cdc, clientMsg) + + return nil +} diff --git a/x/zoneconcierge/genesis.go b/x/zoneconcierge/genesis.go index ef412bd4b..fb3758b66 100644 --- a/x/zoneconcierge/genesis.go +++ b/x/zoneconcierge/genesis.go @@ -19,15 +19,11 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) panic("could not claim port capability: " + err.Error()) } } - k.SetParams(ctx, genState.Params) } // ExportGenesis returns the module's exported genesis func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) - genesis.PortId = k.GetPort(ctx) - return genesis } diff --git a/x/zoneconcierge/genesis_test.go b/x/zoneconcierge/genesis_test.go index c1b5f624c..731765ab6 100644 --- a/x/zoneconcierge/genesis_test.go +++ b/x/zoneconcierge/genesis_test.go @@ -12,7 +12,6 @@ import ( func TestGenesis(t *testing.T) { genesisState := types.GenesisState{ - Params: types.DefaultParams(), PortId: types.PortID, } @@ -25,5 +24,4 @@ func TestGenesis(t *testing.T) { nullify.Fill(got) require.Equal(t, genesisState.PortId, got.PortId) - } diff --git a/x/zoneconcierge/keeper/canonical_chain_indexer_test.go b/x/zoneconcierge/keeper/canonical_chain_indexer_test.go index 4248fb530..365854120 100644 --- a/x/zoneconcierge/keeper/canonical_chain_indexer_test.go +++ b/x/zoneconcierge/keeper/canonical_chain_indexer_test.go @@ -12,7 +12,7 @@ func FuzzCanonicalChainIndexer(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -21,8 +21,8 @@ func FuzzCanonicalChainIndexer(f *testing.F) { hooks := zcKeeper.Hooks() // simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 1 - headers := SimulateHeadersViaHook(ctx, hooks, czChain.ChainID, 0, numHeaders) + numHeaders := datagen.RandomInt(r, 100) + 1 + headers := SimulateHeadersViaHook(ctx, r, hooks, czChain.ChainID, 0, numHeaders) // check if the canonical chain index is correct or not for i := uint64(0); i < numHeaders; i++ { @@ -48,7 +48,7 @@ func FuzzFindClosestHeader(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -61,22 +61,22 @@ func FuzzFindClosestHeader(f *testing.F) { require.Error(t, err) // simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 1 - headers := SimulateHeadersViaHook(ctx, hooks, czChain.ChainID, 0, numHeaders) + numHeaders := datagen.RandomInt(r, 100) + 1 + headers := SimulateHeadersViaHook(ctx, r, hooks, czChain.ChainID, 0, numHeaders) header, err := zcKeeper.FindClosestHeader(ctx, czChain.ChainID, numHeaders) require.NoError(t, err) require.Equal(t, headers[len(headers)-1].Header.LastCommitHash, header.Hash) // skip a non-zero number of headers in between, in order to create a gap of non-timestamped headers - gap := datagen.RandomInt(10) + 1 + gap := datagen.RandomInt(r, 10) + 1 // simulate a random number of blocks // where the new batch of headers has a gap with the previous batch - SimulateHeadersViaHook(ctx, hooks, czChain.ChainID, numHeaders+gap+1, numHeaders) + SimulateHeadersViaHook(ctx, r, hooks, czChain.ChainID, numHeaders+gap+1, numHeaders) // get a random height that is in this gap - randomHeightInGap := datagen.RandomInt(int(gap+1)) + numHeaders + randomHeightInGap := datagen.RandomInt(r, int(gap+1)) + numHeaders // find the closest header with the given randomHeightInGap header, err = zcKeeper.FindClosestHeader(ctx, czChain.ChainID, randomHeightInGap) require.NoError(t, err) diff --git a/x/zoneconcierge/keeper/chain_info_indexer.go b/x/zoneconcierge/keeper/chain_info_indexer.go index b85462fe2..cd71c2904 100644 --- a/x/zoneconcierge/keeper/chain_info_indexer.go +++ b/x/zoneconcierge/keeper/chain_info_indexer.go @@ -3,10 +3,11 @@ package keeper import ( "fmt" - sdkerrors "cosmossdk.io/errors" - "github.com/babylonchain/babylon/x/zoneconcierge/types" + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/babylonchain/babylon/x/zoneconcierge/types" ) func (k Keeper) setChainInfo(ctx sdk.Context, chainInfo *types.ChainInfo) { @@ -20,7 +21,7 @@ func (k Keeper) InitChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo } // ensure chain info has not been initialised yet if k.HasChainInfo(ctx, chainID) { - return nil, sdkerrors.Wrapf(types.ErrInvalidChainInfo, "chain info has already initialized") + return nil, errorsmod.Wrapf(types.ErrInvalidChainInfo, "chain info has already initialized") } chainInfo := &types.ChainInfo{ @@ -48,11 +49,11 @@ func (k Keeper) HasChainInfo(ctx sdk.Context, chainID string) bool { // Since IBC does not provide API that allows to initialise chain info right before creating an IBC connection, // we can only check its existence every time, and return an empty one if it's not initialised yet. func (k Keeper) GetChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo, error) { - store := k.chainInfoStore(ctx) - - if !store.Has([]byte(chainID)) { - return nil, types.ErrEpochChainInfoNotFound + if !k.HasChainInfo(ctx, chainID) { + return nil, types.ErrChainInfoNotFound } + + store := k.chainInfoStore(ctx) chainInfoBytes := store.Get([]byte(chainID)) var chainInfo types.ChainInfo k.cdc.MustUnmarshal(chainInfoBytes, &chainInfo) @@ -67,7 +68,7 @@ func (k Keeper) GetChainInfo(ctx sdk.Context, chainID string) (*types.ChainInfo, // equal to the total number of headers in CZ. func (k Keeper) updateLatestHeader(ctx sdk.Context, chainID string, header *types.IndexedHeader) error { if header == nil { - return sdkerrors.Wrapf(types.ErrInvalidHeader, "header is nil") + return errorsmod.Wrapf(types.ErrInvalidHeader, "header is nil") } chainInfo, err := k.GetChainInfo(ctx, chainID) if err != nil { @@ -88,12 +89,12 @@ func (k Keeper) updateLatestHeader(ctx sdk.Context, chainID string, header *type // - If this fork header is older than the current latest fork, ignore func (k Keeper) tryToUpdateLatestForkHeader(ctx sdk.Context, chainID string, header *types.IndexedHeader) error { if header == nil { - return sdkerrors.Wrapf(types.ErrInvalidHeader, "header is nil") + return errorsmod.Wrapf(types.ErrInvalidHeader, "header is nil") } chainInfo, err := k.GetChainInfo(ctx, chainID) if err != nil { - return sdkerrors.Wrapf(types.ErrChainInfoNotFound, "cannot insert fork header when chain info is not initialized") + return errorsmod.Wrapf(types.ErrChainInfoNotFound, "cannot insert fork header when chain info is not initialized") } if len(chainInfo.LatestForks.Headers) == 0 { diff --git a/x/zoneconcierge/keeper/epoch_chain_info_indexer.go b/x/zoneconcierge/keeper/epoch_chain_info_indexer.go index f9d92e628..286c36c1e 100644 --- a/x/zoneconcierge/keeper/epoch_chain_info_indexer.go +++ b/x/zoneconcierge/keeper/epoch_chain_info_indexer.go @@ -1,54 +1,32 @@ package keeper import ( - bbn "github.com/babylonchain/babylon/types" - "github.com/babylonchain/babylon/x/zoneconcierge/types" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + + bbn "github.com/babylonchain/babylon/types" + "github.com/babylonchain/babylon/x/zoneconcierge/types" ) // GetEpochChainInfo gets the latest chain info of a given epoch for a given chain ID func (k Keeper) GetEpochChainInfo(ctx sdk.Context, chainID string, epochNumber uint64) (*types.ChainInfo, error) { - store := k.epochChainInfoStore(ctx, chainID) - epochNumberBytes := sdk.Uint64ToBigEndian(epochNumber) - if !store.Has(epochNumberBytes) { + if !k.EpochChainInfoExists(ctx, chainID, epochNumber) { return nil, types.ErrEpochChainInfoNotFound } + + store := k.epochChainInfoStore(ctx, chainID) + epochNumberBytes := sdk.Uint64ToBigEndian(epochNumber) epochChainInfoBytes := store.Get(epochNumberBytes) var chainInfo types.ChainInfo k.cdc.MustUnmarshal(epochChainInfoBytes, &chainInfo) return &chainInfo, nil } -// GetLastFinalizedChainInfo gets the last finalised chain info recorded for a given chain ID -// and the earliest epoch that snapshots this chain info -func (k Keeper) GetLastFinalizedChainInfo(ctx sdk.Context, chainID string) (uint64, *types.ChainInfo, error) { - // find the last finalised epoch - finalizedEpoch, err := k.GetFinalizedEpoch(ctx) - if err != nil { - return 0, nil, err - } - - // find the chain info of this epoch - chainInfo, err := k.GetEpochChainInfo(ctx, chainID, finalizedEpoch) - if err != nil { - return finalizedEpoch, nil, err - } - - // It's possible that the chain info's epoch is way before the last finalised epoch - // e.g., when there is no relayer for many epochs - // NOTE: if an epoch is finalised then all of its previous epochs are also finalised - if chainInfo.LatestHeader.BabylonEpoch < finalizedEpoch { - // remember the last finalised epoch - finalizedEpoch = chainInfo.LatestHeader.BabylonEpoch - // replace the chain info w.r.t. this last finalised epoch - chainInfo, err = k.GetEpochChainInfo(ctx, chainID, finalizedEpoch) - if err != nil { - return finalizedEpoch, nil, err - } - } - - return finalizedEpoch, chainInfo, nil +// EpochChainInfoExists checks if the latest chain info exists of a given epoch for a given chain ID +func (k Keeper) EpochChainInfoExists(ctx sdk.Context, chainID string, epochNumber uint64) bool { + store := k.epochChainInfoStore(ctx, chainID) + epochNumberBytes := sdk.Uint64ToBigEndian(epochNumber) + return store.Has(epochNumberBytes) } // GetEpochHeaders gets the headers timestamped in a given epoch, in the ascending order diff --git a/x/zoneconcierge/keeper/epoch_chain_info_indexer_test.go b/x/zoneconcierge/keeper/epoch_chain_info_indexer_test.go index 02f8b0606..db7f71cfe 100644 --- a/x/zoneconcierge/keeper/epoch_chain_info_indexer_test.go +++ b/x/zoneconcierge/keeper/epoch_chain_info_indexer_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/babylonchain/babylon/testutil/datagen" - ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" "github.com/stretchr/testify/require" ) @@ -13,7 +13,7 @@ func FuzzEpochChainInfoIndexer(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -23,15 +23,15 @@ func FuzzEpochChainInfoIndexer(f *testing.F) { hooks := zcKeeper.Hooks() // enter a random epoch - epochNum := datagen.RandomInt(10) + epochNum := datagen.RandomInt(r, 10) for j := uint64(0); j < epochNum; j++ { epochingKeeper.IncEpoch(ctx) } // invoke the hook a random number of times to simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 1 - numForkHeaders := datagen.RandomInt(10) + 1 - SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) + numHeaders := datagen.RandomInt(r, 100) + 1 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + SimulateHeadersAndForksViaHook(ctx, r, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) // end this epoch hooks.AfterEpochEnds(ctx, epochNum) @@ -49,7 +49,7 @@ func FuzzGetEpochHeaders(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -58,9 +58,9 @@ func FuzzGetEpochHeaders(f *testing.F) { ctx := babylonChain.GetContext() hooks := zcKeeper.Hooks() - numReqs := datagen.RandomInt(5) + 1 + numReqs := datagen.RandomInt(r, 5) + 1 - epochNumList := []uint64{datagen.RandomInt(10) + 1} + epochNumList := []uint64{datagen.RandomInt(r, 10) + 1} nextHeightList := []uint64{0} numHeadersList := []uint64{} expectedHeadersMap := map[uint64][]*ibctmtypes.Header{} @@ -82,10 +82,10 @@ func FuzzGetEpochHeaders(f *testing.F) { } // generate a random number of headers and fork headers - numHeadersList = append(numHeadersList, datagen.RandomInt(100)+1) - numForkHeadersList = append(numForkHeadersList, datagen.RandomInt(10)+1) + numHeadersList = append(numHeadersList, datagen.RandomInt(r, 100)+1) + numForkHeadersList = append(numForkHeadersList, datagen.RandomInt(r, 10)+1) // trigger hooks to append these headers and fork headers - expectedHeaders, _ := SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, nextHeightList[i], numHeadersList[i], numForkHeadersList[i]) + expectedHeaders, _ := SimulateHeadersAndForksViaHook(ctx, r, hooks, czChain.ChainID, nextHeightList[i], numHeadersList[i], numForkHeadersList[i]) expectedHeadersMap[epochNum] = expectedHeaders // prepare nextHeight for the next request nextHeightList = append(nextHeightList, nextHeightList[i]+numHeadersList[i]) @@ -93,7 +93,7 @@ func FuzzGetEpochHeaders(f *testing.F) { // simulate the scenario that a random epoch has ended hooks.AfterEpochEnds(ctx, epochNum) // prepare epochNum for the next request - epochNumList = append(epochNumList, epochNum+datagen.RandomInt(10)+1) + epochNumList = append(epochNumList, epochNum+datagen.RandomInt(r, 10)+1) } // attest the correctness of epoch info for each tested epoch diff --git a/x/zoneconcierge/keeper/fork_indexer_test.go b/x/zoneconcierge/keeper/fork_indexer_test.go index b6a8a28f4..769df4db5 100644 --- a/x/zoneconcierge/keeper/fork_indexer_test.go +++ b/x/zoneconcierge/keeper/fork_indexer_test.go @@ -12,7 +12,7 @@ func FuzzForkIndexer(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -21,9 +21,9 @@ func FuzzForkIndexer(f *testing.F) { hooks := zcKeeper.Hooks() // invoke the hook a random number of times to simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 1 - numForkHeaders := datagen.RandomInt(10) + 1 - _, forkHeaders := SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) + numHeaders := datagen.RandomInt(r, 100) + 1 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + _, forkHeaders := SimulateHeadersAndForksViaHook(ctx, r, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) // check if the fork is updated or not forks := zcKeeper.GetForks(ctx, czChain.ChainID, numHeaders-1) diff --git a/x/zoneconcierge/keeper/grpc_query.go b/x/zoneconcierge/keeper/grpc_query.go index e1aac72ff..191f59f32 100644 --- a/x/zoneconcierge/keeper/grpc_query.go +++ b/x/zoneconcierge/keeper/grpc_query.go @@ -3,15 +3,20 @@ package keeper import ( "context" - "github.com/babylonchain/babylon/x/zoneconcierge/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" + + bbntypes "github.com/babylonchain/babylon/types" + + "github.com/babylonchain/babylon/x/zoneconcierge/types" ) var _ types.QueryServer = Keeper{} +const maxQueryChainsInfoLimit = 100 + func (k Keeper) ChainList(c context.Context, req *types.QueryChainListRequest) (*types.QueryChainListResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") @@ -37,24 +42,39 @@ func (k Keeper) ChainList(c context.Context, req *types.QueryChainListRequest) ( return resp, nil } -// ChainInfo returns the latest info of a chain with given ID -func (k Keeper) ChainInfo(c context.Context, req *types.QueryChainInfoRequest) (*types.QueryChainInfoResponse, error) { +// ChainsInfo returns the latest info for a given list of chains +func (k Keeper) ChainsInfo(c context.Context, req *types.QueryChainsInfoRequest) (*types.QueryChainsInfoResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - if len(req.ChainId) == 0 { - return nil, status.Error(codes.InvalidArgument, "chain ID cannot be empty") + // return if no chain IDs are provided + if len(req.ChainIds) == 0 { + return nil, status.Error(codes.InvalidArgument, "chain IDs cannot be empty") + } + + // return if chain IDs exceed the limit + if len(req.ChainIds) > maxQueryChainsInfoLimit { + return nil, status.Errorf(codes.InvalidArgument, "cannot query more than %d chains", maxQueryChainsInfoLimit) + } + + // return if chain IDs contain duplicates or empty strings + if err := bbntypes.CheckForDuplicatesAndEmptyStrings(req.ChainIds); err != nil { + return nil, status.Error(codes.InvalidArgument, types.ErrInvalidChainIDs.Wrap(err.Error()).Error()) } ctx := sdk.UnwrapSDKContext(c) + var chainsInfo []*types.ChainInfo + for _, chainID := range req.ChainIds { + chainInfo, err := k.GetChainInfo(ctx, chainID) + if err != nil { + return nil, err + } - // find the chain info of this epoch - chainInfo, err := k.GetChainInfo(ctx, req.ChainId) - if err != nil { - return nil, err + chainsInfo = append(chainsInfo, chainInfo) } - resp := &types.QueryChainInfoResponse{ChainInfo: chainInfo} + + resp := &types.QueryChainsInfoResponse{ChainsInfo: chainsInfo} return resp, nil } @@ -83,24 +103,51 @@ func (k Keeper) Header(c context.Context, req *types.QueryHeaderRequest) (*types return resp, nil } -// EpochChainInfo returns the info of a chain with given ID in a given epoch -func (k Keeper) EpochChainInfo(c context.Context, req *types.QueryEpochChainInfoRequest) (*types.QueryEpochChainInfoResponse, error) { +// EpochChainsInfo returns the latest info for list of chains in a given epoch +func (k Keeper) EpochChainsInfo(c context.Context, req *types.QueryEpochChainsInfoRequest) (*types.QueryEpochChainsInfoResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - if len(req.ChainId) == 0 { - return nil, status.Error(codes.InvalidArgument, "chain ID cannot be empty") + // return if no chain IDs are provided + if len(req.ChainIds) == 0 { + return nil, status.Error(codes.InvalidArgument, "chain IDs cannot be empty") + } + + // return if chain IDs exceed the limit + if len(req.ChainIds) > maxQueryChainsInfoLimit { + return nil, status.Errorf(codes.InvalidArgument, "cannot query more than %d chains", maxQueryChainsInfoLimit) + } + + // return if chain IDs contain duplicates or empty strings + if err := bbntypes.CheckForDuplicatesAndEmptyStrings(req.ChainIds); err != nil { + return nil, status.Error(codes.InvalidArgument, types.ErrInvalidChainIDs.Wrap(err.Error()).Error()) } ctx := sdk.UnwrapSDKContext(c) + var chainsInfo []*types.ChainInfo + for _, chainID := range req.ChainIds { + // check if chain ID is valid + if !k.HasChainInfo(ctx, chainID) { + return nil, status.Error(codes.InvalidArgument, types.ErrChainInfoNotFound.Wrapf("chain ID %s", chainID).Error()) + } - // find the chain info of the given epoch - chainInfo, err := k.GetEpochChainInfo(ctx, req.ChainId, req.EpochNum) - if err != nil { - return nil, err + // if the chain info is not found in the given epoch, return with empty fields + if !k.EpochChainInfoExists(ctx, chainID, req.EpochNum) { + chainsInfo = append(chainsInfo, &types.ChainInfo{ChainId: chainID}) + continue + } + + // find the chain info of the given epoch + chainInfo, err := k.GetEpochChainInfo(ctx, chainID, req.EpochNum) + if err != nil { + return nil, err + } + + chainsInfo = append(chainsInfo, chainInfo) } - resp := &types.QueryEpochChainInfoResponse{ChainInfo: chainInfo} + + resp := &types.QueryEpochChainsInfoResponse{ChainsInfo: chainsInfo} return resp, nil } @@ -159,54 +206,95 @@ func (k Keeper) ListEpochHeaders(c context.Context, req *types.QueryListEpochHea return resp, nil } -func (k Keeper) FinalizedChainInfo(c context.Context, req *types.QueryFinalizedChainInfoRequest) (*types.QueryFinalizedChainInfoResponse, error) { +// FinalizedChainsInfo returns the finalized info for a given list of chains +func (k Keeper) FinalizedChainsInfo(c context.Context, req *types.QueryFinalizedChainsInfoRequest) (*types.QueryFinalizedChainsInfoResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } - if len(req.ChainId) == 0 { + // return if no chain IDs are provided + if len(req.ChainIds) == 0 { return nil, status.Error(codes.InvalidArgument, "chain ID cannot be empty") } - ctx := sdk.UnwrapSDKContext(c) - resp := &types.QueryFinalizedChainInfoResponse{} - - // find the last finalised chain info and the earliest epoch that snapshots this chain info - finalizedEpoch, chainInfo, err := k.GetLastFinalizedChainInfo(ctx, req.ChainId) - if err != nil { - return nil, err + // return if chain IDs exceed the limit + if len(req.ChainIds) > maxQueryChainsInfoLimit { + return nil, status.Errorf(codes.InvalidArgument, "cannot query more than %d chains", maxQueryChainsInfoLimit) } - resp.FinalizedChainInfo = chainInfo - // find the epoch metadata of the finalised epoch - resp.EpochInfo, err = k.epochingKeeper.GetHistoricalEpoch(ctx, finalizedEpoch) - if err != nil { - return nil, err + // return if chain IDs contain duplicates or empty strings + if err := bbntypes.CheckForDuplicatesAndEmptyStrings(req.ChainIds); err != nil { + return nil, status.Error(codes.InvalidArgument, types.ErrInvalidChainIDs.Wrap(err.Error()).Error()) } - rawCheckpoint, err := k.checkpointingKeeper.GetRawCheckpoint(ctx, finalizedEpoch) + ctx := sdk.UnwrapSDKContext(c) + resp := &types.QueryFinalizedChainsInfoResponse{FinalizedChainsInfo: []*types.FinalizedChainInfo{}} + // find the last finalised epoch + lastFinalizedEpoch, err := k.GetFinalizedEpoch(ctx) if err != nil { return nil, err } - resp.RawCheckpoint = rawCheckpoint.Ckpt + for _, chainID := range req.ChainIds { + // check if chain ID is valid + if !k.HasChainInfo(ctx, chainID) { + return nil, status.Error(codes.InvalidArgument, types.ErrChainInfoNotFound.Wrapf("chain ID %s", chainID).Error()) + } - // find the raw checkpoint and the best submission key for the finalised epoch - _, resp.BtcSubmissionKey, err = k.btccKeeper.GetBestSubmission(ctx, finalizedEpoch) - if err != nil { - return nil, err - } + data := &types.FinalizedChainInfo{ChainId: chainID} - // if the query does not want the proofs, return here - if !req.Prove { - return resp, nil - } + // if the chain info is not found in the last finalised epoch, return with empty fields + if !k.EpochChainInfoExists(ctx, chainID, lastFinalizedEpoch) { + resp.FinalizedChainsInfo = append(resp.FinalizedChainsInfo, data) + continue + } - // generate all proofs - resp.Proof, err = k.proveFinalizedChainInfo(ctx, chainInfo, resp.EpochInfo, resp.BtcSubmissionKey) - if err != nil { - return nil, err + // find the chain info in the last finalised epoch + chainInfo, err := k.GetEpochChainInfo(ctx, chainID, lastFinalizedEpoch) + if err != nil { + return nil, err + } + + // set finalizedEpoch as the earliest epoch that snapshots this chain info. + // it's possible that the chain info's epoch is way before the last finalised epoch + // e.g., when there is no relayer for many epochs + // NOTE: if an epoch is finalised then all of its previous epochs are also finalised + finalizedEpoch := lastFinalizedEpoch + if chainInfo.LatestHeader.BabylonEpoch < finalizedEpoch { + finalizedEpoch = chainInfo.LatestHeader.BabylonEpoch + } + + data.FinalizedChainInfo = chainInfo + + // find the epoch metadata of the finalised epoch + data.EpochInfo, err = k.epochingKeeper.GetHistoricalEpoch(ctx, finalizedEpoch) + if err != nil { + return nil, err + } + + rawCheckpoint, err := k.checkpointingKeeper.GetRawCheckpoint(ctx, finalizedEpoch) + if err != nil { + return nil, err + } + + data.RawCheckpoint = rawCheckpoint.Ckpt + + // find the raw checkpoint and the best submission key for the finalised epoch + _, data.BtcSubmissionKey, err = k.btccKeeper.GetBestSubmission(ctx, finalizedEpoch) + if err != nil { + return nil, err + } + + // generate all proofs + if req.Prove { + data.Proof, err = k.proveFinalizedChainInfo(ctx, chainInfo, data.EpochInfo, data.BtcSubmissionKey) + if err != nil { + return nil, err + } + } + + resp.FinalizedChainsInfo = append(resp.FinalizedChainsInfo, data) } return resp, nil @@ -224,11 +312,27 @@ func (k Keeper) FinalizedChainInfoUntilHeight(c context.Context, req *types.Quer ctx := sdk.UnwrapSDKContext(c) resp := &types.QueryFinalizedChainInfoUntilHeightResponse{} - // find and assign the last finalised chain info and the earliest epoch that snapshots this chain info - finalizedEpoch, chainInfo, err := k.GetLastFinalizedChainInfo(ctx, req.ChainId) + // find the last finalised epoch + lastFinalizedEpoch, err := k.GetFinalizedEpoch(ctx) + if err != nil { + return nil, err + } + + // find the chain info in the last finalised epoch + chainInfo, err := k.GetEpochChainInfo(ctx, req.ChainId, lastFinalizedEpoch) if err != nil { return nil, err } + + // set finalizedEpoch as the earliest epoch that snapshots this chain info. + // it's possible that the chain info's epoch is way before the last finalised epoch + // e.g., when there is no relayer for many epochs + // NOTE: if an epoch is finalised then all of its previous epochs are also finalised + finalizedEpoch := lastFinalizedEpoch + if chainInfo.LatestHeader.BabylonEpoch < finalizedEpoch { + finalizedEpoch = chainInfo.LatestHeader.BabylonEpoch + } + resp.FinalizedChainInfo = chainInfo if chainInfo.LatestHeader.Height <= req.Height { // the requested height is after the last finalised chain info diff --git a/x/zoneconcierge/keeper/grpc_query_params.go b/x/zoneconcierge/keeper/grpc_query_params.go deleted file mode 100644 index 2e76d1b4e..000000000 --- a/x/zoneconcierge/keeper/grpc_query_params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/babylonchain/babylon/x/zoneconcierge/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - - return &types.QueryParamsResponse{Params: k.GetParams(ctx)}, nil -} diff --git a/x/zoneconcierge/keeper/grpc_query_params_test.go b/x/zoneconcierge/keeper/grpc_query_params_test.go deleted file mode 100644 index 8aeb30bd4..000000000 --- a/x/zoneconcierge/keeper/grpc_query_params_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package keeper_test - -import ( - "testing" - - testkeeper "github.com/babylonchain/babylon/testutil/keeper" - "github.com/babylonchain/babylon/x/zoneconcierge/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.ZoneConciergeKeeper(t, nil, nil, nil, nil) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/zoneconcierge/keeper/grpc_query_test.go b/x/zoneconcierge/keeper/grpc_query_test.go index cb910ebfa..08ad7f6cf 100644 --- a/x/zoneconcierge/keeper/grpc_query_test.go +++ b/x/zoneconcierge/keeper/grpc_query_test.go @@ -4,25 +4,33 @@ import ( "math/rand" "testing" + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + tmrpctypes "github.com/cometbft/cometbft/rpc/core/types" + tmtypes "github.com/cometbft/cometbft/types" + "github.com/cosmos/cosmos-sdk/types/query" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + "github.com/golang/mock/gomock" + "github.com/stretchr/testify/require" + "github.com/babylonchain/babylon/testutil/datagen" testkeeper "github.com/babylonchain/babylon/testutil/keeper" btcctypes "github.com/babylonchain/babylon/x/btccheckpoint/types" checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" zctypes "github.com/babylonchain/babylon/x/zoneconcierge/types" - "github.com/cosmos/cosmos-sdk/types/query" - ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - tmrpctypes "github.com/tendermint/tendermint/rpc/core/types" - tmtypes "github.com/tendermint/tendermint/types" ) +type chainInfo struct { + chainID string + numHeaders uint64 + numForkHeaders uint64 + headerStartHeight uint64 +} + func FuzzChainList(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, _, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -31,22 +39,22 @@ func FuzzChainList(f *testing.F) { hooks := zcKeeper.Hooks() // invoke the hook a random number of times with random chain IDs - numHeaders := datagen.RandomInt(100) + 1 + numHeaders := datagen.RandomInt(r, 100) + 1 allChainIDs := []string{} for i := uint64(0); i < numHeaders; i++ { var chainID string // simulate the scenario that some headers belong to the same chain - if i > 0 && datagen.OneInN(2) { - chainID = allChainIDs[rand.Intn(len(allChainIDs))] + if i > 0 && datagen.OneInN(r, 2) { + chainID = allChainIDs[r.Intn(len(allChainIDs))] } else { - chainID = datagen.GenRandomHexStr(30) + chainID = datagen.GenRandomHexStr(r, 30) allChainIDs = append(allChainIDs, chainID) } - header := datagen.GenRandomIBCTMHeader(chainID, 0) - hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(32), header, false) + header := datagen.GenRandomIBCTMHeader(r, chainID, 0) + hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), false) } - limit := datagen.RandomInt(len(allChainIDs)) + 1 + limit := datagen.RandomInt(r, len(allChainIDs)) + 1 // make query to get actual chain IDs resp, err := zcKeeper.ChainList(ctx, &zctypes.QueryChainListRequest{ @@ -65,29 +73,47 @@ func FuzzChainList(f *testing.F) { }) } -func FuzzChainInfo(f *testing.F) { +func FuzzChainsInfo(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) - _, babylonChain, czChain, babylonApp := SetupTest(t) + _, babylonChain, _, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper ctx := babylonChain.GetContext() hooks := zcKeeper.Hooks() - // invoke the hook a random number of times to simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 1 - numForkHeaders := datagen.RandomInt(10) + 1 - SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) + var ( + chainsInfo []chainInfo + chainIDs []string + ) + numChains := datagen.RandomInt(r, 100) + 1 + for i := uint64(0); i < numChains; i++ { + chainID := datagen.GenRandomHexStr(r, 30) + numHeaders := datagen.RandomInt(r, 100) + 1 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + SimulateHeadersAndForksViaHook(ctx, r, hooks, chainID, 0, numHeaders, numForkHeaders) + + chainIDs = append(chainIDs, chainID) + chainsInfo = append(chainsInfo, chainInfo{ + chainID: chainID, + numHeaders: numHeaders, + numForkHeaders: numForkHeaders, + }) + } - // check if the chain info of is recorded or not - resp, err := zcKeeper.ChainInfo(ctx, &zctypes.QueryChainInfoRequest{ChainId: czChain.ChainID}) + resp, err := zcKeeper.ChainsInfo(ctx, &zctypes.QueryChainsInfoRequest{ + ChainIds: chainIDs, + }) require.NoError(t, err) - chainInfo := resp.ChainInfo - require.Equal(t, numHeaders-1, chainInfo.LatestHeader.Height) - require.Equal(t, numForkHeaders, uint64(len(chainInfo.LatestForks.Headers))) + + for i, respData := range resp.ChainsInfo { + require.Equal(t, chainsInfo[i].chainID, respData.ChainId) + require.Equal(t, chainsInfo[i].numHeaders-1, respData.LatestHeader.Height) + require.Equal(t, chainsInfo[i].numForkHeaders, uint64(len(respData.LatestForks.Headers))) + } }) } @@ -95,7 +121,7 @@ func FuzzHeader(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -104,12 +130,12 @@ func FuzzHeader(f *testing.F) { hooks := zcKeeper.Hooks() // invoke the hook a random number of times to simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 2 - numForkHeaders := datagen.RandomInt(10) + 1 - headers, forkHeaders := SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) + numHeaders := datagen.RandomInt(r, 100) + 2 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + headers, forkHeaders := SimulateHeadersAndForksViaHook(ctx, r, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) // find header at a random height and assert correctness against the expected header - randomHeight := datagen.RandomInt(int(numHeaders - 1)) + randomHeight := datagen.RandomInt(r, int(numHeaders-1)) resp, err := zcKeeper.Header(ctx, &zctypes.QueryHeaderRequest{ChainId: czChain.ChainID, Height: randomHeight}) require.NoError(t, err) require.Equal(t, headers[randomHeight].Header.LastCommitHash, resp.Header.Hash) @@ -126,50 +152,100 @@ func FuzzHeader(f *testing.F) { }) } -func FuzzEpochChainInfo(f *testing.F) { +func FuzzEpochChainsInfo(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - - _, babylonChain, czChain, babylonApp := SetupTest(t) + r := rand.New(rand.NewSource(seed)) + _, babylonChain, _, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper ctx := babylonChain.GetContext() hooks := zcKeeper.Hooks() - numReqs := datagen.RandomInt(5) + 1 + // generate a random number of chains + numChains := datagen.RandomInt(r, 10) + 1 + var chainIDs []string + for j := uint64(0); j < numChains; j++ { + chainID := datagen.GenRandomHexStr(r, 30) + chainIDs = append(chainIDs, chainID) + } - epochNumList := []uint64{datagen.RandomInt(10) + 1} - nextHeightList := []uint64{0} - numHeadersList := []uint64{} - numForkHeadersList := []uint64{} + // generate a random number of epochNums + totalNumEpochs := datagen.RandomInt(r, 5) + 1 + epochNums := []uint64{datagen.RandomInt(r, 10) + 1} + for i := uint64(1); i < totalNumEpochs; i++ { + nextEpoch := epochNums[i-1] + datagen.RandomInt(r, 10) + 1 + epochNums = append(epochNums, nextEpoch) + } - // we test the scenario of ending an epoch for multiple times, in order to ensure that - // consecutive epoch infos do not affect each other. - for i := uint64(0); i < numReqs; i++ { - // generate a random number of headers and fork headers - numHeadersList = append(numHeadersList, datagen.RandomInt(100)+1) - numForkHeadersList = append(numForkHeadersList, datagen.RandomInt(10)+1) - // trigger hooks to append these headers and fork headers - SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, nextHeightList[i], numHeadersList[i], numForkHeadersList[i]) - // prepare nextHeight for the next request - nextHeightList = append(nextHeightList, nextHeightList[i]+numHeadersList[i]) + // we insert random number of headers and fork headers for each chain in each epoch, + // chainHeaderStartHeights keeps track of the next start height of header for each chain + chainHeaderStartHeights := make([]uint64, numChains) + epochToChainInfo := make(map[uint64]map[string]chainInfo) + for _, epochNum := range epochNums { + epochToChainInfo[epochNum] = make(map[string]chainInfo) + for j, chainID := range chainIDs { + // generate a random number of headers and fork headers for each chain + numHeaders := datagen.RandomInt(r, 100) + 1 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + + // trigger hooks to append these headers and fork headers + SimulateHeadersAndForksViaHook(ctx, r, hooks, chainID, chainHeaderStartHeights[j], numHeaders, numForkHeaders) + + epochToChainInfo[epochNum][chainID] = chainInfo{ + chainID: chainID, + numHeaders: numHeaders, + numForkHeaders: numForkHeaders, + headerStartHeight: chainHeaderStartHeights[j], + } + + // update next insertion height for this chain + chainHeaderStartHeights[j] += numHeaders + } // simulate the scenario that a random epoch has ended - hooks.AfterEpochEnds(ctx, epochNumList[i]) - // prepare epochNum for the next request - epochNumList = append(epochNumList, epochNumList[i]+datagen.RandomInt(10)+1) + hooks.AfterEpochEnds(ctx, epochNum) } - // attest the correctness of epoch info for each tested epoch - for i := uint64(0); i < numReqs; i++ { - resp, err := zcKeeper.EpochChainInfo(ctx, &zctypes.QueryEpochChainInfoRequest{EpochNum: epochNumList[i], ChainId: czChain.ChainID}) + // assert correctness of best case scenario + for _, epochNum := range epochNums { + resp, err := zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: epochNum, ChainIds: chainIDs}) require.NoError(t, err) - chainInfo := resp.ChainInfo - require.Equal(t, nextHeightList[i+1]-1, chainInfo.LatestHeader.Height) - require.Equal(t, numForkHeadersList[i], uint64(len(chainInfo.LatestForks.Headers))) + epochChainsInfo := resp.ChainsInfo + require.Len(t, epochChainsInfo, int(numChains)) + for _, info := range epochChainsInfo { + require.Equal(t, epochToChainInfo[epochNum][info.ChainId].numForkHeaders, uint64(len(info.LatestForks.Headers))) + + actualHeight := epochToChainInfo[epochNum][info.ChainId].headerStartHeight + (epochToChainInfo[epochNum][info.ChainId].numHeaders - 1) + require.Equal(t, actualHeight, info.LatestHeader.Height) + + } } + + // if num of chain ids exceed the max limit, query should fail + largeNumChains := datagen.RandomInt(r, 10) + 101 + var maxChainIDs []string + for i := uint64(0); i < largeNumChains; i++ { + maxChainIDs = append(maxChainIDs, datagen.GenRandomHexStr(r, 30)) + } + randomEpochNum := datagen.RandomInt(r, 10) + 1 + _, err := zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: maxChainIDs}) + require.Error(t, err) + + // if no input is passed in, query should fail + _, err = zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: nil}) + require.Error(t, err) + + // if len of chain ids is 0, query should fail + _, err = zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: []string{}}) + require.Error(t, err) + + // if chain ids contain duplicates, query should fail + randomChainID := datagen.GenRandomHexStr(r, 30) + dupChainIds := []string{randomChainID, randomChainID} + _, err = zcKeeper.EpochChainsInfo(ctx, &zctypes.QueryEpochChainsInfoRequest{EpochNum: randomEpochNum, ChainIds: dupChainIds}) + require.Error(t, err) }) } @@ -177,7 +253,7 @@ func FuzzListHeaders(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -186,12 +262,12 @@ func FuzzListHeaders(f *testing.F) { hooks := zcKeeper.Hooks() // invoke the hook a random number of times to simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 1 - numForkHeaders := datagen.RandomInt(10) + 1 - headers, _ := SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) + numHeaders := datagen.RandomInt(r, 100) + 1 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + headers, _ := SimulateHeadersAndForksViaHook(ctx, r, hooks, czChain.ChainID, 0, numHeaders, numForkHeaders) // a request with randomised pagination - limit := datagen.RandomInt(int(numHeaders)) + 1 + limit := datagen.RandomInt(r, int(numHeaders)) + 1 req := &zctypes.QueryListHeadersRequest{ ChainId: czChain.ChainID, Pagination: &query.PageRequest{ @@ -211,7 +287,7 @@ func FuzzListEpochHeaders(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) _, babylonChain, czChain, babylonApp := SetupTest(t) zcKeeper := babylonApp.ZoneConciergeKeeper @@ -220,9 +296,9 @@ func FuzzListEpochHeaders(f *testing.F) { ctx := babylonChain.GetContext() hooks := zcKeeper.Hooks() - numReqs := datagen.RandomInt(5) + 1 + numReqs := datagen.RandomInt(r, 5) + 1 - epochNumList := []uint64{datagen.RandomInt(10) + 1} + epochNumList := []uint64{datagen.RandomInt(r, 10) + 1} nextHeightList := []uint64{0} numHeadersList := []uint64{} expectedHeadersMap := map[uint64][]*ibctmtypes.Header{} @@ -244,10 +320,10 @@ func FuzzListEpochHeaders(f *testing.F) { } // generate a random number of headers and fork headers - numHeadersList = append(numHeadersList, datagen.RandomInt(100)+1) - numForkHeadersList = append(numForkHeadersList, datagen.RandomInt(10)+1) + numHeadersList = append(numHeadersList, datagen.RandomInt(r, 100)+1) + numForkHeadersList = append(numForkHeadersList, datagen.RandomInt(r, 10)+1) // trigger hooks to append these headers and fork headers - expectedHeaders, _ := SimulateHeadersAndForksViaHook(ctx, hooks, czChain.ChainID, nextHeightList[i], numHeadersList[i], numForkHeadersList[i]) + expectedHeaders, _ := SimulateHeadersAndForksViaHook(ctx, r, hooks, czChain.ChainID, nextHeightList[i], numHeadersList[i], numForkHeadersList[i]) expectedHeadersMap[epochNum] = expectedHeaders // prepare nextHeight for the next request nextHeightList = append(nextHeightList, nextHeightList[i]+numHeadersList[i]) @@ -255,7 +331,7 @@ func FuzzListEpochHeaders(f *testing.F) { // simulate the scenario that a random epoch has ended hooks.AfterEpochEnds(ctx, epochNum) // prepare epochNum for the next request - epochNumList = append(epochNumList, epochNum+datagen.RandomInt(10)+1) + epochNumList = append(epochNumList, epochNum+datagen.RandomInt(r, 10)+1) } // attest the correctness of epoch info for each tested epoch @@ -283,16 +359,13 @@ func FuzzFinalizedChainInfo(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) ctrl := gomock.NewController(t) defer ctrl.Finish() - czChainIDLen := datagen.RandomInt(50) + 1 - czChainID := string(datagen.GenRandomByteArray(czChainIDLen)) - // simulate the scenario that a random epoch has ended and finalised - epoch := datagen.GenRandomEpoch() + epoch := datagen.GenRandomEpoch(r) // mock checkpointing keeper // TODO: tests with a set of validators @@ -300,7 +373,7 @@ func FuzzFinalizedChainInfo(f *testing.F) { checkpointingKeeper.EXPECT().GetBLSPubKeySet(gomock.Any(), gomock.Eq(epoch.EpochNumber)).Return([]*checkpointingtypes.ValidatorWithBlsKey{}, nil).AnyTimes() // mock btccheckpoint keeper // TODO: test with BTCSpvProofs - randomRawCkpt := datagen.GenRandomRawCheckpoint() + randomRawCkpt := datagen.GenRandomRawCheckpoint(r) randomRawCkpt.EpochNum = epoch.EpochNumber btccKeeper := zctypes.NewMockBtcCheckpointKeeper(ctrl) checkpointingKeeper.EXPECT().GetRawCheckpoint(gomock.Any(), gomock.Eq(epoch.EpochNumber)).Return( @@ -334,20 +407,39 @@ func FuzzFinalizedChainInfo(f *testing.F) { zcKeeper, ctx := testkeeper.ZoneConciergeKeeper(t, checkpointingKeeper, btccKeeper, epochingKeeper, tmClient) hooks := zcKeeper.Hooks() - // invoke the hook a random number of times to simulate a random number of blocks - numHeaders := datagen.RandomInt(100) + 1 - numForkHeaders := datagen.RandomInt(10) + 1 - SimulateHeadersAndForksViaHook(ctx, hooks, czChainID, 0, numHeaders, numForkHeaders) + var ( + chainsInfo []chainInfo + chainIDs []string + ) + numChains := datagen.RandomInt(r, 100) + 1 + for i := uint64(0); i < numChains; i++ { + czChainIDLen := datagen.RandomInt(r, 50) + 1 + czChainID := string(datagen.GenRandomByteArray(r, czChainIDLen)) + + // invoke the hook a random number of times to simulate a random number of blocks + numHeaders := datagen.RandomInt(r, 100) + 1 + numForkHeaders := datagen.RandomInt(r, 10) + 1 + SimulateHeadersAndForksViaHook(ctx, r, hooks, czChainID, 0, numHeaders, numForkHeaders) + + chainIDs = append(chainIDs, czChainID) + chainsInfo = append(chainsInfo, chainInfo{ + chainID: czChainID, + numHeaders: numHeaders, + numForkHeaders: numForkHeaders, + }) + } hooks.AfterEpochEnds(ctx, epoch.EpochNumber) err := hooks.AfterRawCheckpointFinalized(ctx, epoch.EpochNumber) require.NoError(t, err) // check if the chain info of this epoch is recorded or not - resp, err := zcKeeper.FinalizedChainInfo(ctx, &zctypes.QueryFinalizedChainInfoRequest{ChainId: czChainID, Prove: true}) + resp, err := zcKeeper.FinalizedChainsInfo(ctx, &zctypes.QueryFinalizedChainsInfoRequest{ChainIds: chainIDs, Prove: true}) require.NoError(t, err) - chainInfo := resp.FinalizedChainInfo - require.Equal(t, numHeaders-1, chainInfo.LatestHeader.Height) - require.Equal(t, numForkHeaders, uint64(len(chainInfo.LatestForks.Headers))) + for i, respData := range resp.FinalizedChainsInfo { + require.Equal(t, chainsInfo[i].chainID, respData.FinalizedChainInfo.ChainId) + require.Equal(t, chainsInfo[i].numHeaders-1, respData.FinalizedChainInfo.LatestHeader.Height) + require.Equal(t, chainsInfo[i].numForkHeaders, uint64(len(respData.FinalizedChainInfo.LatestForks.Headers))) + } }) } diff --git a/x/zoneconcierge/keeper/hooks.go b/x/zoneconcierge/keeper/hooks.go index d3e931377..95b52a65f 100644 --- a/x/zoneconcierge/keeper/hooks.go +++ b/x/zoneconcierge/keeper/hooks.go @@ -3,13 +3,12 @@ package keeper import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + extendedkeeper "github.com/babylonchain/babylon/x/zoneconcierge/extended-client-keeper" "github.com/babylonchain/babylon/x/zoneconcierge/types" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ibcclientkeeper "github.com/cosmos/ibc-go/v5/modules/core/02-client/keeper" - ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" ) type Hooks struct { @@ -17,34 +16,38 @@ type Hooks struct { } // ensures Hooks implements ClientHooks interfaces -var _ ibcclientkeeper.ClientHooks = Hooks{} +var _ extendedkeeper.ClientHooks = Hooks{} var _ checkpointingtypes.CheckpointingHooks = Hooks{} var _ epochingtypes.EpochingHooks = Hooks{} func (k Keeper) Hooks() Hooks { return Hooks{k} } // AfterHeaderWithValidCommit is triggered upon each CZ header with a valid QC -func (h Hooks) AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header *ibctmtypes.Header, isOnFork bool) { +func (h Hooks) AfterHeaderWithValidCommit(ctx sdk.Context, txHash []byte, header *extendedkeeper.HeaderInfo, isOnFork bool) { babylonHeader := ctx.BlockHeader() indexedHeader := types.IndexedHeader{ - ChainId: header.Header.ChainID, - Hash: header.Header.LastCommitHash, - Height: uint64(header.Header.Height), + ChainId: header.ChaindId, + Hash: header.Hash, + Height: header.Height, BabylonHeader: &babylonHeader, BabylonEpoch: h.k.GetEpoch(ctx).EpochNumber, BabylonTxHash: txHash, } - // initialise chain info if not exist - chainInfo, err := h.k.GetChainInfo(ctx, indexedHeader.ChainId) - if err != nil { - if sdkerrors.IsOf(err, types.ErrEpochChainInfoNotFound) { - // chain info does not exist yet, initialise chain info for this chain - chainInfo, err = h.k.InitChainInfo(ctx, indexedHeader.ChainId) - if err != nil { - panic(fmt.Errorf("failed to initialize chain info of %s: %w", indexedHeader.ChainId, err)) - } - } else { + var ( + chainInfo *types.ChainInfo + err error + ) + if !h.k.HasChainInfo(ctx, indexedHeader.ChainId) { + // chain info does not exist yet, initialise chain info for this chain + chainInfo, err = h.k.InitChainInfo(ctx, indexedHeader.ChainId) + if err != nil { + panic(fmt.Errorf("failed to initialize chain info of %s: %w", indexedHeader.ChainId, err)) + } + } else { + // get chain info + chainInfo, err = h.k.GetChainInfo(ctx, indexedHeader.ChainId) + if err != nil { panic(fmt.Errorf("failed to get chain info of %s: %w", indexedHeader.ChainId, err)) } } diff --git a/x/zoneconcierge/keeper/ibc_packet.go b/x/zoneconcierge/keeper/ibc_packet.go index 7d97c2d32..a75fc2415 100644 --- a/x/zoneconcierge/keeper/ibc_packet.go +++ b/x/zoneconcierge/keeper/ibc_packet.go @@ -4,15 +4,15 @@ import ( "fmt" "time" - sdkerrors "cosmossdk.io/errors" + errorsmod "cosmossdk.io/errors" metrics "github.com/armon/go-metrics" "github.com/babylonchain/babylon/x/zoneconcierge/types" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v5/modules/core/24-host" - coretypes "github.com/cosmos/ibc-go/v5/modules/core/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + coretypes "github.com/cosmos/ibc-go/v7/modules/core/types" ) // SendIBCPacket sends an IBC packet to a channel @@ -24,44 +24,33 @@ func (k Keeper) SendIBCPacket(ctx sdk.Context, channel channeltypes.IdentifiedCh destinationPort := channel.Counterparty.GetPortID() destinationChannel := channel.Counterparty.GetChannelID() - // find the next sequence number - sequence, found := k.channelKeeper.GetNextSequenceSend(ctx, sourcePort, sourceChannel) - if !found { - return sdkerrors.Wrapf( - channeltypes.ErrSequenceSendNotFound, - "source port: %s, source channel: %s", sourcePort, sourceChannel, - ) - } - // begin createOutgoingPacket logic // See spec for this logic: https://github.com/cosmos/ibc/tree/master/spec/app/ics-020-fungible-token-transfer#packet-relay channelCap, ok := k.scopedKeeper.GetCapability(ctx, host.ChannelCapabilityPath(sourcePort, sourceChannel)) if !ok { - return sdkerrors.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability: sourcePort: %s, sourceChannel: %s", sourcePort, sourceChannel) + return errorsmod.Wrapf(channeltypes.ErrChannelCapabilityNotFound, "module does not own channel capability: sourcePort: %s, sourceChannel: %s", sourcePort, sourceChannel) } // timeout timeoutTime := uint64(ctx.BlockHeader().Time.Add(time.Hour * 24).UnixNano()) // TODO: parameterise zeroheight := clienttypes.ZeroHeight() - // construct packet from packet data - packet := channeltypes.NewPacket( - k.cdc.MustMarshal(packetData), - sequence, + seq, err := k.ics4Wrapper.SendPacket( + ctx, + channelCap, sourcePort, sourceChannel, - destinationPort, - destinationChannel, zeroheight, // no need to set timeout height if timeout timestamp is set timeoutTime, // if the packet is not relayed after this time, then the packet will be time out + k.cdc.MustMarshal(packetData), ) // send packet - if err := k.ics4Wrapper.SendPacket(ctx, channelCap, packet); err != nil { + if err != nil { // Failed/timeout packet should not make the system crash - k.Logger(ctx).Error(fmt.Sprintf("failed to send IBC packet (sequence number: %d) to channel %v port %s: %v", packet.Sequence, destinationChannel, destinationPort, err)) + k.Logger(ctx).Error(fmt.Sprintf("failed to send IBC packet (sequence number: %d) to channel %v port %s: %v", seq, destinationChannel, destinationPort, err)) } else { - k.Logger(ctx).Info(fmt.Sprintf("successfully sent IBC packet (sequence number: %d) to channel %v port %s", packet.Sequence, destinationChannel, destinationPort)) + k.Logger(ctx).Info(fmt.Sprintf("successfully sent IBC packet (sequence number: %d) to channel %v port %s", seq, destinationChannel, destinationPort)) } // metrics stuff diff --git a/x/zoneconcierge/keeper/keeper.go b/x/zoneconcierge/keeper/keeper.go index 2db45a40a..d2f928e8a 100644 --- a/x/zoneconcierge/keeper/keeper.go +++ b/x/zoneconcierge/keeper/keeper.go @@ -2,22 +2,21 @@ package keeper import ( "github.com/babylonchain/babylon/x/zoneconcierge/types" + "github.com/cometbft/cometbft/libs/log" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - host "github.com/cosmos/ibc-go/v5/modules/core/24-host" - "github.com/tendermint/tendermint/libs/log" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - memKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + memKey storetypes.StoreKey ics4Wrapper types.ICS4Wrapper channelKeeper types.ChannelKeeper @@ -37,7 +36,6 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, ics4Wrapper types.ICS4Wrapper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, @@ -50,16 +48,10 @@ func NewKeeper( storeQuerier sdk.Queryable, scopedKeeper types.ScopedKeeper, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - return &Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, - paramstore: ps, ics4Wrapper: ics4Wrapper, channelKeeper: channelKeeper, portKeeper: portKeeper, @@ -76,7 +68,7 @@ func NewKeeper( // Logger returns a module-specific logger. func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", "x/"+host.ModuleName+"-"+types.ModuleName) + return ctx.Logger().With("module", "x/"+ibcexported.ModuleName+"-"+types.ModuleName) } // IsBound checks if the transfer module is already bound to the desired port diff --git a/x/zoneconcierge/keeper/keeper_test.go b/x/zoneconcierge/keeper/keeper_test.go index 12069d90f..eb1b63dc1 100644 --- a/x/zoneconcierge/keeper/keeper_test.go +++ b/x/zoneconcierge/keeper/keeper_test.go @@ -2,14 +2,16 @@ package keeper_test import ( "encoding/json" + "math/rand" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v7/testing" + "github.com/babylonchain/babylon/app" "github.com/babylonchain/babylon/testutil/datagen" zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" - sdk "github.com/cosmos/cosmos-sdk/types" - ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" - ibctesting "github.com/cosmos/ibc-go/v5/testing" ) // SetupTest creates a coordinator with 2 test chains, and a ZoneConcierge keeper. @@ -20,7 +22,7 @@ func SetupTest(t *testing.T) (*ibctesting.Coordinator, *ibctesting.TestChain, *i ibctesting.DefaultTestingAppInit = func() (ibctesting.TestingApp, map[string]json.RawMessage) { babylonApp := app.Setup(t, false) bbnApp = babylonApp - encCdc := app.MakeTestEncodingConfig() + encCdc := app.GetEncodingConfig() genesis := app.NewDefaultGenesisState(encCdc.Marshaler) return babylonApp, genesis } @@ -34,32 +36,32 @@ func SetupTest(t *testing.T) (*ibctesting.Coordinator, *ibctesting.TestChain, *i } // SimulateHeadersViaHook generates a non-zero number of canonical headers via the hook -func SimulateHeadersViaHook(ctx sdk.Context, hooks zckeeper.Hooks, chainID string, startHeight uint64, numHeaders uint64) []*ibctmtypes.Header { +func SimulateHeadersViaHook(ctx sdk.Context, r *rand.Rand, hooks zckeeper.Hooks, chainID string, startHeight uint64, numHeaders uint64) []*ibctmtypes.Header { headers := []*ibctmtypes.Header{} // invoke the hook a number of times to simulate a number of blocks for i := uint64(0); i < numHeaders; i++ { - header := datagen.GenRandomIBCTMHeader(chainID, startHeight+i) - hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(32), header, false) + header := datagen.GenRandomIBCTMHeader(r, chainID, startHeight+i) + hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), false) headers = append(headers, header) } return headers } // SimulateHeadersViaHook generates a random non-zero number of canonical headers and fork headers via the hook -func SimulateHeadersAndForksViaHook(ctx sdk.Context, hooks zckeeper.Hooks, chainID string, startHeight uint64, numHeaders uint64, numForkHeaders uint64) ([]*ibctmtypes.Header, []*ibctmtypes.Header) { +func SimulateHeadersAndForksViaHook(ctx sdk.Context, r *rand.Rand, hooks zckeeper.Hooks, chainID string, startHeight uint64, numHeaders uint64, numForkHeaders uint64) ([]*ibctmtypes.Header, []*ibctmtypes.Header) { headers := []*ibctmtypes.Header{} // invoke the hook a number of times to simulate a number of blocks for i := uint64(0); i < numHeaders; i++ { - header := datagen.GenRandomIBCTMHeader(chainID, startHeight+i) - hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(32), header, false) + header := datagen.GenRandomIBCTMHeader(r, chainID, startHeight+i) + hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), false) headers = append(headers, header) } // generate a number of fork headers forkHeaders := []*ibctmtypes.Header{} for i := uint64(0); i < numForkHeaders; i++ { - header := datagen.GenRandomIBCTMHeader(chainID, startHeight+numHeaders-1) - hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(32), header, true) + header := datagen.GenRandomIBCTMHeader(r, chainID, startHeight+numHeaders-1) + hooks.AfterHeaderWithValidCommit(ctx, datagen.GenRandomByteArray(r, 32), datagen.HeaderToHeaderInfo(header), true) forkHeaders = append(forkHeaders, header) } return headers, forkHeaders diff --git a/x/zoneconcierge/keeper/params.go b/x/zoneconcierge/keeper/params.go deleted file mode 100644 index 328fbd9c6..000000000 --- a/x/zoneconcierge/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - "github.com/babylonchain/babylon/x/zoneconcierge/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(ctx sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/zoneconcierge/keeper/params_test.go b/x/zoneconcierge/keeper/params_test.go deleted file mode 100644 index b319a114c..000000000 --- a/x/zoneconcierge/keeper/params_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package keeper_test - -import ( - "testing" - - testkeeper "github.com/babylonchain/babylon/testutil/keeper" - "github.com/babylonchain/babylon/x/zoneconcierge/types" - "github.com/stretchr/testify/require" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.ZoneConciergeKeeper(t, nil, nil, nil, nil) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} diff --git a/x/zoneconcierge/keeper/proof_block_in_epoch.go b/x/zoneconcierge/keeper/proof_block_in_epoch.go index 6897e8e0a..0cdbabd35 100644 --- a/x/zoneconcierge/keeper/proof_block_in_epoch.go +++ b/x/zoneconcierge/keeper/proof_block_in_epoch.go @@ -3,9 +3,9 @@ package keeper import ( epochingkeeper "github.com/babylonchain/babylon/x/epoching/keeper" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" - tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" ) func (k Keeper) ProveHeaderInEpoch(ctx sdk.Context, header *tmproto.Header, epoch *epochingtypes.Epoch) (*tmcrypto.Proof, error) { diff --git a/x/zoneconcierge/keeper/proof_epoch_sealed.go b/x/zoneconcierge/keeper/proof_epoch_sealed.go index 6d16129d5..a0d32e1a8 100644 --- a/x/zoneconcierge/keeper/proof_epoch_sealed.go +++ b/x/zoneconcierge/keeper/proof_epoch_sealed.go @@ -3,13 +3,13 @@ package keeper import ( "fmt" + errorsmod "cosmossdk.io/errors" "github.com/babylonchain/babylon/crypto/bls12381" checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" "github.com/babylonchain/babylon/x/zoneconcierge/types" + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" ) func getEpochInfoKey(epochNumber uint64) []byte { @@ -36,7 +36,7 @@ func getValSetKey(epochNumber uint64) []byte { func (k Keeper) ProveValSet(epoch *epochingtypes.Epoch) (*tmcrypto.ProofOps, error) { valSetKey := getValSetKey(epoch.EpochNumber) - _, _, proof, err := k.QueryStore(epochingtypes.StoreKey, valSetKey, epoch.SealerHeader.Height) + _, _, proof, err := k.QueryStore(checkpointingtypes.StoreKey, valSetKey, epoch.SealerHeader.Height) if err != nil { return nil, err } @@ -154,7 +154,7 @@ func VerifyEpochSealed(epoch *epochingtypes.Epoch, rawCkpt *checkpointingtypes.R return err } if err := VerifyStore(root, epochingtypes.StoreKey, getEpochInfoKey(epoch.EpochNumber), epochBytes, proof.ProofEpochInfo); err != nil { - return sdkerrors.Wrapf(types.ErrInvalidMerkleProof, "invalid inclusion proof for epoch metadata: %w", err) + return errorsmod.Wrapf(types.ErrInvalidMerkleProof, "invalid inclusion proof for epoch metadata: %v", err) } // Ensure The validator set is committed to the app_hash of the sealer header @@ -163,7 +163,7 @@ func VerifyEpochSealed(epoch *epochingtypes.Epoch, rawCkpt *checkpointingtypes.R return err } if err := VerifyStore(root, checkpointingtypes.StoreKey, getValSetKey(epoch.EpochNumber), valSetBytes, proof.ProofEpochValSet); err != nil { - return sdkerrors.Wrapf(types.ErrInvalidMerkleProof, "invalid inclusion proof for validator set: %w", err) + return errorsmod.Wrapf(types.ErrInvalidMerkleProof, "invalid inclusion proof for validator set: %v", err) } return nil diff --git a/x/zoneconcierge/keeper/proof_epoch_sealed_test.go b/x/zoneconcierge/keeper/proof_epoch_sealed_test.go index a357bff78..e29c6eae6 100644 --- a/x/zoneconcierge/keeper/proof_epoch_sealed_test.go +++ b/x/zoneconcierge/keeper/proof_epoch_sealed_test.go @@ -41,20 +41,20 @@ func FuzzProofEpochSealed_BLSSig(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) ctrl := gomock.NewController(t) defer ctrl.Finish() // generate a random epoch - epoch := datagen.GenRandomEpoch() + epoch := datagen.GenRandomEpoch(r) // generate a random validator set with 100 validators numVals := 100 valSet, blsSKs := datagen.GenerateValidatorSetWithBLSPrivKeys(numVals) // sample a validator subset, which may or may not reach a quorum - bm, numSubSet := datagen.GenRandomBitmap() + bm, numSubSet := datagen.GenRandomBitmap(r) _, subsetPower, err := valSet.FindSubsetWithPowerSum(bm) require.NoError(t, err) @@ -107,8 +107,7 @@ func FuzzProofEpochSealed_Epoch(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - + // r := rand.New(rand.NewSource(seed)) }) } @@ -117,7 +116,6 @@ func FuzzProofEpochSealed_ValSet(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) - + // r := rand.New(rand.NewSource(seed)) }) } diff --git a/x/zoneconcierge/keeper/proof_epoch_submitted_test.go b/x/zoneconcierge/keeper/proof_epoch_submitted_test.go index 26e4e1d99..c8cacc3c5 100644 --- a/x/zoneconcierge/keeper/proof_epoch_submitted_test.go +++ b/x/zoneconcierge/keeper/proof_epoch_submitted_test.go @@ -1,6 +1,7 @@ package keeper_test import ( + "encoding/hex" "math/rand" "testing" @@ -18,22 +19,22 @@ func FuzzProofEpochSubmitted(f *testing.F) { datagen.AddRandomSeedsToFuzzer(f, 10) f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + r := rand.New(rand.NewSource(seed)) // generate random epoch, random rawBtcCkpt and random rawCkpt - epoch := datagen.GenRandomEpoch() - rawBtcCkpt := datagen.GetRandomRawBtcCheckpoint() + epoch := datagen.GenRandomEpoch(r) + rawBtcCkpt := datagen.GetRandomRawBtcCheckpoint(r) rawBtcCkpt.Epoch = epoch.EpochNumber rawCkpt, err := checkpointingtypes.FromBTCCkptToRawCkpt(rawBtcCkpt) require.NoError(t, err) // encode ckpt to BTC txs in BTC blocks testRawCkptData := datagen.EncodeRawCkptToTestData(rawBtcCkpt) - idxs := []uint64{datagen.RandomInt(5) + 1, datagen.RandomInt(5) + 1} - offsets := []uint64{datagen.RandomInt(5) + 1, datagen.RandomInt(5) + 1} + idxs := []uint64{datagen.RandomInt(r, 5) + 1, datagen.RandomInt(r, 5) + 1} + offsets := []uint64{datagen.RandomInt(r, 5) + 1, datagen.RandomInt(r, 5) + 1} btcBlocks := []*datagen.BlockCreationResult{ - datagen.CreateBlock(1, uint32(idxs[0]+offsets[0]), uint32(idxs[0]), testRawCkptData.FirstPart), - datagen.CreateBlock(2, uint32(idxs[1]+offsets[1]), uint32(idxs[1]), testRawCkptData.SecondPart), + datagen.CreateBlock(r, 1, uint32(idxs[0]+offsets[0]), uint32(idxs[0]), testRawCkptData.FirstPart), + datagen.CreateBlock(r, 2, uint32(idxs[1]+offsets[1]), uint32(idxs[1]), testRawCkptData.SecondPart), } // create MsgInsertBtcSpvProof for the rawCkpt msgInsertBtcSpvProof := datagen.GenerateMessageWithRandomSubmitter([]*datagen.BlockCreationResult{btcBlocks[0], btcBlocks[1]}) @@ -60,10 +61,11 @@ func FuzzProofEpochSubmitted(f *testing.F) { // net param, babylonTag powLimit := chaincfg.SimNetParams.PowLimit - babylonTag := txformat.MainTag(0) + babylonTag := btcctypes.DefaultCheckpointTag + tagAsBytes, _ := hex.DecodeString(babylonTag) // verify - err = zckeeper.VerifyEpochSubmitted(rawCkpt, txsInfo, btcHeaders, powLimit, babylonTag) + err = zckeeper.VerifyEpochSubmitted(rawCkpt, txsInfo, btcHeaders, powLimit, txformat.BabylonTag(tagAsBytes)) require.NoError(t, err) }) } diff --git a/x/zoneconcierge/keeper/proof_tx_in_block.go b/x/zoneconcierge/keeper/proof_tx_in_block.go index 87c9a8803..89b309926 100644 --- a/x/zoneconcierge/keeper/proof_tx_in_block.go +++ b/x/zoneconcierge/keeper/proof_tx_in_block.go @@ -4,9 +4,9 @@ import ( "crypto/sha256" "fmt" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" sdk "github.com/cosmos/cosmos-sdk/types" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" ) func (k Keeper) ProveTxInBlock(ctx sdk.Context, txHash []byte) (*tmproto.TxProof, error) { diff --git a/x/zoneconcierge/keeper/proof_tx_in_block_test.go b/x/zoneconcierge/keeper/proof_tx_in_block_test.go index 11944081a..36d88ce6e 100644 --- a/x/zoneconcierge/keeper/proof_tx_in_block_test.go +++ b/x/zoneconcierge/keeper/proof_tx_in_block_test.go @@ -4,8 +4,6 @@ import ( "fmt" "testing" - "github.com/babylonchain/babylon/app" - zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/testutil/network" @@ -13,12 +11,16 @@ import ( banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/spf13/pflag" "github.com/stretchr/testify/require" + + "github.com/babylonchain/babylon/app" + zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" ) func TestProveTxInBlock(t *testing.T) { // setup virtual network - cfg := network.DefaultConfig() - encodingCfg := app.MakeTestEncodingConfig() + min := network.MinimumAppConfig() + cfg, _ := network.DefaultConfigWithAppConfig(min) + encodingCfg := app.GetEncodingConfig() cfg.InterfaceRegistry = encodingCfg.InterfaceRegistry cfg.TxConfig = encodingCfg.TxConfig cfg.NumValidators = 2 @@ -52,10 +54,14 @@ func TestProveTxInBlock(t *testing.T) { coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10))) msg := banktypes.NewMsgSend(val.Address, testNetwork.Validators[1].Address, coins) + txf, err := tx.NewFactoryCLI(val.ClientCtx, fs) + + require.NoError(t, err) // construct a tx that includes this msg - txf := tx.NewFactoryCLI(val.ClientCtx, fs). + txf = txf. WithTxConfig(val.ClientCtx.TxConfig). WithAccountRetriever(val.ClientCtx.AccountRetriever) + txf, err = txf.Prepare(val.ClientCtx) require.NoError(t, err) txb, err := txf.BuildUnsignedTx(msg) diff --git a/x/zoneconcierge/keeper/query_kvstore.go b/x/zoneconcierge/keeper/query_kvstore.go index 3e2eff4a7..bdebccee1 100644 --- a/x/zoneconcierge/keeper/query_kvstore.go +++ b/x/zoneconcierge/keeper/query_kvstore.go @@ -3,10 +3,10 @@ package keeper import ( "fmt" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cometbft/cometbft/crypto/merkle" + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" "github.com/cosmos/cosmos-sdk/store/rootmulti" - abci "github.com/tendermint/tendermint/abci/types" - "github.com/tendermint/tendermint/crypto/merkle" - tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" ) // QueryStore queries a KV pair in the KVStore, where @@ -28,7 +28,7 @@ func (k Keeper) QueryStore(moduleStoreKey string, key []byte, queryHeight int64) resp := k.storeQuerier.Query(abci.RequestQuery{ Path: path, Data: key, - Height: queryHeight, + Height: queryHeight - 1, // NOTE: the inclusion proof corresponds to the NEXT header Prove: true, }) if resp.Code != 0 { diff --git a/x/zoneconcierge/keeper/query_kvstore_test.go b/x/zoneconcierge/keeper/query_kvstore_test.go index 06f619831..7134afadf 100644 --- a/x/zoneconcierge/keeper/query_kvstore_test.go +++ b/x/zoneconcierge/keeper/query_kvstore_test.go @@ -1,40 +1,33 @@ package keeper_test import ( - "math/rand" "testing" - "github.com/babylonchain/babylon/testutil/datagen" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) -func FuzzQueryStore(f *testing.F) { - datagen.AddRandomSeedsToFuzzer(f, 10) +func TestQueryStore(t *testing.T) { + _, babylonChain, _, babylonApp := SetupTest(t) + zcKeeper := babylonApp.ZoneConciergeKeeper - f.Fuzz(func(t *testing.T, seed int64) { - rand.Seed(seed) + babylonChain.NextBlock() + babylonChain.NextBlock() - _, babylonChain, _, babylonApp := SetupTest(t) - zcKeeper := babylonApp.ZoneConciergeKeeper + ctx := babylonChain.GetContext() - babylonChain.NextBlock() - babylonChain.NextBlock() + epochQueryKey := append(epochingtypes.EpochInfoKey, sdk.Uint64ToBigEndian(1)...) + // NOTE: QueryStore will use ctx.BlockHeight() - 1 as the height for ABCI query + // This is because the ABCI query will return the inclusion proof corresponding + // to the NEXT block rather than the given block. + key, value, proof, err := zcKeeper.QueryStore(epochingtypes.StoreKey, epochQueryKey, ctx.BlockHeight()) - ctx := babylonChain.GetContext() + require.NoError(t, err) + require.NotNil(t, proof) + require.Equal(t, epochQueryKey, key) - // NOTE: the queryHeight has to be the previous block because - // NextBlock() only invokes BeginBlock(), but not EndBlock(), for the new block - epochQueryKey := append(epochingtypes.EpochInfoKey, sdk.Uint64ToBigEndian(1)...) - key, value, proof, err := zcKeeper.QueryStore(epochingtypes.StoreKey, epochQueryKey, ctx.BlockHeight()-1) - - require.NoError(t, err) - require.NotNil(t, proof) - require.Equal(t, epochQueryKey, key) - - err = zckeeper.VerifyStore(ctx.BlockHeader().AppHash, epochingtypes.StoreKey, key, value, proof) - require.NoError(t, err) - }) + err = zckeeper.VerifyStore(ctx.BlockHeader().AppHash, epochingtypes.StoreKey, key, value, proof) + require.NoError(t, err) } diff --git a/x/zoneconcierge/module.go b/x/zoneconcierge/module.go index ee59187f4..26ffaf051 100644 --- a/x/zoneconcierge/module.go +++ b/x/zoneconcierge/module.go @@ -8,7 +8,7 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" - abci "github.com/tendermint/tendermint/abci/types" + abci "github.com/cometbft/cometbft/abci/types" "github.com/babylonchain/babylon/x/zoneconcierge/client/cli" "github.com/babylonchain/babylon/x/zoneconcierge/keeper" @@ -18,7 +18,7 @@ import ( cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types" + porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" ) var ( @@ -111,17 +111,9 @@ func NewAppModule( } } -// Deprecated: use RegisterServices -func (am AppModule) Route() sdk.Route { return sdk.Route{} } - // Deprecated: use RegisterServices func (AppModule) QuerierRoute() string { return types.RouterKey } -// Deprecated: use RegisterServices -func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { - return nil -} - // RegisterServices registers a gRPC query service to respond to the module-specific gRPC queries func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) diff --git a/x/zoneconcierge/module_ibc.go b/x/zoneconcierge/module_ibc.go index e8a81cd83..758cc6451 100644 --- a/x/zoneconcierge/module_ibc.go +++ b/x/zoneconcierge/module_ibc.go @@ -8,10 +8,11 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v5/modules/core/05-port/types" - host "github.com/cosmos/ibc-go/v5/modules/core/24-host" - ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" + host "github.com/cosmos/ibc-go/v7/modules/core/24-host" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + errorsmod "cosmossdk.io/errors" ) type IBCModule struct { @@ -38,7 +39,7 @@ func (im IBCModule) OnChanOpenInit( // Require portID to be the one that ZoneConcierge is bound to boundPort := im.keeper.GetPort(ctx) if boundPort != portID { - return "", sdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + return "", errorsmod.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) } // Claim channel capability passed back by IBC module @@ -63,7 +64,7 @@ func (im IBCModule) OnChanOpenTry( // Require portID to be the one that ZoneConcierge is bound to boundPort := im.keeper.GetPort(ctx) if boundPort != portID { - return "", sdkerrors.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) + return "", errorsmod.Wrapf(porttypes.ErrInvalidPort, "invalid port: %s, expected %s", portID, boundPort) } // Module may have already claimed capability in OnChanOpenInit in the case of crossing hellos @@ -90,7 +91,7 @@ func (im IBCModule) OnChanOpenAck( ) error { // // TODO (Babylon): check version consistency (this requires modifying CZ code) // if counterpartyVersion != types.Version { - // return sdkerrors.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) + // return errorsmod.Wrapf(types.ErrInvalidVersion, "invalid counterparty version: %s, expected %s", counterpartyVersion, types.Version) // } return nil } @@ -111,7 +112,7 @@ func (im IBCModule) OnChanCloseInit( channelID string, ) error { // Disallow user-initiated channel closing for channels - return sdkerrors.Wrap(sdkerrors.ErrInvalidRequest, "user cannot close channel") + return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "user cannot close channel") } // OnChanCloseConfirm implements the IBCModule interface @@ -133,7 +134,7 @@ func (im IBCModule) OnRecvPacket( var modulePacketData types.ZoneconciergePacketData if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { - return channeltypes.NewErrorAcknowledgement(sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error())) + return channeltypes.NewErrorAcknowledgement(errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error())) } // // TODO (Babylon): Dispatch and process packet @@ -156,7 +157,7 @@ func (im IBCModule) OnAcknowledgementPacket( ) error { var ack channeltypes.Acknowledgement if err := types.ModuleCdc.UnmarshalJSON(acknowledgement, &ack); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet acknowledgement: %v", err) + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet acknowledgement: %v", err) } var eventType string @@ -165,7 +166,7 @@ func (im IBCModule) OnAcknowledgementPacket( // switch packet := modulePacketData.Packet.(type) { // default: // errMsg := fmt.Sprintf("unrecognized %s packet type: %T", types.ModuleName, packet) - // return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + // return errorsmod.Wrap(sdkerrors.ErrUnknownRequest, errMsg) // } ctx.EventManager().EmitEvent( @@ -204,14 +205,14 @@ func (im IBCModule) OnTimeoutPacket( ) error { var modulePacketData types.ZoneconciergePacketData if err := modulePacketData.Unmarshal(modulePacket.GetData()); err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()) + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "cannot unmarshal packet data: %s", err.Error()) } // // TODO (Babylon): Dispatch and process packet // switch packet := modulePacketData.Packet.(type) { // default: // errMsg := fmt.Sprintf("unrecognized %s packet type: %T", types.ModuleName, packet) - // return sdkerrors.Wrap(sdkerrors.ErrUnknownRequest, errMsg) + // return errorsmod.Wrap(sdkerrors.ErrUnknownRequest, errMsg) // } return nil diff --git a/x/zoneconcierge/module_ibc_packet_test.go b/x/zoneconcierge/module_ibc_packet_test.go index 468e766e3..3dbcdf712 100644 --- a/x/zoneconcierge/module_ibc_packet_test.go +++ b/x/zoneconcierge/module_ibc_packet_test.go @@ -4,10 +4,11 @@ import ( "encoding/json" "math/rand" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + ibctesting "github.com/cosmos/ibc-go/v7/testing" + "github.com/babylonchain/babylon/app" zctypes "github.com/babylonchain/babylon/x/zoneconcierge/types" - channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v5/testing" ) // SetupTest creates a coordinator with 2 test chains. @@ -17,7 +18,7 @@ func (suite *ZoneConciergeTestSuite) SetupTestForIBCPackets() { ibctesting.DefaultTestingAppInit = func() (ibctesting.TestingApp, map[string]json.RawMessage) { babylonApp := app.Setup(suite.T(), false) suite.zcKeeper = babylonApp.ZoneConciergeKeeper - encCdc := app.MakeTestEncodingConfig() + encCdc := app.GetEncodingConfig() genesis := app.NewDefaultGenesisState(encCdc.Marshaler) return babylonApp, genesis } diff --git a/x/zoneconcierge/module_simulation.go b/x/zoneconcierge/module_simulation.go index 104ed625d..7bb84f9a4 100644 --- a/x/zoneconcierge/module_simulation.go +++ b/x/zoneconcierge/module_simulation.go @@ -1,16 +1,15 @@ package zoneconcierge import ( - "math/rand" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + simappparams "github.com/babylonchain/babylon/app/params" "github.com/babylonchain/babylon/testutil/sample" zoneconciergesimulation "github.com/babylonchain/babylon/x/zoneconcierge/simulation" "github.com/babylonchain/babylon/x/zoneconcierge/types" "github.com/cosmos/cosmos-sdk/baseapp" - simappparams "github.com/cosmos/cosmos-sdk/simapp/params" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" ) @@ -30,23 +29,16 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { accs[i] = acc.Address.String() } zoneconciergeGenesis := types.GenesisState{ - Params: types.DefaultParams(), PortId: types.PortID, } simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&zoneconciergeGenesis) } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } -// RandomizedParams creates randomized param changes for the simulator -func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { - - return []simtypes.ParamChange{} -} - // RegisterStoreDecoder registers a decoder func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) {} diff --git a/x/zoneconcierge/module_test.go b/x/zoneconcierge/module_test.go index 8289001a0..27a531fc7 100644 --- a/x/zoneconcierge/module_test.go +++ b/x/zoneconcierge/module_test.go @@ -7,25 +7,26 @@ import ( "testing" "time" - "github.com/babylonchain/babylon/app" - zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" + tmbytes "github.com/cometbft/cometbft/libs/bytes" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtypes "github.com/cometbft/cometbft/types" "github.com/cosmos/cosmos-sdk/codec" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - clientexported "github.com/cosmos/ibc-go/v5/modules/core/02-client/exported" - "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" - clienttypes "github.com/cosmos/ibc-go/v5/modules/core/02-client/types" - commitmenttypes "github.com/cosmos/ibc-go/v5/modules/core/23-commitment/types" - "github.com/cosmos/ibc-go/v5/modules/core/exported" - ibctmtypes "github.com/cosmos/ibc-go/v5/modules/light-clients/07-tendermint/types" - ibctesting "github.com/cosmos/ibc-go/v5/testing" - ibctestingmock "github.com/cosmos/ibc-go/v5/testing/mock" - "github.com/cosmos/ibc-go/v5/testing/simapp" + clientexported "github.com/cosmos/ibc-go/v7/modules/core/02-client/exported" + "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" + "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + ibctesting "github.com/cosmos/ibc-go/v7/testing" + ibctestingmock "github.com/cosmos/ibc-go/v7/testing/mock" + "github.com/cosmos/ibc-go/v7/testing/simapp" "github.com/stretchr/testify/suite" - tmbytes "github.com/tendermint/tendermint/libs/bytes" - tmproto "github.com/tendermint/tendermint/proto/tendermint/types" - tmtypes "github.com/tendermint/tendermint/types" + + "github.com/babylonchain/babylon/app" + zckeeper "github.com/babylonchain/babylon/x/zoneconcierge/keeper" ) // ZoneConciergeTestSuite provides a test suite for IBC functionalities in ZoneConcierge @@ -65,7 +66,7 @@ func (suite *ZoneConciergeTestSuite) SetupTest() { ibctesting.DefaultTestingAppInit = func() (ibctesting.TestingApp, map[string]json.RawMessage) { babylonApp := app.Setup(suite.T(), false) suite.zcKeeper = babylonApp.ZoneConciergeKeeper - encCdc := app.MakeTestEncodingConfig() + encCdc := app.GetEncodingConfig() return babylonApp, app.NewDefaultGenesisState(encCdc.Marshaler) } babylonChainID := ibctesting.GetChainID(1) @@ -183,7 +184,7 @@ func (suite *ZoneConciergeTestSuite) TestUpdateClientTendermint() { {"valid duplicate update", func() { clientID := path.EndpointA.ClientID - height1 := clienttypes.NewHeight(0, 1) + height1 := clienttypes.NewHeight(1, 1) // store previous consensus state prevConsState := &ibctmtypes.ConsensusState{ @@ -192,7 +193,7 @@ func (suite *ZoneConciergeTestSuite) TestUpdateClientTendermint() { } suite.babylonChain.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.babylonChain.GetContext(), clientID, height1, prevConsState) - height5 := clienttypes.NewHeight(0, 5) + height5 := clienttypes.NewHeight(1, 5) // store next consensus state to check that trustedHeight does not need to be hightest consensus state before header height nextConsState := &ibctmtypes.ConsensusState{ Timestamp: suite.past.Add(time.Minute), @@ -200,7 +201,7 @@ func (suite *ZoneConciergeTestSuite) TestUpdateClientTendermint() { } suite.babylonChain.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.babylonChain.GetContext(), clientID, height5, nextConsState) - height3 := clienttypes.NewHeight(0, 3) + height3 := clienttypes.NewHeight(1, 3) // updateHeader will fill in consensus state between prevConsState and suite.consState // clientState should not be updated updateHeader = createPastUpdateFn(height3, height1) @@ -210,7 +211,7 @@ func (suite *ZoneConciergeTestSuite) TestUpdateClientTendermint() { {"misbehaviour in dishonest majority CZ: conflicting header", func() { clientID := path.EndpointA.ClientID - height1 := clienttypes.NewHeight(0, 1) + height1 := clienttypes.NewHeight(1, 1) // store previous consensus state prevConsState := &ibctmtypes.ConsensusState{ Timestamp: suite.past, @@ -218,7 +219,7 @@ func (suite *ZoneConciergeTestSuite) TestUpdateClientTendermint() { } suite.babylonChain.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.babylonChain.GetContext(), clientID, height1, prevConsState) - height5 := clienttypes.NewHeight(0, 5) + height5 := clienttypes.NewHeight(1, 5) // store next consensus state to check that trustedHeight does not need to be hightest consensus state before header height nextConsState := &ibctmtypes.ConsensusState{ Timestamp: suite.past.Add(time.Minute), @@ -226,7 +227,7 @@ func (suite *ZoneConciergeTestSuite) TestUpdateClientTendermint() { } suite.babylonChain.App.GetIBCKeeper().ClientKeeper.SetClientConsensusState(suite.babylonChain.GetContext(), clientID, height5, nextConsState) - height3 := clienttypes.NewHeight(0, 3) + height3 := clienttypes.NewHeight(1, 3) // updateHeader will fill in consensus state between prevConsState and suite.consState // clientState should not be updated updateHeader = createPastUpdateFn(height3, height1) diff --git a/x/zoneconcierge/types/errors.go b/x/zoneconcierge/types/errors.go index 483ae213b..a9d28f4bd 100644 --- a/x/zoneconcierge/types/errors.go +++ b/x/zoneconcierge/types/errors.go @@ -3,24 +3,25 @@ package types // DONTCOVER import ( - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + errorsmod "cosmossdk.io/errors" ) // x/zoneconcierge module sentinel errors var ( - ErrSample = sdkerrors.Register(ModuleName, 1100, "sample error") - ErrInvalidPacketTimeout = sdkerrors.Register(ModuleName, 1101, "invalid packet timeout") - ErrInvalidVersion = sdkerrors.Register(ModuleName, 1102, "invalid version") - ErrHeaderNotFound = sdkerrors.Register(ModuleName, 1103, "no header exists at this height") - ErrInvalidHeader = sdkerrors.Register(ModuleName, 1104, "input header is invalid") - ErrNoValidAncestorHeader = sdkerrors.Register(ModuleName, 1105, "no valid ancestor for this header") - ErrForkNotFound = sdkerrors.Register(ModuleName, 1106, "cannot find fork") - ErrInvalidForks = sdkerrors.Register(ModuleName, 1107, "input forks is invalid") - ErrChainInfoNotFound = sdkerrors.Register(ModuleName, 1108, "no chain info exists") - ErrEpochChainInfoNotFound = sdkerrors.Register(ModuleName, 1109, "no chain info exists at this epoch") - ErrEpochHeadersNotFound = sdkerrors.Register(ModuleName, 1110, "no timestamped header exists at this epoch") - ErrFinalizedEpochNotFound = sdkerrors.Register(ModuleName, 1111, "cannot find a finalized epoch") - ErrInvalidProofEpochSealed = sdkerrors.Register(ModuleName, 1112, "invalid ProofEpochSealed") - ErrInvalidMerkleProof = sdkerrors.Register(ModuleName, 1113, "invalid Merkle inclusion proof") - ErrInvalidChainInfo = sdkerrors.Register(ModuleName, 1114, "invalid chain info") + ErrSample = errorsmod.Register(ModuleName, 1100, "sample error") + ErrInvalidPacketTimeout = errorsmod.Register(ModuleName, 1101, "invalid packet timeout") + ErrInvalidVersion = errorsmod.Register(ModuleName, 1102, "invalid version") + ErrHeaderNotFound = errorsmod.Register(ModuleName, 1103, "no header exists at this height") + ErrInvalidHeader = errorsmod.Register(ModuleName, 1104, "input header is invalid") + ErrNoValidAncestorHeader = errorsmod.Register(ModuleName, 1105, "no valid ancestor for this header") + ErrForkNotFound = errorsmod.Register(ModuleName, 1106, "cannot find fork") + ErrInvalidForks = errorsmod.Register(ModuleName, 1107, "input forks is invalid") + ErrChainInfoNotFound = errorsmod.Register(ModuleName, 1108, "no chain info exists") + ErrEpochChainInfoNotFound = errorsmod.Register(ModuleName, 1109, "no chain info exists at this epoch") + ErrEpochHeadersNotFound = errorsmod.Register(ModuleName, 1110, "no timestamped header exists at this epoch") + ErrFinalizedEpochNotFound = errorsmod.Register(ModuleName, 1111, "cannot find a finalized epoch") + ErrInvalidProofEpochSealed = errorsmod.Register(ModuleName, 1112, "invalid ProofEpochSealed") + ErrInvalidMerkleProof = errorsmod.Register(ModuleName, 1113, "invalid Merkle inclusion proof") + ErrInvalidChainInfo = errorsmod.Register(ModuleName, 1114, "invalid chain info") + ErrInvalidChainIDs = errorsmod.Register(ModuleName, 1115, "chain ids contain duplicates or empty strings") ) diff --git a/x/zoneconcierge/types/expected_keepers.go b/x/zoneconcierge/types/expected_keepers.go index 190f1daaf..42d9701b1 100644 --- a/x/zoneconcierge/types/expected_keepers.go +++ b/x/zoneconcierge/types/expected_keepers.go @@ -3,17 +3,19 @@ package types import ( context "context" + clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" + btcctypes "github.com/babylonchain/babylon/x/btccheckpoint/types" checkpointingtypes "github.com/babylonchain/babylon/x/checkpointing/types" epochingtypes "github.com/babylonchain/babylon/x/epoching/types" + tmcrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + ctypes "github.com/cometbft/cometbft/rpc/core/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - connectiontypes "github.com/cosmos/ibc-go/v5/modules/core/03-connection/types" - channeltypes "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - ibcexported "github.com/cosmos/ibc-go/v5/modules/core/exported" - tmcrypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - ctypes "github.com/tendermint/tendermint/rpc/core/types" + connectiontypes "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" ) // AccountKeeper defines the contract required for account APIs. @@ -34,7 +36,15 @@ type BankKeeper interface { // ICS4Wrapper defines the expected ICS4Wrapper for middleware type ICS4Wrapper interface { - SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet ibcexported.PacketI) error + SendPacket( + ctx sdk.Context, + channelCap *capabilitytypes.Capability, + sourcePort string, + sourceChannel string, + timeoutHeight clienttypes.Height, + timeoutTimestamp uint64, + data []byte, + ) (uint64, error) } // ChannelKeeper defines the expected IBC channel keeper diff --git a/x/zoneconcierge/types/genesis.go b/x/zoneconcierge/types/genesis.go index 53e808b94..5bd0f2ea7 100644 --- a/x/zoneconcierge/types/genesis.go +++ b/x/zoneconcierge/types/genesis.go @@ -1,7 +1,7 @@ package types import ( - host "github.com/cosmos/ibc-go/v5/modules/core/24-host" + host "github.com/cosmos/ibc-go/v7/modules/core/24-host" ) // DefaultIndex is the default global index @@ -11,7 +11,6 @@ const DefaultIndex uint64 = 1 func DefaultGenesis() *GenesisState { return &GenesisState{ PortId: PortID, - Params: DefaultParams(), } } @@ -21,6 +20,5 @@ func (gs GenesisState) Validate() error { if err := host.PortIdentifierValidator(gs.PortId); err != nil { return err } - - return gs.Params.Validate() + return nil } diff --git a/x/zoneconcierge/types/genesis.pb.go b/x/zoneconcierge/types/genesis.pb.go index a71d4ff3d..67c72b428 100644 --- a/x/zoneconcierge/types/genesis.pb.go +++ b/x/zoneconcierge/types/genesis.pb.go @@ -1,12 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/zoneconcierge/genesis.proto +// source: babylon/zoneconcierge/v1/genesis.proto package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -25,15 +24,14 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the zoneconcierge module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - PortId string `protobuf:"bytes,2,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` + PortId string `protobuf:"bytes,1,opt,name=port_id,json=portId,proto3" json:"port_id,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_d7b9195ea3db0fdd, []int{0} + return fileDescriptor_56f290ad7c2c7dc7, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -62,13 +60,6 @@ func (m *GenesisState) XXX_DiscardUnknown() { var xxx_messageInfo_GenesisState proto.InternalMessageInfo -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - func (m *GenesisState) GetPortId() string { if m != nil { return m.PortId @@ -81,26 +72,22 @@ func init() { } func init() { - proto.RegisterFile("babylon/zoneconcierge/genesis.proto", fileDescriptor_d7b9195ea3db0fdd) + proto.RegisterFile("babylon/zoneconcierge/v1/genesis.proto", fileDescriptor_56f290ad7c2c7dc7) } -var fileDescriptor_d7b9195ea3db0fdd = []byte{ - // 225 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4e, 0x4a, 0x4c, 0xaa, +var fileDescriptor_56f290ad7c2c7dc7 = []byte{ + // 173 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4b, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0xaf, 0xca, 0xcf, 0x4b, 0x4d, 0xce, 0xcf, 0x4b, 0xce, 0x4c, 0x2d, 0x4a, - 0x4f, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, - 0x92, 0x80, 0x2a, 0xd2, 0x43, 0x51, 0xa4, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, - 0x56, 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x4b, 0x29, 0x61, 0x37, 0xb4, 0x20, 0xb1, 0x28, 0x31, 0x17, - 0x6a, 0xa6, 0x52, 0x3a, 0x17, 0x8f, 0x3b, 0xc4, 0x92, 0xe0, 0x92, 0xc4, 0x92, 0x54, 0x21, 0x3b, - 0x2e, 0x36, 0x88, 0xbc, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x82, 0x1e, 0x2e, 0x4b, 0xf5, - 0x02, 0xc0, 0xea, 0x9c, 0x58, 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0xea, 0x12, 0x12, 0xe7, 0x62, - 0x2f, 0xc8, 0x2f, 0x2a, 0x89, 0xcf, 0x4c, 0x91, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x0c, 0x62, 0x03, - 0x71, 0x3d, 0x53, 0x9c, 0xfc, 0x4f, 0x3c, 0x92, 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, - 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, - 0x34, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, 0x39, 0x3f, 0x57, 0x1f, 0x6a, 0x59, 0x72, 0x46, - 0x62, 0x66, 0x1e, 0x8c, 0xa3, 0x5f, 0x81, 0xe6, 0x81, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, - 0xb0, 0x07, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xc4, 0xfa, 0x5c, 0xd5, 0x3b, 0x01, 0x00, - 0x00, + 0x4f, 0xd5, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0x92, 0x80, 0xaa, 0xd3, 0x43, 0x51, 0xa7, 0x57, 0x66, 0xa8, 0xa4, 0xce, 0xc5, + 0xe3, 0x0e, 0x51, 0x1a, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x24, 0xce, 0xc5, 0x5e, 0x90, 0x5f, 0x54, + 0x12, 0x9f, 0x99, 0x22, 0xc1, 0xa8, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x06, 0xe2, 0x7a, 0xa6, 0x38, + 0xf9, 0x9f, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, + 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x69, 0x7a, 0x66, 0x49, + 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x9e, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x18, + 0x47, 0xbf, 0x02, 0xcd, 0x79, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0x60, 0xa7, 0x19, 0x03, + 0x02, 0x00, 0x00, 0xff, 0xff, 0x7f, 0x84, 0xa6, 0xb1, 0xc4, 0x00, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -128,18 +115,8 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.PortId) i = encodeVarintGenesis(dAtA, i, uint64(len(m.PortId))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0xa } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -160,8 +137,6 @@ func (m *GenesisState) Size() (n int) { } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) l = len(m.PortId) if l > 0 { n += 1 + l + sovGenesis(uint64(l)) @@ -205,39 +180,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field PortId", wireType) } diff --git a/x/zoneconcierge/types/mocked_keepers.go b/x/zoneconcierge/types/mocked_keepers.go index d58c82a20..1e3dbed9d 100644 --- a/x/zoneconcierge/types/mocked_keepers.go +++ b/x/zoneconcierge/types/mocked_keepers.go @@ -14,12 +14,12 @@ import ( types2 "github.com/cosmos/cosmos-sdk/types" types3 "github.com/cosmos/cosmos-sdk/x/auth/types" types4 "github.com/cosmos/cosmos-sdk/x/capability/types" - types5 "github.com/cosmos/ibc-go/v5/modules/core/03-connection/types" - types6 "github.com/cosmos/ibc-go/v5/modules/core/04-channel/types" - exported "github.com/cosmos/ibc-go/v5/modules/core/exported" + types5 "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" + types6 "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + exported "github.com/cosmos/ibc-go/v7/modules/core/exported" gomock "github.com/golang/mock/gomock" - crypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - coretypes "github.com/tendermint/tendermint/rpc/core/types" + crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + coretypes "github.com/cometbft/cometbft/rpc/core/types" ) // MockAccountKeeper is a mock of AccountKeeper interface. diff --git a/x/zoneconcierge/types/packet.pb.go b/x/zoneconcierge/types/packet.pb.go index 9db34cfb5..1f2bb92a2 100644 --- a/x/zoneconcierge/types/packet.pb.go +++ b/x/zoneconcierge/types/packet.pb.go @@ -1,11 +1,11 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/zoneconcierge/packet.proto +// source: babylon/zoneconcierge/v1/packet.proto package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -22,8 +22,13 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// ZoneconciergePacketData is the message that defines the IBC packets of +// ZoneConcierge type ZoneconciergePacketData struct { + // packet is the actual message carried in the IBC packet + // // Types that are valid to be assigned to Packet: + // // *ZoneconciergePacketData_Heartbeart Packet isZoneconciergePacketData_Packet `protobuf_oneof:"packet"` } @@ -32,7 +37,7 @@ func (m *ZoneconciergePacketData) Reset() { *m = ZoneconciergePacketData func (m *ZoneconciergePacketData) String() string { return proto.CompactTextString(m) } func (*ZoneconciergePacketData) ProtoMessage() {} func (*ZoneconciergePacketData) Descriptor() ([]byte, []int) { - return fileDescriptor_40e046ee0bdbe2bf, []int{0} + return fileDescriptor_be12e124c5c4fdb9, []int{0} } func (m *ZoneconciergePacketData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -94,6 +99,8 @@ func (*ZoneconciergePacketData) XXX_OneofWrappers() []interface{} { } } +// Heartbeat is a heartbeat message that can be carried in IBC packets of +// ZoneConcierge type Heartbeat struct { Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"` } @@ -102,7 +109,7 @@ func (m *Heartbeat) Reset() { *m = Heartbeat{} } func (m *Heartbeat) String() string { return proto.CompactTextString(m) } func (*Heartbeat) ProtoMessage() {} func (*Heartbeat) Descriptor() ([]byte, []int) { - return fileDescriptor_40e046ee0bdbe2bf, []int{1} + return fileDescriptor_be12e124c5c4fdb9, []int{1} } func (m *Heartbeat) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -144,24 +151,25 @@ func init() { } func init() { - proto.RegisterFile("babylon/zoneconcierge/packet.proto", fileDescriptor_40e046ee0bdbe2bf) + proto.RegisterFile("babylon/zoneconcierge/v1/packet.proto", fileDescriptor_be12e124c5c4fdb9) } -var fileDescriptor_40e046ee0bdbe2bf = []byte{ - // 206 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, +var fileDescriptor_be12e124c5c4fdb9 = []byte{ + // 209 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4d, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0xaf, 0xca, 0xcf, 0x4b, 0x4d, 0xce, 0xcf, 0x4b, 0xce, 0x4c, 0x2d, 0x4a, - 0x4f, 0xd5, 0x2f, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, - 0x80, 0xaa, 0xd1, 0x43, 0x51, 0xa3, 0x57, 0x66, 0xa8, 0x94, 0xc5, 0x25, 0x1e, 0x85, 0x2c, 0x16, - 0x00, 0xd6, 0xe6, 0x92, 0x58, 0x92, 0x28, 0xe4, 0xca, 0xc5, 0x95, 0x91, 0x9a, 0x58, 0x54, 0x92, - 0x04, 0x22, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x94, 0xf5, 0x70, 0x99, 0xa4, 0xe7, 0x01, - 0x55, 0x5b, 0xe2, 0xc1, 0x10, 0x84, 0xa4, 0xd1, 0x89, 0x83, 0x8b, 0x0d, 0xe2, 0x16, 0x25, 0x59, - 0x2e, 0x4e, 0xb8, 0x22, 0x21, 0x01, 0x2e, 0xe6, 0xdc, 0xe2, 0x74, 0xb0, 0xb1, 0x9c, 0x41, 0x20, - 0xa6, 0x93, 0xff, 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, 0x99, 0xa6, 0x67, - 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xed, 0x4f, 0xce, 0x48, 0xcc, 0xcc, - 0x83, 0x71, 0xf4, 0x2b, 0xd0, 0x3c, 0x5f, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xbc, - 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xbf, 0xc2, 0x16, 0x4a, 0x22, 0x01, 0x00, 0x00, + 0x4f, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x4c, 0xce, 0x4e, 0x2d, 0xd1, 0x2b, 0x28, 0xca, 0x2f, + 0xc9, 0x17, 0x92, 0x80, 0x2a, 0xd3, 0x43, 0x51, 0xa6, 0x57, 0x66, 0xa8, 0x94, 0xc5, 0x25, 0x1e, + 0x85, 0x2c, 0x16, 0x00, 0xd6, 0xe6, 0x92, 0x58, 0x92, 0x28, 0xe4, 0xca, 0xc5, 0x95, 0x91, 0x9a, + 0x58, 0x54, 0x92, 0x04, 0x22, 0x24, 0x18, 0x15, 0x18, 0x35, 0xb8, 0x8d, 0x94, 0xf5, 0x70, 0x99, + 0xa4, 0xe7, 0x01, 0x55, 0x5b, 0xe2, 0xc1, 0x10, 0x84, 0xa4, 0xd1, 0x89, 0x83, 0x8b, 0x0d, 0xe2, + 0x16, 0x25, 0x59, 0x2e, 0x4e, 0xb8, 0x22, 0x21, 0x01, 0x2e, 0xe6, 0xdc, 0xe2, 0x74, 0xb0, 0xb1, + 0x9c, 0x41, 0x20, 0xa6, 0x93, 0xff, 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, + 0x99, 0xa6, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x43, 0xed, 0x4f, 0xce, + 0x48, 0xcc, 0xcc, 0x83, 0x71, 0xf4, 0x2b, 0xd0, 0xfc, 0x5f, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, + 0x06, 0xf6, 0xbc, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0xe0, 0xc6, 0x63, 0x3e, 0x25, 0x01, 0x00, + 0x00, } func (m *ZoneconciergePacketData) Marshal() (dAtA []byte, err error) { diff --git a/x/zoneconcierge/types/params.go b/x/zoneconcierge/types/params.go deleted file mode 100644 index 357196ad6..000000000 --- a/x/zoneconcierge/types/params.go +++ /dev/null @@ -1,39 +0,0 @@ -package types - -import ( - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -// NewParams creates a new Params instance -func NewParams() Params { - return Params{} -} - -// DefaultParams returns a default set of parameters -func DefaultParams() Params { - return NewParams() -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{} -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, _ := yaml.Marshal(p) - return string(out) -} diff --git a/x/zoneconcierge/types/params.pb.go b/x/zoneconcierge/types/params.pb.go deleted file mode 100644 index f361d64dc..000000000 --- a/x/zoneconcierge/types/params.pb.go +++ /dev/null @@ -1,266 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/zoneconcierge/params.proto - -package types - -import ( - fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Params defines the parameters for the module. -type Params struct { -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_3c5b947078cec19b, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func init() { - proto.RegisterType((*Params)(nil), "babylon.zoneconcierge.v1.Params") -} - -func init() { - proto.RegisterFile("babylon/zoneconcierge/params.proto", fileDescriptor_3c5b947078cec19b) -} - -var fileDescriptor_3c5b947078cec19b = []byte{ - // 160 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4a, 0x4a, 0x4c, 0xaa, - 0xcc, 0xc9, 0xcf, 0xd3, 0xaf, 0xca, 0xcf, 0x4b, 0x4d, 0xce, 0xcf, 0x4b, 0xce, 0x4c, 0x2d, 0x4a, - 0x4f, 0xd5, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, - 0x80, 0xaa, 0xd1, 0x43, 0x51, 0xa3, 0x57, 0x66, 0x28, 0x25, 0x92, 0x9e, 0x9f, 0x9e, 0x0f, 0x56, - 0xa4, 0x0f, 0x62, 0x41, 0xd4, 0x2b, 0xf1, 0x71, 0xb1, 0x05, 0x80, 0xf5, 0x5b, 0xb1, 0xcc, 0x58, - 0x20, 0xcf, 0xe0, 0xe4, 0x7f, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, - 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xa6, - 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0x4b, 0x92, 0x33, 0x12, - 0x33, 0xf3, 0x60, 0x1c, 0xfd, 0x0a, 0x34, 0x77, 0x95, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, - 0xed, 0x31, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x43, 0xb4, 0x76, 0x93, 0xbd, 0x00, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowParams - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/zoneconcierge/types/query.pb.go b/x/zoneconcierge/types/query.pb.go index aa2c0e391..fa90d6a3d 100644 --- a/x/zoneconcierge/types/query.pb.go +++ b/x/zoneconcierge/types/query.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/zoneconcierge/query.proto +// source: babylon/zoneconcierge/v1/query.proto package types @@ -10,9 +10,8 @@ import ( types1 "github.com/babylonchain/babylon/x/checkpointing/types" types "github.com/babylonchain/babylon/x/epoching/types" query "github.com/cosmos/cosmos-sdk/types/query" - _ "github.com/gogo/protobuf/gogoproto" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -33,89 +32,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// QueryParamsRequest is request type for the Query/Params RPC method. -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{0} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{1} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - // QueryHeaderRequest is request type for the Query/Header RPC method. type QueryHeaderRequest struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -126,7 +42,7 @@ func (m *QueryHeaderRequest) Reset() { *m = QueryHeaderRequest{} } func (m *QueryHeaderRequest) String() string { return proto.CompactTextString(m) } func (*QueryHeaderRequest) ProtoMessage() {} func (*QueryHeaderRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{2} + return fileDescriptor_cd665af90102da38, []int{0} } func (m *QueryHeaderRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -169,7 +85,7 @@ func (m *QueryHeaderRequest) GetHeight() uint64 { return 0 } -// QueryParamsResponse is response type for the Query/Header RPC method. +// QueryHeaderResponse is response type for the Query/Header RPC method. type QueryHeaderResponse struct { Header *IndexedHeader `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` ForkHeaders *Forks `protobuf:"bytes,2,opt,name=fork_headers,json=forkHeaders,proto3" json:"fork_headers,omitempty"` @@ -179,7 +95,7 @@ func (m *QueryHeaderResponse) Reset() { *m = QueryHeaderResponse{} } func (m *QueryHeaderResponse) String() string { return proto.CompactTextString(m) } func (*QueryHeaderResponse) ProtoMessage() {} func (*QueryHeaderResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{3} + return fileDescriptor_cd665af90102da38, []int{1} } func (m *QueryHeaderResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -232,7 +148,7 @@ func (m *QueryChainListRequest) Reset() { *m = QueryChainListRequest{} } func (m *QueryChainListRequest) String() string { return proto.CompactTextString(m) } func (*QueryChainListRequest) ProtoMessage() {} func (*QueryChainListRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{4} + return fileDescriptor_cd665af90102da38, []int{2} } func (m *QueryChainListRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -280,7 +196,7 @@ func (m *QueryChainListResponse) Reset() { *m = QueryChainListResponse{} func (m *QueryChainListResponse) String() string { return proto.CompactTextString(m) } func (*QueryChainListResponse) ProtoMessage() {} func (*QueryChainListResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{5} + return fileDescriptor_cd665af90102da38, []int{3} } func (m *QueryChainListResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -323,23 +239,23 @@ func (m *QueryChainListResponse) GetPagination() *query.PageResponse { return nil } -// QueryChainInfoRequest is request type for the Query/ChainInfo RPC method. -type QueryChainInfoRequest struct { - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +// QueryChainsInfoRequest is request type for the Query/ChainsInfo RPC method. +type QueryChainsInfoRequest struct { + ChainIds []string `protobuf:"bytes,1,rep,name=chain_ids,json=chainIds,proto3" json:"chain_ids,omitempty"` } -func (m *QueryChainInfoRequest) Reset() { *m = QueryChainInfoRequest{} } -func (m *QueryChainInfoRequest) String() string { return proto.CompactTextString(m) } -func (*QueryChainInfoRequest) ProtoMessage() {} -func (*QueryChainInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{6} +func (m *QueryChainsInfoRequest) Reset() { *m = QueryChainsInfoRequest{} } +func (m *QueryChainsInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryChainsInfoRequest) ProtoMessage() {} +func (*QueryChainsInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_cd665af90102da38, []int{4} } -func (m *QueryChainInfoRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryChainsInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryChainsInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryChainInfoRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryChainsInfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -349,43 +265,42 @@ func (m *QueryChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *QueryChainInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChainInfoRequest.Merge(m, src) +func (m *QueryChainsInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChainsInfoRequest.Merge(m, src) } -func (m *QueryChainInfoRequest) XXX_Size() int { +func (m *QueryChainsInfoRequest) XXX_Size() int { return m.Size() } -func (m *QueryChainInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChainInfoRequest.DiscardUnknown(m) +func (m *QueryChainsInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChainsInfoRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryChainInfoRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryChainsInfoRequest proto.InternalMessageInfo -func (m *QueryChainInfoRequest) GetChainId() string { +func (m *QueryChainsInfoRequest) GetChainIds() []string { if m != nil { - return m.ChainId + return m.ChainIds } - return "" + return nil } -// QueryChainInfoResponse is response type for the Query/ChainInfo RPC method. -type QueryChainInfoResponse struct { - // chain_info is the info of the CZ - ChainInfo *ChainInfo `protobuf:"bytes,1,opt,name=chain_info,json=chainInfo,proto3" json:"chain_info,omitempty"` +// QueryChainsInfoResponse is response type for the Query/ChainsInfo RPC method. +type QueryChainsInfoResponse struct { + ChainsInfo []*ChainInfo `protobuf:"bytes,1,rep,name=chains_info,json=chainsInfo,proto3" json:"chains_info,omitempty"` } -func (m *QueryChainInfoResponse) Reset() { *m = QueryChainInfoResponse{} } -func (m *QueryChainInfoResponse) String() string { return proto.CompactTextString(m) } -func (*QueryChainInfoResponse) ProtoMessage() {} -func (*QueryChainInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{7} +func (m *QueryChainsInfoResponse) Reset() { *m = QueryChainsInfoResponse{} } +func (m *QueryChainsInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryChainsInfoResponse) ProtoMessage() {} +func (*QueryChainsInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd665af90102da38, []int{5} } -func (m *QueryChainInfoResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryChainsInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryChainsInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryChainInfoResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryChainsInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -395,43 +310,44 @@ func (m *QueryChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *QueryChainInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryChainInfoResponse.Merge(m, src) +func (m *QueryChainsInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryChainsInfoResponse.Merge(m, src) } -func (m *QueryChainInfoResponse) XXX_Size() int { +func (m *QueryChainsInfoResponse) XXX_Size() int { return m.Size() } -func (m *QueryChainInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryChainInfoResponse.DiscardUnknown(m) +func (m *QueryChainsInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryChainsInfoResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryChainInfoResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryChainsInfoResponse proto.InternalMessageInfo -func (m *QueryChainInfoResponse) GetChainInfo() *ChainInfo { +func (m *QueryChainsInfoResponse) GetChainsInfo() []*ChainInfo { if m != nil { - return m.ChainInfo + return m.ChainsInfo } return nil } -// QueryEpochChainInfoRequest is request type for the Query/EpochChainInfo RPC method. -type QueryEpochChainInfoRequest struct { - EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` - ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +// QueryEpochChainsInfoRequest is request type for the Query/EpochChainsInfo RPC +// method. +type QueryEpochChainsInfoRequest struct { + EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` + ChainIds []string `protobuf:"bytes,2,rep,name=chain_ids,json=chainIds,proto3" json:"chain_ids,omitempty"` } -func (m *QueryEpochChainInfoRequest) Reset() { *m = QueryEpochChainInfoRequest{} } -func (m *QueryEpochChainInfoRequest) String() string { return proto.CompactTextString(m) } -func (*QueryEpochChainInfoRequest) ProtoMessage() {} -func (*QueryEpochChainInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{8} +func (m *QueryEpochChainsInfoRequest) Reset() { *m = QueryEpochChainsInfoRequest{} } +func (m *QueryEpochChainsInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryEpochChainsInfoRequest) ProtoMessage() {} +func (*QueryEpochChainsInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_cd665af90102da38, []int{6} } -func (m *QueryEpochChainInfoRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryEpochChainsInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryEpochChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryEpochChainsInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryEpochChainInfoRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryEpochChainsInfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -441,50 +357,51 @@ func (m *QueryEpochChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *QueryEpochChainInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEpochChainInfoRequest.Merge(m, src) +func (m *QueryEpochChainsInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochChainsInfoRequest.Merge(m, src) } -func (m *QueryEpochChainInfoRequest) XXX_Size() int { +func (m *QueryEpochChainsInfoRequest) XXX_Size() int { return m.Size() } -func (m *QueryEpochChainInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEpochChainInfoRequest.DiscardUnknown(m) +func (m *QueryEpochChainsInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochChainsInfoRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryEpochChainInfoRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryEpochChainsInfoRequest proto.InternalMessageInfo -func (m *QueryEpochChainInfoRequest) GetEpochNum() uint64 { +func (m *QueryEpochChainsInfoRequest) GetEpochNum() uint64 { if m != nil { return m.EpochNum } return 0 } -func (m *QueryEpochChainInfoRequest) GetChainId() string { +func (m *QueryEpochChainsInfoRequest) GetChainIds() []string { if m != nil { - return m.ChainId + return m.ChainIds } - return "" + return nil } -// QueryEpochChainInfoResponse is response type for the Query/EpochChainInfo RPC method. -type QueryEpochChainInfoResponse struct { +// QueryEpochChainsInfoResponse is response type for the Query/EpochChainsInfo RPC +// method. +type QueryEpochChainsInfoResponse struct { // chain_info is the info of the CZ - ChainInfo *ChainInfo `protobuf:"bytes,1,opt,name=chain_info,json=chainInfo,proto3" json:"chain_info,omitempty"` + ChainsInfo []*ChainInfo `protobuf:"bytes,1,rep,name=chains_info,json=chainsInfo,proto3" json:"chains_info,omitempty"` } -func (m *QueryEpochChainInfoResponse) Reset() { *m = QueryEpochChainInfoResponse{} } -func (m *QueryEpochChainInfoResponse) String() string { return proto.CompactTextString(m) } -func (*QueryEpochChainInfoResponse) ProtoMessage() {} -func (*QueryEpochChainInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{9} +func (m *QueryEpochChainsInfoResponse) Reset() { *m = QueryEpochChainsInfoResponse{} } +func (m *QueryEpochChainsInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryEpochChainsInfoResponse) ProtoMessage() {} +func (*QueryEpochChainsInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd665af90102da38, []int{7} } -func (m *QueryEpochChainInfoResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryEpochChainsInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryEpochChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryEpochChainsInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryEpochChainInfoResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryEpochChainsInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -494,21 +411,21 @@ func (m *QueryEpochChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *QueryEpochChainInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryEpochChainInfoResponse.Merge(m, src) +func (m *QueryEpochChainsInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryEpochChainsInfoResponse.Merge(m, src) } -func (m *QueryEpochChainInfoResponse) XXX_Size() int { +func (m *QueryEpochChainsInfoResponse) XXX_Size() int { return m.Size() } -func (m *QueryEpochChainInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryEpochChainInfoResponse.DiscardUnknown(m) +func (m *QueryEpochChainsInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryEpochChainsInfoResponse.DiscardUnknown(m) } -var xxx_messageInfo_QueryEpochChainInfoResponse proto.InternalMessageInfo +var xxx_messageInfo_QueryEpochChainsInfoResponse proto.InternalMessageInfo -func (m *QueryEpochChainInfoResponse) GetChainInfo() *ChainInfo { +func (m *QueryEpochChainsInfoResponse) GetChainsInfo() []*ChainInfo { if m != nil { - return m.ChainInfo + return m.ChainsInfo } return nil } @@ -524,7 +441,7 @@ func (m *QueryListHeadersRequest) Reset() { *m = QueryListHeadersRequest func (m *QueryListHeadersRequest) String() string { return proto.CompactTextString(m) } func (*QueryListHeadersRequest) ProtoMessage() {} func (*QueryListHeadersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{10} + return fileDescriptor_cd665af90102da38, []int{8} } func (m *QueryListHeadersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -567,7 +484,8 @@ func (m *QueryListHeadersRequest) GetPagination() *query.PageRequest { return nil } -// QueryListHeadersResponse is response type for the Query/ListHeaders RPC method. +// QueryListHeadersResponse is response type for the Query/ListHeaders RPC +// method. type QueryListHeadersResponse struct { // headers is the list of headers Headers []*IndexedHeader `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` @@ -579,7 +497,7 @@ func (m *QueryListHeadersResponse) Reset() { *m = QueryListHeadersRespon func (m *QueryListHeadersResponse) String() string { return proto.CompactTextString(m) } func (*QueryListHeadersResponse) ProtoMessage() {} func (*QueryListHeadersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{11} + return fileDescriptor_cd665af90102da38, []int{9} } func (m *QueryListHeadersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -622,7 +540,8 @@ func (m *QueryListHeadersResponse) GetPagination() *query.PageResponse { return nil } -// QueryListEpochHeadersRequest is request type for the Query/ListEpochHeaders RPC method. +// QueryListEpochHeadersRequest is request type for the Query/ListEpochHeaders +// RPC method. type QueryListEpochHeadersRequest struct { EpochNum uint64 `protobuf:"varint,1,opt,name=epoch_num,json=epochNum,proto3" json:"epoch_num,omitempty"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` @@ -632,7 +551,7 @@ func (m *QueryListEpochHeadersRequest) Reset() { *m = QueryListEpochHead func (m *QueryListEpochHeadersRequest) String() string { return proto.CompactTextString(m) } func (*QueryListEpochHeadersRequest) ProtoMessage() {} func (*QueryListEpochHeadersRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{12} + return fileDescriptor_cd665af90102da38, []int{10} } func (m *QueryListEpochHeadersRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -675,7 +594,8 @@ func (m *QueryListEpochHeadersRequest) GetChainId() string { return "" } -// QueryListEpochHeadersResponse is response type for the Query/ListEpochHeaders RPC method. +// QueryListEpochHeadersResponse is response type for the Query/ListEpochHeaders +// RPC method. type QueryListEpochHeadersResponse struct { // headers is the list of headers Headers []*IndexedHeader `protobuf:"bytes,1,rep,name=headers,proto3" json:"headers,omitempty"` @@ -685,7 +605,7 @@ func (m *QueryListEpochHeadersResponse) Reset() { *m = QueryListEpochHea func (m *QueryListEpochHeadersResponse) String() string { return proto.CompactTextString(m) } func (*QueryListEpochHeadersResponse) ProtoMessage() {} func (*QueryListEpochHeadersResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{13} + return fileDescriptor_cd665af90102da38, []int{11} } func (m *QueryListEpochHeadersResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -721,26 +641,27 @@ func (m *QueryListEpochHeadersResponse) GetHeaders() []*IndexedHeader { return nil } -// QueryFinalizedChainInfoRequest is request type for the Query/FinalizedChainInfo RPC method. -type QueryFinalizedChainInfoRequest struct { - // chain_id is the ID of the CZ - ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +// QueryFinalizedChainsInfoRequest is request type for the +// Query/FinalizedChainsInfo RPC method. +type QueryFinalizedChainsInfoRequest struct { + // chain_ids is the list of ids of CZs + ChainIds []string `protobuf:"bytes,1,rep,name=chain_ids,json=chainIds,proto3" json:"chain_ids,omitempty"` // prove indicates whether the querier wants to get proofs of this timestamp Prove bool `protobuf:"varint,2,opt,name=prove,proto3" json:"prove,omitempty"` } -func (m *QueryFinalizedChainInfoRequest) Reset() { *m = QueryFinalizedChainInfoRequest{} } -func (m *QueryFinalizedChainInfoRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFinalizedChainInfoRequest) ProtoMessage() {} -func (*QueryFinalizedChainInfoRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{14} +func (m *QueryFinalizedChainsInfoRequest) Reset() { *m = QueryFinalizedChainsInfoRequest{} } +func (m *QueryFinalizedChainsInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryFinalizedChainsInfoRequest) ProtoMessage() {} +func (*QueryFinalizedChainsInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_cd665af90102da38, []int{12} } -func (m *QueryFinalizedChainInfoRequest) XXX_Unmarshal(b []byte) error { +func (m *QueryFinalizedChainsInfoRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFinalizedChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryFinalizedChainsInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFinalizedChainInfoRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryFinalizedChainsInfoRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -750,58 +671,50 @@ func (m *QueryFinalizedChainInfoRequest) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *QueryFinalizedChainInfoRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFinalizedChainInfoRequest.Merge(m, src) +func (m *QueryFinalizedChainsInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFinalizedChainsInfoRequest.Merge(m, src) } -func (m *QueryFinalizedChainInfoRequest) XXX_Size() int { +func (m *QueryFinalizedChainsInfoRequest) XXX_Size() int { return m.Size() } -func (m *QueryFinalizedChainInfoRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFinalizedChainInfoRequest.DiscardUnknown(m) +func (m *QueryFinalizedChainsInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFinalizedChainsInfoRequest.DiscardUnknown(m) } -var xxx_messageInfo_QueryFinalizedChainInfoRequest proto.InternalMessageInfo +var xxx_messageInfo_QueryFinalizedChainsInfoRequest proto.InternalMessageInfo -func (m *QueryFinalizedChainInfoRequest) GetChainId() string { +func (m *QueryFinalizedChainsInfoRequest) GetChainIds() []string { if m != nil { - return m.ChainId + return m.ChainIds } - return "" + return nil } -func (m *QueryFinalizedChainInfoRequest) GetProve() bool { +func (m *QueryFinalizedChainsInfoRequest) GetProve() bool { if m != nil { return m.Prove } return false } -// QueryFinalizedChainInfoResponse is response type for the Query/FinalizedChainInfo RPC method. -type QueryFinalizedChainInfoResponse struct { - // finalized_chain_info is the info of the CZ - FinalizedChainInfo *ChainInfo `protobuf:"bytes,1,opt,name=finalized_chain_info,json=finalizedChainInfo,proto3" json:"finalized_chain_info,omitempty"` - // epoch_info is the metadata of the last BTC-finalised epoch - EpochInfo *types.Epoch `protobuf:"bytes,2,opt,name=epoch_info,json=epochInfo,proto3" json:"epoch_info,omitempty"` - // raw_checkpoint is the raw checkpoint of this epoch - RawCheckpoint *types1.RawCheckpoint `protobuf:"bytes,3,opt,name=raw_checkpoint,json=rawCheckpoint,proto3" json:"raw_checkpoint,omitempty"` - // btc_submission_key is position of two BTC txs that include the raw checkpoint of this epoch - BtcSubmissionKey *types2.SubmissionKey `protobuf:"bytes,4,opt,name=btc_submission_key,json=btcSubmissionKey,proto3" json:"btc_submission_key,omitempty"` - // proof is the proof that the chain info is finalized - Proof *ProofFinalizedChainInfo `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` +// QueryFinalizedChainsInfoResponse is response type for the +// Query/FinalizedChainsInfo RPC method. +type QueryFinalizedChainsInfoResponse struct { + FinalizedChainsInfo []*FinalizedChainInfo `protobuf:"bytes,1,rep,name=finalized_chains_info,json=finalizedChainsInfo,proto3" json:"finalized_chains_info,omitempty"` } -func (m *QueryFinalizedChainInfoResponse) Reset() { *m = QueryFinalizedChainInfoResponse{} } -func (m *QueryFinalizedChainInfoResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFinalizedChainInfoResponse) ProtoMessage() {} -func (*QueryFinalizedChainInfoResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{15} +func (m *QueryFinalizedChainsInfoResponse) Reset() { *m = QueryFinalizedChainsInfoResponse{} } +func (m *QueryFinalizedChainsInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryFinalizedChainsInfoResponse) ProtoMessage() {} +func (*QueryFinalizedChainsInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_cd665af90102da38, []int{13} } -func (m *QueryFinalizedChainInfoResponse) XXX_Unmarshal(b []byte) error { +func (m *QueryFinalizedChainsInfoResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *QueryFinalizedChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *QueryFinalizedChainsInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_QueryFinalizedChainInfoResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_QueryFinalizedChainsInfoResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -811,59 +724,33 @@ func (m *QueryFinalizedChainInfoResponse) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *QueryFinalizedChainInfoResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFinalizedChainInfoResponse.Merge(m, src) +func (m *QueryFinalizedChainsInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryFinalizedChainsInfoResponse.Merge(m, src) } -func (m *QueryFinalizedChainInfoResponse) XXX_Size() int { +func (m *QueryFinalizedChainsInfoResponse) XXX_Size() int { return m.Size() } -func (m *QueryFinalizedChainInfoResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFinalizedChainInfoResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFinalizedChainInfoResponse proto.InternalMessageInfo - -func (m *QueryFinalizedChainInfoResponse) GetFinalizedChainInfo() *ChainInfo { - if m != nil { - return m.FinalizedChainInfo - } - return nil -} - -func (m *QueryFinalizedChainInfoResponse) GetEpochInfo() *types.Epoch { - if m != nil { - return m.EpochInfo - } - return nil -} - -func (m *QueryFinalizedChainInfoResponse) GetRawCheckpoint() *types1.RawCheckpoint { - if m != nil { - return m.RawCheckpoint - } - return nil +func (m *QueryFinalizedChainsInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryFinalizedChainsInfoResponse.DiscardUnknown(m) } -func (m *QueryFinalizedChainInfoResponse) GetBtcSubmissionKey() *types2.SubmissionKey { - if m != nil { - return m.BtcSubmissionKey - } - return nil -} +var xxx_messageInfo_QueryFinalizedChainsInfoResponse proto.InternalMessageInfo -func (m *QueryFinalizedChainInfoResponse) GetProof() *ProofFinalizedChainInfo { +func (m *QueryFinalizedChainsInfoResponse) GetFinalizedChainsInfo() []*FinalizedChainInfo { if m != nil { - return m.Proof + return m.FinalizedChainsInfo } return nil } -// QueryFinalizedChainInfoUntilHeightRequest is request type for the Query/FinalizedChainInfoUntilHeight RPC method. +// QueryFinalizedChainInfoUntilHeightRequest is request type for the +// Query/FinalizedChainInfoUntilHeight RPC method. type QueryFinalizedChainInfoUntilHeightRequest struct { // chain_id is the ID of the CZ ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // height is the height of the CZ chain - // such that the returned finalised chain info will be no later than this height + // such that the returned finalised chain info will be no later than this + // height Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"` // prove indicates whether the querier wants to get proofs of this timestamp Prove bool `protobuf:"varint,3,opt,name=prove,proto3" json:"prove,omitempty"` @@ -877,7 +764,7 @@ func (m *QueryFinalizedChainInfoUntilHeightRequest) String() string { } func (*QueryFinalizedChainInfoUntilHeightRequest) ProtoMessage() {} func (*QueryFinalizedChainInfoUntilHeightRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{16} + return fileDescriptor_cd665af90102da38, []int{14} } func (m *QueryFinalizedChainInfoUntilHeightRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -927,7 +814,8 @@ func (m *QueryFinalizedChainInfoUntilHeightRequest) GetProve() bool { return false } -// QueryFinalizedChainInfoUntilHeightResponse is response type for the Query/FinalizedChainInfoUntilHeight RPC method. +// QueryFinalizedChainInfoUntilHeightResponse is response type for the +// Query/FinalizedChainInfoUntilHeight RPC method. type QueryFinalizedChainInfoUntilHeightResponse struct { // finalized_chain_info is the info of the CZ FinalizedChainInfo *ChainInfo `protobuf:"bytes,1,opt,name=finalized_chain_info,json=finalizedChainInfo,proto3" json:"finalized_chain_info,omitempty"` @@ -935,7 +823,8 @@ type QueryFinalizedChainInfoUntilHeightResponse struct { EpochInfo *types.Epoch `protobuf:"bytes,2,opt,name=epoch_info,json=epochInfo,proto3" json:"epoch_info,omitempty"` // raw_checkpoint is the raw checkpoint of this epoch RawCheckpoint *types1.RawCheckpoint `protobuf:"bytes,3,opt,name=raw_checkpoint,json=rawCheckpoint,proto3" json:"raw_checkpoint,omitempty"` - // btc_submission_key is position of two BTC txs that include the raw checkpoint of this epoch + // btc_submission_key is position of two BTC txs that include the raw + // checkpoint of this epoch BtcSubmissionKey *types2.SubmissionKey `protobuf:"bytes,4,opt,name=btc_submission_key,json=btcSubmissionKey,proto3" json:"btc_submission_key,omitempty"` // proof is the proof that the chain info is finalized Proof *ProofFinalizedChainInfo `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` @@ -949,7 +838,7 @@ func (m *QueryFinalizedChainInfoUntilHeightResponse) String() string { } func (*QueryFinalizedChainInfoUntilHeightResponse) ProtoMessage() {} func (*QueryFinalizedChainInfoUntilHeightResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_2caab7ee15063236, []int{17} + return fileDescriptor_cd665af90102da38, []int{15} } func (m *QueryFinalizedChainInfoUntilHeightResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1014,103 +903,99 @@ func (m *QueryFinalizedChainInfoUntilHeightResponse) GetProof() *ProofFinalizedC } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "babylon.zoneconcierge.v1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "babylon.zoneconcierge.v1.QueryParamsResponse") proto.RegisterType((*QueryHeaderRequest)(nil), "babylon.zoneconcierge.v1.QueryHeaderRequest") proto.RegisterType((*QueryHeaderResponse)(nil), "babylon.zoneconcierge.v1.QueryHeaderResponse") proto.RegisterType((*QueryChainListRequest)(nil), "babylon.zoneconcierge.v1.QueryChainListRequest") proto.RegisterType((*QueryChainListResponse)(nil), "babylon.zoneconcierge.v1.QueryChainListResponse") - proto.RegisterType((*QueryChainInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryChainInfoRequest") - proto.RegisterType((*QueryChainInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryChainInfoResponse") - proto.RegisterType((*QueryEpochChainInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryEpochChainInfoRequest") - proto.RegisterType((*QueryEpochChainInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryEpochChainInfoResponse") + proto.RegisterType((*QueryChainsInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryChainsInfoRequest") + proto.RegisterType((*QueryChainsInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryChainsInfoResponse") + proto.RegisterType((*QueryEpochChainsInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryEpochChainsInfoRequest") + proto.RegisterType((*QueryEpochChainsInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryEpochChainsInfoResponse") proto.RegisterType((*QueryListHeadersRequest)(nil), "babylon.zoneconcierge.v1.QueryListHeadersRequest") proto.RegisterType((*QueryListHeadersResponse)(nil), "babylon.zoneconcierge.v1.QueryListHeadersResponse") proto.RegisterType((*QueryListEpochHeadersRequest)(nil), "babylon.zoneconcierge.v1.QueryListEpochHeadersRequest") proto.RegisterType((*QueryListEpochHeadersResponse)(nil), "babylon.zoneconcierge.v1.QueryListEpochHeadersResponse") - proto.RegisterType((*QueryFinalizedChainInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryFinalizedChainInfoRequest") - proto.RegisterType((*QueryFinalizedChainInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryFinalizedChainInfoResponse") + proto.RegisterType((*QueryFinalizedChainsInfoRequest)(nil), "babylon.zoneconcierge.v1.QueryFinalizedChainsInfoRequest") + proto.RegisterType((*QueryFinalizedChainsInfoResponse)(nil), "babylon.zoneconcierge.v1.QueryFinalizedChainsInfoResponse") proto.RegisterType((*QueryFinalizedChainInfoUntilHeightRequest)(nil), "babylon.zoneconcierge.v1.QueryFinalizedChainInfoUntilHeightRequest") proto.RegisterType((*QueryFinalizedChainInfoUntilHeightResponse)(nil), "babylon.zoneconcierge.v1.QueryFinalizedChainInfoUntilHeightResponse") } -func init() { proto.RegisterFile("babylon/zoneconcierge/query.proto", fileDescriptor_2caab7ee15063236) } - -var fileDescriptor_2caab7ee15063236 = []byte{ - // 1155 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x58, 0x4f, 0x6f, 0xdc, 0x44, - 0x14, 0x8f, 0xf3, 0xaf, 0xc9, 0x0b, 0xad, 0xaa, 0x21, 0x94, 0xc5, 0x69, 0x37, 0xc1, 0x48, 0x25, - 0xad, 0x8a, 0x8d, 0x97, 0x96, 0x12, 0x21, 0x51, 0x65, 0x53, 0x92, 0x86, 0xa2, 0xd2, 0x18, 0xc2, - 0x01, 0x21, 0xad, 0x6c, 0xef, 0xac, 0xd7, 0x4a, 0xd6, 0xb3, 0xf5, 0x78, 0xb7, 0xd9, 0x86, 0x70, - 0xe0, 0x0b, 0x80, 0xc4, 0x05, 0x71, 0x45, 0x2a, 0x12, 0x87, 0x7e, 0x8e, 0x22, 0xf5, 0x50, 0x89, - 0x0b, 0x27, 0x84, 0x12, 0xbe, 0x06, 0x12, 0xf2, 0xcc, 0xd8, 0x6b, 0xef, 0xda, 0xdd, 0x3f, 0xe4, - 0xc0, 0x81, 0xdb, 0x8e, 0xe7, 0xbd, 0xdf, 0xfb, 0xbd, 0x7f, 0xf3, 0x9e, 0x16, 0x5e, 0xb7, 0x4c, - 0xab, 0xb3, 0x4f, 0x3c, 0xed, 0x11, 0xf1, 0xb0, 0x4d, 0x3c, 0xdb, 0xc5, 0xbe, 0x83, 0xb5, 0x07, - 0x2d, 0xec, 0x77, 0xd4, 0xa6, 0x4f, 0x02, 0x82, 0x0a, 0x42, 0x44, 0x4d, 0x89, 0xa8, 0x6d, 0x5d, - 0x5e, 0x74, 0x88, 0x43, 0x98, 0x90, 0x16, 0xfe, 0xe2, 0xf2, 0xf2, 0x45, 0x87, 0x10, 0x67, 0x1f, - 0x6b, 0x66, 0xd3, 0xd5, 0x4c, 0xcf, 0x23, 0x81, 0x19, 0xb8, 0xc4, 0xa3, 0xe2, 0xf6, 0xaa, 0x4d, - 0x68, 0x83, 0x50, 0xcd, 0x32, 0xa9, 0x30, 0xa3, 0xb5, 0x75, 0x0b, 0x07, 0xa6, 0xae, 0x35, 0x4d, - 0xc7, 0xf5, 0x98, 0xb0, 0x90, 0x2d, 0x46, 0xe4, 0xac, 0xc0, 0xb6, 0xeb, 0xd8, 0xde, 0x6b, 0x12, - 0xd7, 0x0b, 0xb4, 0xe0, 0x40, 0xdc, 0x5f, 0xc9, 0xbe, 0x4f, 0x9d, 0x84, 0x68, 0xec, 0x67, 0xf7, - 0xc6, 0xf5, 0x9c, 0xa4, 0x9f, 0xf2, 0xe5, 0x6c, 0x91, 0x3e, 0x28, 0x25, 0x92, 0xc3, 0x4d, 0x62, - 0xd7, 0x43, 0x91, 0xb6, 0x1e, 0xff, 0xee, 0x95, 0x49, 0x87, 0xb5, 0x69, 0xfa, 0x66, 0x83, 0xf6, - 0xb2, 0x4f, 0xcb, 0xa4, 0xa3, 0xcc, 0x44, 0x95, 0x45, 0x40, 0x3b, 0x21, 0xd3, 0xfb, 0x4c, 0xdf, - 0xc0, 0x0f, 0x5a, 0x98, 0x06, 0xca, 0x2e, 0xbc, 0x9c, 0xfa, 0x4a, 0x9b, 0xc4, 0xa3, 0x18, 0x7d, - 0x00, 0xb3, 0xdc, 0x4e, 0x41, 0x5a, 0x91, 0x56, 0x17, 0x4a, 0x2b, 0x6a, 0x5e, 0x02, 0x55, 0xae, - 0x59, 0x9e, 0x7e, 0xfa, 0xc7, 0xf2, 0x84, 0x21, 0xb4, 0x94, 0x2d, 0x61, 0xec, 0x0e, 0x36, 0xab, - 0xd8, 0x17, 0xc6, 0xd0, 0x6b, 0x30, 0x67, 0xd7, 0x4d, 0xd7, 0xab, 0xb8, 0x55, 0x86, 0x3b, 0x6f, - 0x9c, 0x61, 0xe7, 0xed, 0x2a, 0xba, 0x00, 0xb3, 0x75, 0xec, 0x3a, 0xf5, 0xa0, 0x30, 0xb9, 0x22, - 0xad, 0x4e, 0x1b, 0xe2, 0xa4, 0xfc, 0x28, 0x09, 0x82, 0x11, 0x92, 0x20, 0x78, 0x2b, 0x94, 0x0f, - 0xbf, 0x08, 0x82, 0x6f, 0xe6, 0x13, 0xdc, 0xf6, 0xaa, 0xf8, 0x00, 0x57, 0x05, 0x80, 0x50, 0x43, - 0x65, 0x78, 0xa9, 0x46, 0xfc, 0xbd, 0x0a, 0x3f, 0x52, 0x66, 0x76, 0xa1, 0xb4, 0x9c, 0x0f, 0xb3, - 0x49, 0xfc, 0x3d, 0x6a, 0x2c, 0x84, 0x4a, 0x1c, 0x8a, 0x2a, 0x15, 0x78, 0x85, 0x71, 0xdb, 0x08, - 0x9d, 0xf8, 0xd8, 0xa5, 0x41, 0xe4, 0xe8, 0x26, 0x40, 0xb7, 0x10, 0x05, 0xc3, 0xcb, 0x2a, 0xaf, - 0x5a, 0x35, 0xac, 0x5a, 0x95, 0x17, 0x8d, 0xa8, 0x5a, 0xf5, 0xbe, 0xe9, 0x60, 0xa1, 0x6b, 0x24, - 0x34, 0x95, 0xaf, 0xe1, 0x42, 0xaf, 0x01, 0xe1, 0xff, 0x12, 0xcc, 0x47, 0xa1, 0x0c, 0x73, 0x34, - 0xb5, 0x3a, 0x6f, 0xcc, 0x89, 0x58, 0x52, 0xb4, 0x95, 0x32, 0x3f, 0x29, 0x02, 0x34, 0xc8, 0x3c, - 0x47, 0x4e, 0xd9, 0x2f, 0x25, 0x1d, 0xdc, 0xf6, 0x6a, 0x64, 0x70, 0x26, 0x95, 0x2f, 0x93, 0x9c, - 0xb9, 0x8e, 0xe0, 0x5c, 0x06, 0x10, 0x4a, 0x5e, 0x8d, 0x88, 0xa8, 0xbc, 0x91, 0x1f, 0xf0, 0x2e, - 0x00, 0x77, 0x35, 0xfc, 0xa9, 0x7c, 0x06, 0x32, 0x43, 0xff, 0x30, 0xec, 0x95, 0x3e, 0x5a, 0x4b, - 0x30, 0xcf, 0x9a, 0xa8, 0xe2, 0xb5, 0x1a, 0xcc, 0xc0, 0xb4, 0x31, 0xc7, 0x3e, 0xdc, 0x6b, 0x35, - 0x52, 0x9c, 0x27, 0xd3, 0x9c, 0x4d, 0x58, 0xca, 0x44, 0x3d, 0x45, 0xe2, 0x5f, 0xc1, 0xab, 0xcc, - 0x44, 0x98, 0x45, 0x51, 0x3f, 0x43, 0xb4, 0xc5, 0x66, 0x46, 0x26, 0xc7, 0x29, 0xa4, 0xc7, 0x12, - 0x14, 0xfa, 0xcd, 0x0b, 0xf7, 0xd6, 0xe1, 0x4c, 0xd4, 0x05, 0x61, 0x25, 0x8d, 0xd0, 0x4c, 0x91, - 0xde, 0xe9, 0x55, 0xdc, 0xe7, 0x70, 0x31, 0xe6, 0xc9, 0xb2, 0xd1, 0x13, 0xab, 0x71, 0x33, 0x6c, - 0xc1, 0xa5, 0x1c, 0xdc, 0x53, 0x0b, 0x82, 0xb2, 0x03, 0x45, 0x66, 0x63, 0xd3, 0xf5, 0xcc, 0x7d, - 0xf7, 0x11, 0xae, 0x8e, 0xd0, 0x36, 0x68, 0x11, 0x66, 0x9a, 0x3e, 0x69, 0x63, 0x46, 0x7c, 0xce, - 0xe0, 0x07, 0xe5, 0xa7, 0x29, 0x58, 0xce, 0xc5, 0x14, 0xcc, 0x77, 0x61, 0xb1, 0x16, 0xdd, 0x56, - 0xc6, 0xab, 0x53, 0x54, 0xeb, 0x83, 0x47, 0x6b, 0x00, 0x3c, 0xd2, 0x0c, 0x8c, 0xa7, 0x54, 0x8e, - 0xc1, 0xe2, 0x59, 0xd5, 0xd6, 0x55, 0x16, 0x4f, 0x83, 0xe7, 0x85, 0xa9, 0xde, 0x83, 0x73, 0xbe, - 0xf9, 0xb0, 0xd2, 0x9d, 0x7a, 0x85, 0xa9, 0x9e, 0x47, 0x3a, 0x35, 0x1e, 0x43, 0x0c, 0xc3, 0x7c, - 0xb8, 0x11, 0x7f, 0x33, 0xce, 0xfa, 0xc9, 0x23, 0xda, 0x05, 0x64, 0x05, 0x76, 0x85, 0xb6, 0xac, - 0x86, 0x4b, 0xa9, 0x4b, 0xbc, 0xca, 0x1e, 0xee, 0x14, 0xa6, 0x7b, 0x30, 0xd3, 0x23, 0xbb, 0xad, - 0xab, 0x9f, 0xc6, 0xf2, 0x77, 0x71, 0xc7, 0x38, 0x6f, 0x05, 0x76, 0xea, 0x0b, 0xda, 0x62, 0x21, - 0x27, 0xb5, 0xc2, 0x0c, 0x43, 0xd2, 0x5f, 0x30, 0xe3, 0x42, 0xb1, 0x8c, 0x14, 0x70, 0x7d, 0x25, - 0x80, 0x2b, 0x39, 0x49, 0xda, 0xf5, 0x02, 0x77, 0xff, 0x0e, 0x1b, 0x65, 0xe3, 0x0f, 0xc1, 0x6e, - 0x6d, 0x4c, 0x25, 0x6b, 0xe3, 0xc9, 0x14, 0x5c, 0x1d, 0xc6, 0xec, 0xff, 0x65, 0xf2, 0xdf, 0x28, - 0x93, 0xd2, 0xe3, 0xb3, 0x30, 0xc3, 0x12, 0x86, 0xbe, 0x95, 0x60, 0x96, 0xef, 0x4d, 0xe8, 0x5a, - 0x3e, 0x5c, 0xff, 0xba, 0x26, 0xbf, 0x35, 0xa4, 0x34, 0xcf, 0xb9, 0xb2, 0xfa, 0xcd, 0x6f, 0x7f, - 0x7d, 0x3f, 0xa9, 0xa0, 0x15, 0x2d, 0x7b, 0x4f, 0x6c, 0xeb, 0x62, 0x9d, 0x44, 0x4f, 0x24, 0x98, - 0xe5, 0xef, 0xd9, 0x40, 0x46, 0xa9, 0x9d, 0x6e, 0x20, 0xa3, 0xf4, 0xde, 0xa6, 0x6c, 0x31, 0x46, - 0xeb, 0xe8, 0x56, 0x3e, 0xa3, 0x6e, 0x6d, 0x6a, 0x87, 0x51, 0xa7, 0x1c, 0x69, 0xfc, 0x91, 0xd5, - 0x0e, 0x79, 0x4b, 0x1c, 0xa1, 0x1f, 0x24, 0x98, 0x8f, 0xd7, 0x22, 0xa4, 0x0d, 0x60, 0xd1, 0xbb, - 0xa1, 0xc9, 0x6f, 0x0f, 0xaf, 0x30, 0x7c, 0x2c, 0x19, 0x5b, 0x8a, 0x7e, 0x8e, 0xa8, 0xb1, 0x2a, - 0x1f, 0x8a, 0x5a, 0x62, 0x48, 0x0c, 0x47, 0x2d, 0x39, 0x01, 0x94, 0x9b, 0x8c, 0x9a, 0x8e, 0xb4, - 0x11, 0x83, 0x8a, 0x7e, 0x95, 0xe0, 0x5c, 0x7a, 0xe7, 0x41, 0xd7, 0x07, 0x58, 0xcf, 0x5c, 0xbc, - 0xe4, 0x1b, 0x23, 0x6a, 0x09, 0xe2, 0x1f, 0x31, 0xe2, 0xb7, 0x51, 0x79, 0xd4, 0x6a, 0x60, 0x8f, - 0x08, 0xd5, 0x0e, 0xe3, 0x5d, 0xe0, 0x08, 0xfd, 0x22, 0xc1, 0x42, 0x62, 0xbb, 0x41, 0xfa, 0x00, - 0x4a, 0xfd, 0x8b, 0x98, 0x5c, 0x1a, 0x45, 0x45, 0xb8, 0x70, 0x9d, 0xb9, 0xa0, 0xa2, 0x6b, 0xf9, - 0x2e, 0x88, 0xfd, 0x20, 0x19, 0xf8, 0x67, 0x12, 0x9c, 0xef, 0x5d, 0x45, 0xd0, 0xbb, 0x43, 0x98, - 0xcf, 0xd8, 0x89, 0xe4, 0x9b, 0x23, 0xeb, 0x0d, 0xdf, 0x8c, 0xfd, 0xdc, 0xb3, 0x62, 0xff, 0x4c, - 0x02, 0xd4, 0xff, 0xee, 0xa1, 0xf7, 0x06, 0x10, 0xcb, 0x5d, 0x94, 0xe4, 0xb5, 0x31, 0x34, 0x85, - 0x53, 0xeb, 0xcc, 0xa9, 0xf7, 0xd1, 0x5a, 0xbe, 0x53, 0x59, 0x73, 0x30, 0x99, 0x9d, 0xbf, 0x25, - 0xb8, 0xf4, 0xc2, 0xa1, 0x8a, 0x36, 0x46, 0xe6, 0xd7, 0xbf, 0x09, 0xc8, 0xb7, 0xff, 0x1d, 0x88, - 0xf0, 0x77, 0x87, 0xf9, 0x7b, 0x17, 0x6d, 0x8f, 0xed, 0xaf, 0xc6, 0xdf, 0xd4, 0xf8, 0x6d, 0x2d, - 0x7f, 0xf2, 0xf4, 0xb8, 0x28, 0x3d, 0x3f, 0x2e, 0x4a, 0x7f, 0x1e, 0x17, 0xa5, 0xef, 0x4e, 0x8a, - 0x13, 0xcf, 0x4f, 0x8a, 0x13, 0xbf, 0x9f, 0x14, 0x27, 0xbe, 0xb8, 0xe1, 0xb8, 0x41, 0xbd, 0x65, - 0xa9, 0x36, 0x69, 0x44, 0xe6, 0x18, 0x4c, 0x6c, 0xfb, 0xa0, 0xc7, 0x7a, 0xd0, 0x69, 0x62, 0x6a, - 0xcd, 0xb2, 0xbf, 0x20, 0xde, 0xf9, 0x27, 0x00, 0x00, 0xff, 0xff, 0x1f, 0xf5, 0xc1, 0xb9, 0x2a, - 0x12, 0x00, 0x00, +func init() { + proto.RegisterFile("babylon/zoneconcierge/v1/query.proto", fileDescriptor_cd665af90102da38) +} + +var fileDescriptor_cd665af90102da38 = []byte{ + // 1101 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x57, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xce, 0x3a, 0x1f, 0x4d, 0x5e, 0xf3, 0x51, 0x4d, 0xda, 0x62, 0xb6, 0xad, 0x6b, 0x2d, 0x1f, + 0x4d, 0x4b, 0xb2, 0x8b, 0x5d, 0xd2, 0xaa, 0x5c, 0xaa, 0x36, 0x25, 0x69, 0x54, 0x54, 0xda, 0x85, + 0x80, 0xc4, 0x65, 0xd9, 0x5d, 0x8f, 0xed, 0x55, 0xe2, 0x1d, 0xd7, 0xb3, 0x76, 0xeb, 0x86, 0x70, + 0x40, 0xfc, 0x00, 0x24, 0x2e, 0x88, 0x13, 0x27, 0x0e, 0x1c, 0x7a, 0xe3, 0x27, 0x20, 0x71, 0xe0, + 0x50, 0x89, 0x0b, 0x47, 0x94, 0xf0, 0x0b, 0xb8, 0x23, 0xa1, 0x9d, 0x99, 0xb5, 0xf7, 0xd3, 0x5e, + 0x87, 0xdc, 0x32, 0xe3, 0xf7, 0x7d, 0x9e, 0xe7, 0xfd, 0x9a, 0x77, 0x03, 0x6f, 0x5a, 0xa6, 0x35, + 0xd8, 0x23, 0xae, 0xf6, 0x8c, 0xb8, 0xd8, 0x26, 0xae, 0xed, 0xe0, 0x6e, 0x13, 0x6b, 0xfd, 0xaa, + 0xf6, 0xb8, 0x87, 0xbb, 0x03, 0xb5, 0xd3, 0x25, 0x1e, 0x41, 0x25, 0x61, 0xa5, 0x46, 0xac, 0xd4, + 0x7e, 0x55, 0xbe, 0xd0, 0x24, 0xa4, 0xb9, 0x87, 0x35, 0xb3, 0xe3, 0x68, 0xa6, 0xeb, 0x12, 0xcf, + 0xf4, 0x1c, 0xe2, 0x52, 0xee, 0x27, 0x5f, 0xb5, 0x09, 0x6d, 0x13, 0xaa, 0x59, 0x26, 0xc5, 0x1c, + 0x50, 0xeb, 0x57, 0x2d, 0xec, 0x99, 0x55, 0xad, 0x63, 0x36, 0x1d, 0x97, 0x19, 0x0b, 0xdb, 0xd5, + 0x40, 0x89, 0xe5, 0xd9, 0x76, 0x0b, 0xdb, 0xbb, 0x1d, 0xe2, 0xb8, 0x9e, 0xaf, 0x24, 0x72, 0x21, + 0xac, 0xaf, 0x04, 0xd6, 0xa3, 0x5f, 0x1c, 0xb7, 0xe9, 0x5b, 0x27, 0x4c, 0x95, 0xc0, 0x14, 0x77, + 0x88, 0xdd, 0x12, 0x56, 0xc1, 0xdf, 0x71, 0xf2, 0x44, 0x1a, 0xa2, 0x11, 0x33, 0x6b, 0x65, 0x0b, + 0xd0, 0x23, 0x3f, 0x98, 0x7b, 0xd8, 0xac, 0xe3, 0xae, 0x8e, 0x1f, 0xf7, 0x30, 0xf5, 0xd0, 0xeb, + 0xb0, 0x68, 0xb7, 0x4c, 0xc7, 0x35, 0x9c, 0x7a, 0x49, 0xaa, 0x48, 0x2b, 0x4b, 0xfa, 0x29, 0x76, + 0xde, 0xae, 0xa3, 0x73, 0xb0, 0xd0, 0xc2, 0x4e, 0xb3, 0xe5, 0x95, 0x0a, 0x15, 0x69, 0x65, 0x4e, + 0x17, 0x27, 0xe5, 0x07, 0x09, 0x96, 0x23, 0x48, 0xb4, 0x43, 0x5c, 0x8a, 0xd1, 0x2d, 0xdf, 0xde, + 0xbf, 0x61, 0x40, 0xc5, 0xda, 0x65, 0x35, 0xab, 0x00, 0xea, 0xb6, 0x5b, 0xc7, 0x4f, 0x71, 0x5d, + 0x00, 0x08, 0x37, 0x74, 0x07, 0x5e, 0x6a, 0x90, 0xee, 0xae, 0xc1, 0x8f, 0x94, 0xd1, 0x16, 0x6b, + 0x97, 0xb2, 0x61, 0x36, 0x49, 0x77, 0x97, 0xea, 0x45, 0xdf, 0x89, 0x43, 0x51, 0xc5, 0x80, 0xb3, + 0x4c, 0xdb, 0x86, 0x1f, 0xc4, 0x87, 0x0e, 0xf5, 0x82, 0x40, 0x37, 0x01, 0x46, 0xd5, 0x13, 0x0a, + 0xdf, 0x56, 0x79, 0xa9, 0x55, 0xbf, 0xd4, 0x2a, 0xef, 0x1d, 0x51, 0x6a, 0xf5, 0xa1, 0xd9, 0xc4, + 0xc2, 0x57, 0x0f, 0x79, 0x2a, 0x5f, 0xc1, 0xb9, 0x38, 0x81, 0x88, 0xff, 0x3c, 0x2c, 0x05, 0xa9, + 0xa4, 0x25, 0xa9, 0x32, 0xbb, 0xb2, 0xa4, 0x2f, 0x8a, 0x5c, 0x52, 0xb4, 0x15, 0xa1, 0x2f, 0x88, + 0x04, 0x4d, 0xa2, 0xe7, 0xc8, 0x11, 0xfe, 0xf5, 0x30, 0x3f, 0xdd, 0x76, 0x1b, 0x24, 0x88, 0x70, + 0x1c, 0xbf, 0x62, 0xc0, 0x6b, 0x09, 0x37, 0xa1, 0xfb, 0x2e, 0x14, 0x99, 0x19, 0x35, 0x1c, 0xb7, + 0x41, 0x98, 0x67, 0xb1, 0xf6, 0x46, 0x76, 0xd6, 0x19, 0x04, 0x43, 0x00, 0x7b, 0x88, 0xa6, 0x7c, + 0x06, 0xe7, 0x19, 0xc1, 0x07, 0x7e, 0x8f, 0xa6, 0x8a, 0x63, 0xdd, 0x6b, 0xb8, 0xbd, 0x36, 0xcb, + 0xfe, 0x9c, 0xbe, 0xc8, 0x2e, 0x1e, 0xf4, 0xda, 0x51, 0xe5, 0x85, 0x98, 0xf2, 0x3a, 0x5c, 0x48, + 0x07, 0x3e, 0x51, 0xf9, 0x5f, 0x8a, 0xfc, 0xf8, 0x15, 0x15, 0xbd, 0x94, 0x63, 0x44, 0x36, 0x53, + 0xaa, 0x7a, 0x9c, 0xa6, 0xfa, 0x49, 0x82, 0x52, 0x92, 0x5e, 0x04, 0x78, 0x1b, 0x4e, 0x05, 0x13, + 0xc1, 0x83, 0xcb, 0x3d, 0x58, 0x81, 0xdf, 0xc9, 0x75, 0xdf, 0xa7, 0xa2, 0x18, 0xbe, 0x4e, 0x56, + 0x90, 0x58, 0xae, 0xc6, 0x96, 0x39, 0x9c, 0xc8, 0x42, 0x24, 0x91, 0x8a, 0x05, 0x17, 0x33, 0x70, + 0x4f, 0x2c, 0x09, 0xca, 0x27, 0x70, 0x89, 0x71, 0x6c, 0x3a, 0xae, 0xb9, 0xe7, 0x3c, 0xc3, 0xf5, + 0xe9, 0x46, 0x08, 0x9d, 0x81, 0xf9, 0x4e, 0x97, 0xf4, 0x31, 0xd3, 0xbe, 0xa8, 0xf3, 0x83, 0xf2, + 0x8d, 0x04, 0x95, 0x6c, 0x58, 0xa1, 0xfe, 0x0b, 0x38, 0xdb, 0x08, 0x7e, 0x36, 0x92, 0xdd, 0xba, + 0x3a, 0xe6, 0x89, 0x8b, 0xa0, 0x32, 0xd0, 0xe5, 0x46, 0x92, 0x49, 0xf1, 0xe0, 0x4a, 0x8a, 0x0a, + 0xff, 0xa7, 0x1d, 0xd7, 0x73, 0xf6, 0xee, 0xb1, 0xa7, 0xfb, 0xf8, 0x8f, 0xfe, 0x28, 0xf8, 0xd9, + 0x70, 0xf0, 0xcf, 0x67, 0xe1, 0x6a, 0x1e, 0x5a, 0x91, 0x86, 0x1d, 0x38, 0x13, 0x4b, 0x43, 0x90, + 0x05, 0x29, 0xef, 0xcc, 0xa2, 0x46, 0x82, 0x09, 0xdd, 0x04, 0xe0, 0x4d, 0xc7, 0xc0, 0x78, 0x77, + 0xcb, 0x43, 0xb0, 0xe1, 0xd2, 0xec, 0x57, 0x55, 0xd6, 0x5a, 0x3a, 0x6f, 0x51, 0xe6, 0xfa, 0x00, + 0x5e, 0xe9, 0x9a, 0x4f, 0x8c, 0xd1, 0xfa, 0x65, 0xf1, 0x85, 0xbb, 0x2b, 0xb2, 0xaa, 0x7d, 0x0c, + 0xdd, 0x7c, 0xb2, 0x31, 0xbc, 0xd3, 0x5f, 0xee, 0x86, 0x8f, 0x68, 0x07, 0x90, 0xe5, 0xd9, 0x06, + 0xed, 0x59, 0x6d, 0x87, 0x52, 0x87, 0xb8, 0xc6, 0x2e, 0x1e, 0x94, 0xe6, 0x62, 0x98, 0xd1, 0x6f, + 0x83, 0x7e, 0x55, 0xfd, 0x78, 0x68, 0x7f, 0x1f, 0x0f, 0xf4, 0xd3, 0x96, 0x67, 0x47, 0x6e, 0xd0, + 0x16, 0xcb, 0x3e, 0x69, 0x94, 0xe6, 0x19, 0x52, 0x35, 0x3b, 0x53, 0x0f, 0x7d, 0xb3, 0x94, 0xa6, + 0xe1, 0xfe, 0xb5, 0x7f, 0x8a, 0x30, 0xcf, 0x0a, 0x86, 0x9e, 0x4b, 0xb0, 0xc0, 0x27, 0x04, 0x8d, + 0x69, 0xbf, 0xe4, 0x17, 0x83, 0xbc, 0x96, 0xd3, 0x9a, 0xd7, 0x5c, 0xd9, 0xfa, 0xfa, 0x8f, 0xbf, + 0xbf, 0x2b, 0xdc, 0x46, 0xb7, 0xb4, 0xcc, 0xaf, 0x95, 0x51, 0x27, 0x68, 0xfb, 0x41, 0x5f, 0x1e, + 0x68, 0x7c, 0x6c, 0xb5, 0x7d, 0xde, 0x80, 0x07, 0xe8, 0x7b, 0x09, 0x96, 0x86, 0x4b, 0x17, 0x69, + 0x13, 0x54, 0xc4, 0xf7, 0xbf, 0xfc, 0x6e, 0x7e, 0x07, 0xa1, 0x7c, 0x85, 0x29, 0x57, 0x50, 0x65, + 0x82, 0x72, 0x8a, 0x7e, 0x94, 0x00, 0x46, 0xb3, 0x88, 0x72, 0x51, 0x85, 0xdf, 0x1d, 0xb9, 0x3a, + 0x85, 0x87, 0x50, 0xb7, 0xc6, 0xd4, 0x5d, 0x46, 0x6f, 0x4d, 0x52, 0xc7, 0x12, 0x8b, 0x7e, 0x91, + 0xe0, 0xd5, 0xd8, 0x06, 0x45, 0xeb, 0x13, 0x58, 0xd3, 0x57, 0xb9, 0x7c, 0x7d, 0x5a, 0x37, 0xa1, + 0xf8, 0x1a, 0x53, 0xbc, 0x86, 0xde, 0xc9, 0x56, 0xcc, 0xc7, 0x38, 0xac, 0xfb, 0x67, 0x09, 0x8a, + 0xa1, 0xa5, 0x88, 0x26, 0x65, 0x2a, 0xb9, 0xbf, 0xe5, 0xda, 0x34, 0x2e, 0x42, 0xeb, 0x7b, 0x4c, + 0xab, 0x8a, 0x56, 0xb3, 0xb5, 0x8a, 0xb5, 0x12, 0x6a, 0x59, 0xf4, 0xbb, 0x04, 0xa7, 0xe3, 0x1b, + 0x0c, 0x5d, 0xcf, 0x41, 0x9f, 0xb2, 0x4a, 0xe5, 0x1b, 0x53, 0xfb, 0xe5, 0x9f, 0xb8, 0xa4, 0x76, + 0x9e, 0x7a, 0xaa, 0xed, 0x0f, 0xd7, 0xf7, 0x01, 0xfa, 0x55, 0x82, 0xe5, 0x94, 0xad, 0x86, 0x6e, + 0x4e, 0x50, 0x96, 0xbd, 0x60, 0xe5, 0xf7, 0x8f, 0xe3, 0x2a, 0xe2, 0xba, 0xc1, 0xe2, 0xaa, 0x22, + 0x2d, 0x3b, 0xae, 0xd4, 0x25, 0x8b, 0xfe, 0x95, 0xe0, 0xe2, 0xd8, 0x05, 0x85, 0x36, 0xa6, 0x92, + 0x95, 0xbe, 0x55, 0xe5, 0xbb, 0xff, 0x0f, 0x44, 0x44, 0xf9, 0x88, 0x45, 0x79, 0x1f, 0x6d, 0xe7, + 0x8e, 0x32, 0xe5, 0xe5, 0xf4, 0x11, 0x87, 0x2f, 0xe7, 0x9d, 0x8f, 0x7e, 0x3b, 0x2c, 0x4b, 0x2f, + 0x0e, 0xcb, 0xd2, 0x5f, 0x87, 0x65, 0xe9, 0xdb, 0xa3, 0xf2, 0xcc, 0x8b, 0xa3, 0xf2, 0xcc, 0x9f, + 0x47, 0xe5, 0x99, 0xcf, 0xd7, 0x9b, 0x8e, 0xd7, 0xea, 0x59, 0xaa, 0x4d, 0xda, 0x01, 0x1d, 0x83, + 0x19, 0x72, 0x3f, 0x8d, 0xb1, 0x7b, 0x83, 0x0e, 0xa6, 0xd6, 0x02, 0xfb, 0x8f, 0xf2, 0xda, 0x7f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x4b, 0x80, 0x0f, 0x7d, 0x88, 0x0f, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1125,23 +1010,25 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Header queries the CZ header and fork headers at a given height. Header(ctx context.Context, in *QueryHeaderRequest, opts ...grpc.CallOption) (*QueryHeaderResponse, error) // ChainList queries the list of chains that checkpoint to Babylon ChainList(ctx context.Context, in *QueryChainListRequest, opts ...grpc.CallOption) (*QueryChainListResponse, error) - // ChainInfo queries the latest info of a chain in Babylon's view - ChainInfo(ctx context.Context, in *QueryChainInfoRequest, opts ...grpc.CallOption) (*QueryChainInfoResponse, error) - // EpochChainInfo queries the latest info of a chain in a given epoch of Babylon's view - EpochChainInfo(ctx context.Context, in *QueryEpochChainInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainInfoResponse, error) - // ListHeaders queries the headers of a chain in Babylon's view, with pagination support + // ChainsInfo queries the latest info for a given list of chains in Babylon's view + ChainsInfo(ctx context.Context, in *QueryChainsInfoRequest, opts ...grpc.CallOption) (*QueryChainsInfoResponse, error) + // EpochChainsInfo queries the latest info for a list of chains + // in a given epoch in Babylon's view + EpochChainsInfo(ctx context.Context, in *QueryEpochChainsInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainsInfoResponse, error) + // ListHeaders queries the headers of a chain in Babylon's view, with + // pagination support ListHeaders(ctx context.Context, in *QueryListHeadersRequest, opts ...grpc.CallOption) (*QueryListHeadersResponse, error) - // ListEpochHeaders queries the headers of a chain timestamped in a given epoch of Babylon, with pagination support + // ListEpochHeaders queries the headers of a chain timestamped in a given + // epoch of Babylon, with pagination support ListEpochHeaders(ctx context.Context, in *QueryListEpochHeadersRequest, opts ...grpc.CallOption) (*QueryListEpochHeadersResponse, error) - // FinalizedChainInfo queries the BTC-finalised info of a chain, with proofs - FinalizedChainInfo(ctx context.Context, in *QueryFinalizedChainInfoRequest, opts ...grpc.CallOption) (*QueryFinalizedChainInfoResponse, error) - // FinalizedChainInfoUntilHeight queries the BTC-finalised info no later than the provided CZ height, with proofs + // FinalizedChainsInfo queries the BTC-finalised info of chains with given IDs, with proofs + FinalizedChainsInfo(ctx context.Context, in *QueryFinalizedChainsInfoRequest, opts ...grpc.CallOption) (*QueryFinalizedChainsInfoResponse, error) + // FinalizedChainInfoUntilHeight queries the BTC-finalised info no later than + // the provided CZ height, with proofs FinalizedChainInfoUntilHeight(ctx context.Context, in *QueryFinalizedChainInfoUntilHeightRequest, opts ...grpc.CallOption) (*QueryFinalizedChainInfoUntilHeightResponse, error) } @@ -1153,15 +1040,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) Header(ctx context.Context, in *QueryHeaderRequest, opts ...grpc.CallOption) (*QueryHeaderResponse, error) { out := new(QueryHeaderResponse) err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/Header", in, out, opts...) @@ -1180,18 +1058,18 @@ func (c *queryClient) ChainList(ctx context.Context, in *QueryChainListRequest, return out, nil } -func (c *queryClient) ChainInfo(ctx context.Context, in *QueryChainInfoRequest, opts ...grpc.CallOption) (*QueryChainInfoResponse, error) { - out := new(QueryChainInfoResponse) - err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/ChainInfo", in, out, opts...) +func (c *queryClient) ChainsInfo(ctx context.Context, in *QueryChainsInfoRequest, opts ...grpc.CallOption) (*QueryChainsInfoResponse, error) { + out := new(QueryChainsInfoResponse) + err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/ChainsInfo", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) EpochChainInfo(ctx context.Context, in *QueryEpochChainInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainInfoResponse, error) { - out := new(QueryEpochChainInfoResponse) - err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/EpochChainInfo", in, out, opts...) +func (c *queryClient) EpochChainsInfo(ctx context.Context, in *QueryEpochChainsInfoRequest, opts ...grpc.CallOption) (*QueryEpochChainsInfoResponse, error) { + out := new(QueryEpochChainsInfoResponse) + err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/EpochChainsInfo", in, out, opts...) if err != nil { return nil, err } @@ -1216,9 +1094,9 @@ func (c *queryClient) ListEpochHeaders(ctx context.Context, in *QueryListEpochHe return out, nil } -func (c *queryClient) FinalizedChainInfo(ctx context.Context, in *QueryFinalizedChainInfoRequest, opts ...grpc.CallOption) (*QueryFinalizedChainInfoResponse, error) { - out := new(QueryFinalizedChainInfoResponse) - err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/FinalizedChainInfo", in, out, opts...) +func (c *queryClient) FinalizedChainsInfo(ctx context.Context, in *QueryFinalizedChainsInfoRequest, opts ...grpc.CallOption) (*QueryFinalizedChainsInfoResponse, error) { + out := new(QueryFinalizedChainsInfoResponse) + err := c.cc.Invoke(ctx, "/babylon.zoneconcierge.v1.Query/FinalizedChainsInfo", in, out, opts...) if err != nil { return nil, err } @@ -1236,23 +1114,25 @@ func (c *queryClient) FinalizedChainInfoUntilHeight(ctx context.Context, in *Que // QueryServer is the server API for Query service. type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Header queries the CZ header and fork headers at a given height. Header(context.Context, *QueryHeaderRequest) (*QueryHeaderResponse, error) // ChainList queries the list of chains that checkpoint to Babylon ChainList(context.Context, *QueryChainListRequest) (*QueryChainListResponse, error) - // ChainInfo queries the latest info of a chain in Babylon's view - ChainInfo(context.Context, *QueryChainInfoRequest) (*QueryChainInfoResponse, error) - // EpochChainInfo queries the latest info of a chain in a given epoch of Babylon's view - EpochChainInfo(context.Context, *QueryEpochChainInfoRequest) (*QueryEpochChainInfoResponse, error) - // ListHeaders queries the headers of a chain in Babylon's view, with pagination support + // ChainsInfo queries the latest info for a given list of chains in Babylon's view + ChainsInfo(context.Context, *QueryChainsInfoRequest) (*QueryChainsInfoResponse, error) + // EpochChainsInfo queries the latest info for a list of chains + // in a given epoch in Babylon's view + EpochChainsInfo(context.Context, *QueryEpochChainsInfoRequest) (*QueryEpochChainsInfoResponse, error) + // ListHeaders queries the headers of a chain in Babylon's view, with + // pagination support ListHeaders(context.Context, *QueryListHeadersRequest) (*QueryListHeadersResponse, error) - // ListEpochHeaders queries the headers of a chain timestamped in a given epoch of Babylon, with pagination support + // ListEpochHeaders queries the headers of a chain timestamped in a given + // epoch of Babylon, with pagination support ListEpochHeaders(context.Context, *QueryListEpochHeadersRequest) (*QueryListEpochHeadersResponse, error) - // FinalizedChainInfo queries the BTC-finalised info of a chain, with proofs - FinalizedChainInfo(context.Context, *QueryFinalizedChainInfoRequest) (*QueryFinalizedChainInfoResponse, error) - // FinalizedChainInfoUntilHeight queries the BTC-finalised info no later than the provided CZ height, with proofs + // FinalizedChainsInfo queries the BTC-finalised info of chains with given IDs, with proofs + FinalizedChainsInfo(context.Context, *QueryFinalizedChainsInfoRequest) (*QueryFinalizedChainsInfoResponse, error) + // FinalizedChainInfoUntilHeight queries the BTC-finalised info no later than + // the provided CZ height, with proofs FinalizedChainInfoUntilHeight(context.Context, *QueryFinalizedChainInfoUntilHeightRequest) (*QueryFinalizedChainInfoUntilHeightResponse, error) } @@ -1260,20 +1140,17 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func (*UnimplementedQueryServer) Header(ctx context.Context, req *QueryHeaderRequest) (*QueryHeaderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Header not implemented") } func (*UnimplementedQueryServer) ChainList(ctx context.Context, req *QueryChainListRequest) (*QueryChainListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChainList not implemented") } -func (*UnimplementedQueryServer) ChainInfo(ctx context.Context, req *QueryChainInfoRequest) (*QueryChainInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ChainInfo not implemented") +func (*UnimplementedQueryServer) ChainsInfo(ctx context.Context, req *QueryChainsInfoRequest) (*QueryChainsInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChainsInfo not implemented") } -func (*UnimplementedQueryServer) EpochChainInfo(ctx context.Context, req *QueryEpochChainInfoRequest) (*QueryEpochChainInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EpochChainInfo not implemented") +func (*UnimplementedQueryServer) EpochChainsInfo(ctx context.Context, req *QueryEpochChainsInfoRequest) (*QueryEpochChainsInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method EpochChainsInfo not implemented") } func (*UnimplementedQueryServer) ListHeaders(ctx context.Context, req *QueryListHeadersRequest) (*QueryListHeadersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListHeaders not implemented") @@ -1281,8 +1158,8 @@ func (*UnimplementedQueryServer) ListHeaders(ctx context.Context, req *QueryList func (*UnimplementedQueryServer) ListEpochHeaders(ctx context.Context, req *QueryListEpochHeadersRequest) (*QueryListEpochHeadersResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ListEpochHeaders not implemented") } -func (*UnimplementedQueryServer) FinalizedChainInfo(ctx context.Context, req *QueryFinalizedChainInfoRequest) (*QueryFinalizedChainInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FinalizedChainInfo not implemented") +func (*UnimplementedQueryServer) FinalizedChainsInfo(ctx context.Context, req *QueryFinalizedChainsInfoRequest) (*QueryFinalizedChainsInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FinalizedChainsInfo not implemented") } func (*UnimplementedQueryServer) FinalizedChainInfoUntilHeight(ctx context.Context, req *QueryFinalizedChainInfoUntilHeightRequest) (*QueryFinalizedChainInfoUntilHeightResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FinalizedChainInfoUntilHeight not implemented") @@ -1292,24 +1169,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/babylon.zoneconcierge.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_Header_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryHeaderRequest) if err := dec(in); err != nil { @@ -1346,38 +1205,38 @@ func _Query_ChainList_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } -func _Query_ChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryChainInfoRequest) +func _Query_ChainsInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryChainsInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ChainInfo(ctx, in) + return srv.(QueryServer).ChainsInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.zoneconcierge.v1.Query/ChainInfo", + FullMethod: "/babylon.zoneconcierge.v1.Query/ChainsInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ChainInfo(ctx, req.(*QueryChainInfoRequest)) + return srv.(QueryServer).ChainsInfo(ctx, req.(*QueryChainsInfoRequest)) } return interceptor(ctx, in, info, handler) } -func _Query_EpochChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryEpochChainInfoRequest) +func _Query_EpochChainsInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryEpochChainsInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).EpochChainInfo(ctx, in) + return srv.(QueryServer).EpochChainsInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.zoneconcierge.v1.Query/EpochChainInfo", + FullMethod: "/babylon.zoneconcierge.v1.Query/EpochChainsInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).EpochChainInfo(ctx, req.(*QueryEpochChainInfoRequest)) + return srv.(QueryServer).EpochChainsInfo(ctx, req.(*QueryEpochChainsInfoRequest)) } return interceptor(ctx, in, info, handler) } @@ -1418,20 +1277,20 @@ func _Query_ListEpochHeaders_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _Query_FinalizedChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFinalizedChainInfoRequest) +func _Query_FinalizedChainsInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryFinalizedChainsInfoRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).FinalizedChainInfo(ctx, in) + return srv.(QueryServer).FinalizedChainsInfo(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/babylon.zoneconcierge.v1.Query/FinalizedChainInfo", + FullMethod: "/babylon.zoneconcierge.v1.Query/FinalizedChainsInfo", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).FinalizedChainInfo(ctx, req.(*QueryFinalizedChainInfoRequest)) + return srv.(QueryServer).FinalizedChainsInfo(ctx, req.(*QueryFinalizedChainsInfoRequest)) } return interceptor(ctx, in, info, handler) } @@ -1458,10 +1317,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "babylon.zoneconcierge.v1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, { MethodName: "Header", Handler: _Query_Header_Handler, @@ -1471,12 +1326,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_ChainList_Handler, }, { - MethodName: "ChainInfo", - Handler: _Query_ChainInfo_Handler, + MethodName: "ChainsInfo", + Handler: _Query_ChainsInfo_Handler, }, { - MethodName: "EpochChainInfo", - Handler: _Query_EpochChainInfo_Handler, + MethodName: "EpochChainsInfo", + Handler: _Query_EpochChainsInfo_Handler, }, { MethodName: "ListHeaders", @@ -1487,8 +1342,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_ListEpochHeaders_Handler, }, { - MethodName: "FinalizedChainInfo", - Handler: _Query_FinalizedChainInfo_Handler, + MethodName: "FinalizedChainsInfo", + Handler: _Query_FinalizedChainsInfo_Handler, }, { MethodName: "FinalizedChainInfoUntilHeight", @@ -1496,63 +1351,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/zoneconcierge/query.proto", -} - -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil + Metadata: "babylon/zoneconcierge/v1/query.proto", } func (m *QueryHeaderRequest) Marshal() (dAtA []byte, err error) { @@ -1716,7 +1515,7 @@ func (m *QueryChainListResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryChainInfoRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryChainsInfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1726,27 +1525,29 @@ func (m *QueryChainInfoRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryChainInfoRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryChainsInfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryChainsInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa + if len(m.ChainIds) > 0 { + for iNdEx := len(m.ChainIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ChainIds[iNdEx]) + copy(dAtA[i:], m.ChainIds[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainIds[iNdEx]))) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func (m *QueryChainInfoResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryChainsInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1756,32 +1557,34 @@ func (m *QueryChainInfoResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryChainInfoResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryChainsInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryChainInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryChainsInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ChainInfo != nil { - { - size, err := m.ChainInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.ChainsInfo) > 0 { + for iNdEx := len(m.ChainsInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChainsInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *QueryEpochChainInfoRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryEpochChainsInfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1791,22 +1594,24 @@ func (m *QueryEpochChainInfoRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryEpochChainInfoRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryEpochChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0x12 + if len(m.ChainIds) > 0 { + for iNdEx := len(m.ChainIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ChainIds[iNdEx]) + copy(dAtA[i:], m.ChainIds[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainIds[iNdEx]))) + i-- + dAtA[i] = 0x12 + } } if m.EpochNum != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.EpochNum)) @@ -1816,7 +1621,7 @@ func (m *QueryEpochChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, err return len(dAtA) - i, nil } -func (m *QueryEpochChainInfoResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryEpochChainsInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1826,27 +1631,29 @@ func (m *QueryEpochChainInfoResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryEpochChainInfoResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryEpochChainInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryEpochChainsInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.ChainInfo != nil { - { - size, err := m.ChainInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.ChainsInfo) > 0 { + for iNdEx := len(m.ChainsInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ChainsInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2014,7 +1821,7 @@ func (m *QueryListEpochHeadersResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryFinalizedChainInfoRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryFinalizedChainsInfoRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2024,12 +1831,12 @@ func (m *QueryFinalizedChainInfoRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFinalizedChainInfoRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFinalizedChainsInfoRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFinalizedChainsInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2044,17 +1851,19 @@ func (m *QueryFinalizedChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, i-- dAtA[i] = 0x10 } - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0xa + if len(m.ChainIds) > 0 { + for iNdEx := len(m.ChainIds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ChainIds[iNdEx]) + copy(dAtA[i:], m.ChainIds[iNdEx]) + i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainIds[iNdEx]))) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } -func (m *QueryFinalizedChainInfoResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryFinalizedChainsInfoResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2064,75 +1873,29 @@ func (m *QueryFinalizedChainInfoResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryFinalizedChainInfoResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryFinalizedChainsInfoResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryFinalizedChainInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryFinalizedChainsInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.Proof != nil { - { - size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.FinalizedChainsInfo) > 0 { + for iNdEx := len(m.FinalizedChainsInfo) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.FinalizedChainsInfo[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0x2a - } - if m.BtcSubmissionKey != nil { - { - size, err := m.BtcSubmissionKey.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.RawCheckpoint != nil { - { - size, err := m.RawCheckpoint.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if m.EpochInfo != nil { - { - size, err := m.EpochInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - if m.FinalizedChainInfo != nil { - { - size, err := m.FinalizedChainInfo.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa } return len(dAtA) - i, nil } @@ -2276,26 +2039,6 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryHeaderRequest) Size() (n int) { if m == nil { return 0 @@ -2361,33 +2104,37 @@ func (m *QueryChainListResponse) Size() (n int) { return n } -func (m *QueryChainInfoRequest) Size() (n int) { +func (m *QueryChainsInfoRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ChainIds) > 0 { + for _, s := range m.ChainIds { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } } return n } -func (m *QueryChainInfoResponse) Size() (n int) { +func (m *QueryChainsInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ChainInfo != nil { - l = m.ChainInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.ChainsInfo) > 0 { + for _, e := range m.ChainsInfo { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } return n } -func (m *QueryEpochChainInfoRequest) Size() (n int) { +func (m *QueryEpochChainsInfoRequest) Size() (n int) { if m == nil { return 0 } @@ -2396,22 +2143,26 @@ func (m *QueryEpochChainInfoRequest) Size() (n int) { if m.EpochNum != 0 { n += 1 + sovQuery(uint64(m.EpochNum)) } - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ChainIds) > 0 { + for _, s := range m.ChainIds { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } } return n } -func (m *QueryEpochChainInfoResponse) Size() (n int) { +func (m *QueryEpochChainsInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.ChainInfo != nil { - l = m.ChainInfo.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.ChainsInfo) > 0 { + for _, e := range m.ChainsInfo { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } return n } @@ -2483,15 +2234,17 @@ func (m *QueryListEpochHeadersResponse) Size() (n int) { return n } -func (m *QueryFinalizedChainInfoRequest) Size() (n int) { +func (m *QueryFinalizedChainsInfoRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) + if len(m.ChainIds) > 0 { + for _, s := range m.ChainIds { + l = len(s) + n += 1 + l + sovQuery(uint64(l)) + } } if m.Prove { n += 2 @@ -2499,31 +2252,17 @@ func (m *QueryFinalizedChainInfoRequest) Size() (n int) { return n } -func (m *QueryFinalizedChainInfoResponse) Size() (n int) { +func (m *QueryFinalizedChainsInfoResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - if m.FinalizedChainInfo != nil { - l = m.FinalizedChainInfo.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.EpochInfo != nil { - l = m.EpochInfo.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.RawCheckpoint != nil { - l = m.RawCheckpoint.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.BtcSubmissionKey != nil { - l = m.BtcSubmissionKey.Size() - n += 1 + l + sovQuery(uint64(l)) - } - if m.Proof != nil { - l = m.Proof.Size() - n += 1 + l + sovQuery(uint64(l)) + if len(m.FinalizedChainsInfo) > 0 { + for _, e := range m.FinalizedChainsInfo { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } } return n } @@ -2582,139 +2321,6 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryHeaderRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -3142,7 +2748,7 @@ func (m *QueryChainListResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryChainInfoRequest) Unmarshal(dAtA []byte) error { +func (m *QueryChainsInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3165,15 +2771,15 @@ func (m *QueryChainInfoRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryChainInfoRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChainsInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChainInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChainsInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3201,7 +2807,7 @@ func (m *QueryChainInfoRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ChainIds = append(m.ChainIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -3224,7 +2830,7 @@ func (m *QueryChainInfoRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryChainInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryChainsInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3247,15 +2853,15 @@ func (m *QueryChainInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryChainInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryChainsInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryChainInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryChainsInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainsInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3282,10 +2888,8 @@ func (m *QueryChainInfoResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ChainInfo == nil { - m.ChainInfo = &ChainInfo{} - } - if err := m.ChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ChainsInfo = append(m.ChainsInfo, &ChainInfo{}) + if err := m.ChainsInfo[len(m.ChainsInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3310,7 +2914,7 @@ func (m *QueryChainInfoResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { +func (m *QueryEpochChainsInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3333,10 +2937,10 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryEpochChainInfoRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEpochChainsInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEpochChainInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEpochChainsInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3360,7 +2964,7 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3388,7 +2992,7 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ChainIds = append(m.ChainIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -3411,7 +3015,7 @@ func (m *QueryEpochChainInfoRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryEpochChainInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryEpochChainsInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3434,15 +3038,15 @@ func (m *QueryEpochChainInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryEpochChainInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryEpochChainsInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryEpochChainInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryEpochChainsInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainInfo", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainsInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3469,10 +3073,8 @@ func (m *QueryEpochChainInfoResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.ChainInfo == nil { - m.ChainInfo = &ChainInfo{} - } - if err := m.ChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ChainsInfo = append(m.ChainsInfo, &ChainInfo{}) + if err := m.ChainsInfo[len(m.ChainsInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3920,7 +3522,7 @@ func (m *QueryListEpochHeadersResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFinalizedChainInfoRequest) Unmarshal(dAtA []byte) error { +func (m *QueryFinalizedChainsInfoRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3943,15 +3545,15 @@ func (m *QueryFinalizedChainInfoRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedChainInfoRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFinalizedChainsInfoRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedChainInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFinalizedChainsInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ChainIds", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3979,7 +3581,7 @@ func (m *QueryFinalizedChainInfoRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + m.ChainIds = append(m.ChainIds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: if wireType != 0 { @@ -4022,7 +3624,7 @@ func (m *QueryFinalizedChainInfoRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryFinalizedChainInfoResponse) Unmarshal(dAtA []byte) error { +func (m *QueryFinalizedChainsInfoResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4045,87 +3647,15 @@ func (m *QueryFinalizedChainInfoResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFinalizedChainInfoResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryFinalizedChainsInfoResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFinalizedChainInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryFinalizedChainsInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalizedChainInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.FinalizedChainInfo == nil { - m.FinalizedChainInfo = &ChainInfo{} - } - if err := m.FinalizedChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EpochInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.EpochInfo == nil { - m.EpochInfo = &types.Epoch{} - } - if err := m.EpochInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoint", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedChainsInfo", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4152,82 +3682,8 @@ func (m *QueryFinalizedChainInfoResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.RawCheckpoint == nil { - m.RawCheckpoint = &types1.RawCheckpoint{} - } - if err := m.RawCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BtcSubmissionKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.BtcSubmissionKey == nil { - m.BtcSubmissionKey = &types2.SubmissionKey{} - } - if err := m.BtcSubmissionKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Proof == nil { - m.Proof = &ProofFinalizedChainInfo{} - } - if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.FinalizedChainsInfo = append(m.FinalizedChainsInfo, &FinalizedChainInfo{}) + if err := m.FinalizedChainsInfo[len(m.FinalizedChainsInfo)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/x/zoneconcierge/types/query.pb.gw.go b/x/zoneconcierge/types/query.pb.gw.go index 4a9974981..607477240 100644 --- a/x/zoneconcierge/types/query.pb.gw.go +++ b/x/zoneconcierge/types/query.pb.gw.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: babylon/zoneconcierge/query.proto +// source: babylon/zoneconcierge/v1/query.proto /* Package types is a reverse proxy. @@ -33,24 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_Header_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryHeaderRequest var metadata runtime.ServerMetadata @@ -163,132 +145,74 @@ func local_request_Query_ChainList_0(ctx context.Context, marshaler runtime.Mars } -func request_Query_ChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChainInfoRequest - var metadata runtime.ServerMetadata +var ( + filter_Query_ChainsInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) - var ( - val string - ok bool - err error - _ = err - ) +func request_Query_ChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChainsInfoRequest + var metadata runtime.ServerMetadata - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainsInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.ChainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ChainsInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryChainInfoRequest +func local_request_Query_ChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryChainsInfoRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_ChainsInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.ChainInfo(ctx, &protoReq) + msg, err := server.ChainsInfo(ctx, &protoReq) return msg, metadata, err } -func request_Query_EpochChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryEpochChainInfoRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) +var ( + filter_Query_EpochChainsInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } +func request_Query_EpochChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochChainsInfoRequest + var metadata runtime.ServerMetadata - val, ok = pathParams["epoch_num"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.EpochNum, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochChainsInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.EpochChainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.EpochChainsInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_EpochChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryEpochChainInfoRequest +func local_request_Query_EpochChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryEpochChainsInfoRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - - val, ok = pathParams["epoch_num"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "epoch_num") + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - - protoReq.EpochNum, err = runtime.Uint64(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "epoch_num", err) + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_EpochChainsInfo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.EpochChainInfo(ctx, &protoReq) + msg, err := server.EpochChainsInfo(ctx, &protoReq) return msg, metadata, err } @@ -442,73 +366,37 @@ func local_request_Query_ListEpochHeaders_0(ctx context.Context, marshaler runti } var ( - filter_Query_FinalizedChainInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{"chain_id": 0}, Base: []int{1, 1, 0}, Check: []int{0, 1, 2}} + filter_Query_FinalizedChainsInfo_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} ) -func request_Query_FinalizedChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFinalizedChainInfoRequest +func request_Query_FinalizedChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFinalizedChainsInfoRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FinalizedChainInfo_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FinalizedChainsInfo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := client.FinalizedChainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.FinalizedChainsInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_FinalizedChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFinalizedChainInfoRequest +func local_request_Query_FinalizedChainsInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryFinalizedChainsInfoRequest var metadata runtime.ServerMetadata - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["chain_id"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "chain_id") - } - - protoReq.ChainId, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "chain_id", err) - } - if err := req.ParseForm(); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FinalizedChainInfo_0); err != nil { + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_FinalizedChainsInfo_0); err != nil { return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) } - msg, err := server.FinalizedChainInfo(ctx, &protoReq) + msg, err := server.FinalizedChainsInfo(ctx, &protoReq) return msg, metadata, err } @@ -613,29 +501,6 @@ func local_request_Query_FinalizedChainInfoUntilHeight_0(ctx context.Context, ma // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Header_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -682,7 +547,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_ChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChainsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -693,7 +558,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ChainsInfo_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -701,11 +566,11 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_EpochChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EpochChainsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -716,7 +581,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_EpochChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_EpochChainsInfo_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -724,7 +589,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_EpochChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EpochChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -774,7 +639,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_FinalizedChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FinalizedChainsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -785,7 +650,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_FinalizedChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_FinalizedChainsInfo_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -793,7 +658,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_FinalizedChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FinalizedChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -861,26 +726,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_Header_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -921,7 +766,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ChainsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -930,18 +775,18 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ChainInfo_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ChainsInfo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) - mux.Handle("GET", pattern_Query_EpochChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_EpochChainsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -950,14 +795,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_EpochChainInfo_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_EpochChainsInfo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_EpochChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_EpochChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1001,7 +846,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_FinalizedChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_FinalizedChainsInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -1010,14 +855,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_FinalizedChainInfo_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_FinalizedChainsInfo_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_FinalizedChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_FinalizedChainsInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -1045,41 +890,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "zoneconcierge", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_Header_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"babylon", "zoneconcierge", "v1", "chain_info", "chain_id", "header", "height"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ChainList_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "zoneconcierge", "v1", "chains"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ChainInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "zoneconcierge", "v1", "chain_info", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ChainsInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "zoneconcierge", "v1", "chains_info"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_EpochChainInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"babylon", "zoneconcierge", "v1", "chain_info", "chain_id", "epochs", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_EpochChainsInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "zoneconcierge", "v1", "epoch_chains_info"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ListHeaders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "zoneconcierge", "v1", "headers", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_ListEpochHeaders_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6}, []string{"babylon", "zoneconcierge", "v1", "headers", "chain_id", "epochs", "epoch_num"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_FinalizedChainInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4}, []string{"babylon", "zoneconcierge", "v1", "finalized_chain_info", "chain_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_FinalizedChainsInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"babylon", "zoneconcierge", "v1", "finalized_chains_info"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_FinalizedChainInfoUntilHeight_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 5}, []string{"babylon", "zoneconcierge", "v1", "finalized_chain_info", "chain_id", "height"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_Header_0 = runtime.ForwardResponseMessage forward_Query_ChainList_0 = runtime.ForwardResponseMessage - forward_Query_ChainInfo_0 = runtime.ForwardResponseMessage + forward_Query_ChainsInfo_0 = runtime.ForwardResponseMessage - forward_Query_EpochChainInfo_0 = runtime.ForwardResponseMessage + forward_Query_EpochChainsInfo_0 = runtime.ForwardResponseMessage forward_Query_ListHeaders_0 = runtime.ForwardResponseMessage forward_Query_ListEpochHeaders_0 = runtime.ForwardResponseMessage - forward_Query_FinalizedChainInfo_0 = runtime.ForwardResponseMessage + forward_Query_FinalizedChainsInfo_0 = runtime.ForwardResponseMessage forward_Query_FinalizedChainInfoUntilHeight_0 = runtime.ForwardResponseMessage ) diff --git a/x/zoneconcierge/types/tx.pb.go b/x/zoneconcierge/types/tx.pb.go index c874da3b1..2c52ff6b3 100644 --- a/x/zoneconcierge/types/tx.pb.go +++ b/x/zoneconcierge/types/tx.pb.go @@ -1,13 +1,13 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/zoneconcierge/tx.proto +// source: babylon/zoneconcierge/v1/tx.proto package types import ( context "context" fmt "fmt" - grpc1 "github.com/gogo/protobuf/grpc" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" math "math" ) @@ -23,19 +23,19 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -func init() { proto.RegisterFile("babylon/zoneconcierge/tx.proto", fileDescriptor_8e6a138445b0c506) } +func init() { proto.RegisterFile("babylon/zoneconcierge/v1/tx.proto", fileDescriptor_35e2112d987e4e18) } -var fileDescriptor_8e6a138445b0c506 = []byte{ - // 136 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0x4a, 0x4c, 0xaa, +var fileDescriptor_35e2112d987e4e18 = []byte{ + // 140 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x4c, 0x4a, 0x4c, 0xaa, 0xcc, 0xc9, 0xcf, 0xd3, 0xaf, 0xca, 0xcf, 0x4b, 0x4d, 0xce, 0xcf, 0x4b, 0xce, 0x4c, 0x2d, 0x4a, - 0x4f, 0xd5, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80, 0xca, 0xeb, 0xa1, - 0xc8, 0xeb, 0x95, 0x19, 0x1a, 0xb1, 0x72, 0x31, 0xfb, 0x16, 0xa7, 0x3b, 0xf9, 0x9f, 0x78, 0x24, - 0xc7, 0x78, 0xe1, 0x91, 0x1c, 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, - 0x2c, 0xc7, 0x70, 0xe3, 0xb1, 0x1c, 0x43, 0x94, 0x69, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, - 0x72, 0x7e, 0xae, 0x3e, 0xd4, 0x94, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x18, 0x47, 0xbf, 0x02, 0xdd, - 0xd2, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0xc5, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, - 0x52, 0x2a, 0x1c, 0x1f, 0x9a, 0x00, 0x00, 0x00, + 0x4f, 0xd5, 0x2f, 0x33, 0xd4, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0x80, + 0x2a, 0xd1, 0x43, 0x51, 0xa2, 0x57, 0x66, 0x68, 0xc4, 0xca, 0xc5, 0xec, 0x5b, 0x9c, 0xee, 0xe4, + 0x7f, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, + 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0xa6, 0xe9, 0x99, 0x25, 0x19, + 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x50, 0x53, 0x92, 0x33, 0x12, 0x33, 0xf3, 0x60, 0x1c, + 0xfd, 0x0a, 0x34, 0x7b, 0x4b, 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x16, 0x1b, 0x03, 0x02, + 0x00, 0x00, 0xff, 0xff, 0xd3, 0x96, 0xa5, 0xaf, 0x9d, 0x00, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -77,5 +77,5 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{}, Streams: []grpc.StreamDesc{}, - Metadata: "babylon/zoneconcierge/tx.proto", + Metadata: "babylon/zoneconcierge/v1/tx.proto", } diff --git a/x/zoneconcierge/types/zoneconcierge.pb.go b/x/zoneconcierge/types/zoneconcierge.pb.go index bfb3066fc..f9e732c74 100644 --- a/x/zoneconcierge/types/zoneconcierge.pb.go +++ b/x/zoneconcierge/types/zoneconcierge.pb.go @@ -1,15 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: babylon/zoneconcierge/zoneconcierge.proto +// source: babylon/zoneconcierge/v1/zoneconcierge.proto package types import ( fmt "fmt" - types2 "github.com/babylonchain/babylon/x/btccheckpoint/types" - types1 "github.com/babylonchain/babylon/x/checkpointing/types" - proto "github.com/gogo/protobuf/proto" - crypto "github.com/tendermint/tendermint/proto/tendermint/crypto" - types "github.com/tendermint/tendermint/proto/tendermint/types" + types3 "github.com/babylonchain/babylon/x/btccheckpoint/types" + types2 "github.com/babylonchain/babylon/x/checkpointing/types" + types1 "github.com/babylonchain/babylon/x/epoching/types" + crypto "github.com/cometbft/cometbft/proto/tendermint/crypto" + types "github.com/cometbft/cometbft/proto/tendermint/types" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" @@ -35,12 +36,14 @@ type IndexedHeader struct { // height is the height of this header on CZ ledger // (hash, height) jointly provides the position of the header on CZ ledger Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` - // babylon_header is the header of the babylon block that includes this CZ header + // babylon_header is the header of the babylon block that includes this CZ + // header BabylonHeader *types.Header `protobuf:"bytes,4,opt,name=babylon_header,json=babylonHeader,proto3" json:"babylon_header,omitempty"` // epoch is the epoch number of this header on Babylon ledger BabylonEpoch uint64 `protobuf:"varint,5,opt,name=babylon_epoch,json=babylonEpoch,proto3" json:"babylon_epoch,omitempty"` // 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 + // (babylon_block_height, babylon_tx_hash) jointly provides the position of + // the header on Babylon ledger BabylonTxHash []byte `protobuf:"bytes,6,opt,name=babylon_tx_hash,json=babylonTxHash,proto3" json:"babylon_tx_hash,omitempty"` } @@ -48,7 +51,7 @@ func (m *IndexedHeader) Reset() { *m = IndexedHeader{} } func (m *IndexedHeader) String() string { return proto.CompactTextString(m) } func (*IndexedHeader) ProtoMessage() {} func (*IndexedHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_c76d28ce8dde4532, []int{0} + return fileDescriptor_ab886e1868e5c5cd, []int{0} } func (m *IndexedHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -123,15 +126,18 @@ func (m *IndexedHeader) GetBabylonTxHash() []byte { // For example, assuming the following blockchain // ``` // A <- B <- C <- D <- E -// \ -- D1 -// \ -- D2 +// +// \ -- 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. +// 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. type Forks struct { // blocks is the list of non-canonical indexed headers at the same height Headers []*IndexedHeader `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"` @@ -141,7 +147,7 @@ func (m *Forks) Reset() { *m = Forks{} } func (m *Forks) String() string { return proto.CompactTextString(m) } func (*Forks) ProtoMessage() {} func (*Forks) Descriptor() ([]byte, []int) { - return fileDescriptor_c76d28ce8dde4532, []int{1} + return fileDescriptor_ab886e1868e5c5cd, []int{1} } func (m *Forks) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -183,9 +189,11 @@ type ChainInfo struct { ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` // latest_header is the latest header in CZ's canonical chain LatestHeader *IndexedHeader `protobuf:"bytes,2,opt,name=latest_header,json=latestHeader,proto3" json:"latest_header,omitempty"` - // latest_forks is the latest forks, formed as a series of IndexedHeader (from low to high) + // latest_forks is the latest forks, formed as a series of IndexedHeader (from + // low to high) LatestForks *Forks `protobuf:"bytes,3,opt,name=latest_forks,json=latestForks,proto3" json:"latest_forks,omitempty"` - // timestamped_headers_count is the number of timestamped headers in CZ's canonical chain + // timestamped_headers_count is the number of timestamped headers in CZ's + // canonical chain TimestampedHeadersCount uint64 `protobuf:"varint,4,opt,name=timestamped_headers_count,json=timestampedHeadersCount,proto3" json:"timestamped_headers_count,omitempty"` } @@ -193,7 +201,7 @@ func (m *ChainInfo) Reset() { *m = ChainInfo{} } func (m *ChainInfo) String() string { return proto.CompactTextString(m) } func (*ChainInfo) ProtoMessage() {} func (*ChainInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_c76d28ce8dde4532, []int{2} + return fileDescriptor_ab886e1868e5c5cd, []int{2} } func (m *ChainInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -250,22 +258,118 @@ func (m *ChainInfo) GetTimestampedHeadersCount() uint64 { return 0 } -// 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 +// FinalizedChainInfo is the information of a CZ that is BTC-finalised +type FinalizedChainInfo struct { + // chain_id is the ID of the chain + ChainId string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + // finalized_chain_info is the info of the CZ + FinalizedChainInfo *ChainInfo `protobuf:"bytes,2,opt,name=finalized_chain_info,json=finalizedChainInfo,proto3" json:"finalized_chain_info,omitempty"` + // epoch_info is the metadata of the last BTC-finalised epoch + EpochInfo *types1.Epoch `protobuf:"bytes,3,opt,name=epoch_info,json=epochInfo,proto3" json:"epoch_info,omitempty"` + // raw_checkpoint is the raw checkpoint of this epoch + RawCheckpoint *types2.RawCheckpoint `protobuf:"bytes,4,opt,name=raw_checkpoint,json=rawCheckpoint,proto3" json:"raw_checkpoint,omitempty"` + // btc_submission_key is position of two BTC txs that include the raw + // checkpoint of this epoch + BtcSubmissionKey *types3.SubmissionKey `protobuf:"bytes,5,opt,name=btc_submission_key,json=btcSubmissionKey,proto3" json:"btc_submission_key,omitempty"` + // proof is the proof that the chain info is finalized + Proof *ProofFinalizedChainInfo `protobuf:"bytes,6,opt,name=proof,proto3" json:"proof,omitempty"` +} + +func (m *FinalizedChainInfo) Reset() { *m = FinalizedChainInfo{} } +func (m *FinalizedChainInfo) String() string { return proto.CompactTextString(m) } +func (*FinalizedChainInfo) ProtoMessage() {} +func (*FinalizedChainInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_ab886e1868e5c5cd, []int{3} +} +func (m *FinalizedChainInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *FinalizedChainInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_FinalizedChainInfo.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *FinalizedChainInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_FinalizedChainInfo.Merge(m, src) +} +func (m *FinalizedChainInfo) XXX_Size() int { + return m.Size() +} +func (m *FinalizedChainInfo) XXX_DiscardUnknown() { + xxx_messageInfo_FinalizedChainInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_FinalizedChainInfo proto.InternalMessageInfo + +func (m *FinalizedChainInfo) GetChainId() string { + if m != nil { + return m.ChainId + } + return "" +} + +func (m *FinalizedChainInfo) GetFinalizedChainInfo() *ChainInfo { + if m != nil { + return m.FinalizedChainInfo + } + return nil +} + +func (m *FinalizedChainInfo) GetEpochInfo() *types1.Epoch { + if m != nil { + return m.EpochInfo + } + return nil +} + +func (m *FinalizedChainInfo) GetRawCheckpoint() *types2.RawCheckpoint { + if m != nil { + return m.RawCheckpoint + } + return nil +} + +func (m *FinalizedChainInfo) GetBtcSubmissionKey() *types3.SubmissionKey { + if m != nil { + return m.BtcSubmissionKey + } + return nil +} + +func (m *FinalizedChainInfo) GetProof() *ProofFinalizedChainInfo { + if m != nil { + return m.Proof + } + return nil +} + +// 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 `last_commit_hash` is same as in the sealer header -// - More than 1/3 (in voting power) validators in the validator set of this epoch have signed `last_commit_hash` of the sealer header +// - More than 1/3 (in voting power) validators in the validator set of this +// epoch have signed `last_commit_hash` of the sealer header // - The epoch medatata is committed to the `app_hash` of the sealer header // - The validator set is committed to the `app_hash` of the sealer header type ProofEpochSealed struct { // validator_set is the validator set of the sealed epoch - // This validator set has generated a BLS multisig on `last_commit_hash` of the sealer header - ValidatorSet []*types1.ValidatorWithBlsKey `protobuf:"bytes,1,rep,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"` - // proof_epoch_info is the Merkle proof that the epoch's metadata is committed to `app_hash` of the sealer header + // This validator set has generated a BLS multisig on `last_commit_hash` of + // the sealer header + ValidatorSet []*types2.ValidatorWithBlsKey `protobuf:"bytes,1,rep,name=validator_set,json=validatorSet,proto3" json:"validator_set,omitempty"` + // proof_epoch_info is the Merkle proof that the epoch's metadata is committed + // to `app_hash` of the sealer header ProofEpochInfo *crypto.ProofOps `protobuf:"bytes,2,opt,name=proof_epoch_info,json=proofEpochInfo,proto3" json:"proof_epoch_info,omitempty"` - // proof_epoch_info is the Merkle proof that the epoch's validator set is committed to `app_hash` of the sealer header + // proof_epoch_info is the Merkle proof that the epoch's validator set is + // committed to `app_hash` of the sealer header ProofEpochValSet *crypto.ProofOps `protobuf:"bytes,3,opt,name=proof_epoch_val_set,json=proofEpochValSet,proto3" json:"proof_epoch_val_set,omitempty"` } @@ -273,7 +377,7 @@ func (m *ProofEpochSealed) Reset() { *m = ProofEpochSealed{} } func (m *ProofEpochSealed) String() string { return proto.CompactTextString(m) } func (*ProofEpochSealed) ProtoMessage() {} func (*ProofEpochSealed) Descriptor() ([]byte, []int) { - return fileDescriptor_c76d28ce8dde4532, []int{3} + return fileDescriptor_ab886e1868e5c5cd, []int{4} } func (m *ProofEpochSealed) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -302,7 +406,7 @@ func (m *ProofEpochSealed) XXX_DiscardUnknown() { var xxx_messageInfo_ProofEpochSealed proto.InternalMessageInfo -func (m *ProofEpochSealed) GetValidatorSet() []*types1.ValidatorWithBlsKey { +func (m *ProofEpochSealed) GetValidatorSet() []*types2.ValidatorWithBlsKey { if m != nil { return m.ValidatorSet } @@ -323,24 +427,28 @@ func (m *ProofEpochSealed) GetProofEpochValSet() *crypto.ProofOps { return nil } -// ProofFinalizedChainInfo is a set of proofs that attest a chain info is BTC-finalised +// ProofFinalizedChainInfo is a set of proofs that attest a chain info is +// BTC-finalised type ProofFinalizedChainInfo struct { - // proof_tx_in_block is the proof that tx that carries the header is included in a certain Babylon block + // proof_tx_in_block is the proof that tx that carries the header is included + // in a certain Babylon block ProofTxInBlock *types.TxProof `protobuf:"bytes,4,opt,name=proof_tx_in_block,json=proofTxInBlock,proto3" json:"proof_tx_in_block,omitempty"` - // proof_header_in_epoch is the proof that the Babylon header is in a certain epoch + // proof_header_in_epoch is the proof that the Babylon header is in a certain + // epoch ProofHeaderInEpoch *crypto.Proof `protobuf:"bytes,5,opt,name=proof_header_in_epoch,json=proofHeaderInEpoch,proto3" json:"proof_header_in_epoch,omitempty"` // proof_epoch_sealed is the proof that the epoch is sealed ProofEpochSealed *ProofEpochSealed `protobuf:"bytes,6,opt,name=proof_epoch_sealed,json=proofEpochSealed,proto3" json:"proof_epoch_sealed,omitempty"` - // 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 - ProofEpochSubmitted []*types2.TransactionInfo `protobuf:"bytes,7,rep,name=proof_epoch_submitted,json=proofEpochSubmitted,proto3" json:"proof_epoch_submitted,omitempty"` + // 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 + ProofEpochSubmitted []*types3.TransactionInfo `protobuf:"bytes,7,rep,name=proof_epoch_submitted,json=proofEpochSubmitted,proto3" json:"proof_epoch_submitted,omitempty"` } func (m *ProofFinalizedChainInfo) Reset() { *m = ProofFinalizedChainInfo{} } func (m *ProofFinalizedChainInfo) String() string { return proto.CompactTextString(m) } func (*ProofFinalizedChainInfo) ProtoMessage() {} func (*ProofFinalizedChainInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_c76d28ce8dde4532, []int{4} + return fileDescriptor_ab886e1868e5c5cd, []int{5} } func (m *ProofFinalizedChainInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -390,7 +498,7 @@ func (m *ProofFinalizedChainInfo) GetProofEpochSealed() *ProofEpochSealed { return nil } -func (m *ProofFinalizedChainInfo) GetProofEpochSubmitted() []*types2.TransactionInfo { +func (m *ProofFinalizedChainInfo) GetProofEpochSubmitted() []*types3.TransactionInfo { if m != nil { return m.ProofEpochSubmitted } @@ -401,61 +509,70 @@ func init() { proto.RegisterType((*IndexedHeader)(nil), "babylon.zoneconcierge.v1.IndexedHeader") proto.RegisterType((*Forks)(nil), "babylon.zoneconcierge.v1.Forks") proto.RegisterType((*ChainInfo)(nil), "babylon.zoneconcierge.v1.ChainInfo") + proto.RegisterType((*FinalizedChainInfo)(nil), "babylon.zoneconcierge.v1.FinalizedChainInfo") proto.RegisterType((*ProofEpochSealed)(nil), "babylon.zoneconcierge.v1.ProofEpochSealed") proto.RegisterType((*ProofFinalizedChainInfo)(nil), "babylon.zoneconcierge.v1.ProofFinalizedChainInfo") } func init() { - proto.RegisterFile("babylon/zoneconcierge/zoneconcierge.proto", fileDescriptor_c76d28ce8dde4532) -} - -var fileDescriptor_c76d28ce8dde4532 = []byte{ - // 719 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x51, 0x6f, 0xd3, 0x3c, - 0x14, 0x5d, 0xd6, 0x6e, 0xfb, 0xe6, 0xb6, 0xfb, 0x46, 0x26, 0x58, 0x36, 0xa0, 0x94, 0x4e, 0x1a, - 0x1d, 0x12, 0xa9, 0x56, 0xc4, 0x0b, 0x2f, 0x88, 0x8e, 0x4d, 0xeb, 0x86, 0x34, 0x94, 0x55, 0x03, - 0x21, 0xa1, 0xc8, 0x49, 0xdc, 0xc6, 0x6a, 0x6a, 0x87, 0xd8, 0xad, 0xd2, 0xfd, 0x0a, 0x7e, 0x16, - 0x8f, 0x7b, 0xe4, 0x11, 0x6d, 0xf0, 0x0f, 0x78, 0xe1, 0x0d, 0xc5, 0x76, 0xda, 0xb4, 0x6c, 0xc0, - 0x4b, 0x55, 0xe7, 0x9e, 0x7b, 0xee, 0xf1, 0xb9, 0xf7, 0x1a, 0xec, 0x38, 0xd0, 0x19, 0x05, 0x94, - 0xd4, 0xcf, 0x29, 0x41, 0x2e, 0x25, 0x2e, 0x46, 0x51, 0x17, 0x4d, 0x9f, 0xcc, 0x30, 0xa2, 0x9c, - 0xea, 0x86, 0x82, 0x9a, 0xd3, 0xc1, 0xe1, 0xee, 0xe6, 0x3d, 0x8e, 0x88, 0x87, 0xa2, 0x3e, 0x26, - 0xbc, 0xce, 0x47, 0x21, 0x62, 0xf2, 0x57, 0xe6, 0x6d, 0xde, 0xcf, 0x44, 0xdd, 0x68, 0x14, 0x72, - 0x5a, 0x0f, 0x23, 0x4a, 0x3b, 0x2a, 0x3c, 0x56, 0xe0, 0x70, 0xd7, 0xf5, 0x91, 0xdb, 0x0b, 0x69, - 0x82, 0x9c, 0x3a, 0x29, 0xe8, 0x56, 0x0a, 0x9d, 0x44, 0x30, 0xe9, 0xd6, 0x9d, 0x80, 0xd9, 0x3d, - 0x34, 0x52, 0xa0, 0x87, 0xd7, 0x83, 0x3e, 0x0e, 0x50, 0x94, 0x42, 0xb6, 0xaf, 0x87, 0xcc, 0xd6, - 0xab, 0x7e, 0xd3, 0x40, 0xa9, 0x45, 0x3c, 0x14, 0x23, 0xef, 0x10, 0x41, 0x0f, 0x45, 0xfa, 0x06, - 0xf8, 0xcf, 0xf5, 0x21, 0x26, 0x36, 0xf6, 0x0c, 0xad, 0xa2, 0xd5, 0x96, 0xad, 0x25, 0x71, 0x6e, - 0x79, 0xba, 0x0e, 0xf2, 0x3e, 0x64, 0xbe, 0x31, 0x5f, 0xd1, 0x6a, 0x45, 0x4b, 0xfc, 0xd7, 0xef, - 0x80, 0x45, 0x1f, 0xe1, 0xae, 0xcf, 0x8d, 0x5c, 0x45, 0xab, 0xe5, 0x2d, 0x75, 0xd2, 0x5f, 0x80, - 0x15, 0x25, 0xc1, 0xf6, 0x05, 0xb1, 0x91, 0xaf, 0x68, 0xb5, 0x42, 0xc3, 0x30, 0x27, 0x5e, 0x99, - 0xd2, 0x43, 0x59, 0xd8, 0x2a, 0x29, 0xbc, 0xd2, 0xb1, 0x05, 0xd2, 0x0f, 0x36, 0x0a, 0xa9, 0xeb, - 0x1b, 0x0b, 0x82, 0xbf, 0xa8, 0x3e, 0xee, 0x27, 0xdf, 0xf4, 0x6d, 0xf0, 0x7f, 0x0a, 0xe2, 0xb1, - 0x2d, 0xc4, 0x2d, 0x0a, 0x71, 0x69, 0x6e, 0x3b, 0x3e, 0x84, 0xcc, 0xaf, 0x1e, 0x81, 0x85, 0x03, - 0x1a, 0xf5, 0x98, 0xfe, 0x12, 0x2c, 0x49, 0x39, 0xcc, 0xc8, 0x55, 0x72, 0xb5, 0x42, 0xe3, 0x91, - 0x79, 0x53, 0xcf, 0xcd, 0x29, 0x5f, 0xac, 0x34, 0xaf, 0xfa, 0x43, 0x03, 0xcb, 0x7b, 0xc2, 0x11, - 0xd2, 0xa1, 0x7f, 0xb2, 0xeb, 0x35, 0x28, 0x05, 0x90, 0x23, 0xc6, 0x53, 0x07, 0xe6, 0x85, 0x03, - 0xff, 0x5c, 0xb1, 0x28, 0xb3, 0x95, 0x1f, 0x4d, 0xa0, 0xce, 0x76, 0x27, 0xb9, 0x89, 0xb0, 0xbb, - 0xd0, 0x78, 0x70, 0x33, 0x99, 0xb8, 0xb0, 0x55, 0x90, 0x49, 0xf2, 0xf6, 0xcf, 0xc1, 0x06, 0xc7, - 0x7d, 0xc4, 0x38, 0xec, 0x87, 0xc8, 0x53, 0xb2, 0x98, 0xed, 0xd2, 0x01, 0xe1, 0xa2, 0x3f, 0x79, - 0x6b, 0x3d, 0x03, 0x90, 0x95, 0xd9, 0x5e, 0x12, 0xae, 0xfe, 0xd4, 0xc0, 0xea, 0x9b, 0x64, 0xa8, - 0x85, 0xf3, 0xa7, 0x08, 0x06, 0xc8, 0xd3, 0x2d, 0x50, 0x1a, 0xc2, 0x00, 0x7b, 0x90, 0xd3, 0xc8, - 0x66, 0x88, 0x1b, 0x9a, 0x30, 0xf5, 0xc9, 0x58, 0xd5, 0xd4, 0xf8, 0x25, 0xaa, 0xce, 0x52, 0xf8, - 0x5b, 0xcc, 0xfd, 0x66, 0xc0, 0x8e, 0xd1, 0xc8, 0x2a, 0x8e, 0x39, 0x4e, 0x11, 0xd7, 0xf7, 0xc1, - 0xaa, 0x58, 0x1e, 0xd9, 0x76, 0x1b, 0x93, 0x0e, 0x55, 0xce, 0xdd, 0xcd, 0xce, 0x8e, 0xdc, 0x33, - 0x53, 0x48, 0x3a, 0x09, 0x99, 0xb5, 0x12, 0x8e, 0xc5, 0x89, 0xc6, 0x1c, 0x81, 0xb5, 0x2c, 0xcd, - 0x10, 0x06, 0x42, 0x60, 0xee, 0xef, 0x4c, 0xab, 0x13, 0xa6, 0x33, 0x18, 0x9c, 0x22, 0x5e, 0xfd, - 0x3e, 0x0f, 0xd6, 0x45, 0xf8, 0x00, 0x13, 0x18, 0xe0, 0x73, 0xe4, 0x4d, 0x06, 0xe0, 0x15, 0xb8, - 0x25, 0xeb, 0xf0, 0xd8, 0xc6, 0xc4, 0x76, 0x02, 0xea, 0xf6, 0xd4, 0xac, 0x6f, 0xfc, 0x3e, 0xeb, - 0xed, 0x58, 0xf0, 0x28, 0xb5, 0xed, 0xb8, 0x45, 0x9a, 0x49, 0x82, 0x7e, 0x0c, 0x6e, 0x4b, 0x16, - 0xd9, 0x93, 0x84, 0x69, 0x32, 0xf5, 0x33, 0x5b, 0x93, 0xd5, 0x6b, 0xe9, 0x22, 0x4d, 0x76, 0xaa, - 0xa5, 0xb6, 0xe2, 0x1d, 0xd0, 0xb3, 0x57, 0x67, 0xa2, 0x57, 0x62, 0x31, 0x0a, 0x8d, 0xc7, 0x37, - 0x0f, 0xcc, 0x6c, 0x77, 0xb3, 0x46, 0xa8, 0x7e, 0x7f, 0x48, 0x65, 0x2a, 0xe6, 0x81, 0xd3, 0xc7, - 0x9c, 0x23, 0xcf, 0x58, 0x12, 0x7d, 0xdf, 0x19, 0x93, 0x4f, 0xbf, 0x6d, 0xc3, 0x5d, 0xb3, 0x1d, - 0x41, 0xc2, 0xa0, 0xcb, 0x31, 0x15, 0xb6, 0x59, 0x6b, 0x19, 0xee, 0x94, 0xa5, 0x79, 0xf2, 0xf9, - 0xb2, 0xac, 0x5d, 0x5c, 0x96, 0xb5, 0xaf, 0x97, 0x65, 0xed, 0xd3, 0x55, 0x79, 0xee, 0xe2, 0xaa, - 0x3c, 0xf7, 0xe5, 0xaa, 0x3c, 0xf7, 0xfe, 0x59, 0x17, 0x73, 0x7f, 0xe0, 0x98, 0x2e, 0xed, 0xd7, - 0x55, 0x0d, 0xb1, 0x66, 0xe9, 0xa1, 0x1e, 0xcf, 0x3c, 0xef, 0xc2, 0x6e, 0x67, 0x51, 0xbc, 0x72, - 0x4f, 0x7f, 0x05, 0x00, 0x00, 0xff, 0xff, 0x91, 0x2a, 0x68, 0xc0, 0x04, 0x06, 0x00, 0x00, + proto.RegisterFile("babylon/zoneconcierge/v1/zoneconcierge.proto", fileDescriptor_ab886e1868e5c5cd) +} + +var fileDescriptor_ab886e1868e5c5cd = []byte{ + // 848 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0xdd, 0x6e, 0x1b, 0x45, + 0x14, 0xce, 0xc6, 0xf9, 0x21, 0xe3, 0x38, 0x84, 0x29, 0xd0, 0x4d, 0x00, 0x63, 0xb9, 0x52, 0x71, + 0x11, 0xac, 0xe5, 0x20, 0x2e, 0xe0, 0x06, 0x91, 0xd0, 0xd2, 0xb4, 0x88, 0xa2, 0x89, 0x5b, 0x10, + 0x12, 0x5a, 0xcd, 0xee, 0x8e, 0xbd, 0x23, 0xaf, 0x67, 0x56, 0x3b, 0x13, 0xd7, 0xee, 0x53, 0xf0, + 0x2a, 0xbc, 0x05, 0x97, 0xbd, 0xe4, 0x12, 0x25, 0xf0, 0x06, 0xdc, 0x70, 0x87, 0xf6, 0xcc, 0xec, + 0x7a, 0x5d, 0x6b, 0x69, 0x6e, 0x2c, 0xcf, 0xcc, 0x77, 0xbe, 0xf3, 0xcd, 0x77, 0xce, 0x99, 0x45, + 0x9f, 0x04, 0x34, 0x58, 0x24, 0x52, 0xf4, 0x5f, 0x48, 0xc1, 0x42, 0x29, 0x42, 0xce, 0xb2, 0x31, + 0xeb, 0xcf, 0x06, 0xab, 0x1b, 0x5e, 0x9a, 0x49, 0x2d, 0xb1, 0x6b, 0xd1, 0xde, 0xea, 0xe1, 0x6c, + 0x70, 0xfc, 0xbe, 0x66, 0x22, 0x62, 0xd9, 0x94, 0x0b, 0xdd, 0xd7, 0x8b, 0x94, 0x29, 0xf3, 0x6b, + 0xe2, 0x8e, 0x3f, 0xa8, 0x9c, 0x86, 0xd9, 0x22, 0xd5, 0xb2, 0x9f, 0x66, 0x52, 0x8e, 0xec, 0x71, + 0x29, 0x22, 0xd0, 0x61, 0x18, 0xb3, 0x70, 0x92, 0xca, 0x1c, 0x39, 0x1b, 0xac, 0x6e, 0x58, 0xf4, + 0xdd, 0x02, 0xbd, 0x3c, 0xe1, 0x62, 0x0c, 0xe8, 0x44, 0xf9, 0x13, 0xb6, 0xb0, 0xb8, 0x7b, 0xb5, + 0xb8, 0x35, 0xca, 0x6e, 0x01, 0x65, 0xa9, 0x0c, 0x63, 0x8b, 0x2a, 0xfe, 0x1b, 0x4c, 0xf7, 0x2f, + 0x07, 0xb5, 0xce, 0x45, 0xc4, 0xe6, 0x2c, 0x7a, 0xc8, 0x68, 0xc4, 0x32, 0x7c, 0x84, 0xde, 0x08, + 0x63, 0xca, 0x85, 0xcf, 0x23, 0xd7, 0xe9, 0x38, 0xbd, 0x3d, 0xb2, 0x0b, 0xeb, 0xf3, 0x08, 0x63, + 0xb4, 0x15, 0x53, 0x15, 0xbb, 0x9b, 0x1d, 0xa7, 0xb7, 0x4f, 0xe0, 0x3f, 0x7e, 0x17, 0xed, 0xc4, + 0x8c, 0x8f, 0x63, 0xed, 0x36, 0x3a, 0x4e, 0x6f, 0x8b, 0xd8, 0x15, 0xfe, 0x0a, 0x1d, 0xd8, 0xf4, + 0x7e, 0x0c, 0xc4, 0xee, 0x56, 0xc7, 0xe9, 0x35, 0x4f, 0x5c, 0x6f, 0xe9, 0x9a, 0x67, 0xdc, 0x34, + 0x89, 0x49, 0xcb, 0xe2, 0xad, 0x8e, 0x3b, 0xa8, 0xd8, 0xf0, 0x41, 0xb3, 0xbb, 0x0d, 0xfc, 0xfb, + 0x76, 0xf3, 0x7e, 0xbe, 0x87, 0xef, 0xa2, 0x37, 0x0b, 0x90, 0x9e, 0xfb, 0x20, 0x6e, 0x07, 0xc4, + 0x15, 0xb1, 0xc3, 0xf9, 0x43, 0xaa, 0xe2, 0xee, 0x23, 0xb4, 0xfd, 0x40, 0x66, 0x13, 0x85, 0xbf, + 0x46, 0xbb, 0x46, 0x8e, 0x72, 0x1b, 0x9d, 0x46, 0xaf, 0x79, 0xf2, 0x91, 0x57, 0x57, 0x7d, 0x6f, + 0xc5, 0x17, 0x52, 0xc4, 0x75, 0xff, 0x71, 0xd0, 0xde, 0x19, 0x38, 0x22, 0x46, 0xf2, 0xff, 0xec, + 0xfa, 0x0e, 0xb5, 0x12, 0xaa, 0x99, 0xd2, 0x85, 0x03, 0x9b, 0xe0, 0xc0, 0x8d, 0x33, 0xee, 0x9b, + 0x68, 0xeb, 0xc7, 0x29, 0xb2, 0x6b, 0x7f, 0x94, 0xdf, 0x04, 0xec, 0x6e, 0x9e, 0x7c, 0x58, 0x4f, + 0x06, 0x17, 0x26, 0x4d, 0x13, 0x64, 0x6e, 0xff, 0x25, 0x3a, 0xd2, 0x7c, 0xca, 0x94, 0xa6, 0xd3, + 0x94, 0x45, 0x56, 0x96, 0xf2, 0x43, 0x79, 0x29, 0x34, 0xd4, 0x67, 0x8b, 0xdc, 0xae, 0x00, 0x4c, + 0x66, 0x75, 0x96, 0x1f, 0x77, 0x7f, 0x6b, 0x20, 0xfc, 0x80, 0x0b, 0x9a, 0xf0, 0x17, 0x2c, 0xba, + 0xd1, 0xfd, 0x9f, 0xa2, 0xb7, 0x47, 0x45, 0x80, 0x6f, 0x41, 0x62, 0x24, 0xad, 0x0d, 0x77, 0xea, + 0x95, 0x97, 0xec, 0x04, 0x8f, 0xd6, 0x33, 0x7e, 0x81, 0x10, 0x34, 0x84, 0x21, 0x33, 0x36, 0x1c, + 0x97, 0x64, 0x65, 0x7f, 0xcf, 0x06, 0x1e, 0xf4, 0x08, 0xd9, 0x83, 0x2d, 0x08, 0xfd, 0x1e, 0x1d, + 0x64, 0xf4, 0xb9, 0xbf, 0x9c, 0x14, 0xdb, 0x94, 0xcb, 0x92, 0xac, 0x4c, 0x55, 0xce, 0x41, 0xe8, + 0xf3, 0xb3, 0x72, 0x8f, 0xb4, 0xb2, 0xea, 0x12, 0x3f, 0x45, 0x38, 0xd0, 0xa1, 0xaf, 0x2e, 0x83, + 0x29, 0x57, 0x8a, 0x4b, 0x91, 0x0f, 0x2a, 0x34, 0x6a, 0x95, 0x73, 0x75, 0xdc, 0x67, 0x03, 0xef, + 0xa2, 0xc4, 0x3f, 0x66, 0x0b, 0x72, 0x18, 0xe8, 0x70, 0x65, 0x07, 0x7f, 0x8b, 0xb6, 0xe1, 0x21, + 0x81, 0x5e, 0x6e, 0x9e, 0x0c, 0xea, 0x9d, 0xfa, 0x21, 0x87, 0xad, 0x57, 0x85, 0x98, 0xf8, 0xee, + 0xbf, 0x0e, 0x3a, 0x04, 0x08, 0x38, 0x71, 0xc1, 0x68, 0xc2, 0x22, 0x4c, 0x50, 0x6b, 0x46, 0x13, + 0x1e, 0x51, 0x2d, 0x33, 0x5f, 0x31, 0xed, 0x3a, 0x30, 0x08, 0x9f, 0xd6, 0x7b, 0xf0, 0xac, 0x80, + 0xff, 0xc8, 0x75, 0x7c, 0x9a, 0xa8, 0x5c, 0xf5, 0x7e, 0xc9, 0x71, 0xc1, 0x34, 0xbe, 0x8f, 0x0e, + 0x21, 0xa3, 0x5f, 0xa9, 0x8c, 0x29, 0xf3, 0x7b, 0xd5, 0x79, 0x37, 0xaf, 0xa4, 0x51, 0xfd, 0x24, + 0x55, 0xe4, 0x20, 0x2d, 0xc5, 0x41, 0x7d, 0x1e, 0xa1, 0x5b, 0x55, 0x9a, 0x19, 0x4d, 0x40, 0x60, + 0xe3, 0xf5, 0x4c, 0x87, 0x4b, 0xa6, 0x67, 0x34, 0xb9, 0x60, 0xba, 0xfb, 0xf7, 0x26, 0xba, 0x5d, + 0x63, 0x0f, 0xfe, 0x06, 0xbd, 0x65, 0xf2, 0xe8, 0xb9, 0xcf, 0x85, 0x1f, 0x24, 0x32, 0x9c, 0xd8, + 0x56, 0x38, 0x5a, 0x7f, 0x9f, 0x86, 0x73, 0xe0, 0xb1, 0x6a, 0x87, 0xf3, 0x73, 0x71, 0x9a, 0x07, + 0xe0, 0xc7, 0xe8, 0x1d, 0xc3, 0x62, 0xe6, 0x28, 0x67, 0x5a, 0xbe, 0x54, 0xaf, 0xbc, 0x74, 0x55, + 0xbd, 0x04, 0x43, 0x98, 0x99, 0xae, 0x73, 0xfb, 0x92, 0xfd, 0x84, 0x70, 0xf5, 0xea, 0x0a, 0x6a, + 0x65, 0x1b, 0xe0, 0xe3, 0xd7, 0x34, 0x40, 0xa5, 0xba, 0x55, 0x23, 0x6c, 0xbd, 0x7f, 0x29, 0x64, + 0x5a, 0xe6, 0xbc, 0xd5, 0xb4, 0x66, 0x91, 0xbb, 0x0b, 0x75, 0xbf, 0x57, 0xdf, 0xa7, 0xc3, 0x8c, + 0x0a, 0x45, 0x43, 0xcd, 0xa5, 0xe9, 0xaa, 0x5b, 0x15, 0xee, 0x82, 0xe5, 0xf4, 0xc9, 0xef, 0x57, + 0x6d, 0xe7, 0xe5, 0x55, 0xdb, 0xf9, 0xf3, 0xaa, 0xed, 0xfc, 0x7a, 0xdd, 0xde, 0x78, 0x79, 0xdd, + 0xde, 0xf8, 0xe3, 0xba, 0xbd, 0xf1, 0xf3, 0xe7, 0x63, 0xae, 0xe3, 0xcb, 0xc0, 0x0b, 0xe5, 0xb4, + 0x6f, 0x73, 0xc0, 0x2b, 0x50, 0x2c, 0xfa, 0xf3, 0x57, 0xbe, 0xcf, 0x60, 0x77, 0xb0, 0x03, 0x5f, + 0xa6, 0xcf, 0xfe, 0x0b, 0x00, 0x00, 0xff, 0xff, 0x4c, 0xe5, 0x71, 0xc2, 0xc5, 0x07, 0x00, 0x00, } func (m *IndexedHeader) Marshal() (dAtA []byte, err error) { @@ -620,6 +737,96 @@ func (m *ChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *FinalizedChainInfo) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *FinalizedChainInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *FinalizedChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintZoneconcierge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.BtcSubmissionKey != nil { + { + size, err := m.BtcSubmissionKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintZoneconcierge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if m.RawCheckpoint != nil { + { + size, err := m.RawCheckpoint.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintZoneconcierge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.EpochInfo != nil { + { + size, err := m.EpochInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintZoneconcierge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if m.FinalizedChainInfo != nil { + { + size, err := m.FinalizedChainInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintZoneconcierge(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintZoneconcierge(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *ProofEpochSealed) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -835,6 +1042,39 @@ func (m *ChainInfo) Size() (n int) { return n } +func (m *FinalizedChainInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.ChainId) + if l > 0 { + n += 1 + l + sovZoneconcierge(uint64(l)) + } + if m.FinalizedChainInfo != nil { + l = m.FinalizedChainInfo.Size() + n += 1 + l + sovZoneconcierge(uint64(l)) + } + if m.EpochInfo != nil { + l = m.EpochInfo.Size() + n += 1 + l + sovZoneconcierge(uint64(l)) + } + if m.RawCheckpoint != nil { + l = m.RawCheckpoint.Size() + n += 1 + l + sovZoneconcierge(uint64(l)) + } + if m.BtcSubmissionKey != nil { + l = m.BtcSubmissionKey.Size() + n += 1 + l + sovZoneconcierge(uint64(l)) + } + if m.Proof != nil { + l = m.Proof.Size() + n += 1 + l + sovZoneconcierge(uint64(l)) + } + return n +} + func (m *ProofEpochSealed) Size() (n int) { if m == nil { return 0 @@ -1372,6 +1612,268 @@ func (m *ChainInfo) Unmarshal(dAtA []byte) error { } return nil } +func (m *FinalizedChainInfo) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowZoneconcierge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FinalizedChainInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FinalizedChainInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowZoneconcierge + } + 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 ErrInvalidLengthZoneconcierge + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthZoneconcierge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedChainInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowZoneconcierge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthZoneconcierge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthZoneconcierge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FinalizedChainInfo == nil { + m.FinalizedChainInfo = &ChainInfo{} + } + if err := m.FinalizedChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field EpochInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowZoneconcierge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthZoneconcierge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthZoneconcierge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.EpochInfo == nil { + m.EpochInfo = &types1.Epoch{} + } + if err := m.EpochInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RawCheckpoint", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowZoneconcierge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthZoneconcierge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthZoneconcierge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.RawCheckpoint == nil { + m.RawCheckpoint = &types2.RawCheckpoint{} + } + if err := m.RawCheckpoint.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BtcSubmissionKey", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowZoneconcierge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthZoneconcierge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthZoneconcierge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.BtcSubmissionKey == nil { + m.BtcSubmissionKey = &types3.SubmissionKey{} + } + if err := m.BtcSubmissionKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowZoneconcierge + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthZoneconcierge + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthZoneconcierge + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Proof == nil { + m.Proof = &ProofFinalizedChainInfo{} + } + if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipZoneconcierge(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthZoneconcierge + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *ProofEpochSealed) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1430,7 +1932,7 @@ func (m *ProofEpochSealed) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorSet = append(m.ValidatorSet, &types1.ValidatorWithBlsKey{}) + m.ValidatorSet = append(m.ValidatorSet, &types2.ValidatorWithBlsKey{}) if err := m.ValidatorSet[len(m.ValidatorSet)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -1694,7 +2196,7 @@ func (m *ProofFinalizedChainInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ProofEpochSubmitted = append(m.ProofEpochSubmitted, &types2.TransactionInfo{}) + m.ProofEpochSubmitted = append(m.ProofEpochSubmitted, &types3.TransactionInfo{}) if err := m.ProofEpochSubmitted[len(m.ProofEpochSubmitted)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err }