Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relative-navigated imports don't work in SolidityCompiler -- path variant #114

Closed
3Nigma opened this issue Oct 14, 2022 · 2 comments
Closed
Assignees
Labels
bug Something isn't working contracts LiveContract/Smart contract related heavy work Heavy work is expected for this
Milestone

Comments

@3Nigma
Copy link
Contributor

3Nigma commented Oct 14, 2022

So if you start out with the following snippet:

var solc = require('solc');

var input = {
  language: 'Solidity',
  sources: {
    '_.sol': {
      content: 'import "../lib.sol"; contract Whatever { }'
    }
  }
};

function findImports(path) {
  console.log(`Import-resolution requested for path '${path}'`);
}

solc.compile(JSON.stringify(input), { import: findImports });

You would expect to see Import-resolution requested for path '../lib.sol' while, in actuality, you get Import-resolution requested for path 'lib.sol' logged.

It looks like the solidity-compiler is loosing track of relative navigation directives. We need to compensate for this in Strato. The remix ide code might give some hints on how they resolve this.

Note: This ticket deals with fixing the behavior of Contract.allFrom({ path }) (+ the newFrom variant). The { code } behavior will be handled by #117 .

@3Nigma 3Nigma added bug Something isn't working heavy work Heavy work is expected for this contracts LiveContract/Smart contract related labels Oct 14, 2022
@3Nigma 3Nigma added this to the Back-burner milestone Oct 14, 2022
@3Nigma
Copy link
Contributor Author

3Nigma commented Oct 14, 2022

Unfortunately we can't switch SolidityCompiler directly to @remix-project/remix-solidity because the remix code only works in browser contexts while Strato should also work in node-js contexts.

@3Nigma 3Nigma self-assigned this Oct 18, 2022
@3Nigma 3Nigma changed the title Relative-navigated imports don't work in SolidityCompiler Relative-navigated imports don't work in SolidityCompiler -- path variant Oct 18, 2022
@3Nigma
Copy link
Contributor Author

3Nigma commented Oct 18, 2022

Including this ticket in the 0.8.1 milestone release since this will not require a bump on the rollup-plugin-hedera-js package.

@3Nigma 3Nigma modified the milestones: Back-burner, 0.8.1 Oct 18, 2022
3Nigma added a commit that referenced this issue Oct 22, 2022
Fixed `..` relative path imports for `Contract.XFrom({ path })` scenarios
@3Nigma 3Nigma closed this as completed Nov 24, 2022
3Nigma added a commit that referenced this issue Nov 30, 2022
commit 3f5f047
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Tue Nov 29 16:22:29 2022 +0200

    Bumped to beta.3 and published it to beta channel instead of release one. Retracted other beta versions for 0.8.2

commit 3667929
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Tue Nov 29 15:32:24 2022 +0200

    Bumped to beta.2 to allow publishing the correct build. Refactored publish:npm package script to npm native's prepublishOnly one.

commit 31df149
Merge: 3c3af8c 7cc4e84
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Tue Nov 29 15:21:11 2022 +0200

    Merge pull request #132 from /issues/131-win-abs-path-imports-fix

    Windows `import` fix

commit 7cc4e84
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Tue Nov 29 14:32:21 2022 +0200

    Initial fix which has been manually tested to work. Unfortunately, there is no plan of having a windows test written for it at the moment. Bumped version to new beta version.

commit 3c3af8c
Merge: 353b61d 05a3c9c
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Fri Nov 25 12:27:22 2022 +0200

    Merge pull request #130 from /issues/129-sol-import-id-already-exists

    Solidity `DeclarationError` fix in `SolidityCompiler`

commit 05a3c9c
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Fri Nov 25 08:10:06 2022 +0200

    Bumped lib version to 0.8.2-beta.0

commit df5a11a
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Fri Nov 25 08:09:37 2022 +0200

    Initial commit with working fix. All tests (node & jsdom) are green

commit 353b61d
Author: Victor ADĂSCĂLIȚEI <210908+3Nigma@users.noreply.github.com>
Date:   Thu Nov 24 13:15:36 2022 +0200

    Update README.md

commit 4c38fa4
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Thu Nov 24 13:06:46 2022 +0200

    Fix tests badge

commit 0eb1dc1
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Thu Nov 24 12:44:34 2022 +0200

    Fix manual test Github Action

commit df37dea
Merge: 676b1cf 7e06cd0
Author: Victor ADĂSCĂLIȚEI <210908+3Nigma@users.noreply.github.com>
Date:   Thu Nov 24 11:03:14 2022 +0200

    Merge pull request #125 from buidler-labs/develop

    0.8.1

commit 7e06cd0
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Thu Nov 24 10:54:47 2022 +0200

    Renamed all occurrences of hedera-venin to hashgraph-venin

commit fba3b2e
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Thu Nov 24 07:57:38 2022 +0200

    Added tests for #126

commit e7b456e
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Thu Nov 24 07:30:29 2022 +0200

    Fixed import reference for failing test

commit a2c4b2c
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Thu Nov 24 07:06:32 2022 +0200

    Fixed failing tests

commit 31c4a29
Merge: afe53f6 d338119
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Wed Nov 23 15:35:45 2022 +0200

    Merge branch 'develop' of https://github.com/buidler-labs/hedera-strato-js into develop

commit afe53f6
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Wed Nov 23 15:35:12 2022 +0200

    Add HEDERAS_NODES env vars in Github Actions.

commit d338119
Merge: c6db54a 1003a65
Author: Victor ADĂSCĂLIȚEI <210908+3Nigma@users.noreply.github.com>
Date:   Wed Nov 23 15:34:25 2022 +0200

    Merge pull request #127 from buidler-labs/issues/#126-token-create-fails-with-insufficient_tx_fee

    Add support for maxTransactionFee on TokenCreate

commit c6db54a
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Wed Nov 23 15:29:40 2022 +0200

    Default to hedera-devnet environment for GitHub Actions.

commit 1003a65
Author: Victor Holotescu <victor.holotescu@yahoo.ro>
Date:   Wed Nov 23 13:20:12 2022 +0200

    Add support for maxTransactionFee on TokenCreate

commit 085f0e4
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Tue Nov 22 15:52:43 2022 +0200

    Renamed couple of missed references for #123 and bumped lib version to 0.8.1

commit bc9e55f
Merge: 205e80a 817e543
Author: Victor ADĂSCĂLIȚEI <210908+3Nigma@users.noreply.github.com>
Date:   Tue Nov 22 15:36:04 2022 +0200

    Merge pull request #124 from /issues/123-lib-renaming

    The king is dead, long live the king!

commit 817e543
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Tue Nov 22 15:29:11 2022 +0200

    Fixed npm vulnerabilities and renamed public library references to venin (and derivatives).

commit 205e80a
Merge: 278d07c ffff801
Author: Victor ADĂSCĂLIȚEI <210908+3Nigma@users.noreply.github.com>
Date:   Sat Oct 22 19:56:41 2022 +0300

    Merge pull request #118 from /issues/114-sol-relative-imports-path-fix

    Fixed `..` relative path imports for `Contract.XFrom({ path })` scenarios

commit ffff801
Author: Victor ADASCALITEI <210908+3Nigma@users.noreply.github.com>
Date:   Wed Oct 19 13:00:27 2022 +0300

    Initial fix of #114 with tests added and everything green.

commit 676b1cf
Merge: e1aa9c2 278d07c
Author: Victor ADĂSCĂLIȚEI <210908+3Nigma@users.noreply.github.com>
Date:   Fri Oct 7 16:52:51 2022 +0300

    Merge pull request #113 from buidler-labs/develop

    0.8.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working contracts LiveContract/Smart contract related heavy work Heavy work is expected for this
Projects
None yet
Development

No branches or pull requests

1 participant