Skip to content

Commit

Permalink
Simplified executionPayloadV1 testing util (#228)
Browse files Browse the repository at this point in the history
  • Loading branch information
Filter94 authored Oct 22, 2024
1 parent 3ab2f91 commit d2a120f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
5 changes: 4 additions & 1 deletion coordinator/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@ plugins {

configurations.configureEach {
exclude group: "org.rocksdb", module: "rocksdbjni"
exclude group: "it.unimi.dsi", module: "fastutil"
exclude group: "org.hyperledger.besu", module: "bls12-381"
exclude group: "org.hyperledger.besu", module: "secp256r1"
}

configurations {
runtimeClasspath.exclude group: "it.unimi.dsi", module: "fastutil"
}

dependencies {
implementation project(':jvm-libs:generic:json-rpc')
implementation project(':jvm-libs:generic:http-rest')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import net.consensys.toBigInteger
import org.apache.tuweni.bytes.Bytes
import org.apache.tuweni.bytes.Bytes32
import org.apache.tuweni.units.bigints.UInt256
import tech.pegasys.teku.ethereum.executionclient.schema.SharedUtils.dataStructureUtil
import tech.pegasys.teku.infrastructure.bytes.Bytes20
import tech.pegasys.teku.infrastructure.unsigned.UInt64
import tech.pegasys.teku.spec.TestSpecFactory
Expand Down Expand Up @@ -86,7 +85,7 @@ fun randomExecutionPayload(
transactionsRlp: List<Bytes> = emptyList(),
blockNumber: Long? = null
): ExecutionPayloadV1 {
val executionPayload = dataStructureUtil().randomExecutionPayload()
val executionPayload = dataStructureUtil.randomExecutionPayload()
return ExecutionPayloadV1(
/* parentHash = */ executionPayload.parentHash,
/* feeRecipient = */
Expand Down Expand Up @@ -118,17 +117,7 @@ fun randomExecutionPayload(
)
}

private object SharedUtils {
// Lazy loaded to avoid issues on coordinator tests
private var dataStructureUtil: DataStructureUtil? = null

fun dataStructureUtil(): DataStructureUtil {
if (dataStructureUtil == null) {
dataStructureUtil = DataStructureUtil(TestSpecFactory.createMinimalBellatrix())
}
return dataStructureUtil!!
}
}
val dataStructureUtil: DataStructureUtil = DataStructureUtil(TestSpecFactory.createMinimalBellatrix())

// Teku UInt64 has a bug allow negative number to be created
// random test payload creates such cases we need to fix it
Expand Down

0 comments on commit d2a120f

Please sign in to comment.