skalenetwork / IMA

SKALE Interchain Messaging Agent
https://skale.space
GNU Affero General Public License v3.0
38 stars 17 forks source link

Failure during manifest setup #1612

Open DimaStebaev opened 1 year ago

DimaStebaev commented 1 year ago

The bug description There are 3 places where asynchronous functions are called wrong

It causes wrong behavior when a manifest file is not present.

Besides the manifest filename is generated incorrectly for globally known networks such as mainnet, goerli, sepolia, et cetera. https://github.com/skalenetwork/IMA/blob/bbe0c0d452c189f39a8c6bf9f1ca9a03db52128b/proxy/migrations/generateManifest.ts#L137

Probably the manifestSetup function is relevant only for actions on schain but it is used in upgrade script for mainnet smart contracts. https://github.com/skalenetwork/IMA/blob/bbe0c0d452c189f39a8c6bf9f1ca9a03db52128b/proxy/migrations/upgradeMainnet.ts#L69

To Reproduce Run upgrade of IMA mainnet smart contracts

  1. npx hardhat run migrations/upgradeMainnet.ts --network custom

Expected behavior Smart contracts are upgraded.

Screenshots

> npx hardhat run migrations/upgradeMainnet.ts --network custom
Current Manifest file detected - will use this one
Error: ENOENT: no such file or directory, access '.openzeppelin/unknown-5.json'

Desktop:

Smartphone:

Additional context The issue is present for IMA 2.0.0-beta.16.

DmytroNazarenko commented 1 year ago

Added to 2.3, as a fix is small and crucial for upgrading mainnet IMA

PolinaKiporenko commented 11 months ago

After discussion with D3, Stan - nice to have in 2.3, but could be postponed to 2.4 due to its not planned in 2.3 to upgrade IMA contract

PolinaKiporenko commented 9 months ago

ima 2.1.0-beta.2

OleksanderSalamatov commented 8 months ago

Test strategy: 1) Check that if there is no manifest file, upgrade script will print that there is no manifest 2) Check that upgrade script detect <network_name>.json files, and not only unknown-X.json

Versions: IMA: 2.1.0-beta.2

Result: 1) Script is telling that there is no ProxyAdmin address in manifest, not that there is no manifest

➜  proxy git:(2.1.0-beta.2) ✗ npx hardhat run migrations/upgradeMainnet.ts --network custom
Error: No ProxyAdmin was found in the network manifest at getManifestAdmin (/root/Workspace/IMA/proxy/node_modules/@openzeppelin/hardhat-upgrades/src/admin.ts:65:11)

2) Upgrade script correctly detects networkID via file name

➜  proxy git:(2.1.0-beta.2) ✗ ll .openzeppelin 
total 512K
-rw-r--r-- 1 root root 430K Feb 23 17:55 mainnet.json
-rw-r--r-- 1 root root  704 Feb 20 18:11 project.json
-rw-r--r-- 1 root root  76K Feb 23 18:09 sepolia.json
➜  proxy git:(2.1.0-beta.2) ✗ npx hardhat run migrations/upgradeMainnet.ts --network custom
Will mark updated version as 2.1.0-beta.2
Prepare upgrade of MessageProxyForMainnet
...

Summary: First case should be fixed further, second is good.