Skip to content

Commit caec40d

Browse files
ortyomkaturuslan
andauthored
Proofs v24 (#162)
* Updated filecoin-ffi version Signed-off-by: artyom-yurin <[email protected]> * Updated bls-provider Signed-off-by: artyom-yurin <[email protected]> * Added CURL for downloading proofs Returned proof param provider Renamed dir of header Signed-off-by: artyom-yurin <[email protected]> * Added error indicator in proof param provider Added getSectorSize function for getting actual size from ProofType Signed-off-by: artyom-yurin <[email protected]> * Added util functions Signed-off-by: artyom-yurin <[email protected]> * Proofs v24: changes (#163) Signed-off-by: turuslan <[email protected]> Co-authored-by: Ruslan Tushov <[email protected]>
1 parent 1d65126 commit caec40d

32 files changed

+1255
-463
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
uses: actions/[email protected]
4040
env:
4141
cache-name: cache-filecoin-ffi-proofs
42-
version: v23
42+
version: v24
4343
with:
4444
path: /var/tmp/filecoin-proof-parameters
4545
key: build-${{ env.cache-name }}-${{ env.version }}

.github/workflows/lsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/[email protected]
1919
env:
2020
cache-name: cache-filecoin-ffi-proofs
21-
version: v23
21+
version: v24
2222
with:
2323
path: /var/tmp/filecoin-proof-parameters
2424
key: build-${{ env.cache-name }}-${{ env.version }}

.github/workflows/tsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/[email protected]
1919
env:
2020
cache-name: cache-filecoin-ffi-proofs
21-
version: v23
21+
version: v24
2222
with:
2323
path: /var/tmp/filecoin-proof-parameters
2424
key: build-${{ env.cache-name }}-${{ env.version }}

.github/workflows/ubsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
uses: actions/[email protected]
1919
env:
2020
cache-name: cache-filecoin-ffi-proofs
21-
version: v23
21+
version: v24
2222
with:
2323
path: /var/tmp/filecoin-proof-parameters
2424
key: build-${{ env.cache-name }}-${{ env.version }}

cmake/Hunter/config.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ hunter_config(
1010
CMAKE_ARGS "CMAKE_CXX_FLAGS=-Wno-deprecated-copy"
1111
)
1212

13+
hunter_config(
14+
CURL
15+
VERSION 7.60.0-p2
16+
CMAKE_ARGS "HTTP_ONLY=ON"
17+
)
18+
1319
hunter_config(
1420
spdlog
1521
URL https://github.com/gabime/spdlog/archive/v1.4.2.zip

cmake/dependencies.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ find_package(Microsoft.GSL CONFIG REQUIRED)
1818
hunter_add_package(OpenSSL)
1919
find_package(OpenSSL REQUIRED)
2020

21+
# https://hunter.readthedocs.io/en/latest/packages/pkg/CURL.html#pkg-curl
22+
hunter_add_package(CURL)
23+
find_package(CURL CONFIG REQUIRED)
24+
2125
# https://developers.google.com/protocol-buffers/
2226
hunter_add_package(Protobuf)
2327
find_package(Protobuf CONFIG REQUIRED)

core/common/blob.hpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
#include <boost/format.hpp>
1212
#include <boost/functional/hash.hpp>
13+
1314
#include "common/hexutil.hpp"
15+
#include "common/span.hpp"
1416

1517
namespace fc::common {
1618

@@ -74,14 +76,7 @@ namespace fc::common {
7476
* @return result containing Blob object if string has proper size
7577
*/
7678
static outcome::result<Blob<size_>> fromString(std::string_view data) {
77-
if (data.size() != size_) {
78-
return BlobError::INCORRECT_LENGTH;
79-
}
80-
81-
Blob<size_> b;
82-
std::copy(data.begin(), data.end(), b.begin());
83-
84-
return b;
79+
return fromSpan(span::cbytes(data));
8580
}
8681

8782
/**

core/common/ffi.hpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#ifndef CPP_FILECOIN_CORE_COMMON_FFI_HPP
7+
#define CPP_FILECOIN_CORE_COMMON_FFI_HPP
8+
9+
#include <memory>
10+
11+
#include "common/blob.hpp"
12+
13+
namespace fc::common::ffi {
14+
template <typename T, typename D>
15+
auto wrap(T *ptr, D deleter) {
16+
return std::unique_ptr<T, D>(ptr, deleter);
17+
}
18+
19+
template <size_t size>
20+
auto array(const uint8_t (&rhs)[size]) {
21+
Blob<size> lhs;
22+
std::copy(std::begin(rhs), std::end(rhs), std::begin(lhs));
23+
return lhs;
24+
}
25+
26+
template <size_t size>
27+
void array(uint8_t (&lhs)[size], const std::array<uint8_t, size> rhs) {
28+
std::copy(std::begin(rhs), std::end(rhs), std::begin(lhs));
29+
}
30+
} // namespace fc::common::ffi
31+
32+
#endif // CPP_FILECOIN_CORE_COMMON_FFI_HPP

core/common/span.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
namespace fc::common::span {
1212
template <typename To, typename From>
1313
constexpr auto cast(gsl::span<From> span) {
14+
static_assert(sizeof(To) == 1);
1415
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-reinterpret-cast)
1516
return gsl::make_span(reinterpret_cast<To *>(span.data()), span.size());
1617
}

core/crypto/bls/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ add_library(bls_provider
88
)
99

1010
target_link_libraries(bls_provider
11+
blob
1112
filecoin_ffi
1213
outcome
1314
)

0 commit comments

Comments
 (0)