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

Some issues and threads #358

Merged
merged 31 commits into from
Apr 30, 2019
Merged

Some issues and threads #358

merged 31 commits into from
Apr 30, 2019

Conversation

marcelomorgado
Copy link
Contributor

@marcelomorgado marcelomorgado commented Apr 29, 2019

Issue link

#351
#350
#349
#298
#291
#329

Auto-close the issue?

Closes #351
Closes #350
Closes #349
Closes #298
Closes #291
Closes #354 (comment)

Types of changes

Technical debt (a code change that doesn't fix a bug or add a feature but makes something clearer for devs)

Notes

Disabling CI node_modules caching to solve failure after truffle-hdwallet-provider upgrade. (Refs: https://circleci.com/gh/tasitlabs/TasitSDK/593)

Copy link
Member

@pcowgill pcowgill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- dependency-cache-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- dependency-cache-
#- restore_cache:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, are you sure we want to disable the cache?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, just saw this comment:

Disabling CI node_modules caching to solve failure after truffle-hdwallet-provider upgrade. (Refs: https://circleci.com/gh/tasitlabs/TasitSDK/593)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider downgrading that package instead? Will we be able to re-enable caching at any point?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can downgrade truffle-hdwallet-provider package or try to re-enable in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What in the error message indicated to you that it was realted to truffle-hdwallet-provider?

> npx lerna bootstrap --hoist

lerna notice cli v3.13.4
lerna info ci enabled
lerna info Bootstrapping 6 packages
lerna info Installing external dependencies
lerna info hoist Installing hoisted dependencies into root
lerna info hoist Pruning hoisted dependencies
lerna info hoist Finished pruning hoisted dependencies
lerna ERR! npm install --no-save exited 1 in 'root'
lerna ERR! npm install --no-save stderr:
npm ERR! path /home/circleci/tasit-sdk/node_modules/web3-providers-ws/node_modules/websocket
npm ERR! code EISGIT
npm ERR! git /home/circleci/tasit-sdk/node_modules/web3-providers-ws/node_modules/websocket: Appears to be a git repo or submodule.
npm ERR! git     /home/circleci/tasit-sdk/node_modules/web3-providers-ws/node_modules/websocket
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

Copy link
Member

@pcowgill pcowgill Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The results you shared are convincing - I think lerna's docs are wrong, then. Because it says that it hoists "shared" dependencies.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this issue on the lerna repo lerna/lerna#2062

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/tasit-action/node_modules:
tasit-account tasit-contracts

This one is surprising then, right?

I didn't get it. tasit-action is using tasit-contracts to resolve contracts ABI/address and tasit-account as devDependency to access createFromPrivateKey helper.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue to enable cache in future: #359

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

packages/tasit-action/node_modules:
tasit-account tasit-contracts

This one is surprising then, right?

I didn't get it. tasit-action is using tasit-contracts to resolve contracts ABI/address and tasit-account as devDependency to access createFromPrivateKey helper.

Yep. So why aren't they hoisted like all of our other deps?

@@ -108,6 +108,10 @@ export class Action extends Subscription {
const baseEthersListener = async blockNumber => {
try {
const tx = await this.#tx;
if (!tx) {
console.log(`The action wasn't sent yet.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this log statement in a dependency (our own) get handled with our removing log approach in the Tasit apps?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I should have used the warn instead.
The console removal plugin used on tasit removes all console.* from code.
Not sure about the best way to deal with warn, not sure if make sense use error event for that. What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh yes, that's a good point that this should be warn.

If this is something that would prevent the tx from going through, then passing this back to the caller as an error so they can retry the tx and update the UI accordingly probably makes sense.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, just thought again about it: It's happening when an action starts to be listening before send it (the tx field is assigned on the send function). I think that worths a test case, and maybe is a situation to be ignored?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's worth a test case

I'm not sure if it's a situation to be ignored, though? Why would it be okay to ignore it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've wrote this test case:

    it("should be able to listen to an event before sending", async () => {
      const confirmationListener = sinon.fake(async message => {
        action.off("confirmation");
      });

      const errorListener = sinon.fake();

      action = sampleContract.setValue(rand);
      action.on("error", errorListener);
      action.on("confirmation", confirmationListener);

      await mineBlocks(provider, 2);

      await action.send();
      await action.waitForOneConfirmation();

      await mineBlocks(provider, 2);

      expect(confirmationListener.callCount).to.equal(1);
      expect(errorListener.called).to.be.false;
    });

That way, warn is being printed for each new block mined, I'm not sure if it's desirable.
Since:

  1. It's expected behavior;
  2. I've improved the signAndSend function (that assigns the this.#tx field) to guarantee that it'll emit an error event if some error occurs;
    Maybe we could remove this warn.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this gate merging?

I don't think so.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh ok - I forgot that the action not being sent yet was something we would want to happen sometimes.

Based on that, what I said earlier:

If this is something that would prevent the tx from going through, then passing this back to the caller as an error so they can retry the tx and update the UI accordingly probably makes sense.

...didn't make sense. So I'm glad you wrote this test as a way of clarifying how we would run into this scenario. Thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That way, warn is being printed for each new block mined, I'm not sure if it's desirable.

Yep, this is an argument for moving it back to INFO level

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I've improved the signAndSend function (that assigns the this.#tx field) to guarantee that it'll emit an error event if some error occurs;

Oh okay, great!

Maybe we could remove this warn.

Oh remove it, not just change it to an INFO log? Maybe if we INFO log when sending and INFO log when listening we could remove it here.

packages/tasit-action/src/contract/Contract.test.js Outdated Show resolved Hide resolved
.circleci/config.yml Outdated Show resolved Hide resolved
pcowgill
pcowgill previously approved these changes Apr 29, 2019
@marcelomorgado
Copy link
Contributor Author

I think it's ready to merge.

@@ -34,7 +34,7 @@ jobs:
# Download and cache dependencies
#- restore_cache:
# keys:
# - dependency-cache-{{ checksum "package.json" }}
# - dependency-cache-{{ checksum "package-lock.json" }}
# fallback to using the latest cache if no exact match is found
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we definitely won't want to enable this

@pcowgill pcowgill merged commit 6690055 into develop Apr 30, 2019
@pcowgill pcowgill deleted the feature/some-issues-and-threads branch April 30, 2019 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants