zemse / hardhat-tracer

🕵️ allows you to see internal calls, events and storage operations in the console
MIT License
341 stars 35 forks source link

Error HH10: Error while loading Hardhat's configuration. #48

Open mhxw opened 1 year ago

mhxw commented 1 year ago

Error HH10: Error while loading Hardhat's configuration. You or one of your plugins is trying to modify the userConfig.tracer.nameTags

zemse commented 1 year ago

Is your repo public? Is the problem reproducible using the latest v2.3.2?

XWJACK commented 1 year ago

same question

diff --git a/node_modules/hardhat-tracer/dist/src/format/call.js b/node_modules/hardhat-tracer/dist/src/format/call.js
index 11dc7b5..f2ec5f8 100644
--- a/node_modules/hardhat-tracer/dist/src/format/call.js
+++ b/node_modules/hardhat-tracer/dist/src/format/call.js
@@ -32,7 +32,7 @@ async function formatCall(to, input, ret, value, gasUsed, gasLimit, success, dep
             contractName = betterContractName;
         }
         else if (contractName) {
-            dependencies.tracerEnv.nameTags[to] = contractName;
+            // dependencies.tracerEnv.nameTags[to] = contractName;
         }
     }
     // if ERC20 method found then fetch decimals
@@ -77,9 +77,9 @@ async function formatCall(to, input, ret, value, gasUsed, gasLimit, success, dep
         const outputArgs = returnResult
             ? (0, result_1.formatResult)(returnResult, fragment.outputs, { decimals: contractDecimals, shorten: true }, dependencies)
             : // if return data is not decoded, then show return data only if call was success
-                ret !== "0x" && success !== false // success can be undefined
-                    ? ret
-                    : "";
+            ret !== "0x" && success !== false // success can be undefined
+                ? ret
+                : "";
         const nameToPrint = contractName ?? "UnknownContract";
         return `${to &&
             (dependencies.tracerEnv.showAddresses ||
diff --git a/node_modules/hardhat-tracer/dist/src/utils/metadata.js b/node_modules/hardhat-tracer/dist/src/utils/metadata.js
index 6a95388..2a19a2b 100644
--- a/node_modules/hardhat-tracer/dist/src/utils/metadata.js
+++ b/node_modules/hardhat-tracer/dist/src/utils/metadata.js
@@ -107,13 +107,13 @@ async function getBetterContractName(address, dependencies) {
     const contractNameFromNameMethod = await fetchContractName(address, dependencies);
     dependencies.tracerEnv.enabled = true; // enable tracer back
     if (contractNameFromNameMethod) {
-        dependencies.tracerEnv.nameTags[address] = contractNameFromNameMethod;
+        // dependencies.tracerEnv.nameTags[address] = contractNameFromNameMethod;
         return contractNameFromNameMethod;
     }
     // 3. Match bytecode
     const contractNameFromBytecodeComparison = await fetchContractNameUsingBytecodeComparison(address, dependencies);
     if (contractNameFromBytecodeComparison) {
-        dependencies.tracerEnv.nameTags[address] = contractNameFromBytecodeComparison;
+        // dependencies.tracerEnv.nameTags[address] = contractNameFromBytecodeComparison;
         return contractNameFromBytecodeComparison;
     }
 }

hardhat-tracer+2.3.2.patch

zemse commented 1 year ago

I'm looking into this problem, the code should not have modified the userConfig at all, but if the error says so then that's a bug. Just to confirm, after applying this diff did the HH10 error go away for you?

zemse commented 1 year ago

Can you try hardhat-tracer@2.3.3 if it fixes this problem?

XWJACK commented 1 year ago

new error

DOMException [DataCloneError]: #<Object> could not be cloned.
    at new DOMException (node:internal/per_context/domexception:53:5)
    at structuredClone (node:internal/structured_clone:23:17)
    at /node_modules/@ungap/structured-clone/cjs/index.js:21:46
    at /node_modules/hardhat-tracer/src/extend/config.ts:22:39
zemse commented 1 year ago

can you share your config passed for tracer: {} in the hardhat.config.ts file?

XWJACK commented 1 year ago
tracer: {
        opcodes: [
            'CALL',
            'STATICCALL',
            'DELEGATECALL',
            'REVERT',
        ],
        showAddresses: true,
        enableAllOpcodes: false,
        gasCost: true,
        nameTags: {
            '0x00000000000000ADc04C56Bf30aC9d3c0aAF14dC': 'Seaport 1.5',
        }
}
zemse commented 1 year ago

Thanks! I've published hardhat-tracer@2.3.4 with the fix. Please try it and let me know if it has any issues.

mhxw commented 1 year ago

Thank you very much! I have tried the hardhat-tracer@2.3.4 version, and the fix works great. If I encounter any issues during use, I will inform you promptly. Thanks again for your help and support!

k06a commented 1 year ago

@XWJACK fixed in 2.3.5: https://github.com/zemse/hardhat-tracer/issues/49#issuecomment-1586443984