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 to hydrate contract from the capability registry view #15309

Merged
merged 9 commits into from
Nov 25, 2024

Conversation

vyzaldysanchez
Copy link
Contributor

Requires

Supports

ChainID uint64
}

func (v CapabilityRegistryView) Hydrate(env deployment.Environment, cfg HydrateConfig) (*deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry], error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the views packages should all be readonly. Anything that writes onchain should be in a changeset. You can add a common/changeset if you want though, after #15288 there will already be a directory for that you can use

krehermann
krehermann previously approved these changes Nov 20, 2024
)
return deployment.ContractDeploy[*capabilities_registry.CapabilitiesRegistry]{
Address: crAddr, Contract: cr, Tx: tx, Err: err2,
Tv: deployment.NewTypeAndVersion("CapabilitiesRegistry", deployment.Version1_0_0),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these values come from the contract itself

return nil, fmt.Errorf("failed to convert nodes to nodes params: %w", err)
}
tx, err := deployedContract.Contract.AddNodes(chain.DeployerKey, nodesParams)
if _, err = deployment.ConfirmIfNoError(chain, tx, err); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use this helper to decode the err parse err func

}

capabilitiesParams := v.CapabilitiesToCapabilitiesParams()
tx, err = deployedContract.Contract.AddCapabilities(chain.DeployerKey, capabilitiesParams)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to add both nops & capabilities before adding nodes b/c FK constraints in the contract enforce the nop id and hash capabilities values already exist

Copy link
Contributor

github-actions bot commented Nov 20, 2024

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

@vyzaldysanchez vyzaldysanchez marked this pull request as ready for review November 20, 2024 21:37
@vyzaldysanchez vyzaldysanchez requested review from a team as code owners November 20, 2024 21:37
var capabilityRegistryView v1_0.CapabilityRegistryView
require.NoError(t, json.Unmarshal(b, &capabilityRegistryView))

chainID := chainsel.TEST_90000001.EvmChainID + 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why + 1?
i think there are multiple TEST selectors if you simply want one that is not 90000001

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Used +1 based on how chains are generated here.

krehermann
krehermann previously approved these changes Nov 20, 2024
)

func DeployCapabilityRegistry(env deployment.Environment, config interface{}) (deployment.ChangesetOutput, error) {
func DeployCapabilityRegistry(env deployment.Environment, config interface{}) (deployment.ChangesetOutput, *capabilities_registry.CapabilitiesRegistry, error) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will break downstream users.

there ought to be a type assert here, but it's missing. please add it
type assertion

instead of returning the contract, you can load the contract from the returned addressbook
contract set

return nil, fmt.Errorf("failed to deploy contract: %w", err)
}

nopsParams := v.NopsToNopsParams()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@connorwstein it's not straightforward to reuse the existing changeset that deploys/configures our capability registry because it does too much stuff (and need to be refactored to support mcms as discussed in slack)

i'd like to move forward with this approach here so we can use the tool downstream

@vyzaldysanchez please file a ticket to refactor this logic into calls to bite-sizes changesets. and write in that ticket that we need to implement the changesets first.

krehermann
krehermann previously approved these changes Nov 22, 2024
@vyzaldysanchez vyzaldysanchez added this pull request to the merge queue Nov 25, 2024
Merged via the queue into develop with commit f5d228e Nov 25, 2024
151 checks passed
@vyzaldysanchez vyzaldysanchez deleted the task/KS-528/changesets-tool branch November 25, 2024 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants