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

Add a Reconnect handling feature. Fix bugs. #60

Merged
merged 11 commits into from
Dec 4, 2023
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## Version 2.0.0-alpha.17

* Separated the logic of the Reporter and moved transaction-related functions to the TransactionRunner class.
* Added the ability to specify a name for each transaction, essentially enabling the same transaction to be distinguishable. Also fixed a few bugs related to migration storage.
* Added a Network Manager to handle network errors and implemented logic for reconnection. Also updated the Reporter to support these changes properly.

## Version 2.0.0-alpha.16

* Fixed a bug when txs could not be sent with overrides
Expand Down
39 changes: 33 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ module.exports = {
pathToMigrations: "./deploy",
force: false,
continue: false,
transactionStatusCheckInterval: 2000,
},
};
```
Expand All @@ -102,6 +103,7 @@ module.exports = {
- `pathToMigrations` : The path to the folder with the specified migrations.
- `force` : The flag indicating whether the contracts compilation is forced.
- `continue` : The flag indicating whether the deployment should restore the state from the previous deployment.
- `transactionStatusCheckInterval` : The interval in milliseconds between transaction status checks.

### Deploying

Expand All @@ -123,12 +125,6 @@ npx hardhat migrate --network sepolia --from 1 --to 2

In this case, migrations 1 through 2 (both) will be applied without the automatic verification.

<!-- ### Verifying

> _This plugin has a `migrate:verify` task, to learn how to use it, see the example project._

-->

## How it works

The plugin includes the following packages to perform the deployment and verification process:
Expand Down Expand Up @@ -160,6 +156,37 @@ Under the hood, it uses `ContractFactory` from [@ethers](https://www.npmjs.com/p

Returns the deployed contract instance.

### Transactions

We have introduced the capability to assign a specific name to each transaction, enhancing its entropy.
This feature varies depending on the framework used.

#### Ethers.js Usage:

In Ethers.js, you can specify the transaction name using the `customData` field within the overrides.
A special field, `txName`, is dedicated for this purpose.
Here’s an example of how to set a transaction name using Ethers.js:

```javascript
await contract.runner.sendTransaction({ customData: { txName: "Funding Transaction" }});
```

This method helps avoid potential collisions and ensures a smoother recovery process.

#### Truffle Usage:

For those using Truffle, the transaction name can be specified using the `hardfork` field. Here's how you can do it:

``` javascript
await contract.send(1, { hardfork: "Funding Transaction" });
```

#### Purpose

The primary purpose of naming transactions is to facilitate the deployment process.
If an error occurs, you can use the `--continue` flag to resume the deployment from the point of failure.
The Migrator will utilize these names to distinguish between identical transactions

### Verifier

For a list of parameters that affect the verification process, see [Parameter Explanation](https://github.com/dl-solarity/hardhat-migrate#parameter-explanation).
Expand Down
Loading