Skip to content

Commit 67f637c

Browse files
committed
merge conflicts
1 parent a7ea3cd commit 67f637c

File tree

6 files changed

+5
-101
lines changed

6 files changed

+5
-101
lines changed

src/state_transition/cache/effective_balance_increments.zig

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ const std = @import("std");
22
const Allocator = std.mem.Allocator;
33
const preset = @import("preset").preset;
44
const AnyBeaconState = @import("fork_types").AnyBeaconState;
5-
const ReferenceCount = @import("../utils/reference_count.zig").ReferenceCount;
6-
const BeaconStateAllForks = @import("../types/beacon_state.zig").BeaconStateAllForks;
7-
const EFFECTIVE_BALANCE_INCREMENT = preset.EFFECTIVE_BALANCE_INCREMENT;
85
const RefCount = @import("../utils/ref_count.zig").RefCount;
96

107
pub const EffectiveBalanceIncrements = std.ArrayList(u16);

src/state_transition/cache/epoch_cache.zig

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@ const ForkTypes = @import("fork_types").ForkTypes;
4949

5050
const syncPubkeys = @import("./pubkey_cache.zig").syncPubkeys;
5151

52-
const RefCount = @import("../utils/ref_count.zig").RefCount;
53-
5452
pub const EpochCacheImmutableData = struct {
5553
config: *const BeaconConfig,
5654
pubkey_to_index: *PubkeyIndexMap,
@@ -66,10 +64,6 @@ const proposer_weight: f64 = @floatFromInt(c.PROPOSER_WEIGHT);
6664
const weight_denominator: f64 = @floatFromInt(c.WEIGHT_DENOMINATOR);
6765

6866
pub const proposer_weight_factor: f64 = proposer_weight / (weight_denominator - proposer_weight);
69-
/// an EpochCache is shared by multiple CachedBeaconStateAllForks instances
70-
/// a CachedBeaconStateAllForks should increase the reference count of EpochCache when it is created
71-
/// and decrease the reference count when it is deinitialized
72-
pub const EpochCacheRc = ReferenceCount(*EpochCache);
7367

7468
pub const EpochCache = struct {
7569
allocator: Allocator,

src/state_transition/cache/sync_committee_cache.zig

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ const SyncCommitteeIndices = std.ArrayList(u32);
1111
const SyncComitteeValidatorIndexMap = std.AutoHashMap(ValidatorIndex, SyncCommitteeIndices);
1212
const RefCount = @import("../utils/ref_count.zig").RefCount;
1313

14-
pub const SyncCommitteeCacheRc = ReferenceCount(SyncCommitteeCacheAllForks);
15-
pub const SyncCommitteeCacheRc = RefCount(SyncCommitteeCacheAllForks);
14+
pub const SyncCommitteeCacheRc = RefCount(SyncCommitteeCache);
1615

1716
/// EpochCache is the only consumer of this cache but an instance of SyncCommitteeCacheAllForks is shared across EpochCache instances
1817
/// no EpochCache instance takes the ownership of SyncCommitteeCacheAllForks instance
19-
/// instead of that, we count on reference counting to deallocate the memory, see ReferenceCount() utility
20-
pub const SyncCommitteeCacheAllForks = union(enum) {
18+
/// instead of that, we count on reference counting to deallocate the memory, see RefCount() utility
19+
pub const SyncCommitteeCache = union(enum) {
2120
phase0: void,
2221
altair: *SyncCommitteeCacheAltair,
2322

src/state_transition/utils/epoch_shuffling.zig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ const Epoch = types.primitive.Epoch.Type;
1111
const computeStartSlotAtEpoch = @import("./epoch.zig").computeStartSlotAtEpoch;
1212
const getBlockRootAtSlot = @import("./block_root.zig").getBlockRootAtSlot;
1313
const computeAnchorCheckpoint = @import("./anchor_checkpoint.zig").computeAnchorCheckpoint;
14-
const Epoch = ssz.primitive.Epoch.Type;
15-
const ReferenceCount = @import("./reference_count.zig").ReferenceCount;
1614
const RefCount = @import("./ref_count.zig").RefCount;
1715

1816
pub const EpochShufflingRc = RefCount(*EpochShuffling);

src/state_transition/utils/ref_count.zig

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,18 @@ pub fn RefCount(comptime T: type) type {
1919
return ptr;
2020
}
2121

22-
/// private deinit, consumer should call unref() instead
22+
/// private deinit, consumer should call release() instead
2323
fn deinit(self: *@This()) void {
2424
self.instance.deinit();
2525
self.allocator.destroy(self);
2626
}
2727

28-
/// caution: this returns a copy of the instance, make sure this does not have copy overhead
29-
/// or use pointer type instead
3028
pub fn get(self: *@This()) T {
3129
return self.instance;
3230
}
3331

3432
pub fn ref(self: *@This()) *@This() {
35-
_ = self._ref_count.fetchAdd(1, .acquire);
33+
_ = self._ref_count.fetchAdd(1, .monotonic);
3634
return self;
3735
}
3836

src/state_transition/utils/reference_count.zig

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)