attestantio / go-eth2-client

Apache License 2.0
102 stars 59 forks source link

Reject negative base fee per gas #114

Closed jtraglia closed 4 months ago

jtraglia commented 4 months ago

When unmarshaling execution payloads & payload headers, I noticed that a negative value could be provided which is greater than 32 bytes. When converting this to little endian bytes, it would panic:

--- FAIL: TestExecutionPayloadJSON (0.00s)
    --- FAIL: TestExecutionPayloadJSON/NegativeBaseFeePerGasGreaterThan32Bytes (0.00s)
panic: runtime error: index out of range [32] with length 32 [recovered]
    panic: runtime error: index out of range [32] with length 32