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

[Supplier] Supplier unbonding period governance param #704

Merged
merged 33 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
332e015
feat: Unbonding period endblocker
red-0ne Jul 5, 2024
065097a
chore: Update comments
red-0ne Jul 5, 2024
46d1d31
Merge remote-tracking branch 'origin/main' into feat/unbonding-period
red-0ne Jul 8, 2024
16a5e01
test: Add unbonding tests
red-0ne Jul 8, 2024
cdb4a25
test: Update E2E tests
red-0ne Jul 8, 2024
a1afa75
feat: Add unbonding gov param
red-0ne Jul 10, 2024
94f078f
chore: Rename step
red-0ne Jul 10, 2024
9901029
Merge remote-tracking branch 'origin/main' into feat/unbonding-period
red-0ne Jul 12, 2024
aa26347
chore: Address review change requests
red-0ne Jul 12, 2024
cf737f2
Merge remote-tracking branch 'origin/main' into feat/unbonding-period
red-0ne Jul 15, 2024
1616f96
chore: Fix import
red-0ne Jul 15, 2024
1f2da17
refactor: Use proof window end as unbonding period
red-0ne Jul 17, 2024
803567a
Merge remote-tracking branch 'origin/main' into feat/unbonding-period
red-0ne Jul 17, 2024
f4b5c95
chore: Address review change requests
red-0ne Jul 18, 2024
f3e2e86
Merge remote-tracking branch 'origin/main' into feat/unbonding-period
red-0ne Jul 18, 2024
304fc70
chore: Add IsUnbonding and IsActive godoc
red-0ne Jul 22, 2024
5d914e7
Merge branch 'main' into feat/unbonding-period
Olshansk Jul 22, 2024
c77015a
chore: Address reivew change requests
red-0ne Jul 23, 2024
c2c6113
Merge branch 'main' into feat/unbonding-period
Olshansk Jul 24, 2024
1b8fd4a
feat: add supplier unbonding period gov param
red-0ne Jul 25, 2024
cadef6c
fix: godoc function name
red-0ne Jul 25, 2024
645dc2c
Merge branch 'feat/unbonding-period' into feat/unbonding-gov-param
red-0ne Jul 25, 2024
3b48b60
fix: Remove unused variable
red-0ne Jul 25, 2024
1309d3d
Merge remote-tracking branch 'origin/main' into feat/unbonding-gov-param
red-0ne Jul 26, 2024
ac08327
Merge remote-tracking branch 'origin/main' into feat/unbonding-gov-param
red-0ne Jul 27, 2024
8b276dd
chore: Address review change requests
red-0ne Jul 27, 2024
ea0a258
Merge branch 'main' into feat/unbonding-gov-param
Olshansk Jul 30, 2024
236329f
chore: Address review change requests
red-0ne Jul 31, 2024
fea990f
Merge remote-tracking branch 'origin/main' into feat/unbonding-gov-param
red-0ne Jul 31, 2024
b9abf06
fix: E2E tests steps
red-0ne Jul 31, 2024
14d573c
Merge remote-tracking branch 'origin/main' into feat/unbonding-gov-param
red-0ne Jul 31, 2024
e533f9a
chore: Update min supplier unbonding period sessions godoc
red-0ne Aug 2, 2024
c10703c
chore: Fix typos
red-0ne Aug 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 89 additions & 22 deletions api/poktroll/shared/params.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 69 additions & 0 deletions docusaurus/docs/protocol/actors/supplier.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ sidebar_position: 4
- [Supplier Module](#supplier-module)
- [Proof Module](#proof-module)
- [CLI](#cli)
- [Supplier lifecycle](#supplier-lifecycle)
- [1. Staking Initiation:](#1-staking-initiation)
- [2. Activation:](#2-activation)
- [3. Unsaking Initiation:](#3-unsaking-initiation)
- [4. Unbonding Phase:](#4-unbonding-phase)
- [5. Completion of Unbonding:](#5-completion-of-unbonding)
- [Timeline of Events](#timeline-of-events)

## Overview

Expand Down Expand Up @@ -69,3 +76,65 @@ or
```bash
poktrolld tx proof
```

## Supplier lifecycle
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

The lifecycle of a `Supplier` in the network involves several phases, each
with specific actions and status changes. Here’s a detailed breakdown:

red-0ne marked this conversation as resolved.
Show resolved Hide resolved
### 1. Staking Initiation:
red-0ne marked this conversation as resolved.
Show resolved Hide resolved

* The `Supplier` sends a `MsgStakeSupplier` message to the network, initiating
the staking process.
* The `Supplier` remains inactive until the beginning of the next session.

red-0ne marked this conversation as resolved.
Show resolved Hide resolved
### 2. Activation:

* The `Supplier` becomes active at the start of the new session and can now
provide services to the network.

### 3. Unsaking Initiation:
red-0ne marked this conversation as resolved.
Show resolved Hide resolved

* The `Supplier` sends a `MsgUnstakeSupplier` message to the network to start
the unstaking process.
* The `Supplier` continues to be active until the end of the current session.

red-0ne marked this conversation as resolved.
Show resolved Hide resolved
### 4. Unbonding Phase:

* In the following session, the `Supplier` enters the unbonding phase, becoming
inactive and no longer participating in sessions or providing services.
* During this phase, the staked funds are locked, and any pending claims are settled.

red-0ne marked this conversation as resolved.
Show resolved Hide resolved
### 5. Completion of Unbonding:

* After the unbonding period ends, the staked funds are transferred back to the
`Supplier`'s account, and the `Supplier`'s record is removed from the network.
red-0ne marked this conversation as resolved.
Show resolved Hide resolved

### Timeline of Events

Here’s a visual representation of the `Supplier` lifecycle from staking to unbonding
with the following example parameters:

* **Unbonding Period**: 3 sessions
* **Number of Blocks per Session**: 10 blocks
* **Session End Height to Proof Window Close Height**: 15 blocks
red-0ne marked this conversation as resolved.
Show resolved Hide resolved
red-0ne marked this conversation as resolved.
Show resolved Hide resolved


```mermaid
red-0ne marked this conversation as resolved.
Show resolved Hide resolved
timeline
section Session 1 <br> [1,10]
Block 3: DO Stake Supplier1 <br> Is inactive
Block 5: DO Stake Supplier2 <br> Is inactive
section Session 2 <br> [11,20]
Block 11: Supplier1 IS included in sessions : Supplier2 IS included in sessions
section Session 3 <br> [21,30]
Block 21 : Supplier1 unstakes <br> Still active
Block 28 : Supplier2 unstakes <br> Still active
Block 30: DO Deactivate Supplier1 : DO Deactivate Supplier2
section Session 4 <br>[31, 40]
Block 31: Supplier1 IS NOT included in sessions : Supplier2 IS NOT included in sessions
section Session 5 <br>[41, 50]
Block 45: ProofWindowClosed
section Session 6 <br>[51, 60]
Block 60: DO UNBOND Supplier1 : DO UNBOND Supplier2
```
2 changes: 1 addition & 1 deletion e2e/tests/init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ func (s *suite) TheServiceRegisteredForApplicationHasAComputeUnitsPerRelayOf(ser
s.Fatalf("ERROR: service %s is not registered for application %s", serviceId, appName)
}

func (s *suite) TheForAccountIsNotStaked(actorType, accName string) {
func (s *suite) TheUserVerifiesTheForAccountIsNotStaked(actorType, accName string) {
_, ok := s.getStakedAmount(actorType, accName)
require.Falsef(s, ok, "account %s of type %s SHOULD NOT be staked", accName, actorType)
}
Expand Down
2 changes: 2 additions & 0 deletions e2e/tests/parse_params_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ func (s *suite) newSharedMsgUpdateParams(params paramsMap) cosmostypes.Msg {
msgUpdateParams.Params.ProofWindowOpenOffsetBlocks = uint64(paramValue.value.(int64))
case sharedtypes.ParamProofWindowCloseOffsetBlocks:
msgUpdateParams.Params.ProofWindowCloseOffsetBlocks = uint64(paramValue.value.(int64))
case sharedtypes.ParamSupplierUnbondingPeriodSessions:
msgUpdateParams.Params.SupplierUnbondingPeriodSessions = uint64(paramValue.value.(int64))
default:
s.Fatalf("ERROR: unexpected %q type param name %q", paramValue.typeStr, paramName)
}
Expand Down
Loading
Loading