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

merge devnet-5 version to base branch #266

Merged
merged 93 commits into from
Nov 20, 2024

Conversation

SebastianElvis
Copy link
Member

@SebastianElvis SebastianElvis commented Nov 14, 2024

NOTE: This PR should be merged by a merge commit

RafilxTenfen and others added 30 commits September 26, 2024 10:40
- Add default gen state to `ibc` module
- Add `jq` to dockerfile, needed to local deployments
- Specify min gas prices as default `1ubbn` in a single place
When we initialize epoch, we should also initialize epoch 1. Otherwise,
epoch 0 will be accessed
Forgot to add changelog in #91
just a show case of changes necessary to remove zoneconciege module
- Update upgrade name from signet-launch to v1
- A new file with data for token distribution to run during the upgrade.
Expected template:

```json
{
  "token_distribution": [
    {
      "address_sender": "bbn14d97wthm9fqvvdd96ax8lnfppwknndxztevs7k",
      "address_receiver": "bbn13t5cnqj6t0p4xa40cwhmgv4wju0zl6g8slk8rz",
      "amount": 100000
    },
    ...
  ]
}
```

- New function from test suite to run before the upgrade `type
PreUpgradeFunc func([]*chain.Config)`
Resolves babylonlabs-io/pm#49

This PR introduces the in-protocol minimum gas price mechanism, in which
the consensus (more specifically the AnteHandler) enforces every tx has
to set a gas price at least 0.002 ubbn. The PR also provides relevant
tests. The impl closely follows
celestiaorg/celestia-app#2985.

In addition, this PR creates a new package `app/ante` to abstract out
the construction of the AnteHandler for Babylon, following the practice
at Celestia.

- RFC: babylonlabs-io/pm#56
- ADR: babylonlabs-io/pm#61
### Summary
Update to `btcstaking` docs 

- Revised wording to align with standard Cosmos SDK practices, ensuring
clarity for users. Each module should utilise a single KV store, with
different data types organised using prefixed namespaces within that
store, instead of creating multiple KV stores.
- Updates to query params documentation
Resolves babylonlabs-io/pm#64

This PR introduces the functionality of refunding fee for certain txs,
including BTC headers/checkpoints in BTC timestamping protocol, and
finality signature, BTC delegation inclusion proof, covenant signatures,
undelegation, selective slashing evidence in BTC staking protocol.

The implementation leverages a new key-only KV store in the incentive
module for storing refundable messages, and a new PostHandler for
refunding a tx if all msgs in it are refundable.

Along the way, this PR also adds dependency from BTC light client / BTC
staking modules to the incentive module, and adds relevant e2e tests to
ensure that the tx fee refunding indeed works.

- RFC:
https://github.com/babylonlabs-io/pm/blob/main/rfc/rfc-010-transaction-fee-refund-protocol.md
- ADR:
https://github.com/babylonlabs-io/pm/blob/main/adr/adr-028-transaction-fee-refund-protocol.md
- Slipt the upgrade data into two
  - testnet `app/upgrades/v1/testnet`
  - mainnet `app/upgrades/v1/mainnet`
- Add new build tag `mainnet` or `testnet` that adds the upgrade handler
with the expected data
- By default `make build` creates a binary with an upgrade plan that
contains mainnet data, if `make build-testnet` is run it adds the
`testnet` build flag and adds the upgrade plan that contains testnet
data
This follow-up PR fixes the comments in
#125, including

- changelog and typo comments in BTCCheckpoint module
- allow covenant signatures after covenant quorum are reached, and
return error if the covenant signature is duplicated. This is to ensure
covenants won't have operational cost when submitting covenant sig late,
and avoid refunding to duplicated covenant signatures
- reject duplicated finality signature. This is to avoid refunding to
duplicated covenant signatures
- add a dedup check in the PostHandler, to ensure one won't exploit the
refunding by having many duplicated messages in a single tx. Also added
a fuzz test for this.
Resolves #127

This PR fixes the `DropValidatorMsgDecorator` AnteHandler to handle
disallowed staking related messages inside `MsgExec` (ref
https://jumpcrypto.com/writing/bypassing-ethermint-ante-handlers/).
This PR handles the conversion of ints to uint32s in the btcstaking
library. The conversions that were modified were not unsafe as they were
the results of the `len()` call,
but they still made static analyzers complain.

Instead, we opted to convert uint32s to ints. However, this makes the
assumption that the program will be executed in 64-bit architectures in
order to be safe, which afaik is already a requirement.
As we are adding static analyzers in the codebase, many of them will
point out unhandled errors. If we add annotations to our codebase for
each of them, this might bloat the codebase. Another approach is to only
allow a single static analyzer fail about unhandled errors, while
ignoring the rest.

In this PR, I opted to just handle the errors by panicking in order to remove
the `nolint:errcheck` from the annotations. These methods failing
are programmatic errors.
Pr: #130 allowed for
accepting covenant signatures after quorum is reached.

This change introduces regression i.e covenant signatures accepted after
quorum is reached also generated voting power events, this could lead to
weird results in processing voting power events.

This pr fixes that by making sure that events of any kind are generated
only if this is first time quorum is reached.
Resolves #121
Resolves #119 

This PR adapts the tests under `x/btcstaking` to the pre-approval flow.
This includes

- generalising the `h.CreateDelegation` function to support both
pre-approval and non-pre-approval flow
- new test util function for submitting inclusion proof
- adapt most of the tests to use pre-pre-approval

~~In addition, this PR proposes to rename status `VERIFIED` to
`APPROVED` for clarity: verified is a bit generic while approved is more
consistent with existing terms (pre-"approval").~~ Also this PR fixes
the flaky `FuzzBTCDelegation` test (checked the fix via fuzzing
locally).
- Update cosmwasm params during upgrade
- Mainnet only gov account can store new contracts
- Testnet everybody can store new contracts
…nge (#144)

This is a follow-up PR of #131. This PR implements events generation
related to finality providers as described in
https://babylonlabs.atlassian.net/wiki/spaces/BABYLON/pages/31195227/API+asks+for+BBN+node.
In particular, this PR

1. adds events for fp creation and editing, which are emitted within
corresponding message handlers
2. adds events for fp status update, i.e., active, inactive, jailed,
slashed, which are emitted during voting power table update per
BeginBlock
Finality providers will register themselfs after the chain is public
launched, so the signed msgs can be removed from the upgrade handler

Should be reviewed after #132 is merged
- Removed ZoneConcierge params from swagger docs
- Add status to `QueryBTCDelegationsRequest`
- Moved from
`/babylon/btcstaking/v1/btc_delegations/{staking_tx_hash_hex}` to
`/babylon/btcstaking/v1/btc_delegation/{staking_tx_hash_hex}` in
`QueryBTCDelegationRequest`
Lazar955 and others added 15 commits November 6, 2024 13:30
Retry library should not be part of the core babylon repo. It is up to
the caller to decide which errors he should hanle and in what mannet
Fix error handling in checkpointing module:
- the line `err = types.ErrInvalidCkptStatus.Wrapf("the status of the
checkpoint should be %s", from.String())` was just allocating error and
not doing anything with it
- error from `ckptWithMeta, err := k.GetRawCheckpoint(ctx, epoch)` was
just getting swallowed
Make github action actually make a go release package and added into
release note to be able download by all the audience. Remove libwasmvm
for github action using whatever is defined in the go mod file library.
Upgrades wasmd, cosmos sdk, relayer
Resolves babylonlabs-io/pm#100

This PR implements the leftover issues in the tokenmomics, including

- removing BTC timestamping related incentive mechanisms
- rewarding all active FPs rather than those who voted (we can do this
because of jailing mechanism, and this is in line with Cosmos SDK)

The rest of the [tokenomics
issue](babylonlabs-io/pm#100) are mostly
parameters and benchmarking, which depend on external factors and other
engineering efforts.
Implement:
- allow list that will expire at certain Babylon block
- upgrade to insert allowed transactions hashes
- modification in message handler to use allow list under certain
Babylon height

i.e approach 4, from
[RFC-15](https://github.com/babylonlabs-io/pm/blob/main/rfc/rfc-015-moderate-intake-of-phase-1-stake.md#4-fixed-list-of-allowed-transactions-with-parameter-how-long-to-keep-the-allow-list)

Rationale for putting allowlist expiration height in params:
- if we discover some problems during initial blocks of phase-2, we may
extend the periond when allow list is used
- we should be able to disable allow list for testnet (setting
expiration height to `0` disable allow list)
Fixes: #269

In phase-2 every delegation must have only one finality provider.
Adds:
- validation
- test cases
- Add staking tx to the event 
- Removes from the event data than can be retrieved from staking tx:
  - staking tx hash
  - staking output pk script
  - staking output amount
@SebastianElvis SebastianElvis force-pushed the rebase-devnet-5 branch 5 times, most recently from 836c8cd to a7febbd Compare November 20, 2024 05:30
@SebastianElvis SebastianElvis marked this pull request as ready for review November 20, 2024 06:28
@SebastianElvis SebastianElvis requested a review from a team as a code owner November 20, 2024 06:28
@SebastianElvis SebastianElvis requested review from gitferry and KonradStaniec and removed request for a team November 20, 2024 06:28
Copy link
Contributor

@gusin13 gusin13 left a comment

Choose a reason for hiding this comment

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

nice work, lgtm 👍

@SebastianElvis SebastianElvis merged commit 3aa1afc into base/consumer-chain-support Nov 20, 2024
20 checks passed
@SebastianElvis SebastianElvis deleted the rebase-devnet-5 branch November 20, 2024 07:03
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.