Skip to content

Commit dae8024

Browse files
authored
Merge pull request #112 from iExecBlockchainComputing/release/4.2.0
Release/4.2.0
2 parents af3cb8a + fd0e09b commit dae8024

21 files changed

+524
-276
lines changed

CHANGELOG.md

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

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

5+
## [[4.2.0]](https://github.com/iExecBlockchainComputing/iexec-commons-poco/releases/tag/v4.2.0) 2024-12-18
6+
7+
### New Features
8+
9+
- Add `getUserGasPrice` method to `Web3jAbstractService`. (#104)
10+
- Make **TEE tasks** with callback eligible to `contributeAndFinalize` flow. (#109)
11+
- Add accessors to read on-chain deployed PoCo Smart Contracts configurations:
12+
`callbackgas`, `contribution_deadline_ratio` and `final_deadline_ratio`. (#111)
13+
14+
### Bug Fixes
15+
16+
- Prefer methods with ECKEyPair parameter when signing prefixed messages. (#107)
17+
18+
### Quality
19+
20+
- Use `poco-chain` with `poco v5.5.0` and `voucher v1.0.0` in tests. (#106)
21+
- Manage deal parameters in a single field and add assets owner and assets price fields in `TaskDescription`. (#108)
22+
23+
### Dependency Upgrades
24+
25+
- Upgrade to Gradle 8.10.2. (#105)
26+
- Upgrade to `testcontainers` 1.20.4. (#110)
27+
528
## [[4.1.0]](https://github.com/iExecBlockchainComputing/iexec-commons-poco/releases/tag/v4.1.0) 2024-06-17
629

730
### New Features

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
plugins {
22
id 'java-library'
3-
id 'io.freefair.lombok' version '8.6'
3+
id 'io.freefair.lombok' version '8.10.2'
44
id 'jacoco'
5-
id 'org.sonarqube' version '5.0.0.4638'
5+
id 'org.sonarqube' version '5.1.0.4882'
66
id 'maven-publish'
77
}
88

99
group = 'com.iexec.commons'
1010

1111
ext {
12-
testContainersVersion = '1.19.3'
12+
testContainersVersion = '1.20.4'
1313
}
1414

1515
if (!project.hasProperty('gitBranch')) {

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
services:
22
poco-chain:
3-
image: docker-regis.iex.ec/poco-chain:native-v5.4.2-5s
3+
image: docker-regis.iex.ec/poco-chain:1.0.0-poco-v5.5.0-voucher-v1.0.0-nethermind
44
expose:
55
- "8545"

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=4.1.0
1+
version=4.2.0
22
nexusUser
33
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/commons/poco/chain/IexecHubAbstractService.java

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,16 @@
2626
import org.awaitility.core.ConditionTimeoutException;
2727
import org.web3j.crypto.Credentials;
2828
import org.web3j.ens.EnsResolutionException;
29+
import org.web3j.protocol.core.DefaultBlockParameterName;
2930
import org.web3j.protocol.core.RemoteCall;
3031
import org.web3j.protocol.core.methods.response.TransactionReceipt;
3132
import org.web3j.tuples.generated.Tuple3;
3233
import org.web3j.tx.RawTransactionManager;
3334
import org.web3j.tx.gas.ContractGasProvider;
3435
import org.web3j.tx.gas.DefaultGasProvider;
36+
import org.web3j.utils.Numeric;
3537

38+
import java.io.IOException;
3639
import java.math.BigInteger;
3740
import java.nio.charset.StandardCharsets;
3841
import java.util.HashMap;
@@ -41,6 +44,7 @@
4144
import java.util.concurrent.Callable;
4245
import java.util.concurrent.TimeUnit;
4346

47+
import static com.iexec.commons.poco.encoding.AccessorsEncoder.*;
4448
import static com.iexec.commons.poco.encoding.AssetDataEncoder.getAssetAddressFromReceipt;
4549
import static com.iexec.commons.poco.tee.TeeEnclaveConfiguration.buildEnclaveConfigurationFromJsonString;
4650
import static com.iexec.commons.poco.utils.BytesUtils.isNonZeroedBytes32;
@@ -889,7 +893,7 @@ public long getMaxNbOfPeriodsForConsensus() {
889893

890894
private void setMaxNbOfPeriodsForConsensus() {
891895
try {
892-
maxNbOfPeriodsForConsensus = iexecHubContract.contribution_deadline_ratio().send().longValue();
896+
maxNbOfPeriodsForConsensus = getContributionDeadlineRatio().longValue();
893897
} catch (Exception e) {
894898
log.error("Failed to get maxNbOfPeriodsForConsensus from the chain", e);
895899
maxNbOfPeriodsForConsensus = -1;
@@ -951,6 +955,45 @@ public boolean isTeeTask(String chainTaskId) {
951955
return taskDescription.isTeeTask();
952956
}
953957

958+
// region accessors
959+
960+
/**
961+
* Send call to callbackgas() PoCo method.
962+
*
963+
* @return callbackgas value
964+
* @throws IOException if communication fails
965+
*/
966+
public BigInteger getCallbackGas() throws IOException {
967+
return sendCallWithFunctionSelector(CALLBACKGAS_SELECTOR);
968+
}
969+
970+
/**
971+
* Send call to contribution_deadline_ratio() PoCo method.
972+
*
973+
* @return contribution_deadline_ratio value
974+
* @throws IOException if communication fails
975+
*/
976+
public BigInteger getContributionDeadlineRatio() throws IOException {
977+
return sendCallWithFunctionSelector(CONTRIBUTION_DEADLINE_RATIO_SELECTOR);
978+
}
979+
980+
/**
981+
* Send call to final_deadline_ratio() PoCo method.
982+
*
983+
* @return final_deadline_ratio value
984+
* @throws IOException if communication fails
985+
*/
986+
public BigInteger getFinalDeadlineRatio() throws IOException {
987+
return sendCallWithFunctionSelector(FINAL_DEADLINE_RATIO_SELECTOR);
988+
}
989+
990+
private BigInteger sendCallWithFunctionSelector(final String functionSelector) throws IOException {
991+
return Numeric.toBigInt(
992+
txManager.sendCall(iexecHubAddress, functionSelector, DefaultBlockParameterName.LATEST));
993+
}
994+
995+
// endregion
996+
954997
// region Purge
955998

956999
/**

src/main/java/com/iexec/commons/poco/chain/SignerService.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import org.web3j.protocol.core.methods.response.Transaction;
3535
import org.web3j.protocol.exceptions.JsonRpcError;
3636
import org.web3j.tx.RawTransactionManager;
37-
import org.web3j.utils.Numeric;
3837

3938
import java.io.IOException;
4039
import java.math.BigInteger;
@@ -108,8 +107,7 @@ public BigInteger getNonce() {
108107
* Signs messages with Ethereum prefix
109108
*/
110109
public Signature signMessageHash(String messageHash) {
111-
String hexPrivateKey = Numeric.toHexStringWithPrefix(credentials.getEcKeyPair().getPrivateKey());
112-
return SignatureUtils.signMessageHashAndGetSignature(messageHash, hexPrivateKey);
110+
return SignatureUtils.signMessageHashAndGetSignature(messageHash, credentials.getEcKeyPair());
113111
}
114112

115113
public String signEIP712Entity(EIP712Entity<?> eip712Entity) {

0 commit comments

Comments
 (0)