Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Fix LevelDB creation from previous snapshot #239

Closed
wants to merge 2 commits into from

Conversation

bingen
Copy link

@bingen bingen commented Dec 1, 2018

Wrong option for encoding-down.
Fixes #597

Wrong option for `encoding-down`.
Copy link
Member

@davidmurdoch davidmurdoch left a comment

Choose a reason for hiding this comment

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

There appears to be no changes to the logic with the change. What is the change trying to accomplish?

@mikeseese
Copy link
Contributor

@davidmurdoch there is a change in logic. the { valueEncoding: "json" } in the second branch of the conditional now is going into the encode function instead of the levelup function. I'm not sure if this is the correct usage or not however.

I think we should break this code into less one-liner changes. Breaking up the code would look like this:

Before

if (self.options.db) {
  const levelupOptions = { valueEncoding: "json" };
  levelup(self.options.db, levelupOptions, finishInitializing);
} else {
  const levelupOptions = { valueEncoding: "json" };
  const encodedCachedown = encode(cachedown(directory, filedown).maxSize(100));
  levelupdb(encodedCachedown, levelupOptions, finishInitializing);
}

After

if (self.options.db) {
  const levelupOptions = { valueEncoding: "json" };
  levelup(self.options.db, levelupOptions, finishInitializing);
} else {
  const encodeOptions = { valueEncoding: "json" };
  const levelupOptions = {};
  const encodedCachedown = encode(cachedown(directory, filedown).maxSize(100), encodeOptions);
  levelupdb(encodedCachedown, levelupOptions, finishInitializing);
}

@bingen
Copy link
Author

bingen commented Dec 1, 2018

The one-line thing was automatically formatted.

@davidmurdoch
Copy link
Member

davidmurdoch commented Dec 2, 2018

@seese, @bingen, ah, sorry I missed that change. Definitely prefer the readability of the PR's formatting, and @seese's improvements even more. We'll investigate further this week!

@davidmurdoch davidmurdoch reopened this Dec 2, 2018
@bingen
Copy link
Author

bingen commented Dec 2, 2018

Ok, thanks @davidmurdoch
Another way our issue gets fixed is just removing encoding-down. That was my first attempt, but then I thought that maybe it is needed for some other use case I'm missing. I opened the PR for you to have a look: #240 Feel free to close it if encoding-down is really needed.
I'll change the formatting to @seesemichaelj way.

@bingen bingen force-pushed the levelup_encoding_2 branch from 1ca9dff to f39d076 Compare December 2, 2018 10:35
@davidmurdoch
Copy link
Member

Fixed in 994f0a6

@bingen
Copy link
Author

bingen commented Dec 9, 2018

Thanks @davidmurdoch , nice to have this fixed. Is it a new version planned to be published to npm soon? It would be useful to fix our dependencies.

@davidmurdoch
Copy link
Member

@bingen I am hoping to release tomorrow, however, in pre-release testing I may have uncovered some new issues that may postpone the release.

bingen added a commit to aragon/dao-templates that referenced this pull request Dec 11, 2018
Make sure ganache-core is pinned to 2.2.1
See: trufflesuite/ganache#239
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.

3 participants