-
Notifications
You must be signed in to change notification settings - Fork 89
Make API backwards compatible #118
base: master
Are you sure you want to change the base?
Conversation
Wrap delRaw method Fix wrapper polyfills for "raw" methods Wrap prove and verifyProof static methods Add wrappers for batch and createScratchReadStream methods
Following @alcuadrado advice, I run the wrapped MPT v4 (version from this PR) against v3.0.0 tests. This helped discover a bug in I also added wrappers for some other methods to make the v3 tests pass. They were not wrapped before as they are not used by the packages of interest to us. These steps helped to reduce the number of errors in Buidler EVM tests from 237 down to 12, but there still is some compatibility problem. Tests output: buidler-core tests on wrapped MPT v4 (level, fixed "raw" methods).txt CC: @ryanio @holgerd77 |
I'm glad you found this @msieczko! Failures 1, 2, 3, 4, 9, 10, 11, and 12 are unrelated. To avoid them, you have to run The other failing tests are related to My suspicion is that one of these methods broke:
|
@msieczko thanks so much for your debugging and investigation. I'll add some more "breaking change" release notes based on your insights in this PR, and I will continue to update with any new merges. |
The remaining failing tests that @alcuadrado mentioned are in fact 2 tests that fail for the same reason. They both test a simple behaviour and fail at step 3:
pragma solidity 0.5.10;
contract Example {
event StateModified(uint256 indexed _oldI, uint256 _newI);
uint256 public i = 0;
uint8 public j = 1;
bytes32 h = "1234567890123456789012345678901234567890123456789012345678901234";
function modifiesState(uint256 _i) payable public {
emit StateModified(i, _i);
i = _i;
}
} What's interesting is that if you omit the 2nd step, both tests pass. This means that |
Ok, I found another deviation in the wrappers which caused these 2 last tests to fail. It turns out that I've also found that MPT v3 |
@msieczko thanks for finding these inconsistencies. i'm not sure if they are deliberate or not. maybe we can add some failing test cases and resolve them based on the behavior we should expect to be right? |
@ryanio I didn't identify any bug in MPT v4 itself other than this one inconsistency which would cause problems during my integration attempts. I'd say that Anyway, packages depending on MPT assume that |
Context
Hi, together with @sz-piotr we've been working on measuring the performance of MPT with native
Map
used as its underlying storage as opposed tolevel
. It is clear that MPT performs better whenMap
is used which can be seen in both our benchmark results and @ryanio's which were discussed in #113. Next we wanted to measure performance gains on the level of packages using MPT as a dependency.Problem
We tried hooking up our fork of MPT (modified to use
Map
for storage) to Buidler EVM. Our fork is similar to what @ryanio did in #113, but we left the MPT interface async.Since MPT's interface has been rewritten to use promises and is not backwards compatible with v3.0.0 we created wrappers that translate the old callback style to the new promise style. We then made appropriate changes in Buidler EVM and its dependencies relying on MPT to work with the new wrapped MPT.
Although all MPT's tests pass when ran using our backported interface, many Buidler EVM tests fail on this version of MPT. We rerun the Builder EVM tests against current version of MPT wrapped in the compatible interface (see changes in this PR) to check if they would work. The same tests failed, which may indicate that MPT v4 introduces braking changes other than the change of interface. The other option is that we messed sth up with the wrappers themselves.
Steps to reproduce
In order to test Buidler EVM on wrapped MPT v4 we needed to adjust
package.json
files and imports in:We then published the updated dependency packages to a private Verdaccio npm registry and used it when installing dependencies in buidler monorepo. This way we were able to have wrapped MPT v4 installed in
node_modules
.To reproduce this setup:
measure-buidler
branch.mpt-v4
postinstall
script)buidler-core
testsTests output: buidler-core tests on wrapped MPT v4 (level).txt
CC: @alcuadrado