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

Conversation

red-0ne
Copy link
Contributor

@red-0ne red-0ne commented Jul 25, 2024

Summary

This PR adds

  • Session number supplier_unbonding_period governance param as a follow-up to [Supplier] Implement unbonding period #666.
  • Enforces supplier_unbonding_period resutling blocks to be greater than the cumulated proof window close blocks.
  • Enforces global sharedParams validation when updating individual params (as some values depend on each other)

Example Supplier unstaking/unbonding timeline

Supplier unstaking (UnbondingPeriod = 3 sessioons, NumBlocksPerSession = 10, ProofWindowClose = 15 blocks)

timeline
    section Session 1 <br> [1,10]
        Blocks 1 - 10 : Supplier1 is active : Supplier2 is active
    section Session 2 <br> [11,20]
        Block 11 : Supplier1 unstakes <br> Still active
        Block 18 : Supplier2 unstakes <br> Still active
        Block 20: DO Deactivate Supplier1 : DO Deactivate Supplier2
    section Session 3 <br>[21, 30]
        Block 21: Supplier1 IS NOT included in sessions : Supplier2 IS NOT included in sessions
    section Session 4 <br>[31, 40]
        Block 35: ProofWindowClosed
    section Session 5 <br>[41, 50]
        Block 50: DO UNBOND Supplier1 : DO UNBOND Supplier2
Loading

Issue

Type of change

Select one or more:

  • New feature, functionality or library
  • Bug fix
  • Code health or cleanup
  • Documentation
  • Other (specify)

Testing

Documentation changes (only if making doc changes)

  • make docusaurus_start; only needed if you make doc changes

Local Testing (only if making code changes)

  • Unit Tests: make go_develop_and_test
  • LocalNet E2E Tests: make test_e2e
  • See quickstart guide for instructions

PR Testing (only if making code changes)

  • DevNet E2E Tests: Add the devnet-test-e2e label to the PR.
    • THIS IS VERY EXPENSIVE, so only do it after all the reviews are complete.
    • Optionally run make trigger_ci if you want to re-trigger tests without any code changes
    • If tests fail, try re-running failed tests only using the GitHub UI as shown here

Sanity Checklist

  • I have tested my changes using the available tooling
  • I have commented my code
  • I have performed a self-review of my own code; both comments & source code
  • I create and reference any new tickets, if applicable
  • I have left TODOs throughout the codebase, if applicable

Summary by CodeRabbit

  • New Features

    • Introduced a SupplierUnbondingPeriod parameter, defining the waiting duration for suppliers after unstaking before they can withdraw tokens.
    • Added a new SupplierUnbondingPeriodSessions parameter to enhance the unbonding process functionality.
    • Updated operational parameters for session management and claim windows.
  • Bug Fixes

    • Enhanced parameter validation logic to ensure correct handling of the new SupplierUnbondingPeriod and SupplierUnbondingPeriodSessions.
  • Tests

    • Improved existing test functions with new validation logic and enhanced coverage for supplier unbonding parameters.
    • Added tests to verify the correct updating of SupplierUnbondingPeriodSessions with validation against thresholds.

@red-0ne red-0ne added supplier Changes related to the Supplier actor on-chain On-chain business logic labels Jul 25, 2024
@red-0ne red-0ne self-assigned this Jul 25, 2024
@red-0ne red-0ne changed the base branch from feat/unbonding-period to main July 26, 2024 12:30
Copy link

coderabbitai bot commented Jul 26, 2024

Walkthrough

The changes introduce two new fields, SupplierUnbondingPeriod and SupplierUnbondingPeriodSessions, enhancing the management of unbonding durations for suppliers after unstaking. These updates improve parameter management and validation logic across the codebase, ensuring better handling and clarity of the staking mechanism. Comprehensive tests have been implemented to confirm the accurate functioning of these new parameters, thereby reinforcing the robustness of the entire system.

Changes

Files Change Summary
api/poktroll/shared/params.pulsar.go, x/shared/types/params.go Added SupplierUnbondingPeriod and SupplierUnbondingPeriodSessions fields, with associated getters and validation functions. Updated default values and parameter management logic.
e2e/tests/init_test.go, e2e/tests/update_params.feature Renamed a test function for clarity and updated parameter handling related to unbonding periods.
x/shared/keeper/msg_server_update_param.go, x/shared/keeper/msg_server_update_param_test.go Streamlined parameter update logic and enhanced validation procedures for the new unbonding parameters.
x/shared/types/message_update_param.go, x/shared/types/genesis_test.go Expanded validation logic to include new unbonding period parameters for consistent initialization.
x/shared/supplier.go, x/supplier/keeper/unbond_suppliers.go Improved logic for calculating unbonding heights, enhancing performance and resource utilization.

Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e533f9a and c10703c.

Files selected for processing (1)
  • x/shared/keeper/msg_server_update_param_test.go (7 hunks)
Files skipped from review as they are similar to previous changes (1)
  • x/shared/keeper/msg_server_update_param_test.go

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

x/shared/keeper/msg_server_update_param.go Show resolved Hide resolved
proto/poktroll/shared/params.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/params.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/params.proto Outdated Show resolved Hide resolved
proto/poktroll/shared/params.proto Outdated Show resolved Hide resolved
x/shared/types/params.go Outdated Show resolved Hide resolved
x/shared/types/params.go Outdated Show resolved Hide resolved
x/shared/types/params_test.go Outdated Show resolved Hide resolved
x/shared/types/params.go Show resolved Hide resolved
x/shared/keeper/msg_server_update_param_test.go Outdated Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (17)
docusaurus/docs/protocol/actors/supplier.md (12)

80-80: Add a period at the end of the sentence.

The sentence should end with a period for consistency.

- ## Supplier lifecycle
+ ## Supplier lifecycle.

85-85: Remove trailing punctuation in heading.

Remove the colon at the end of the heading.

- ### 1. Staking Initiation:
+ ### 1. Staking Initiation
Tools
Markdownlint

85-85: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


87-89: Fix unordered list style and indentation.

Use dashes for unordered lists and correct the indentation.

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

87-87: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


89-89: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


87-87: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


89-89: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


91-91: Remove trailing punctuation in heading.

Remove the colon at the end of the heading.

- ### 2. Activation:
+ ### 2. Activation
Tools
Markdownlint

91-91: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


93-94: Fix unordered list style and indentation.

Use dashes for unordered lists and correct the indentation.

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

93-93: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


93-93: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


98-100: Fix unordered list style and indentation.

Use dashes for unordered lists and correct the indentation.

-  * 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.
+ - 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.
Tools
Markdownlint

98-98: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


100-100: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


98-98: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


100-100: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


102-102: Remove trailing punctuation in heading.

Remove the colon at the end of the heading.

- ### 4. Unbonding Phase:
+ ### 4. Unbonding Phase
Tools
Markdownlint

102-102: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


104-106: Fix unordered list style and indentation.

Use dashes for unordered lists and correct the indentation.

-  * 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.
+ - 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.
Tools
Markdownlint

104-104: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


106-106: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


104-104: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


106-106: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


108-108: Remove trailing punctuation in heading.

Remove the colon at the end of the heading.

- ### 5. Completion of Unbonding:
+ ### 5. Completion of Unbonding
Tools
Markdownlint

108-108: Punctuation: ':'
Trailing punctuation in heading

(MD026, no-trailing-punctuation)


110-111: Fix unordered list style and indentation.

Use dashes for unordered lists and correct the indentation.

-  * 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.
+ - 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.
Tools
Markdownlint

110-110: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


110-110: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


113-113: Remove trailing punctuation in heading.

Remove the colon at the end of the heading.

- ### Timeline of Events:
+ ### Timeline of Events

118-120: Fix unordered list style and indentation.

Use dashes for unordered lists and correct the indentation.

-  * **Unbonding Period**: 3 sessions
-  * **Number of Blocks per Session**: 10 blocks
-  * **Session End Height to Proof Window Close Height**: 15 blocks
+ - **Unbonding Period**: 3 sessions
+ - **Number of Blocks per Session**: 10 blocks
+ - **Session End Height to Proof Window Close Height**: 15 blocks
Tools
Markdownlint

118-118: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


119-119: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


120-120: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)

x/shared/types/params.go (1)

20-21: Add a comment for ParamSupplierUnbondingPeriodSessions.

The comment for ParamSupplierUnbondingPeriodSessions is missing. Add a comment to maintain consistency.

+ // ParamSupplierUnbondingPeriodSessions is the key for the supplier unbonding period sessions parameter.
	ParamSupplierUnbondingPeriodSessions   = "supplier_unbonding_period_sessions"
x/shared/keeper/msg_server_update_param_test.go (4)

52-58: Consider renaming paramDelta to deltaClaimWindowOpenOffsetBlocks.

The variable name paramDelta could be more descriptive to indicate its specific purpose.

- paramDelta := uint64(expectedClaimWindowOpenOffestBlocks) - defaultParams.ClaimWindowOpenOffsetBlocks
+ deltaClaimWindowOpenOffsetBlocks := uint64(expectedClaimWindowOpenOffestBlocks) - defaultParams.ClaimWindowOpenOffsetBlocks
- defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, paramDelta)
+ defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, deltaClaimWindowOpenOffsetBlocks)

87-93: Consider renaming paramDelta to deltaClaimWindowCloseOffsetBlocks.

The variable name paramDelta could be more descriptive to indicate its specific purpose.

- paramDelta := uint64(expectedClaimWindowCloseOffestBlocks) - defaultParams.ClaimWindowCloseOffsetBlocks
+ deltaClaimWindowCloseOffsetBlocks := uint64(expectedClaimWindowCloseOffestBlocks) - defaultParams.ClaimWindowCloseOffsetBlocks
- defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, paramDelta)
+ defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, deltaClaimWindowCloseOffsetBlocks)

122-128: Consider renaming paramDelta to deltaProofWindowOpenOffsetBlocks.

The variable name paramDelta could be more descriptive to indicate its specific purpose.

- paramDelta := uint64(expectedProofWindowOpenOffestBlocks) - defaultParams.ProofWindowOpenOffsetBlocks
+ deltaProofWindowOpenOffsetBlocks := uint64(expectedProofWindowOpenOffestBlocks) - defaultParams.ProofWindowOpenOffsetBlocks
- defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, paramDelta)
+ defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, deltaProofWindowOpenOffsetBlocks)

157-163: Consider renaming paramDelta to deltaProofWindowCloseOffsetBlocks.

The variable name paramDelta could be more descriptive to indicate its specific purpose.

- paramDelta := uint64(expectedProofWindowCloseOffestBlocks) - defaultParams.ProofWindowCloseOffsetBlocks
+ deltaProofWindowCloseOffsetBlocks := uint64(expectedProofWindowCloseOffestBlocks) - defaultParams.ProofWindowCloseOffsetBlocks
- defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, paramDelta)
+ defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, deltaProofWindowCloseOffsetBlocks)

docusaurus/docs/protocol/actors/supplier.md Outdated Show resolved Hide resolved
@red-0ne red-0ne requested a review from Olshansk July 28, 2024 08:06
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

Just a few NITs, but should be g2g after!

// new value to update the supplier unbonding period blocks such as it is greater
// than the cumulative proof window close blocks to pass UpdateParam validation.
paramDelta := uint64(expectedProofWindowOpenOffestBlocks) - defaultParams.ProofWindowOpenOffsetBlocks
defaultParams.SupplierUnbondingPeriodSessions = getMinSupplierUnbondingPeriodSessions(&defaultParams, paramDelta)
Copy link
Member

Choose a reason for hiding this comment

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

NIT: What do you think of capturing the paramDelta calculation inside of getMinSupplier....

It already takes in defaultParams so you'd just provide expectedProofWindow... instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order to achieve that, we need to know which variable is affected.

We currently do: fn([A, B, C], X-B)
Which we can't replicate by doing fn([A, B, C], X) since we lose which item we are subtracting from.
We can achieve by passing the affected original value B though. fn([A, B, C], X, B)

docusaurus/docs/protocol/actors/supplier.md Outdated Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
Copy link

The CI will now also run the e2e tests on devnet, which increases the time it takes to complete all CI checks.

You may need to run make trigger_ci to submit an empty commit that'll trigger the tests.

GCP workloads (requires changing the namespace to 704)
Grafana network dashboard for devnet-issue-{issue-id}

@github-actions github-actions bot added devnet push-image CI related - pushes images to ghcr.io labels Jul 31, 2024
@red-0ne red-0ne requested a review from Olshansk July 31, 2024 18:04
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range, codebase verification and nitpick comments (2)
docusaurus/docs/protocol/actors/supplier.md (2)

18-18: Correct typo in heading.

The word "Unsaking" should be "Unstaking".

- ### 3. Unsaking Initiation:
+ ### 3. Unstaking Initiation

87-120: Fix unordered list style and indentation.

The unordered list style and indentation should be consistent.

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

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

-  * 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.
+ - 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.

-  * 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.
+ - 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.

-  * 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.
+ - 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.

-  * **Unbonding Period**: 3 sessions
-  * **Number of Blocks per Session**: 10 blocks
-  * **Session End Height to Proof Window Close Height**: 15 blocks
+ - **Unbonding Period**: 3 sessions
+ - **Number of Blocks per Session**: 10 blocks
+ - **Session End Height to Proof Window Close Height**: 15 blocks
Tools
Markdownlint

87-87: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


89-89: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


93-93: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


98-98: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


100-100: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


104-104: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


106-106: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


110-110: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


118-118: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


119-119: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


120-120: Expected: dash; Actual: asterisk
Unordered list style

(MD004, ul-style)


87-87: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


89-89: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


93-93: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


98-98: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


100-100: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


104-104: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


106-106: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)


110-110: Expected: 0; Actual: 2
Unordered list indentation

(MD007, ul-indent)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

Outside diff range, codebase verification and nitpick comments (7)
docusaurus/docs/protocol/actors/supplier.md (7)

96-96: Correct typo in heading.

The word "Unsaking" should be "Unstaking".

- ### 3. Unsaking Initiation
+ ### 3. Unstaking Initiation

126-126: Improve readability of timeline events.

Enclose status indicators in brackets for clarity.

-      Block 3: DO Stake Supplier1 <br> [Is inactive]
+      Block 3: DO Stake Supplier1 <br> (Is inactive)

127-127: Improve readability of timeline events.

Enclose status indicators in brackets for clarity.

-      Block 5: DO Stake Supplier2 <br> [Is inactive]
+      Block 5: DO Stake Supplier2 <br> (Is inactive)

131-131: Improve readability of timeline events.

Enclose status indicators in brackets for clarity.

-        Block 21 : Supplier1 unstakes <br> [Still active]
+        Block 21 : Supplier1 unstakes <br> (Still active)

132-132: Improve readability of timeline events.

Enclose status indicators in brackets for clarity.

-        Block 28 : Supplier2 unstakes <br> [Still active]
+        Block 28 : Supplier2 unstakes <br> (Still active)

135-135: Improve readability of timeline events.

Enclose status indicators in brackets for clarity.

-        Block 31: Supplier1 IS NOT included in sessions : Supplier2 IS NOT included in sessions
+        Block 31: Supplier1 IS NOT included in sessions : Supplier2 IS NOT included in sessions

139-139: Improve readability of timeline events.

Enclose status indicators in brackets for clarity.

-        Block 60: DO UNBOND Supplier1 : DO UNBOND Supplier2
+        Block 60: DO UNBOND Supplier1 : DO UNBOND Supplier2

docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

Outside diff range, codebase verification and nitpick comments (3)
tests/integration/supplier/supplier_lifecycle.go (1)

3-13: Clarify and expand TODO comments.

The TODO comments outline the steps for testing the supplier lifecycle but could benefit from additional details to ensure clarity and completeness. Consider expanding each step to include specific actions and expected outcomes.

- // 1. Stake a supplier
+ // 1. Stake a supplier using `MsgStakeSupplier` message.
- // 2. Check that is is not included in sessions
+ // 2. Check that the supplier is not included in sessions immediately after staking.
- // 3. Wait until it is activated
+ // 3. Wait until the next session starts to ensure the supplier is activated.
- // 4. Check that is is included in sessions
+ // 4. Check that the supplier is included in sessions after activation.
- // 5. Unstake the supplier mid session
+ // 5. Unstake the supplier mid-session using `MsgUnstakeSupplier` message.
- // 6. Check that it is included in the current session
+ // 6. Check that the supplier remains active for the rest of the current session.
- // 7. Check that it is not included in the next session
+ // 7. Check that the supplier is not included in the next session after unstaking.
- // 8. Submit a proof and a claim and ensure it is successful
+ // 8. Submit a proof and a claim for the supplier and ensure it is successful.
- // 9. Check that it gets rewarded when settling the claim
+ // 9. Check that the supplier receives rewards when settling the claim.
- // 10. Check that it gets removed from the suppliers list after the unbonding period is over
+ // 10. Check that the supplier is removed from the suppliers list after the unbonding period is over.
docusaurus/docs/protocol/actors/supplier.md (2)

18-18: Correct typo in heading.

The word "Unsaking" should be "Unstaking".

- ### 3. Unsaking Initiation:
+ ### 3. Unstaking Initiation:

123-139: Great addition!

The timeline of events provides a clear and detailed visual representation of the supplier lifecycle. Consider putting statuses like Is inactive and Still active in brackets for consistency.

- Block 3: DO Stake Supplier1 <br> [Is inactive]
- Block 5: DO Stake Supplier2 <br> [Is inactive]
+ Block 3: DO Stake Supplier1 <br> (Is inactive)
+ Block 5: DO Stake Supplier2 <br> (Is inactive)
- Block 21 : Supplier1 unstakes <br> [Still active]
- Block 28 : Supplier2 unstakes <br> [Still active]
+ Block 21 : Supplier1 unstakes <br> (Still active)
+ Block 28 : Supplier2 unstakes <br> (Still active)

docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
docusaurus/docs/protocol/actors/supplier.md Show resolved Hide resolved
Copy link
Member

@Olshansk Olshansk left a comment

Choose a reason for hiding this comment

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

Please look and update at my least comment but otherwise LGTM

@@ -255,7 +263,12 @@ func TestMsgUpdateParam_UpdateSupplierUnbondingPeriodSessions(t *testing.T) {

// getMinSupplierUnbondingPeriodSessions returns the minimum supplier unbonding period
// in session number that is greater than the cumulative proof window close blocks.
func getMinSupplierUnbondingPeriodSessions(params *sharedtypes.Params, deltaBlocks uint64) uint64 {
func getMinSupplierUnbondingPeriodSessions(
Copy link
Member

Choose a reason for hiding this comment

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

I like this new helper but am a bit confused why the comment everywhere it's used is 100% the same BUT the inputs we give it are different?

  1. Same function
  2. Same variable assignment
  3. Same comment
  4. Different inputs

#PUC ? What am I misunderstanding?

@Olshansk Olshansk added this to the Shannon Beta TestNet Launch milestone Aug 2, 2024
@Olshansk
Copy link
Member

Olshansk commented Aug 2, 2024

@red-0ne Reminder to update the mileston on PRs & Issues please

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (6)
x/shared/keeper/msg_server_update_param_test.go (6)

53-54: Typo in comment.

The comment has a typo: "SupplierUnbondigPeriodSessions" should be "SupplierUnbondingPeriodSessions".

-	// Update the SupplierUnbondigPeriodSessions such that it is greater than the
+	// Update the SupplierUnbondingPeriodSessions such that it is greater than the

90-91: Typo in comment.

The comment has a typo: "SupplierUnbondigPeriodSessions" should be "SupplierUnbondingPeriodSessions".

-	// Update the SupplierUnbondigPeriodSessions such that it is greater than the
+	// Update the SupplierUnbondingPeriodSessions such that it is greater than the

127-128: Typo in comment.

The comment has a typo: "SupplierUnbondigPeriodSessions" should be "SupplierUnbondingPeriodSessions".

-	// Update the SupplierUnbondigPeriodSessions such that it is greater than the
+	// Update the SupplierUnbondingPeriodSessions such that it is greater than the

164-165: Typo in comment.

The comment has a typo: "SupplierUnbondigPeriodSessions" should be "SupplierUnbondingPeriodSessions".

-	// Update the SupplierUnbondigPeriodSessions such that it is greater than the
+	// Update the SupplierUnbondingPeriodSessions such that it is greater than the

227-227: Typo in variable name.

The variable name has a typo: "expectedSupplierUnbondingPerid" should be "expectedSupplierUnbondingPeriod".

-	var expectedSupplierUnbondingPerid int64 = 5
+	var expectedSupplierUnbondingPeriod int64 = 5

273-273: Typo in variable name.

The variable name has a typo: "newProofWindowCloseBlobcks" should be "newProofWindowCloseBlocks".

-	newProofWindowCloseBlobcks := types.GetSessionEndToProofWindowCloseBlocks(params) + deltaBlocks
+	newProofWindowCloseBlocks := types.GetSessionEndToProofWindowCloseBlocks(params) + deltaBlocks

@red-0ne red-0ne merged commit 672fbb1 into main Aug 2, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
devnet devnet-test-e2e on-chain On-chain business logic push-image CI related - pushes images to ghcr.io supplier Changes related to the Supplier actor
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants