Skip to content

Commit

Permalink
Fix/ci release (#4)
Browse files Browse the repository at this point in the history
* fix(cli,oracle): export + vote power (ExocoreNetwork#53)

* fix(oracle):skip cache commit when refill cache on node restart

* text: add comments

* fix(oracle):set recentParams when commit cached params

* typo(oracle):lint

* fix:CVE-2024-3817, update getter to 1.7.4

* fix(cli): make `export` work again

* fix(dogfood): remove debug line

* refactor(dogfood): load `AccAddress` for val

* fix(oracle): use `GetConsensusPower` correctly

The `v.GetConsensusPower` function expects the power reduction factor as
a parameter, and not the number of bonded tokens (that is available to
the validator object anyway).

* fix(cli): pass `chainID` via `ctx` and not param

Tested with `exocored export | jq`

* fix(ci): remove deprecated config

* fix(test): remove call count for GetBondedTokens

---------

Co-authored-by: leonz789 <[email protected]>
Co-authored-by: cloud8little <[email protected]>

* fix(delegation): don't error if no delegations (ExocoreNetwork#60)

* fix(delegation): don't error if no delegations

If both the operator and its stakers exit the system, the TotalAmount
and TotalShare are 0. In that event, it is not erroneous to return a
value of 0 for the share and the amount, respectively.

Updates tests as well

Fixes ExocoreNetwork#59

* chore: use lowercase for local var

* feat: CLIs for delegation, operator, dogfood (ExocoreNetwork#46)

* refactor(operator): use flags to RegisterOperator

Instead of relying on the positioning of arguments, the flags mechanism
(as seen in the Cosmos SDK's x/staking) offers a cleaner approach.

* feat(operator): add commission rate to CLI

* refactor(operator): validate registration input

* feat(operator): add `OptIn` to AVS function

* refactor(assets): remove app chains

These should be in the AVS module anyway.

* fix(operator): share `opt.go`, `consensus_keys.go`

An operator must first opt into the chain-as-an-AVS before assigning a
consensus key for said chain. Similarly, to opt out, the operator must
first remove their key and then opt out.

* fix(operator): correct interface

* fix(dogfood): remove unused code

* feat(operator): add AVS opt out CLI

* fix(operator): implement msg server

* feat(operator): implement cons key interfaces

* fix(operator): skip opting out operators from list

* fix typos

* fix(dogfood): update operator hook assumptions

* feat(operator): add QueryAllOperatorKeysByChainID

* feat(operator): implement QueryOperatorConsAddress

* feat(operator): implement QueryAllOperatorConsAddr

* feat(dogfood): implement QueryOptOutsToFinish

* feat(dogfood): QueryOperatorOptOutFinishEpoch

* feat(delegation): query undelegation hold count

* feat(dogfood): implement QueryUndelegationsToMature

* fix(delegation): use string record key type

* feat(dogfood): query undelegation maturity epoch

* feat(dogfood): query validator

* fix(operator): allow build

* fix(dogfood): actually schedule cons addr prune

* chore: lint and tests

* fix: use consistent naming of query members

* remove unused comments

* doc: update comment for why chain not chain_id

* fix(operator): add Router for tx

* chore(lint)

* fix(test): fix operator tests, disable 1

* fix(proto): prevent complains about duplicate reg

* fix(operator): query operator CLI with address

* feat(operator): add set-cons-key and removal cli

* fix(dogfood,operator): clear prev keys correctly

AVSs are free to choose their own epoch schedule. The previous key needs
to be cleared only at epoch end (and not at block end as it was done
previously). Additionally, it is specific to the AVS identifier (the
chainID in the case of the dogfood module) that should be cleared.

BREAKING: the format of storing the previous consensus keys has changed.
Previously, they were indexed by operator's AccAddress and chainID. Now
they are indexed by the reverse of it, that is, chainID + AccAddress.
This is done to ensure easy clearing of the data for each specific AVS.

BREAKING: the `prefixSlashAssetsState` and another prefix were sharing
the same value of 5 `BytePrefixForOperatorAndChainIDToConsKey`. This has
been fixed.

* fix(operator): remove pointer receiver

* refactor: clarify all vs active operators

* feat(operator): add get all operators query

* fix(operator): parse cons key correctly

* chore(lint): placate proto-lint

* chore(lint): placate golang lint

* fix(operator): impl for msgs GetSignBytes, Type

Without these functions implemented, sending a transaction with the
wrong chain-id produces a panic while verifying the signature. This
panic happens on the receiving node (and not the sender), although
consensus isn't impacted.

With these functions implemented, the receiving node replies "signature
verification failed, please verify account number (%d) and chain-id
(%s)". If the transaction were only legacy amino, even the "sequence
(%d)" would have shown up in the error message.

* fix: validatorupdateblock update every block cause messy of upgrade (ExocoreNetwork#57)

* fix(oracle): add copy of aggregatorContext for checkTx-mode of execution (ExocoreNetwork#50)

* fix(oracle): add copy of aggregatorContext for checkTx-mode of execution

* fix lint

* fix(oracle):use set to copy bigInt

* fix(oracle):deep copy on price

* fix(oracle):get rid of map in cache for deteministic serialize

* fix(oracle):bigint set, slice initialize

* GetConsensusPower should have reduction as input

* test(oracle): remove unused monkey-patch

* test: remove unused monkey mock

* fix: error retruned by precompiled contract can not be caught with tr… (ExocoreNetwork#69)

* fix: error retruned by precompiled contract can not be caught with try/catch in EVM

* fix withdraw_integrate_test

* fix failed tests and add some TODO comments

* patch clientchains precompile

* [fix] Fix the issue regarding voting power not taking effect (ExocoreNetwork#65)

* fix the issue ExocoreNetwork#58 regarding voting power not taking effect

* change prepareDelegation to be compatible with PR61

* update ibc-go to v7.4.0 to fix the Vulnerability GO-2024-2694

* change the epoch configuration to hour when start a local node through the local_node.sh

* using shfmt to fix the shell lint error

* refactor: refactor avs and add test

* oracle:add fields for params (ExocoreNetwork#75)

* oracle:add fields for params

* udpate default params with new fields

* fix lint

* test(oracle): convert int type

* feat(build): add commit hash in version name (ExocoreNetwork#76)

* fix:fix golangci-lint error

* fix:fix issues in comments

* fix(assets,delegation): case insensitive query (ExocoreNetwork#80)

* fix(delegation): convert query to lowercase

* fix(assets): convert query to lowercase

* refactor(assets,delegation): check case with flag

* fix(assets,delegation): stateless validate cli

* fix(assets): deprecate StakerExoCoreAddr

* fix(assets): remove StakerExoCoreAddr

* fix(assets): require non-zero address length (ExocoreNetwork#82)

* fix(localnet): set `address_length`

* fix(assets): validate non-zero address length

* fix(app): reorder the EndBlockers (ExocoreNetwork#98)

* chore: update go version to 1.21.11

* fix(ci): disable buggy workflows

till they can be fixed

* fix(app): reorder the EndBlockers

The `EndBlockers` do the following jobs:
- `x/operator` saves the USD value for delegations, indexed by operator.
- `x/dogfood` uses the USD value obtained from `x/operator` to calculate
  the new voting power and forwards the new validator set to Tendermint.
  It also decreases the hold count on pending undelegations maturing at
  that epoch, from the perspective of the dogfood-AVS.
- `x/delegation` releases any matured undelegations and makes assets
  available for withdrawal.
- `x/oracle` fetches the new voting power from `x/dogfood` and prepares
  for the next round.

The new order is updated to reflect the above functions. As a
consequence, delegations made during blocks just before the epoch ends
will also accurately update the vote power of the validators.

* chore: lint

* fix(docker): update to new alpine

* feat(ci): add `docker build` CI

* chore(ci): run `lint` on workflows

* chore(ci): run `lint` on workflows again

* fix(ci): trigger Dockerbuild only if file changes

* fix(ci): remove backticks from workflow name

* fix(ci): lint the workflow again

* fix(ci): use correct path to trigger

* fix(ci): specify go version in consensuswarn (ExocoreNetwork#103)

* refactor(dogfood): return cons key in `Validator` (ExocoreNetwork#72)

* refactor(dogfood): return cons key in `Validator`

Until `x/dogfood` was made compatible with `x/evm` and `x/oracle`, a
`nil` validator was being returned by `ValidatorByConsAddr`. This
validator was correctly processed by the `x/evidence` module when it
handled equivocation evidence.

However, with the changes introduced for compatibiltiy with `x/evm`, the
validator returned is no longer nil. Such a validator will have an
operator address, whose presence will trigger a call to `Validator`,
which is implemented by this change.

* fix(dogfood): add expected keeper interface

* fix(dogfood): return `validator` not `val`

* fix(operator,dogfood): return val with key

* fix(dogfood): correctly set bonded status

The validators loaded from x/dogfood are considered bonded, while the
validators pulled from x/operator can have any status.

* doc(dogfood): add error logs

* fix(ci): specify go version in consensuswarn

* feat(dogfood): implement `ExportGenesis` (ExocoreNetwork#95)

* feat(dogfood): re-scaffold genesis

In preparation for the `ExportGenesis` implementation, re-scaffold the
genesis state of the dogfood module.

* fix(dogfood): remove deprecated keys

* refactor: use new dogfood genesis

* refactor(dogfood): - validatorupdate from gen

* refactor(dogfood): update ImportGenesis

...for new genesis structure

* refactor(dogfood): simplify gen state names

* feat(dogfood): implement ExportGenesis

Partially resolves ExocoreNetwork#54

* chore: lint

* proto(dogfood): remove unused import

* fix(local): compat with new dogfood genesis

* chore: lint proto file and gen

* fix(test): use correct struct member name

* chore: update go version to 1.21.11

* fix(ci): disable buggy workflows

till they can be fixed

* chore: lint

* fix(dogfood): don't stop iterating in export

The return value should be `false` to continue

* fix(doc): add comment about exported validators

* doc(dogfood): log iteration failure

If such an iteration failure happens during export, a pipe to `jq` will
fail and inform the user of the failure.

* docs(delegation): validation of record key params

* fix(app): register operator hooks for dogfood

* feat(operator): return `OptingOut` status

Whenever a query for consensus keys or addresses is answered, it should
specify whether the operator is currently in the process of opting out.
This is because the data is retained until the opt out is complete, even
though the operator may not be actively validating. The purpose of the
data retention, as always, is to slash the operator (if required), based
on the key.

* refactor(operator): rationalize opt-in/out

When an operator opts into an AVS, they should be required to supply the
consensus (or other) key to opt-in. Similarly, when they opt-out, the
key should automatically be removed.

This commit implements that functionality, however, it is restricted to
`ctx.ChainID()`. For an overbroad implementation, an AVS registry from
AVS address -> key type should be implemented.

* refactor(delegation): verbose panic

* fix(dogfood): query validator by cons addr not hex

* refactor(dogfood): move opt func to correct loc

* chore(x/operator): lint go

* fix(operator): wrap and return error

---------

Co-authored-by: cloud8little <[email protected]>

* fix(ci): upgrade deprecated goreleaser

- Set version in `.goreleaser.yml`
- Correct the `goreleaser-cross` version to use the latest available and
  compatible version
- Update workflow to test release builds on pull requests, but not
  publish them

---------

Co-authored-by: Max <[email protected]>
Co-authored-by: leonz789 <[email protected]>
Co-authored-by: Leon <[email protected]>
Co-authored-by: adu <[email protected]>
Co-authored-by: TimmyExogenous <[email protected]>
Co-authored-by: trestin <[email protected]>
Co-authored-by: trestin-web3 <[email protected]>
  • Loading branch information
8 people authored Jun 21, 2024
1 parent e14054a commit 04fb243
Show file tree
Hide file tree
Showing 151 changed files with 15,692 additions and 3,076 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ante-benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
- name: Setup Golang
uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true

- name: Run benchmark tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true
- uses: technote-space/[email protected]
id: git_diff
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/consensuswarn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ jobs:
contents: read
pull-requests: write # For reading the PR and posting comment
runs-on: ubuntu-latest
env:
GOTOOLCHAIN: "go1.21.11"
steps:
# This is used for warning when a PR touches any of the roots, or any function or method directly or indirectly called by a root
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true
- name: "Checkout Repository"
uses: actions/checkout@v4
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/docker-localnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Docker build for localnet
on:
pull_request:
paths:
- networks/local/exocore/Dockerfile
- networks/Makefile
push:
paths:
- networks/local/exocore/Dockerfile
- networks/Makefile
branches:
- develop
- main
- master
- release/**

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: make -C ./networks
30 changes: 30 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Docker build in root directory
on:
pull_request:
paths:
- Dockerfile
push:
paths:
- Dockerfile
branches:
- develop
- main
- master
- release/**

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: docker build .
27 changes: 15 additions & 12 deletions .github/workflows/goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
name: goreleaser

permissions:
# github releases
contents: write

on:
push:
tags:
- "v*.*.*"
env:
CGO_CFLAGS: "-O -D__BLST_PORTABLE__"
CGO_CFLAGS_ALLOW: "-O -D__BLST_PORTABLE__"
# Validate on develop, main, and master branches that the releaser
# is working as expected.
pull_request:
branches:
- develop
- main
- master

jobs:
goreleaser:
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.9'
go-version: '1.21.11'
check-latest: true
- name: release dry run
- name: Release dry run
run: make release-dry-run
- name: setup release environment
- name: Release publish
# Do not publish the release for pull requests.
if: github.event_name != 'pull_request'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |-
echo 'GITHUB_TOKEN=${{secrets.GITHUB_TOKEN}}' > .release-env
- name: release publish
run: make release
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
# Required: setup-go, for all versions v3.0.0+ of golangci-lint
- uses: actions/setup-go@v5
with:
go-version: '1.21.9'
go-version: '1.21.11'
# Use pinned versions, not git versions
check-latest: false
# Match `golangci-lint-action` recommendation
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/proto-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ on:
jobs:
download-artifact-and-comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.conclusion == 'success'
if: ${{ false }}
steps:
- name: 'Download artifact'
uses: actions/[email protected]
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ on:
jobs:
download-artifact-and-comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
if: ${{ false }}
steps:
- name: Download artifact
uses: actions/[email protected]
Expand Down
3 changes: 1 addition & 2 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ run:
tests: false
timeout: 5m
concurrency: 4
go: "1.21.11"

linters:
enable:
Expand Down Expand Up @@ -49,8 +50,6 @@ linters-settings:
allow-leading-space: true
require-explanation: false
require-specific: false
gofumpt:
lang-version: "1.21.9"
gomodguard:
blocked:
versions: # List of blocked module version constraints
Expand Down
4 changes: 3 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2

before:
hooks:
- go mod download
Expand Down Expand Up @@ -101,4 +103,4 @@ changelog:
- '^docs:'
- '^test:'
snapshot:
name_template: "{{ .Tag }}-next"
name_template: "{{ .Tag }}-{{ .Branch }}@{{ .ShortCommit }}-{{ .GitTreeState }}"
5 changes: 3 additions & 2 deletions .protolint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,9 @@ lint:
- For
- Of
# # The specific keywords including prepositions to ignore. E.g. EndOfSupport is a term you would like to use, and skip checking.
# excludes:
# - EndOfSupport
excludes:
- OptOutOfAVSReq
- OptOutOfAVSResponse

# # RPC_NAMES_CASE rule option.
# rpc_names_case:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This is the published docker image for exocore.

FROM golang:1.21.9-alpine3.18 AS build-env
FROM golang:1.21.11-alpine3.19 AS build-env

WORKDIR /go/src/github.com/ExocoreNetwork/exocore

COPY go.mod go.sum ./

RUN apk add --no-cache ca-certificates=20230506-r0 build-base=0.5-r3 git=2.40.1-r0 linux-headers=6.3-r0
RUN apk add --no-cache ca-certificates=20240226-r0 build-base=0.5-r3 git=2.43.4-r0 linux-headers=6.5-r0

RUN --mount=type=bind,target=. --mount=type=secret,id=GITHUB_TOKEN \
git config --global url."https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/".insteadOf "https://github.com/"; \
Expand All @@ -16,14 +16,14 @@ COPY . .

RUN make build && go install github.com/MinseokOh/toml-cli@latest

FROM alpine:3.18
FROM alpine:3.19

WORKDIR /root

COPY --from=build-env /go/src/github.com/ExocoreNetwork/exocore/build/exocored /usr/bin/exocored
COPY --from=build-env /go/bin/toml-cli /usr/bin/toml-cli

RUN apk add --no-cache ca-certificates=20230506-r0 libstdc++=12.2.1_git20220924-r10 jq=1.6-r4 curl=8.5.0-r0 bash=5.2.15-r5 vim=9.0.2073-r0 lz4=1.9.4-r4 rclone=1.62.2-r6 \
RUN apk add --no-cache ca-certificates=20240226-r0 libstdc++=13.2.1_git20231014-r0 jq=1.7.1-r0 curl=8.5.0-r0 bash=5.2.21-r0 vim=9.0.2127-r0 lz4=1.9.4-r5 rclone=1.65.0-r3 \
&& addgroup -g 1000 exocore \
&& adduser -S -h /home/exocore -D exocore -u 1000 -G exocore

Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,9 @@ localnet-show-logstream:
###############################################################################

PACKAGE_NAME:=github.com/ExocoreNetwork/exocore
GOLANG_CROSS_VERSION = v1.21.9
# There is no `goreleaser-cross` package for 1.21.11, so we use the next
# available version of v1.22 with goreleaser version 2.0.0
GOLANG_CROSS_VERSION = v1.22-v2.0.0
GOPATH ?= '$(HOME)/go'
release-dry-run:
docker run \
Expand All @@ -537,7 +539,7 @@ release-dry-run:
-v ${GOPATH}/pkg:/go/pkg \
-w /go/src/$(PACKAGE_NAME) \
ghcr.io/goreleaser/goreleaser-cross:${GOLANG_CROSS_VERSION} \
--clean --skip-validate --skip-publish --snapshot
--clean --skip validate,publish --snapshot

release:
@if [ ! -f ".release-env" ]; then \
Expand Down
14 changes: 9 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,10 @@ func NewExocoreApp(
app.AssetsKeeper, // assets for vote power
)

(&app.OperatorKeeper).SetHooks(
app.StakingKeeper.OperatorHooks(),
)

(&app.EpochsKeeper).SetHooks(
app.StakingKeeper.EpochsHooks(),
)
Expand Down Expand Up @@ -939,12 +943,12 @@ func NewExocoreApp(

app.mm.SetOrderEndBlockers(
capabilitytypes.ModuleName,
crisistypes.ModuleName, // easy quit
stakingtypes.ModuleName,
operatorTypes.ModuleName, // after staking keeper
delegationTypes.ModuleName, // after operator keeper
crisistypes.ModuleName, // easy quit
operatorTypes.ModuleName, // first, so that USD value is recorded
stakingtypes.ModuleName, // uses the USD value recorded in operator to calculate vote power
delegationTypes.ModuleName, // process the undelegations matured by dogfood
govtypes.ModuleName, // after staking keeper to ensure new vote powers
oracleTypes.ModuleName, // after staking keeper to ensure new vote powers
oracleTypes.ModuleName, // prepares for next round with new vote powers from staking keeper
evmtypes.ModuleName, // can be anywhere
feegrant.ModuleName, // can be anywhere
// no-op modules
Expand Down
3 changes: 3 additions & 0 deletions app/ethtest_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"time"

"cosmossdk.io/math"
"cosmossdk.io/simapp"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/codec"
Expand Down Expand Up @@ -252,6 +253,8 @@ func genesisStateWithValSet(codec codec.Codec, genesisState simapp.GenesisState,
Power: 1,
},
},
[]dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{},
[]dogfoodtypes.EpochToUndelegationRecordKeys{}, math.NewInt(1),
)
genesisState[dogfoodtypes.ModuleName] = codec.MustMarshalJSON(dogfoodGenesis)

Expand Down
12 changes: 6 additions & 6 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ func (app *ExocoreApp) ExportAppStateAndValidators(
) (servertypes.ExportedApp, error) {
// Creates context with current height and checks txs for ctx to be usable by start of next
// block
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()})
ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}).
WithChainID(app.ChainID())

// We export at last height + 1, because that's the height at which
// Tendermint will start InitChain.
Expand All @@ -74,14 +75,13 @@ func (app *ExocoreApp) ExportAppStateAndValidators(
return servertypes.ExportedApp{}, err
}

validators, err := app.StakingKeeper.WriteValidators(ctx)
if err != nil {
return servertypes.ExportedApp{}, err
}
// the x/dogfood validator set is exported in its `val_set` key, and hence,
// does not need to be part of the app export. in other words, we do not
// duplicate the exported validator set. besides, as far as i can tell, the
// SDK does not use the Validators member of the ExportedApp struct.

return servertypes.ExportedApp{
AppState: appState,
Validators: validators,
Height: height,
ConsensusParams: app.BaseApp.GetConsensusParams(ctx),
}, nil
Expand Down
6 changes: 6 additions & 0 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"

"cosmossdk.io/math"
"cosmossdk.io/simapp"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
Expand Down Expand Up @@ -267,13 +268,18 @@ func GenesisStateWithValSet(app *ExocoreApp, genesisState simapp.GenesisState,
delegationGenesis := delegationtypes.NewGenesis(delegationsByStaker)
genesisState[delegationtypes.ModuleName] = app.AppCodec().MustMarshalJSON(delegationGenesis)

// create a dogfood genesis with just the validator set, that is, the bare
// minimum valid genesis required to start a chain.
dogfoodGenesis := dogfoodtypes.NewGenesis(
dogfoodtypes.DefaultParams(), []dogfoodtypes.GenesisValidator{
{
PublicKey: consensusKeyRecords[0].Chains[0].ConsensusKey,
Power: 1,
},
},
[]dogfoodtypes.EpochToOperatorAddrs{}, []dogfoodtypes.EpochToConsensusAddrs{},
[]dogfoodtypes.EpochToUndelegationRecordKeys{},
math.NewInt(1), // total vote power
)
genesisState[dogfoodtypes.ModuleName] = app.AppCodec().MustMarshalJSON(dogfoodGenesis)

Expand Down
Loading

0 comments on commit 04fb243

Please sign in to comment.