Skip to content

Commit 873cdac

Browse files
Michał Mrożekkapke
Michał Mrożek
authored andcommitted
[ETCM-286] Adjustments to rpc tests (#776)
1 parent 618ec39 commit 873cdac

File tree

4 files changed

+28
-10
lines changed

4 files changed

+28
-10
lines changed
File renamed without changes.

src/rpcTest/resources/privateNetConfig/conf/rpc-test-private-genesis.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extraData": "0x00",
33
"nonce": "0x0000000000000042",
4-
"gasLimit": "0x2fefd8",
4+
"gasLimit": "0xffffffffff",
55
"difficulty": "0x400",
66
"ommersHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
77
"timestamp": "0x00",

src/rpcTest/resources/privateNetConfig/conf/rpc-test-private.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ mantis {
88

99
network = "rpc-test-private"
1010

11-
rpc-test-private = ${mantis.blockchains.base}
11+
rpc-test-private = ${mantis.blockchains.etc}
1212
rpc-test-private {
1313
dao = null
1414
custom-genesis-file = ./conf/rpc-test-private-genesis.json

src/rpcTest/scala/io/iohk/ethereum/rpcTest/RpcApiTests.scala

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
176176
val pBlock = response1.getBlock
177177
pBlock should not equal null
178178

179-
pBlock.getNumber compareTo lBlock.getNumber should be <= 0
179+
pBlock.getNumber should be >= lBlock.getNumber
180180
}
181181

182182
it should "eth_getUncleByBlockNumberAndIndex" taggedAs (MainNet) in new ScenarioSetup {
@@ -899,7 +899,7 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
899899
nonExistingFilterChanges.getLogs.asScala.size shouldEqual 0
900900
}
901901

902-
it should "eth_newBlockFilter" taggedAs (PrivNet, MainNet) in new ScenarioSetup {
902+
it should "eth_newBlockFilter" taggedAs (PrivNet) in new ScenarioSetup {
903903
val blockFilter = service.ethNewBlockFilter().send()
904904
val filterid = blockFilter.getFilterId
905905

@@ -1054,22 +1054,40 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
10541054
getHashRateResponse3.getHashrate.asBigInt shouldEqual 0
10551055
}
10561056

1057-
it should "eth_getTransactionCount without mining" taggedAs (PrivNetNoMining) in new ScenarioSetup {
1057+
it should "eth_getTransactionCount (without pending block) without mining" taggedAs (PrivNetNoMining) in new ScenarioSetup {
10581058
val unlockAccountResponse = service.personalUnlockAccount(firstAccount.address, firstAccount.password, 0).send()
10591059
unlockAccountResponse.accountUnlocked() shouldEqual true
10601060

1061-
val curentCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
1062-
val currentCount = curentCountResponse.getTransactionCount
1061+
val currentCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
1062+
val currentCount = currentCountResponse.getTransactionCount
10631063

10641064
val transferAmount = 100
10651065
val response1 =
10661066
service.ethSendTransaction(valueTransfer(firstAccount.address, secondAccount.address, transferAmount)).send()
10671067
response1.getError shouldEqual null
10681068

1069-
val curentCountResponse1 = service.ethGetTransactionCount(firstAccount.address, pendingBlock).send()
1070-
val currentCount1 = curentCountResponse1.getTransactionCount
1069+
val txCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
1070+
val txCount = txCountResponse.getTransactionCount
10711071

1072-
currentCount.asBigInt shouldEqual currentCount1.asBigInt
1072+
txCount.asBigInt shouldEqual currentCount.asBigInt
1073+
}
1074+
1075+
it should "eth_getTransactionCount (with pending block) without mining" taggedAs (PrivNetNoMining) in new ScenarioSetup {
1076+
val unlockAccountResponse = service.personalUnlockAccount(firstAccount.address, firstAccount.password, 0).send()
1077+
unlockAccountResponse.accountUnlocked() shouldEqual true
1078+
1079+
val currentCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
1080+
val currentCount = currentCountResponse.getTransactionCount
1081+
1082+
val transferAmount = 100
1083+
val response1 =
1084+
service.ethSendTransaction(valueTransfer(firstAccount.address, secondAccount.address, transferAmount)).send()
1085+
response1.getError shouldEqual null
1086+
1087+
val txCountResponseWithPendingBlock = service.ethGetTransactionCount(firstAccount.address, pendingBlock).send()
1088+
val txCount = txCountResponseWithPendingBlock.getTransactionCount
1089+
1090+
txCount.asBigInt shouldEqual currentCount.asBigInt + 1
10731091
}
10741092

10751093
it should "personal_ListAccounts and eth_ListAccounts " taggedAs (PrivNet) in new ScenarioSetup {

0 commit comments

Comments
 (0)