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

Use git-submodules to include UtilityToken and Organized contracts #712

Closed
deepesh-kn opened this issue Apr 11, 2019 · 10 comments · Fixed by #728
Closed

Use git-submodules to include UtilityToken and Organized contracts #712

deepesh-kn opened this issue Apr 11, 2019 · 10 comments · Fixed by #728
Assignees
Milestone

Comments

@deepesh-kn
Copy link
Contributor

deepesh-kn commented Apr 11, 2019

Use git-submodules to include the following contracts

  • SafeMath.sol
  • EIP20Token.sol
  • UtilityToken.sol
  • Organized.sol

Following is the proposal:

  1. Remove the existing implementation of the above contracts.
  2. Use git-submodules to include EIP20Token.sol and UtilityToken.sol from OpenST/utilitytoken-contracts.
  3. Check if UtilityToken imports the dependent Organized contract.
  4. If not then use git-submodules to include Organized contract in the project from OpenST/organization-contracts.
  5. Use git-submodules to include SafeMath contract in the project from < will be updated >
@jasonklein
Copy link
Contributor

jasonklein commented Apr 15, 2019

@deepesh-kn: in addition to git-submodules, another option might be truffle's existing support for NPM packages (I have not yet tried it, so this is a suggestion and not a recommendation 😅). Have you considered that option?

✏️ N.B.: I will also post this question on the epic.

@schemar
Copy link
Contributor

schemar commented Apr 15, 2019

@deepesh-kn: in addition to git-submodules, another option might be truffle's existing support for NPM packages (I have not yet tried it, so this is a suggestion and not a recommendation 😅). Have you considered that option?

✏️ N.B.: I will also post this question on the epic.

Now discussed here: OpenST/developer-guidelines#20 (comment)

@benjaminbollen
Copy link
Contributor

EIP20token should not be in utility token. if we want to deduplicate it then we can use openZeppeling eg. but for now EIP20token is not part of this scope. It should only ever be part of test contracts

@schemar
Copy link
Contributor

schemar commented Apr 29, 2019

Blocked by the discussion git submodules vs npm.
EIP20 should come from openzeppelin.

@benjaminbollen
Copy link
Contributor

conclusion from discussion;

internal dependencies like organization-contracts and utilitytoken-contracts should be included through git-submodule;

external dependencies like SafeMath (possibly an EIP20Token for testing purposes) should be included through NPM packages

@benjaminbollen benjaminbollen changed the title Use git-submodules to include SafeMath, EIP20Token, UtilityToken and Organized contracts Use git-submodules to include UtilityToken and Organized contracts Apr 30, 2019
@schemar schemar added this to the Sprint 0 milestone May 2, 2019
@schemar
Copy link
Contributor

schemar commented May 2, 2019

  • SafeMath and EIP20 should be imported using NPM
  • OST dependencies should be imported using git-submodules

See also OpenST/openst-contracts#197

@schemar schemar self-assigned this May 6, 2019
@schemar
Copy link
Contributor

schemar commented May 6, 2019

There are conflicts due to multiple declarations of the same contracts. For example, organization contracts are part of utility tokens; safe math from utility tokens is already declared in npm dependency ...

Using NPM would have automatically deduplicated the dependencies.

@schemar
Copy link
Contributor

schemar commented May 6, 2019

I think step one to resolving this is adding safemath as an npm dependency to utilitytoken contracts.

@schemar
Copy link
Contributor

schemar commented May 6, 2019

Step two will be using the organization contracts from within utility token contracts.

"inception"

schemar added a commit to schemar/utilitytoken-contracts that referenced this issue May 7, 2019
schemar added a commit to schemar/utilitytoken-contracts that referenced this issue May 7, 2019
@schemar
Copy link
Contributor

schemar commented May 7, 2019

Deduplicating EIP20Token is out-of-scope, as it requires changing UtilityToken contracts (which has an EIP20Token) and all consumers of UtilityToken, which currently may or may not rely on the EIP20Token from there.
Simply adding the npm package does not work, as there will be an error about multiple definitions of the same Symbol (contract EIP20Token).

schemar added a commit to schemar/mosaic-contracts that referenced this issue May 7, 2019
Code deduplication by getting dependencies from npm and git submodules.

* `UtilityToken` contracts are now imported as a git submodule.
* `Organization` contracst are now imported as a git submodule inside
  the `UtilityToken` submodule.
* `SafeMath` is now imported as open zeppelin npm package.

Note that inside the utility token repository, `token` has not been
renamed to `value token`, and therefore some tests needed to be updated.
Also, some tests required updating as `SafeMath` does not give an error
message anymore.

`Organiation` contracts cannot be imported as a separate git submodule
dependency, as then the solidity compiler will complain that there are
multiple definitions of the same symbol (e.g. `contract Organization`).

For now it is fine to import organization from inside utility tokens,
but that will lead to an error latest when there is a diamond
dependency:

```
      Organization
       /        \
UtilitToken   SomethingElse
       \        /
      NewRepository
```

In this case, it couldn't be avoided that `Organization` was defined
multiple times.

To fix this, I created follow-up ticket:
OpenST/developer-guidelines#27

Deduplicating EIP20Token is out-of-scope, as it requires changing
UtilityToken contracts (which has an EIP20Token) and all consumers of
UtilityToken, which currently may or may not rely on the EIP20Token from
there.
Simply adding the npm package does not work, as there will be an error
about multiple definitions of the same Symbol (`contract EIP20Token`).

To fix this, I created a follow-up ticket:
OpenST/developer-guidelines#28

Fixes OpenST#712
schemar added a commit to schemar/mosaic-contracts that referenced this issue May 7, 2019
Code deduplication by getting dependencies from npm and git submodules.

* `UtilityToken` contracts are now imported as a git submodule.
* `Organization` contracst are now imported as a git submodule inside
  the `UtilityToken` submodule.
* `SafeMath` is now imported as open zeppelin npm package.

Note that inside the utility token repository, `token` has not been
renamed to `value token`, and therefore some tests needed to be updated.
Also, some tests required updating as `SafeMath` does not give an error
message anymore.

`Organiation` contracts cannot be imported as a separate git submodule
dependency, as then the solidity compiler will complain that there are
multiple definitions of the same symbol (e.g. `contract Organization`).

For now it is fine to import organization from inside utility tokens,
but that will lead to an error latest when there is a diamond
dependency:

```
       Organization
        /        \
UtilityToken   SomethingElse
        \        /
       NewRepository
```

In this case, it couldn't be avoided that `Organization` was defined
multiple times.

To fix this, I created follow-up ticket:
OpenST/developer-guidelines#27

Deduplicating EIP20Token is out-of-scope, as it requires changing
UtilityToken contracts (which has an EIP20Token) and all consumers of
UtilityToken, which currently may or may not rely on the EIP20Token from
there.
Simply adding the npm package does not work, as there will be an error
about multiple definitions of the same Symbol (`contract EIP20Token`).

To fix this, I created a follow-up ticket:
OpenST/developer-guidelines#28

Fixes OpenST#712
schemar added a commit to schemar/mosaic-contracts that referenced this issue May 7, 2019
Code deduplication by getting dependencies from npm and git submodules.

* `UtilityToken` contracts are now imported as a git submodule.
* `Organization` contracst are now imported as a git submodule inside
  the `UtilityToken` submodule.
* `SafeMath` is now imported as open zeppelin npm package.

Note that inside the utility token repository, `token` has not been
renamed to `value token`, and therefore some tests needed to be updated.
Also, some tests required updating as `SafeMath` does not give an error
message anymore.

`Organiation` contracts cannot be imported as a separate git submodule
dependency, as then the solidity compiler will complain that there are
multiple definitions of the same symbol (e.g. `contract Organization`).

For now it is fine to import organization from inside utility tokens,
but that will lead to an error latest when there is a diamond
dependency:

```
       Organization
        /        \
UtilityToken   SomethingElse
        \        /
       NewRepository
```

In this case, it couldn't be avoided that `Organization` was defined
multiple times.

To fix this, I created follow-up ticket:
OpenST/developer-guidelines#27

Deduplicating EIP20Token is out-of-scope, as it requires changing
UtilityToken contracts (which has an EIP20Token) and all consumers of
UtilityToken, which currently may or may not rely on the EIP20Token from
there.
Simply adding the npm package does not work, as there will be an error
about multiple definitions of the same Symbol (`contract EIP20Token`).

To fix this, I created a follow-up ticket:
OpenST/developer-guidelines#28

Fixes OpenST#712
schemar added a commit to schemar/organization-contracts that referenced this issue May 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants