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

Allow revisions to set MaxRevisionNumber #247

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 7 additions & 0 deletions .changesets/allow-max-revision.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
default: minor
---

# Allow revisions to set MaxRevisionNumber

`MaxRevisionNumber` was previously used to finalize contracts, but that is not the case anymore, so the restriction can be removed.
4 changes: 0 additions & 4 deletions consensus/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -761,10 +761,6 @@ func validateV2FileContracts(ms *MidState, txn types.V2Transaction) error {
return fmt.Errorf("file contract revision %v parent (%v) %s", i, fcr.Parent.ID, err)
} else if cur.ProofHeight < ms.base.childHeight() {
return fmt.Errorf("file contract revision %v cannot be applied to contract after proof height (%v)", i, cur.ProofHeight)
} else if rev.RevisionNumber == types.MaxRevisionNumber {
// NOTE: disallowing this means that resolutions always take
// precedence over revisions
return fmt.Errorf("file contract revision %v resolves contract", i)
} else if err := validateRevision(fcr.Parent, rev); err != nil {
return fmt.Errorf("file contract revision %v %s", i, err)
}
Expand Down
7 changes: 0 additions & 7 deletions consensus/validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1128,13 +1128,6 @@ func TestValidateV2Block(t *testing.T) {
txn.NewFoundationAddress = &addr
},
},
{
"revision that resolves contract",
func(b *types.Block) {
txn := &b.V2.Transactions[0]
txn.FileContractRevisions[0].Revision.RevisionNumber = types.MaxRevisionNumber
},
},
{
"revision with window that starts in past",
func(b *types.Block) {
Expand Down
Loading