lodestar icon indicating copy to clipboard operation
lodestar copied to clipboard

Support eventstream example (bls_to_execution_change) from recent beacon API test suite

Open jeluard opened this issue 1 year ago • 5 comments

Beacon APIs v2.4.0 introduce a new eventstream example that do not pass currently on lodestar.

  1) eventstream event data
       bls_to_execution_change:

      eventTestData[bls_to_execution_change] does not match spec's example
      + expected - actual

       {
         "message": {
      -    "from_bls_pubkey": "0x9048a71944feba4695ef870dfb5745c934d81c5efd934c0250a12942fcc2a2dfd6b20d53314379dec7aae5ca5fe9e9c4"
      -    "to_execution_address": "0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
      +    "from_bls_pubkey": "0x933ad9491b62059dd065b560d256d8957a8c402cc6e8d8ee7290ae11e8f7329267a8811c397529dac52ae1342ba58c95"
      +    "to_execution_address": "0x9be8d619c56699667c1fedcd15f6b14d8B067f72"
           "validator_index": "1"
         }
         "signature": "0x1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505cc411d61252fb6cb3fa0017b679f8bb2305b26a285fa2737f175668d0dff91cc1b66ac1fb663c9bc59509846d6ec05345bd908eda73e670af888da41af171505"
       }

jeluard avatar Dec 08 '23 10:12 jeluard

Updating test data here should fix this https://github.com/ChainSafe/lodestar/blob/53378e1e08f5947bfe119c07c9b8211117f34cd9/packages/api/test/unit/beacon/testData/events.ts#L52-L57

nflaig avatar Dec 08 '23 11:12 nflaig

Updating the test data doesn't entirely fix the test. Namely, "to_execution_address": "0x9be8d619c56699667c1fedcd15f6b14d8B067f72" gets changed during the round-trip into "to_execution_address": "0x9be8d619c56699667c1fedcd15f6b14d8b067f72" (notice the only uppercase letter is now lower case). hex encoding is not case aware and all letters are deserialized into lower-cases.

It's not yet clear what the best fix would be.

jeluard avatar Dec 15 '23 16:12 jeluard

It's not yet clear what the best fix would be.

Let's just make the spec example address all lowercase?

nflaig avatar Dec 15 '23 16:12 nflaig

Related to https://github.com/ethereum/beacon-APIs/pull/395

jeluard avatar Dec 16 '23 08:12 jeluard

Would definitely prefer checksummed also as good standard practice. There's a lot of copying/pasting with these addresses and we should do our part to steward this practice. My preference is https://github.com/ethereum/beacon-APIs/pull/396 over 395. Thanks for opening the PRs.

philknows avatar Dec 19 '23 20:12 philknows