# EPF C4 - Tomás Arjovsky - Week 11
These are the updates for the week of 2023/09/25.
## First update
The first update is a bit short as monday was a holiday here. I've mostly been writing documentation so that new collaborators can better navigate the ethspecs when entering the project. I'll be publishing those asap!
I also had a technical discussion with Tomás Grüner on how to implement the request-response pattern in ports, as the PoC I built is mostly used for pubsub style communication.
I came up with a skeleton of an idea (without taking care of the encoding/decoding) that can be used to use the pubsub as a request response using the serialized pids as request ids:
```elixir=
def request(message) do
GenServer.cast(__MODULE__, {:request, self(), message})
receive do
response -> response
end
end
def handle_cast({:request, pid, message}, state) do
send_port(Map.put(message, :id, :erlang.term_to_binary(pid)))
{:noreply, state}
end
def handle_info(response, state) do
send(:erlang.binary_to_term(response.id), response)
end
```
Right now the PoC already uses UUIDs as request ids, so we might as well use this without much code change
## Second Update
### Nix
I updated nix so that it was compatible with OTP 26 and elixir 15, which are the versions that the latest OSX version requires. I tried the environment from scratch and tested that the app worked. [My PR](https://github.com/lambdaclass/lambda_ethereum_consensus/pull/246) was merged, so people that don't want to install all languages manually and globally, should now be able to bootstrap their environment very quickly with nix.
### Documentation updates
Updated the architecture diagrams to include a more realist interaction with levelDB, more similar to what we'll use on the next milestone.
```mermaid
graph LR
subgraph "Consensus Node"
engine[Engine API Client]
BAPI[Beacon API]
TICK[Slot processor]
blk_db[Block DB]
BS_db[Beacon State DB]
brod[Broadway]
FCTree[Fork choice tree - Genserver]
BAPI -->|Beacon state queries| BS_db
brod -->|Save blocks| blk_db
brod -->|Blocks and attestations| FCTree
TICK -->|New ticks| FCTree
BAPI --> engine
BAPI --> |head/slot requests| FCTree
brod --> |Save new states|BS_db
end
GOS[Gossip Protocols]
exec[Execution Client]
VALIDATOR[Validator]
engine <--> |payload validation, execution| exec
GOS -->|blocks, attestations| brod
VALIDATOR --> BAPI
```
This now reflects:
- There's no more "state transition server". Gossip protocol communicates with Broadway, which in turn calls `on_block` and `on_attestation` handlers. At a higher level, this means that state transition happens in broadway tasks and are not sequentialized unnecessarily. This is also supported by leveldb being thread-safe.
- Fork choice updates now go to the fork choice tree, which is a genserver holding the fork-choice data in memory. Eventually we'll add persistence for most of the fork-choice state.
- The DBs are logically separated in Beacon state and block DBs.