Add Electra fork boilerplate (#5122)

* Add Electra fork boilerplate

* Remove electra from spec tests

* Fix tests

* Remove sneaky log file

* Fix more tests

* Fix even more tests and add suggestions

* Remove unrelated lcli addition

* Update more tests

* Merge branch 'unstable' into electra

* Add comment for test-suite lcli override

* Merge branch 'unstable' into electra

* Cleanup

* Merge branch 'unstable' into electra

* Apply suggestions

* Merge branch 'unstable' into electra

* Merge sigp/unstable into electra

* Merge branch 'unstable' into electra
This commit is contained in:
Mac L
2024-04-02 23:35:02 +11:00
committed by GitHub
parent 3058b96f25
commit f8fdb71f50
105 changed files with 2079 additions and 405 deletions

View File

@@ -350,7 +350,9 @@ impl<T: BeaconChainTypes> NetworkBeaconProcessor<T> {
.epoch()
.map_or(self.chain.spec.max_request_blocks, |epoch| {
match self.chain.spec.fork_name_at_epoch(epoch) {
ForkName::Deneb => self.chain.spec.max_request_blocks_deneb,
ForkName::Deneb | ForkName::Electra => {
self.chain.spec.max_request_blocks_deneb
}
ForkName::Base | ForkName::Altair | ForkName::Merge | ForkName::Capella => {
self.chain.spec.max_request_blocks
}

View File

@@ -237,7 +237,7 @@ fn test_single_block_lookup_happy_path() {
let id = rig.expect_lookup_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_lookup_request(ResponseType::Blob);
}
@@ -285,7 +285,7 @@ fn test_single_block_lookup_empty_response() {
let id = rig.expect_lookup_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_lookup_request(ResponseType::Blob);
}
@@ -313,7 +313,7 @@ fn test_single_block_lookup_wrong_response() {
let id = rig.expect_lookup_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_lookup_request(ResponseType::Blob);
}
@@ -351,7 +351,7 @@ fn test_single_block_lookup_failure() {
let id = rig.expect_lookup_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_lookup_request(ResponseType::Blob);
}
@@ -383,7 +383,7 @@ fn test_single_block_lookup_becomes_parent_request() {
let id = rig.expect_lookup_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_lookup_request(ResponseType::Blob);
}
@@ -413,7 +413,7 @@ fn test_single_block_lookup_becomes_parent_request() {
rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
rig.expect_empty_network();
@@ -442,7 +442,7 @@ fn test_parent_lookup_happy_path() {
let id = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
@@ -493,7 +493,7 @@ fn test_parent_lookup_wrong_response() {
let id1 = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
@@ -559,7 +559,7 @@ fn test_parent_lookup_empty_response() {
let id1 = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
@@ -614,7 +614,7 @@ fn test_parent_lookup_rpc_failure() {
let id1 = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
@@ -676,7 +676,7 @@ fn test_parent_lookup_too_many_attempts() {
let id = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) && i == 1 {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) && i == 1 {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
match i % 2 {
@@ -755,7 +755,7 @@ fn test_parent_lookup_too_many_download_attempts_no_blacklist() {
let id = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) && i == 1 {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) && i == 1 {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
if i % 2 != 0 {
@@ -823,7 +823,7 @@ fn test_parent_lookup_too_many_processing_attempts_must_blacklist() {
let id = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) && i == 0 {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) && i == 0 {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
// The request fails. It should be tried again.
@@ -841,7 +841,7 @@ fn test_parent_lookup_too_many_processing_attempts_must_blacklist() {
// Now fail processing a block in the parent request
for i in 0..PROCESSING_FAILURES {
let id = dbg!(rig.expect_parent_request(response_type));
if matches!(fork_name, ForkName::Deneb) && i != 0 {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) && i != 0 {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
// If we're in deneb, a blob request should have been triggered as well,
@@ -901,7 +901,7 @@ fn test_parent_lookup_too_deep() {
let id = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
// the block
@@ -969,7 +969,7 @@ fn test_single_block_lookup_ignored_response() {
let id = rig.expect_lookup_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_lookup_request(ResponseType::Blob);
}
@@ -1024,7 +1024,7 @@ fn test_parent_lookup_ignored_response() {
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
@@ -1103,7 +1103,7 @@ fn test_same_chain_race_condition() {
let id = rig.expect_parent_request(response_type);
// If we're in deneb, a blob request should have been triggered as well,
// we don't require a response because we're generateing 0-blob blocks in this test.
if matches!(fork_name, ForkName::Deneb) {
if matches!(fork_name, ForkName::Deneb | ForkName::Electra) {
let _ = rig.expect_parent_request(ResponseType::Blob);
}
// the block

View File

@@ -530,7 +530,7 @@ mod tests {
panic!("Should have sent a batch request to the peer")
};
let blob_req_id = match fork_name {
ForkName::Deneb => {
ForkName::Deneb | ForkName::Electra => {
if let Ok(NetworkMessage::SendRequest {
peer_id,
request: _,