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

Source map indexes are missing in artifacts #1236

Open
ABBDVD opened this issue Aug 28, 2018 · 1 comment
Open

Source map indexes are missing in artifacts #1236

ABBDVD opened this issue Aug 28, 2018 · 1 comment

Comments

@ABBDVD
Copy link

ABBDVD commented Aug 28, 2018

  • [x ] I've asked for help in the Truffle Gitter before filing this issue.

Issue

The built json files in /build/contracts contain source maps. The identifiers which source file has which index are not explicitly given, thus making it much less useful to work with for building tools that want to make use of the truffle.

Steps to Reproduce

  1. truffle unbox metacoin in an empty folder
  2. truffle compile (possibly remove the truffle.js file on Windows before)
  3. observe that the .json files in the folder build/contracts contain the source maps but there's no source list given (as solc returns) nor any other explicit mention which source file is which identifier.

Expected Behavior

Output the source list such that the source mappings can be used.

Actual Results

The source list or an explicit mention of the source file identifiers are not given

Environment

  • Operating System: Windows 10
  • Ethereum client: - (non necessary)
  • Truffle version (truffle version): v4.1.14
  • node version (node --version): v8.11.1
  • npm version (npm --version): v6.4.0

Possible solutions

This could possibly be done as a separate file for example in the build/ folder, but this might be an issue if partial compilations can create overlaps with the identifiers. In which case for example the following could work:

  • Each compilation adds an identifier to all contract json files built in that run.
  • Each contract json file contains the identifier of it's own source file.
    This is under the assumption that compilation of a contract will always compile also all dependencies and that would then allow us to resolve which source mapping uses which compilation identifier and thus which source list and the source list would contain all relevant source files.

The relevant identifiers are returned by the solc output json to truffle here (as far as I can tell) and should thus be relatively easy to add to the built files. The updatedAt could be possibly used somewhat as an identifier for which compilation run it is, but it wouldn't be a nice solution as compilatin runs would have to be identified by comparing similar times.

@fainashalts
Copy link
Contributor

We need to document how to get this info when DB is enabled in the config, as it is now available.

@fainashalts fainashalts added the db label Oct 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants