Ganache-cli: JSON parse error when loading snapshot generated in 6.1.x

Created on 23 Nov 2018  路  5Comments  路  Source: trufflesuite/ganache-cli


We have a snapshot from a previous version of Ganache (6.1.x). When loading this in Ganache CLI v6.2.3 (ganache-core: 2.3.1) I receive a JSON parse error.

SyntaxError: Unexpected token o in JSON at position 1
    at Object.parse [as decode] (<anonymous>)
    at Codec.decodeValue (/Users/jacob/projects/ethdev/0x/0x-starter-project/node_modules/level-codec/index.js:45:36)
    at /Users/jacob/projects/ethdev/0x/0x-starter-project/node_modules/level-sublevel/nut.js:122:34
    at /Users/jacob/projects/ethdev/0x/0x-starter-project/node_modules/encoding-down/index.js:57:5
    at /Users/jacob/projects/ethdev/0x/0x-starter-project/node_modules/cachedown/index.js:61:5
    at /Users/jacob/projects/ethdev/0x/0x-starter-project/node_modules/ganache-core/lib/database/filedown.js:28:5
    at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)

Here is the tx printed prior to the throw at:

Codec.prototype.decodeValue = function (value, opts) {
  console.log(value, opts);
  return this._valueEncoding(opts).decode(value)
}

It appears that previous transaction was encoded correctly as JSON, but this is unmarshalled to an object and fails to be decoded as JSON. That is, there is one prior transaction which was successfully loaded and the second (not raw JSON) fails.

  • I asked about this on gitter: [ ]
  • Link to my question on gitter:

Expected Behavior

I believe this release should have no breaking changes when moving from 6.1.x to 6.2.x. It should be able to load previous snapshot versions.

Current Behavior

Possible Solution

Steps to Reproduce (for bugs)


1.
2.
3.
4.

Context

Your Environment

  • Version used:
  • Version of Truffle/Remix/Other tools used:
  • NodeJS Version: [ ] 6.x, [ ] 7.x (unsupported), [ ] 8.x, [ ] 9.x
  • Operating System and version (include distro if Linux):
  • Link to your project or repro gist:
  • Commit hash to use with above link for reproduction:
  • I intend to submit a pull request to fix this issue: [ ]

bug needs validation priority-high

Most helpful comment

@nicholasjpaterno Confirmed this has been fixed for us with the new release :).

All 5 comments

@dekz, thanks for reporting this. We did not intend on having in breaking changes in this release. My hunch is that this is a regression caused by https://github.com/trufflesuite/ganache-core/commit/7f837abeb33ebee034849214aaa5c07e68c49de2. Most of the team is on holiday here in the US until Monday, so we'll be sure to look into it then.

Looping @nicholasjpaterno for his TX knowledge and @benjamincburns as well in case he can spot the issue easily.

I can confirm that something around snapshotting is broken since 6.2.0 or 6.2.1
A bit more details on builds created by bot https://github.com/PolymathNetwork/polymath-core/issues/417

After manually testing, it is confirmed that snapshotting feature is not working as expected. Something else might also have broke but snapshotting is definitely broken.

Edit: This is a bit different issue. We are using evm_snapshot and evm_revert in the same test and it's still misbehaving. nothing to do with migrating snapshots from 6.1.X.

This is a problem we're facing as well in @aragon/cli, which was using 6.1.x snapshots before and got silently updated to 6.2: https://github.com/aragon/aragon-cli/issues/274.

We're in the process of rebuilding our snapshots using 6.2.x but paused due to the above comment which suggests snapshots may not be working correctly in 6.2.x.

@dekz @maxsam4 @sohkai This should be fixed in the latest ganache release. Let us know if you're still experiencing any issues!

@nicholasjpaterno Confirmed this has been fixed for us with the new release :).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

xavierlepretre picture xavierlepretre  路  5Comments

dwalintukan picture dwalintukan  路  6Comments

axic picture axic  路  5Comments

pradeeps picture pradeeps  路  6Comments

remote-gildor picture remote-gildor  路  4Comments