diff --git a/CHANGELOG.md b/CHANGELOG.md index f382c092..e5210e61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. - Add ContributeAndFinalize to `ReplicateWorkflow`. (#574) - Add check for ContributeAndFinalize in `ReplicatesService`. (#576) - Add `running2Finalized2Completed` in `TaskUpdateManager`. (#577 #578) +- Disable `contributeAndFinalize` with CallBack. (#579) ### Bug Fixes - Prevent race condition on replicate update. (#568) ### Quality diff --git a/src/main/java/com/iexec/core/workflow/ReplicateWorkflow.java b/src/main/java/com/iexec/core/workflow/ReplicateWorkflow.java index 60f955ef..ca0ac07f 100644 --- a/src/main/java/com/iexec/core/workflow/ReplicateWorkflow.java +++ b/src/main/java/com/iexec/core/workflow/ReplicateWorkflow.java @@ -21,6 +21,7 @@ import com.iexec.commons.poco.notification.TaskNotificationType; import com.iexec.commons.poco.task.TaskDescription; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import java.util.Arrays; import java.util.LinkedHashMap; @@ -195,7 +196,8 @@ TaskNotificationType getNextActionWhenStatusAndCause(ReplicateStatus whenStatus, log.error("TaskDescription is null with a COMPUTED status, this case shouldn't happen"); return PLEASE_ABORT; } - if (taskDescription.isTeeTask()) { + // We must check CallBack is empty because there is an issue in poco (transaction is revert) + if (taskDescription.isTeeTask() && StringUtils.isEmpty(taskDescription.getCallback())) { return PLEASE_CONTRIBUTE_AND_FINALIZE; } } diff --git a/src/test/java/com/iexec/core/workflow/ReplicateWorkflowTests.java b/src/test/java/com/iexec/core/workflow/ReplicateWorkflowTests.java index 89f98263..d311063c 100644 --- a/src/test/java/com/iexec/core/workflow/ReplicateWorkflowTests.java +++ b/src/test/java/com/iexec/core/workflow/ReplicateWorkflowTests.java @@ -187,6 +187,15 @@ void shouldGetNextActionOnComputedWithoutTaskDescriptionShouldBePleaseAbort(){ .isEqualTo(PLEASE_ABORT); } + @Test + void shouldGetNextActionOnComputedWithTeeTaskAndCallBackShouldBePlease(){ + assertThat(replicateWorkflow + .getNextAction(COMPUTED, + null, + TaskDescription.builder().isTeeTask(true).callback("callback").build())) + .isEqualTo(PLEASE_CONTRIBUTE); + } + // endregion /*