Skip to content
Draft
Show file tree
Hide file tree
Changes from 46 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
cc8b238
chore: add foundry to package deps
Seth-Schmidt Feb 26, 2026
eb8322c
feat: initial simple invariant test for protocol staking
Seth-Schmidt Mar 3, 2026
32dae45
chore: use multiple periods for total supply invariant test
Seth-Schmidt Mar 4, 2026
e3d8529
feat: add ProtocolStakingHandler and use built-in invariant testing
Seth-Schmidt Mar 4, 2026
3c55b59
chore: cleanup old invariant tests
Seth-Schmidt Mar 4, 2026
f06d916
chore: rename protocol staking invariant test file
Seth-Schmidt Mar 4, 2026
8d0e8ea
feat: add invariant for total staked weight
Seth-Schmidt Mar 4, 2026
7ffc002
feat: support multiple actors for invariant tests
Seth-Schmidt Mar 4, 2026
0e3e79e
chore: remove debugging test
Seth-Schmidt Mar 4, 2026
49186e0
chore: add invariant for reward debt conservation; support storage reads
Seth-Schmidt Mar 4, 2026
086ae97
chore: add monotonicity fuzz tests for claimed, claimable, and awaiti…
Seth-Schmidt Mar 4, 2026
af3703c
fix: improper handling of the awaiting release invariant
Seth-Schmidt Mar 4, 2026
9c78c71
chore: add invariant for ending withdrawals solvency
Seth-Schmidt Mar 4, 2026
5830bf5
chore: add invariant for staking funds solvency
Seth-Schmidt Mar 4, 2026
5142a29
chore: add unstake queue monotonicity invariant test
Seth-Schmidt Mar 5, 2026
da83054
feat: add scenario handling for complex invariants
Seth-Schmidt Mar 5, 2026
2d2aa1b
chore: add handler for setUnstakeCooldownPeriod
Seth-Schmidt Mar 5, 2026
de6e463
chore: add TESTING.md for testing documentation
Seth-Schmidt Mar 5, 2026
f05331a
chore: protocol staking handler cleanup
Seth-Schmidt Mar 5, 2026
c07b8cc
fix: use modifier pattern for transitional invariants in favor of sta…
Seth-Schmidt Mar 6, 2026
5a5eceb
chore: update TESTING.md
Seth-Schmidt Mar 6, 2026
f36f141
chore: fail on revert enabled for handler modifier
Seth-Schmidt Mar 6, 2026
1b2a8a6
chore: comment cleanup
Seth-Schmidt Mar 6, 2026
45197eb
chore: bump invariant runs
Seth-Schmidt Mar 6, 2026
036cebd
chore: use harness to expose internal storage for testing
Seth-Schmidt Mar 6, 2026
1ef6f04
chore: remove unnecessary ghost_eligibleAccounts and simplify
Seth-Schmidt Mar 6, 2026
97d102f
chore: move scenario assertions inside scenario functions
Seth-Schmidt Mar 6, 2026
f1cd625
chore: assert 0 reward debt when staking is empty
Seth-Schmidt Mar 6, 2026
a21a879
chore: cleanup post-state transition invariant assertions
Seth-Schmidt Mar 6, 2026
987f8a4
chore: use forge-std from foundry installation
Seth-Schmidt Mar 6, 2026
61d738b
fix: apply tolerance to net reward debt on 0 stake weight
Seth-Schmidt Mar 6, 2026
b0b880b
fix: file linking in TESTING.md
Seth-Schmidt Mar 7, 2026
188ab6a
chore: prettier formatting
Seth-Schmidt Mar 7, 2026
c505307
fix: rename TESTING.md to FUZZING.md for clarity
Seth-Schmidt Mar 9, 2026
32ed0f5
chore: reduce runs for fuzz testing
Seth-Schmidt Mar 9, 2026
6bc32da
chore: fuzz initial values in invariant test setup
Seth-Schmidt Mar 9, 2026
931517a
fix: title in FUZZING.md
Seth-Schmidt Mar 9, 2026
c1d7182
fix: use makeAddr for actor accounts
Seth-Schmidt Mar 9, 2026
18e7bc9
chore: cleanup unnecessary selector targeting
Seth-Schmidt Mar 9, 2026
dece594
chore: use targetSender in favor of actor index bounding
Seth-Schmidt Mar 9, 2026
1bea63a
chore: allow for certain accounts to never be eligible
Seth-Schmidt Mar 9, 2026
6a28a1f
fix: only increment ghost accumulated reward capacity when staked
Seth-Schmidt Mar 9, 2026
5e54e3a
fix: increase MAX_PERIOD_DURATION and decouple MAX_UNSTAKE_COOLDOWN_P…
Seth-Schmidt Mar 9, 2026
7394a67
chore: remove wei buffer for invariant_TotalSupplyBoundedByRewardRate…
Seth-Schmidt Mar 9, 2026
14a9a04
fix: update invariant tolerances with concrete bounds
Seth-Schmidt Mar 10, 2026
ed53d1e
fix: linting errors
Seth-Schmidt Mar 10, 2026
4e3b748
test: add unit tests for minting unbacked wei using unstake
Seth-Schmidt Mar 14, 2026
5232c36
test: update ProtocolStakingHandler contract description
Seth-Schmidt Mar 19, 2026
61be67d
test: implement per-call totalSupply tolerance for weight decreasing …
Seth-Schmidt Mar 19, 2026
18d107f
test: add test_CompoundPhantomWei
Seth-Schmidt Mar 19, 2026
ba73c02
test: add tolerance for weight-increase operations tracking allocatio…
Seth-Schmidt Mar 19, 2026
c1732d9
test: update unit examples with tighter bounds
Seth-Schmidt Mar 19, 2026
a03ebe2
test: update documentation around reward debt in handler
Seth-Schmidt Mar 19, 2026
3d85af7
test: improve docmentation around actor handling by fuzzer
Seth-Schmidt Mar 19, 2026
59f78dd
test: refactor reward queue monotonicity to stronger full invariant
Seth-Schmidt Mar 19, 2026
97618af
test: improve handler and invariant documentation
Seth-Schmidt Mar 19, 2026
ef39234
test: fuzzing.md cleanup
Seth-Schmidt Mar 19, 2026
fb34e72
test: move earned is zero after claim to transition invariant
Seth-Schmidt Mar 19, 2026
106d199
test: match invariant ordering to documentation
Seth-Schmidt Mar 19, 2026
014ddd6
test: fix linting
Seth-Schmidt Mar 19, 2026
2440f39
test: improve documentation around unit tests justifying tolerance bo…
Seth-Schmidt Mar 19, 2026
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
1 change: 1 addition & 0 deletions contracts/staking/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ contracts-exposed
# Foundry
/out
/cache_forge
/lib/forge-std

yarn.lock
fhevmTemp
21 changes: 19 additions & 2 deletions contracts/staking/foundry.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
[profile.default]
src = 'contracts'
libs = ['node_modules']
out = 'out'
test = 'test/foundry'
cache_path = 'cache_forge'
libs = ['lib', 'node_modules']
solc = '0.8.27'
optimizer_runs = 200
optimizer = true
optimizer_runs = 800
evm_version = 'cancun'

remappings = [
'forge-std/=lib/forge-std/src/',
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/',
'@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/',
'token/=../token/',
]

[invariant]
runs = 296
depth = 100
fail_on_revert = true
45 changes: 26 additions & 19 deletions contracts/staking/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions contracts/staking/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"lint:sol": "prettier --loglevel warn '{contracts,test}/**/*.sol' --check && solhint --config solhint.config.js '{contracts,test}/**/*.sol'",
"lint:sol:fix": "solhint --config solhint.config.js '{contracts,test}/**/*.sol' --fix; prettier --loglevel warn '{contracts,test}/**/*.sol' --write",
"test": "hardhat test",
"test:fuzz": "forge test",
"test:fuzz:verbose": "forge test -vvv",
"test:tasks": "hardhat test:tasks",
"test:gas": "REPORT_GAS=true hardhat test",
"test:pragma": "npm run compile && scripts/checks/pragma-validity.js artifacts/build-info/*",
Expand Down
Loading