Skip to content

Commit 26d1058

Browse files
authored
fix: upgrade to commons-poco 5.3.1 for latest eth_call fix (#184)
1 parent cd3b8ab commit 26d1058

File tree

3 files changed

+10
-12
lines changed

3 files changed

+10
-12
lines changed

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22

33
ibaa-chain:
4-
image: docker-regis.iex.ec/poco-chain:1.0.0-poco-v5.5.0-voucher-v1.0.0-nethermind
4+
image: docker-regis.iex.ec/poco-chain:1.1.0-poco-v6.1.0-contracts-voucher-v1.0.0-nethermind
55
expose:
66
- "8545"
77

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# x-release-please-start-version
22
version=9.0.2
33
# x-release-please-end
4-
iexecCommonsPocoVersion=5.1.0
5-
iexecCommonVersion=9.1.0
4+
iexecCommonsPocoVersion=5.3.1
5+
iexecCommonVersion=9.2.0
66

77
nexusUser
88
nexusPassword

src/test/java/com/iexec/blockchain/chain/IexecHubServiceTests.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@
2929
import org.web3j.crypto.Keys;
3030
import org.web3j.protocol.core.methods.response.TransactionReceipt;
3131
import org.web3j.protocol.exceptions.TransactionException;
32-
import org.web3j.tx.RawTransactionManager;
3332
import org.web3j.tx.response.PollingTransactionReceiptProcessor;
3433

3534
import java.io.IOException;
3635
import java.math.BigInteger;
3736
import java.time.Duration;
3837
import java.time.Instant;
38+
import java.util.Map;
3939
import java.util.Optional;
4040

4141
import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -59,8 +59,6 @@ class IexecHubServiceTests {
5959
@Mock
6060
private PollingTransactionReceiptProcessor txReceiptProcessor;
6161
@Mock
62-
private RawTransactionManager txManager;
63-
@Mock
6462
private Web3jService web3jService;
6563
@Mock
6664
private TransactionReceipt receipt;
@@ -72,7 +70,6 @@ void init() {
7270
when(signerService.getCredentials()).thenReturn(credentials);
7371
iexecHubService = spy(new IexecHubService(signerService, web3jService, chainConfig));
7472
ReflectionTestUtils.setField(iexecHubService, "txReceiptProcessor", txReceiptProcessor);
75-
ReflectionTestUtils.setField(iexecHubService, "txManager", txManager);
7673
}
7774

7875
@SneakyThrows
@@ -130,15 +127,15 @@ void shouldNotReveal() throws IOException {
130127
@Test
131128
void shouldFinalizeTask() throws IOException, TransactionException {
132129
mockTransaction();
133-
when(txManager.sendCall(any(), any(), any())).thenReturn("0x30D40"); // hexadecimal value for 200_000
130+
when(web3jService.sendCall(any(), any(), any())).thenReturn("0x30D40"); // hexadecimal value for 200_000
134131
assertThat(iexecHubService.finalizeTask(chainTaskId, "resultLink", "callbackData"))
135132
.isEqualTo(receipt);
136133
}
137134

138135
@Test
139136
void shouldNotFinalizeTask() throws IOException {
140137
when(signerService.estimateGas(any(), any())).thenReturn(BigInteger.valueOf(100_000L));
141-
when(txManager.sendCall(any(), any(), any())).thenReturn("0x30D40"); // hexadecimal value for 200_000
138+
when(web3jService.sendCall(any(), any(), any())).thenReturn("0x30D40"); // hexadecimal value for 200_000
142139
when(signerService.signAndSendTransaction(any(), any(), any(), any(), any()))
143140
.thenThrow(IOException.class);
144141
assertThatThrownBy(() -> iexecHubService.finalizeTask(chainTaskId, "resultLink", "callbackData"))
@@ -176,9 +173,10 @@ void shouldNotBeBeforeContributionDeadline() {
176173
@Test
177174
void shouldBeBeforeContributionDeadline() {
178175
final BigInteger startTime = BigInteger.valueOf(Instant.now().getEpochSecond());
179-
final ChainCategory category = ChainCategory.builder().id(0).maxExecutionTime(1000L).build();
180-
doReturn(Optional.of(ChainDeal.builder().chainCategory(category).startTime(startTime).build()))
181-
.when(iexecHubService).getChainDeal("dealId");
176+
final ChainCategory category = ChainCategory.builder().maxExecutionTime(1000L).build();
177+
ReflectionTestUtils.setField(iexecHubService, "categories", Map.of(0L, category));
178+
when(iexecHubService.getChainDeal("dealId"))
179+
.thenReturn(Optional.of(ChainDeal.builder().chainCategory(category).startTime(startTime).build()));
182180
assertThat(iexecHubService.isBeforeContributionDeadline("dealId"))
183181
.isTrue();
184182
}

0 commit comments

Comments
 (0)