diff --git a/CHANGELOG.md b/CHANGELOG.md
index 33cc04e7..7f221c81 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -36,6 +36,8 @@ All notable changes to this project will be documented in this file.
- Upgrade to Spring Dependency Management Plugin 1.1.4. (#634)
- Upgrade to Spring Doc Openapi 1.7.0. (#637)
- Upgrade to `jenkins-library` 2.7.4. (#630)
+- Upgrade to `iexec-commons-poco` 3.2.0. (#648)
+- Upgrade to `iexec-common` 8.3.1. (#648)
## [[8.2.3]](https://github.com/iExecBlockchainComputing/iexec-core/releases/tag/v8.2.3) 2023-12-14
diff --git a/gradle.properties b/gradle.properties
index 85506e05..10ed77cc 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,6 +1,6 @@
version=8.2.3
-iexecCommonVersion=8.3.0
-iexecCommonsPocoVersion=3.1.0
+iexecCommonVersion=8.3.1
+iexecCommonsPocoVersion=3.2.0
iexecBlockchainAdapterVersion=8.2.0-NEXT-SNAPSHOT
iexecResultVersion=8.2.0
iexecSmsVersion=8.3.0
diff --git a/src/main/java/com/iexec/core/chain/IexecHubService.java b/src/main/java/com/iexec/core/chain/IexecHubService.java
index 7557c725..a9597a3e 100644
--- a/src/main/java/com/iexec/core/chain/IexecHubService.java
+++ b/src/main/java/com/iexec/core/chain/IexecHubService.java
@@ -125,6 +125,7 @@ public boolean isBeforeContributionDeadline(ChainDeal chainDeal) {
*
maxCategoryTime: duration of the deal's category.
* nbOfCategoryUnits: number of category units dedicated
* for the contribution phase.
+ *
*
* @param chainDeal
* @return
@@ -147,6 +148,7 @@ public Date getChainDealContributionDeadline(ChainDeal chainDeal) {
* maxCategoryTime: duration of the deal's category.
* 10: number of category units dedicated
* for the hole execution.
+ *
*
* @param chainDeal
* @return
@@ -267,14 +269,14 @@ public boolean repeatIsRevealedTrue(String chainTaskId, String walletAddress) {
"isRevealedTrue", this::isRevealed, chainTaskId, walletAddress);
}
- boolean isContributed(String... args) {
+ public boolean isContributed(String... args) {
return getChainContribution(args[0], args[1])
.map(ChainContribution::getStatus)
.filter(chainStatus -> chainStatus == CONTRIBUTED || chainStatus == REVEALED)
.isPresent();
}
- boolean isRevealed(String... args) {
+ public boolean isRevealed(String... args) {
return getChainContribution(args[0], args[1])
.map(ChainContribution::getStatus)
.filter(chainStatus -> chainStatus == REVEALED)
diff --git a/src/main/java/com/iexec/core/detector/replicate/UnnotifiedAbstractDetector.java b/src/main/java/com/iexec/core/detector/replicate/UnnotifiedAbstractDetector.java
index 202759f5..14c538a8 100644
--- a/src/main/java/com/iexec/core/detector/replicate/UnnotifiedAbstractDetector.java
+++ b/src/main/java/com/iexec/core/detector/replicate/UnnotifiedAbstractDetector.java
@@ -71,9 +71,9 @@ protected UnnotifiedAbstractDetector(TaskService taskService,
/**
* Detects the following issues:
*
- * - `onchainDone` status only if replicates are in `offchainOngoing` status;
- * - `onchainDone` if replicates are not in `offchainDone` status.
- *
+ * `onchainDone` status only if replicates are in `offchainOngoing` status
+ * `onchainDone` if replicates are not in `offchainDone` status
+ *
* The second detection is not always ran, depending on the detector run occurrences.
*/
void detectOnChainChanges() {
@@ -101,11 +101,8 @@ void detectOnchainDoneWhenOffchainOngoing() {
continue;
}
- final boolean statusTrueOnChain = iexecHubService.isStatusTrueOnChain(
- task.getChainTaskId(),
- replicate.getWalletAddress(),
- onchainDone
- );
+ final boolean statusTrueOnChain = detectStatusReachedOnChain(
+ task.getChainTaskId(), replicate.getWalletAddress());
if (statusTrueOnChain) {
log.info("Detected confirmed missing update (replicate) [is:{}, should:{}, taskId:{}]",
@@ -121,7 +118,7 @@ void detectOnchainDoneWhenOffchainOngoing() {
* (worker didn't notify any status)
* We want to detect them:
* - Frequently but no so often since it's eth node resource consuming and less probable
- * - When we receive a "can't do " relative to the `onchainDone` status (e.g.: `CANNOT_REVEAL`)
+ * - When we receive a "can't do <action>" relative to the `onchainDone` status (e.g.: `CANNOT_REVEAL`)
*/
public void detectOnchainDone() {
log.debug("Detect onchain {} [retryIn:{}]", onchainDone, this.detectorRate * LESS_OFTEN_DETECTOR_FREQUENCY);
@@ -133,11 +130,8 @@ public void detectOnchainDone() {
continue;
}
- final boolean statusTrueOnChain = iexecHubService.isStatusTrueOnChain(
- task.getChainTaskId(),
- replicate.getWalletAddress(),
- onchainDone
- );
+ final boolean statusTrueOnChain = detectStatusReachedOnChain(
+ task.getChainTaskId(), replicate.getWalletAddress());
if (statusTrueOnChain) {
log.info("Detected confirmed missing update (replicate) [is:{}, should:{}, taskId:{}]",
@@ -148,6 +142,24 @@ public void detectOnchainDone() {
}
}
+ /**
+ * Checks if {@code onchainDone} status has been reached on blockchain network.
+ *
+ * @param chainTaskId ID of on-chain task
+ * @param walletAddress Address of a worker working on the current task.
+ * @return
+ */
+ private boolean detectStatusReachedOnChain(String chainTaskId, String walletAddress) {
+ switch (onchainDone) {
+ case CONTRIBUTED:
+ return iexecHubService.isContributed(chainTaskId, walletAddress);
+ case REVEALED:
+ return iexecHubService.isRevealed(chainTaskId, walletAddress);
+ default:
+ return false;
+ }
+ }
+
/*
* This method should stay private. We need to ensure that
* it is only called by the POOL_MANAGER.
diff --git a/src/main/java/com/iexec/core/replicate/ReplicatesService.java b/src/main/java/com/iexec/core/replicate/ReplicatesService.java
index 57f7a5c9..09ef8495 100644
--- a/src/main/java/com/iexec/core/replicate/ReplicatesService.java
+++ b/src/main/java/com/iexec/core/replicate/ReplicatesService.java
@@ -618,13 +618,11 @@ public boolean isResultUploaded(TaskDescription task) {
}
public boolean didReplicateContributeOnchain(String chainTaskId, String walletAddress) {
- return iexecHubService.isStatusTrueOnChain(
- chainTaskId, walletAddress, getChainStatus(ReplicateStatus.CONTRIBUTED));
+ return iexecHubService.isContributed(chainTaskId, walletAddress);
}
public boolean didReplicateRevealOnchain(String chainTaskId, String walletAddress) {
- return iexecHubService.isStatusTrueOnChain(
- chainTaskId, walletAddress, getChainStatus(ReplicateStatus.REVEALED));
+ return iexecHubService.isRevealed(chainTaskId, walletAddress);
}
public void setRevealTimeoutStatusIfNeeded(String chainTaskId, Replicate replicate) {
diff --git a/src/test/java/com/iexec/core/detector/replicate/ContributionAndFinalizationUnnotifiedDetectorTests.java b/src/test/java/com/iexec/core/detector/replicate/ContributionAndFinalizationUnnotifiedDetectorTests.java
index f429d42b..3da2f41e 100644
--- a/src/test/java/com/iexec/core/detector/replicate/ContributionAndFinalizationUnnotifiedDetectorTests.java
+++ b/src/test/java/com/iexec/core/detector/replicate/ContributionAndFinalizationUnnotifiedDetectorTests.java
@@ -3,7 +3,6 @@
import com.iexec.common.replicate.ReplicateStatus;
import com.iexec.common.replicate.ReplicateStatusDetails;
import com.iexec.common.replicate.ReplicateStatusUpdate;
-import com.iexec.commons.poco.chain.ChainContributionStatus;
import com.iexec.commons.poco.chain.ChainReceipt;
import com.iexec.core.chain.IexecHubService;
import com.iexec.core.chain.Web3jService;
@@ -55,6 +54,7 @@ void init() {
}
// region Detector aggregator
+
/**
* When running {@link ContributionAndFinalizationUnnotifiedDetector#detectOnChainChanges} 10 times,
* {@link ReplicatesService#updateReplicateStatus(String, String, ReplicateStatus, ReplicateStatusDetails)} should be called 11 times:
@@ -73,7 +73,7 @@ void shouldDetectBothChangesOnChain() {
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(CHAIN_TASK_ID)).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(CHAIN_TASK_ID, WALLET_ADDRESS, ChainContributionStatus.REVEALED)).thenReturn(true);
+ when(iexecHubService.isRevealed(CHAIN_TASK_ID, WALLET_ADDRESS)).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getFinalizeBlock(CHAIN_TASK_ID, 0))
.thenReturn(ChainReceipt.builder()
@@ -94,9 +94,11 @@ void shouldDetectBothChangesOnChain() {
any(ReplicateStatusDetails.class)
);
}
+
// endregion
//region detectOnchainDoneWhenOffchainOngoing (ContributeAndFinalizeOngoing)
+
@Test
void shouldDetectUnNotifiedContributeAndFinalizeDoneAfterContributeAndFinalizeOngoing() {
Task task = Task.builder().chainTaskId(CHAIN_TASK_ID).build();
@@ -107,7 +109,7 @@ void shouldDetectUnNotifiedContributeAndFinalizeDoneAfterContributeAndFinalizeOn
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(CHAIN_TASK_ID)).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(CHAIN_TASK_ID, WALLET_ADDRESS, ChainContributionStatus.REVEALED)).thenReturn(true);
+ when(iexecHubService.isRevealed(CHAIN_TASK_ID, WALLET_ADDRESS)).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getFinalizeBlock(CHAIN_TASK_ID, 0))
.thenReturn(ChainReceipt.builder()
@@ -137,7 +139,7 @@ void shouldDetectUnNotifiedContributeAndFinalizeDoneSinceBeforeContributeAndFina
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(CHAIN_TASK_ID)).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(CHAIN_TASK_ID, WALLET_ADDRESS, ChainContributionStatus.REVEALED)).thenReturn(true);
+ when(iexecHubService.isRevealed(CHAIN_TASK_ID, WALLET_ADDRESS)).thenReturn(true);
detector.detectOnchainDoneWhenOffchainOngoing();
@@ -155,15 +157,17 @@ void shouldNotDetectUnNotifiedContributeAndFinalizeDoneSinceNotFinalizedOnChain(
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(CHAIN_TASK_ID)).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(CHAIN_TASK_ID, WALLET_ADDRESS, ChainContributionStatus.REVEALED)).thenReturn(false);
+ when(iexecHubService.isRevealed(CHAIN_TASK_ID, WALLET_ADDRESS)).thenReturn(false);
detector.detectOnchainDoneWhenOffchainOngoing();
Mockito.verify(replicatesService, Mockito.times(0))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
//region detectOnchainDone (REVEALED)
+
@Test
void shouldDetectUnNotifiedContributeAndFinalizeOngoing() {
Task task = Task.builder().chainTaskId(CHAIN_TASK_ID).build();
@@ -174,7 +178,7 @@ void shouldDetectUnNotifiedContributeAndFinalizeOngoing() {
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(CHAIN_TASK_ID)).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(CHAIN_TASK_ID, WALLET_ADDRESS, ChainContributionStatus.REVEALED)).thenReturn(true);
+ when(iexecHubService.isRevealed(CHAIN_TASK_ID, WALLET_ADDRESS)).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getFinalizeBlock(CHAIN_TASK_ID, 0)).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -202,12 +206,13 @@ void shouldNotDetectUnNotifiedContributedSinceContributeAndFinalizeDone() {
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(CHAIN_TASK_ID)).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(CHAIN_TASK_ID, WALLET_ADDRESS, ChainContributionStatus.REVEALED)).thenReturn(true);
+ when(iexecHubService.isRevealed(CHAIN_TASK_ID, WALLET_ADDRESS)).thenReturn(true);
detector.detectOnchainDone();
Mockito.verify(replicatesService, Mockito.times(0))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
}
diff --git a/src/test/java/com/iexec/core/detector/replicate/ContributionUnnotifiedDetectorTests.java b/src/test/java/com/iexec/core/detector/replicate/ContributionUnnotifiedDetectorTests.java
index 26d99fcd..fc8ec478 100644
--- a/src/test/java/com/iexec/core/detector/replicate/ContributionUnnotifiedDetectorTests.java
+++ b/src/test/java/com/iexec/core/detector/replicate/ContributionUnnotifiedDetectorTests.java
@@ -71,6 +71,7 @@ void init() {
}
// region Detector aggregator
+
/**
* When running {@link ContributionUnnotifiedDetector#detectOnChainChanges} 10 times,
* {@link ReplicatesService#updateReplicateStatus(String, String, ReplicateStatus, ReplicateStatusDetails)} should be called 11 times:
@@ -89,7 +90,7 @@ void shouldDetectBothChangesOnChain() {
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isContributed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getContributionBlock(anyString(), anyString(), anyLong())).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -103,9 +104,11 @@ void shouldDetectBothChangesOnChain() {
Mockito.verify(replicatesService, Mockito.times(11))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
//region detectOnchainDoneWhenOffchainOngoing (CONTRIBUTING)
+
@Test
void shouldDetectUnNotifiedContributedAfterContributing() {
Task task = Task.builder().chainTaskId(CHAIN_TASK_ID).build();
@@ -117,7 +120,7 @@ void shouldDetectUnNotifiedContributedAfterContributing() {
when(cronConfiguration.getContribute()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isContributed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getContributionBlock(anyString(), anyString(), anyLong()))
.thenReturn(ChainReceipt.builder().blockNumber(10L).txHash("0xabcef").build());
@@ -139,7 +142,7 @@ void shouldDetectUnNotifiedContributedAfterContributingSinceBeforeContributing()
when(cronConfiguration.getContribute()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isContributed(any(), any())).thenReturn(true);
contributionDetector.detectOnchainDoneWhenOffchainOngoing();
@@ -158,15 +161,17 @@ void shouldNotDetectUnNotifiedContributedAfterContributingSinceNotContributedOnC
// when(cronConfiguration.getContribute()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(false);
+ when(iexecHubService.isContributed(any(), any())).thenReturn(false);
contributionDetector.detectOnchainDoneWhenOffchainOngoing();
Mockito.verify(replicatesService, Mockito.times(0))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
// region detectOnchainDone (CONTRIBUTED)
+
@Test
void shouldDetectUnNotifiedContributed1() {
Task task = Task.builder().chainTaskId(CHAIN_TASK_ID).build();
@@ -178,7 +183,7 @@ void shouldDetectUnNotifiedContributed1() {
when(cronConfiguration.getContribute()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isContributed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getContributionBlock(anyString(), anyString(), anyLong())).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -202,7 +207,7 @@ void shouldDetectUnNotifiedContributed2() {
when(cronConfiguration.getContribute()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isContributed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getContributionBlock(anyString(), anyString(), anyLong())).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -226,11 +231,12 @@ void shouldNotDetectUnNotifiedContributedSinceContributed() {
when(cronConfiguration.getContribute()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isContributed(any(), any())).thenReturn(true);
contributionDetector.detectOnchainDone();
Mockito.verify(replicatesService, Mockito.times(0))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
}
diff --git a/src/test/java/com/iexec/core/detector/replicate/RevealUnnotifiedDetectorTests.java b/src/test/java/com/iexec/core/detector/replicate/RevealUnnotifiedDetectorTests.java
index cfe6a05b..5809dc75 100644
--- a/src/test/java/com/iexec/core/detector/replicate/RevealUnnotifiedDetectorTests.java
+++ b/src/test/java/com/iexec/core/detector/replicate/RevealUnnotifiedDetectorTests.java
@@ -70,6 +70,7 @@ void init() {
}
// region Detector aggregator
+
/**
* When running {@link RevealUnnotifiedDetector#detectOnChainChanges} 10 times,
* {@link ReplicatesService#updateReplicateStatus(String, String, ReplicateStatus, ReplicateStatusDetails)} should be called 11 times:
@@ -88,7 +89,7 @@ void shouldDetectBothChangesOnChain() {
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isRevealed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getRevealBlock(anyString(), anyString(), anyLong())).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -102,9 +103,11 @@ void shouldDetectBothChangesOnChain() {
Mockito.verify(replicatesService, Mockito.times(11))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
//region detectOnchainDoneWhenOffchainOngoing (REVEALING)
+
@Test
void shouldDetectUnNotifiedRevealedAfterRevealing() {
Task task = Task.builder().chainTaskId(CHAIN_TASK_ID).build();
@@ -116,7 +119,7 @@ void shouldDetectUnNotifiedRevealedAfterRevealing() {
when(cronConfiguration.getReveal()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isRevealed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getRevealBlock(anyString(), anyString(), anyLong())).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -140,7 +143,7 @@ void shouldDetectUnNotifiedRevealedAfterRevealingSinceBeforeRevealing() {
when(cronConfiguration.getReveal()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isRevealed(any(), any())).thenReturn(true);
revealDetector.detectOnchainDoneWhenOffchainOngoing();
Mockito.verify(replicatesService, Mockito.times(0))
@@ -157,15 +160,17 @@ void shouldNotDetectUnNotifiedRevealedAfterRevealingSinceNotRevealedOnChain() {
replicate.setStatusUpdateList(Collections.singletonList(statusUpdate));
when(cronConfiguration.getReveal()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(false);
+ when(iexecHubService.isRevealed(any(), any())).thenReturn(false);
revealDetector.detectOnchainDoneWhenOffchainOngoing();
Mockito.verify(replicatesService, Mockito.times(0))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
// region detectOnchainDone (REVEALED)
+
@Test
void shouldDetectUnNotifiedRevealed1() {
Task task = Task.builder().chainTaskId(CHAIN_TASK_ID).build();
@@ -177,7 +182,7 @@ void shouldDetectUnNotifiedRevealed1() {
when(cronConfiguration.getReveal()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isRevealed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getRevealBlock(anyString(), anyString(), anyLong())).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -206,7 +211,7 @@ void shouldDetectUnNotifiedRevealed2() {
when(cronConfiguration.getReveal()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isRevealed(any(), any())).thenReturn(true);
when(web3jService.getLatestBlockNumber()).thenReturn(11L);
when(iexecHubService.getRevealBlock(anyString(), anyString(), anyLong())).thenReturn(ChainReceipt.builder()
.blockNumber(10L)
@@ -230,11 +235,12 @@ void shouldNotDetectUnNotifiedRevealedSinceRevealed() {
when(cronConfiguration.getReveal()).thenReturn(DETECTOR_PERIOD);
when(replicatesService.getReplicates(any())).thenReturn(Collections.singletonList(replicate));
- when(iexecHubService.isStatusTrueOnChain(any(), any(), any())).thenReturn(true);
+ when(iexecHubService.isRevealed(any(), any())).thenReturn(true);
revealDetector.detectOnchainDone();
Mockito.verify(replicatesService, Mockito.times(0))
.updateReplicateStatus(any(), any(), any(), any(ReplicateStatusDetails.class));
}
+
// endregion
}
diff --git a/src/test/java/com/iexec/core/replicate/ReplicateServiceTests.java b/src/test/java/com/iexec/core/replicate/ReplicateServiceTests.java
index 8a011e4f..868ed137 100644
--- a/src/test/java/com/iexec/core/replicate/ReplicateServiceTests.java
+++ b/src/test/java/com/iexec/core/replicate/ReplicateServiceTests.java
@@ -18,7 +18,6 @@
import com.iexec.common.replicate.*;
import com.iexec.commons.poco.chain.ChainContribution;
-import com.iexec.commons.poco.chain.ChainContributionStatus;
import com.iexec.commons.poco.notification.TaskNotificationType;
import com.iexec.commons.poco.task.TaskDescription;
import com.iexec.commons.poco.utils.BytesUtils;
@@ -866,13 +865,7 @@ void shouldReturnTrueForTeeTask() {
@Test
void shouldReturnFindReplicateContributedOnchain() {
- when(
- iexecHubService.isStatusTrueOnChain(
- CHAIN_TASK_ID,
- WALLET_WORKER_1,
- ChainContributionStatus.CONTRIBUTED
- )
- ).thenReturn(true);
+ when(iexecHubService.isContributed(CHAIN_TASK_ID, WALLET_WORKER_1)).thenReturn(true);
assertThat(
replicatesService.didReplicateContributeOnchain(
CHAIN_TASK_ID,
@@ -884,14 +877,8 @@ void shouldReturnFindReplicateContributedOnchain() {
// didReplicateRevealOnchain
@Test
- void shouldFindReplicatedReveledOnchain() {
- when(
- iexecHubService.isStatusTrueOnChain(
- CHAIN_TASK_ID,
- WALLET_WORKER_1,
- ChainContributionStatus.REVEALED
- )
- ).thenReturn(true);
+ void shouldFindReplicatedRevealedOnchain() {
+ when(iexecHubService.isRevealed(CHAIN_TASK_ID, WALLET_WORKER_1)).thenReturn(true);
assertThat(
replicatesService.didReplicateRevealOnchain(
CHAIN_TASK_ID,