## TLDR I worked on adding a LightClientUpdate database to prysm so the updates can be saved and retrieved upon request, not having to calculate them every time which takes a lot of time and energy. ## Recap of last week In the last two weeks I was mostly studying the prysm database and [bboltDB](https://github.com/etcd-io/bbolt) to be able to understand how things work. I theorized how to add the light client updates to the db, and went over the points with Radek. There are still parts left to figure out. ## What happened this week After getting a basic understanding of the prysm db, I started implementing the light client updates db bucket. I added a `LightClientUpdateBucket` to the [key value schema](https://github.com/prysmaticlabs/prysm/pull/14266/files#diff-83734c09415f136d49c86de869874d3e904c9e39c9e82ab66b1e9a0c0da88ed2R21). Then I defined three functions in the db interface: - [`LightClientUpdate(period int)`](https://github.com/prysmaticlabs/prysm/pull/14266/files#diff-f46b6b9fe1446ae49ea1a3a70f35958916008bcbbc23c417daa54c228368e2e5R62) - [`LightClientUpdates(startPeriod int, endPeriod int)`](https://github.com/prysmaticlabs/prysm/pull/14266/files#diff-f46b6b9fe1446ae49ea1a3a70f35958916008bcbbc23c417daa54c228368e2e5R61) - [`SaveLightClientUpdate(period int, update LightClientUpdateWithVersion)`](https://github.com/prysmaticlabs/prysm/pull/14266/files#diff-f46b6b9fe1446ae49ea1a3a70f35958916008bcbbc23c417daa54c228368e2e5R100) And implemented them in [`beacon-chain/db/kv/lightclient.go`](https://github.com/prysmaticlabs/prysm/pull/14266/files#diff-f55af4f4cf25ba8b39c7013ac07d7c609ae93d87e835ca522958cb1c6f2482de) Forgot to mention that I added a new struct [`LightClientUpdateWithVersion`](https://github.com/prysmaticlabs/prysm/pull/14266/files#diff-42a4d41a7867abcdef52ea7582f4562b60fa6ee4c6555dda547d528bce744727R72) since this is what the RPC should return, so it makes sense to save it in the db as is. I also added access to the previously mentioned functions in [the RPC APIs](https://github.com/prysmaticlabs/prysm/pull/14266/files#diff-efde9f352072c601a11370de845753056981742760cc0d0cbfb1677cd241521aR13) so it's possible to read the updates from the db upon request. ## What's next Next I will write tests for the kv functions. right now I'm stuck on this since I get an import cycle error when I want to use the functions in the `blockchain` package in the `kv` package, which are needed for me to run the tests. ## Other notes - We decided that the full nodes will only return lc updates younger than their starting sync point. So if you start syncing your node from slot N you will not be able to get light client updates for slots [0, (N-1)].