Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

[after Constantinople] test rpc #4859

Closed
wants to merge 1 commit into from
Closed

[after Constantinople] test rpc #4859

wants to merge 1 commit into from

Conversation

winsvega
Copy link
Contributor

experimenting with rpc methods that would make test generation possible via rpc.

ethereum/retesteth#5
ethereum/retesteth#4

@codecov-io
Copy link

codecov-io commented Feb 23, 2018

Codecov Report

Merging #4859 into develop will increase coverage by 2.5%.
The diff coverage is 13%.

Impacted file tree graph

@@            Coverage Diff             @@
##           develop    #4859     +/-   ##
==========================================
+ Coverage    58.46%   60.96%   +2.5%     
==========================================
  Files          337      350     +13     
  Lines        27024    28415   +1391     
  Branches      3164     2894    -270     
==========================================
+ Hits         15799    17323   +1524     
+ Misses       10161    10134     -27     
+ Partials      1064      958    -106

rules = Network::HomesteadTest;
else if (forkRules == "EIP150")
rules = Network::EIP150Test;
else if (forkRules == "EIP158")
Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer the general config it would be nice to refer to these with their semi-"official" names, such as SpuriousDragon and TangerineWhistle.

Copy link
Contributor Author

@winsvega winsvega Mar 15, 2018

Choose a reason for hiding this comment

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

Still we need docs on what those names mean exactly. What changes are applied.
ethereum/retesteth#12

@chfast
Copy link
Member

chfast commented Mar 12, 2018

When are you planning to finish this? The more you add here the longer it will take to do the review process.

eth/main.cpp Outdated
@@ -1063,6 +1063,13 @@ int main(int argc, char** argv)
web3.setIdealPeerCount(peers);
web3.setPeerStretch(peerStretch);
// std::shared_ptr<eth::BasicGasPricer> gasPricer = make_shared<eth::BasicGasPricer>(u256(double(ether / 1000) / etherPrice), u256(blockFees * 1000));

// allow any gasPrice in testing mode
Copy link
Member

Choose a reason for hiding this comment

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

This would be a good candidate for a PR on its own.

@winsvega
Copy link
Contributor Author

I was planning to run all existing tests with RPC.
Now I see that there are lost of issues and it will take much more time to cover this.
Another issue is that methods format might change in the future.

If you fine with that. I could start refactoring this PR and split it into multimple if you want.
Please keep the existing testeth in this repo for now. (travis automatition) I dont want to break existing test cases in cpp client.

callQueuedFunctions();

if (shouldStop())
Copy link
Member

Choose a reason for hiding this comment

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

Not sure what these shouldStop expressions are doing but it seems it would be better to have it as a PR on its own?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will put small changes from this PR into a separate and then rebase this on top develop.
this shouldStop() accelerating blockchain reset. Is is a tweak by Andrey. Perhaps better be moved to TestClient.cpp

@@ -281,3 +291,63 @@ bytes ChainParams::genesisBlock() const
block.appendRaw(RLPEmptyList);
return block.out();
}

#include <libethashseal/GenesisInfo.h>
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't includes go to the top of the file?

reopenChain(params, WithExisting::Kill);
setAuthor(params.author); //for some reason author is not being set
completeSync(); // set sync state to idle for mining
Copy link
Member

Choose a reason for hiding this comment

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

These seems to be a bugfix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. it resolve setAuthor issue

Copy link
Member

Choose a reason for hiding this comment

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

Do you want to create a new PR for the bugfix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes

Copy link
Member

Choose a reason for hiding this comment

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

Ping 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@@ -360,8 +360,8 @@ TransactionSkeleton toTransactionSkeleton(Json::Value const& _json)

if (!_json["from"].empty())
ret.from = jsToAddress(_json["from"].asString());
if (!_json["to"].empty() && _json["to"].asString() != "0x")
ret.to = jsToAddress(_json["to"].asString());
if (!_json["to"].empty() && _json["to"].asString() != "0x" && !_json["to"].asString().empty())
Copy link
Member

Choose a reason for hiding this comment

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

This seems to be a bugfix?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes. because empty() is true if there is no "to" json section.
but the string in this section could be empty or 0x (looks like no consensus on format here)

Copy link
Member

Choose a reason for hiding this comment

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

Should there be a PR for this bugfix?

Copy link
Member

Choose a reason for hiding this comment

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

Ping 😉

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ask/bid price PR is yet not merged.

Copy link
Member

Choose a reason for hiding this comment

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

How is that relevant?

Copy link
Contributor Author

@winsvega winsvega Mar 29, 2018

Choose a reason for hiding this comment

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

I don't want to track many PRs at the same time.
ok. I have now finished fixing the tests and could concentrate on PRs here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Thanks!

@@ -33,6 +38,107 @@ using namespace jsonrpc;

Test::Test(eth::Client& _eth): m_eth(_eth) {}

string prepareVersionString()
Copy link
Member

Choose a reason for hiding this comment

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

This should be moved to a generic place I'd assume. The client should also print this on start.

Copy link
Member

Choose a reason for hiding this comment

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

Also if not moved elsewhere, should be placed into the anonymous namespace.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this one copied from test namespace. however libwe3jsonrpc should not have deps on test namespace

Copy link
Member

Choose a reason for hiding this comment

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

I think it should be a generic helper available allover cpp-eth, what do you think @chfast and @gumb0 ?

@chfast
Copy link
Member

chfast commented Mar 22, 2018

When this is going to be ready for review?

@@ -1,4 +1,7 @@
[
{ "name": "test_getClientInfo", "params": [], "order": [], "returns": ""},
Copy link
Member

Choose a reason for hiding this comment

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

How is this different to https://github.com/ethereum/wiki/wiki/JSON-RPC#web3_clientversion ? It seems you are just returning the version.

Copy link
Contributor Author

@winsvega winsvega Mar 22, 2018

Choose a reason for hiding this comment

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

in that case. no need to implement a new method.
I am removing it from the list of test RPC methods:
ethereum/retesteth#5

Copy link
Member

Choose a reason for hiding this comment

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

Can you remove it from this PR then?

@winsvega
Copy link
Contributor Author

@chfast seeing how a 1 line commit takes about 2 weeks to get merged. I guess this branch stays as experimental. and to merge changes from this branch I will open series of PRs with small changes. then just rebase this branch untill no changes left.

@chfast
Copy link
Member

chfast commented Mar 22, 2018

If you refer to #4895, maybe it's time to fix the broken tests?

@@ -73,7 +73,8 @@ EVMSchedule const& ChainOperationParams::scheduleForBlockNumber(u256 const& _blo

u256 ChainOperationParams::blockReward(EVMSchedule const& _schedule) const
{
if (_schedule.blockRewardOverwrite)
return 0;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no reward for StateTests.
for BlockchainTests reward should be enabled.

Copy link
Member

Choose a reason for hiding this comment

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

I don't understand. This change does not make sense to me.

Copy link
Contributor Author

@winsvega winsvega Jul 25, 2018

Choose a reason for hiding this comment

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

this is not the change. its a work around. currently there is no way to set mining reward from the config option.
Andrey said that mining reward must present and be hardcoded by the fork rules.
I guess this means no StateTests support then. But we actually dont need state tests because if you run it with test_mineBlocks anyway. there would be no difference between state and blockchain test then.

so this line could be removed

Copy link
Member

Choose a reason for hiding this comment

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

still not clear, what do you want us to do with this PR now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we need to agree on genesis scheme ethereum/tests#469

@gumb0 gumb0 requested review from gumb0 and removed request for gumb0 July 25, 2018 13:27
@chfast chfast changed the base branch from develop to master August 2, 2018 08:38
@axic axic added the testeth label Aug 9, 2018
@winsvega winsvega changed the title test rpc [WIP] [after Constantinople] test rpc Oct 9, 2018
@winsvega
Copy link
Contributor Author

introduced changes are merged

@winsvega winsvega closed this Mar 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants