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

[v5] Migrations loss of information #1252

Closed
roderik opened this issue Sep 1, 2018 · 3 comments
Closed

[v5] Migrations loss of information #1252

roderik opened this issue Sep 1, 2018 · 3 comments

Comments

@roderik
Copy link
Contributor

roderik commented Sep 1, 2018

I use migrations quite extensively, not only for deploying contracts, but also to execute a lot of other transactions like assigning permissions etc. in the v4 migration output you could see all tx hashes, in v5 I only see the contract deployments. Is it possible to put the others back?

@cgewecke
Copy link
Contributor

cgewecke commented Sep 3, 2018

Hi @roderik, thanks for raising this.

The non-deploy transaction hash logging was removed because it was difficult to represent meaningfully (although you were able to interpret it :) ). Web3 1.0 exposes event listeners for transaction hash and receipt so a work-around for your case might look something like:

await deployer.deploy(Registry);
const registry = await Registry.deployed();
await registry.authorize()
              .on('transactionHash', hash => log(`Submitted registry authorization tx: ${hash}`))
              .on('receipt', receipt => log(`Registry authorized`));

More broadly, the Migrations module has been rewritten to emit await-able events and have output managed by an extensible reporter service that tracks state across a series of migrations files. This feature needs a little more work and lots of documentation but you should soon be able to plug in your own reporter and control it from the migrations file. Example:

await deployer.deploy(Registry);
const registry = await Registry.deployed();

await deployer.emit('startRegistryAuthorization', registry.address);
const receipt = await registry.authorize();
await deployer.emit('endRegistryAuthorization', receipt);

The reporter might just log to the command line, or track additional gas usage, but it could basically do anything - like text you if your deployment errors or wrap a server that connects the migrations to a browser interface.

@roderik
Copy link
Contributor Author

roderik commented Oct 6, 2018

@gnidan this is the loss of information issue I mentioned during TruffleCon

@gnidan
Copy link
Contributor

gnidan commented May 29, 2019

Closing this as duplicate of #1347. Don't worry @roderik, we haven't forgotten about wanting to add this behavior back in!

@gnidan gnidan closed this as completed May 29, 2019
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

3 participants