Skip to content

Commit

Permalink
Merge branch 'main' into zkbesu
Browse files Browse the repository at this point in the history
# Conflicts:
#	.circleci/config.yml
  • Loading branch information
fab-10 committed Dec 7, 2023
2 parents 62107e5 + ecb23ba commit 5fb77a5
Show file tree
Hide file tree
Showing 81 changed files with 326 additions and 295 deletions.
2 changes: 1 addition & 1 deletion acceptance-tests/tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ sourceSets {
}
}

processTestResources.dependsOn(':acceptance-tests:test-plugins:testPluginsJar')
processTestResources.dependsOn(':acceptance-tests:test-plugins:testPluginsJar',':acceptance-tests:test-plugins:jar')

task acceptanceTest(type: Test) {
inputs.property "integration.date", LocalTime.now() // so it runs at every invocation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
@SuppressWarnings("rawtypes")
public class PrivacyReorgTest {

@TempDir private static Path folder;
@TempDir private Path folder;

private static final Supplier<SignatureAlgorithm> SIGNATURE_ALGORITHM =
Suppliers.memoize(SignatureAlgorithmFactory::getInstance);
Expand Down
2 changes: 1 addition & 1 deletion besu/src/test/java/org/hyperledger/besu/PrivacyTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public class PrivacyTest {

private final Vertx vertx = Vertx.vertx();

@TempDir private static Path dataDir;
@TempDir private Path dataDir;

@AfterEach
public void cleanUp() {
Expand Down
2 changes: 1 addition & 1 deletion besu/src/test/java/org/hyperledger/besu/RunnerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public void stopVertx() {
vertx.close();
}

@TempDir private static Path temp;
@TempDir private Path temp;

@Test
public void getFixedNodes() {
Expand Down
2 changes: 1 addition & 1 deletion consensus/common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ dependencies {
testImplementation project( path: ':crypto:services', configuration: 'testSupportArtifacts')
testImplementation project(':metrics:core')

testImplementation 'junit:junit'
testImplementation 'org.assertj:assertj-core'
testImplementation 'org.awaitility:awaitility'
testImplementation 'org.junit.jupiter:junit-jupiter'
testImplementation 'org.mockito:mockito-core'
testImplementation 'org.mockito:mockito-junit-jupiter'

testRuntimeOnly 'org.junit.vintage:junit-vintage-engine'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
import java.util.function.Function;
import java.util.stream.Collectors;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class CombinedProtocolScheduleFactoryTest {

private final CombinedProtocolScheduleFactory combinedProtocolScheduleFactory =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.List;
import java.util.Optional;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ForksScheduleTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import static java.util.Collections.emptyList;
import static org.hyperledger.besu.ethereum.core.BlockHeader.GENESIS_BLOCK_NUMBER;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.reset;
import static org.mockito.Mockito.verify;
Expand All @@ -40,13 +41,13 @@
import java.util.function.Consumer;

import org.apache.tuweni.bytes.Bytes;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class MigratingMiningCoordinatorTest {

@Mock private BftMiningCoordinator coordinator1;
Expand All @@ -58,7 +59,7 @@ public class MigratingMiningCoordinatorTest {
private ForksSchedule<MiningCoordinator> coordinatorSchedule;
private static final long MIGRATION_BLOCK_NUMBER = 5L;

@Before
@BeforeEach
public void setup() {
coordinatorSchedule = createCoordinatorSchedule(coordinator1, coordinator2);
final Block block = new Block(blockHeader, blockBody);
Expand Down Expand Up @@ -87,13 +88,12 @@ public void startShouldRegisterThisCoordinatorAsObserver() {
@Test
public void startShouldUnregisterDelegateCoordinatorAsObserver() {
final BftMiningCoordinator delegateCoordinator = createDelegateCoordinator();
when(blockchain.observeBlockAdded(delegateCoordinator)).thenReturn(1L);
lenient().when(blockchain.observeBlockAdded(delegateCoordinator)).thenReturn(1L);
final MigratingMiningCoordinator coordinator =
new MigratingMiningCoordinator(
createCoordinatorSchedule(delegateCoordinator, coordinator2), blockchain);

coordinator.start();

verify(blockchain).observeBlockAdded(coordinator);
verify(blockchain).observeBlockAdded(delegateCoordinator);
verify(blockchain).removeObserver(1L);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import java.util.List;
import java.util.Optional;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

public class MigratingProtocolContextTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
import java.util.List;
import java.util.Optional;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BaseBftProtocolScheduleBuilderTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.function.Consumer;

import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public abstract class BaseForksSchedulesFactoryTest<
C extends BftConfigOptions, M extends MutableBftConfigOptions> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.List;
import java.util.concurrent.TimeUnit;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BftEventQueueTest {
private static final int MAX_QUEUE_SIZE = 1000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import java.util.List;
import java.util.Map;

import org.junit.Test;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;

public class BftForksScheduleFactoryTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
package org.hyperledger.besu.consensus.common.bft;

import org.assertj.core.api.Assertions;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BftHelpersTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
import java.util.concurrent.TimeUnit;

import org.awaitility.Awaitility;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.StrictStubs.class)
@ExtendWith(MockitoExtension.class)
public class BftProcessorTest {
private EventMultiplexer mockeEventMultiplexer;

@Before
@BeforeEach
public void initialise() {
mockeEventMultiplexer = mock(EventMultiplexer.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.StrictStubs.class)
@ExtendWith(MockitoExtension.class)
public class BlockTimerTest {

private BftExecutors bftExecutors;
private BftEventQueue mockQueue;
private Clock mockClock;
private ForksSchedule<BftConfigOptions> mockForksSchedule;

@Before
@BeforeEach
@SuppressWarnings("unchecked")
public void initialise() {
bftExecutors = mock(BftExecutors.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
import org.hyperledger.besu.ethereum.eth.manager.EthPeers;
import org.hyperledger.besu.ethereum.p2p.rlpx.connections.PeerConnection;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class EthSynchronizerUpdaterTest {

@Mock private EthPeers ethPeers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import org.hyperledger.besu.ethereum.p2p.rlpx.wire.MessageData;

import org.apache.tuweni.bytes.Bytes;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class MessageTrackerTest {
private final MessageTracker messageTracker = new MessageTracker(5);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,20 @@
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.StrictStubs.class)
@ExtendWith(MockitoExtension.class)
public class RoundTimerTest {
private BftExecutors bftExecutors;
private BftEventQueue queue;
private RoundTimer timer;

@Before
@BeforeEach
public void initialise() {
bftExecutors = mock(BftExecutors.class);
queue = new BftEventQueue(1000);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class SizeLimitedMapTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@

import com.google.common.collect.Lists;
import org.apache.tuweni.bytes.Bytes;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class UniqueMessageMulticasterTest {

private final MessageTracker messageTracker = mock(MessageTracker.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import org.hyperledger.besu.datatypes.Address;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class VoteTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.hyperledger.besu.consensus.common.bft.blockcreation;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.lenient;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
Expand All @@ -35,13 +36,13 @@
import java.util.concurrent.TimeUnit;

import org.apache.tuweni.bytes.Bytes;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.mockito.junit.jupiter.MockitoExtension;

@RunWith(MockitoJUnitRunner.class)
@ExtendWith(MockitoExtension.class)
public class BftMiningCoordinatorTest {
@Mock private BftEventHandler controller;
@Mock private BftExecutors bftExecutors;
Expand All @@ -54,14 +55,14 @@ public class BftMiningCoordinatorTest {
private final BftEventQueue eventQueue = new BftEventQueue(1000);
private BftMiningCoordinator bftMiningCoordinator;

@Before
@BeforeEach
public void setup() {
bftMiningCoordinator =
new BftMiningCoordinator(
bftExecutors, controller, bftProcessor, bftBlockCreatorFactory, blockChain, eventQueue);
when(block.getBody()).thenReturn(blockBody);
when(block.getHeader()).thenReturn(blockHeader);
when(blockBody.getTransactions()).thenReturn(Collections.emptyList());
lenient().when(block.getBody()).thenReturn(blockBody);
lenient().when(block.getHeader()).thenReturn(blockHeader);
lenient().when(blockBody.getTransactions()).thenReturn(Collections.emptyList());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import java.util.List;
import java.util.Optional;

import org.junit.Test;
import org.junit.jupiter.api.Test;

public class ProposerSelectorTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import java.util.Optional;

import com.google.common.collect.Lists;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BftCoinbaseValidationRuleTest {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
import java.util.stream.IntStream;

import com.google.common.collect.Lists;
import org.junit.Test;
import org.junit.jupiter.api.Test;

public class BftCommitSealsValidationRuleTest {

Expand Down
Loading

0 comments on commit 5fb77a5

Please sign in to comment.