urbit / azimuth

General-purpose PKI on Ethereum
MIT License
134 stars 36 forks source link

tests/deployments fail #62

Open dillon opened 1 year ago

dillon commented 1 year ago

npm test fails to deploy Azimuth contracts. This is also an issue for bridge.

Not sure if this is truly a gas issue or if that error is a red herring. I do know that there were a few gas-related changes in Shanghai.

Steps to reproduce:

  1. clone this repo
  2. nvm use
  3. npm i -g truffle
  4. npm i
  5. npm run test
➜  azimuth git:(master) ✗ truffle --version
Truffle v5.9.0 (core: 5.9.0)
Ganache v7.8.0
Solidity - pragma (solc-js)
Node v16.18.0
Web3.js v1.10.0
➜  azimuth git:(master) ✗ npm test

> azimuth-solidity@1.2.4 test
> npm-run-all test:setup test:truffle test:cleanup --continue-on-error

> azimuth-solidity@1.2.4 test:setup
> npm run build && npm run test:ganache

> azimuth-solidity@1.2.4 build
> truffle compile

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

> azimuth-solidity@1.2.4 test:ganache
> ganache-cli --gasLimit 6000000 > /dev/null &

> azimuth-solidity@1.2.4 test:truffle
> truffle test

Using network 'development'.

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.
Error:  *** Deployment Failed ***

"Azimuth" ran out of gas (using a value you set in your network config or deployment parameters.)
   * Block limit:  6000000 (0x5b8d80)
   * Gas sent:     6000000 (0x5b8d80)

    at /Users/admin/.nvm/versions/node/v16.18.0/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:330:1
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at module.exports (/Users/admin/git/dillon/azimuth/migrations/2_deploy_contracts.js:29:19)
Truffle v5.9.0 (core: 5.9.0)
Node v16.18.0

> azimuth-solidity@1.2.4 test:cleanup
> pkill -f ganache-cli

ERROR: "test:truffle" exited with 1.

Oversized contracts I noticed that two contracts are over the 24kib limit: Ecliptic.sol and Azimuth.sol. I'm not sure if this is causing issues but messing with configs a bit I was able to produce this error as well: "Azimuth" -- The contract code couldn't be stored, please check your gas limit... Can't seem to config ganache to allow it, even with --chain.hardfork merge --chain.allowUnlimitedInitCodeSize --chain.allowUnlimitedContractSize

➜  azimuth git:(master) ✗ truffle run contract-size ./contracts
┌──────────────────────────────────────────────────────────────────────┬──────────┐
│                                                                      │          │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ AddressUtils                                                         │ 0.07 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Azimuth                                                              │ 27.97 K… │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Censures                                                             │ 4.76 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ConditionalStarRelease                                               │ 16.12 K… │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ DelegatedSending                                                     │ 7.79 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Claims                                                               │ 6.17 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ENS                                                                  │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ERC165                                                               │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ENSRegistry                                                          │ 2.37 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ERC721                                                               │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ERC721Enumerable                                                     │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ERC721Basic                                                          │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ERC721Receiver                                                       │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ERC721Metadata                                                       │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Ecliptic                                                             │ 38.64 K… │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ EclipticBase                                                         │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ EclipticResolver                                                     │ 0.69 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ LinearStarRelease                                                    │ 9.92 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ITreasuryProxy                                                       │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Migrations                                                           │ 0.74 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ NFTokenReceiverTestMock                                              │ 0.37 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Naive                                                                │ 0.10 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Ownable                                                              │ 0.94 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ PlanetSale                                                           │ 3.80 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ Polls                                                                │ 7.48 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ PublicResolver                                                       │ 7.75 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ReadsAzimuth                                                         │ 0.23 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ ResolverInterface                                                    │ 0.00 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ SafeMath                                                             │ 0.07 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ SafeMath16                                                           │ 0.07 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ SafeMath8                                                            │ 0.07 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ SupportsInterfaceWithLookup                                          │ 0.46 KiB │
├──────────────────────────────────────────────────────────────────────┼──────────┤
│ TakesPoints                                                          │ 0.23 KiB │
└──────────────────────────────────────────────────────────────────────┴──────────┘
vcavallo commented 1 year ago

Is it just me, or are tests that involve Ecliptic failing for everyone?

image

image

image

I'm an ethereum novice, so it's a bit beyond me to debug this (or to even know if it's "broken" or just an issue with my local setup), but it looks like the error message above isn't lying:

5 arguments image

4 arguments in test image

Any help or advice would be appreciated. I'm writing a contract that integrates very thinly with Ecliptic, but I'd still like to have test cases for the integration - but without being able to build Ecliptic in the tests, I'm a little stuck.

vcavallo commented 1 year ago

Update: looks like I can just pass another zero as the 5th argument, and as long as my tests don't interact with treasury (I'm not sure what this is), it should be "okay"...