mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 11:41:19 +00:00
83d767c861
[devnet-8](https://notes.ethereum.org/@ethpandaops/dencun-devnet-8) doesn't include https://github.com/ethereum/EIPs/pull/7431 since it's rendered obsolete by upcoming https://github.com/ethereum/EIPs/pull/7456 (to be implemented by PR #8038). This reverts PR #7952.
24 lines
1.1 KiB
Go
24 lines
1.1 KiB
Go
package misc
|
|
|
|
import (
|
|
"github.com/holiman/uint256"
|
|
|
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
|
"github.com/ledgerwatch/erigon/consensus"
|
|
"github.com/ledgerwatch/erigon/core/state"
|
|
"github.com/ledgerwatch/erigon/core/types"
|
|
"github.com/ledgerwatch/erigon/params"
|
|
)
|
|
|
|
func ApplyBeaconRootEip4788(chain consensus.ChainHeaderReader, header *types.Header, state *state.IntraBlockState) {
|
|
historyStorageAddress := libcommon.BytesToAddress(params.HistoryStorageAddress)
|
|
historicalRootsModulus := params.HistoricalRootsModulus
|
|
timestampReduced := header.Time % historicalRootsModulus
|
|
timestampExtended := timestampReduced + historicalRootsModulus
|
|
timestampIndex := libcommon.BytesToHash((uint256.NewInt(timestampReduced)).Bytes())
|
|
rootIndex := libcommon.BytesToHash(uint256.NewInt(timestampExtended).Bytes())
|
|
parentBeaconBlockRootInt := *uint256.NewInt(0).SetBytes(header.ParentBeaconBlockRoot.Bytes())
|
|
state.SetState(historyStorageAddress, ×tampIndex, *uint256.NewInt(header.Time))
|
|
state.SetState(historyStorageAddress, &rootIndex, parentBeaconBlockRootInt)
|
|
}
|