-
Notifications
You must be signed in to change notification settings - Fork 2.2k
return importBlockFailed ImportResult in test_importRawBlock #5868
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The related unit tests crash now. Maybe the exception doesn't really contain errinfo_importResult
?
Also please add an entry to CHANGELOG.md
Unit test failures:
|
The tests are failing because of this line (fixed code ClientTest.cpp :: 149)
the block was successfully imported into blockqueue but then dropped from the chain. |
Your exception handler should better check |
As for Invalid Difficulty - I'm not sure, it seems to me from the code, that it should be checked on the very first stage during adding to Block Queue. |
But as a general comment I'm not sure that the tests should require the exact error message to be returned from the client. The way to check that invalid difficulty is rejected is just to construct the block that has all other fields right except for the difficulty, and check whether the client rejects it. Without relying on error messages, error messages are not part of the consensus. |
"The way to check that invalid difficulty is rejected is just to construct the block that has all other fields right except for the difficulty, and check whether the client rejects it. Without relying on error messages, error messages are not part of the consensus." that's how the tests do. But when I generate the test I must verify the exception to be safe that the exact exception is checked. I am not talking about exact error message. but the exception upon block import. |
Well the tests contain things like
So it looks they try to check the exact exception. |
@winsvega Could you provide me the chain config and block data with invalid difficulty? I'll try to check what's happening with it |
try running
this is old format. I am customizing this so that clients could report any kind of message. |
Yeah this block doesn't pass the first checks in BlockQueue, but |
I still don't get, how do you change it? If the test won't contain different errors, then what's the point of checking the error during generation? (the result test is the same anyway?) |
The generated test is the same but I need a confirmation from the client that a specific exception was hit to be sure (upon generation) |
To be sure of what? So the test fillers still contain different exception names? Why not get rid of them there, too, if you remove them from filled test? |
To be sure that a client that generates the test reject the block with required exception. And avoid the case where client reject the block but for a different reason. And yes to check that a test created correctly. (Typos/code issues) |
why do you need that? |
This is my standard of quality for the tests |
Ok I have some ideas how to return the exact error |
Btw geth return exact exception |
In #5871 I'm adding a nested exception with the exact header validation error to When it's merged, you would need to
|
rebased on top of #5871 |
Will you be able to finish it today so I can include it in the 1.8.0 release? |
No. I checked yesterday this hack doesn't detect some of the block validation exceptions. Such as |
Please rebase on master |
Codecov Report
@@ Coverage Diff @@
## master #5868 +/- ##
==========================================
- Coverage 64.04% 63.98% -0.06%
==========================================
Files 365 365
Lines 31037 31093 +56
Branches 3440 3441 +1
==========================================
+ Hits 19877 19895 +18
- Misses 9929 9968 +39
+ Partials 1231 1230 -1 |
Export exception information on test_improtRawBlock