Today I did some light reading. Just starting out!
A few weeks back I submitted a PR for implementing the expected_withdrawals HTTP API in Lighthouse.
Issue
https://github.com/sigp/lighthouse/issues/4029
PR
https://github.com/sigp/lighthouse/pull/4390
Spec
https://github.com/ethereum/beacon-APIs/issues/301
Helpful link for beacon API specs
https://ethereum.github.io/beacon-APIs/
Today I received some feedback. I need to:
state.slot() + 1
builder_threshold
. might be good enough to just use ApiTesterConfig::default()?
I will update the list above as I complete these tasks
other notes:
cargo test --release tests::expected_withdrawals_valid_capella -- --nocapture
I received an email last night from Mario and Josh to schedule an interview for the EPF cohort #4! Super excited to chat with them, I'm going to spend the next few days making sure I'm ready for the interview. I also want to make sure I write down some questions I have about the cohort so I dont forget to ask.
Today I continued work on implementing the requested changes for the expected_withdrawals HTTP endpoint in Lighthouse.
I'm working specificially on the SSZ seralization portion. I left the following question in the Eth R&D discord
Hello, I have a question regarding the getNextWithdrawals spec
https://github.com/ethereum/beacon-APIs/commit/8fc2729b555ac03250731923a63d424d49cb8445
for the application/json response schema, we want to return a json object with the following properties
{ execution_optimistic: bool, finalized: bool, data: array of Withdrawals }
that all makes sense to me. however for application/octet-stream response type, the response schema is definied as
SSZ serialized Withdrawals list. Use Accept header to choose this response type
Does that mean, only the withdrawals list is ssz serialized?
execution_optimistic
andfinalized
wouldnt be part of the serialized response?
Based on my discussions in Eth R&D it seems that it is the case that, when ssz serialization is specified, execution_optimistic
and finalized
are not part of the serialized response.
This allowed me to progress with implementing SSZ serialization for this endpoint. The plan is to now submit my PR for an additional review tomorrow.
I cleaned up some of the code I was working on yesterday related to the expected withdrawals http endpoint. I also removed some unecessary configurations I made in my integration tests, i.e.:
check if expected_withdrawals_invalid_state test requires builder_threshold. might be good enough to just use ApiTesterConfig::default()?
I pushed up my changes, and pinged the lighthouse devs to inform them that my PR is ready. for another review.
Did a bunch of work on starting up the redb implementation is the slasher backend. I actually teamed up with a potential fellow to begin work on this! Here is our PR
https://github.com/sigp/lighthouse/pull/4430
I've added some notes here regarding the redb implementation
https://hackmd.io/6W9QPfw_TzyZT8nH6ub2dQ
I have some additional feedback regarding my PR for updating the Node health endpoint in Lighthouse to match the spec
PR: https://github.com/sigp/lighthouse/pull/4310
Issue: https://github.com/sigp/lighthouse/issues/4292
Spec: https://ethereum.github.io/beacon-APIs/#/Node/getHealth
I have some TODOs to work on:
Sync::Stalled
behaviourI ended up getting these fixes pushed up today for another review
Continued brainstorming and making progress on the redb implementation for the slasher backend
I have some additional feedback regarding my PR for implementing the expected_withdrawals HTTP API in Lighthouse.
https://github.com/sigp/lighthouse/pull/4390
I have some TODOs to work on:
let proposal_slot = query.proposal_slot.unwrap_or(state.slot() + 1);
One of the guys at lighthouse left the following comment on my PR
I wonder how far ahead of the prestate we should allow proposal_slot to be - if user provides a far future slot, we should probably return an error rather than computing it - although I haven't seen any specific number in the spec.
Looking at the prysm implementation of this endpoint they calculated a look ahead limit using MaxSeedLookahead
lookAheadLimit := uint64(params.BeaconConfig().SlotsPerEpoch.Mul(uint64(params.BeaconConfig().MaxSeedLookahead)))
and then returned an error if proposal slot >= state.slot + lookAheadlimit
I'm going to add this as a TODO
Two PRs were approved today for v4.3.0 of Lighthouse
PR: Update Node Health Endpoint
PR: Added debouncing and metric counting to logs
These are some of my biggest contributions to Lighthouse so far and I'm really excited that they will be part of v4.3.0.
I also completed the above TODOS for the expected withdrawls endpoint and pushed up my changes for another review. Hopefully this endpoint will also make it to v4.3.0
I recieved some more feedback regarding my PR for implementing the expected_withdrawals HTTP API in Lighthouse.
https://github.com/sigp/lighthouse/pull/4390
I'm a bit disappointed in myself, I should have caught some of these fixes. I really want to reduce the amount of back and forth needed for future pull requests so that I don't waste the core Lighthouse teams time.
I implemented changes based on the feedback that was given to me on Friday. I am now waiting for another review
I spent a good chunk of the day writing up a test redb db implementation using some of the interfaces that exist in lighthouse. I have issues with some of the types being used in the interfaces vs the types that the redb implementation expects. For example, REDB keys must impleement the std::Borrow interface, but the existing interface doesnt implement that. Changing the existing interface will make things backwords incompatible, which is a bit of an issue
I investigated what it would take to work on the following issue: https://github.com/sigp/lighthouse/issues/4457
This enables SSZ requests in the post beacon block endpoints. I added some comments regarding how I think it would work, and I may pick this issue up soon.
I started working on the following issue https://github.com/sigp/lighthouse/issues/4457
This will add SSZ support in the request body for beacon/blocks v1 and v2 endpoints. I broke up this feature into a few parts
I put together the new ssz route handlers, added the relevant logic to the existing http routing and began putting together some integration tests.
I'm having issues with de-decoding ssz SignedBeaconBlock
encoded data in my integration tests. I'm getting an exception when Decoding the data. In the SignedBeaconBlock
struct I added the Decode macro, which should allow me to decode appropriately formatted SignedBeaconBlock
data. I also had to change the the ssz enum behavior from transparent to union on this struct because of the Decode macro I added. I have a feeling this is whats causing the issue
Just to add some more info here: changing the ssz enum behavior from transaparent to union causes other related integration tests to fail. I think I need to step back and rethink how im decoding ssz encoded SignedBeaconBlock
data.
I spent Sunday and today continuing my work on adding SSZ support in the request body for beacon/blocks v1 and v2 endpoints. I was able to resolve the issues I was having decoding SignedBeaconBlock
data
Initially I had added the Decode macro to the SignedBeaconBlock
struct and attempted to decode the ssz data like so
let block = Decode::from_ssz_bytes(&block_bytes)?;
However this was throwing an exception. After some investigation, I realized there were existing functions to decode an SSZ encoded SignedBeaconBlock
let block = SignedBeaconBlock::<T::EthSpec>::from_ssz_bytes(
&block_bytes,
&chain.spec
)?
The fork name (provided in chain.spec
) has an affect on how SignedBeaconBlock
data should be ssz encoded/decoded.