Skip to content

Commit

Permalink
CapabilitiyRegistry: Restrict nodes to a single Workflow DON (#13566)
Browse files Browse the repository at this point in the history
* Minor gas saving refactor

* Minor gas saving refactor #2

* Split DON IDs into capabilities and workflow

* Validate that a node can belong to a single Workflow DON

* Update gas snapshot and wrappers

* Align error messages

* Changesets

* NodeInfo => NodeParams

* Add NodeInfo

* Update gas snapshot and wrappers

* Update reader integration test

* Fix Reader test

* Simplify changes

* Comment fix
  • Loading branch information
DeividasK authored Jun 17, 2024
1 parent 22cab6c commit f1d478d
Show file tree
Hide file tree
Showing 17 changed files with 338 additions and 226 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-crabs-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal
5 changes: 5 additions & 0 deletions contracts/.changeset/red-wasps-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/contracts': patch
---

#internal
77 changes: 39 additions & 38 deletions contracts/gas-snapshots/keystone.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,28 @@ CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas:
CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_CapabilityExists() (gas: 145769)
CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractDoesNotMatchInterface() (gas: 94606)
CapabilityRegistry_AddCapabilitiesTest:test_RevertWhen_ConfigurationContractNotDeployed() (gas: 92961)
CapabilityRegistry_AddDONTest:test_AddDON() (gas: 499005)
CapabilityRegistry_AddDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19247)
CapabilityRegistry_AddDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 291948)
CapabilityRegistry_AddDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 365161)
CapabilityRegistry_AddDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 375975)
CapabilityRegistry_AddDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 177964)
CapabilityRegistry_AddDONTest:test_RevertWhen_FaultToleranceIsZero() (gas: 43332)
CapabilityRegistry_AddDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 306409)
CapabilityRegistry_AddDONTest:test_AddDON() (gas: 372909)
CapabilityRegistry_AddDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19269)
CapabilityRegistry_AddDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 169874)
CapabilityRegistry_AddDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 243042)
CapabilityRegistry_AddDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 249901)
CapabilityRegistry_AddDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 116949)
CapabilityRegistry_AddDONTest:test_RevertWhen_FaultToleranceIsZero() (gas: 43354)
CapabilityRegistry_AddDONTest:test_RevertWhen_NodeAlreadyBelongsToWorkflowDON() (gas: 344231)
CapabilityRegistry_AddDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 180335)
CapabilityRegistry_AddNodeOperatorsTest:test_AddNodeOperators() (gas: 184333)
CapabilityRegistry_AddNodeOperatorsTest:test_RevertWhen_CalledByNonAdmin() (gas: 17602)
CapabilityRegistry_AddNodeOperatorsTest:test_RevertWhen_NodeOperatorAdminAddressZero() (gas: 18498)
CapabilityRegistry_AddNodesTest:test_AddsNodeInfo() (gas: 355400)
CapabilityRegistry_AddNodesTest:test_OwnerCanAddNodes() (gas: 355388)
CapabilityRegistry_AddNodesTest:test_AddsNodeParams() (gas: 358667)
CapabilityRegistry_AddNodesTest:test_OwnerCanAddNodes() (gas: 358633)
CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingDuplicateP2PId() (gas: 301350)
CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 55207)
CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidNodeOperator() (gas: 24940)
CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithInvalidNodeOperator() (gas: 24895)
CapabilityRegistry_AddNodesTest:test_RevertWhen_AddingNodeWithoutCapabilities() (gas: 27702)
CapabilityRegistry_AddNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25108)
CapabilityRegistry_AddNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 27408)
CapabilityRegistry_AddNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 27047)
CapabilityRegistry_AddNodesTest:test_RevertWhen_SignerAddressNotUnique() (gas: 309778)
CapabilityRegistry_AddNodesTest:test_RevertWhen_SignerAddressNotUnique() (gas: 309800)
CapabilityRegistry_DeprecateCapabilitiesTest:test_DeprecatesCapability() (gas: 92938)
CapabilityRegistry_DeprecateCapabilitiesTest:test_EmitsEvent() (gas: 93066)
CapabilityRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CalledByNonAdmin() (gas: 22944)
Expand All @@ -33,51 +34,51 @@ CapabilityRegistry_DeprecateCapabilitiesTest:test_RevertWhen_CapabilityIsDepreca
CapabilityRegistry_GetCapabilitiesTest:test_ExcludesDeprecatedCapabilities() (gas: 122114)
CapabilityRegistry_GetCapabilitiesTest:test_ReturnsCapabilities() (gas: 58311)
CapabilityRegistry_GetDONsTest:test_CorrectlyFetchesDONs() (gas: 65746)
CapabilityRegistry_GetDONsTest:test_DoesNotIncludeRemovedDONs() (gas: 88461)
CapabilityRegistry_GetDONsTest:test_DoesNotIncludeRemovedDONs() (gas: 65329)
CapabilityRegistry_GetHashedCapabilityTest:test_CorrectlyGeneratesHashedCapabilityId() (gas: 11428)
CapabilityRegistry_GetHashedCapabilityTest:test_DoesNotCauseIncorrectClashes() (gas: 13087)
CapabilityRegistry_GetNodeOperatorsTest:test_CorrectlyFetchesNodeOperators() (gas: 36653)
CapabilityRegistry_GetNodeOperatorsTest:test_DoesNotIncludeRemovedNodeOperators() (gas: 38938)
CapabilityRegistry_GetNodesTest:test_CorrectlyFetchesNodes() (gas: 59861)
CapabilityRegistry_GetNodesTest:test_DoesNotIncludeRemovedNodes() (gas: 71597)
CapabilityRegistry_RemoveDONsTest:test_RemovesDON() (gas: 60669)
CapabilityRegistry_GetNodesTest:test_CorrectlyFetchesNodes() (gas: 65482)
CapabilityRegistry_GetNodesTest:test_DoesNotIncludeRemovedNodes() (gas: 73664)
CapabilityRegistry_RemoveDONsTest:test_RemovesDON() (gas: 54946)
CapabilityRegistry_RemoveDONsTest:test_RevertWhen_CalledByNonAdmin() (gas: 15647)
CapabilityRegistry_RemoveDONsTest:test_RevertWhen_DONDoesNotExist() (gas: 16518)
CapabilityRegistry_RemoveDONsTest:test_RevertWhen_DONDoesNotExist() (gas: 16550)
CapabilityRegistry_RemoveNodeOperatorsTest:test_RemovesNodeOperator() (gas: 36122)
CapabilityRegistry_RemoveNodeOperatorsTest:test_RevertWhen_CalledByNonOwner() (gas: 15816)
CapabilityRegistry_RemoveNodesTest:test_CanAddNodeWithSameSignerAddressAfterRemoving() (gas: 114054)
CapabilityRegistry_RemoveNodesTest:test_CanRemoveWhenDONDeleted() (gas: 371555)
CapabilityRegistry_RemoveNodesTest:test_CanRemoveWhenNodeNoLongerPartOfDON() (gas: 712587)
CapabilityRegistry_RemoveNodesTest:test_OwnerCanRemoveNodes() (gas: 72342)
CapabilityRegistry_RemoveNodesTest:test_RemovesNode() (gas: 74176)
CapabilityRegistry_RemoveNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 24916)
CapabilityRegistry_RemoveNodesTest:test_CanAddNodeWithSameSignerAddressAfterRemoving() (gas: 115436)
CapabilityRegistry_RemoveNodesTest:test_CanRemoveWhenDONDeleted() (gas: 288312)
CapabilityRegistry_RemoveNodesTest:test_CanRemoveWhenNodeNoLongerPartOfDON() (gas: 562061)
CapabilityRegistry_RemoveNodesTest:test_OwnerCanRemoveNodes() (gas: 73457)
CapabilityRegistry_RemoveNodesTest:test_RemovesNode() (gas: 75292)
CapabilityRegistry_RemoveNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25053)
CapabilityRegistry_RemoveNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 18418)
CapabilityRegistry_RemoveNodesTest:test_RevertWhen_NodePartOfDON() (gas: 385167)
CapabilityRegistry_RemoveNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 18430)
CapabilityRegistry_RemoveNodesTest:test_RevertWhen_NodePartOfCapabilitiesDON() (gas: 385680)
CapabilityRegistry_RemoveNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 18408)
CapabilityRegistry_TypeAndVersionTest:test_TypeAndVersion() (gas: 9796)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_CalledByNonAdmin() (gas: 19411)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 157904)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_CapabilityDoesNotExist() (gas: 153162)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_DONDoesNotExist() (gas: 17831)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 231117)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 241977)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 103722)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 172410)
CapabilityRegistry_UpdateDONTest:test_UpdatesDON() (gas: 433641)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_DeprecatedCapabilityAdded() (gas: 226375)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_DuplicateCapabilityAdded() (gas: 233235)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_DuplicateNodeAdded() (gas: 107828)
CapabilityRegistry_UpdateDONTest:test_RevertWhen_NodeDoesNotSupportCapability() (gas: 163668)
CapabilityRegistry_UpdateDONTest:test_UpdatesDON() (gas: 372699)
CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_CalledByNonAdminAndNonOwner() (gas: 20627)
CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorAdminIsZeroAddress() (gas: 20048)
CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorDoesNotExist() (gas: 19786)
CapabilityRegistry_UpdateNodeOperatorTest:test_RevertWhen_NodeOperatorIdAndParamLengthsMismatch() (gas: 15426)
CapabilityRegistry_UpdateNodeOperatorTest:test_UpdatesNodeOperator() (gas: 36991)
CapabilityRegistry_UpdateNodesTest:test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() (gas: 250659)
CapabilityRegistry_UpdateNodesTest:test_OwnerCanUpdateNodes() (gas: 158814)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 35963)
CapabilityRegistry_UpdateNodesTest:test_CanUpdateParamsIfNodeSignerAddressNoLongerUsed() (gas: 253325)
CapabilityRegistry_UpdateNodesTest:test_OwnerCanUpdateNodes() (gas: 161746)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_AddingNodeWithInvalidCapability() (gas: 35794)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_CalledByNonNodeOperatorAdminAndNonOwner() (gas: 25064)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_NodeDoesNotExist() (gas: 27303)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() (gas: 29184)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_NodeSignerAlreadyAssignedToAnotherNode() (gas: 29214)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_P2PIDEmpty() (gas: 27291)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 26974)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_UpdatingNodeWithoutCapabilities() (gas: 25538)
CapabilityRegistry_UpdateNodesTest:test_UpdatesNodeInfo() (gas: 158803)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_SignerAddressEmpty() (gas: 26951)
CapabilityRegistry_UpdateNodesTest:test_RevertWhen_UpdatingNodeWithoutCapabilities() (gas: 25508)
CapabilityRegistry_UpdateNodesTest:test_UpdatesNodeParams() (gas: 161800)
KeystoneForwarder_ReportTest:test_Report_ConfigVersion() (gas: 1802140)
KeystoneForwarder_ReportTest:test_Report_FailedDeliveryWhenReceiverInterfaceNotSupported() (gas: 126020)
KeystoneForwarder_ReportTest:test_Report_FailedDeliveryWhenReceiverNotContract() (gas: 127513)
Expand Down
Loading

0 comments on commit f1d478d

Please sign in to comment.