You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: construct queued proposals with predecessors (#276)
Enables users to construct proposals given a list of preceding,
non-executed proposals, such that proposal signing can happen in
parallel assuming a pre-determined sequential execution order. The key
changes are as follows:
### Enhancements to Proposal Creation:
* Updated the `NewProposal` and `NewTimelockProposal` functions to
accept a list of predecessor proposals, allowing for the configuration
of operation counts based on the execution order of proposals.
(`proposal.go`, `timelock_proposal.go`)
[[1]](diffhunk://#diff-76c5df6d4d3acdc6b2bc63b2377214b642e59a655957a9e65884ed21f204a27bL90-R116)
[[2]](diffhunk://#diff-22aa9f90e7ed0f30eb381e769a6ce492d3472c4e8029e134f0074e1913ce482fR54-R63)
### Documentation Updates:
* Added a new section in `docs/usage/building-proposals.md` to explain
how to build proposals with staged but non-executed predecessor
proposals.
### Code Refactoring:
* Modified various test files to accommodate the new `NewProposal` and
`NewTimelockProposal` function signatures that include predecessor
proposals. (`ledger_test.go`, `signing.go`, `proposal_test.go`,
`timelock_proposal_test.go`)
[[1]](diffhunk://#diff-046f7b9890699bc5c0782f4c739ef15b5f8be4727b0c2f7cf932fa171d9f514dL206-R207)
[[2]](diffhunk://#diff-0c8a658097684777bc5992740e4c927a02a88830e4a6783742f7a3de02b6bfa3L52-R52)
[[3]](diffhunk://#diff-f54ef2790620db06a34dcf62d0565c5536ddeb0b22274fafc6d0cff158c9b789R131-R190)
[[4]](diffhunk://#diff-b80686a8969c14a89af64e7ed45e5a1e0dc025880256405d9e48eac6e33722b9R100-R173)
### New Methods:
* Added `TransactionCounts`, `ChainMetadatas`, and `SetChainMetadata`
methods to the `ProposalInterface` to manage chain metadata more
effectively. (`proposal.go`, `timelock_proposal.go`)
[[1]](diffhunk://#diff-76c5df6d4d3acdc6b2bc63b2377214b642e59a655957a9e65884ed21f204a27bR84-R93)
[[2]](diffhunk://#diff-22aa9f90e7ed0f30eb381e769a6ce492d3472c4e8029e134f0074e1913ce482fR54-R63)
### Minor Changes:
* Updated the `.changeset/shaggy-pianos-remember.md` file to reflect the
minor version update for the `@smartcontractkit/mcms` package.
For the JSON structure of the proposal please check the [MCMS Proposal Format Doc.](/key-concepts/mcm-proposal.md)
48
49
50
+
### Build Proposal Given Staged but Non-Executed Predecessor Proposals
51
+
52
+
In scenarios where a proposal is generated with the assumption that multiple proposals are executed beforehand, you can enable proposals to be signed in parallel with a pre-determined execution order. This can be achieved by passing a list of files as the second argument in the Proposal constructor, as shown below:
53
+
54
+
```go
55
+
package main
56
+
57
+
import (
58
+
"log"
59
+
"os"
60
+
"io"
61
+
62
+
"github.com/smartcontractkit/mcms"
63
+
)
64
+
65
+
funcmain() {
66
+
// Open the JSON file for the new proposal
67
+
file, err:= os.Open("proposal.json")
68
+
if err != nil {
69
+
log.Fatalf("Error opening file: %v", err)
70
+
}
71
+
defer file.Close()
72
+
73
+
// Open the JSON file for the predecessor proposal
wantErr: "Key: 'Proposal.BaseProposal.ChainMetadata' Error:Field validation for 'ChainMetadata' failed on the 'min' tag\nKey: 'Proposal.Operations' Error:Field validation for 'Operations' failed on the 'min' tag",
202
+
givePredecessors: []string{},
203
+
wantErr: "failed to decode and validate target proposal: failed to validate proposal: Key: 'Proposal.BaseProposal.ChainMetadata' Error:Field validation for 'ChainMetadata' failed on the 'min' tag\nKey: 'Proposal.Operations' Error:Field validation for 'Operations' failed on the 'min' tag",
0 commit comments