Skip to content

Commit

Permalink
[feature] BitfieldSignerMock
Browse files Browse the repository at this point in the history
Signed-off-by: iceseer <[email protected]>
  • Loading branch information
iceseer committed Dec 3, 2024
1 parent 362c5e7 commit 962d959
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 5 deletions.
13 changes: 8 additions & 5 deletions test/core/parachain/backing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "common/main_thread_pool.hpp"
#include "common/worker_thread_pool.hpp"
#include "mock/core/parachain/prospective_parachains_mock.hpp"
#include "mock/core/parachain/bitfield_signer_mock.hpp"
#include "mock/core/application/app_configuration_mock.hpp"
#include "mock/core/application/app_state_manager_mock.hpp"
#include "mock/core/network/peer_view_mock.hpp"
Expand Down Expand Up @@ -42,20 +43,21 @@ class BackingTest : public ProspectiveParachainsTestHarness {
sr25519_provider_ = std::make_shared<Sr25519ProviderMock>();
router_ = std::make_shared<RouterMock>();
peer_view_ = std::make_shared<PeerViewMock>();
bitfield_signer_ = std::make_shared<BitfieldSignerMock>();

StartApp app_state_manager;



ParachainProcessorImpl(
/*ParachainProcessorImpl(
peer_manager_,
sr25519_provider_,
router_,
*main_thread_pool_,
hasher_,
std::shared_ptr<network::IPeerView> peer_view,
common::WorkerThreadPool &worker_thread_pool,
std::shared_ptr<parachain::IBitfieldSigner> bitfield_signer,
peer_view_,
*worker_thread_pool_,
bitfield_signer_,
std::shared_ptr<parachain::IPvfPrecheck> pvf_precheck,
std::shared_ptr<parachain::BitfieldStore> bitfield_store,
std::shared_ptr<parachain::BackingStore> backing_store,
Expand All @@ -74,7 +76,7 @@ class BackingTest : public ProspectiveParachainsTestHarness {
LazySPtr<consensus::SlotsUtil> slots_util,
std::shared_ptr<consensus::babe::BabeConfigRepository> babe_config_repo,
std::shared_ptr<statement_distribution::IStatementDistribution>
statement_distribution);
statement_distribution);*/
}

void TearDown() override {
Expand All @@ -93,6 +95,7 @@ class BackingTest : public ProspectiveParachainsTestHarness {
std::shared_ptr<Sr25519ProviderMock> sr25519_provider_;
std::shared_ptr<RouterMock> router_;
std::shared_ptr<network::PeerViewMock> peer_view_;
std::shared_ptr<BitfieldSignerMock> bitfield_signer_;

struct TestState {
std::vector<ParachainId> chain_ids;
Expand Down
33 changes: 33 additions & 0 deletions test/mock/core/parachain/bitfield_signer_mock.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/**
* Copyright Quadrivium LLC
* All Rights Reserved
* SPDX-License-Identifier: Apache-2.0
*/

#pragma once

#include <gmock/gmock.h>

#include "parachain/availability/bitfield/signer.hpp"

namespace kagome::parachain {

class BitfieldSignerMock : public IBitfieldSigner {
public:
MOCK_METHOD(void,
start,
(),
(override));

MOCK_METHOD(outcome::result<void>,
sign,
(const ValidatorSigner &, const Candidates &),
(override));

MOCK_METHOD(void,
setBroadcastCallback,
(BroadcastCallback &&),
(override));
};

} // namespace kagome::parachain

0 comments on commit 962d959

Please sign in to comment.