Clone and start the: filecoin-localnet. For this feature only lotus and lotus-miner are needed (in the docker-compose.yaml you can comment out other services).
fetch the changes from this branch and yarn install
Run: npx hardhat run hh-test/market.sample.t.ts --network localnet
(WIP) Different proxy mechanism tests: npx hardhat run test --network localnet
How it works (Overview)
It utilises Lotus CLI and Lotus Miner CLI to create new accounts that will be used in the hardhat test and to issue additional commands needed to sign messages and change the miner's control address (Note: miner's control addresses is the address that has the privilege to publish deals on the behalf of the provider).
Test flow
Sample file: ./hh-test/market.sample.t.ts
Scenario:
Generate all of the accounts needed (deployer (F4/ETH address), anyone (F4/ETH address) and client (F3/BLS address))
Note: the provider is created by lotus-miner and stays constant between runs
Fund the newly created accounts (native FIL balances)
Deploy all contracts (Market and Helper)
Set the miner's control address to the Market Contract's one (F4 address and not the ETH equivalent)
Add funds to the ecrow for client and provider
Generate the deal parameters
Serialise the deal parameters using the Helper contract
Note: This is CBOR serialisation, due to many custom solidity types I assume there is no better way to do this
Sign the serialised deal parameters by the client
Publish the deal (done by anyone)
Compare all of the expected vs actual values
For proxy tests, this scenario will be expanded such that deal publishing/checking is performed before and after the upgrade.
Additional useful material
Lotus/Lotus Miner CLI is your best friend (completely read those docs)
Description:
This setup provides a more readable and concise way of testing when compared to present rust tests.
Related to #2 . It enables the use of hardhat's openzeppelin upgrade plugin needed for closing the issue.
Note: It creates a hybrid foundry-hardhat project
Setup:
lotus
andlotus-miner
are needed (in the docker-compose.yaml you can comment out other services).yarn install
npx hardhat run hh-test/market.sample.t.ts --network localnet
npx hardhat run test --network localnet
How it works (Overview)
It utilises Lotus CLI and Lotus Miner CLI to create new accounts that will be used in the hardhat test and to issue additional commands needed to sign messages and change the miner's control address (Note: miner's control addresses is the address that has the privilege to publish deals on the behalf of the provider).
Test flow
Sample file:
./hh-test/market.sample.t.ts
Scenario:
For proxy tests, this scenario will be expanded such that deal publishing/checking is performed before and after the upgrade.
Additional useful material
docker exec lotus lotus evm invoke t410f...q <ABI encoded params>
0x
prefix--method/value
options and providing CBOR encoded params (see CBOR playground)Fixes #2