Skip to content

Commit

Permalink
Merge pull request #53 from eth-protocol-fellows/main
Browse files Browse the repository at this point in the history
update week 2, add recordings
  • Loading branch information
taxmeifyoucan authored Feb 26, 2024
2 parents ab4a2f0 + b1322c4 commit 7a2119f
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 3 deletions.
125 changes: 125 additions & 0 deletions docs/eps/presentations/week2_notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Week 2 Lecture

## Overview

### Block Validation

go
func stf(parent types.Block, block types.Block, state state.StateDB) (state.StateDB, error) {
if err := core.VerifyHeaders(parent, block); err != nil {
// header error detected
return nil, err
}
for , tx := range block.Transactions() {
res, err := vm.Run(block.Header(), tx, state)
if err != nil {
// transaction invalid, block is invalid
return nil, err
}
state = res
}
return state, nil
}

func newPayload(execPayload engine.ExecutionPayload) bool {
if , err := stf(..); err != nil {
return false
}
return true
}

https://github.com/ethereum/go-ethereum/blob/63aaac81007ad46b208570c17cae78b7f60931d4/consensus/beacon/consensus.go#L229C23-L229C35

### Block Building

go
func build(env Environment, pool txpool.Pool, state state.StateDB) (types.Block, state.StateDB, error) {
var (
gasUsed = 0
txs []types.Transactions
)
for ; gasUsed < env.GasLimit || !pool.Empty(); {
tx := pool.Pop()
res, gas, err := vm.Run(env, tx, state)
if err != nil {
// tx invalid
continue
}
gasUsed += gas
txs = append(txs, tx)
state = res
}
return core.Finalize(env, txs, state)
}

### State Transition Function
* walkthrough go-ethereum

### EVM

* arithmetic
* bitwise
* environment
* control flow
* stack ops
* push, pop, swap
* system
* call, create, return, sstorge
* memory
* mload, mstore, mstore8

### p2p

* execution layer operates on devp2p
* devp2p => sub-capability eth/68, eth/69, snap, whisper, les, wit
* eth/1 -> eth/2 -> eth/6.1 -> eth/6.2

#### Responsibility

* historical data
* GetBlockHeader
* GetBlockBodies
* GetReceipts
* pending transactions
* Transactions
* NewPooledTransactionHashes
* GetPooledTransactions
* state
snap

R1 ->
/ \
x x
/ \ / \
a b c d

R200 ->
/ \
1 2
/ \ / \
r a c d

^^^ contiguous state retrieval

R200

a b c d


"healing phase"

* get R200 -> (1, 2)
* get 1 -> (r, a)

r a c d

* get 2 -> (c, d)

"healing done"


#### Start snap

* start weak subjectivity-checkpoint -> block hash
* get block associated with hash
* start snap against block's state
16 changes: 13 additions & 3 deletions docs/eps/week2.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

During the second week, we will dive into the Execution layer of Ethereum.

Come to see the presentation by [lightclient](https://twitter.com/lightclients/) on [Monday, February 26, 4PM UTC](https://savvytime.com/converter/utc-to-germany-berlin-united-kingdom-london-ny-new-york-city-ca-san-francisco-china-shanghai-japan-tokyo-australia-sydney/feb-26-2024/4pm).
Watch the presentation diving into EL internals with Lightclient on [StreamEth](https://streameth.org/watch?event=&session=65dcdef0a6d370a1ab326de1) or [Youtube](https://www.youtube.com/watch?v=pniTkWo70OY). The overview document is available here.

Watch the talk stream here: https://streameth.org/65cf97e702e803dbd57d823f/epf_study_group
[recording](https://streameth.org/embed/?playbackId=70f6rq6un48dy74q&vod=true&streamId=&playerName=Execution+Layer+Overview+%7C+lightclient+%7C+Week+2 ':include :type=iframe width=100% height=520 frameborder="0" allow="fullscreen" allowfullscreen')

For archive of the discussion during the talk, check [this thread](https://discord.com/channels/1205546645496795137/1210292746817110027/1210292751158222848) in our [Discord server](https://discord.gg/epfsg).

Join our [Discord group](https://discord.gg/epfsg) to ask questions and participate in discussion during the talk.

## Pre-reading

Expand Down Expand Up @@ -58,5 +59,14 @@ Additionally, you should read through the following documents to prepare for the

## Additional reading and exercises

- https://www.evm.codes/
- https://github.com/ethereum/go-ethereum
- https://github.com/ethereum/consensus-specs
- https://github.com/ethereum/execution-specs
- https://github.com/ethereum/devp2p
- https://github.com/ethereum/execution-apis
- https://blog.ethereum.org/2022/01/24/the-great-eth2-renaming
- https://blog.ethereum.org/2021/11/29/how-the-merge-impacts-app-layer
- [How The Execution Client and the Consensus Client Can Work Together](https://www.youtube.com/watch?v=91-GArv6lKo)

Lightclient's vim and shell setup https://github.com/lightclient/dotfiles

0 comments on commit 7a2119f

Please sign in to comment.