Skip to content

Commit bde9c9f

Browse files
authored
Merge pull request #88 from iExecBlockchainComputing/feature/[email protected]@8.2.0
Use [email protected] and [email protected]
2 parents 8b54dfb + c7f9ae2 commit bde9c9f

File tree

6 files changed

+94
-12
lines changed

6 files changed

+94
-12
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ You can configure the iExec Result Proxy with the following properties:
2424
| `IEXEC_IS_SIDECHAIN` | Define if iExec on-chain protocol is built on top of token (`false`) or native currency (`true`). | Boolean | `false` |
2525
| `IEXEC_PRIVATE_CHAIN_ADDRESS` | Private URL to connect to the blockchain node. | URL | `http://localhost:8545` |
2626
| `IEXEC_HUB_ADDRESS` | Proxy contract address to interact with the iExec on-chain protocol. | Ethereum address | `0xBF6B2B07e47326B7c8bfCb4A5460bef9f0Fd2002` |
27+
| `IEXEC_BLOCK_TIME` | Duration between consecutive blocks on the blockchain network. | String | `PT5S` |
2728
| `IEXEC_GAS_PRICE_MULTIPLIER` | Transactions will be sent with `networkGasPrice * IEXEC_GAS_PRICE_MULTIPLIER`. | Float | `1.0` |
2829
| `IEXEC_GAS_PRICE_CAP` | In Wei, will be used for transactions if `networkGasPrice * IEXEC_GAS_PRICE_MULTIPLIER > gasPriceCap`. | Integer | `22000000000` |
2930
| `IEXEC_IPFS_HOST` | Host to connect to the IPFS node. | String | `127.0.0.1` |

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version=8.0.0
2-
iexecCommonVersion=8.1.0-NEXT-SNAPSHOT
3-
iexecCommonsPocoVersion=2.0.0
2+
iexecCommonVersion=8.2.0
3+
iexecCommonsPocoVersion=3.0.2
44

55
nexusUser
66
nexusPassword

src/main/java/com/iexec/resultproxy/chain/ChainConfig.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
1+
/*
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
117
package com.iexec.resultproxy.chain;
218

319
import lombok.Data;
420
import org.springframework.boot.context.properties.ConfigurationProperties;
521
import org.springframework.boot.context.properties.ConstructorBinding;
622

23+
import java.time.Duration;
24+
725
@Data
826
@ConstructorBinding
927
@ConfigurationProperties(prefix = "chain")
@@ -13,6 +31,7 @@ public class ChainConfig {
1331
private final boolean sidechain;
1432
private final String privateAddress;
1533
private final String hubAddress;
34+
private final Duration blockTime;
1635
private final float gasPriceMultiplier;
1736
private final long gasPriceCap;
1837
}

src/main/java/com/iexec/resultproxy/chain/Web3jService.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,20 @@
1717
package com.iexec.resultproxy.chain;
1818

1919
import com.iexec.commons.poco.chain.Web3jAbstractService;
20-
2120
import org.springframework.stereotype.Service;
2221

2322
@Service
2423
public class Web3jService extends Web3jAbstractService {
2524

2625
public Web3jService(ChainConfig chainConfig) {
27-
super(chainConfig.getPrivateAddress(), chainConfig.getGasPriceMultiplier(), chainConfig.getGasPriceCap(),
28-
chainConfig.isSidechain());
26+
super(
27+
chainConfig.getId(),
28+
chainConfig.getPrivateAddress(),
29+
chainConfig.getBlockTime(),
30+
chainConfig.getGasPriceMultiplier(),
31+
chainConfig.getGasPriceCap(),
32+
chainConfig.isSidechain()
33+
);
2934
}
3035

31-
}
36+
}

src/main/resources/application.yml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ spring:
1010
auto-index-creation: true # Auto-index creation is disabled by default starting with Spring Data MongoDB 3.x.
1111

1212
chain:
13-
id: ${IEXEC_CHAIN_ID:17}
14-
sidechain: ${IEXEC_IS_SIDECHAIN:false}
15-
privateAddress: ${IEXEC_PRIVATE_CHAIN_ADDRESS:http://localhost:8545}
16-
publicAddress: ${IEXEC_PUBLIC_CHAIN_ADDRESS:http://localhost:8545}
17-
hubAddress: ${IEXEC_HUB_ADDRESS:0xBF6B2B07e47326B7c8bfCb4A5460bef9f0Fd2002}
18-
startBlockNumber: ${IEXEC_START_BLOCK_NUMBER:0}
13+
id: ${IEXEC_CHAIN_ID:134}
14+
sidechain: ${IEXEC_IS_SIDECHAIN:true}
15+
privateAddress: ${IEXEC_PRIVATE_CHAIN_ADDRESS:https://bellecour.iex.ec}
16+
hubAddress: ${IEXEC_HUB_ADDRESS:0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f}
17+
blockTime: ${IEXEC_BLOCK_TIME:PT5S}
1918
gasPriceMultiplier: ${IEXEC_GAS_PRICE_MULTIPLIER:1.0} # txs will be sent with networkGasPrice*gasPriceMultiplier, 4.0 means super fast
2019
gasPriceCap: ${IEXEC_GAS_PRICE_CAP:22000000000} #in Wei, will be used for txs if networkGasPrice*gasPriceMultiplier > gasPriceCap
2120

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
/*
2+
* Copyright 2023-2023 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.resultproxy.chain;
18+
19+
import org.junit.jupiter.api.Test;
20+
import org.junit.jupiter.api.extension.ExtendWith;
21+
import org.springframework.beans.factory.annotation.Autowired;
22+
import org.springframework.boot.context.properties.EnableConfigurationProperties;
23+
import org.springframework.test.context.TestPropertySource;
24+
import org.springframework.test.context.junit.jupiter.SpringExtension;
25+
26+
import java.time.Duration;
27+
28+
import static org.assertj.core.api.Assertions.assertThat;
29+
30+
@ExtendWith(SpringExtension.class)
31+
@EnableConfigurationProperties(value = ChainConfig.class)
32+
@TestPropertySource(properties = {
33+
"chain.id=134",
34+
"chain.sidechain=true",
35+
"chain.privateAddress=https://bellecour.iex.ec",
36+
"chain.hubAddress=0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f",
37+
"chain.blockTime=PT5S",
38+
"chain.gasPriceMultiplier=1.0",
39+
"chain.gasPriceCap=22000000000" })
40+
class Web3jServiceTests {
41+
@Autowired
42+
private ChainConfig chainConfig;
43+
44+
@Test
45+
void checkChainConfig() {
46+
ChainConfig expextedConfig = new ChainConfig(
47+
134, true, "https://bellecour.iex.ec",
48+
"0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f", Duration.ofSeconds(5),
49+
1.0f, 22000000000L
50+
);
51+
assertThat(chainConfig).isEqualTo(expextedConfig);
52+
}
53+
54+
@Test
55+
void shouldCreateInstance() {
56+
assertThat(new Web3jService(chainConfig)).isNotNull();
57+
}
58+
}

0 commit comments

Comments
 (0)