mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-09 03:31:45 +00:00
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:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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: _,
|
||||
|
||||
Reference in New Issue
Block a user