mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 19:40:37 +00:00
Return historical roots in Capella state (#12642)
* Return historical roots in Capella state * test fix --------- Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
parent
405cd6ed86
commit
2217b45e16
@ -851,6 +851,10 @@ func BeaconStateCapellaToProto(st state.BeaconState) (*ethpbv2.BeaconStateCapell
|
||||
StateSummaryRoot: summary.StateSummaryRoot,
|
||||
}
|
||||
}
|
||||
hRoots, err := st.HistoricalRoots()
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "could not get historical roots")
|
||||
}
|
||||
|
||||
result := ðpbv2.BeaconStateCapella{
|
||||
GenesisTime: st.GenesisTime(),
|
||||
@ -925,6 +929,7 @@ func BeaconStateCapellaToProto(st state.BeaconState) (*ethpbv2.BeaconStateCapell
|
||||
NextWithdrawalIndex: sourceNextWithdrawalIndex,
|
||||
NextWithdrawalValidatorIndex: sourceNextWithdrawalValIndex,
|
||||
HistoricalSummaries: sourceHistoricalSummaries,
|
||||
HistoricalRoots: hRoots,
|
||||
}
|
||||
|
||||
return result, nil
|
||||
|
@ -727,6 +727,8 @@ func TestBeaconStateCapellaToProto(t *testing.T) {
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("blockroots"), 32), result.BlockRoots[0])
|
||||
assert.Equal(t, 8192, len(result.StateRoots))
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("stateroots"), 32), result.StateRoots[0])
|
||||
assert.Equal(t, 1, len(result.HistoricalRoots))
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("historicalroots"), 32), result.HistoricalRoots[0])
|
||||
resultEth1Data := result.Eth1Data
|
||||
require.NotNil(t, resultEth1Data)
|
||||
assert.DeepEqual(t, bytesutil.PadTo([]byte("e1ddepositroot"), 32), resultEth1Data.DepositRoot)
|
||||
|
Loading…
Reference in New Issue
Block a user