Skip to content

Commit

Permalink
consensus: Allow revisions to set MaxRevisionNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechampine committed Dec 9, 2024
1 parent eaa5ca8 commit 6f9994c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
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

0 comments on commit 6f9994c

Please sign in to comment.