fixed tests
This commit is contained in:
@@ -73,9 +73,11 @@ open class NativeSubscribe(
|
||||
is SilentException.UnsupportedBlockchain -> StatusException(
|
||||
Status.UNAVAILABLE.withDescription("BLOCKCHAIN UNAVAILABLE: ${t.blockchainId}")
|
||||
)
|
||||
|
||||
is UnsupportedOperationException -> StatusException(
|
||||
Status.UNIMPLEMENTED.withDescription(t.message)
|
||||
)
|
||||
|
||||
else -> {
|
||||
log.warn("Unhandled error", t)
|
||||
StatusException(
|
||||
@@ -98,7 +100,7 @@ open class NativeSubscribe(
|
||||
|
||||
holder.nonce?.also { nonce ->
|
||||
holder.getSource()?.let {
|
||||
signer.sign(nonce, result, it)
|
||||
signer.sign(nonce, result, it)
|
||||
}?.let {
|
||||
buildSignature(nonce, it)
|
||||
}?.also {
|
||||
|
||||
@@ -58,7 +58,7 @@ class EthereumWsFactory(
|
||||
)
|
||||
}
|
||||
|
||||
fun create(id: String, upstream: DefaultUpstream?, validator: EthereumUpstreamValidator?): WsConnection {
|
||||
fun create(upstream: DefaultUpstream?, validator: EthereumUpstreamValidator?): WsConnection {
|
||||
require(upstream == null || upstream.getId() == id) {
|
||||
"Creating instance for different upstream. ${upstream?.getId()} != id"
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ class EthereumRpcConnector(
|
||||
init {
|
||||
if (wsFactory != null) {
|
||||
// do not set upstream to the WS, since it doesn't control the RPC upstream
|
||||
conn = wsFactory.create(id, null, null)
|
||||
conn = wsFactory.create(null, null)
|
||||
val wsHead = EthereumWsHead(conn, id, forkChoice, blockValidator)
|
||||
// receive bew blocks through WebSockets, but also periodically verify with RPC in case if WS failed
|
||||
val rpcHead = EthereumRpcHead(directReader, forkChoice, id, blockValidator, Duration.ofSeconds(60))
|
||||
|
||||
@@ -4,12 +4,14 @@ import io.emeraldpay.dshackle.reader.Reader
|
||||
import io.emeraldpay.dshackle.upstream.BlockValidator
|
||||
import io.emeraldpay.dshackle.upstream.DefaultUpstream
|
||||
import io.emeraldpay.dshackle.upstream.Head
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.*
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumUpstreamValidator
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumWsFactory
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumWsHead
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.WsConnection
|
||||
import io.emeraldpay.dshackle.upstream.forkchoice.ForkChoice
|
||||
import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcRequest
|
||||
import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcResponse
|
||||
import io.emeraldpay.dshackle.upstream.rpcclient.JsonRpcWsClient
|
||||
import io.emeraldpay.grpc.Chain
|
||||
|
||||
class EthereumWsConnector(
|
||||
wsFactory: EthereumWsFactory,
|
||||
@@ -23,7 +25,7 @@ class EthereumWsConnector(
|
||||
private val head: EthereumWsHead
|
||||
|
||||
init {
|
||||
conn = wsFactory.create(upstream.getId(), upstream, validator)
|
||||
conn = wsFactory.create(upstream, validator)
|
||||
head = EthereumWsHead(conn, upstream.getId(), forkChoice, blockValidator)
|
||||
api = JsonRpcWsClient(conn)
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ class HeightByHashAddingSpec extends Specification {
|
||||
|
||||
def block = new BlockContainer(
|
||||
12079192L, BlockId.from("0xa6af163aab691919c595e2a466f0a7b01f1dff8cfd9631dee811df57064c2d32"),
|
||||
BigInteger.ONE, Instant.now(), false, "".bytes, null, [], 0
|
||||
BigInteger.ONE, Instant.now(), false, "".bytes, null, [], 0, "upstream"
|
||||
)
|
||||
|
||||
def "use memory if available"() {
|
||||
|
||||
@@ -87,7 +87,8 @@ class ReceiptMemCacheSpec extends Specification {
|
||||
"{}".bytes,
|
||||
null,
|
||||
[TxId.from(receipt.transactionHash)],
|
||||
0
|
||||
0,
|
||||
"unknown"
|
||||
)
|
||||
|
||||
when:
|
||||
|
||||
@@ -22,6 +22,7 @@ import io.emeraldpay.dshackle.upstream.Selector
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumMultistream
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumPosMultiStream
|
||||
import io.emeraldpay.dshackle.upstream.ethereum.EthereumSubscribe
|
||||
import io.emeraldpay.dshackle.upstream.signature.NoSigner
|
||||
import io.emeraldpay.grpc.Chain
|
||||
import reactor.core.publisher.Flux
|
||||
import reactor.test.StepVerifier
|
||||
@@ -30,6 +31,7 @@ import spock.lang.Specification
|
||||
import java.time.Duration
|
||||
|
||||
class NativeSubscribeSpec extends Specification {
|
||||
def signer = new NoSigner()
|
||||
|
||||
def "Call with empty params when not provided"() {
|
||||
setup:
|
||||
@@ -40,7 +42,7 @@ class NativeSubscribeSpec extends Specification {
|
||||
1 * it.getSubscribe() >> subscribe
|
||||
}
|
||||
|
||||
def nativeSubscribe = new NativeSubscribe(new MultistreamHolderMock(Chain.ETHEREUM, up))
|
||||
def nativeSubscribe = new NativeSubscribe(new MultistreamHolderMock(Chain.ETHEREUM, up), signer)
|
||||
def call = BlockchainOuterClass.NativeSubscribeRequest.newBuilder()
|
||||
.setChainValue(Chain.ETHEREUM.id)
|
||||
.setMethod("newHeads")
|
||||
@@ -50,7 +52,7 @@ class NativeSubscribeSpec extends Specification {
|
||||
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNext("{}")
|
||||
.expectNext(new NativeSubscribe.ResponseHolder("{}", null))
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
}
|
||||
@@ -72,7 +74,7 @@ class NativeSubscribeSpec extends Specification {
|
||||
1 * it.getSubscribe() >> subscribe
|
||||
}
|
||||
|
||||
def nativeSubscribe = new NativeSubscribe(new MultistreamHolderMock(Chain.ETHEREUM, up))
|
||||
def nativeSubscribe = new NativeSubscribe(new MultistreamHolderMock(Chain.ETHEREUM, up), signer)
|
||||
def call = BlockchainOuterClass.NativeSubscribeRequest.newBuilder()
|
||||
.setChainValue(Chain.ETHEREUM.id)
|
||||
.setMethod("logs")
|
||||
@@ -86,7 +88,7 @@ class NativeSubscribeSpec extends Specification {
|
||||
|
||||
then:
|
||||
StepVerifier.create(act)
|
||||
.expectNext("{}")
|
||||
.expectNext(new NativeSubscribe.ResponseHolder("{}", null))
|
||||
.expectComplete()
|
||||
.verify(Duration.ofSeconds(1))
|
||||
}
|
||||
|
||||
@@ -271,7 +271,7 @@ class TrackBitcoinAddressSpec extends Specification {
|
||||
Head head = Mock(Head) {
|
||||
1 * getFlux() >> Flux.concat(
|
||||
Flux.just(
|
||||
new BlockContainer(0L, BlockId.from(hash1), BigInteger.ZERO, Instant.now(), false, null, null, [], 0)
|
||||
new BlockContainer(0L, BlockId.from(hash1), BigInteger.ZERO, Instant.now(), false, null, null, [], 0, "TrackBitcoinAddressSpec")
|
||||
),
|
||||
blocks.asFlux()
|
||||
)
|
||||
@@ -312,7 +312,7 @@ class TrackBitcoinAddressSpec extends Specification {
|
||||
StepVerifier.create(resp)
|
||||
.expectNext("0")
|
||||
.then {
|
||||
blocks.tryEmitNext(new BlockContainer(1L, BlockId.from(hash1), BigInteger.ONE, Instant.now(), false, null, null, [], 0))
|
||||
blocks.tryEmitNext(new BlockContainer(1L, BlockId.from(hash1), BigInteger.ONE, Instant.now(), false, null, null, [], 0, "TrackBitcoinAddressSpec"))
|
||||
}
|
||||
.expectNext("1230000")
|
||||
.then {
|
||||
|
||||
@@ -142,7 +142,7 @@ class TrackBitcoinTxSpec extends Specification {
|
||||
def txid = "69cd44d7c641db82e69824523c7ac0c5c1e5628f025474529cf5ffe64527efc9"
|
||||
// start with the current block
|
||||
def next = Flux.fromIterable([10, 12, 13, 14, 15]).map { h ->
|
||||
new BlockContainer(h.longValue(), BlockId.from("0000000000000000000895d1b9d3898700e1deecc3b0e69f439aa77875e6042f"), BigInteger.ONE, Instant.now(), false, null, null, [], 0)
|
||||
new BlockContainer(h.longValue(), BlockId.from("0000000000000000000895d1b9d3898700e1deecc3b0e69f439aa77875e6042f"), BigInteger.ONE, Instant.now(), false, null, null, [], 0, "unknown")
|
||||
}
|
||||
Head head = Mock(Head) {
|
||||
1 * getFlux() >> next
|
||||
@@ -173,7 +173,7 @@ class TrackBitcoinTxSpec extends Specification {
|
||||
def txid = "69cd44d7c641db82e69824523c7ac0c5c1e5628f025474529cf5ffe64527efc9"
|
||||
// start with the current block
|
||||
def next = Flux.fromIterable([10, 12, 13]).map { h ->
|
||||
new BlockContainer(h.longValue(), BlockId.from("0000000000000000000895d1b9d3898700e1deecc3b0e69f439aa77875e6042f"), BigInteger.ONE, Instant.now(), false, null, null, [], 0)
|
||||
new BlockContainer(h.longValue(), BlockId.from("0000000000000000000895d1b9d3898700e1deecc3b0e69f439aa77875e6042f"), BigInteger.ONE, Instant.now(), false, null, null, [], 0, "unknown")
|
||||
}
|
||||
Head head = Mock(Head) {
|
||||
1 * getFlux() >> next
|
||||
@@ -268,7 +268,7 @@ class TrackBitcoinTxSpec extends Specification {
|
||||
])
|
||||
}
|
||||
def next = Flux.fromIterable([10, 11, 12]).map { h ->
|
||||
new BlockContainer(h.longValue(), BlockId.from("0000000000000000000895d1b9d3898700e1deecc3b0e69f439aa77875e6042f"), BigInteger.ONE, Instant.now(), false, null, null, [], 0)
|
||||
new BlockContainer(h.longValue(), BlockId.from("0000000000000000000895d1b9d3898700e1deecc3b0e69f439aa77875e6042f"), BigInteger.ONE, Instant.now(), false, null, null, [], 0, "unknown")
|
||||
}
|
||||
Head head = Mock(Head) {
|
||||
_ * getFlux() >> next
|
||||
|
||||
@@ -165,7 +165,8 @@ class TrackERC20AddressSpec extends Specification {
|
||||
],
|
||||
TransactionId.from("0x5a7898e27120575c33d3d0179af3b6353c7268bbad4255df079ed26b743a21a5"),
|
||||
1,
|
||||
false
|
||||
false,
|
||||
"unknown"
|
||||
)
|
||||
]
|
||||
def logs = Mock(ConnectLogs) {
|
||||
|
||||
@@ -199,7 +199,7 @@ class TrackEthereumTxSpec extends Specification {
|
||||
def tx = new TrackEthereumTx.TxDetails(Chain.ETHEREUM, Instant.now(), TransactionId.from(txId), 6)
|
||||
def block = new BlockContainer(
|
||||
100, BlockId.from(txId), BigInteger.ONE, Instant.now(), false, "".bytes, null,
|
||||
[TxId.from(txId)], 0
|
||||
[TxId.from(txId)], 0, "unknown"
|
||||
)
|
||||
|
||||
when:
|
||||
@@ -222,7 +222,7 @@ class TrackEthereumTxSpec extends Specification {
|
||||
def block = new BlockContainer(
|
||||
100, BlockId.from(txId), BigInteger.ONE, Instant.now(), false, "".bytes, null,
|
||||
[TxId.from("0xa0e65cbc1b52a8ca60562112c6060552d882f16f34a9dba2ccdc05c0a6a27c22")],
|
||||
0
|
||||
0, "unknown"
|
||||
)
|
||||
apiMock.answer("eth_getTransactionByHash", [txId], null)
|
||||
|
||||
|
||||
@@ -114,7 +114,8 @@ class TestingCommons {
|
||||
null,
|
||||
null,
|
||||
[],
|
||||
0
|
||||
0,
|
||||
"upstream"
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class AbstractHeadSpec extends Specification {
|
||||
def blocks = [1L, 2, 3, 4].collect { i ->
|
||||
byte[] hash = new byte[32]
|
||||
hash[0] = i as byte
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], 0)
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], 0, "AbstractHeadSpec")
|
||||
}
|
||||
|
||||
def "Calls beforeBlock on each block"() {
|
||||
@@ -96,7 +96,7 @@ class AbstractHeadSpec extends Specification {
|
||||
blocks[1].height, BlockId.from(blocks[1].hash.value.clone().tap { it[1] = 0xff as byte }),
|
||||
blocks[1].difficulty - 1,
|
||||
Instant.now(),
|
||||
false, null, null, [], 0
|
||||
false, null, null, [], 0, "AbstractHeadSpec"
|
||||
)
|
||||
when:
|
||||
head.follow(source.asFlux())
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.time.Instant
|
||||
|
||||
class DefaultEthereumHeadSpec extends Specification {
|
||||
|
||||
DefaultEthereumHead head = new DefaultEthereumHead(new MostWorkForkChoice(), BlockValidator.@Companion.ALWAYS_VALID)
|
||||
DefaultEthereumHead head = new DefaultEthereumHead("upstream", new MostWorkForkChoice(), BlockValidator.@Companion.ALWAYS_VALID)
|
||||
ObjectMapper objectMapper = Global.objectMapper
|
||||
|
||||
def blocks = (10L..20L).collect { i ->
|
||||
|
||||
@@ -52,6 +52,8 @@ class EthereumBlockValidatorSpec extends Specification {
|
||||
true, bytes,
|
||||
block,
|
||||
Collections.emptyList(),
|
||||
1)
|
||||
1,
|
||||
"upstream"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -302,7 +302,7 @@ class EthereumFullBlocksReaderSpec extends Specification {
|
||||
"extraField2": "extraValue2"
|
||||
}
|
||||
'''
|
||||
blocks.add(BlockContainer.fromEthereumJson(blockJson.bytes))
|
||||
blocks.add(BlockContainer.fromEthereumJson(blockJson.bytes, "EthereumFullBlocksReaderSpec"))
|
||||
|
||||
def tx1 = '''
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ class ConnectBlockUpdatesSpec extends Specification {
|
||||
]
|
||||
})
|
||||
when:
|
||||
def act = connectBlockUpdates.whenReplaced(block)
|
||||
def act = connectBlockUpdates.whenReplaced(block, "ConnectBlockUpdatesSpec")
|
||||
.collectList().block(Duration.ofSeconds(3))
|
||||
|
||||
then:
|
||||
|
||||
@@ -40,7 +40,8 @@ class ConnectLogsSpec extends Specification {
|
||||
],
|
||||
TransactionId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
|
||||
1L,
|
||||
false
|
||||
false,
|
||||
"upstream"
|
||||
)
|
||||
|
||||
def log2 = new LogMessage(
|
||||
@@ -54,7 +55,8 @@ class ConnectLogsSpec extends Specification {
|
||||
],
|
||||
TransactionId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
|
||||
1L,
|
||||
false
|
||||
false,
|
||||
"upstream"
|
||||
)
|
||||
|
||||
def log3 = new LogMessage(
|
||||
@@ -68,7 +70,8 @@ class ConnectLogsSpec extends Specification {
|
||||
],
|
||||
TransactionId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
|
||||
1L,
|
||||
false
|
||||
false,
|
||||
"upstream"
|
||||
)
|
||||
|
||||
def log4 = new LogMessage(
|
||||
@@ -82,7 +85,8 @@ class ConnectLogsSpec extends Specification {
|
||||
],
|
||||
TransactionId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
|
||||
1L,
|
||||
false
|
||||
false,
|
||||
"upstream"
|
||||
)
|
||||
|
||||
def "Filter is empty"() {
|
||||
|
||||
@@ -45,7 +45,8 @@ class ProduceLogsSpec extends Specification {
|
||||
BlockId.from("0x668b92d6b8c7db1350fd527fec4885ce5be2159b2b7daf6b126babdcbaa349da"),
|
||||
13412871,
|
||||
ConnectBlockUpdates.UpdateType.NEW,
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af"),
|
||||
"upstream"
|
||||
)
|
||||
when:
|
||||
def act = producer.produceAdded(update)
|
||||
@@ -67,7 +68,8 @@ class ProduceLogsSpec extends Specification {
|
||||
BlockId.from("0x668b92d6b8c7db1350fd527fec4885ce5be2159b2b7daf6b126babdcbaa349da"),
|
||||
13412871,
|
||||
ConnectBlockUpdates.UpdateType.NEW,
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af"),
|
||||
"upstream"
|
||||
)
|
||||
when:
|
||||
def act = producer.produceAdded(update)
|
||||
@@ -112,7 +114,8 @@ class ProduceLogsSpec extends Specification {
|
||||
BlockId.from("0x668b92d6b8c7db1350fd527fec4885ce5be2159b2b7daf6b126babdcbaa349da"),
|
||||
13412871,
|
||||
ConnectBlockUpdates.UpdateType.NEW,
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af"),
|
||||
"upstream"
|
||||
)
|
||||
when:
|
||||
def act = producer.produceAdded(update)
|
||||
@@ -157,7 +160,8 @@ class ProduceLogsSpec extends Specification {
|
||||
BlockId.from("0x668b92d6b8c7db1350fd527fec4885ce5be2159b2b7daf6b126babdcbaa349da"),
|
||||
13412871,
|
||||
ConnectBlockUpdates.UpdateType.NEW,
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af")
|
||||
TxId.from("0x6c88df9d65ccc9351db65676c3581b29483e8dabb71c48ef7671c44b0d5568af"),
|
||||
"upstream"
|
||||
)
|
||||
when:
|
||||
def act = producer.produceAdded(update)
|
||||
@@ -267,7 +271,8 @@ class ProduceLogsSpec extends Specification {
|
||||
BlockId.from("0x668b92d6b8c7db1350fd527fec4885ce5be2159b2b7daf6b126babdcbaa349da"),
|
||||
13412871,
|
||||
ConnectBlockUpdates.UpdateType.NEW,
|
||||
TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec")
|
||||
TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
|
||||
"upstream"
|
||||
)
|
||||
when:
|
||||
def act = producer.produceAdded(update)
|
||||
@@ -345,13 +350,15 @@ class ProduceLogsSpec extends Specification {
|
||||
BlockId.from("0x668b92d6b8c7db1350fd527fec4885ce5be2159b2b7daf6b126babdcbaa349da"),
|
||||
13412871,
|
||||
ConnectBlockUpdates.UpdateType.NEW,
|
||||
TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec")
|
||||
TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
|
||||
"upstream"
|
||||
)
|
||||
def update2 = new ConnectBlockUpdates.Update(
|
||||
BlockId.from("0x668b92d6b8c7db1350fd527fec4885ce5be2159b2b7daf6b126babdcbaa349da"),
|
||||
13412871,
|
||||
ConnectBlockUpdates.UpdateType.DROP,
|
||||
TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec")
|
||||
TxId.from("0xb5e554178a94fd993111f2ae64cb708cb0899d7b5182024e70d5c468164a8bec"),
|
||||
"upstream"
|
||||
)
|
||||
when:
|
||||
// first need to produce them as added, because that's when it remembers logs to "remove"
|
||||
|
||||
@@ -41,7 +41,8 @@ class LogMessageSpec extends Specification {
|
||||
],
|
||||
TransactionId.from("0xc7529e79f78f58125abafeaea01fe3abdc6f45c173d5dfb36716cbc526e5b2d1"),
|
||||
0xa3,
|
||||
false)
|
||||
false,
|
||||
"LogMessageSpec")
|
||||
ObjectMapper objectMapper = Global.getObjectMapper()
|
||||
def exp = '{' +
|
||||
'"address":"0x011b6e24ffb0b5f5fcc564cf4183c5bbbc96d515",' +
|
||||
|
||||
@@ -23,7 +23,8 @@ class NewHeadMessageSpec extends Specification {
|
||||
0x7bb33e,
|
||||
Bloom.from("0x012040020880820356a20b8e980a2004c19f1291800501040001180bb029d0002d8c49440e002048ca00d48581000d900a458100c90139056140880582f22a0a8050224c020c233be8c3080c0a016aa4226a2001446c800822080445a2454118139804001202068401841900840c484222420c4b2022046052c0011e81a9e450085883708545810592e40040010411442300080b0130711f602880600a30c90702cb420a0102a644820650908802840810948142541404884300acc69d000840702020224c000020200880c10858418408098a61445b0ab0480234862655a5000434311b91044849c165040411aa0400b00008222642d24313020d9022219120"),
|
||||
Address.from("0x829bd824b016326a401d083b33d092293333a830"),
|
||||
null
|
||||
null,
|
||||
"NewHeadMessageSpec"
|
||||
)
|
||||
ObjectMapper objectMapper = Global.getObjectMapper()
|
||||
def exp = '{' +
|
||||
|
||||
@@ -11,7 +11,7 @@ class MostWorkForkChoiceSpec extends Specification {
|
||||
def blocks = [1L, 2, 3, 4].collect { i ->
|
||||
byte[] hash = new byte[32]
|
||||
hash[0] = i as byte
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], 0)
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], 0, "MostWorkForkChoiceSpec")
|
||||
}
|
||||
|
||||
def "filters blocks"() {
|
||||
|
||||
@@ -10,7 +10,7 @@ class NoChoiceWithPriorityForkChoiceSpec extends Specification {
|
||||
def blocks = [1L, 2, 3, 4].collect { i ->
|
||||
byte[] hash = new byte[32]
|
||||
hash[0] = i as byte
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], 0)
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], 0, "NoChoiceWithPriorityForkChoiceSpec")
|
||||
}
|
||||
|
||||
def "filters blocks"() {
|
||||
|
||||
@@ -10,7 +10,7 @@ class PriorityForkChoiceSpec extends Specification {
|
||||
def blocks = [1L, 2, 3, 4].collect { i ->
|
||||
byte[] hash = new byte[32]
|
||||
hash[0] = i as byte
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], i.toInteger())
|
||||
new BlockContainer(i, BlockId.from(hash), BigInteger.valueOf(i), Instant.now(), false, null, null, [], i.toInteger(), "PriorityForkChoiceSpec")
|
||||
}
|
||||
def "filters blocks"() {
|
||||
def choice = new PriorityForkChoice()
|
||||
|
||||
@@ -95,7 +95,7 @@ class EcdsaSignerSpec extends Specification {
|
||||
def signer = new EcdsaSigner(Stub(ECPrivateKey), 100L)
|
||||
|
||||
when:
|
||||
def act = signer.wrapMessage(10, "test".bytes, up)
|
||||
def act = signer.wrapMessage(10, "test".bytes, up.id)
|
||||
|
||||
then:
|
||||
act == "DSHACKLESIG/10/infura/9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08"
|
||||
|
||||
Reference in New Issue
Block a user