Skip to content

feat: schedule process_subsidies call after initiate_epoch_change#3200

Merged
halfprice merged 4 commits intomainfrom
zhewu/process_subsidy_after_epoch_change
Apr 1, 2026
Merged

feat: schedule process_subsidies call after initiate_epoch_change#3200
halfprice merged 4 commits intomainfrom
zhewu/process_subsidy_after_epoch_change

Conversation

@halfprice
Copy link
Copy Markdown
Collaborator

@halfprice halfprice commented Mar 27, 2026

Description

Call process_subsidies after initiate_epoch_change in InitiateEpochChangeOperation::invoke to distribute usage-independent subsidies right after epoch transition, since the new contract usage independent subsidies only pay for previous epoch's subsidy.

The call runs regardless of whether initiate_epoch_change succeeds (since another node may have already initiated it), and failure is best-effort (logged but does not block the epoch change result)

Test plan

How did you test the new or updated feature?


Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.
For each box you select, include information after the relevant heading that describes the impact of your changes that
a user might notice and any actions they must take to implement updates. (Add release notes after the colon for each item)

  • Storage node:
  • Aggregator:
  • Publisher:
  • CLI:

@halfprice halfprice force-pushed the zhewu/process_subsidy_after_epoch_change branch from c9340dc to a71f351 Compare March 27, 2026 06:05
@halfprice halfprice requested a review from karlwuest March 27, 2026 06:08
@halfprice halfprice marked this pull request as ready for review March 27, 2026 06:08
Copilot AI review requested due to automatic review settings March 27, 2026 06:08
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Schedules a best-effort process_subsidies call immediately after attempting initiate_epoch_change, so usage-independent subsidies for the just-finished epoch can be paid right after an epoch transition.

Changes:

  • Add a post-epoch-change process_subsidies call in InitiateEpochChangeOperation::invoke, gated by whether the subsidies object is configured.
  • Add unit and E2E coverage to validate the post-epoch-change subsidy processing behavior.
  • Expose latest_subsidized_epoch() (test-utils only) to assert that usage-independent subsidies advanced.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/walrus-sui/src/types/move_structs.rs Adds a test-only accessor for the latest subsidized epoch from the deserialized WalrusSubsidies object.
crates/walrus-service/src/node/epoch_change_driver.rs Calls process_subsidies after the epoch-change initiation attempt and adds a unit test verifying the sequencing.
crates/walrus-e2e-tests/tests/test_client.rs Adds an E2E test asserting latest_epoch advances after an epoch change due to the new post-epoch-change call.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/walrus-service/src/node/epoch_change_driver.rs Outdated
Copy link
Copy Markdown
Contributor

@karlwuest karlwuest left a comment

Choose a reason for hiding this comment

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

LGTM (after the comments are addressed)!

Comment thread crates/walrus-service/src/node/epoch_change_driver.rs Outdated
Comment thread crates/walrus-service/src/node/epoch_change_driver.rs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

Warning: This PR touches the mainnet-contracts directory. This should only be done if the Mainnet contracts are updated.
cc @karlwuest @mlegner

@halfprice halfprice force-pushed the zhewu/process_subsidy_after_epoch_change branch from b54330d to dcb5a79 Compare March 30, 2026 07:57
@halfprice
Copy link
Copy Markdown
Collaborator Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dcb5a794dd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/walrus-service/src/node.rs Outdated
Comment thread crates/walrus-service/src/node/start_epoch_change_finisher.rs Outdated
Comment thread crates/walrus-service/src/node/start_epoch_change_finisher.rs Outdated
Comment thread crates/walrus-service/src/node/start_epoch_change_finisher.rs Outdated
@halfprice halfprice force-pushed the zhewu/process_subsidy_after_epoch_change branch from d9547d8 to c9781b3 Compare March 31, 2026 06:25
@halfprice
Copy link
Copy Markdown
Collaborator Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9781b3c14

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/walrus-service/src/node/epoch_change_driver.rs
@halfprice halfprice force-pushed the zhewu/process_subsidy_after_epoch_change branch from c9781b3 to e643ee1 Compare March 31, 2026 06:51
Copy link
Copy Markdown
Contributor

@karlwuest karlwuest left a comment

Choose a reason for hiding this comment

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

Thanks for all the changes, LGTM!

@halfprice halfprice force-pushed the zhewu/process_subsidy_after_epoch_change branch from e643ee1 to e5134fe Compare April 1, 2026 06:42
@halfprice halfprice enabled auto-merge (squash) April 1, 2026 06:43
@halfprice halfprice merged commit 05cfb8f into main Apr 1, 2026
26 checks passed
@halfprice halfprice deleted the zhewu/process_subsidy_after_epoch_change branch April 1, 2026 07:16
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