Skip to content

Commit

Permalink
Merge branch 'develop' into nrailic-crib-clanup
Browse files Browse the repository at this point in the history
  • Loading branch information
njegosrailic authored Aug 14, 2024
2 parents 3425986 + 3399dd6 commit 2647cfd
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 30 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/chilly-cars-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": minor
---

add error handle for gnosis chiado for seen tx #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 .changeset/ninety-ways-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"chainlink": patch
---

#internal speed up keystone e2e tests
2 changes: 1 addition & 1 deletion .github/workflows/crib-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
CRIB_NODES: 5
GAP_URL: ${{ secrets.GAP_URL }}
SETH_LOG_LEVEL: info
# RESTY_DEBUG: true
# RESTY_DEBUG: true
TEST_PERSISTENCE: true
run: |-
go test -v -run TestCRIB
Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func setupCapabilitiesRegistryContract(ctx context.Context, t *testing.T, workfl
triggerCapabilityConfig := newCapabilityConfig()
triggerCapabilityConfig.RemoteConfig = &pb.CapabilityConfig_RemoteTriggerConfig{
RemoteTriggerConfig: &pb.RemoteTriggerConfig{
RegistrationRefresh: durationpb.New(60000 * time.Millisecond),
RegistrationRefresh: durationpb.New(1000 * time.Millisecond),
RegistrationExpiry: durationpb.New(60000 * time.Millisecond),
// F + 1
MinResponsesToAggregate: uint32(triggerDon.F) + 1,
Expand Down
8 changes: 6 additions & 2 deletions 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 Expand Up @@ -259,14 +259,18 @@ var mantle = ClientErrors{
Fatal: regexp.MustCompile(`(: |^)'*invalid sender`),
}

var gnosis = ClientErrors{
TransactionAlreadyInMempool: regexp.MustCompile(`(: |^)(alreadyknown)`),
}

const TerminallyStuckMsg = "transaction terminally stuck"

// Tx.Error messages that are set internally so they are not chain or client specific
var internal = ClientErrors{
TerminallyStuck: regexp.MustCompile(TerminallyStuckMsg),
}

var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, mantle, aStar, internal}
var clients = []ClientErrors{parity, geth, arbitrum, metis, substrate, avalanche, nethermind, harmony, besu, erigon, klaytn, celo, zkSync, zkEvm, mantle, aStar, gnosis, internal}

// ClientErrorRegexes returns a map of compiled regexes for each error type
func ClientErrorRegexes(errsRegex config.ClientErrors) *ClientErrors {
Expand Down
3 changes: 3 additions & 0 deletions core/chains/evm/client/errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ func Test_Eth_Errors(t *testing.T) {
// This seems to be an erroneous message from the zkSync client, we'll have to match it anyway
{"ErrorObject { code: ServerError(3), message: \\\"known transaction. transaction with hash 0xf016…ad63 is already in the system\\\", data: Some(RawValue(\\\"0x\\\")) }", true, "zkSync"},
{"client error transaction already in mempool", true, "tomlConfig"},
{"alreadyknown", true, "Gnosis"},
}
for _, test := range tests {
err = evmclient.NewSendErrorS(test.message)
Expand Down Expand Up @@ -229,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
2 changes: 0 additions & 2 deletions core/services/chainlink/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,6 @@ func NewApplication(opts ApplicationOpts) (Application, error) {
signer := externalPeer
externalPeerWrapper = externalPeer
remoteDispatcher := remote.NewDispatcher(externalPeerWrapper, signer, opts.CapabilitiesRegistry, globalLogger)
srvcs = append(srvcs, remoteDispatcher)

dispatcher = remoteDispatcher
} else {
dispatcher = opts.CapabilitiesDispatcher
Expand Down

0 comments on commit 2647cfd

Please sign in to comment.