From 7aa6678cd46b1fa770f00923003a311a9d7a65da Mon Sep 17 00:00:00 2001 From: Tuyen Nguyen Date: Mon, 19 Aug 2024 13:59:54 +0700 Subject: [PATCH] fix: work around for sliceFrom() api --- packages/state-transition/src/block/processWithdrawals.ts | 3 +++ .../src/epoch/processPendingBalanceDeposits.ts | 3 +++ .../state-transition/src/epoch/processPendingConsolidations.ts | 3 +++ 3 files changed, 9 insertions(+) diff --git a/packages/state-transition/src/block/processWithdrawals.ts b/packages/state-transition/src/block/processWithdrawals.ts index e81c973e4558..7d5a52befb5d 100644 --- a/packages/state-transition/src/block/processWithdrawals.ts +++ b/packages/state-transition/src/block/processWithdrawals.ts @@ -55,6 +55,9 @@ export function processWithdrawals( if (fork >= ForkSeq.electra) { const stateElectra = state as CachedBeaconStateElectra; + // TODO: remove once this PR is included in a release + // https://github.com/ChainSafe/ssz/pull/394 + stateElectra.pendingPartialWithdrawals.getAllReadonly(); stateElectra.pendingPartialWithdrawals = stateElectra.pendingPartialWithdrawals.sliceFrom(partialWithdrawalsCount); } diff --git a/packages/state-transition/src/epoch/processPendingBalanceDeposits.ts b/packages/state-transition/src/epoch/processPendingBalanceDeposits.ts index 81da34349e53..44566acb4885 100644 --- a/packages/state-transition/src/epoch/processPendingBalanceDeposits.ts +++ b/packages/state-transition/src/epoch/processPendingBalanceDeposits.ts @@ -55,6 +55,9 @@ export function processPendingBalanceDeposits(state: CachedBeaconStateElectra, c nextDepositIndex++; } + // TODO: remove once this PR is included in a release + // https://github.com/ChainSafe/ssz/pull/394 + state.pendingBalanceDeposits.getAllReadonly(); const remainingPendingBalanceDeposits = state.pendingBalanceDeposits.sliceFrom(nextDepositIndex); state.pendingBalanceDeposits = remainingPendingBalanceDeposits; diff --git a/packages/state-transition/src/epoch/processPendingConsolidations.ts b/packages/state-transition/src/epoch/processPendingConsolidations.ts index d6f760a6b27a..a5e3ef4ce74f 100644 --- a/packages/state-transition/src/epoch/processPendingConsolidations.ts +++ b/packages/state-transition/src/epoch/processPendingConsolidations.ts @@ -47,5 +47,8 @@ export function processPendingConsolidations(state: CachedBeaconStateElectra, ca nextPendingConsolidation++; } + // TODO: remove once this PR is included in a release + // https://github.com/ChainSafe/ssz/pull/394 + state.pendingConsolidations.getAllReadonly(); state.pendingConsolidations = state.pendingConsolidations.sliceFrom(nextPendingConsolidation); }