Hello everyone! I'm Ankur and am excited to participate in the 4th cohort of the fellowship as a permissionless participant! Since I have a full-time job I plan to contribute in the mornings of my weekdays and primarily on the weekends.
I'm highly interested in working on the Lighthouse consensus client, and the project on optimising attestation aggregation looks very interesting to me. I've decided work on this project for this fellowship.
I'll use this note to document my updates prior to the fellowship officially kicking off, over a period of 2 weeks.
The majority of this week was spent learning Rust from scratch. The Rust Book was my primary reading material here, and videos from NoBoilerplate to get a general sense of the ideology behind Rust.
I then solved a few challenges from the Advent of Code 2022 in Rust to get a hang of things, the solutions to which can be found here.
Coming from a Typescript background, I was very curious about the concurrency models supported by Rust. I was surpised to learn that pretty much everything is possible, and EventLoop style concurrency is supported via custom community maintained runtimes like Tokio. I reviewed the Async Book to get a general understanding of Rust's support for async/.await, and also spent some time playing around with Messaging Passing style of concurrency via channels. In the coming weeks I would be interested in trying out the Shared Memory style of concurrency as well.
The next section of the week was spent learning about how the Ethereum Beacon Chain works. I started by getting a basic understanding from ethereum.org's documentation and then reviewed the articles linked below. A major goal of this was to understand what Attestations are, their aggregation - when/why it's necessary and any other constraints.
Finally, the remainder of the week was spent understanding how Attestation Aggregations are currently implemented in Lighthouse. The current implementation is based on a greedy approach to the maximum weighted coverage problem. I was able to develop a high level understanding of the algorithm. Some of the other articles I reviewed:
Satalia has provided 3 excellent documents focussing on the following:
I have gone through the papers a few times, and I feel I have a working understanding of the proposed solution to the aggregation stage.
The articles from Sigma Prime's blog 1 and 2 were also very helpful, particularly the first one which contains an analysis of the attestation packing efficiencies of various points at the time the article was published.
Given that the project heavily utilizes graphs and associated algorithms, I figured it might be a good idea to try to implement a few basic graph algorithms in Rust myself. It turns out that representing graphs in Rust is not trivial, and requires careful thought to prevent dependency cycles, and also requires using smart pointers like Rc<> for managing multiple ownership and RefCell<> for allowing mutation of Nodes after they have been allocated.
I implemented a simple DFS in Rust here, utilizing a combination of Rc<> and Weak<> to prevent depenedency cycles. I put it up for review with my Twitter connections and received a lot of feedback on improvements which I plan to play around with this week.
I was also suggested to go through Learn Rust With Entirely Too Many Linked Lists. This book is really great for understanding pointers and memory management, I'm halfway through this book currently.
I was able to setup the Lighthouse codebase locally, run the test-cases and also use the start_local_testnet.sh
script to run a few instances of lighthouse and an instance of geth. I had a few hiccups with a few libraries missing, but I was able to find them on brew.
While reviewing Satalia's reference implementation, I noticed that they were using a few outdated feature gates because of which the code wasn't compiling with latest rust nightly tool-chain. I submitted a small fix to update the reference implementation. @michaelsproul suggested that we should migrate the code to stable rust, as a crate inside Lighthouse. I agree with this and this is something which Geemo suggested as well.
I've been having a lot of fun learning Rust, the more I learn the more I appreciate the language, tho I'm still figthing the borrow checker from time to time. The Learn Rust With Entirely Too Many Linked Lists book is really well written and has been an awesome read so far.
I attended the EPF4 Kickoff Call today, and am really excited given that the fellowship has officially kicked-off. Mario gave a really great overview of the history of Ethereum.
So this wil be all for this document, Week 1 has officially started 🎊 so going forward I'll be documenting my updates on a weekly basis.