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

New rmn curse changeset #15868

Merged
merged 28 commits into from
Jan 15, 2025
Merged

New rmn curse changeset #15868

merged 28 commits into from
Jan 15, 2025

Conversation

carte7000
Copy link
Contributor

@carte7000 carte7000 commented Jan 8, 2025

This PR add a new changeset to curse lanes and chains via RMNRemote

It also add a utility that allow writing changeset without caring about wether we are creating a proposal or executing with a deployer key.

Example usage of the changeset

cfg := RMNCurseConfig{
    CurseActions: []CurseAction{
        CurseChain(SEPOLIA_CHAIN_SELECTOR),
        CurseLane(SEPOLIA_CHAIN_SELECTOR, AVAX_FUJI_CHAIN_SELECTOR),
    },
    CurseReason: "test curse",
    MCMS: &MCMSConfig{MinDelay: 0},
}
output, err := NewRMNCurseChangeset(env, cfg)

@carte7000 carte7000 requested review from a team as code owners January 8, 2025 19:33
Copy link
Contributor

github-actions bot commented Jan 8, 2025

AER Report: CI Core ran successfully ✅

aer_workflow , commit

AER Report: Operator UI CI ran successfully ✅

aer_workflow , commit

Copy link
Contributor

@makramkd makramkd left a comment

Choose a reason for hiding this comment

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

Only read half the PR so far, looking good but some changes needed

state, err := LoadOnchainState(e)

if err != nil {
return errors.Errorf("failed to load onchain state: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: we're trying to actively discontinue the use of errors in favor of fmt - so here fmt.Errorf instead

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@makramkd I had to change this to make the linter pass, everything was using fmt.Errorf but linting would fail

Copy link
Contributor

Choose a reason for hiding this comment

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

What is the linting error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can't find the previous run, it will probably be quicker to change the format once more and see if the linting issues reappear, anyways from what I get we should probably update the linting rule if this flags fmt.Errorf

deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
grouped[subject.ChainSelector] = append(grouped[subject.ChainSelector], subject.SubjectToCurse)
}

// Only keep unique subjects, preserve only global curse if present and eliminate any curse where the selector is the same as the subject
Copy link
Contributor

Choose a reason for hiding this comment

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

eliminate any curse where the selector is the same as the subject

Trying to understand this, aren't the subjects either global curse or the chain selector? So "eliminate any curse where the selector is the same as the subject" are just non-global curses no? Might be just simpler to say 'if the global curse subject is one of the subjects, prune all other subjects and only keep the global one'?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think my comment was not clear, I changed it, however the goal here was to avoid self curse or in other word having a chain curse it's own chain selector on RMNRemote

}
}

func groupRMNSubjectBySelector(rmnSubjects []RMNCurseAction, filter bool) map[uint64][]Subject {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
func groupRMNSubjectBySelector(rmnSubjects []RMNCurseAction, filter bool) map[uint64][]Subject {
func groupRMNSubjectBySelector(rmnSubjects []RMNCurseAction, keepOnlyGlobal bool) map[uint64][]Subject {

Based on my understanding of this code, this seems like a more meaningful var name, please correct me if I'm wrong though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the function to have less confusing options but keepOnlyGlobal would not be enough as we also need to remove the self curses I was mentioning above.

}

func groupRMNSubjectBySelector(rmnSubjects []RMNCurseAction, filter bool) map[uint64][]Subject {
grouped := make(map[uint64][]Subject)
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems like a simpler approach to me:

func groupRMNSubjectBySelector(rmnSubjects []RMNCurseAction, keepOnlyGlobal bool) (result map[uint64][]Subject) {
	grouped := make(map[uint64]map[Subject]struct{})

	// Group subjects by chain selector and ensure uniqueness
	for _, subject := range rmnSubjects {
		if grouped[subject.ChainSelector] == nil {
            grouped[subject.ChainSelector] = make(map[Subject]struct{})
        }
        if keepOnlyGlobal && subject.SubjectToCurse == SelectorToSubject(subject.ChainSelector) {
            continue
        }
        grouped[subject.ChainSelector][subject.SubjectToCurse] = struct{}{}
	}

	result = make(map[uint64][]Subject)
	for selector, subjects := range grouped {
		// see https://pkg.go.dev/golang.org/x/exp/maps#Values
		result[selector] = maps.Values(subjects)
	}

	return result
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this might be missing some parts, ie if the GlobalSubject is part of the subject to curse on a chain we would want to only keep this one when keepOnlyGlobal is active. I updated the original to be clearer let me know if it looks good to you

deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
sim := &bind.TransactOpts{
From: txOpts.From,
Signer: txOpts.Signer,
GasLimit: txOpts.GasLimit,
Copy link
Contributor

Choose a reason for hiding this comment

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

Not 100% sure what these values would be in DeployerKey but if this is non-zero the gethwrappers won't estimate gas, see e.g transactions https://github.com/ethereum/go-ethereum/blob/c0882429f032da58620bcaa610007939aa7e0adb/accounts/abi/bind/base.go#L316

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see but I don't think we would be modifying the original behavior from the deployerKey here no?

@carte7000 carte7000 requested a review from makramkd January 13, 2025 16:01
Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 2597661 (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestRMNCurseIdempotent 0.00% true true false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 23b24e2 (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestRMNCurseIdempotent 0.00% true true false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 23b24e2 (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestDeployCCIPContracts N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployChainContractsChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployHomeChain N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployPrerequisites N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestJobSpecChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestRMNCurseIdempotent 0.00% true true false 6 0 6 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestRMNCurseIdempotent/chain_NO_MCMS N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 6 0 6 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_NewAcceptOwnershipChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

@AnieeG AnieeG left a comment

Choose a reason for hiding this comment

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

do you have a test for RMN contracts owned by deployer key?

deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
deployment/ccip/changeset/cs_rmn_curse_uncurse.go Outdated Show resolved Hide resolved
@carte7000
Copy link
Contributor Author

do you have a test for RMN contracts owned by deployer key?

Yes we have one with MCMS and one with deployer key for each Curse/Uncurse test cases

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 23b24e2 (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestDeployCCIPContracts N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployChainContractsChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployHomeChain N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployPrerequisites N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestJobSpecChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestRMNCurseIdempotent 0.00% true true false 9 0 9 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestRMNCurseIdempotent/chain_NO_MCMS N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 9 0 9 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_NewAcceptOwnershipChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 95e4256 (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestRMNCurseIdempotent 0.00% true true false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 235ecaf (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestRMNCurseIdempotent 0.00% true true false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

@carte7000 carte7000 enabled auto-merge January 15, 2025 01:24
Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 235ecaf (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestDeployCCIPContracts N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployChainContractsChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployHomeChain N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestDeployPrerequisites N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestJobSpecChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
TestRMNCurseIdempotent 0.00% true true false 6 0 6 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 6 0 6 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_NewAcceptOwnershipChangeset N/A false false false 0 0 0 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

@carte7000 carte7000 requested a review from AnieeG January 15, 2025 12:51
ecPablo
ecPablo previously approved these changes Jan 15, 2025
@carte7000 carte7000 requested a review from ecPablo January 15, 2025 19:20
@carte7000 carte7000 added this pull request to the merge queue Jan 15, 2025
Copy link
Contributor

Flakeguard Summary

Ran new or updated tests between develop and 0cd231c (new-rmn-curse-changeset).

View Flaky Detector Details | Compare Changes

Found Flaky Tests ❌

Name Pass Ratio Panicked? Timed Out? Race? Runs Successes Failures Skips Package Package Panicked? Avg Duration Code Owners
TestRMNCurseIdempotent 0.00% true true false 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation
Test_ActiveCandidate 0.00% false false true 3 0 3 0 github.com/smartcontractkit/chainlink/deployment/ccip/changeset true 0s @smartcontractkit/ccip, @smartcontractkit/core, @smartcontractkit/deployment-automation

Artifacts

For detailed logs of the failed tests, please refer to the artifact failed-test-results-with-logs.json.

Merged via the queue into develop with commit f9cc514 Jan 15, 2025
191 of 192 checks passed
@carte7000 carte7000 deleted the new-rmn-curse-changeset branch January 15, 2025 19:51
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.

5 participants