@ -437,6 +437,9 @@ func assertOwnChain(t *testing.T, tester *downloadTester, length int) {
func TestCanonicalSynchronisation66Full ( t * testing . T ) { testCanonSync ( t , eth . ETH66 , FullSync ) }
func TestCanonicalSynchronisation66Snap ( t * testing . T ) { testCanonSync ( t , eth . ETH66 , SnapSync ) }
func TestCanonicalSynchronisation66Light ( t * testing . T ) { testCanonSync ( t , eth . ETH66 , LightSync ) }
func TestCanonicalSynchronisation67Full ( t * testing . T ) { testCanonSync ( t , eth . ETH67 , FullSync ) }
func TestCanonicalSynchronisation67Snap ( t * testing . T ) { testCanonSync ( t , eth . ETH67 , SnapSync ) }
func TestCanonicalSynchronisation67Light ( t * testing . T ) { testCanonSync ( t , eth . ETH67 , LightSync ) }
func testCanonSync ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -457,6 +460,8 @@ func testCanonSync(t *testing.T, protocol uint, mode SyncMode) {
// until the cached blocks are retrieved.
func TestThrottling66Full ( t * testing . T ) { testThrottling ( t , eth . ETH66 , FullSync ) }
func TestThrottling66Snap ( t * testing . T ) { testThrottling ( t , eth . ETH66 , SnapSync ) }
func TestThrottling67Full ( t * testing . T ) { testThrottling ( t , eth . ETH67 , FullSync ) }
func TestThrottling67Snap ( t * testing . T ) { testThrottling ( t , eth . ETH67 , SnapSync ) }
func testThrottling ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -537,6 +542,9 @@ func testThrottling(t *testing.T, protocol uint, mode SyncMode) {
func TestForkedSync66Full ( t * testing . T ) { testForkedSync ( t , eth . ETH66 , FullSync ) }
func TestForkedSync66Snap ( t * testing . T ) { testForkedSync ( t , eth . ETH66 , SnapSync ) }
func TestForkedSync66Light ( t * testing . T ) { testForkedSync ( t , eth . ETH66 , LightSync ) }
func TestForkedSync67Full ( t * testing . T ) { testForkedSync ( t , eth . ETH67 , FullSync ) }
func TestForkedSync67Snap ( t * testing . T ) { testForkedSync ( t , eth . ETH67 , SnapSync ) }
func TestForkedSync67Light ( t * testing . T ) { testForkedSync ( t , eth . ETH67 , LightSync ) }
func testForkedSync ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -564,6 +572,9 @@ func testForkedSync(t *testing.T, protocol uint, mode SyncMode) {
func TestHeavyForkedSync66Full ( t * testing . T ) { testHeavyForkedSync ( t , eth . ETH66 , FullSync ) }
func TestHeavyForkedSync66Snap ( t * testing . T ) { testHeavyForkedSync ( t , eth . ETH66 , SnapSync ) }
func TestHeavyForkedSync66Light ( t * testing . T ) { testHeavyForkedSync ( t , eth . ETH66 , LightSync ) }
func TestHeavyForkedSync67Full ( t * testing . T ) { testHeavyForkedSync ( t , eth . ETH67 , FullSync ) }
func TestHeavyForkedSync67Snap ( t * testing . T ) { testHeavyForkedSync ( t , eth . ETH67 , SnapSync ) }
func TestHeavyForkedSync67Light ( t * testing . T ) { testHeavyForkedSync ( t , eth . ETH67 , LightSync ) }
func testHeavyForkedSync ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -593,6 +604,9 @@ func testHeavyForkedSync(t *testing.T, protocol uint, mode SyncMode) {
func TestBoundedForkedSync66Full ( t * testing . T ) { testBoundedForkedSync ( t , eth . ETH66 , FullSync ) }
func TestBoundedForkedSync66Snap ( t * testing . T ) { testBoundedForkedSync ( t , eth . ETH66 , SnapSync ) }
func TestBoundedForkedSync66Light ( t * testing . T ) { testBoundedForkedSync ( t , eth . ETH66 , LightSync ) }
func TestBoundedForkedSync67Full ( t * testing . T ) { testBoundedForkedSync ( t , eth . ETH67 , FullSync ) }
func TestBoundedForkedSync67Snap ( t * testing . T ) { testBoundedForkedSync ( t , eth . ETH67 , SnapSync ) }
func TestBoundedForkedSync67Light ( t * testing . T ) { testBoundedForkedSync ( t , eth . ETH67 , LightSync ) }
func testBoundedForkedSync ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -627,6 +641,15 @@ func TestBoundedHeavyForkedSync66Snap(t *testing.T) {
func TestBoundedHeavyForkedSync66Light ( t * testing . T ) {
testBoundedHeavyForkedSync ( t , eth . ETH66 , LightSync )
}
func TestBoundedHeavyForkedSync67Full ( t * testing . T ) {
testBoundedHeavyForkedSync ( t , eth . ETH67 , FullSync )
}
func TestBoundedHeavyForkedSync67Snap ( t * testing . T ) {
testBoundedHeavyForkedSync ( t , eth . ETH67 , SnapSync )
}
func TestBoundedHeavyForkedSync67Light ( t * testing . T ) {
testBoundedHeavyForkedSync ( t , eth . ETH67 , LightSync )
}
func testBoundedHeavyForkedSync ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -654,6 +677,9 @@ func testBoundedHeavyForkedSync(t *testing.T, protocol uint, mode SyncMode) {
func TestCancel66Full ( t * testing . T ) { testCancel ( t , eth . ETH66 , FullSync ) }
func TestCancel66Snap ( t * testing . T ) { testCancel ( t , eth . ETH66 , SnapSync ) }
func TestCancel66Light ( t * testing . T ) { testCancel ( t , eth . ETH66 , LightSync ) }
func TestCancel67Full ( t * testing . T ) { testCancel ( t , eth . ETH67 , FullSync ) }
func TestCancel67Snap ( t * testing . T ) { testCancel ( t , eth . ETH67 , SnapSync ) }
func TestCancel67Light ( t * testing . T ) { testCancel ( t , eth . ETH67 , LightSync ) }
func testCancel ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -681,6 +707,9 @@ func testCancel(t *testing.T, protocol uint, mode SyncMode) {
func TestMultiSynchronisation66Full ( t * testing . T ) { testMultiSynchronisation ( t , eth . ETH66 , FullSync ) }
func TestMultiSynchronisation66Snap ( t * testing . T ) { testMultiSynchronisation ( t , eth . ETH66 , SnapSync ) }
func TestMultiSynchronisation66Light ( t * testing . T ) { testMultiSynchronisation ( t , eth . ETH66 , LightSync ) }
func TestMultiSynchronisation67Full ( t * testing . T ) { testMultiSynchronisation ( t , eth . ETH67 , FullSync ) }
func TestMultiSynchronisation67Snap ( t * testing . T ) { testMultiSynchronisation ( t , eth . ETH67 , SnapSync ) }
func TestMultiSynchronisation67Light ( t * testing . T ) { testMultiSynchronisation ( t , eth . ETH67 , LightSync ) }
func testMultiSynchronisation ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -705,6 +734,9 @@ func testMultiSynchronisation(t *testing.T, protocol uint, mode SyncMode) {
func TestMultiProtoSynchronisation66Full ( t * testing . T ) { testMultiProtoSync ( t , eth . ETH66 , FullSync ) }
func TestMultiProtoSynchronisation66Snap ( t * testing . T ) { testMultiProtoSync ( t , eth . ETH66 , SnapSync ) }
func TestMultiProtoSynchronisation66Light ( t * testing . T ) { testMultiProtoSync ( t , eth . ETH66 , LightSync ) }
func TestMultiProtoSynchronisation67Full ( t * testing . T ) { testMultiProtoSync ( t , eth . ETH67 , FullSync ) }
func TestMultiProtoSynchronisation67Snap ( t * testing . T ) { testMultiProtoSync ( t , eth . ETH67 , SnapSync ) }
func TestMultiProtoSynchronisation67Light ( t * testing . T ) { testMultiProtoSync ( t , eth . ETH67 , LightSync ) }
func testMultiProtoSync ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -715,7 +747,7 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) {
// Create peers of every type
tester . newPeer ( "peer 66" , eth . ETH66 , chain . blocks [ 1 : ] )
//tester.newPeer("peer 65", eth.ETH67, chain.blocks[1:)
tester . newPeer ( "peer 67" , eth . ETH67 , chain . blocks [ 1 : ] )
// Synchronise with the requested peer and make sure all blocks were retrieved
if err := tester . sync ( fmt . Sprintf ( "peer %d" , protocol ) , nil , mode ) ; err != nil {
@ -724,7 +756,7 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) {
assertOwnChain ( t , tester , len ( chain . blocks ) )
// Check that no peers have been dropped off
for _ , version := range [ ] int { 66 } {
for _ , version := range [ ] int { 66 , 67 } {
peer := fmt . Sprintf ( "peer %d" , version )
if _ , ok := tester . peers [ peer ] ; ! ok {
t . Errorf ( "%s dropped" , peer )
@ -737,6 +769,9 @@ func testMultiProtoSync(t *testing.T, protocol uint, mode SyncMode) {
func TestEmptyShortCircuit66Full ( t * testing . T ) { testEmptyShortCircuit ( t , eth . ETH66 , FullSync ) }
func TestEmptyShortCircuit66Snap ( t * testing . T ) { testEmptyShortCircuit ( t , eth . ETH66 , SnapSync ) }
func TestEmptyShortCircuit66Light ( t * testing . T ) { testEmptyShortCircuit ( t , eth . ETH66 , LightSync ) }
func TestEmptyShortCircuit67Full ( t * testing . T ) { testEmptyShortCircuit ( t , eth . ETH67 , FullSync ) }
func TestEmptyShortCircuit67Snap ( t * testing . T ) { testEmptyShortCircuit ( t , eth . ETH67 , SnapSync ) }
func TestEmptyShortCircuit67Light ( t * testing . T ) { testEmptyShortCircuit ( t , eth . ETH67 , LightSync ) }
func testEmptyShortCircuit ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -785,6 +820,9 @@ func testEmptyShortCircuit(t *testing.T, protocol uint, mode SyncMode) {
func TestMissingHeaderAttack66Full ( t * testing . T ) { testMissingHeaderAttack ( t , eth . ETH66 , FullSync ) }
func TestMissingHeaderAttack66Snap ( t * testing . T ) { testMissingHeaderAttack ( t , eth . ETH66 , SnapSync ) }
func TestMissingHeaderAttack66Light ( t * testing . T ) { testMissingHeaderAttack ( t , eth . ETH66 , LightSync ) }
func TestMissingHeaderAttack67Full ( t * testing . T ) { testMissingHeaderAttack ( t , eth . ETH67 , FullSync ) }
func TestMissingHeaderAttack67Snap ( t * testing . T ) { testMissingHeaderAttack ( t , eth . ETH67 , SnapSync ) }
func TestMissingHeaderAttack67Light ( t * testing . T ) { testMissingHeaderAttack ( t , eth . ETH67 , LightSync ) }
func testMissingHeaderAttack ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -811,6 +849,9 @@ func testMissingHeaderAttack(t *testing.T, protocol uint, mode SyncMode) {
func TestShiftedHeaderAttack66Full ( t * testing . T ) { testShiftedHeaderAttack ( t , eth . ETH66 , FullSync ) }
func TestShiftedHeaderAttack66Snap ( t * testing . T ) { testShiftedHeaderAttack ( t , eth . ETH66 , SnapSync ) }
func TestShiftedHeaderAttack66Light ( t * testing . T ) { testShiftedHeaderAttack ( t , eth . ETH66 , LightSync ) }
func TestShiftedHeaderAttack67Full ( t * testing . T ) { testShiftedHeaderAttack ( t , eth . ETH67 , FullSync ) }
func TestShiftedHeaderAttack67Snap ( t * testing . T ) { testShiftedHeaderAttack ( t , eth . ETH67 , SnapSync ) }
func TestShiftedHeaderAttack67Light ( t * testing . T ) { testShiftedHeaderAttack ( t , eth . ETH67 , LightSync ) }
func testShiftedHeaderAttack ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -837,6 +878,7 @@ func testShiftedHeaderAttack(t *testing.T, protocol uint, mode SyncMode) {
// for various failure scenarios. Afterwards a full sync is attempted to make
// sure no state was corrupted.
func TestInvalidHeaderRollback66Snap ( t * testing . T ) { testInvalidHeaderRollback ( t , eth . ETH66 , SnapSync ) }
func TestInvalidHeaderRollback67Snap ( t * testing . T ) { testInvalidHeaderRollback ( t , eth . ETH67 , SnapSync ) }
func testInvalidHeaderRollback ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -923,6 +965,15 @@ func TestHighTDStarvationAttack66Snap(t *testing.T) {
func TestHighTDStarvationAttack66Light ( t * testing . T ) {
testHighTDStarvationAttack ( t , eth . ETH66 , LightSync )
}
func TestHighTDStarvationAttack67Full ( t * testing . T ) {
testHighTDStarvationAttack ( t , eth . ETH67 , FullSync )
}
func TestHighTDStarvationAttack67Snap ( t * testing . T ) {
testHighTDStarvationAttack ( t , eth . ETH67 , SnapSync )
}
func TestHighTDStarvationAttack67Light ( t * testing . T ) {
testHighTDStarvationAttack ( t , eth . ETH67 , LightSync )
}
func testHighTDStarvationAttack ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -937,6 +988,7 @@ func testHighTDStarvationAttack(t *testing.T, protocol uint, mode SyncMode) {
// Tests that misbehaving peers are disconnected, whilst behaving ones are not.
func TestBlockHeaderAttackerDropping66 ( t * testing . T ) { testBlockHeaderAttackerDropping ( t , eth . ETH66 ) }
func TestBlockHeaderAttackerDropping67 ( t * testing . T ) { testBlockHeaderAttackerDropping ( t , eth . ETH67 ) }
func testBlockHeaderAttackerDropping ( t * testing . T , protocol uint ) {
// Define the disconnection requirement for individual hash fetch errors
@ -987,6 +1039,9 @@ func testBlockHeaderAttackerDropping(t *testing.T, protocol uint) {
func TestSyncProgress66Full ( t * testing . T ) { testSyncProgress ( t , eth . ETH66 , FullSync ) }
func TestSyncProgress66Snap ( t * testing . T ) { testSyncProgress ( t , eth . ETH66 , SnapSync ) }
func TestSyncProgress66Light ( t * testing . T ) { testSyncProgress ( t , eth . ETH66 , LightSync ) }
func TestSyncProgress67Full ( t * testing . T ) { testSyncProgress ( t , eth . ETH67 , FullSync ) }
func TestSyncProgress67Snap ( t * testing . T ) { testSyncProgress ( t , eth . ETH67 , SnapSync ) }
func TestSyncProgress67Light ( t * testing . T ) { testSyncProgress ( t , eth . ETH67 , LightSync ) }
func testSyncProgress ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -1064,6 +1119,9 @@ func checkProgress(t *testing.T, d *Downloader, stage string, want ethereum.Sync
func TestForkedSyncProgress66Full ( t * testing . T ) { testForkedSyncProgress ( t , eth . ETH66 , FullSync ) }
func TestForkedSyncProgress66Snap ( t * testing . T ) { testForkedSyncProgress ( t , eth . ETH66 , SnapSync ) }
func TestForkedSyncProgress66Light ( t * testing . T ) { testForkedSyncProgress ( t , eth . ETH66 , LightSync ) }
func TestForkedSyncProgress67Full ( t * testing . T ) { testForkedSyncProgress ( t , eth . ETH67 , FullSync ) }
func TestForkedSyncProgress67Snap ( t * testing . T ) { testForkedSyncProgress ( t , eth . ETH67 , SnapSync ) }
func TestForkedSyncProgress67Light ( t * testing . T ) { testForkedSyncProgress ( t , eth . ETH67 , LightSync ) }
func testForkedSyncProgress ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -1135,6 +1193,9 @@ func testForkedSyncProgress(t *testing.T, protocol uint, mode SyncMode) {
func TestFailedSyncProgress66Full ( t * testing . T ) { testFailedSyncProgress ( t , eth . ETH66 , FullSync ) }
func TestFailedSyncProgress66Snap ( t * testing . T ) { testFailedSyncProgress ( t , eth . ETH66 , SnapSync ) }
func TestFailedSyncProgress66Light ( t * testing . T ) { testFailedSyncProgress ( t , eth . ETH66 , LightSync ) }
func TestFailedSyncProgress67Full ( t * testing . T ) { testFailedSyncProgress ( t , eth . ETH67 , FullSync ) }
func TestFailedSyncProgress67Snap ( t * testing . T ) { testFailedSyncProgress ( t , eth . ETH67 , SnapSync ) }
func TestFailedSyncProgress67Light ( t * testing . T ) { testFailedSyncProgress ( t , eth . ETH67 , LightSync ) }
func testFailedSyncProgress ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -1201,6 +1262,9 @@ func testFailedSyncProgress(t *testing.T, protocol uint, mode SyncMode) {
func TestFakedSyncProgress66Full ( t * testing . T ) { testFakedSyncProgress ( t , eth . ETH66 , FullSync ) }
func TestFakedSyncProgress66Snap ( t * testing . T ) { testFakedSyncProgress ( t , eth . ETH66 , SnapSync ) }
func TestFakedSyncProgress66Light ( t * testing . T ) { testFakedSyncProgress ( t , eth . ETH66 , LightSync ) }
func TestFakedSyncProgress67Full ( t * testing . T ) { testFakedSyncProgress ( t , eth . ETH67 , FullSync ) }
func TestFakedSyncProgress67Snap ( t * testing . T ) { testFakedSyncProgress ( t , eth . ETH67 , SnapSync ) }
func TestFakedSyncProgress67Light ( t * testing . T ) { testFakedSyncProgress ( t , eth . ETH67 , LightSync ) }
func testFakedSyncProgress ( t * testing . T , protocol uint , mode SyncMode ) {
tester := newTester ( t )
@ -1347,6 +1411,11 @@ func TestCheckpointEnforcement66Snap(t *testing.T) { testCheckpointEnforcement(t
func TestCheckpointEnforcement66Light ( t * testing . T ) {
testCheckpointEnforcement ( t , eth . ETH66 , LightSync )
}
func TestCheckpointEnforcement67Full ( t * testing . T ) { testCheckpointEnforcement ( t , eth . ETH67 , FullSync ) }
func TestCheckpointEnforcement67Snap ( t * testing . T ) { testCheckpointEnforcement ( t , eth . ETH67 , SnapSync ) }
func TestCheckpointEnforcement67Light ( t * testing . T ) {
testCheckpointEnforcement ( t , eth . ETH67 , LightSync )
}
func testCheckpointEnforcement ( t * testing . T , protocol uint , mode SyncMode ) {
// Create a new tester with a particular hard coded checkpoint block