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

Port CLI to mcms for non CLD integrations #182

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open

Conversation

akhilchainani
Copy link
Collaborator

@akhilchainani akhilchainani commented Dec 3, 2024

Add the following changes:

  • Adds CLI commands for basic MCMS management
  • Changes the WriteProposal functions to be member functions of the MCMSProposal and TimelockProposal types
  • Exposes the Proposal Object in the Signable and Executable structs
  • Defines an interface with common behavior across MCMSProposal and TimelockProposal such that we can interact with the proposals in a proposal-agnostic way

Note: The CLI component right now is fairly coupled to EVM. This is tech debt that needs to be resolved at a later point in time, as this is being implemented to unblock Keystone efforts, which are currently only targeting EVM chains

We should consolidate this with CLD CLI at some point but I think we can do that in a followup PR

Copy link

changeset-bot bot commented Dec 3, 2024

⚠️ No Changeset found

Latest commit: 0c0814c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@akhilchainani akhilchainani changed the title port CLI to mcms for non CLD integrations Port CLI to mcms for non CLD integrations Dec 3, 2024
@akhilchainani akhilchainani marked this pull request as ready for review December 3, 2024 09:47
@akhilchainani akhilchainani requested a review from a team as a code owner December 3, 2024 09:47
@cl-sonarqube-production
Copy link

Quality Gate failed Quality Gate failed

Failed conditions
21.3% Duplication on New Code (required ≤ 5%)

See analysis details on SonarQube

@@ -22,6 +22,16 @@ import (

const SignMsgABI = `[{"type":"bytes32"},{"type":"uint32"}]`

// ProposalInterface is the interface for all MCMS proposals.
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want the word Interface in the type? I see we already have Proposal as a struct implementing this interface but I was wondering if we could rename it.

I understand this would be a breaking change, but since we don't have any official clients it wouldn't affect anyone.

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure how others feel about it but, maybe we could rename the current Proposal struct to MCMSProposal.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 on that, I actually were a bit confused how proposal is different from timelockproposal as we additionaly have baseproposal. MCMSProposal seems more straightforward.

// and merkle tree.
func NewSignable(
proposal *Proposal,
Proposal *Proposal,
Copy link
Contributor

Choose a reason for hiding this comment

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

capitalized method parameters are not very common. Was this the result of an accidental search+replace?

@@ -75,32 +75,32 @@ func (s *Signable) Sign(signer signer) (sig types.Signature, err error) {
return types.NewSignatureFromBytes(sigB)
}

// SignAndAppend signs the proposal using the provided signer and appends the resulting signature
// to the proposal's list of signatures.
// SignAndAppend signs the Proposal using the provided signer and appends the resulting signature
Copy link
Contributor

Choose a reason for hiding this comment

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

seems we have a few accidental renames in the comments as well

@@ -9,13 +9,15 @@ sonar.exclusions=\
**/generate,\
**/*.md, \
**/mocks/**/*
cmd/**/*
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand excluding the cmd/ files from the coverage analysis (below), but why from the static analysis?

Copy link
Contributor

Choose a reason for hiding this comment

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

most of the code under cmd/ was copied from chainlink-deployments/cmd/, correct?

@@ -93,6 +93,7 @@ issues:
# Exclude the directory from linting because it will soon be removed and only contains
# generated code. Can be removed once the gethwrappers directory is removed.
- sdk/evm/bindings
- cmd
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should lint this code, or if there is a linter that is specifically not needed, we can exclude it explicitly.

I am very wary of blanket exclusions

fmt.Printf("Checking quorum for proposal %s\n", proposalPath)
proposal, err := loadProposal(proposalPath)
if err != nil {
fmt.Printf("Error loading proposal: %s\n", err)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably bringing up a linting error, but you can you the print function on the cmd object instead of fmt

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