Skip to content
This repository has been archived by the owner on Jun 14, 2018. It is now read-only.

[WIP] Async Deployer #23

Open
wants to merge 9 commits into
base: next
Choose a base branch
from
Open

[WIP] Async Deployer #23

wants to merge 9 commits into from

Conversation

cgewecke
Copy link
Contributor

@cgewecke cgewecke commented Jun 6, 2018

  • Refactors deployer into a module that can be consumed by a Reporter which runs arbitrary async code on emitted events before returning control flow. (See reporter in tests for basic example). Used this library for that.
  • Adds logic to idle deployments for n confirmations, via truffle config. truffle 763
  • Implements (as a part of the unit tests reporter) +/- exhaustive parsing of the error messages we get back from the vm / web3. Have also mocked in some logic for reason string handling - needs a release at ganache-cli and little extra logic to be complete.
  • Needs checking against geth to make sure error mgmt. is cross-client. Parity?
  • Table below would be better if it had the JS payload for each of event but it's kind of a formatting nightmare. TLDR; reporter gets tons of info. Needs documentation.
  • Parallel work at truffle-migrate is beginning now.

Requesting preliminary review so architectural stuff can be addressed as necessary.

ERROR COHERENCE CHART

Error Cause V4 V5
Insufficient funds Sender balance < cost Yes Yes
Out of gas (block limit) ex: while looping Yes Yes
Base fee (block limit) ex: contract undeployably large Yes Yes
Base fee (gas too low) ex: {gas: 100} No Yes
Check your gas amount Contract is interface/abstract No Yes
Nonce too low Infura load balancing No Yes
Check your gas amount (revert) Failing require condition No Yes
Check your gas amount (invalid opcode) Failing assert condition No Yes
Exceeds block limit Sent gas > block.gasLimit Yes Yes

EVENTS

Event When Async
preDeploy After trial gas estimate is executed, immediately before deployment is attempted. Yes
postDeploy On successful deployment. Yes
preDeployMany Immediately before a batch of deployments is attempted. Yes
postDeployMany On successful deployment of a contract batch. Yes
deployFailed On deployment error. Yes
linking On linking of contracts to libraries. No
error On all non-deployment errors Yes
transactionHash On receiving a deployment's web3 transactionHash event. No
receipt On receiving a deployment's web3 receipt event. No
confirmation On receiving a deployment's web3 confirmation event. No

package.json Outdated
@@ -24,12 +24,16 @@
},
"homepage": "https://github.com/trufflesuite/truffle-deployer#readme",
"dependencies": {
"truffle-contract": "^3.0.5",
"emittery": "^0.3.0",
"truffle-contract": "git+https://github.com/trufflesuite/truffle-contract.git#8f90e82bb3e22e2da6b493d8edd217fb49d8906c",
"truffle-expect": "^0.0.3"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be 'truffle-contract'


/**
* Queries the confirmations mappping periodically to see if we have
* heard enough confirmations for a given tx to allow `deploy` to complete.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ppp

} else {
hasAddress = library.address != null;
deployer.emitter.emit('error', eventArgs);
throw new Error(); // <-- Handle this
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Handle this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant