Skip to content

[M4] combined updates after review #64

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 72 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
72 commits
Select commit Hold shift + click to select a range
adb7f23
filecoin-fvm-localnet added
wertikalk Apr 1, 2024
f77e2a0
localnet init
wertikalk Apr 1, 2024
e47beaa
test env regroup
wertikalk Apr 1, 2024
72d4040
hh-test package versions update and refactor
wertikalk Apr 2, 2024
8e8dd6b
stash
wertikalk Apr 4, 2024
a8935f2
market test - done
wertikalk Apr 8, 2024
03203cd
dev. env setup
wertikalk Apr 10, 2024
96e423c
hh config update
wertikalk Apr 11, 2024
730b70b
fil localnet submodule removed
wertikalk Apr 11, 2024
006c82c
localnet restart script added
wertikalk Apr 11, 2024
894f44a
hh-tests: verifreg.t started
wertikalk Apr 11, 2024
4b83cc7
hh-test: verifreg update
wertikalk Apr 11, 2024
e155c07
hh localnet setup cleanup
wertikalk Apr 12, 2024
f7c9d59
hh: init cmt
wertikalk Apr 24, 2024
c7e330c
hh: added localnet tests - account
wertikalk Apr 24, 2024
60caf55
hh: added localnet tests - address
wertikalk Apr 24, 2024
79ca71a
hh: added localnet tests - bigints
wertikalk Apr 24, 2024
5c02698
hh: utils update
wertikalk Apr 24, 2024
df0ca64
dev-env: update
wertikalk Apr 24, 2024
7e05b40
hh: localnet test add - marketcbor
wertikalk Apr 24, 2024
61aa147
hh: localnet market test update
wertikalk Apr 24, 2024
dc53c9a
contracts: update helpers
wertikalk Apr 24, 2024
caf96f9
hh: localnet tests add: send, deserializeParams, cbordecode
wertikalk Apr 24, 2024
e2a5c80
hh: localnet, added leb128 test
wertikalk Apr 24, 2024
601e811
hh: localnet verifreg update
wertikalk Apr 24, 2024
456be22
hh: calibnet init
wertikalk Apr 24, 2024
d2e61e2
hh: calibnet add tests: account and address
wertikalk Apr 24, 2024
c08a77e
hh: added calibnet test versions
wertikalk Apr 24, 2024
618d0ae
hh: localnet, added tests: datacap, miner, power - still wip
wertikalk Apr 24, 2024
3320631
wip: cmt
wertikalk Apr 29, 2024
72ecb24
hh-test: dep. update
wertikalk May 8, 2024
10b872c
hh-tests: calibnet done
wertikalk May 8, 2024
6a9e2ae
hh-tests: localnet done
wertikalk May 8, 2024
8bb0dff
hh-test: dep. update
wertikalk May 8, 2024
d93284c
hh-test: cleanup
wertikalk May 8, 2024
950b206
datacap: update
wertikalk May 10, 2024
5b2fad0
market api: update
wertikalk May 10, 2024
ae40e4d
miner api: update
wertikalk May 10, 2024
f7bf869
optim. update
wertikalk May 10, 2024
3767f6e
optims update
wertikalk May 10, 2024
a318f0a
package version bump
wertikalk May 10, 2024
431a383
fix #55
wertikalk May 10, 2024
00f8cab
hh-test: update
wertikalk May 24, 2024
6fb257f
stack too deep - fix
wertikalk May 24, 2024
7c7f3ea
hh-test: cleanup
wertikalk May 24, 2024
9e5502e
localnet env: update
wertikalk May 24, 2024
93d436e
hh-test: update
wertikalk May 24, 2024
cda4eeb
fix: removing faulty test
wertikalk May 24, 2024
3683237
fix: integration tests
vaniiiii May 31, 2024
4374425
keep bugfix in merge conflict
snissn Jun 3, 2024
34cae2c
Merge branch 'master' into m4-combined
snissn Jun 3, 2024
697a0d2
Merge branch 'm4-combined' of https://github.com/filecoin-project/fil…
wertikalk Jun 17, 2024
4e7f6b2
hh-test: network node localhost added
wertikalk Jun 17, 2024
57e4004
hh-test: upgradeable tests update
wertikalk Jun 17, 2024
7499bc5
sc: unused vars removed
wertikalk Jun 17, 2024
0b3387c
hh-test: utils update
wertikalk Jun 17, 2024
b7fdf78
hh-test: calibnet upgradeable updates
wertikalk Jun 18, 2024
b48b4a5
hh-test: upgradeable uups - cleanup
wertikalk Jun 18, 2024
6004bc9
hh-test: calibnet tx wait time update
wertikalk Jun 18, 2024
bd06734
hh-test: removed .only modifier
wertikalk Jun 18, 2024
1f15eba
gh-actions: update
wertikalk Jun 18, 2024
c846007
gh actions: update
wertikalk Jun 18, 2024
7ff9a02
hh-test: cleanup
wertikalk Jun 18, 2024
6b3cb7d
.gitignore update
wertikalk Jun 18, 2024
c594fea
package: version bump
wertikalk Jun 18, 2024
e9e93b5
empty commit to trigger ci
snissn Jun 21, 2024
4437d31
hh-test: update
wertikalk Jun 24, 2024
2027e80
.env.example update
wertikalk Jun 26, 2024
80eaf0b
Merge branch 'master' into m4-combined-updates
wertikalk Jun 26, 2024
ad54288
.env.example description update
wertikalk Jun 26, 2024
ac41d9c
Merge branch 'm4-combined-updates' of https://github.com/filecoin-pro…
wertikalk Jun 26, 2024
79c63ce
hh-test: market.t fix
wertikalk Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
DEPLOYER_PK=""
# Name of the Docker image used by Developer Env. (./lib-dev/dev-env/)
FIL_SOL_DOCKER_IMG="fil-sol-dev-env:latest-amd64"

# Private key for the "master" (F4-type) account on Calibration network
# - this account is used to fund further all necessary accounts (deployers/actors/...)
# - faucet: https://faucet.calibnet.chainsafe-fil.io/send
ETH_PK=""

# Generated dummy F3-type account on Calibration network using Lotus CLI
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include a recipe/methodology for how to specifically create these values? Is it specifically any f3 account that you fund? Just the lotus commands would be good.

# - IMPORTANT: do not add real funds !!!
# - note:
# - actor IDs don't have to be same on different networks
# while the F3_ADDR, F3_PK would remain still the same
# - F3_ID is the actor id on the Calibration network
F3_ADDR="t3wybme2dab6l3h4zuuzxxteztmtq7jyh6qgrko3urkvhjfqdr33vsus4x5s2ccpuhhc5xscpx3bcpufsf6vzq"
F3_PK="7b2254797065223a22626c73222c22507269766174654b6579223a22484651356a783635315a2f5470734332763846373148746f52706459684e52316b2f577135793968316a673d227d"
F3_ID="112484"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ yarn.lock
typechain-types

.openzeppelin/
.env
.env
.vscode

lib-dev/dev-env/.internal
.wip
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
url = https://github.com/foundry-rs/forge-std
24 changes: 24 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

hh_localnet_setup_lock := "localnet-setup-running.lock"

################ BUILD ################
solc := "./bin/solc"

Expand Down Expand Up @@ -131,6 +133,26 @@ test_deserialize: build
test_address: build
cd testing && cargo test address -- --nocapture

################ TESTS HARDHAT ################

start_localnet:
./lib-dev/dev-env/1_clean-start-localnet.sh

restart_localnet:
./lib-dev/dev-env/2_restart-localnet.sh

simple_start_localnet:
./lib-dev/dev-env/3_clean-simple-start.sh

kill_localnet:
./lib-dev/dev-env/4_kill-lotus-ps.sh

test_hh_localnet:
./lib-dev/dev-env/5_test-run-localnet.sh

test_hh_calibnet:
export HH_NETWORK=calibnet && npx hardhat test --bail

################ TESTS SECURITY ################

security_account_api:
Expand Down Expand Up @@ -205,3 +227,5 @@ install-opencl:
sudo apt-get update
sudo apt-get install ocl-icd-opencl-dev

deps_install: install_solc_linux
yarn install
27 changes: 11 additions & 16 deletions contracts/v0.8/DataCapAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ library DataCapAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Return the DataCap token balance for the wallet address.
Expand All @@ -92,8 +91,7 @@ library DataCapAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Return the allowance between owner and operator address.
Expand All @@ -109,8 +107,7 @@ library DataCapAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Transfers data cap tokens to an address.
Expand Down Expand Up @@ -178,8 +175,7 @@ library DataCapAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Decrease the DataCap token allowance that an operator controls of the owner's balance by the requested amount.
Expand All @@ -202,8 +198,7 @@ library DataCapAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Revoke the DataCap token allowance from the operator and set the operator's allowance in behave of owner/caller address to 0.
Expand All @@ -226,8 +221,7 @@ library DataCapAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Burn an amount of DataCap token from the owner/caller address, decreasing total token supply.
Expand All @@ -243,8 +237,7 @@ library DataCapAPI {
return (0, result.deserializeArrayBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Burn an amount of DataCap token from the specified address (owner address), decrease the allowance of operator/caller, and decrease total token supply.
Expand All @@ -260,7 +253,9 @@ library DataCapAPI {
return (0, result.deserializeBurnFromReturn());
}

DataCapTypes.BurnFromReturn memory empty_res;
return (exit_code, empty_res);
return (
exit_code,
DataCapTypes.BurnFromReturn({balance: CommonTypes.BigInt({val: hex"00", neg: false}), allowance: CommonTypes.BigInt({val: hex"00", neg: false})})
);
}
}
39 changes: 15 additions & 24 deletions contracts/v0.8/MarketAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ library MarketAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Return the escrow balance and locked amount for an address.
Expand All @@ -96,8 +95,10 @@ library MarketAPI {
return (0, result.deserializeGetBalanceReturn());
}

MarketTypes.GetBalanceReturn memory empty_res;
return (exit_code, empty_res);
return (
exit_code,
MarketTypes.GetBalanceReturn({balance: CommonTypes.BigInt({val: hex"00", neg: false}), locked: CommonTypes.BigInt({val: hex"00", neg: false})})
);
}

/// @notice This will be available after the deal is published (whether or not is is activated) and up until some undefined period after it is terminated.
Expand All @@ -118,8 +119,7 @@ library MarketAPI {
return (0, result.deserializeGetDealDataCommitmentReturn());
}

MarketTypes.GetDealDataCommitmentReturn memory empty_res;
return (exit_code, empty_res);
return (exit_code, MarketTypes.GetDealDataCommitmentReturn({data: hex"", size: 0}));
}

/// @notice Returns the client for the specified deal
Expand All @@ -135,8 +135,7 @@ library MarketAPI {
return (0, result.deserializeUint64());
}

uint64 empty_res;
return (exit_code, empty_res);
return (exit_code, uint64(0));
}

/// @notice Returns the provider for a specified deal
Expand All @@ -157,8 +156,7 @@ library MarketAPI {
return (0, result.deserializeUint64());
}

uint64 empty_res;
return (exit_code, empty_res);
return (exit_code, uint64(0));
}

/// @notice Returns the label of a storage deal
Expand All @@ -174,8 +172,7 @@ library MarketAPI {
return (0, result.deserializeDealLabel());
}

CommonTypes.DealLabel memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.DealLabel({data: hex"", isString: false}));
}

/// @notice Returns the start epoch and duration(in epochs) of a deal proposal.
Expand All @@ -191,8 +188,7 @@ library MarketAPI {
return (0, result.deserializeGetDealTermReturn());
}

MarketTypes.GetDealTermReturn memory empty_res;
return (exit_code, empty_res);
return (exit_code, MarketTypes.GetDealTermReturn({start: CommonTypes.ChainEpoch.wrap(0), duration: CommonTypes.ChainEpoch.wrap(0)}));
}

/// @notice Returns the total price that will be paid from the client to the provider for this deal.
Expand All @@ -213,8 +209,7 @@ library MarketAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice get the client collateral requirement for a deal
Expand All @@ -235,8 +230,7 @@ library MarketAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Returns the provider's collateral requirement for a deal
Expand All @@ -257,8 +251,7 @@ library MarketAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Returns the verified flag for a deal
Expand All @@ -280,8 +273,7 @@ library MarketAPI {
return (0, result.deserializeBool());
}

bool empty_res;
return (exit_code, empty_res);
return (exit_code, false);
}

/// @notice Fetches activation state for a deal.
Expand All @@ -301,8 +293,7 @@ library MarketAPI {
return (0, result.deserializeGetDealActivationReturn());
}

MarketTypes.GetDealActivationReturn memory empty_res;
return (exit_code, empty_res);
return (exit_code, MarketTypes.GetDealActivationReturn({activated: CommonTypes.ChainEpoch.wrap(0), terminated: CommonTypes.ChainEpoch.wrap(0)}));
}

/// @notice Publish a new set of storage deals (not yet included in a sector).
Expand Down
24 changes: 8 additions & 16 deletions contracts/v0.8/MinerAPI.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ library MinerAPI {
return (0, result.deserializeGetOwnerReturn());
}

MinerTypes.GetOwnerReturn memory empty_res;
return (exit_code, empty_res);
return (exit_code, MinerTypes.GetOwnerReturn({owner: CommonTypes.FilAddress({data: hex""}), proposed: CommonTypes.FilAddress({data: hex""})}));
}

/// @notice Proposes or confirms a change of owner address.
Expand Down Expand Up @@ -96,8 +95,7 @@ library MinerAPI {
return (0, result.deserializeBool());
}

bool empty_res;
return (exit_code, empty_res);
return (exit_code, false);
}

/// @dev For more information about sector sizes, please refer to https://spec.filecoin.io/systems/filecoin_mining/sector/#section-systems.filecoin_mining.sector
Expand All @@ -113,8 +111,7 @@ library MinerAPI {
return (0, result.deserializeUint64());
}

uint64 empty_res;
return (exit_code, empty_res);
return (exit_code, uint64(0));
}

/// @notice This is calculated as actor balance - (vesting funds + pre-commit deposit + initial pledge requirement + fee debt)
Expand All @@ -136,8 +133,7 @@ library MinerAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}

/// @notice Returns specified miner's vesting funds
Expand All @@ -150,8 +146,7 @@ library MinerAPI {
if (exit_code == 0) {
return (0, result.deserializeGetVestingFundsReturn());
}
MinerTypes.VestingFunds[] memory empty_res;
return (exit_code, empty_res);
return (exit_code, new MinerTypes.VestingFunds[](0));
}

/// @notice Proposes or confirms a change of beneficiary address.
Expand Down Expand Up @@ -298,8 +293,7 @@ library MinerAPI {
return (0, result.deserializeArrayFilAddress());
}

CommonTypes.FilAddress memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.FilAddress({data: hex""}));
}

/// @notice Returns miner's multiaddresses
Expand All @@ -314,8 +308,7 @@ library MinerAPI {
return (0, result.deserializeGetMultiaddrsReturn());
}

CommonTypes.FilAddress[] memory empty_res;
return (exit_code, empty_res);
return (exit_code, new CommonTypes.FilAddress[](0));
}

/// @notice Withdraws balance for a specified miner
Expand All @@ -339,7 +332,6 @@ library MinerAPI {
return (0, result.deserializeBytesBigInt());
}

CommonTypes.BigInt memory empty_res;
return (exit_code, empty_res);
return (exit_code, CommonTypes.BigInt({val: hex"00", neg: false}));
}
}
Loading
Loading