-
Notifications
You must be signed in to change notification settings - Fork 0
feat: fund mcms pdas [CLD-2765] #101
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
Merged
Merged
Changes from all commits
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
7b2ded2
chore: move oputils into non legacy folder
ecPablo 55ea3be
feat: add deploy custom topology
ecPablo f9aab1d
Merge branch 'refs/heads/main' into ecpablo/deploy-topology-mcms
ecPablo ed8ab5c
feat: add deploy custom topology
ecPablo 44c087b
feat(mcms): add transfer-to-mcms changeset [CLD-2762]
graham-chainlink 9ebd24d
Merge branch 'refs/heads/main' into ecpablo/fund-mcms-pdas
ecPablo b3cc5cf
feat: fund mcms pdas refactor
ecPablo 5d0d941
Merge branch 'main' into ecpablo/deploy-topology-mcms
ecPablo b05953d
fix: add checks for duplicate timelock refs or conflicting regs with …
ecPablo 05e8c69
Potential fix for pull request finding
ecPablo 0961740
fix: remove code duplication on sequence registry
ecPablo 0cf7ac3
Potential fix for pull request finding
ecPablo 1bad648
Potential fix for pull request finding
ecPablo 00f1923
Potential fix for pull request finding
ecPablo 08f25ce
Potential fix for pull request finding
ecPablo 41dbbe3
Potential fix for pull request finding
ecPablo 21e456e
Potential fix for pull request finding
ecPablo c112b33
fix: code cleanup and copilot comments
ecPablo 9e4e51b
Merge branch 'ggoh/CLD-2762/transfer-to-mcms' into ecpablo/deploy-top…
ecPablo dd1c08b
fix: remove transfer ownership changeset in favor of new changeset in…
ecPablo 64cd08b
fix: remove transfer ownership changeset in favor of new changeset in…
ecPablo 1faf6ec
Merge branch 'ecpablo/deploy-topology-mcms' into ecpablo/fund-mcms-pdas
ecPablo 3e3382d
fix: remove transfer ownership changeset in favor of new changeset in…
ecPablo 76e5e77
Potential fix for pull request finding
ecPablo 9f438dc
fix: copilot comments
ecPablo 4fce639
fix: copilot comments
ecPablo 2e0c579
Merge branch 'main' into ecpablo/deploy-topology-mcms
ecPablo aea9450
fix: use ExecuteOnChainSequenceAndMerge in changeset.go
ecPablo 0594dd9
fix: remove ds merge
ecPablo d9fd9f2
fix: use new gas boost types and use familyregistry
ecPablo f91be67
fix: removed type alias
ecPablo d95268a
Potential fix for pull request finding
ecPablo 215e6d9
fix: address copilot comments
ecPablo bac6cf5
fix: restore transfer to mcms changes
ecPablo 99a9ee1
fix: linting
ecPablo 1896f69
fix: linting
ecPablo efb0b98
Potential fix for pull request finding
ecPablo 5b8cb99
Potential fix for pull request finding
ecPablo 26d8991
Potential fix for pull request finding
ecPablo ab353bf
Potential fix for pull request finding
ecPablo 30fe931
fix: copilot comments
ecPablo 474032b
feat(mcms): add transfer-to-timelock changeset [CLD-2762] (#99)
graham-chainlink 89d36c1
refactor: introduce family registry helper (#102)
graham-chainlink 49fbcdc
fix: use ExecuteOnChainSequenceAndMerge in changeset.go
ecPablo 0cf80a5
fix: remove ds merge
ecPablo 66c12e6
fix: use new gas boost types and use familyregistry
ecPablo d417d8f
fix: removed type alias
ecPablo c6a62fa
Potential fix for pull request finding
ecPablo 491435d
fix: address copilot comments
ecPablo dc658e0
fix: restore transfer to mcms changes
ecPablo 328a819
fix: linting
ecPablo 3725e62
fix: linting
ecPablo 3899f44
chore: update gitignore
ecPablo 361a70a
Merge branch 'ecpablo/deploy-topology-mcms' into ecpablo/fund-mcms-pdas
ecPablo 53e0365
fix: always set env.Datastore to new datastore with deployed contracts
ecPablo 6180e35
fix: use Collect, assert exact error messages, and add doc.go with ex…
ecPablo 6c772fd
fix: add comment explicitly stating how duplicates are handled
ecPablo 9838c45
fix: add more explicit copy logic for qualifier
ecPablo 31907a3
chore: add .go cache folder to gitignore
ecPablo 3a591e0
Merge branch 'ecpablo/deploy-topology-mcms' into ecpablo/fund-mcms-pdas
ecPablo 0574177
fix: move changeset to solana specific folder since this changeset is…
ecPablo 9676a53
Merge branch 'main' into ecpablo/fund-mcms-pdas
ecPablo b509d26
fix: lint errors
ecPablo d2140f0
fix: move solana specific changeset under mcms/solana/changesets/fund…
ecPablo eb1320f
Merge branch 'main' into ecpablo/fund-mcms-pdas
ecPablo 3cf7c8d
fix: consolidate sequences and ops in the same changesets folder
ecPablo e2587b4
Merge branch 'main' into ecpablo/fund-mcms-pdas
ecPablo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| // Package changesets provides multi-family MCMS changesets. | ||
| // | ||
| // Start here when looking for a changeset to use. Each subdirectory is a | ||
| // self-contained changeset with a chain-agnostic entrypoint ([Changeset], Config, | ||
| // and optionally a registry for per-family sequences). | ||
| // | ||
| // # Multi-family changesets (this directory) | ||
| // | ||
| // - set-config — configure MCMS contracts across chains | ||
| // - deploy — deploy the standard MCMS topology | ||
| // - deploy-custom-topology — deploy an arbitrary MCMS topology | ||
| // - transfer-to-timelock — transfer contract ownership to a timelock | ||
| // - firedrill — MCMS firedrill operations | ||
| // | ||
| // Import path pattern: | ||
| // | ||
| // github.com/smartcontractkit/cld-changesets/mcms/changesets/<name> | ||
| // | ||
| // Blank-import the chain families you need, for example: | ||
| // | ||
| // _ "github.com/smartcontractkit/cld-changesets/mcms/evm/set-config" | ||
| // _ "github.com/smartcontractkit/cld-changesets/mcms/solana/set-config" | ||
| // | ||
| // # Family-only changesets | ||
| // | ||
| // Some changesets are inherently specific to one chain family and have no | ||
| // chain-agnostic wrapper. Solana-only changesets live under | ||
| // mcms/solana/changesets (for example fund-mcm-pdas). EVM-only changesets | ||
| // would follow mcms/evm/changesets if added in the future. | ||
| // | ||
| // Family implementation packages (mcms/evm/<name>, mcms/solana/<name>) contain | ||
| // sequences and operations registered by multi-family changesets via init. | ||
| // Solana-only changesets live under mcms/solana/changesets. | ||
| package changesets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| // Package changesets holds Solana-only MCMS changesets. | ||
| // | ||
| // Multi-family changesets (set-config, deploy, firedrill, and others) live under | ||
| // mcms/changesets and register per-family implementations from mcms/solana/<name> | ||
| // and mcms/evm/<name>. Solana-only changesets that have no chain-agnostic layer | ||
| // — because the concept is inherently Solana-specific — live here instead. | ||
| // | ||
| // # Available changesets | ||
| // | ||
| // - fund-mcm-pdas — fund MCMS signer PDAs with lamports | ||
| // (github.com/smartcontractkit/cld-changesets/mcms/solana/changesets/fund-mcm-pdas) | ||
| // | ||
| // Import path pattern: | ||
| // | ||
| // github.com/smartcontractkit/cld-changesets/mcms/solana/changesets/<name> | ||
| package changesets |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| package fundmcmpdas | ||
|
|
||
| import ( | ||
| "errors" | ||
| "fmt" | ||
|
|
||
| "github.com/smartcontractkit/chainlink-deployments-framework/changeset/sequenceutils" | ||
| "github.com/smartcontractkit/chainlink-deployments-framework/datastore" | ||
| cldf "github.com/smartcontractkit/chainlink-deployments-framework/deployment" | ||
|
|
||
| "github.com/smartcontractkit/cld-changesets/internal/maputil" | ||
| ) | ||
|
|
||
| var _ cldf.ChangeSetV2[Config] = Changeset{} | ||
|
|
||
| // Changeset funds MCMS signer PDAs on each configured Solana chain. | ||
| type Changeset struct{} | ||
|
|
||
| func (Changeset) VerifyPreconditions(env cldf.Environment, config Config) error { | ||
| if len(config.FundingPerChain) == 0 { | ||
| return errors.New("no funding config provided") | ||
| } | ||
|
|
||
| for chainSelector, chainCfg := range config.FundingPerChain { | ||
| if _, ok := env.BlockChains.SolanaChains()[chainSelector]; !ok { | ||
| return fmt.Errorf("solana chain %d not found in environment", chainSelector) | ||
| } | ||
|
ecPablo marked this conversation as resolved.
|
||
| if err := validateMCMSRefs(env, chainSelector, chainCfg); err != nil { | ||
| return err | ||
| } | ||
| if err := validateDeployerBalance(env, chainSelector, chainCfg); err != nil { | ||
| return err | ||
| } | ||
| } | ||
|
|
||
| return nil | ||
| } | ||
|
|
||
| func (Changeset) Apply(e cldf.Environment, config Config) (cldf.ChangesetOutput, error) { | ||
| deps := Deps{ | ||
| BlockChains: e.BlockChains, | ||
| DataStore: e.DataStore, | ||
| } | ||
|
|
||
| var agg sequenceutils.OnChainOutput | ||
|
|
||
| for _, chainSelector := range maputil.SortedMapKeys(config.FundingPerChain) { | ||
| chainCfg := config.FundingPerChain[chainSelector] | ||
|
|
||
| var mergeErr error | ||
| agg, mergeErr = sequenceutils.ExecuteOnChainSequenceAndMerge( | ||
| e.OperationsBundle, | ||
| deps, | ||
| SeqFundMCMPDAs, | ||
| ChainInput{ | ||
| ChainSelector: chainSelector, | ||
| FundingConfig: chainCfg, | ||
| }, | ||
| agg, | ||
| ) | ||
| if mergeErr != nil { | ||
| return buildOutput(e, agg, mergeErr) | ||
| } | ||
| } | ||
|
|
||
| return buildOutput(e, agg, nil) | ||
| } | ||
|
|
||
| func buildOutput( | ||
| e cldf.Environment, | ||
| agg sequenceutils.OnChainOutput, | ||
| err error, | ||
| ) (cldf.ChangesetOutput, error) { | ||
| ds := datastore.NewMemoryDataStore() | ||
| if metaErr := ds.WriteMetadata(agg.Metadata); metaErr != nil { | ||
| return cldf.ChangesetOutput{DataStore: ds}, | ||
| fmt.Errorf("failed to write metadata to datastore: %w", metaErr) | ||
| } | ||
|
|
||
| partialOutput := cldf.ChangesetOutput{DataStore: ds} | ||
| if err != nil { | ||
| return partialOutput, err | ||
| } | ||
|
|
||
| out, buildErr := cldf.NewOutputBuilder(e, ds).Build() | ||
| if buildErr != nil { | ||
| return out, fmt.Errorf("build changeset output: %w", buildErr) | ||
| } | ||
|
|
||
| return out, nil | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.