Search in sources :

Example 6 with SszData

use of tech.pegasys.teku.infrastructure.ssz.SszData in project teku by ConsenSys.

the class SszSchemaTestBase method assertTreeRoundtrip.

private void assertTreeRoundtrip(final SszSchema<?> schema, final int maxBranchLevelsSkipped) {
    // Find some non-zero data (to make sure it's actually different to the default tree)
    final SszData data = randomSsz.withMaxListSize(50).randomDataStream(schema).filter(item -> !item.getBackingNode().hashTreeRoot().isZero()).findFirst().orElseThrow();
    assertTreeRoundtrip(schema, maxBranchLevelsSkipped, data);
}
Also used : SszData(tech.pegasys.teku.infrastructure.ssz.SszData)

Aggregations

SszData (tech.pegasys.teku.infrastructure.ssz.SszData)6 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)3 MethodSource (org.junit.jupiter.params.provider.MethodSource)3 Bytes (org.apache.tuweni.bytes.Bytes)2 TreeNodeAssert.assertThatTreeNode (tech.pegasys.teku.infrastructure.ssz.schema.TreeNodeAssert.assertThatTreeNode)2 TreeNode (tech.pegasys.teku.infrastructure.ssz.tree.TreeNode)2 Path (java.nio.file.Path)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 SszSuperNodeHint (tech.pegasys.teku.infrastructure.ssz.schema.SszSchemaHints.SszSuperNodeHint)1 AbstractSszCollectionSchema (tech.pegasys.teku.infrastructure.ssz.schema.impl.AbstractSszCollectionSchema)1 SimpleSszReader (tech.pegasys.teku.infrastructure.ssz.sos.SimpleSszReader)1