Skip to content

Commit 878dba8

Browse files
authored
Merge pull request #726 from iExecBlockchainComputing/release/8.6.0
Release/8.6.0
2 parents a3234eb + 18d2b2d commit 878dba8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+791
-474
lines changed

CHANGELOG.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,40 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [[8.6.0]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.6.0) 2024-12-23
6+
7+
### New Features
8+
9+
- Push scheduler Result Proxy URL as Web2 secret to SMS. (#718)
10+
11+
### Bug Fixes
12+
13+
- Start scheduler in out-of-service mode. (#712)
14+
- Scheduler needs to enter out-of-service mode on first blockchain communication loss.
15+
This is due to **Nethermind v1.14.7+99775bf7** where filters are lost on restart. (#715)
16+
- Use Result Proxy URL defined in deal parameters if any, fall back to scheduler default one otherwise. (#716)
17+
- Update off-chain task model with on-chain task consensus data in all workflows. (#720)
18+
19+
### Quality
20+
21+
- Reorder static and final keywords. (#717)
22+
- Update `contribution` and `contributionAndFinalize` detector tests.
23+
TEE tasks with callback are now eligible to `contributeAndFinalize` flow. (#719)
24+
- Resolve deprecations caused by `TaskDescription` in `ReplicatesService` and `ResultService`. (#723)
25+
- Add missing `@PreDestroy` annotation in services implementing `Purgeable`. (#724)
26+
27+
### Dependency Upgrades
28+
29+
- Upgrade to `eclipse-temurin:11.0.24_8-jre-focal`. (#713)
30+
- Upgrade to Gradle 8.10.2. (#714)
31+
- Upgrade to `testcontainers` 1.20.4. (#721)
32+
- Upgrade to `mongo:7.0.15-jammy`. (#722)
33+
- Upgrade to `iexec-commons-poco` 4.2.0. (#725)
34+
- Upgrade to `iexec-common` 8.6.0. (#725)
35+
- Upgrade to `iexec-blockchain-adapter-api-library` 8.6.0. (#725)
36+
- Upgrade to `iexec-result-proxy-library` 8.6.0. (#725)
37+
- Upgrade to `iexec-sms-library` 8.7.0. (#725)
38+
539
## [[8.5.0]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.5.0) 2024-06-19
640

741
### Deprecation Notices

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM eclipse-temurin:11.0.22_7-jre-focal
1+
FROM eclipse-temurin:11.0.24_8-jre-focal
22

33
ARG jar
44

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ You can configure the _iExec Core Scheduler_ with the following properties:
4747
| `IEXEC_CONFIG_SERVER_PROTOCOL` | _iExec Config Server_ communication protocol. | String | `http` |
4848
| `IEXEC_CONFIG_SERVER_HOST` | _iExec Config Server_ host. | String | `localhost` |
4949
| `IEXEC_CONFIG_SERVER_PORT` | _iExec Config Server_ port. | Positive integer | `8888` |
50-
| `IEXEC_CHAIN_HEALTH_POLLING_INTERVAL_IN_BLOCKS` | Polling interval (in blocks) on the blockchain to check this _Scheduler_ can communicate with it. | Positive integer | 3 |
51-
| `IEXEC_CHAIN_HEALTH_OUT_OF_SERVICE_THRESHOLD` | Max number of consecutive failures of blockchain connection attempts before this _Scheduler_ is declared as OUT-OF-SERVICE. | Positive integer | 4 |
5250
| `IEXEC_RESULT_REPOSITORY_PROTOCOL` | _iExec Result Proxy_ server communication protocol. | String | `http` |
5351
| `IEXEC_RESULT_REPOSITORY_HOST` | _iExec Result Proxy_ server host. | String | `localhost` |
5452
| `IEXEC_RESULT_REPOSITORY_PORT` | _iExec Result Proxy_ server port. | Positive integer | `13200` |

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
plugins {
22
id 'java'
3-
id 'io.freefair.lombok' version '8.6'
3+
id 'io.freefair.lombok' version '8.10.2'
44
id 'org.springframework.boot' version '2.7.18'
5-
id 'io.spring.dependency-management' version '1.1.4'
5+
id 'io.spring.dependency-management' version '1.1.6'
66
id 'jacoco'
7-
id 'org.sonarqube' version '5.0.0.4638'
7+
id 'org.sonarqube' version '5.1.0.4882'
88
id 'maven-publish'
99
}
1010

1111
ext {
1212
springCloudVersion = '2021.0.8'
1313
jjwtVersion = '0.11.5'
1414
mongockVersion = '4.2.7.BETA'
15-
testContainersVersion = '1.19.0'
15+
testContainersVersion = '1.20.4'
1616
}
1717

1818
if (!project.hasProperty('gitBranch')) {
@@ -133,7 +133,7 @@ testing {
133133

134134
tasks.withType(Test).configureEach {
135135
finalizedBy jacocoTestReport
136-
systemProperty "mongo.image", "mongo:4.4.28-focal"
136+
systemProperty "mongo.image", "mongo:7.0.15-jammy"
137137
}
138138

139139
tasks.register('itest') {

gradle.properties

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
version=8.5.0
2-
iexecCommonVersion=8.5.0
3-
iexecCommonsPocoVersion=4.1.0
4-
iexecBlockchainAdapterVersion=8.5.0
5-
iexecResultVersion=8.5.0
6-
iexecSmsVersion=8.6.0
1+
version=8.6.0
2+
iexecCommonsPocoVersion=4.2.0
3+
iexecCommonVersion=8.6.0
4+
iexecBlockchainAdapterVersion=8.6.0
5+
iexecResultVersion=8.6.0
6+
iexecSmsVersion=8.7.0
77
nexusUser
88
nexusPassword

gradle/wrapper/gradle-wrapper.jar

130 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
# See the License for the specific language governing permissions and
1616
# limitations under the License.
1717
#
18+
# SPDX-License-Identifier: Apache-2.0
19+
#
1820

1921
##############################################################################
2022
#
@@ -55,7 +57,7 @@
5557
# Darwin, MinGW, and NonStop.
5658
#
5759
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
60+
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5961
# within the Gradle project.
6062
#
6163
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -84,7 +86,8 @@ done
8486
# shellcheck disable=SC2034
8587
APP_BASE_NAME=${0##*/}
8688
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
87-
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
89+
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90+
' "$PWD" ) || exit
8891

8992
# Use the maximum available, or set MAX_FD != -1 to use that value.
9093
MAX_FD=maximum

gradlew.bat

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
@rem See the License for the specific language governing permissions and
1414
@rem limitations under the License.
1515
@rem
16+
@rem SPDX-License-Identifier: Apache-2.0
17+
@rem
1618

1719
@if "%DEBUG%"=="" @echo off
1820
@rem ##########################################################################

src/main/java/com/iexec/core/chain/BlockchainConnectionHealthIndicator.java

Lines changed: 38 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2023-2023 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2023-2024 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,14 +21,14 @@
2121
import lombok.Getter;
2222
import lombok.extern.slf4j.Slf4j;
2323
import org.springframework.beans.factory.annotation.Autowired;
24-
import org.springframework.beans.factory.annotation.Value;
2524
import org.springframework.boot.actuate.health.Health;
2625
import org.springframework.boot.actuate.health.HealthIndicator;
2726
import org.springframework.boot.actuate.health.Status;
27+
import org.springframework.boot.context.event.ApplicationReadyEvent;
2828
import org.springframework.context.ApplicationEventPublisher;
29+
import org.springframework.context.event.EventListener;
2930
import org.springframework.stereotype.Component;
3031

31-
import javax.annotation.PostConstruct;
3232
import java.time.Clock;
3333
import java.time.Duration;
3434
import java.time.LocalDateTime;
@@ -49,18 +49,14 @@ public class BlockchainConnectionHealthIndicator implements HealthIndicator {
4949
/**
5050
* Number of consecutive failures before declaring this Scheduler is out-of-service.
5151
*/
52-
private final int outOfServiceThreshold;
5352
private final ScheduledExecutorService monitoringExecutor;
5453

5554
/**
56-
* Current number of consecutive failures.
55+
* Current number of consecutive failures. Startup value is greater than {@literal 0} to be out-of-service.
5756
*/
58-
@Getter
59-
private int consecutiveFailures = 0;
57+
private int consecutiveFailures = 1;
6058
@Getter
6159
private LocalDateTime firstFailure = null;
62-
@Getter
63-
private boolean outOfService = false;
6460

6561
/**
6662
* Required for test purposes.
@@ -71,15 +67,11 @@ public class BlockchainConnectionHealthIndicator implements HealthIndicator {
7167
public BlockchainConnectionHealthIndicator(
7268
ApplicationEventPublisher applicationEventPublisher,
7369
Web3jService web3jService,
74-
ChainConfig chainConfig,
75-
@Value("${chain.health.pollingIntervalInBlocks}") int pollingIntervalInBlocks,
76-
@Value("${chain.health.outOfServiceThreshold}") int outOfServiceThreshold) {
70+
ChainConfig chainConfig) {
7771
this(
7872
applicationEventPublisher,
7973
web3jService,
8074
chainConfig,
81-
pollingIntervalInBlocks,
82-
outOfServiceThreshold,
8375
Executors.newSingleThreadScheduledExecutor(),
8476
Clock.systemDefaultZone()
8577
);
@@ -89,28 +81,24 @@ public BlockchainConnectionHealthIndicator(
8981
ApplicationEventPublisher applicationEventPublisher,
9082
Web3jService web3jService,
9183
ChainConfig chainConfig,
92-
int pollingIntervalInBlocks,
93-
int outOfServiceThreshold,
9484
ScheduledExecutorService monitoringExecutor,
9585
Clock clock) {
9686
this.applicationEventPublisher = applicationEventPublisher;
9787
this.web3jService = web3jService;
98-
this.pollingInterval = chainConfig.getBlockTime().multipliedBy(pollingIntervalInBlocks);
99-
this.outOfServiceThreshold = outOfServiceThreshold;
88+
this.pollingInterval = chainConfig.getBlockTime();
10089
this.monitoringExecutor = monitoringExecutor;
10190
this.clock = clock;
10291
}
10392

104-
@PostConstruct
93+
@EventListener(ApplicationReadyEvent.class)
10594
void scheduleMonitoring() {
10695
monitoringExecutor.scheduleAtFixedRate(this::checkConnection, 0, pollingInterval.toSeconds(), TimeUnit.SECONDS);
10796
}
10897

10998
/**
11099
* Check blockchain is reachable by retrieving the latest block number.
111100
* <p>
112-
* If it isn't, then increment {@link BlockchainConnectionHealthIndicator#consecutiveFailures} counter.
113-
* If counter reaches {@link BlockchainConnectionHealthIndicator#outOfServiceThreshold},
101+
* If it isn't, then increment {@link BlockchainConnectionHealthIndicator#consecutiveFailures} counter,
114102
* then this Health Indicator becomes {@link Status#OUT_OF_SERVICE}.
115103
* <p>
116104
* If blockchain is reachable, then reset the counter.
@@ -131,32 +119,20 @@ void checkConnection() {
131119
/**
132120
* Increment the {@link BlockchainConnectionHealthIndicator#consecutiveFailures} counter.
133121
* <p>
134-
* If first failure, set the {@link BlockchainConnectionHealthIndicator#firstFailure} to current time.
135-
* <p>
136-
* If {@link BlockchainConnectionHealthIndicator#outOfServiceThreshold} has been reached for the first time:
122+
* If first failure:
137123
* <ul>
138-
* <li> Set {@link BlockchainConnectionHealthIndicator#outOfService} to {@literal true}
139-
* <li> Publish a {@link ChainDisconnectedEvent} event.
124+
* <li> Publish a {@link ChainDisconnectedEvent} event
125+
* <li> Set the {@link BlockchainConnectionHealthIndicator#firstFailure} to current time
140126
* </ul>
141127
*/
142128
private void connectionFailed() {
143-
++consecutiveFailures;
144-
if (consecutiveFailures >= outOfServiceThreshold) {
145-
log.error("Blockchain hasn't been accessed for a long period. " +
146-
"This Scheduler is now OUT-OF-SERVICE until communication is restored." +
147-
" [unavailabilityPeriod:{}]", pollingInterval.multipliedBy(outOfServiceThreshold));
148-
if (!outOfService) {
149-
outOfService = true;
150-
applicationEventPublisher.publishEvent(new ChainDisconnectedEvent(this));
151-
}
152-
} else {
153-
if (consecutiveFailures == 1) {
154-
firstFailure = LocalDateTime.now(clock);
155-
}
156-
log.warn("Blockchain is unavailable. Will retry connection." +
157-
" [unavailabilityPeriod:{}, nextRetry:{}]",
158-
pollingInterval.multipliedBy(consecutiveFailures), pollingInterval);
129+
if (!isOutOfService()) {
130+
log.error("Blockchain communication failed, this Scheduler is now OUT-OF-SERVICE until communication is restored.");
131+
log.debug("Publishing ChainDisconnectedEvent");
132+
applicationEventPublisher.publishEvent(new ChainDisconnectedEvent(this));
133+
firstFailure = LocalDateTime.now(clock);
159134
}
135+
++consecutiveFailures;
160136
}
161137

162138
/**
@@ -166,27 +142,24 @@ private void connectionFailed() {
166142
* <ul>
167143
* <li>Log a "connection restored" message.
168144
* <li>Reset the {@link BlockchainConnectionHealthIndicator#firstFailure} var to {@code null}
169-
* <li>If {@link Status#OUT_OF_SERVICE}, publish a {@link ChainConnectedEvent} event and reset the
170-
* {@link BlockchainConnectionHealthIndicator#outOfService} state
145+
* <li>If {@link Status#OUT_OF_SERVICE}, publish a {@link ChainConnectedEvent} event
171146
* </ul>
172147
*/
173148
private void connectionSucceeded(long latestBlockNumber) {
174-
if (consecutiveFailures > 0) {
149+
if (isOutOfService()) {
175150
log.info("Blockchain connection is now restored after a period of unavailability." +
176-
" [block:{}, unavailabilityPeriod:{}]",
151+
" [block:{}, unavailabilityPeriod:{}]",
177152
latestBlockNumber, pollingInterval.multipliedBy(consecutiveFailures));
178153
firstFailure = null;
179154
consecutiveFailures = 0;
180-
if (outOfService) {
181-
outOfService = false;
182-
applicationEventPublisher.publishEvent(new ChainConnectedEvent(this));
183-
}
155+
log.debug("Publishing ChainConnectedEvent");
156+
applicationEventPublisher.publishEvent(new ChainConnectedEvent(this));
184157
}
185158
}
186159

187160
@Override
188161
public Health health() {
189-
final Health.Builder healthBuilder = outOfService
162+
final Health.Builder healthBuilder = isOutOfService()
190163
? Health.outOfService()
191164
: Health.up();
192165

@@ -197,10 +170,23 @@ public Health health() {
197170
return healthBuilder
198171
.withDetail("consecutiveFailures", consecutiveFailures)
199172
.withDetail("pollingInterval", pollingInterval)
200-
.withDetail("outOfServiceThreshold", outOfServiceThreshold)
201173
.build();
202174
}
203175

176+
/**
177+
* Returns whether the scheduler should be considered out-of-service.
178+
*
179+
* @return {@literal true} in case of at least one consecutive failures, {@literal false} otherwise.
180+
*/
181+
public boolean isOutOfService() {
182+
return consecutiveFailures > 0;
183+
}
184+
185+
/**
186+
* Returns whether the scheduler is up or not.
187+
*
188+
* @return {@literal true} if the scheduler is up, {@literal false} otherwise.
189+
*/
204190
public boolean isUp() {
205191
return health().getStatus() == Status.UP;
206192
}

0 commit comments

Comments
 (0)