Skip to content

Commit 7825e9d

Browse files
add proof loading to testvectors (#503)
Signed-off-by: Alexey Chernyshov <[email protected]>
1 parent 69b75a0 commit 7825e9d

File tree

11 files changed

+35
-10
lines changed

11 files changed

+35
-10
lines changed

.github/disabled_workflows/msan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # has to be included to access other secrets
4343
# GITHUB_HUNTER_USERNAME: ${{ secrets.HUNTER_USERNAME }}
4444
# GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
45-
# run: cmake . -GNinja -Bbuild -D MSAN=ON -D TESTING_PROOFS=ON
45+
# run: cmake . -GNinja -Bbuild -D MSAN=ON -D TESTING_PROOFS=ON -D TESTING_ACTORS=ON
4646
# - name: build
4747
# run: cmake --build build -- -j2
4848
# - name: run tests

.github/workflows/asan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
4242
CFLAGS: "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
4343
CXXFLAGS: "-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
44-
run: cmake . -GNinja -Bbuild -D ASAN=ON -D TESTING_PROOFS=ON
44+
run: cmake . -GNinja -Bbuild -D ASAN=ON -D TESTING_PROOFS=ON -D TESTING_ACTORS=ON
4545
- name: build
4646
run: cmake --build build -- -j2
4747
- name: run tests

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ jobs:
8383
GITHUB_HUNTER_USERNAME: ${{ secrets.HUNTER_USERNAME }}
8484
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
8585
COVERAGE: ${{ matrix.env.COVERAGE }}
86-
run: cmake . -GNinja -Bbuild $COVERAGE -D TESTING_PROOFS=ON
86+
run: cmake . -GNinja -Bbuild $COVERAGE -D TESTING_PROOFS=ON -D TESTING_ACTORS=ON
8787
- name: build
8888
run: cmake --build build -- -j2
8989
- name: tests

.github/workflows/lsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # has to be included to access other secrets
4242
GITHUB_HUNTER_USERNAME: ${{ secrets.HUNTER_USERNAME }}
4343
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
44-
run: cmake . -GNinja -Bbuild -D LSAN=ON -D TESTING_PROOFS=ON
44+
run: cmake . -GNinja -Bbuild -D LSAN=ON -D TESTING_PROOFS=ON -D TESTING_ACTORS=ON
4545
- name: build
4646
run: cmake --build build -- -j2
4747
- name: run tests

.github/workflows/tsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
4242
CFLAGS: "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
4343
CXXFLAGS: "-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
44-
run: cmake . -GNinja -Bbuild -D TSAN=ON -D TESTING_PROOFS=ON
44+
run: cmake . -GNinja -Bbuild -D TSAN=ON -D TESTING_PROOFS=ON -D TESTING_ACTORS=ON
4545
- name: build
4646
run: cmake --build build -- -j2
4747
- name: run tests

.github/workflows/ubsan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
GITHUB_HUNTER_TOKEN: ${{ secrets.HUNTER_TOKEN }}
4242
CFLAGS: "-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
4343
CXXFLAGS: "-isysroot/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
44-
run: cmake . -GNinja -Bbuild -D UBSAN=ON -D TESTING_PROOFS=ON
44+
run: cmake . -GNinja -Bbuild -D UBSAN=ON -D TESTING_PROOFS=ON -D TESTING_ACTORS=ON
4545
- name: build
4646
run: cmake --build build -- -j2
4747
- name: run tests

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ print("Using CMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}")
5050

5151
option(TESTING "Build tests" ON)
5252
option(TESTING_PROOFS "Build proofs tests" OFF)
53+
option(TESTING_ACTORS "Build actors tests" OFF)
5354
option(CLANG_FORMAT "Enable clang-format target" ON)
5455
option(CLANG_TIDY "Enable clang-tidy checks during compilation" OFF)
5556
option(COVERAGE "Enable generation of coverage info" OFF)

test/core/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,9 @@ add_subdirectory(sector_storage)
2727
add_subdirectory(sectorblocks)
2828
add_subdirectory(serialization)
2929
add_subdirectory(storage)
30-
add_subdirectory(test_vectors)
30+
31+
if (TESTING_ACTORS)
32+
add_subdirectory(test_vectors)
33+
endif()
34+
3135
add_subdirectory(vm)

test/core/test_vectors/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ target_link_libraries(test_vectors_test
1414
interpreter
1515
ipfs_datastore_in_memory
1616
json
17+
proof_param_provider
1718
state_tree
1819
runtime
1920
)

test/core/test_vectors/test.cpp

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include "codec/json/json.hpp"
1515
#include "core/test_vectors/replaying_randomness.hpp"
1616
#include "primitives/tipset/load.hpp"
17+
#include "proofs/proof_param_provider.hpp"
1718
#include "storage/car/car.hpp"
1819
#include "storage/ipfs/impl/in_memory_datastore.hpp"
1920
#include "testutil/read_file.hpp"
@@ -54,8 +55,11 @@ using fc::primitives::ChainEpoch;
5455
using fc::primitives::EpochDuration;
5556
using fc::primitives::address::Address;
5657
using fc::primitives::block::BlockHeader;
58+
using fc::primitives::sector::getSectorSize;
59+
using fc::primitives::sector::RegisteredSealProof;
5760
using fc::primitives::tipset::put;
5861
using fc::primitives::tipset::Tipset;
62+
using fc::proofs::ProofParamProvider;
5963
using fc::vm::actor::Invoker;
6064
using fc::vm::actor::InvokerImpl;
6165
using fc::vm::message::UnsignedMessage;
@@ -261,7 +265,18 @@ auto search() {
261265
return vectors;
262266
}
263267

264-
struct TestVectors : testing::TestWithParam<MessageVector> {};
268+
struct TestVectors : testing::TestWithParam<MessageVector> {
269+
static void SetUpTestCase() {
270+
// Download proofs needed for tests
271+
OUTCOME_EXCEPT(params,
272+
ProofParamProvider::readJson(
273+
"/var/tmp/filecoin-proof-parameters/parameters.json"));
274+
RegisteredSealProof seal_proof_type =
275+
RegisteredSealProof::kStackedDrg2KiBV1;
276+
OUTCOME_EXCEPT(sector_size, getSectorSize(seal_proof_type));
277+
OUTCOME_EXCEPT(ProofParamProvider::getParams(params, sector_size));
278+
}
279+
};
265280

266281
void testTipsets(const MessageVector &mv, const IpldPtr &ipld) {
267282
using namespace fc;
@@ -281,7 +296,8 @@ void testTipsets(const MessageVector &mv, const IpldPtr &ipld) {
281296
parent.parent_state_root = mv.state_before;
282297
put(ipld, nullptr, parent);
283298
OUTCOME_EXCEPT(parents, Tipset::create({parent}));
284-
auto i{0}, j{0};
299+
auto i{0};
300+
auto j{0};
285301
for (const auto &ts : mv.tipsets) {
286302
fc::primitives::tipset::TipsetCreator cr;
287303
fc::primitives::block::Ticket ticket{{0}};

0 commit comments

Comments
 (0)