Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

## [[NEXT]](https://github.com/iExecBlockchainComputing/iexec-blockchain-adapter-api/releases/tag/vNEXT) 2025

### Dependency Upgrades

- Upgrade to `eclipse-temurin:17.0.13_11-jre-focal`. (#162)
- Upgrade to Spring Boot 3.0.13. (#162)
- Upgrade to Spring Doc OpenAPI 2.6.0. (#162)

## [[8.6.0]](https://github.com/iExecBlockchainComputing/iexec-blockchain-adapter-api/releases/tag/v8.6.0) 2024-12-20

### Bug Fixes
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build app container
FROM eclipse-temurin:11.0.24_8-jre-focal
FROM eclipse-temurin:17.0.13_11-jre-focal

ARG jar

Expand Down
21 changes: 6 additions & 15 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
plugins {
id 'java'
id 'io.freefair.lombok' version '8.10.2'
id 'org.springframework.boot' version '2.7.18'
id 'org.springframework.boot' version '3.0.13'
id 'io.spring.dependency-management' version '1.1.6'
id 'jacoco'
id 'org.sonarqube' version '5.1.0.4882'
id 'maven-publish'
}

ext {
openFeignVersion = '11.10'
testContainersVersion = '1.20.4'
}

Expand Down Expand Up @@ -41,8 +40,8 @@ allprojects {
toolchain {
languageVersion.set(JavaLanguageVersion.of(17))
}
sourceCompatibility = '11'
targetCompatibility = '11'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

Expand All @@ -55,16 +54,12 @@ dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'

// Spring Doc
implementation 'org.springdoc:springdoc-openapi-ui:1.7.0'
implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.6.0'

// iexec
implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion"
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"

// feign
implementation "io.github.openfeign:feign-jackson:$openFeignVersion"
implementation "io.github.openfeign:feign-slf4j:$openFeignVersion"

// observability
runtimeOnly 'io.micrometer:micrometer-registry-prometheus'

Expand All @@ -87,19 +82,15 @@ testing {
suites {
configureEach {
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.awaitility:awaitility'
implementation 'org.springframework.boot:spring-boot-starter-test'
implementation 'org.springframework.security:spring-security-test'
}
}
test {
useJUnitJupiter()
}
itest(JvmTestSuite) {
sources {
java {
srcDirs = ['src/itest/java']
}
}
dependencies {
implementation project()
implementation project(':iexec-blockchain-adapter-api-library')
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
version=8.6.0
iexecCommonVersion=8.6.0
iexecCommonsPocoVersion=4.2.0
iexecCommonVersion=8.6.0-NEXT-SNAPSHOT
iexecCommonsPocoVersion=4.2.0-NEXT-SNAPSHOT

nexusUser
nexusPassword
10 changes: 5 additions & 5 deletions iexec-blockchain-adapter-api-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ plugins {
}

dependencies {
implementation platform('org.springframework.boot:spring-boot-dependencies:3.0.13')
implementation "com.iexec.commons:iexec-commons-poco:$iexecCommonsPocoVersion"
implementation "com.iexec.common:iexec-common:$iexecCommonVersion"
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.commons:commons-lang3'
}

java {
sourceCompatibility = '11'
targetCompatibility = '11'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
withJavadocJar()
withSourcesJar()
}
Expand All @@ -23,8 +24,7 @@ testing {
test {
useJUnitJupiter()
dependencies {
implementation 'org.junit.jupiter:junit-jupiter:5.8.2'
implementation 'org.mockito:mockito-junit-jupiter:4.5.1'
implementation 'org.mockito:mockito-junit-jupiter'
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/com/iexec/blockchain/broker/BrokerService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2020-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -38,7 +38,6 @@
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.stream.Collectors;

@Slf4j
@Service
Expand Down Expand Up @@ -151,7 +150,7 @@ Optional<String> fireMatchOrders(
List<String> events = receipt.getLogs().stream()
.filter(log -> expectedTopics.equals(log.getTopics()))
.map(Log::getData)
.collect(Collectors.toList());
.toList();
log.info("logs {}", events);
if (events.size() != 1) {
throw new IllegalStateException("A single deal should have been created, not " + events.size());
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/com/iexec/blockchain/chain/ChainConfig.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2020-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2020-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -17,25 +17,23 @@
package com.iexec.blockchain.chain;

import com.iexec.common.chain.validation.ValidNonZeroEthereumAddress;
import jakarta.annotation.PostConstruct;
import jakarta.validation.*;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Positive;
import lombok.Builder;
import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.hibernate.validator.constraints.URL;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;

import javax.annotation.PostConstruct;
import javax.validation.*;
import javax.validation.constraints.Max;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.util.Set;

@Slf4j
@Value
@Builder
@ConstructorBinding
@ConfigurationProperties(prefix = "chain")
public class ChainConfig {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/iexec/blockchain/chain/QueueService.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2021-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,11 +16,11 @@

package com.iexec.blockchain.chain;

import jakarta.validation.constraints.NotNull;
import lombok.EqualsAndHashCode;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import javax.validation.constraints.NotNull;
import java.util.concurrent.*;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024 IEXEC BLOCKCHAIN TECH
* Copyright 2024-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,11 +19,9 @@
import com.iexec.commons.poco.chain.SignerService;
import lombok.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.ConstructorBinding;
import org.springframework.context.annotation.Bean;

@Value
@ConstructorBinding
@ConfigurationProperties(prefix = "wallet")
public class WalletConfiguration {
String path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
(or PUT/DELETE/PATCH) request with a valid CSRF token
Will eventually activate it later.
*/
.csrf().disable()
.cors().and()
.authorizeRequests()
.mvcMatchers(
"/swagger-ui.html",
"/swagger-ui/**",
"/v3/api-docs/**"
).anonymous() // Anonymous swagger access
.mvcMatchers(
"/actuator/health",
"/actuator/prometheus",
"/config/chain"
).permitAll()
.anyRequest().authenticated()
.and()
.csrf(csrf -> csrf.disable())
.cors(cors -> cors.and())
.authorizeHttpRequests(auth -> auth
.requestMatchers(
"/swagger-ui.html",
"/swagger-ui/**",
"/v3/api-docs/**"
).anonymous() // Anonymous swagger access
.requestMatchers(
"/actuator/health",
"/actuator/prometheus",
"/config/chain"
).permitAll()
.anyRequest().authenticated()
)
.httpBasic();
return http.build();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023-2023 IEXEC BLOCKCHAIN TECH
* Copyright 2023-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -18,13 +18,12 @@

import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.Metrics;
import jakarta.annotation.PostConstruct;
import org.springframework.boot.info.BuildProperties;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

@RestController
public class VersionController {

Expand Down
12 changes: 6 additions & 6 deletions src/test/java/com/iexec/blockchain/chain/ChainConfigTest.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2021-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -16,12 +16,12 @@

package com.iexec.blockchain.chain;

import jakarta.validation.ConstraintViolationException;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

import javax.validation.ConstraintViolationException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.stream.Stream;
Expand Down Expand Up @@ -94,7 +94,7 @@ void shouldNotValidateChainId(int chainId) {

log.info("{}", chainConfig);
assertThatThrownBy(() -> validate(chainConfig))
.getRootCause()
.rootCause()
.isInstanceOf(ConstraintViolationException.class)
.hasMessageContaining("Chain id should be positive")
;
Expand Down Expand Up @@ -123,7 +123,7 @@ void shouldNotValidateNodeAddress(String nodeAddress) {

log.info("{}", chainConfig);
assertThatThrownBy(() -> validate(chainConfig))
.getRootCause()
.rootCause()
.isInstanceOf(ConstraintViolationException.class)
.hasMessageContaining("nodeAddress")
;
Expand All @@ -150,7 +150,7 @@ void shouldNotValidateBlockTime(int blockTime) {

log.info("{}", chainConfig);
assertThatThrownBy(() -> validate(chainConfig))
.getRootCause()
.rootCause()
.isInstanceOf(ConstraintViolationException.class)
.hasMessageContaining("blockTime")
;
Expand Down Expand Up @@ -180,7 +180,7 @@ void shouldNotValidateHubAddress(String hubAddress) {

log.info("{}", chainConfig);
assertThatThrownBy(() -> validate(chainConfig))
.getRootCause()
.rootCause()
.isInstanceOf(ConstraintViolationException.class)
.hasMessageContaining("hubAddress")
;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021-2024 IEXEC BLOCKCHAIN TECH
* Copyright 2021-2025 IEXEC BLOCKCHAIN TECH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,7 +29,6 @@
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

import static org.assertj.core.api.Assertions.assertThatThrownBy;
Expand Down Expand Up @@ -161,15 +160,15 @@ void shouldExecuteInOrder() throws NoSuchFieldException {
final List<Integer> expectedExecutionOrder = IntStream
.range(0, totalTasksNumber)
.boxed()
.collect(Collectors.toList());
.toList();
assertThat(executionOrder).isEqualTo(expectedExecutionOrder);

// After each task execution, one less task should be in the queue.
// This should look like [5, 4, 3, 2, 1, 0].
final List<Integer> expectedRemainingTasksInQueue = IntStream
.range(0, totalTasksNumber)
.mapToObj(i -> totalTasksNumber - i - 1)
.collect(Collectors.toList());
.toList();
assertThat(remainingTasksInQueue).isEqualTo(expectedRemainingTasksInQueue);
}

Expand Down
Loading