Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated beacon root and modulus to match DRAFT eip #5941

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@
public interface ParentBeaconBlockRootHelper {

// Modulus to use for the timestamp to store the root
public static final long HISTORICAL_ROOTS_MODULUS = 98304;
public static final long HISTORY_BUFFER_LENGTH = 8191;
public static final Address BEACON_ROOTS_ADDRESS =
Address.fromHexString("0xbEAC020008aFF7331c0A389CB2AAb67597567d7a");
Address.fromHexString("0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02");

static void storeParentBeaconBlockRoot(
final WorldUpdater worldUpdater, final long timestamp, final Bytes32 root) {
/*
see EIP-4788: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-4788.md
*/
final long timestampReduced = timestamp % HISTORICAL_ROOTS_MODULUS;
final long timestampExtended = timestampReduced + HISTORICAL_ROOTS_MODULUS;
final long timestampReduced = timestamp % HISTORY_BUFFER_LENGTH;
final long timestampExtended = timestampReduced + HISTORY_BUFFER_LENGTH;

final UInt256 timestampIndex = UInt256.valueOf(timestampReduced);
final UInt256 rootIndex = UInt256.valueOf(timestampExtended);
Expand Down