Skip to content

A mistyped exponentiation is used in ImportHistory (use correct uint64 max) #32935

@CertiK-Geth

Description

@CertiK-Geth

System information

Geth version: geth v1.16.5
OS & Version: Windows/Linux/OSX
Commit hash : master branch

Expected behaviour

ImportHistory should pass the maximum uint64 value (i.e. all-bits-set, 0xFFFFFFFFFFFFFFFF) as the limit to core.BlockChain.InsertReceiptChain so receipts import uses the intended unlimited range.

Actual behaviour

A mistyped expression intended as exponentiation (2^64-1) uses Go's ^ (bitwise XOR) operator instead of producing the max uint64. 2^64-1 evaluates to 65, so InsertReceiptChain receives an incorrect small limit, causing incorrect import behavior (failed/skipped receipts or wrong state).

Steps to reproduce the behaviour

A faster repro (static/runtime check): Add a small test or debug print calling the expression

fmt.Printf("%d\n", 2^64-1)

in a Go program — result is 65, not max uint64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions