Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Update to ethereumjs-common v1.1.0 #64

Merged
merged 1 commit into from
Feb 6, 2019

Conversation

danjm
Copy link
Contributor

@danjm danjm commented Feb 1, 2019

This PR updates code and package.json to use ethereumjs-common v1.1.0

@coveralls
Copy link

coveralls commented Feb 1, 2019

Coverage Status

Coverage remained the same at 73.818% when pulling 9dbb00b on update-ethereumjs-common-version into 69c73b1 on master.

Copy link
Contributor

@whymarrh whymarrh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

I think it would make sense to directly update this to v1.1.0 (so ^1.1.0 (once released), then the library will be more safe to be used in a Petersburg context and we can directly state this in the subsequent release notes here.

@danjm If you want you can directly update to safe time. I can then re-trigger CI once the new Common version is released.

@danjm danjm force-pushed the update-ethereumjs-common-version branch from ca01e95 to 7fc7200 Compare February 5, 2019 13:44
@danjm
Copy link
Contributor Author

danjm commented Feb 5, 2019

@holgerd77 Updated to ^1.1.0

@holgerd77
Copy link
Member

Ok, various difficulty related tests failing, maybe that's an issue introduced in the hardfork lineup in Common along with the Petersburg HF, will also investigate a bit. Eventually we have to do a follow-up bugfix release (I would suspect some HF comparison logic bug?).

@holgerd77
Copy link
Member

Some in-between output, here I check for the hardfork chosen in the BlockHeader.canonicalDifficulty() function as well as how the greatThanEqual Common function evaluates:

Chosen hardfork: constantinople
> Constantinople?: true
> Byzantium?: true
not ok 23313 test canonicalDifficulty (fork determination by block number)
  ---
    operator: equal
    expected: '4841178247367196615'
    actual:   '4841178247367192519'
    at: runDifficultyTests (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/tests/difficulty.js:19:7)
    stack: |-
      Error: test canonicalDifficulty (fork determination by block number)
          at Test.assert [as _assert] (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/test.js:224:54)
          at Test.bound [as _assert] (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/test.js:76:32)
          at Test.equal (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/test.js:384:10)
          at Test.bound [as equal] (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/test.js:76:32)
          at runDifficultyTests (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/tests/difficulty.js:19:7)
          at Test.t (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/tests/difficulty.js:67:7)
          at Test.bound [as _cb] (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/test.js:76:32)
          at Test.run (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/test.js:95:10)
          at Test.bound [as run] (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/test.js:76:32)
          at Immediate.next (/Users/hdrewes/Documents/DEV/EthereumJS/ethereumjs-block/node_modules/tape/lib/results.js:71:15)
  ...

This looks ok, nevertheless the difficulty if falsely calculated. I suspect the params read from Common subsequently.

@holgerd77
Copy link
Member

Ok, got it: this is failing because we run the difficulty tests on Ropsten in difficulty.js on difficultyRopstenByzantium.json:

const chainTestData = {
    'mainnet': require('./difficultyMainNetwork.json').tests,
    'ropsten': require('./difficultyRopstenByzantium.json').tests
  }

Since the new Common release also defines a hardfork number for Constantinople for Ropsten and block numbers seems to be above the threshold, difficulty is calculated within the Constantinople context.

If test file is changed to difficultyRopstenConstantinople.json (file already included in the tests folder), tests pass again.

Can you update this here?

@danjm danjm force-pushed the update-ethereumjs-common-version branch from 7fc7200 to 9dbb00b Compare February 6, 2019 09:02
@danjm
Copy link
Contributor Author

danjm commented Feb 6, 2019

@holgerd77 Thanks for the investigation on the test failures. I've made the changes and tests are now passing.

@holgerd77
Copy link
Member

Ok, will directly merge and prepare a release.

@holgerd77 holgerd77 changed the title Update to ethereumjs-common v1.0.0 Update to ethereumjs-common v1.1.0 Feb 6, 2019
Copy link
Member

@holgerd77 holgerd77 left a comment

Choose a reason for hiding this comment

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

Looks good.

@holgerd77 holgerd77 merged commit 97ff421 into master Feb 6, 2019
@holgerd77 holgerd77 deleted the update-ethereumjs-common-version branch February 6, 2019 09:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants