Skip to content

Commit

Permalink
Merge pull request #21 from iExecBlockchainComputing/release/2.0.1
Browse files Browse the repository at this point in the history
Release/2.0.1
  • Loading branch information
jbern0rd authored May 22, 2023
2 parents 72df64c + 23f624f commit e851552
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 17 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

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

## [[2.0.1]](https://github.com/iExecBlockchainComputing/iexec-commons-poco/releases/tag/v2.0.1) 2023-05-22

### New Features
- Add purge cached task descriptions ability. (#20)
### Bug Fixes
- Pull `poco-chain` image before tests. (#18)
- Keep a security factor of 10 for callback gas consumption during `finalize` and `contributeAndFinalize`. (#22)

## [[2.0.0]](https://github.com/iExecBlockchainComputing/iexec-commons-poco/releases/tag/v2.0.0) 2023-05-11

### New Features
Expand Down
7 changes: 6 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,18 @@ tasks.withType(Test).configureEach {
}

test {
doFirst {
exec {
commandLine 'docker', 'compose', 'pull', '-q'
}
}
reports {
junitXml.required = true
html.required = true
}
}

task itest {
tasks.register('itest', Test) {
group 'Verification'
description 'Runs the integration tests.'
}
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version=2.0.0
version=2.0.1

nexusUser
nexusPassword
Original file line number Diff line number Diff line change
Expand Up @@ -1336,4 +1336,30 @@ public boolean isStatusTrueOnChain(String chainTaskId, String walletAddress,
return false;
}
}

// region Purge
/**
* Purge description of given task.
*
* @param chainTaskId ID of the task to purge.
* @return {@literal true} if task description was cached
* and has been purged;
* {@literal false} otherwise.
*/
protected boolean purgeTask(String chainTaskId) {
if (!taskDescriptions.containsKey(chainTaskId)) {
log.info("Can't purge task description [chainTaskId:{}]", chainTaskId);
return false;
}

return taskDescriptions.remove(chainTaskId) != null;
}

/**
* Purge all cached task descriptions.
*/
protected void purgeAllTasksData() {
taskDescriptions.clear();
}
// endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
@Slf4j
public abstract class Web3jAbstractService {

static final long GAS_LIMIT_CAP = 1000000;
static final long GAS_LIMIT_CAP = 1_000_000;
private final float gasPriceMultiplier;
private final long gasPriceCap;
private final boolean isSidechain;
Expand Down Expand Up @@ -320,28 +320,30 @@ static BigInteger getGasLimitForFunction(String functionName) {
long gasLimit;
switch (functionName) {
case FUNC_INITIALIZE:
gasLimit = 300000;//seen 176340
gasLimit = 300_000;//seen 176340
break;
case FUNC_CONTRIBUTE:
gasLimit = 500000;//seen 333541
gasLimit = 500_000;//seen 333541
break;
case FUNC_REVEAL:
gasLimit = 100000;//seen 56333
gasLimit = 100_000;//seen 56333
break;
case FUNC_CONTRIBUTEANDFINALIZE:
case FUNC_FINALIZE:
gasLimit = 300000;//seen 175369 (242641 in reopen case)
// Multiply with a factor of 10 for callback gas consumption
gasLimit = 3_000_000;//seen 175369 (242641 in reopen case)
break;
case FUNC_REOPEN:
gasLimit = 500000;//seen 43721
gasLimit = 500_000;//seen 43721
break;
case FUNC_CREATEAPP:
gasLimit = 900000;//800000 might not be enough
gasLimit = 900_000;//800000 might not be enough
break;
case FUNC_CREATEWORKERPOOL:
gasLimit = 700000;
gasLimit = 700_000;
break;
case FUNC_CREATEDATASET:
gasLimit = 700000;//seen 608878
gasLimit = 700_000;//seen 608878
break;
default:
gasLimit = GAS_LIMIT_CAP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,25 @@ class Web3jAbstractServiceTest {
void getGasLimitForFunction() {
assertEquals(Web3jAbstractService
.getGasLimitForFunction(FUNC_INITIALIZE),
BigInteger.valueOf(300000));
BigInteger.valueOf(300_000));
assertEquals(Web3jAbstractService
.getGasLimitForFunction(FUNC_CONTRIBUTE),
BigInteger.valueOf(500000));
BigInteger.valueOf(500_000));
assertEquals(Web3jAbstractService
.getGasLimitForFunction(FUNC_REVEAL),
BigInteger.valueOf(100000));
BigInteger.valueOf(100_000));
assertEquals(Web3jAbstractService
.getGasLimitForFunction(FUNC_CONTRIBUTEANDFINALIZE),
BigInteger.valueOf(3_000_000));
assertEquals(Web3jAbstractService
.getGasLimitForFunction(FUNC_FINALIZE),
BigInteger.valueOf(300000));
BigInteger.valueOf(3_000_000));
assertEquals(Web3jAbstractService
.getGasLimitForFunction(FUNC_REOPEN),
BigInteger.valueOf(500000));
BigInteger.valueOf(500_000));
assertEquals(Web3jAbstractService
.getGasLimitForFunction(FUNC_CREATEDATASET),
BigInteger.valueOf(700000));
BigInteger.valueOf(700_000));
assertEquals(Web3jAbstractService
.getGasLimitForFunction("randomfunction"),
BigInteger.valueOf(GAS_LIMIT_CAP));
Expand Down

0 comments on commit e851552

Please sign in to comment.