This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
Fixed caching bug: old Migration artifacts would overwrite newly deployed Migrations #18
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Was facing bug in which
truffle migrate
would never save the newly deployedMigrations.sol
contract's artifacts, meaning that the entire migration sequence would run from the beginning every timetruffle migrate
was called.After some digging, it turns out
resolverIntercept.js
is the culprit. Inindex.js
, the following line results in the caching of an old, undeployed Migration artifact:However, if your first migration retrieves the Migration contract as
artifacts.require('Migrations')
and notartifacts.require('Migrations.sol')
, the resolver will cache a duplicate, newer copy of the Migrations artifacts at the keyMigrations
alongside the one already cached atMigrations.sol
.This is problematic because the artifactor uses the resolver's cache to list out which artifacts need to be written to disk -- hence, in alphabetical order, the new artifact associated with the
Migrations
key is written first, and then overwritten by the old artifact associated with theMigrations.sol
key.This PR fixes the above by trimming away trailing import paths and
.sol
extensions from all cache keys.