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

Add renewedTo field to RPCLastestRevision response #246

Closed
ChrisSchinnerl opened this issue Dec 5, 2024 · 4 comments · Fixed by #255
Closed

Add renewedTo field to RPCLastestRevision response #246

ChrisSchinnerl opened this issue Dec 5, 2024 · 4 comments · Fixed by #255
Assignees

Comments

@ChrisSchinnerl
Copy link
Member

In v2 a renter has no way of knowing whether a contract has been renewed when fetching a revision. So if a renter for some reason misses the fact that the contract was renewed (e.g. due to a crash mid-renewal), it would be nice of the host to tell the renter about it via a renewedTo field. Previously we used the max revision number for that but we don't have that anymore.

@ChrisSchinnerl ChrisSchinnerl converted this from a draft issue Dec 5, 2024
@ChrisSchinnerl
Copy link
Member Author

@n8maninger I created this issue since it is something we discussed and after thinking about it I think it would be useful to have. Makes it easier to avoid failed interactions with hosts and also some of the contract maintenance checks.

@ChrisSchinnerl ChrisSchinnerl moved this from Triage to Todo in Sia Dec 5, 2024
@n8maninger
Copy link
Member

n8maninger commented Dec 10, 2024

Thinking about this more: instead of a RenewedTo field, maybe a "Resolution" field that includes the type? If resp.Resolution == "renewal", you can calculate the renewed contract ID using the existing contract ID: renewalID := fcid.V2RenewalID()

@ChrisSchinnerl
Copy link
Member Author

Sounds good to me. I don't feel strongly about either approach. The resolution might be a bit nicer since we only need to send another byte.

@lukechampine
Copy link
Member

lukechampine commented Dec 11, 2024

Perhaps make it RPCContractStatus and return something like ForEachV2FileContractElement?

struct {
    Contract   types.V2FileContractElement // latest on-chain revision
    Revision   *types.V2FileContractRevision // latest off-chain revision, if it exists
    Resolution types.V2FileContractResolutionType // non-nil if contract has been resolved
}

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 a pull request may close this issue.

3 participants