Skip to content

[ETCM-286] Adjustments to rpc tests #776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
3 commits merged into from
Nov 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"extraData": "0x00",
"nonce": "0x0000000000000042",
"gasLimit": "0x2fefd8",
"gasLimit": "0xffffffffff",
"difficulty": "0x400",
"ommersHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
"timestamp": "0x00",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ mantis {

network = "rpc-test-private"

rpc-test-private = ${mantis.blockchains.base}
rpc-test-private = ${mantis.blockchains.etc}
rpc-test-private {
dao = null
custom-genesis-file = ./conf/rpc-test-private-genesis.json
Expand Down
34 changes: 26 additions & 8 deletions src/rpcTest/scala/io/iohk/ethereum/rpcTest/RpcApiTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
val pBlock = response1.getBlock
pBlock should not equal null

pBlock.getNumber compareTo lBlock.getNumber should be <= 0
pBlock.getNumber should be >= lBlock.getNumber
}

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

it should "eth_newBlockFilter" taggedAs (PrivNet, MainNet) in new ScenarioSetup {
it should "eth_newBlockFilter" taggedAs (PrivNet) in new ScenarioSetup {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm curious, why MainNet is not needed anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test is flaky when used in such a big network as mainnet. I am not sure if it is because of reorgs, too big response or sth else. Testing PrivNet tests the required behaviour so it should be enough

val blockFilter = service.ethNewBlockFilter().send()
val filterid = blockFilter.getFilterId

Expand Down Expand Up @@ -1054,22 +1054,40 @@ class RpcApiTests extends AnyFlatSpec with Matchers with Logger {
getHashRateResponse3.getHashrate.asBigInt shouldEqual 0
}

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

val curentCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
val currentCount = curentCountResponse.getTransactionCount
val currentCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
val currentCount = currentCountResponse.getTransactionCount

val transferAmount = 100
val response1 =
service.ethSendTransaction(valueTransfer(firstAccount.address, secondAccount.address, transferAmount)).send()
response1.getError shouldEqual null

val curentCountResponse1 = service.ethGetTransactionCount(firstAccount.address, pendingBlock).send()
val currentCount1 = curentCountResponse1.getTransactionCount
val txCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
val txCount = txCountResponse.getTransactionCount

currentCount.asBigInt shouldEqual currentCount1.asBigInt
txCount.asBigInt shouldEqual currentCount.asBigInt
}

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

val currentCountResponse = service.ethGetTransactionCount(firstAccount.address, latestBlock).send()
val currentCount = currentCountResponse.getTransactionCount

val transferAmount = 100
val response1 =
service.ethSendTransaction(valueTransfer(firstAccount.address, secondAccount.address, transferAmount)).send()
response1.getError shouldEqual null

val txCountResponseWithPendingBlock = service.ethGetTransactionCount(firstAccount.address, pendingBlock).send()
val txCount = txCountResponseWithPendingBlock.getTransactionCount

txCount.asBigInt shouldEqual currentCount.asBigInt + 1
}

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