Skip to content

Conversation

@aarshkshah1992
Copy link
Collaborator

Now that we have a railTerminated call back from the payments contract:

Once a rail is terminated:

  • SP can not add new roots to the proofset as we can't increase the rate of a terminated rail

  • After the rail end epoch has elapsed (i.e. the rail "expires"):

    • SP can only delete the proofset or change ownership. No other operation on the proofset is allowed.

@FilOzzy FilOzzy added this to FS Jul 23, 2025
@github-project-automation github-project-automation bot moved this to 📌 Triage in FS Jul 23, 2025
@rjan90 rjan90 moved this from 📌 Triage to 🔎 Awaiting review in FS Jul 24, 2025
@rjan90 rjan90 added this to the M2: Pandora Alpha on Mainnet milestone Jul 24, 2025
Copy link
Collaborator

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

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

This is good. We'll want to integrate this in with dataset removal when we get around to #69.

RailTerminationStatus memory termStatus = railTerminationStatus[info.railId];
require(
!termStatus.isTerminated || block.number <= termStatus.endEpoch,
"Operation rejected: rail terminated and beyond end epoch"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since these errors really mean -- "this entire dataset is unrecoverable" it should probably be a little more descriptive in this direction.

For example

"Operation rejected: rail terminated and finalized -- proof set must be removed to make progress"

Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove the prefix Operation rejected, since user will already see in the transaction data that it has been required

require(dataSetId != 0, "Rail not associated with any data set");

// Update termination status
railTerminationStatus[railId] = RailTerminationStatus({
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: you could make this is a simple mapping[uint256] => uint256 just storing the end epoch and letting a 0 value stand in for "not terminated"

@github-project-automation github-project-automation bot moved this from 🔎 Awaiting review to ✔️ Approved by reviewer in FS Jul 24, 2025
Comment on lines +549 to +553
RailTerminationStatus memory termStatus = railTerminationStatus[info.railId];
require(
!termStatus.isTerminated || block.number <= termStatus.endEpoch,
"Operation rejected: rail terminated and beyond end epoch"
);
Copy link
Member

Choose a reason for hiding this comment

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

can we refactor this into a method like requireActivePaymentRail(railId) or requireUnterminatedPaymentRail(railId)? It is being used without differences in 3 places

Copy link
Member

Choose a reason for hiding this comment

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

I can add termination logic for the FilCDN rails when we have decided on this matter

RailTerminationStatus memory termStatus = railTerminationStatus[info.railId];
require(
!termStatus.isTerminated || block.number <= termStatus.endEpoch,
"Operation rejected: rail terminated and beyond end epoch"
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove the prefix Operation rejected, since user will already see in the transaction data that it has been required

* @dev Implements the IValidator interface function
* @param railId ID of the payment rail being terminated
* @param terminator Address that initiated the termination
* @param endEpoch The final epoch up to which the rail can be settled
Copy link
Member

Choose a reason for hiding this comment

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

I might not understand settling fully, but does this mean funds will be locked inside the rail if I didn't settle them before endEpoch?

*/
function railTerminated(uint256 railId, address terminator, uint256 endEpoch) external override {
// Only payments contract can call this
require(msg.sender == paymentsContractAddress, "Only payments contract can terminate rails");
Copy link
Member

Choose a reason for hiding this comment

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

since only the one payments contract can do this, shall we drop the terminator argument?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@juliangruber The terminator is the end user who terminated (payer, payee or operator ?). I'll improve the name.

Copy link
Member

Choose a reason for hiding this comment

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

If that is the case then the error message in the require() is confusing

@github-project-automation github-project-automation bot moved this from ✔️ Approved by reviewer to ⌨️ In Progress in FS Jul 24, 2025
@aarshkshah1992
Copy link
Collaborator Author

Closing this in favour of "#93".

@github-project-automation github-project-automation bot moved this from ⌨️ In Progress to 🎉 Done in FS Jul 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🎉 Done

Development

Successfully merging this pull request may close these issues.

5 participants