Skip to content

bug: Negative timestamp and gasLimit wrap to huge uint64 values in MakeHeader #1039

@Aboudjem

Description

@Aboudjem

Bug Description

In rpc/types/utils.go, MakeHeader casts potentially negative values to uint64:

Time: uint64(header.Time.UTC().Unix()),

For pre-epoch timestamps, Unix() returns negative int64 which wraps to huge uint64 values.

Impact

Edge cases (clock skew, test chains, pre-epoch blocks) produce incorrect timestamps in eth_getBlockByNumber responses.

Proposed Fix

Clamp negative values to 0 before uint64 cast.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions