Skip to content

Commit

Permalink
Merge branch 'develop' into task/KS-297/db-syncer
Browse files Browse the repository at this point in the history
  • Loading branch information
bolekk authored Aug 14, 2024
2 parents 1d65a23 + 3399dd6 commit 8d26d02
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 25 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-badgers-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

add error handling when arbitrum sequencer is not accessible #added
5 changes: 5 additions & 0 deletions .changeset/new-eagles-marry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal prevent editing whether or not a DON accepts workflows
5 changes: 5 additions & 0 deletions contracts/.changeset/slimy-pens-listen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chainlink/contracts': patch
---

#internal prevent editing whether or not a DON accepts workflows
20 changes: 15 additions & 5 deletions contracts/src/v0.8/keystone/CapabilitiesRegistry.sol
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,9 @@ contract CapabilitiesRegistry is OwnerIsCreator, TypeAndVersionInterface {
/// @param nodes The nodes making up the DON
/// @param capabilityConfigurations The list of configurations for the
/// capabilities supported by the DON
/// @param isPublic True if the DON is public
/// @param isPublic True if the DON is can accept external capability requests
/// @param acceptsWorkflows True if the DON can accept workflows
/// @param f The maximum number of faulty nodes the DON can tolerate
function addDON(
bytes32[] calldata nodes,
CapabilityConfiguration[] calldata capabilityConfigurations,
Expand All @@ -797,24 +799,32 @@ contract CapabilitiesRegistry is OwnerIsCreator, TypeAndVersionInterface {
/// the admin to reconfigure the list of capabilities supported
/// by the DON, the list of nodes that make up the DON as well
/// as whether or not the DON can accept external workflows
/// @param donId The ID of the DON to update
/// @param nodes The nodes making up the DON
/// @param capabilityConfigurations The list of configurations for the
/// capabilities supported by the DON
/// @param isPublic True if the DON is can accept external workflows
/// @param isPublic True if the DON is can accept external capability requests
/// @param f The maximum number of nodes that can fail
function updateDON(
uint32 donId,
bytes32[] calldata nodes,
CapabilityConfiguration[] calldata capabilityConfigurations,
bool isPublic,
bool acceptsWorkflows,
uint8 f
) external onlyOwner {
uint32 configCount = s_dons[donId].configCount;
DON storage don = s_dons[donId];
uint32 configCount = don.configCount;
if (configCount == 0) revert DONDoesNotExist(donId);
_setDONConfig(
nodes,
capabilityConfigurations,
DONParams({id: donId, configCount: ++configCount, isPublic: isPublic, acceptsWorkflows: acceptsWorkflows, f: f})
DONParams({
id: donId,
configCount: ++configCount,
isPublic: isPublic,
acceptsWorkflows: don.acceptsWorkflows,
f: f
})
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ contract CapabilitiesRegistry_RemoveNodesTest is BaseTest {
bytes32[] memory updatedNodes = new bytes32[](2);
updatedNodes[0] = P2P_ID;
updatedNodes[1] = P2P_ID_THREE;
s_CapabilitiesRegistry.updateDON(DON_ID, updatedNodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, updatedNodes, capabilityConfigs, true, F_VALUE);

// Remove node
s_CapabilitiesRegistry.removeNodes(removedNodes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
capabilityId: s_basicHashedCapabilityId,
config: BASIC_CAPABILITY_CONFIG
});
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE);
}

function test_RevertWhen_NodeDoesNotSupportCapability() public {
Expand All @@ -91,7 +91,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
s_capabilityWithConfigurationContractId
)
);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE);
}

function test_RevertWhen_DONDoesNotExist() public {
Expand All @@ -106,7 +106,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
config: BASIC_CAPABILITY_CONFIG
});
vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.DONDoesNotExist.selector, nonExistentDONId));
s_CapabilitiesRegistry.updateDON(nonExistentDONId, nodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(nonExistentDONId, nodes, capabilityConfigs, true, F_VALUE);
}

function test_RevertWhen_CapabilityDoesNotExist() public {
Expand All @@ -122,7 +122,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
vm.expectRevert(
abi.encodeWithSelector(CapabilitiesRegistry.CapabilityDoesNotExist.selector, s_nonExistentHashedCapabilityId)
);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE);
}

function test_RevertWhen_DuplicateCapabilityAdded() public {
Expand All @@ -144,7 +144,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
vm.expectRevert(
abi.encodeWithSelector(CapabilitiesRegistry.DuplicateDONCapability.selector, 1, s_basicHashedCapabilityId)
);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE);
}

function test_RevertWhen_DeprecatedCapabilityAdded() public {
Expand All @@ -165,7 +165,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
});

vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.CapabilityIsDeprecated.selector, capabilityId));
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE);
}

function test_RevertWhen_DuplicateNodeAdded() public {
Expand All @@ -180,7 +180,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
config: BASIC_CAPABILITY_CONFIG
});
vm.expectRevert(abi.encodeWithSelector(CapabilitiesRegistry.DuplicateDONNode.selector, 1, P2P_ID));
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, true, F_VALUE);
}

function test_UpdatesDON() public {
Expand Down Expand Up @@ -217,7 +217,7 @@ contract CapabilitiesRegistry_UpdateDONTest is BaseTest {
),
1
);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, expectedDONIsPublic, true, F_VALUE);
s_CapabilitiesRegistry.updateDON(DON_ID, nodes, capabilityConfigs, expectedDONIsPublic, F_VALUE);

CapabilitiesRegistry.DONInfo memory donInfo = s_CapabilitiesRegistry.getDON(DON_ID);
assertEq(donInfo.id, DON_ID);
Expand Down
2 changes: 1 addition & 1 deletion core/chains/evm/client/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ var arbitrum = ClientErrors{
Fatal: arbitrumFatal,
L2FeeTooLow: regexp.MustCompile(`(: |^)max fee per gas less than block base fee(:|$)`),
L2Full: regexp.MustCompile(`(: |^)(queue full|sequencer pending tx pool full, please try again)(:|$)`),
ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$`),
ServiceUnavailable: regexp.MustCompile(`(: |^)502 Bad Gateway: [\s\S]*$|network is unreachable|i/o timeout`),
}

var celo = ClientErrors{
Expand Down
2 changes: 2 additions & 0 deletions core/chains/evm/client/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,8 @@ func Test_Eth_Errors(t *testing.T) {
tests := []errorCase{
{"call failed: 503 Service Unavailable: <html>\r\n<head><title>503 Service Temporarily Unavailable</title></head>\r\n<body>\r\n<center><h1>503 Service Temporarily Unavailable</h1></center>\r\n</body>\r\n</html>\r\n", true, "Nethermind"},
{"call failed: 502 Bad Gateway: <html>\r\n<head><title>502 Bad Gateway</title></head>\r\n<body>\r\n<center><h1>502 Bad Gateway</h1></center>\r\n<hr><center>", true, "Arbitrum"},
{"i/o timeout", true, "Arbitrum"},
{"network is unreachable", true, "Arbitrum"},
{"client error service unavailable", true, "tomlConfig"},
}
for _, test := range tests {
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
GETH_VERSION: 1.13.8
capabilities_registry: ../../../contracts/solc/v0.8.24/CapabilitiesRegistry/CapabilitiesRegistry.abi ../../../contracts/solc/v0.8.24/CapabilitiesRegistry/CapabilitiesRegistry.bin bb794cc0042784b060d1d63090e2086670b88ba3685067cd436305f36054c82b
capabilities_registry: ../../../contracts/solc/v0.8.24/CapabilitiesRegistry/CapabilitiesRegistry.abi ../../../contracts/solc/v0.8.24/CapabilitiesRegistry/CapabilitiesRegistry.bin 7e95d72f24940f08ada0ee3b85d894d6bfccfd6c8a3e0ceeff65bae52c899d54
feeds_consumer: ../../../contracts/solc/v0.8.24/KeystoneFeedsConsumer/KeystoneFeedsConsumer.abi ../../../contracts/solc/v0.8.24/KeystoneFeedsConsumer/KeystoneFeedsConsumer.bin 8c3a2b18a80be41e7c40d2bc3a4c8d1b5e18d55c1fd20ad5af68cebb66109fc5
forwarder: ../../../contracts/solc/v0.8.24/KeystoneForwarder/KeystoneForwarder.abi ../../../contracts/solc/v0.8.24/KeystoneForwarder/KeystoneForwarder.bin 45d9b866c64b41c1349a90b6764aee42a6d078b454d38f369b5fe02b23b9d16e
ocr3_capability: ../../../contracts/solc/v0.8.24/OCR3Capability/OCR3Capability.abi ../../../contracts/solc/v0.8.24/OCR3Capability/OCR3Capability.bin 8bf0f53f222efce7143dea6134552eb26ea1eef845407b4475a0d79b7d7ba9f8

0 comments on commit 8d26d02

Please sign in to comment.