Skip to content

Commit 1aa410c

Browse files
committed
Merge branch 'electra-epoch-proc' of https://github.com/sigp/lighthouse into electra-engine-api
2 parents 8e537d1 + 57b6a9a commit 1aa410c

File tree

110 files changed

+2283
-1660
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+2283
-1660
lines changed

.github/workflows/test-suite.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,31 @@ env:
2929
# Enable portable to prevent issues with caching `blst` for the wrong CPU type
3030
TEST_FEATURES: portable
3131
jobs:
32+
check-labels:
33+
runs-on: ubuntu-latest
34+
name: Check for 'skip-ci' label
35+
outputs:
36+
skip_ci: ${{ steps.set-output.outputs.SKIP_CI }}
37+
steps:
38+
- name: check for skip-ci label
39+
id: set-output
40+
env:
41+
LABELS: ${{ toJson(github.event.pull_request.labels) }}
42+
run: |
43+
SKIP_CI="false"
44+
if [ -z "${LABELS}" ]; then
45+
LABELS="none";
46+
else
47+
LABELS=$(echo ${LABELS} | jq -r '.[].name')
48+
fi
49+
for label in ${LABELS}; do
50+
if [ "$label" = "skip-ci" ]; then
51+
SKIP_CI="true"
52+
break
53+
fi
54+
done
55+
echo "::set-output name=skip_ci::$SKIP_CI"
56+
3257
target-branch-check:
3358
name: target-branch-check
3459
runs-on: ubuntu-latest
@@ -38,6 +63,8 @@ jobs:
3863
run: test ${{ github.base_ref }} != "stable"
3964
release-tests-ubuntu:
4065
name: release-tests-ubuntu
66+
needs: [check-labels]
67+
if: needs.check-labels.outputs.skip_ci != 'true'
4168
# Use self-hosted runners only on the sigp repo.
4269
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }}
4370
steps:
@@ -63,6 +90,8 @@ jobs:
6390
run: sccache --show-stats
6491
release-tests-windows:
6592
name: release-tests-windows
93+
needs: [check-labels]
94+
if: needs.check-labels.outputs.skip_ci != 'true'
6695
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "windows", "CI"]') || 'windows-2019' }}
6796
steps:
6897
- uses: actions/checkout@v4
@@ -97,6 +126,8 @@ jobs:
97126
run: sccache --show-stats
98127
beacon-chain-tests:
99128
name: beacon-chain-tests
129+
needs: [check-labels]
130+
if: needs.check-labels.outputs.skip_ci != 'true'
100131
# Use self-hosted runners only on the sigp repo.
101132
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }}
102133
env:
@@ -117,6 +148,8 @@ jobs:
117148
run: sccache --show-stats
118149
op-pool-tests:
119150
name: op-pool-tests
151+
needs: [check-labels]
152+
if: needs.check-labels.outputs.skip_ci != 'true'
120153
runs-on: ubuntu-latest
121154
env:
122155
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -132,6 +165,8 @@ jobs:
132165
run: make test-op-pool
133166
network-tests:
134167
name: network-tests
168+
needs: [check-labels]
169+
if: needs.check-labels.outputs.skip_ci != 'true'
135170
runs-on: ubuntu-latest
136171
env:
137172
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -147,6 +182,8 @@ jobs:
147182
run: make test-network
148183
slasher-tests:
149184
name: slasher-tests
185+
needs: [check-labels]
186+
if: needs.check-labels.outputs.skip_ci != 'true'
150187
runs-on: ubuntu-latest
151188
env:
152189
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -162,6 +199,8 @@ jobs:
162199
run: make test-slasher
163200
debug-tests-ubuntu:
164201
name: debug-tests-ubuntu
202+
needs: [check-labels]
203+
if: needs.check-labels.outputs.skip_ci != 'true'
165204
# Use self-hosted runners only on the sigp repo.
166205
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "large"]') || 'ubuntu-latest' }}
167206
env:
@@ -186,6 +225,8 @@ jobs:
186225
run: sccache --show-stats
187226
state-transition-vectors-ubuntu:
188227
name: state-transition-vectors-ubuntu
228+
needs: [check-labels]
229+
if: needs.check-labels.outputs.skip_ci != 'true'
189230
runs-on: ubuntu-latest
190231
steps:
191232
- uses: actions/checkout@v4
@@ -198,6 +239,8 @@ jobs:
198239
run: make run-state-transition-tests
199240
ef-tests-ubuntu:
200241
name: ef-tests-ubuntu
242+
needs: [check-labels]
243+
if: needs.check-labels.outputs.skip_ci != 'true'
201244
# Use self-hosted runners only on the sigp repo.
202245
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "small"]') || 'ubuntu-latest' }}
203246
env:
@@ -218,6 +261,8 @@ jobs:
218261
run: sccache --show-stats
219262
dockerfile-ubuntu:
220263
name: dockerfile-ubuntu
264+
needs: [check-labels]
265+
if: needs.check-labels.outputs.skip_ci != 'true'
221266
runs-on: ubuntu-latest
222267
steps:
223268
- uses: actions/checkout@v4
@@ -227,6 +272,8 @@ jobs:
227272
run: docker run -t lighthouse:local lighthouse --version
228273
basic-simulator-ubuntu:
229274
name: basic-simulator-ubuntu
275+
needs: [check-labels]
276+
if: needs.check-labels.outputs.skip_ci != 'true'
230277
runs-on: ubuntu-latest
231278
steps:
232279
- uses: actions/checkout@v4
@@ -239,6 +286,8 @@ jobs:
239286
run: cargo run --release --bin simulator basic-sim
240287
fallback-simulator-ubuntu:
241288
name: fallback-simulator-ubuntu
289+
needs: [check-labels]
290+
if: needs.check-labels.outputs.skip_ci != 'true'
242291
runs-on: ubuntu-latest
243292
steps:
244293
- uses: actions/checkout@v4
@@ -251,6 +300,8 @@ jobs:
251300
run: cargo run --release --bin simulator fallback-sim
252301
doppelganger-protection-test:
253302
name: doppelganger-protection-test
303+
needs: [check-labels]
304+
if: needs.check-labels.outputs.skip_ci != 'true'
254305
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "small"]') || 'ubuntu-latest' }}
255306
env:
256307
# Enable portable to prevent issues with caching `blst` for the wrong CPU type
@@ -285,6 +336,8 @@ jobs:
285336
./doppelganger_protection.sh success genesis.json
286337
execution-engine-integration-ubuntu:
287338
name: execution-engine-integration-ubuntu
339+
needs: [check-labels]
340+
if: needs.check-labels.outputs.skip_ci != 'true'
288341
runs-on: ${{ github.repository == 'sigp/lighthouse' && fromJson('["self-hosted", "linux", "CI", "small"]') || 'ubuntu-latest' }}
289342
steps:
290343
- uses: actions/checkout@v4
@@ -330,6 +383,8 @@ jobs:
330383
run: make audit-CI
331384
- name: Run cargo vendor to make sure dependencies can be vendored for packaging, reproducibility and archival purpose
332385
run: CARGO_HOME=$(readlink -f $HOME) make vendor
386+
- name: Markdown-linter
387+
run: make mdlint
333388
check-msrv:
334389
name: check-msrv
335390
runs-on: ubuntu-latest
@@ -344,6 +399,8 @@ jobs:
344399
run: cargo check --workspace
345400
cargo-udeps:
346401
name: cargo-udeps
402+
needs: [check-labels]
403+
if: needs.check-labels.outputs.skip_ci != 'true'
347404
runs-on: ubuntu-latest
348405
steps:
349406
- uses: actions/checkout@v4
@@ -366,6 +423,8 @@ jobs:
366423
RUSTFLAGS: ""
367424
compile-with-beta-compiler:
368425
name: compile-with-beta-compiler
426+
needs: [check-labels]
427+
if: needs.check-labels.outputs.skip_ci != 'true'
369428
runs-on: ubuntu-latest
370429
steps:
371430
- uses: actions/checkout@v4
@@ -377,6 +436,8 @@ jobs:
377436
run: make
378437
cli-check:
379438
name: cli-check
439+
needs: [check-labels]
440+
if: needs.check-labels.outputs.skip_ci != 'true'
380441
runs-on: ubuntu-latest
381442
steps:
382443
- uses: actions/checkout@v4
@@ -391,8 +452,10 @@ jobs:
391452
# a PR is safe to merge. New jobs should be added here.
392453
test-suite-success:
393454
name: test-suite-success
455+
if: needs.check-labels.outputs.skip_ci != 'true'
394456
runs-on: ubuntu-latest
395457
needs: [
458+
'check-labels',
396459
'target-branch-check',
397460
'release-tests-ubuntu',
398461
'release-tests-windows',

CONTRIBUTING.md

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Contributors Guide
2+
23
[![GitPOAP badge](https://public-api.gitpoap.io/v1/repo/sigp/lighthouse/badge)](https://www.gitpoap.io/gh/sigp/lighthouse)
34

4-
Lighthouse is an open-source Ethereum 2.0 client. We're community driven and
5+
Lighthouse is an open-source Ethereum consensus client. We're community driven and
56
welcome all contribution. We aim to provide a constructive, respectful and fun
67
environment for collaboration.
78

8-
We are active contributors to the [Ethereum 2.0 specification](https://github.com/ethereum/eth2.0-specs) and attend all [Eth
9-
2.0 implementers calls](https://github.com/ethereum/eth2.0-pm).
9+
We are active contributors to
10+
the [Ethereum Proof-of-Stake Consensus specification](https://github.com/ethereum/consensus-specs) and attend
11+
all [Ethereum implementers calls](https://github.com/ethereum/pm/).
1012

1113
This guide is geared towards beginners. If you're an open-source veteran feel
1214
free to just skim this document and get straight into crushing issues.
@@ -41,21 +43,21 @@ We recommend the following work-flow for contributors:
4143

4244
1. **Find an issue** to work on, either because it's interesting or suitable to
4345
your skill-set. Use comments to communicate your intentions and ask
44-
questions.
46+
questions.
4547
2. **Work in a feature branch** of your personal fork
4648
(github.com/YOUR_NAME/lighthouse) of the main repository
4749
(github.com/sigp/lighthouse).
4850
3. Once you feel you have addressed the issue, **create a pull-request** with
4951
`unstable` as the base branch to merge your changes into the main repository.
5052
4. Wait for the repository maintainers to **review your changes** to ensure the
5153
issue is addressed satisfactorily. Optionally, mention your PR on
52-
[discord](https://discord.gg/cyAszAh).
54+
[discord](https://discord.gg/cyAszAh).
5355
5. If the issue is addressed the repository maintainers will **merge your
5456
pull-request** and you'll be an official contributor!
5557

5658
Generally, you find an issue you'd like to work on and announce your intentions
5759
to start work in a comment on the issue. Then, do your work on a separate
58-
branch (a "feature branch") in your own fork of the main repository. Once
60+
branch (a "feature branch") in your own fork of the main repository. Once
5961
you're happy and you think the issue has been addressed, create a pull request
6062
into the main repository.
6163

@@ -66,18 +68,20 @@ steps:
6668

6769
1. [Create a
6870
fork](https://help.github.com/articles/fork-a-repo/#fork-an-example-repository)
69-
and [clone
70-
it](https://help.github.com/articles/fork-a-repo/#step-2-create-a-local-clone-of-your-fork)
71-
to your local machine.
71+
and [clone
72+
it](https://help.github.com/articles/fork-a-repo/#step-2-create-a-local-clone-of-your-fork)
73+
to your local machine.
7274
2. [Add an _"upstream"_
7375
branch](https://help.github.com/articles/fork-a-repo/#step-3-configure-git-to-sync-your-fork-with-the-original-spoon-knife-repository)
74-
that tracks github.com/sigp/lighthouse using `$ git remote add upstream
75-
https://github.com/sigp/lighthouse.git` (pro-tip: [use SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) instead of HTTPS).
76+
that tracks github.com/sigp/lighthouse using `$ git remote add upstream
77+
https://github.com/sigp/lighthouse.git` (
78+
pro-tip: [use SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) instead of HTTPS).
7679
3. Create a new feature branch with `$ git checkout -b your_feature_name`. The
7780
name of your branch isn't critical but it should be short and instructive.
78-
E.g., if you're fixing a bug with serialization, you could name your branch
79-
`fix_serialization_bug`.
80-
4. Make sure you sign your commits. See [relevant doc](https://help.github.com/en/github/authenticating-to-github/about-commit-signature-verification).
81+
E.g., if you're fixing a bug with serialization, you could name your branch
82+
`fix_serialization_bug`.
83+
4. Make sure you sign your commits.
84+
See [relevant doc](https://help.github.com/en/github/authenticating-to-github/about-commit-signature-verification).
8185
5. Commit your changes and push them to your fork with `$ git push origin
8286
your_feature_name`.
8387
6. Go to your fork on github.com and use the web interface to create a pull
@@ -92,22 +96,28 @@ by Rob Allen that provides much more detail on each of these steps, if you're
9296
having trouble. As always, jump on [discord](https://discord.gg/cyAszAh)
9397
if you get stuck.
9498

99+
Additionally,
100+
the ["Contributing to Lighthouse" section](https://lighthouse-book.sigmaprime.io/contributing.html#contributing-to-lighthouse)
101+
of the Lighthouse Book provides more details on the setup.
95102

96103
## FAQs
97104

98105
### I don't think I have anything to add
99106

100107
There's lots to be done and there's all sorts of tasks. You can do anything
101-
from correcting typos through to writing core consensus code. If you reach out,
108+
from enhancing documentation through to writing core consensus code. If you reach out,
102109
we'll include you.
103110

111+
Please note, to maintain project quality, we may not accept PRs for small typos or changes
112+
with minimal impact.
113+
104114
### I'm not sure my Rust is good enough
105115

106116
We're open to developers of all levels. If you create a PR and your code
107117
doesn't meet our standards, we'll help you fix it and we'll share the reasoning
108118
with you. Contributing to open-source is a great way to learn.
109119

110-
### I'm not sure I know enough about Ethereum 2.0
120+
### I'm not sure I know enough about Ethereum
111121

112122
No problems, there's plenty of tasks that don't require extensive Ethereum
113123
knowledge. You can learn about Ethereum as you go.

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ cli:
214214
cli-local:
215215
make && ./scripts/cli.sh
216216

217+
# Check for markdown files
218+
mdlint:
219+
./scripts/mdlint.sh
220+
217221
# Runs the entire test suite, downloading test vectors if required.
218222
test-full: cargo-fmt test-release test-debug test-ef test-exec-engine
219223

beacon_node/beacon_chain/src/beacon_chain.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2821,6 +2821,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
28212821
signature_verified_block.block_root(),
28222822
signature_verified_block,
28232823
notify_execution_layer,
2824+
BlockImportSource::RangeSync,
28242825
|| Ok(()),
28252826
)
28262827
.await
@@ -3003,16 +3004,21 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
30033004
self: &Arc<Self>,
30043005
block_root: Hash256,
30053006
unverified_block: B,
3007+
block_source: BlockImportSource,
30063008
notify_execution_layer: NotifyExecutionLayer,
30073009
) -> Result<AvailabilityProcessingStatus, BlockError<T::EthSpec>> {
30083010
self.reqresp_pre_import_cache
30093011
.write()
30103012
.insert(block_root, unverified_block.block_cloned());
30113013

30123014
let r = self
3013-
.process_block(block_root, unverified_block, notify_execution_layer, || {
3014-
Ok(())
3015-
})
3015+
.process_block(
3016+
block_root,
3017+
unverified_block,
3018+
notify_execution_layer,
3019+
block_source,
3020+
|| Ok(()),
3021+
)
30163022
.await;
30173023
self.remove_notified(&block_root, r)
30183024
}
@@ -3035,6 +3041,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
30353041
block_root: Hash256,
30363042
unverified_block: B,
30373043
notify_execution_layer: NotifyExecutionLayer,
3044+
block_source: BlockImportSource,
30383045
publish_fn: impl FnOnce() -> Result<(), BlockError<T::EthSpec>> + Send + 'static,
30393046
) -> Result<AvailabilityProcessingStatus, BlockError<T::EthSpec>> {
30403047
// Start the Prometheus timer.
@@ -3095,6 +3102,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
30953102
"Beacon block imported";
30963103
"block_root" => ?block_root,
30973104
"block_slot" => block_slot,
3105+
"source" => %block_source,
30983106
);
30993107

31003108
// Increment the Prometheus counter for block processing successes.

beacon_node/beacon_chain/src/block_verification.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1382,18 +1382,20 @@ impl<T: BeaconChainTypes> ExecutionPendingBlock<T> {
13821382
let catchup_timer = metrics::start_timer(&metrics::BLOCK_PROCESSING_CATCHUP_STATE);
13831383

13841384
// Stage a batch of operations to be completed atomically if this block is imported
1385-
// successfully. We include the state root of the pre-state, which may be an advanced state
1386-
// that was stored in the DB with a `temporary` flag.
1385+
// successfully. If there is a skipped slot, we include the state root of the pre-state,
1386+
// which may be an advanced state that was stored in the DB with a `temporary` flag.
13871387
let mut state = parent.pre_state;
13881388

1389-
let mut confirmed_state_roots = if state.slot() > parent.beacon_block.slot() {
1390-
// Advanced pre-state. Delete its temporary flag.
1391-
let pre_state_root = state.update_tree_hash_cache()?;
1392-
vec![pre_state_root]
1393-
} else {
1394-
// Pre state is parent state. It is already stored in the DB without temporary status.
1395-
vec![]
1396-
};
1389+
let mut confirmed_state_roots =
1390+
if block.slot() > state.slot() && state.slot() > parent.beacon_block.slot() {
1391+
// Advanced pre-state. Delete its temporary flag.
1392+
let pre_state_root = state.update_tree_hash_cache()?;
1393+
vec![pre_state_root]
1394+
} else {
1395+
// Pre state is either unadvanced, or should not be stored long-term because there
1396+
// is no skipped slot between `parent` and `block`.
1397+
vec![]
1398+
};
13971399

13981400
// The block must have a higher slot than its parent.
13991401
if block.slot() <= parent.beacon_block.slot() {

0 commit comments

Comments
 (0)