Rari-Capital / fuse-v1

Smart contracts for Fuse V1 by Rari Capital.
Other
3 stars 3 forks source link

Port tests from Midas Protocol #16

Closed zerosnacks closed 2 years ago

zerosnacks commented 2 years ago

Relevant tests to port:

Future:

zerosnacks commented 2 years ago

See https://github.com/Rari-Capital/fuse-v1/tree/feature/port-tests-from-midas-protocol

zerosnacks commented 2 years ago

No longer blocked

zerosnacks commented 2 years ago

Blocked again..

I found out the major source of the problems I was having with testing comes down to the fact that for some odd reason the generated Foundry artifact does not include the bytecode / deployedBytecode for some files (not all) making it impossible to use in tests.

In tests the deployCode does not throw but rather returns that the deployed address has a 0x contract (empty).

  "bytecode": {
    "object": "0x",
    "sourceMap": "",
    "linkReferences": {}
  },
  "deployedBytecode": {
    "object": "0x",
    "sourceMap": "",
    "linkReferences": {}
  }

It appears to be generally limited to contracts without a constructor (Comptroller), which makes sense. But also the Unitroller which does have a constructor. In the Midas Protocol the bytecode is generated correctly.

@sriyantra do you know of a way we could deploy a new instance of a Comptroller in our tests? I don't really see a way we are able to port the unit-style tests from Midas without it.

zerosnacks commented 2 years ago

Unblocked, resolved in #39 for now. I have merged it already into here to resolve the blocker

zerosnacks commented 2 years ago

Closed https://github.com/Rari-Capital/fuse-v1/pull/17

Closing this ticket, decided not to port tests 1:1 from Midas but rather take some of their core learnings and implement them separately.