Skip to content

Commit

Permalink
Added patch
Browse files Browse the repository at this point in the history
  • Loading branch information
rokso committed Jun 30, 2022
1 parent 0965a77 commit 1403268
Show file tree
Hide file tree
Showing 6 changed files with 115 additions and 17 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ node_modules
# Eslint
.eslintcache

# Hard hat
# Hardhat
artifacts
cache

# Deployment
**/deployments/localhost/*
**/deployments/*/failed*

# Solidity coverage
coverage
coverage.json
Expand Down
31 changes: 16 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"fork": "lerna run fork --stream",
"test": "lerna run test --stream",
"prepare": "husky install",
"postinstall": "patch-package",
"lerna": "lerna"
},
"devDependencies": {
Expand All @@ -39,7 +40,7 @@
"ethers": "^5.6.9",
"hardhat": "^2.9.9",
"hardhat-contract-sizer": "^2.5.1",
"hardhat-deploy": "^0.11.10",
"hardhat-deploy": "^0.11.11",
"hardhat-gas-reporter": "^1.0.8",
"hardhat-log-remover": "^2.0.2",
"husky": "^8.0.1",
Expand Down
37 changes: 37 additions & 0 deletions patches/@ledgerhq+hw-transport-node-hid+5.26.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/node_modules/@ledgerhq/hw-transport-node-hid/lib/TransportNodeHid.js b/node_modules/@ledgerhq/hw-transport-node-hid/lib/TransportNodeHid.js
index d96740f..5399a59 100644
--- a/node_modules/@ledgerhq/hw-transport-node-hid/lib/TransportNodeHid.js
+++ b/node_modules/@ledgerhq/hw-transport-node-hid/lib/TransportNodeHid.js
@@ -32,7 +32,7 @@ let listenDevicesPollingSkip = () => false;
* TransportNodeHid.create().then(transport => ...)
*/

-
+let transportCache = null;
class TransportNodeHid extends _hwTransportNodeHidNoevents.default {
/**
*
@@ -61,14 +61,18 @@ class TransportNodeHid extends _hwTransportNodeHidNoevents.default {
* if path="" is not provided, the library will take the first device
*/
static open(path) {
+ if(transportCache !== null) {
+ transportCache.device.close()
+ }
return Promise.resolve().then(() => {
if (path) {
- return new TransportNodeHid(new _nodeHid.default.HID(path));
+ transportCache = new TransportNodeHid(new _nodeHid.default.HID(path));
+ } else {
+ const device = (0, _hwTransportNodeHidNoevents.getDevices)()[0];
+ if (!device) throw new _errors.TransportError("NoDevice", "NoDevice");
+ transportCache = new TransportNodeHid(new _nodeHid.default.HID(device.path));
}
-
- const device = (0, _hwTransportNodeHidNoevents.getDevices)()[0];
- if (!device) throw new _errors.TransportError("NoDevice", "NoDevice");
- return new TransportNodeHid(new _nodeHid.default.HID(device.path));
+ return transportCache;
});
}

42 changes: 42 additions & 0 deletions patches/hardhat+2.9.9.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
diff --git a/node_modules/hardhat/internal/artifacts.js b/node_modules/hardhat/internal/artifacts.js
index 7f6c14a..4f07cc1 100644
--- a/node_modules/hardhat/internal/artifacts.js
+++ b/node_modules/hardhat/internal/artifacts.js
@@ -186,6 +186,16 @@ class Artifacts {
const files = await this.getArtifactPaths();
return this._getArtifactPathFromFiles(name, files);
}
+ /**
+ * Pathced to not throw and return all artifacts with same name.
+ */
+ async _getArtifactPathNoError(name) {
+ if ((0, contract_names_1.isFullyQualifiedName)(name)) {
+ return this._getValidArtifactPathFromFullyQualifiedName(name);
+ }
+ const files = await this.getArtifactPaths();
+ return this._getArtifactPathFromFilesNoError(name, files);
+ }
_createBuildInfo(id, solcVersion, solcLongVersion, input, output) {
return {
id,
@@ -418,6 +428,20 @@ Please replace "${contractName}" for the correct contract name wherever you are
}
return matchingFiles[0];
}
+
+ _getArtifactPathFromFilesNoError(contractName, files) {
+ const matchingFiles = files.filter((file) => {
+ return path.basename(file) === `${contractName}.json`;
+ });
+ if (matchingFiles.length === 0) {
+ return this._handleWrongArtifactForContractName(contractName, files);
+ }
+ if (matchingFiles.length > 1) {
+ const candidates = matchingFiles.map((file) => this._getFullyQualifiedNameFromPath(file));
+ return candidates
+ }
+ return matchingFiles[0];
+ }
/**
* Returns the FQN of a contract giving the absolute path to its artifact.
*
13 changes: 13 additions & 0 deletions patches/hardhat-deploy+0.11.11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/node_modules/hardhat-deploy/dist/src/helpers.js b/node_modules/hardhat-deploy/dist/src/helpers.js
index be6113f..c7f25da 100644
--- a/node_modules/hardhat-deploy/dist/src/helpers.js
+++ b/node_modules/hardhat-deploy/dist/src/helpers.js
@@ -796,7 +796,7 @@ getArtifact, saveDeployment, willSaveToDisk, onPendingTx, getGasPrice, log, prin
}
const proxyName = name + '_Proxy';
const { address: owner } = getProxyOwner(options);
- const { address: from } = getFrom(options.from);
+ // const { address: from } = getFrom(options.from);
const implementationArgs = options.args ? [...options.args] : [];
// --- Implementation Deployment ---
const implementationOptions = {

0 comments on commit 1403268

Please sign in to comment.