Skip to content
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

Change stateManager.trie to stateManager._trie in GeneralStateTestsRunner #438

Merged
merged 5 commits into from Feb 19, 2019

Conversation

chikeichan
Copy link
Contributor

Fix #390

stateManager.trie should be stateManager._trie instead. I have also included a change to surface error message in test, as the testrunner was swallowing the error message, making it difficult to debug failing test.

Copy link
Contributor

@s1na s1na left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I verified it manually.

@@ -91,6 +91,9 @@ module.exports = function runBlockchainTest (options, testData, t, cb) {
cb(err)
})
} catch (err) {
if (err) {
console.log(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you encounter errors here when testing? In that case, maybe explicitly failing with t.fail(err) would help find the errors.

Copy link
Contributor

Choose a reason for hiding this comment

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

Update: using t.fail will cause some invalid test cases to fail. We can just remove the console.log 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.

Good call! I updated the PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah you changed it to t.fail :) sorry, my first comment was mistaken, I think we can ignore the error here, no need for any handling.

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 kinda like having the test fail here when it has err, otherwise it fails silently and make it a tad bit more difficult to debug. What do you think @s1na ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, my comment was meant for the other one (GeneralStateTestsRunner), see below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated below

@@ -100,6 +100,9 @@ function runTestCase (options, testData, t, cb) {
tx: tx,
block: block
}, function (err, r) {
if (err) {
console.log(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated

Copy link
Contributor

Choose a reason for hiding this comment

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

I definitely agree with you that its better to have tests fail explicitly. In this case however, tests are correct: they are testing that the VM functions correctly when input is invalid.

E.g. current state root is 0xdeadbeef, when the VM is given an invalid tx (sender doesn't have enough gas), runTx throws an error. The tests later check that the state root shouldn't have changed for an invalid tx.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make sense - updated!

@s1na
Copy link
Contributor

s1na commented Feb 19, 2019

Thanks again for the PR and sorry for the nitpicks :)

Update: Branch was out-of-date, merged master.

@s1na s1na merged commit b03957c into ethereumjs:master Feb 19, 2019
@s1na s1na mentioned this pull request Mar 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Test fails if json trace is enabled
3 participants