Skip to content

Commit fb5347d

Browse files
Rename EpochIndex to ChainEpoch (#47)
Signed-off-by: Alexey-N-Chernyshov <[email protected]>
1 parent ac47b18 commit fb5347d

File tree

6 files changed

+19
-20
lines changed

6 files changed

+19
-20
lines changed

core/crypto/randomness/impl/randomness_provider.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ namespace fc::crypto::randomness {
1717

1818
Randomness RandomnessProviderImpl::deriveRandomness(DomainSeparationTag tag,
1919
Serialization s,
20-
EpochIndex index) {
20+
ChainEpoch index) {
2121
return deriveRandomnessInternal(tag, std::move(s), static_cast<size_t>(-1));
2222
}
2323

2424
Randomness RandomnessProviderImpl::deriveRandomnessInternal(
25-
DomainSeparationTag tag, Serialization s, EpochIndex index) {
25+
DomainSeparationTag tag, Serialization s, ChainEpoch index) {
2626
common::Buffer value{};
2727
const size_t bytes_required =
28-
sizeof(DomainSeparationTag) + sizeof(EpochIndex) + s.size();
28+
sizeof(DomainSeparationTag) + sizeof(ChainEpoch) + s.size();
2929
value.reserve(bytes_required);
3030
common::encodeInteger(static_cast<size_t>(tag), value);
3131
common::encodeInteger(static_cast<size_t>(index), value);

core/crypto/randomness/impl/randomness_provider.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ namespace fc::crypto::randomness {
1919

2020
Randomness deriveRandomness(DomainSeparationTag tag,
2121
Serialization s,
22-
EpochIndex index) override;
22+
ChainEpoch index) override;
2323

2424
private:
2525
Randomness deriveRandomnessInternal(DomainSeparationTag tag,
2626
Serialization s,
27-
EpochIndex index);
27+
ChainEpoch index);
2828
};
2929

3030
} // namespace fc::crypto::randomness

core/crypto/randomness/randomness_provider.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ namespace fc::crypto::randomness {
3434
*/
3535
virtual Randomness deriveRandomness(DomainSeparationTag tag,
3636
Serialization s,
37-
EpochIndex index) = 0;
37+
ChainEpoch index) = 0;
3838
};
3939
} // namespace fc::crypto::randomness
4040

core/crypto/randomness/randomness_types.hpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#ifndef CPP_FILECOIN_CORE_CRYPTO_RANDOMNESS_RANDOMNESS_HPP
77
#define CPP_FILECOIN_CORE_CRYPTO_RANDOMNESS_RANDOMNESS_HPP
88

9-
#include "common/buffer.hpp"
109
#include "common/blob.hpp"
10+
#include "common/buffer.hpp"
1111

1212
namespace fc::crypto::randomness {
1313
/// @brief randomness value type
@@ -17,14 +17,14 @@ namespace fc::crypto::randomness {
1717
using Serialization = common::Buffer;
1818

1919
/// @brief domain separation tag enum
20-
enum class DomainSeparationTag: size_t {
21-
TicketDrawingDST = 1,
22-
TicketProductionDST = 2,
23-
PoStDST = 3
20+
enum class DomainSeparationTag : size_t {
21+
TicketDrawingDST = 1,
22+
TicketProductionDST = 2,
23+
PoStDST = 3
2424
};
2525

26-
/// @brief epoch index type
27-
using EpochIndex = size_t;
28-
}
26+
/// @brief epoch index type represents a round of a blockchain protocol
27+
using ChainEpoch = size_t;
28+
} // namespace fc::crypto::randomness
2929

30-
#endif //CPP_FILECOIN_CORE_CRYPTO_RANDOMNESS_RANDOMNESS_HPP
30+
#endif // CPP_FILECOIN_CORE_CRYPTO_RANDOMNESS_RANDOMNESS_HPP

test/core/crypto/randomness/randomness_provider_test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ struct RandomnessProviderTest
2929
: public RandomnessProviderBaseTest,
3030
public ::testing::TestWithParam<std::tuple<DomainSeparationTag,
3131
Serialization,
32-
EpochIndex,
32+
ChainEpoch,
3333
Randomness>> {
3434
template <class T, class S, class I, class R>
35-
static std::tuple<DomainSeparationTag, Serialization, EpochIndex, Randomness>
35+
static std::tuple<DomainSeparationTag, Serialization, ChainEpoch, Randomness>
3636
makeParams(T tag, S s, I index, R res) {
3737
return std::make_tuple(static_cast<DomainSeparationTag>(std::move(tag)),
3838
static_cast<Serialization>(std::move(s)),
39-
static_cast<EpochIndex>(std::move(index)),
39+
static_cast<ChainEpoch>(std::move(index)),
4040
static_cast<Randomness>(std::move(res)));
4141
}
4242
};
@@ -103,7 +103,7 @@ struct RandomnessProviderValuesTest : public RandomnessProviderBaseTest,
103103
Randomness generateRandomnessValue() {
104104
auto tag = static_cast<DomainSeparationTag>(getRandomByte() % 3 + 1);
105105
Serialization s{random_generator->randomBytes(buffer_size)};
106-
EpochIndex index = getRandomByte() % 100;
106+
ChainEpoch index = getRandomByte() % 100;
107107

108108
return randomness_provider->deriveRandomness(tag, s, index);
109109
}

test/core/vm/actor/actor_test.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#include "codec/cbor/cbor.hpp"
99
#include <gtest/gtest.h>
1010
#include "testutil/literals.hpp"
11-
#include "testutil/outcome.hpp"
1211

1312
using libp2p::multi::ContentIdentifier;
1413

0 commit comments

Comments
 (0)