Skip to content

Commit

Permalink
chore: merge 1.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sotatek-ThinhVu committed May 9, 2024
2 parents ef13526 + 49fd713 commit 24140ad
Show file tree
Hide file tree
Showing 34 changed files with 790 additions and 364 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
uses: google-github-actions/release-please-action@v3
with:
release-type: maven
release-as: 0.8.0
release-as: 0.9.0
18 changes: 9 additions & 9 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,30 +119,30 @@ jobs:
- name: Migrate config
run: postman-to-k6 src/test/Postman/Cardano-Explorer-API.postman_collection.json --environment src/test/Postman/DevInt.postman_environment.json -o k6-script.js --skip-post -i 10
- name: Test
run: newman run src/test/Postman/Cardano-Explorer-API.postman_collection.json -e src/test/Postman/DevInt.postman_environment.json -r cli,htmlextra,allure --reporter-htmlextra-export=reporthtml/reporthtml.html --timeout-request 5000
run: newman run src/test/Postman/Cardano-Explorer-API.postman_collection.json -e src/test/Postman/DevInt.postman_environment.json -r cli,htmlextra,allure --reporter-htmlextra-export=reporthtml/reporthtml.html --timeout-request 10000
- name: Allure Report action from marketplace
uses: simple-elf/allure-report-action@master
if: always()
if: github.ref == 'refs/heads/main'
#id: allure-report
with:
allure_results: allure-results
- name: Archive html results
uses: actions/upload-artifact@v3
if: always()
if: github.ref == 'refs/heads/main'
with:
name: html-report
path: reporthtml
- name: Archive k6 script
uses: actions/upload-artifact@v3
if: always()
if: github.ref == 'refs/heads/main'
with:
name: k6-script
path: |
k6-script.js
libs/
- name: Archive allure results
uses: actions/upload-artifact@v3
if: always()
if: github.ref == 'refs/heads/main'
with:
name: allure-report
path: allure-report
Expand All @@ -165,7 +165,7 @@ jobs:
flags: --vus 10 --out csv=k6_results.csv
- name: Archive allure results
uses: actions/upload-artifact@v3
if: always()
if: github.ref == 'refs/heads/main'
with:
name: loadtest-report
path: k6_results.csv
Expand Down Expand Up @@ -200,23 +200,23 @@ jobs:

- name: Publish mutation test report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: always()
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: allure-report
target-folder: allure-report/

- name: Publish mutation test report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: always()
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: html-report
target-folder: html-report/

- name: Publish LoadTest report to GitHub Pages
uses: JamesIves/github-pages-deploy-action@v4
if: always()
if: github.ref == 'refs/heads/main'
with:
BRANCH: gh-pages
folder: loadtest-report
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
# Changelog

## [0.9.0](https://github.com/cardano-foundation/cf-explorer-api/compare/v0.8.0...v0.9.0) (2024-03-05)


### Bug Fixes

* add createdOn field ([f9f15ef](https://github.com/cardano-foundation/cf-explorer-api/commit/f9f15efa2dd50524492ec1c286ca0b8704c79c90))
* failed to sort several fields on pool list ([3ef63d0](https://github.com/cardano-foundation/cf-explorer-api/commit/3ef63d075e3de3778cb582b0a1508aad5562e2e4))
* MET-1913 update postman collection sprint 0.9.0 ([6b324a6](https://github.com/cardano-foundation/cf-explorer-api/commit/6b324a6c99b2d4f75a78ba3e31ebecdb520f8b21))
* MET-1972 epoch status display incorrect while syncing ([ce89d98](https://github.com/cardano-foundation/cf-explorer-api/commit/ce89d988f1d8c065b69fab3f1aae29c813dc689c))
* remove previous market data cache ([e5448ff](https://github.com/cardano-foundation/cf-explorer-api/commit/e5448ff01aa600bb44057729bfb2cefd642c0b42))
* replace logic check valid value in metadatacip25 ([e69117e](https://github.com/cardano-foundation/cf-explorer-api/commit/e69117e0b6471f2cbb56996ba3cd59c88ecf861e))

## [0.8.0](https://github.com/cardano-foundation/cf-explorer-api/compare/v0.7.0...v0.8.0) (2024-02-09)


Expand Down
31 changes: 31 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Security Policy

## Reporting a Vulnerability

The Cardano Foundation Explorer project takes security seriously. We appreciate your efforts in disclosing any potential vulnerabilities responsibly.

If you have discovered a security vulnerability within this project, please report it to us as soon as possible. We encourage responsible disclosure and kindly ask you to follow the guidelines outlined below.

## Guidelines for Responsible Disclosure

To ensure that the security vulnerability is properly addressed, we request that you adhere to the following guidelines:

1. **Do not exploit the vulnerability**: Do not attempt to exploit the vulnerability or gain unauthorized access to any user data. Only perform actions that are necessary to identify or validate the vulnerability.

2. **Privately disclose the vulnerability**: Please do not disclose the vulnerability publicly before we have had an opportunity to investigate and address the issue. We appreciate your discretion.

3. **Contact us directly**: Send an email to our team at security@cardanofoudnation.org with the subject line: "[Cardano Foundation Explorer] Security Vulnerability Report"

4. **Provide detailed information**: In your report, please include detailed information about the vulnerability, including steps to reproduce it and any potential impact.

5. **Share your contact information**: We would appreciate it if you could provide your name and contact information, including your email address or other means of communication, so we can reach out to you if we require any additional information.

6. **Keep communication confidential**: While we investigate and address the vulnerability, we kindly request that you keep all communication related to the vulnerability confidential.

7. **Allow time for a response**: We strive to acknowledge vulnerability reports as soon as possible and will make every effort to respond within a reasonable timeframe. Please be patient while we investigate and address the reported issue.

## Recognition and Acknowledgment

We believe in recognizing the valuable contributions of the security community and are open to acknowledging those who responsibly disclose vulnerabilities. If you would like to be acknowledged for your responsible disclosure, please let us know when reporting the vulnerability. However, we respect your privacy and will not disclose any personal information without your explicit consent.

Thank you for helping us ensure the security of the Cardano Foundation Explorer project and the broader Cardano ecosystem. Your efforts are greatly appreciated.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>org.cardanofoundation.explorer</groupId>
<artifactId>api</artifactId>
<version>0.8.0</version>
<version>1.0.0</version>
<packaging>jar</packaging>
<description>Explorer REST API exposing functions to the explorer web frontend.</description>

Expand Down Expand Up @@ -67,7 +67,7 @@
<version.snakeyaml>2.0</version.snakeyaml>
<version.mapstruct>1.5.3.Final</version.mapstruct>
<version.lombok-mapstruct-binding>0.2.0</version.lombok-mapstruct-binding>
<version.explorer-common>0.9.0-PR199</version.explorer-common>
<version.explorer-common>0.9.0-PR212</version.explorer-common>
<sonar.coverage.jacoco.xmlReportPaths>../cardano-explorer-api/target/site/jacoco-aggregate/jacoco.xml
</sonar.coverage.jacoco.xmlReportPaths>
<sonar.coverage.exclusions>**/entity/*, **/validation/*</sonar.coverage.exclusions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.cardanofoundation.explorer.api.model.response.drep.DRepDetailsResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepFilterResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepOverviewResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepRangeValuesResponse;
import org.cardanofoundation.explorer.api.model.response.drep.VotingProcedureChartResponse;
import org.cardanofoundation.explorer.api.service.DRepService;
import org.cardanofoundation.explorer.common.entity.enumeration.GovActionType;
Expand Down Expand Up @@ -126,4 +127,13 @@ public ResponseEntity<BaseFilterResponse<DRepFilterResponse>> getDRepsByFilter(
return ResponseEntity.ok(
dRepService.getDRepsByFilter(dRepFilterRequest, pagination.toPageable()));
}

@GetMapping("/range-values-for-filter")
@LogMessage
@Operation(
summary = "Get range value to filter on DRep overview page",
tags = {"dRep"})
public ResponseEntity<DRepRangeValuesResponse> getDRepRangeValues() {
return ResponseEntity.ok(dRepService.getDRepRangeValues());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import org.cardanofoundation.explorer.api.model.response.drep.DRepDelegatorsResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepDetailsResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepFilterResponse;
import org.cardanofoundation.explorer.api.model.response.drep.DRepRangeValuesResponse;
import org.cardanofoundation.explorer.api.projection.DRepDelegatorProjection;
import org.cardanofoundation.explorer.api.projection.DRepRangeProjection;
import org.cardanofoundation.explorer.common.entity.explorer.DRepInfo;

@Mapper(componentModel = "spring")
Expand All @@ -26,6 +28,8 @@ DRepDelegatorsResponse fromDRepDelegatorProjection(
@Mapping(target = "updatedAt", expression = "java(fromLong(dRepInfo.getUpdatedAt()))")
DRepFilterResponse fromDRepInfo(DRepInfo dRepInfo);

DRepRangeValuesResponse fromDRepRangeProjection(DRepRangeProjection dRepRangeProjection);

default Date fromLong(Long value) {
return value == null ? null : new Date(value * 1000);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
package org.cardanofoundation.explorer.api.model.request.drep;

import java.math.BigInteger;
import java.util.Date;
import java.time.LocalDateTime;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import org.springframework.format.annotation.DateTimeFormat;

import org.cardanofoundation.explorer.common.entity.enumeration.DRepStatus;
import org.cardanofoundation.explorer.common.validation.date.DatePattern;
import org.cardanofoundation.explorer.common.validation.date.param.DateValid;

@Getter
@Setter
Expand All @@ -31,9 +31,9 @@ public class DRepFilterRequest {

private DRepStatus drepStatus;

@DateValid(pattern = DatePattern.YYYY_MM_DD)
private Date fromDate;
@DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
private LocalDateTime fromDate;

@DateValid(pattern = DatePattern.YYYY_MM_DD)
private Date toDate;
@DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
private LocalDateTime toDate;
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
package org.cardanofoundation.explorer.api.model.request.governanceAction;

import java.util.Date;
import java.time.LocalDateTime;

import jakarta.validation.constraints.NotNull;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import org.springframework.format.annotation.DateTimeFormat;

import org.cardanofoundation.explorer.common.entity.enumeration.GovActionStatus;
import org.cardanofoundation.explorer.common.entity.enumeration.GovActionType;
import org.cardanofoundation.explorer.common.entity.enumeration.Vote;
import org.cardanofoundation.explorer.common.entity.enumeration.VoterType;
import org.cardanofoundation.explorer.common.validation.date.DatePattern;
import org.cardanofoundation.explorer.common.validation.date.param.DateValid;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class GovernanceActionFilter {

Boolean isRepeatVote;
Expand All @@ -36,9 +38,9 @@ public class GovernanceActionFilter {

@NotNull VoterType voterType;

@DateValid(pattern = DatePattern.YYYY_MM_DD)
private Date fromDate;
@DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
private LocalDateTime fromDate;

@DateValid(pattern = DatePattern.YYYY_MM_DD)
private Date toDate;
@DateTimeFormat(pattern = "yyyy/MM/dd HH:mm:ss")
private LocalDateTime toDate;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.SuperBuilder;

import org.cardanofoundation.explorer.common.entity.enumeration.VoterType;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@SuperBuilder
public class GovernanceActionRequest {
String txHash;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public class PoolReportCreateRequest {
private Integer[] epochRanges;
private String timePattern;
private Long zoneOffset; // diff with UTC in minutes
private String dateFormat;

public PoolReportHistory toEntity(ReportHistory reportHistory) {
return PoolReportHistory.builder()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ public class StakeKeyReportRequest {
private Boolean eventDeregistration;
private String timePattern;
private Long zoneOffset; // diff with UTC in minutes
private String dateFormat;
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public class BlockResponse {
private String slotLeader;

private Integer confirmation;

private String poolView;

private String poolTicker;

private String poolName;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package org.cardanofoundation.explorer.api.model.response.drep;

import java.math.BigInteger;

import lombok.Data;
import lombok.experimental.SuperBuilder;

@Data
@SuperBuilder
public class DRepRangeValuesResponse {
Double minVotingPower;
Double maxVotingPower;

BigInteger maxActiveVoteStake;

BigInteger minActiveVoteStake;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public class SearchResponse {
private PoolSearchResponse pool;
private boolean validPoolName;
private ScriptSearchResponse script;
private String dRep;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.cardanofoundation.explorer.api.projection;

import java.math.BigInteger;

public interface DRepRangeProjection {
BigInteger getMinActiveVoteStake();

BigInteger getMaxActiveVoteStake();

Double getMinVotingPower();

Double getMaxVotingPower();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.cardanofoundation.explorer.api.projection;

public interface PoolMintBlockProjection {
String getPoolView();

String getPoolTicker();

String getPoolName();

Long getBlockNo();
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.cardanofoundation.explorer.api.model.response.drep.projection.DRepStatusCountProjection;
import org.cardanofoundation.explorer.api.projection.DRepInfoProjection;
import org.cardanofoundation.explorer.api.projection.DRepRangeProjection;
import org.cardanofoundation.explorer.common.entity.enumeration.DRepStatus;
import org.cardanofoundation.explorer.common.entity.explorer.DRepInfo;

Expand Down Expand Up @@ -58,4 +59,12 @@ Page<DRepInfo> getDRepInfoByFilterRequest(
@Param("fromDate") Long fromDate,
@Param("toDate") Long toDate,
Pageable pageable);

@Query(
value =
"""
select max(dri.votingPower) as maxVotingPower , max(dri.activeVoteStake) as maxActiveVoteStake,
min(dri.votingPower) as minVotingPower , min(dri.activeVoteStake) as minActiveVoteStake from DRepInfo dri
""")
DRepRangeProjection getDRepRangeValues();
}

0 comments on commit 24140ad

Please sign in to comment.