Skip to content

Commit

Permalink
fix: v1.23.0 merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
twoeths committed Nov 18, 2024
1 parent 99c7b3d commit 961adaa
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {HashComputationGroup} from "@chainsafe/persistent-merkle-tree";
import {
CachedBeaconStateAllForks,
DataAvailableStatus,
Expand All @@ -12,7 +13,6 @@ import {nextEventLoop} from "../../util/eventLoop.js";
import {BlockError, BlockErrorCode} from "../errors/index.js";
import {BlockProcessOpts} from "../options.js";
import {BlockInput, ImportBlockOpts} from "./types.js";
import {HashComputationGroup} from "@chainsafe/persistent-merkle-tree";

/**
* Data in a BeaconBlock is bounded so we can use a single HashComputationGroup for all blocks
Expand Down
2 changes: 1 addition & 1 deletion packages/beacon-node/src/chain/prepareNextSlot.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {HashComputationGroup} from "@chainsafe/persistent-merkle-tree";
import {routes} from "@lodestar/api";
import {ChainForkConfig} from "@lodestar/config";
import {ForkExecution, ForkSeq, SLOTS_PER_EPOCH} from "@lodestar/params";
Expand All @@ -16,7 +17,6 @@ import {Metrics} from "../metrics/index.js";
import {ClockEvent} from "../util/clock.js";
import {isQueueErrorAborted} from "../util/queue/index.js";
import {ForkchoiceCaller} from "./forkChoice/index.js";
import {HashComputationGroup} from "@chainsafe/persistent-merkle-tree";
import {IBeaconChain} from "./interface.js";
import {getPayloadAttributesForSSE, prepareExecutionPayload} from "./produceBlock/produceBlockBody.js";
import {RegenCaller} from "./regen/index.js";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {HashComputationGroup} from "@chainsafe/persistent-merkle-tree";
import {
CachedBeaconStateAllForks,
DataAvailableStatus,
Expand All @@ -8,7 +9,6 @@ import {
import {BeaconBlock, BlindedBeaconBlock, Gwei, Root} from "@lodestar/types";
import {ZERO_HASH} from "../../constants/index.js";
import {Metrics} from "../../metrics/index.js";
import {HashComputationGroup} from "@chainsafe/persistent-merkle-tree";

/**
* Data in a BeaconBlock is bounded so we can use a single HashComputationGroup for all blocks
Expand Down
9 changes: 7 additions & 2 deletions packages/state-transition/src/cache/epochTransitionCache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import {Epoch, RootHex, ValidatorIndex} from "@lodestar/types";
import {intDiv, toRootHex} from "@lodestar/utils";

import {processPendingAttestations} from "../epoch/processPendingAttestations.js";
import {CachedBeaconStateAllForks, CachedBeaconStateAltair, CachedBeaconStatePhase0} from "../index.js";
import {
CachedBeaconStateAllForks,
CachedBeaconStateAltair,
CachedBeaconStatePhase0,
hasCompoundingWithdrawalCredential,
} from "../index.js";
import {computeBaseRewardPerIncrement} from "../util/altair.js";
import {
FLAG_CURR_HEAD_ATTESTER,
Expand Down Expand Up @@ -517,7 +522,7 @@ export function beforeProcessEpoch(
proposerIndices,
inclusionDelays,
flags,
validators,
isCompoundingValidatorArr,
// Will be assigned in processRewardsAndPenalties()
balances: undefined,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
HYSTERESIS_QUOTIENT,
HYSTERESIS_UPWARD_MULTIPLIER,
MAX_EFFECTIVE_BALANCE,
MAX_EFFECTIVE_BALANCE_ELECTRA,
MIN_ACTIVATION_BALANCE,
TIMELY_TARGET_FLAG_INDEX,
} from "@lodestar/params";
import {BeaconStateAltair, CachedBeaconStateAllForks, EpochTransitionCache} from "../types.js";
Expand Down Expand Up @@ -43,7 +45,7 @@ export function processEffectiveBalanceUpdates(
// and updated in processPendingDeposits() and processPendingConsolidations()
// so it's recycled here for performance.
const balances = cache.balances ?? state.balances.getAll();
const currentEpochValidators = cache.validators;
const {isCompoundingValidatorArr} = cache;

let numUpdate = 0;
for (let i = 0, len = balances.length; i < len; i++) {
Expand All @@ -58,7 +60,9 @@ export function processEffectiveBalanceUpdates(
effectiveBalanceLimit = MAX_EFFECTIVE_BALANCE;
} else {
// from electra, effectiveBalanceLimit is per validator
effectiveBalanceLimit = getMaxEffectiveBalance(currentEpochValidators[i].withdrawalCredentials);
// effectiveBalanceLimit = getMaxEffectiveBalance(currentEpochValidators[i].withdrawalCredentials);
const isCompoundingValidator = isCompoundingValidatorArr[i];
effectiveBalanceLimit = isCompoundingValidator ? MAX_EFFECTIVE_BALANCE_ELECTRA : MIN_ACTIVATION_BALANCE;
}

if (
Expand Down
1 change: 1 addition & 0 deletions packages/state-transition/src/stateTransition.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {HashComputationGroup} from "@chainsafe/persistent-merkle-tree";
import {SLOTS_PER_EPOCH} from "@lodestar/params";
import {SignedBeaconBlock, SignedBlindedBeaconBlock, Slot, ssz} from "@lodestar/types";
import {toRootHex} from "@lodestar/utils";
Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/phase0/listValidator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {ListCompositeType, ListCompositeTreeViewDU} from "@chainsafe/ssz";
import {Node} from "@chainsafe/persistent-merkle-tree";
import {ListCompositeTreeViewDU, ListCompositeType} from "@chainsafe/ssz";
import {ValidatorNodeStructType} from "./validator.js";
import {ListValidatorTreeViewDU} from "./viewDU/listValidator.js";

Expand Down
2 changes: 1 addition & 1 deletion packages/types/src/phase0/sszTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
VALIDATOR_REGISTRY_LIMIT,
} from "@lodestar/params";
import * as primitiveSsz from "../primitive/sszTypes.js";
import {ValidatorNodeStruct} from "./validator.js";
import {ListValidatorType} from "./listValidator.js";
import {ValidatorNodeStruct} from "./validator.js";

const {
Bytes32,
Expand Down
10 changes: 5 additions & 5 deletions packages/types/src/phase0/viewDU/listValidator.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {byteArrayIntoHashObject} from "@chainsafe/as-sha256";
import {HashComputationLevel, Node, digestNLevel, setNodesAtDepth} from "@chainsafe/persistent-merkle-tree";
import {
ListCompositeType,
ArrayCompositeTreeViewDUCache,
ListCompositeTreeViewDU,
ByteViews,
ContainerNodeStructTreeViewDU,
ListCompositeTreeViewDU,
ListCompositeType,
} from "@chainsafe/ssz";
import {HashComputationLevel, Node, digestNLevel, setNodesAtDepth} from "@chainsafe/persistent-merkle-tree";
import {byteArrayIntoHashObject} from "@chainsafe/as-sha256";
import {ValidatorNodeStructType, ValidatorType, validatorToChunkBytes} from "../validator.js";
import {ValidatorIndex} from "../../types.js";
import {ValidatorNodeStructType, ValidatorType, validatorToChunkBytes} from "../validator.js";

/**
* hashtree has a MAX_SIZE of 1024 bytes = 32 chunks
Expand Down

0 comments on commit 961adaa

Please sign in to comment.