foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.25k stars 1.73k forks source link

`blockhash()` broken between `nightly-2044faec` and `nightly-b1e93654` #9198

Open adraffy opened 3 hours ago

adraffy commented 3 hours ago

Component

Anvil

Have you ensured that all of these are up to date?

What version of Foundry are you on?

No response

What command(s) is the bug in?

anvil

Operating System

None

Describe the bug

  1. foundryup -v nightly-2044faec64f99a21f0e5f0094458a973612d0712 blockhash(x) == keccak256(rlpEncodeBlock(x))

  2. foundryup -v nightly-b1e93654348a0f31effa34790adae18865b14aa8 ⚠️ blockhash(x) != keccak256(rlpEncodeBlock(x))

adraffy commented 3 hours ago

Diff: https://github.com/foundry-rs/foundry/compare/nightly-2044faec64f99a21f0e5f0094458a973612d0712...nightly-b1e93654348a0f31effa34790adae18865b14aa8

adraffy commented 3 hours ago

on 2044

const parts = [
  "0xa2f9a8897a7dd5f1a0ae653ce793b42548bf9e4401b3ec5070ac94c383caac1f",
  "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "0x0000000000000000000000000000000000000000",
  "0x5186dcad803ce44d801473eb727d4fecc20f759869d4a4daf3e71606c0d580bd",
  "0xa4f2579787fc3ffad5e146925c46fdeda1215edb484443c8bf9bc82f3e5ebc4f",
  "0xa53dd7e7f6147d1f1f6081694647a3e4057eb6553638829138c7204ef86c29a1",
  "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "0x",
  "0x04",
  "0x01c9c380",
  "0x0d921e",
  "0x671c6817",
  "0x",
  "0x0000000000000000000000000000000000000000000000000000000000000000",
  "0x0000000000000000",
  "0x29b2d57d",
  null,
  "0x",
  "0x",
  null
];
const rlp = `0xf90200a0a2f9a8897a7dd5f1a0ae653ce793b42548bf9e4401b3ec5070ac94c383caac1fa01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a05186dcad803ce44d801473eb727d4fecc20f759869d4a4daf3e71606c0d580bda0a4f2579787fc3ffad5e146925c46fdeda1215edb484443c8bf9bc82f3e5ebc4fa0a53dd7e7f6147d1f1f6081694647a3e4057eb6553638829138c7204ef86c29a1b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080048401c9c380830d921e84671c681780a000000000000000000000000000000000000000000000000000000000000000008800000000000000008429b2d57d808080`;
const hash = `0x6ba7a2ecef76fd6cefb179b9d7e469e9acb6ada08ae54809aef5b14c3d665d0a`

on b1e9

const parts = [
  "0x0f915aef13700d93f833d79fae367fc290265667680128c4444fcf4da71049c2",
  "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "0x0000000000000000000000000000000000000000",
  "0x19115cf7490ca6c5d6ab3e14ec8822899ef75706e164f580ba081939fdd465c6",
  "0xa4f2579787fc3ffad5e146925c46fdeda1215edb484443c8bf9bc82f3e5ebc4f",
  "0xa53dd7e7f6147d1f1f6081694647a3e4057eb6553638829138c7204ef86c29a1",
  "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "0x",
  "0x04",
  "0x01c9c380",
  "0x0d921e",
  "0x671c687e",
  "0x",
  "0x0000000000000000000000000000000000000000000000000000000000000000",
  "0x0000000000000000",
  "0x29b2d57d",
  null,
  "0x",
  "0x",
  null
];
const rlp = `0xf90200a00f915aef13700d93f833d79fae367fc290265667680128c4444fcf4da71049c2a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a019115cf7490ca6c5d6ab3e14ec8822899ef75706e164f580ba081939fdd465c6a0a4f2579787fc3ffad5e146925c46fdeda1215edb484443c8bf9bc82f3e5ebc4fa0a53dd7e7f6147d1f1f6081694647a3e4057eb6553638829138c7204ef86c29a1b901000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080048401c9c380830d921e84671c687e80a000000000000000000000000000000000000000000000000000000000000000008800000000000000008429b2d57d808080`;
// keccak256(rlp)
const hash1 = `0x846f24652b2f79182e55f2f6d74ab36c1b5cab6893113658f69a0bf326509cb1`;
// eth_getBlock(x).hash or blockhash(x)
const hash2 = `0xa53dd7e7f6147d1f1f6081694647a3e4057eb6553638829138c7204ef86c29a1`