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

Draft
wants to merge 87 commits into
base: base/consumer-chain-support
Choose a base branch
from

Conversation

SebastianElvis
Copy link
Member

No description provided.

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`
samricotta and others added 30 commits October 18, 2024 12:33
Part closes: babylonlabs-io/pm#72

Currently some of the objects in the babylon apis are exposed and need
to be handled correctly seen in
babylonlabs-io/pm#72

This PR handles the exposed objects in `x/finality`

Specifically the `Evidence` object.
Resolves #26 
Also addresses the GH action warning on Dockerfiles

NOTE: `init.Dockerfile` still uses dynamic linking because it builds
v0.9.3. This can only be fixed in the v2 upgrade, unless we release
v0.9.4 with this PR backported (which I don't think it's the case).
Highlights:
- Now `MsgBTCUndelegate` contains stake spending transaction as well as
inclusion proof
- `BTCDelegation` contains news field `DelegatorUnbondingInfo` instead
of old staker signature field
- new field `DelegatorUnbondingInfo` contains information about in which
header unbonding happened. Also, if `StakeSpendingTx` in the message was
different that registered `UnbondingTx`, `DelegatorUnbondingInfo`
contains whole stake spending tx.
- New event is emitted if unbonding happens through different
transaction the the pre-registered one.
…ccept finality vote/pubrand (#204)

Add finality param to minimum block height to allow receiving Finality
and Pub Rand Commit of `x/finality`

This value is a module parameter and it can be updated by governance
proposal
Closes #129 by introducing the encoder and decoder into the proposal
handler
Closes #225.

* added unbonding start height to early unbonding event
* changed that early unbonding event is emitted  as a tx event
fixes: #176

- expire delegations `max(w, min_unbonding_time)` blocks before timeloc ends
Resolves #24 

This PR moves voting power table to finality module, including all
relevant KV stores, APIs and functions. This ensures that

- BTC staking module becomes the "staking hub" for storing all FPs and
BTC delegations of Babylon and consumer chains
- Finality module becomes the 1st use case of this staking hub, namely
providing BTC staking finality for Babylon chain
In case of large values of iavl cache Babylon hits oom error.
Resolves babylonlabs-io/pm#92

This PR provides the implementation of the inflation module. 

- The module shares the same interfaces as `x/mint`, and serves as a
drop-in replacement of Cosmos SDK's `x/mint`.
- The module implements a different inflation function. Currently, it
employs Celestia's
[algorithm](https://docs.celestia.org/learn/staking-governance-supply)
where the inflation rate decreases gradually w.r.t. the block timestamp.
It contains all necessary dependencies for implementing any inflation
function.
- The implementation is adapted from
[Celestia](https://github.com/celestiaorg/celestia-app/tree/main/x/mint)
and [Cosmos SDK](https://github.com/cosmos/cosmos-sdk/tree/main/x/mint).

Steps for implementation:

- [x] copy https://github.com/celestiaorg/celestia-app/tree/main/x/mint
to `x/mint`
- [x] fix all dependencies
- [x] bump module to Cosmos SDK v0.50
- [x] replace Cosmos x/mint with the new x/mint
- [x] fix unit tests
- [x] fix e2e tests
- [x] fix software upgrade e2e
- [x] changelog
- [x] write ADR
- [x] implement the design
- [x] properly initialise the new mint module in upgrade handler
- [x] fix doc
Fixes: #237

- Adding `PkScript` makes is possible to listen to confirmation event
using lnd libraries (and therefore btc lightclients)
- Addinng `StakingOutputIndex` makes it possible to identify staking
output as utxo i.e tuple (hash, idx)
Closes #251. The flunky is caused due to the fact that the test uses
`uint16` type for the `stakingTimeBlocks` which is generated in a range
of min and max staking time (0, 100000). However, the max value of
`uint16` is 65535. This PR changes the value of max staking time to
10000 to avoid overflow.
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.
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.

10 participants