Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor] remove unused ginkgo #17

Closed
wants to merge 59 commits into from

Conversation

leonz789
Copy link
Contributor

Description

refactor
currently this project mainly use testify as test framework, ginkgo is unused with empty entry point left.


Closes #XXX

The dogfooding module, as previously described, is used as the staking
module for the Exocore chain. It allows operators and delegators to
deposit and delegate their assets on a client chain for staking. The
staked assets are then used to secure the Exocore chain.

The parameters used by this module are the following:
 - EpochsUntilUnbonded, which represents the number of epochs after
   which an unbonding is effective.
 - EpochIdentifier, which is the identifier of the epoch duration. It
   should be valid according to the epoch keeper of `app.go`, and is
   thus constrained to the options week/day/hour.
 - MaxValidators, which is the maximum number of validators that will be
   forwarded to ABCI.
 - HistoricalEntries, which is the number of historical entries to
   persist in state. These are used by IBC.
The bootstrapping smart contract is responsible for accepting user
deposits, operator registration, and delegations. These operations may
flow freely until 24 hours (say) before the spawn time of Exocore, at
which the contract will be locked. During this time, the genesis state
of Exocore will be amended to record the initial deposits, delegations,
operator registrations and public keys. The last of these will feed into
the dogfooding module which will mark these operators as part of the
initial validator set and allow block production.

This PR includes the capability to load that state, and save the newly
created operator information to disk. In addition, the staking hooks
have been set up (partially) in this PR, which allow the SDK's slashing
keeper to record validator signing rates for downtime slashing.
The operator module should restrict an operator from doing things that
are logically not possible. For example, an operator that is already
opted in should not be able to opt in again. Similarly, an operator who
has opted out of a chain should not be able to replace the key for that
chain without opting back in. Based on these assumptions, the comment
maps out the list of possible operations that can happen within an epoch
and is used to ensure that all of the cases result in the unbonding
period being enforced accurately.
Whenever a delegation or undelegation event happens in the delegation
module, the hooks are called. For both of these events, as long as the
operator is not in the process of opting out from the chain, consensus
key operations are queued to be applied at the end of the current epoch.

For undelegation, specifically, the `recordKey` identifier of the
undelegation is used to mark within the delegation module that the
undelegation should be held until released at some point in the future
(as opposed to releasing it after a fixed number of blocks, which is the
default behaviour). This point in the future is calculated as the
earlier of the unbonding period end, or the operator's opt out period
end (if the operator is opting out).
The epochs hooks are used by the dogfood module to subscribe to the
start and end times of epochs. After an epoch ends, the operations that
are currently in the queue are upgraded to "pending", which are applied
at the end of the block. The upgrades are also made to undelegation
maturity, operator opt out, and operator key replacement data. Once the
pending actions are applied, they are cleared from the queue.

This branch is merged into dogfood-part5, which forms the basis of ExocoreNetwork#121.
The validator set is not bound to change at each block. It can only
change at the end of an epoch, or following a slashing event. Therefore,
storing the historical information for each block is redundant. Instead,
we create a validator set id corresponding to each validator set, and
map each height to a validator set id. The mapping and the validator set
id are pruned once the historical info for a height is not required.

TODO: actually store the validator set against each id, within the
`EndBlock` function at the end of the epoch.
The delegation module calls the records as undelegation records, and
within itself stores the identifier for the record as the record key.
The dogfood module should follow the same naming convention and call
them undelegation record keys for clarity.
...and refactor getters / setters to `pending.go`.
* feat(dogfood): implement sdk staking interface

The interface required by IBC was already implemented in
`validators.go`. This PR takes that a step further and implements the
interfaces required to use the dogfood module as a drop-in replacement
for the SDK's staking module. The interfaces implemented are those
expected by the slashing, evidence and `genutil` modules. An explanation
has been provided above each function to explain why and where it is
called, and if its implementation is really necessary. There are still
some TODOs left in this PR that depend on the overall slashing /
operator design.

This branch is merged into dogfood-part6, which forms the basis of ExocoreNetwork#122.

* fix(dogfood): store val set id + val set

at genesis, the val set id starts with 1. each time the validator set
changes, the val set id of the current block is retrieved. for the next
block, the val set is is stored as this id + 1.

* fix(dogfood): increment val set id correctly

in the case of genesis, we should not use height + 1 as the key in the
mapping; rather, it should be height. in all other cases, the mapping
key is height + 1. the value is the val set id in all cases.
feat(dogfood): implement epochs hooks + end block
feat(dogfood): load genesis state for bootstrap
MaxMustermann2 and others added 29 commits February 28, 2024 14:02
* chore(build): use `ExocoreNetwork/exocore` path

* chore(build): try to fix consensus warn

* chore(build): grant labeler write permissions

* chore(ci): remove push labeler only PR

* Revert "chore(ci): use `ExocoreNetwork/exocore`"

This reverts commit cf67225.
* chore(ci): fix DeliverTx

* chore(ci): disable Solidity test

* chore(build): remove extra tab

* chore(build): lint the proto files

* chore(build): generate proto

* chore(build): update for new proto

* chore(ci): remove blank line

* chore(lint): remove unused params

* chore(ci): upgrade vuln deps

* chore(ci): e2e test workflow

* chore(ci): disable e2e tests, we have none

* chore(ci): disable codecov upload

* chore(ci): fail only high vuln deps
* chore(ci): buf compare against develop HEAD

...and not develop HEAD~1. I don't know how this was missed.

* proto(reward): remove blank lines

almost empty commit to trigger the `proto.yml` CI.
* chore(ci): fix super linter config

The super-linter.yml workflow seems to be running on pull requests and
branches. However, for pull requests, it fails silently with the logs
reporting an error. On branches, it fails actually with an ❌ emoji.

* chore(ci): update super linter version

* chore(ci): remove should_follow_golang_style

for proto files, should_follow_golang_style can be removed.

* chore(ci): disable infra-as-code linter

* chore(ci): run protolint autofix

* chore(ci): add comments to all fields

* doc(ci): add comment to explain HEAD~1

* chore(build): run buf generate
The `// #nosec G703` line needs to be placed above the multi-line
statement that it is ignoring, not in the middle of the statement which
contains the part to ignore.
use shared test utils to refine the test codes

fix the problem in tests caused by denom rename
fix(UpdateParams/tests) Fix bugs and refine tests to ensure ‘make test’ works
* feat(dogfood): add asset_ids param

* feat(dogfood): move to average pricing

* fix(dogfood): relint, add epoch id for avg

* chore(dogfood): golangci-lint

* chore(dogfood): lint gosec again

* fix(dogfood): use correct string for pubkey

* fix(dogfood): ++ the undelegation hold count

The line was accidentally deleted.
* chore(lint): satisfy gitleaks

If a variable name contains the word KEY, gitleaks does not like it and
flags it as a potential secret. I have changed the name of the variable
in these files from KEYALGO to ALGO since it is not a secret but rather
the algorithm of the key generation. That silences gitleaks.

* chore(lint): placate YAML linter

added a blank line at the end of `.golangci.yml`

* chore(lint): activate Docker / IAAS linter

* chore(lint): placate shellcheck

* chore(lint): placate markdownlint

* chore(lint): placate markdownlint from `lint.yml`

The previous commit worked on the markdownlint from the super-linter.

* build: use test keyring in localnet

The OS keyring may not always be available.

* chore(lint): merge docker RUN statements

It can potentially reduce the number of layers in the image, making it
smaller and more efficient to build and pull.

* fix(localnet): remove seed URL upon init

* chore(lint): some lint suggestions for Dockerfile

Note that this file is used from the root of the project via `make
localnet-build`, which is why the paths work.

* chore(lint): apply shfmt

* chore(lint): add docker healthcheck and user

* chore(build): update release go version to 1.21

* chore(ci): add permissions to workflows

* chore(ci): skip generated files

* chore(ci): placate yaml linter

* chore(ci): use correct argument name for checkov

* chore(ci): add top level permissions to codeql

* chore(ci): add json super linter to match develop

* chore(ci): disable JSON super linter

* chore(lint): trigger lint workflows with comment

* chore(deps): upgrade protobuf to 1.33.0

CVE-2024-24786 / GO-2024-2611 is fixed with this upgrade. Even though
this package is fundamental to our system, the changes between 1.31.0
and 1.33.0 are minor.

* Revert "chore(deps): upgrade protobuf to 1.33.0"

This reverts commit c09f986.

* chore(deps): update protobuf

A vulnerability has been fixed in v1.33.0 of google.golang.org/protobuf
and we must update the associated github.com/golang/protobuf as well.

* chore(ci): coverage badge comment on PR

* chore(build): exclude testutil from coverage

* chore(ci): add test coverage commenting workflow

* chore(ci): use step output instead of env

* chore(ci): add commit hash in test comment

* chore(ci): remove deprecated output

The test workflow will not fully run right now because it runs on
`pull_request_target` which must be merged into the base branch first.
* chore(lint): security options in docker compose

* chore(lint): unlock mutex in testutil

* chore(lint): limit value of uint using strconv

* fix(lint): check out old code correctly for diff

In the event of a pull_request_target action, the checkout action by
default does not check out the PR but the base repository. This change
explicitly sets it up to check out the PR's head branch.

* Revert "fix(lint): check out old code correctly"

This reverts commit 4f24ba2.

* chore(lint): split test coverage commenter

See comment on test.yml for explanation.

* chore(ci): trigger go based CIs

delete superfluous comment

* fix(lint): add empty line at end of yaml file

* chore(lint): fix the test-comment workflow

- shell check the script
- add top level permissions

* Revert "chore(lint): unlock mutex in testutil"

This reverts commit a6cdb02. It is said
that the unlocking of the mutex might deviate from the original purpose
of the function. Instead, we are electing to ignore the testutil folder,
which will be sent in the next commit.

* chore(ci): ignore testutil for semgrep

* chore(ci): do not fail if breaking proto changes

* chore(ci): trigger buf-breaking-action check

This commit will be reverted before merge of the PR.

* chore(ci): add comment if buf reports change

* fix(ci): only overwrite prev coverage comment

* fix(ci)(proto): +comment read/write permission

* fix(ci): add comment rw permission to job

* fix(ci): update job name in test-comment

* fix(ci): give `proto.yml` all rw permissions

* fix(ci): split buf-breaking and its comment

As before, the `pull_request` event does not have enough permissions to
make a comment and the `pull_request_target` cannot safely check out the
PR. Hence, we split the commenting process into 2 parts:
 - Run the buf breaking action and do not fail the workflow even if it
   errors
 - In a separate workflow, consume the artifact produced by the previous
   workflow and comment (or append to an existing comment) its contents.
Note that the *-comment.yml workflows are being commented blindly at the
moment because it is not possible to run them until they exist on the
branch.

* fix(ci): if condition shouldn't be always true

* Revert "chore(ci): trigger go based CIs"

This reverts commit 62b3744.

* Revert "chore(ci): trigger buf-breaking-action...

check." This reverts commit 88566fd.
@leonz789 leonz789 closed this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants