wighawag / hardhat-deploy

hardhat deployment plugin
MIT License
1.2k stars 296 forks source link

RangeError: Invalid string length during deploy #238

Closed playsnook closed 2 years ago

playsnook commented 2 years ago

Suddenly stuck with the following:

npx hardhat --network polygon deploy --tags polygon | tee -a upgrade-no-sge-state-change.log
Nothing to compile
reusing "DefaultProxyAdmin" at 0xb1c2f36F1aBe8457855a7934E64Bf5C85FFDF6f5
reusing "SnookToken_Implementation" at 0xfa728A3aE4a06B7168Ffb4Cfdc9aEA65Dc33d277
reusing "SkillToken" at 0x689f8e5913C158fFB5Ac5aeb83b3C875F5d20309
reusing "UniswapUSDCSkill" at 0x31f528c6c193b27d77B874D1c28d113103AF04BF
reusing "DefaultProxyAdmin" at 0xb1c2f36F1aBe8457855a7934E64Bf5C85FFDF6f5
reusing "Treasury_Implementation" at 0x5CDC6FD7bB53C1646f290A921dDf060e8b2b2CCE
reusing "DefaultProxyAdmin" at 0xb1c2f36F1aBe8457855a7934E64Bf5C85FFDF6f5
reusing "SnookState_Implementation" at 0xDC22d58c5E56ad3C4A9d7F0dE419E1899f286e59
reusing "DefaultProxyAdmin" at 0xb1c2f36F1aBe8457855a7934E64Bf5C85FFDF6f5
reusing "SkinRewards_Implementation" at 0xF2814a52287F661099795Ac83834359B4E3607Ba
An unexpected error occurred:

Error: ERROR processing /home/worker/Documents/MyProjects/playsnook/onchain-hh/deploy/11_deploy_skin_rewards.js:
RangeError: Invalid string length
    at JSON.stringify (<anonymous>)
    at DeploymentsManager.saveDeployment (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat-deploy/src/DeploymentsManager.ts:768:39)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at DeploymentsManager.executeDeployScripts (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat-deploy/src/DeploymentsManager.ts:1052:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at DeploymentsManager.runDeploy (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat-deploy/src/DeploymentsManager.ts:885:5)
    at Environment._runTaskDefinition (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
    at Environment.run (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
    at SimpleTaskDefinition.action (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat-deploy/src/index.ts:528:32)
    at Environment._runTaskDefinition (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)
    at Environment.run (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat/src/internal/core/runtime-environment.ts:129:14)
    at SimpleTaskDefinition.action (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat-deploy/src/index.ts:605:5)
    at Environment._runTaskDefinition (/home/worker/Documents/MyProjects/playsnook/onchain-hh/node_modules/hardhat/src/internal/core/runtime-environment.ts:217:14)

Please advice

playsnook commented 2 years ago

I have notices the file on which save fails is very big: image Can it be purged and recreated?

wighawag commented 2 years ago

which version of hardhat-deploy ?

playsnook commented 2 years ago

"hardhat-deploy": "^0.8.9"

playsnook commented 2 years ago

The problem was caused by JsonStringify from DeploymentManager.ts which threw RangeError on the big deployment file. Deleting the history field from the JSON solved the problem.

Here is the deployment json with 330 MB of history:

image