Search in sources :

Example 6 with Bytes4

use of tech.pegasys.teku.infrastructure.bytes.Bytes4 in project teku by ConsenSys.

the class ForkTest method equalsReturnsFalseWhenPreviousVersionsAreDifferent.

@Test
void equalsReturnsFalseWhenPreviousVersionsAreDifferent() {
    Fork testFork = new Fork(new Bytes4(previousVersion.getWrappedBytes().not()), currentVersion, epoch);
    assertNotEquals(fork, testFork);
}
Also used : Bytes4(tech.pegasys.teku.infrastructure.bytes.Bytes4) Test(org.junit.jupiter.api.Test)

Example 7 with Bytes4

use of tech.pegasys.teku.infrastructure.bytes.Bytes4 in project teku by ConsenSys.

the class SpecMilestoneTest method getForkVersion_bellatrix.

@Test
public void getForkVersion_bellatrix() {
    final Bytes4 expected = bellatrixSpecConfig.getBellatrixForkVersion();
    assertThat(SpecMilestone.getForkVersion(bellatrixSpecConfig, SpecMilestone.BELLATRIX)).contains(expected);
}
Also used : Bytes4(tech.pegasys.teku.infrastructure.bytes.Bytes4) Test(org.junit.jupiter.api.Test)

Example 8 with Bytes4

use of tech.pegasys.teku.infrastructure.bytes.Bytes4 in project teku by ConsenSys.

the class SpecMilestoneTest method getForkVersion_phase0.

@Test
public void getForkVersion_phase0() {
    final Bytes4 expected = altairSpecConfig.getGenesisForkVersion();
    assertThat(SpecMilestone.getForkVersion(altairSpecConfig, SpecMilestone.PHASE0)).contains(expected);
}
Also used : Bytes4(tech.pegasys.teku.infrastructure.bytes.Bytes4) Test(org.junit.jupiter.api.Test)

Example 9 with Bytes4

use of tech.pegasys.teku.infrastructure.bytes.Bytes4 in project teku by ConsenSys.

the class BlockTopicHandlerTest method returnProperTopicName.

@Test
public void returnProperTopicName() {
    final Bytes4 forkDigest = Bytes4.fromHexString("0x11223344");
    final Eth2TopicHandler<SignedBeaconBlock> topicHandler = new Eth2TopicHandler<>(recentChainData, asyncRunner, processor, gossipEncoding, forkDigest, GossipTopicName.BEACON_BLOCK, spec.getGenesisSchemaDefinitions().getSignedBeaconBlockSchema(), GOSSIP_MAX_SIZE);
    assertThat(topicHandler.getTopic()).isEqualTo("/eth2/11223344/beacon_block/ssz_snappy");
}
Also used : Bytes4(tech.pegasys.teku.infrastructure.bytes.Bytes4) Eth2TopicHandler(tech.pegasys.teku.networking.eth2.gossip.topics.topichandlers.Eth2TopicHandler) SignedBeaconBlock(tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock) Test(org.junit.jupiter.api.Test)

Example 10 with Bytes4

use of tech.pegasys.teku.infrastructure.bytes.Bytes4 in project teku by ConsenSys.

the class ProposerSlashingTopicHandlerTest method returnProperTopicName.

@Test
public void returnProperTopicName() {
    final Bytes4 forkDigest = Bytes4.fromHexString("0x11223344");
    Eth2TopicHandler<ProposerSlashing> topicHandler = new Eth2TopicHandler<>(recentChainData, asyncRunner, processor, gossipEncoding, forkDigest, GossipTopicName.PROPOSER_SLASHING, ProposerSlashing.SSZ_SCHEMA, GOSSIP_MAX_SIZE);
    assertThat(topicHandler.getTopic()).isEqualTo("/eth2/11223344/proposer_slashing/ssz_snappy");
}
Also used : ProposerSlashing(tech.pegasys.teku.spec.datastructures.operations.ProposerSlashing) Bytes4(tech.pegasys.teku.infrastructure.bytes.Bytes4) Eth2TopicHandler(tech.pegasys.teku.networking.eth2.gossip.topics.topichandlers.Eth2TopicHandler) Test(org.junit.jupiter.api.Test)

Aggregations

Bytes4 (tech.pegasys.teku.infrastructure.bytes.Bytes4)33 Test (org.junit.jupiter.api.Test)20 Bytes32 (org.apache.tuweni.bytes.Bytes32)5 UInt64 (tech.pegasys.teku.infrastructure.unsigned.UInt64)5 File (java.io.File)4 Bytes (org.apache.tuweni.bytes.Bytes)4 Eth2TopicHandler (tech.pegasys.teku.networking.eth2.gossip.topics.topichandlers.Eth2TopicHandler)4 SpecVersion (tech.pegasys.teku.spec.SpecVersion)4 Eth1Address (tech.pegasys.teku.spec.datastructures.eth1.Eth1Address)4 SignedBeaconBlock (tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlock)3 EnrForkId (tech.pegasys.teku.spec.datastructures.networking.libp2p.rpc.EnrForkId)3 ForkInfo (tech.pegasys.teku.spec.datastructures.state.ForkInfo)3 SingleProtocolEth2RpcMethod (tech.pegasys.teku.networking.eth2.rpc.core.methods.SingleProtocolEth2RpcMethod)2 SignedBeaconBlockSchema (tech.pegasys.teku.spec.datastructures.blocks.SignedBeaconBlockSchema)2 Fork (tech.pegasys.teku.spec.datastructures.state.Fork)2 DatabaseStorageException (tech.pegasys.teku.storage.server.DatabaseStorageException)2 Suppliers (com.google.common.base.Suppliers)1 Optional (java.util.Optional)1 Random (java.util.Random)1 Set (java.util.Set)1