Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
425 commits
Select commit Hold shift + click to select a range
f0f0966
Verify the validator's withdraw credentials are the staking strategy …
naddison36 Jul 22, 2025
efe7d10
fix: add slither disable comments for reentrancy checks in Compoundin…
clement-ux Jul 22, 2025
65c2df6
Added how to get validator balance proofs
naddison36 Jul 22, 2025
bb40965
refactor: migrate validators data into external json.
clement-ux Jul 22, 2025
ddd5141
minor changes to the testnet
sparrowDom Jul 22, 2025
2ac7fa4
Add more validator data
clement-ux Jul 22, 2025
adee5d4
Improved beacon chain error handling
naddison36 Jul 22, 2025
41c8078
Change Lodestar to use BEACON_PROVIDER_URL env var
naddison36 Jul 23, 2025
2f9439a
prettier
naddison36 Jul 23, 2025
a9e0905
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Jul 23, 2025
7d1fd13
Merge remote-tracking branch 'origin/clement/pectra-test' into nicka/…
naddison36 Jul 23, 2025
ebbd8d2
Added more validator proofs
naddison36 Jul 23, 2025
5f3136d
Updated unit tests
naddison36 Jul 23, 2025
57296b7
Changed balance proof error in verifyValidatorBalance
naddison36 Jul 23, 2025
fb63f75
Improved verifyBalances HH output
naddison36 Jul 23, 2025
ea66248
add proof for validator
clement-ux Jul 23, 2025
21598a9
add deposit proofs
clement-ux Jul 23, 2025
5944dc0
add balance proof for all validators
clement-ux Jul 23, 2025
b98ecde
Mock Beacon Roots (#2596)
sparrowDom Jul 23, 2025
08fc474
Added requestValidatorWithdraw Hardhat task
naddison36 Jul 24, 2025
9df6cbe
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Jul 24, 2025
c9b2d01
Merge remote-tracking branch 'origin/clement/pectra' into nicka/pectra
naddison36 Jul 24, 2025
4bb241c
Updated validator proofs
naddison36 Jul 24, 2025
073755f
add more validators data
clement-ux Jul 24, 2025
30c14d8
add a last validator
clement-ux Jul 24, 2025
43bd569
Add balance proof for 20 validators
clement-ux Jul 24, 2025
00470ed
add a new validators
clement-ux Jul 24, 2025
a241689
add nex balance proof for 21 validators
clement-ux Jul 24, 2025
42a6cf5
add support for hoodie when calling registerValidator
sparrowDom Jul 24, 2025
d3f5903
add check that validator ids are in ascending order
sparrowDom Jul 24, 2025
211d97b
add a task for the initial 1 ETH deposit
sparrowDom Jul 24, 2025
e9232c4
Fix bug in verifyBalances when an active validator is exited
naddison36 Jul 25, 2025
ef388ba
Prettier
naddison36 Jul 25, 2025
67a20a5
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Jul 25, 2025
1583cd9
sort the operator ids instead of throwing an error
sparrowDom Jul 25, 2025
1557632
prettier
naddison36 Jul 25, 2025
c90a3e2
Changed requestConsolidation on the old staking strategy to only be c…
naddison36 Jul 25, 2025
978860e
Added getValidator Hardhat task
naddison36 Jul 25, 2025
29c975f
Merge remote-tracking branch 'origin/master' into nicka/pectra
naddison36 Jul 28, 2025
e14ab55
Remove log output
naddison36 Jul 28, 2025
cd3e20b
snapBalances changed to be external from public
naddison36 Jul 28, 2025
4036090
Added onlyRegistrator to snapBalances to prevent denial of calling ve…
naddison36 Jul 28, 2025
5ba173b
Removed onlyRegistrator from verifyBalances as its on snapBalances
naddison36 Jul 28, 2025
231c6eb
Added extra checks on the number of balance leaves and proofs in veri…
naddison36 Jul 28, 2025
1780fc2
Made Endian library MIT as its used by BeaconOracle which is also MIT
naddison36 Jul 28, 2025
0cfbb75
Changed the initial validator deposit to be 32 ETH
naddison36 Jul 28, 2025
c758cfd
Formatted the output of getValidator Hardhat task
naddison36 Jul 28, 2025
4d7a4bf
Added more data to getValidator hardhat task
naddison36 Jul 29, 2025
aaf3f1a
Updated validatorWithdrawal Natspec with new understanding of how ful…
naddison36 Jul 29, 2025
d675da1
Added Hoodi upgrade script for the staking strategy
naddison36 Jul 29, 2025
c331f4b
Removed reverts from BeaconRoots contract as the underlying beacon ro…
naddison36 Jul 29, 2025
e6e0679
Deployed new MockBeaconRoots
naddison36 Jul 29, 2025
a404f66
Upgraded the CompoundingStakingSSVStrategyProxy on Hoodi
naddison36 Jul 29, 2025
31fe160
Fixes to Hardhat tasks
naddison36 Jul 29, 2025
71d2471
add deployment files
sparrowDom Jul 29, 2025
5013b4c
Changed the WETH contract for Hoodi
naddison36 Jul 30, 2025
4190566
Changed the Hoodi strategist and governor to be the Relayer
naddison36 Jul 30, 2025
aeed943
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Jul 30, 2025
ff6a5ef
Governor spelling
naddison36 Jul 30, 2025
4c2ee7c
Upgraded the OETH Vault on Hoodi
naddison36 Jul 30, 2025
7467169
Upgrade the compounding staking strategy to use new WETH token
naddison36 Jul 30, 2025
3e5afdc
Added tenderlyUpload to verify a single contract
naddison36 Jul 30, 2025
1da4051
beacon proof generators to handle Hoodi
naddison36 Jul 30, 2025
2b24ba4
Deployed new BeaconProofs and CompoundingStakingSSVStrategy
naddison36 Jul 30, 2025
20652b3
Add 1 wei of value to validatorWithdrawal call
naddison36 Jul 30, 2025
e456a67
verifySlot can now be done from a block
naddison36 Jul 30, 2025
91e33e4
Renamed validatorContainerProof to balancesContainerProof
naddison36 Jul 30, 2025
d58f43d
Upgraded the native staking contract on Hoodi
naddison36 Jul 30, 2025
b231c15
Merge remote-tracking branch 'origin/master' into nicka/pectra
naddison36 Jul 31, 2025
c06d3ee
Renamed the ETH/WETH conversion functions
naddison36 Jul 31, 2025
f402e01
P2P API support for Hoodi
naddison36 Jul 31, 2025
c15416b
Updated verifySlot options
naddison36 Jul 31, 2025
1c71c56
Prettier
naddison36 Jul 31, 2025
6d505e9
Fix storage checker
naddison36 Jul 31, 2025
a64f644
Fix old Native Staking fork tests
naddison36 Jul 31, 2025
c8f6b57
bulk exit and remove validator (#2185)
naddison36 Jul 31, 2025
236b930
Changed verifyBalances so a slot before the first pending deposit can…
naddison36 Jul 31, 2025
3450a7a
Fixed check in verifyBalances
naddison36 Jul 31, 2025
d8939ea
Preparing HH tasks to be run as Actions
naddison36 Aug 1, 2025
ce743f7
Defender Action to verify slots
naddison36 Aug 1, 2025
2c36fe3
Deployed latest compounding staking strategy
naddison36 Aug 1, 2025
daa6334
Added getPendingDeposits view function
naddison36 Aug 1, 2025
f1e7f96
Updated snapStakingStrat HH task
naddison36 Aug 1, 2025
0bc74d8
Improved error message when generating verifyBalances proof
naddison36 Aug 3, 2025
a7761ea
Remove BeaconOracle from new staking strategy (#2608)
naddison36 Aug 4, 2025
c896a35
Merge branch 'nicka/pectra' of github.com:OriginProtocol/origin-dolla…
naddison36 Aug 4, 2025
7d633d4
add comment
sparrowDom Aug 4, 2025
1108bc7
Nicka/pectra remove consolidation (#2609)
naddison36 Aug 4, 2025
32e21d6
Merge branch 'nicka/pectra' of github.com:OriginProtocol/origin-dolla…
naddison36 Aug 4, 2025
811fe79
Removed TargetStrategyAdded
naddison36 Aug 4, 2025
c59838a
Simplified verifyValidatorBalance
naddison36 Aug 4, 2025
8ea45b2
Cleaned up defender actions
naddison36 Aug 4, 2025
bc2032e
Merge remote-tracking branch 'origin/master' into nicka/pectra
naddison36 Aug 4, 2025
d1391f5
Deployed to Hoodi
naddison36 Aug 4, 2025
64e0409
Add setRegistrator HH task
naddison36 Aug 4, 2025
5d70361
add an in depth explanation of the accounting behaviour (#2610)
sparrowDom Aug 4, 2025
9cf0db5
Updates to Hardhat tasks
naddison36 Aug 5, 2025
e171e9a
Natspec cleanup
naddison36 Aug 5, 2025
96703da
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Aug 5, 2025
db247a0
Prettier
naddison36 Aug 5, 2025
45ad224
Changed validatorWithdrawal to be payable so the 1 wei fee can be paid
naddison36 Aug 5, 2025
c5ea7c6
Added deposit root to the getPendingDeposits output
naddison36 Aug 5, 2025
c398831
Fix verifyDeposit when the deposit queue is empty
naddison36 Aug 5, 2025
618abca
Updated OETH contracts diagram and staking transitions diagram
naddison36 Aug 5, 2025
daf600e
improved getValidator
naddison36 Aug 5, 2025
ff04605
Added more logging
naddison36 Aug 5, 2025
7d31f69
Validator task upgrades (#2614)
sparrowDom Aug 5, 2025
b6cf000
Changed verifyFirstPendingDepositSlot to return of the deposit queue …
naddison36 Aug 5, 2025
0a489fc
Prettier js
naddison36 Aug 5, 2025
71c2bf9
Check if slot of the pending deposit is zero
naddison36 Aug 6, 2025
d4154a6
Deployed new contracts to Hoodi
naddison36 Aug 6, 2025
cf30076
Added off-chain checks for zero value slots
naddison36 Aug 6, 2025
3631246
Added more logging to HH tasks
naddison36 Aug 6, 2025
d9da029
Fix linter
naddison36 Aug 6, 2025
719edd1
Fix full exit logic in HH task
naddison36 Aug 6, 2025
dd3e0f8
Fixed partial withdrawal in HH task
naddison36 Aug 6, 2025
89c7210
Improved snapStakingStrat HH task
naddison36 Aug 6, 2025
6d351b7
Added more checks to proof verifications
naddison36 Aug 6, 2025
346ca88
DEployed the latest contracts to Hoodi
naddison36 Aug 6, 2025
1f4ad68
Make sure the beacon chain data matches the block used in snapStaking…
naddison36 Aug 7, 2025
2f588d2
adjust comment
sparrowDom Aug 7, 2025
512f2b2
Add pending beacon chain deposits info to snapStakingStrat
naddison36 Aug 7, 2025
270c8e2
added more validator info to snapStakingStrat
naddison36 Aug 7, 2025
a6140e1
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Aug 7, 2025
f22e6ee
Merge remote-tracking branch 'origin/master' into nicka/pectra
naddison36 Aug 7, 2025
fb5e5a5
Updated Natspec
naddison36 Aug 7, 2025
823af48
Call safeApproveAllTokens from initialize function
naddison36 Aug 7, 2025
b01ccf1
Added comment on use of min in _transferWeth
naddison36 Aug 7, 2025
182b0ba
Added check of validator public key length to registerSsvValidator
naddison36 Aug 7, 2025
0a6add6
Fixed Natspec on validatorWithdrawal
naddison36 Aug 8, 2025
303b6e9
Fixed removeSsvValidator Natspec
naddison36 Aug 8, 2025
5e53450
Read depositsRoots.length into memory in getPendingDeposits
naddison36 Aug 8, 2025
3252df3
Fixed Slither
naddison36 Aug 8, 2025
0cdcb68
Upgraded the contracts on Hoodi
naddison36 Aug 8, 2025
0802243
Minor changes to request validator HH tasks
naddison36 Aug 8, 2025
347d06c
Add test coverage of getPendingDeposits
naddison36 Aug 8, 2025
6c1ce3d
Add test that collectRewardTokens is unsupported
naddison36 Aug 8, 2025
2a04afa
Fix off-chain verifyBalances when deposit queue is empty
naddison36 Aug 10, 2025
c20989a
Moved check of public key length into `_hashPubKey`
naddison36 Aug 11, 2025
8d2d0e3
Update HOODI API key
naddison36 Aug 11, 2025
395b9cd
Removed beaconOracle ABI as its no longer used
naddison36 Aug 11, 2025
4de19bc
Removed .out file
naddison36 Aug 11, 2025
09d4ee0
No longer need the optional provider in getSigner factory
naddison36 Aug 11, 2025
4508bbe
Prettier
naddison36 Aug 11, 2025
a77bc5b
Removed _asset from internal _withdraw function
naddison36 Aug 11, 2025
26c889f
Simplified setting of the lastVerifiedEthBalance in _convertEthToWeth
naddison36 Aug 11, 2025
0951ea4
Override setPTokenAddress and removePToken so they revert with "Unsup…
naddison36 Aug 11, 2025
fd21ed6
add comment
sparrowDom Aug 12, 2025
a287f1c
OZ C-01 - Postponed Pending Deposit Breaks verifyDeposit and verifyB…
naddison36 Aug 22, 2025
9afeaa9
Added nextDepositID to be a unique identifier of a deposit to a valid…
naddison36 Aug 22, 2025
7ae469d
Break from iterating over the deposits once the deposit has been foun…
naddison36 Aug 22, 2025
f5bf5f4
Added Compounding Validator State Diagram
naddison36 Aug 22, 2025
c2cc5aa
Improved Beacon Proof constants for readability (#2625)
naddison36 Aug 22, 2025
6b7d42f
Removed the unused SourceStrategyAdded event (#2626)
naddison36 Aug 22, 2025
a15c7db
Added EXITING validator state to help prevent deposits to exiting val…
naddison36 Aug 22, 2025
e460481
set validator status to exiting if such transition detected (#2629)
sparrowDom Aug 22, 2025
1fb2bca
M-02 registrator protections (#2630)
naddison36 Aug 22, 2025
78e29f1
Fixed check of deposit being processed in verifyBalances
naddison36 Aug 22, 2025
5321b03
Merge remote-tracking branch 'origin/master' into nicka/pectra
naddison36 Aug 22, 2025
616be40
N-07 Code Simplifications (#2631)
clement-ux Aug 23, 2025
8c5e78c
N-08 Missing, Incorrect, or Misleading Documentation (#2632)
clement-ux Aug 23, 2025
3e24f63
Changed SNAP_BALANCES_DELAY to 1 epoch
naddison36 Aug 23, 2025
57951f2
Set zero governor on implementation contract
naddison36 Aug 23, 2025
8995fac
Deployed latest contracts on Hoodi
naddison36 Aug 23, 2025
307bfa9
Moved new deposit storage variables for backward compatibility with H…
naddison36 Aug 23, 2025
8a0466c
Redeployed CompoundingStakingSSVStrategy to Hoodi
naddison36 Aug 23, 2025
938a15e
Moved new deposit storage variables back up as now deploying a new st…
naddison36 Aug 23, 2025
f68d8f6
Deployed a new compounding staking contract to Hoodi
naddison36 Aug 24, 2025
1785c2d
Fixed snapStakingStrat
naddison36 Aug 24, 2025
786d22a
Fixed verifyBalances when a deposit is done to an exiting validator
naddison36 Aug 24, 2025
5075002
Skip failing unit test for now
naddison36 Aug 24, 2025
ec4834e
Deployed latest staking contract to Hoodi
naddison36 Aug 24, 2025
f078483
FIxed verifyBalances when there are no pending deposits
naddison36 Aug 24, 2025
bf5b447
Updated OETH contracts diagram
naddison36 Aug 25, 2025
ff92ae0
Updated verifyDeposit process flow
naddison36 Aug 25, 2025
7d5308c
simplify snapping balances (#2633)
sparrowDom Aug 26, 2025
ff1b017
OZ N-03 Checks Effects Interactions (CEI) Pattern (#2634)
naddison36 Aug 26, 2025
92d1465
various minor changes to SSV staking (#2635)
sparrowDom Aug 26, 2025
9e98081
Redeployed latest staking contract to Hoodi
naddison36 Aug 26, 2025
bc96964
Fixed snapStakingStrat Hardhat task
naddison36 Aug 26, 2025
bc39b02
Removed root from VerifyBalances Hardhat task
naddison36 Aug 26, 2025
0bbb0e7
Added removeValidator Hardhat task
naddison36 Aug 27, 2025
3aac286
Fixed registration of new compounding validator
naddison36 Aug 27, 2025
314466c
Fixed verifyBalances Hardhat task
naddison36 Aug 27, 2025
b414887
verifyBalance to default validator slot for verification to the same …
naddison36 Aug 27, 2025
d130c6c
Fixed verifyDeposit Hardhat task
naddison36 Aug 27, 2025
7115e2c
Improve verifyBalances hardhat task when the deposit queue is empty
naddison36 Aug 27, 2025
a2401cf
Fixed validator status in snapStakingStrat HH task
naddison36 Aug 27, 2025
1600e4a
change snap balances delay to 35 slots (#2637)
sparrowDom Aug 27, 2025
640c247
add comment (#2638)
sparrowDom Aug 28, 2025
67d89e9
Added dryrun to stakeValidator HH task
naddison36 Aug 28, 2025
44f9516
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Aug 28, 2025
a60971d
Fixed logging of the deposit ID from stakeValidator HH task
naddison36 Aug 28, 2025
a2fa014
add the support to verify BLS signature before depositing to validato…
sparrowDom Aug 29, 2025
8b2609d
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Aug 29, 2025
2b7ea1d
Removed withdrawable check from verifyDeposit (#2640)
naddison36 Aug 29, 2025
c475120
allow for multiple full/partial validator exits even if full exit req…
sparrowDom Aug 30, 2025
b65d08a
change validator index from uint64 to uint40 (#2642)
sparrowDom Aug 30, 2025
c7c7e29
account as early as possible for the loss because of the front run de…
sparrowDom Aug 30, 2025
163fe89
[SP - 4] Verify validator type (#2644)
sparrowDom Aug 30, 2025
96f6ad3
Deployed latest to Hoodi
naddison36 Aug 30, 2025
ac3dfe5
Fix verifyDeposit Hardhat task
naddison36 Aug 30, 2025
057c8d4
Redeployed both BeaconProofs and CompoundingStakingSSVStrategy to Hoodi
naddison36 Aug 30, 2025
d11d44a
Deployed new strategy to Hoodi
naddison36 Sep 1, 2025
36b587a
Restrict initial deposit to 1 ETH (#2646)
naddison36 Sep 1, 2025
f6eee53
fix slither
sparrowDom Sep 1, 2025
8cfd0e0
Validator deposit and withdrawal amounts can have decimals
naddison36 Sep 2, 2025
4423d24
Format snapStakingStrat
naddison36 Sep 2, 2025
575ca56
Do not allow exiting a validator with a pending deposit (#2647)
naddison36 Sep 2, 2025
aa45d0f
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Sep 3, 2025
ecb4edb
Merge remote-tracking branch 'origin/master' into nicka/pectra
naddison36 Sep 3, 2025
0fbdad6
prettier
sparrowDom Sep 3, 2025
3d4e5f0
add check for zero padding in withdrawal credentials (#2645)
sparrowDom Sep 3, 2025
fcce858
ORGN-01 Array Element Skipping During Deposit Removal in verifyBalanc…
naddison36 Sep 3, 2025
ae47b8e
Fix for: Deposit Balance Undercount Due To Missing Timestamp Validati…
sparrowDom Sep 4, 2025
8eb0228
Fixed unit test of verifyValidator proof
naddison36 Sep 4, 2025
9c7bfac
Deposits to withdrawn validator (#2652)
sparrowDom Sep 4, 2025
68d6909
SP-12 Miscellaneous General Comments (#2657)
naddison36 Sep 5, 2025
70f9171
Fixed verificationEpoch calc to use the slot of the parent root (#2656)
naddison36 Sep 5, 2025
82e7acc
Added more unit tests for verifyBalances
naddison36 Sep 8, 2025
8d2bcc4
Fixed the unit tests
naddison36 Sep 8, 2025
5a7c4ae
Added unit test for removing an invalid validator
naddison36 Sep 8, 2025
ea4cace
Deploy to latest to Hoodi
naddison36 Sep 9, 2025
d262254
remove deposit count subtraction as it is no longer needed (#2660)
sparrowDom Sep 11, 2025
23fe8e0
simplify withdrawal credential comparison (#2659)
sparrowDom Sep 11, 2025
665bf52
correct the comment (#2663)
sparrowDom Sep 12, 2025
ba18006
Refactor verifyBalances to use inclusion proofs of pending deposits (…
naddison36 Sep 15, 2025
4367ae9
Restrict full withdrawals for non activateable validators (#2662)
sparrowDom Sep 15, 2025
741062a
Logging and linter
naddison36 Sep 17, 2025
e7fc5d2
Fix to allow multiple full validator exits (#2667)
naddison36 Sep 17, 2025
90e247d
Increased the min balance to be active to over 32.25 ETH (#2668)
naddison36 Sep 17, 2025
e470ad7
Gas optimization in verifyBalances to only iterate over the deposits …
naddison36 Sep 17, 2025
2cf63a6
restrict pending deposit index to uint32 (#2670)
naddison36 Sep 17, 2025
9518a13
Can verify a deposit if the validator is exiting and the pending depo…
naddison36 Sep 17, 2025
6e722b7
Deployed the latest staking strategy to Hoodi
naddison36 Sep 18, 2025
6124f24
Fixed verifyDeposit Hardhat task
naddison36 Sep 18, 2025
546c47f
Fixed verifyBalances Hardhat task when there is a pending deposit
naddison36 Sep 18, 2025
20fb4bb
Added negative unit tests
naddison36 Sep 18, 2025
613ed9d
Added more unit tests
naddison36 Sep 18, 2025
e8cddb1
ORGN-02 can make a validator INVALID with an incorrect validator type…
naddison36 Sep 19, 2025
b64e305
Deployed the latest contracts to Hoodi
naddison36 Sep 22, 2025
ade07c3
Fixed the validator states in Hardhat task snapStakingStrat
naddison36 Sep 22, 2025
0528675
typo
sparrowDom Sep 23, 2025
10bcaaa
typo
sparrowDom Sep 30, 2025
66c9879
Improve getValidator Hardhat task output
naddison36 Oct 2, 2025
4e1a4fb
Merge remote-tracking branch 'origin/nicka/pectra' into nicka/pectra
naddison36 Oct 2, 2025
9f2eef7
remove comment
sparrowDom Oct 6, 2025
357ed56
remove StakingMonitorChanged event from CompoundingValidatorManager (…
naddison36 Oct 9, 2025
8c3cf41
MAX_VERIFIED_VALIDATORS off by one (#2683)
naddison36 Oct 9, 2025
480333f
Fix comments (#2684)
naddison36 Oct 9, 2025
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
5 changes: 0 additions & 5 deletions contracts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,7 @@ export DEFENDER_TEAM_SECRET=
# set -o allexport && source ../../.env && set +o allexport

# Set the DEBUG environment variable to oeth* for the Defender Action
npx hardhat setActionVars --id 38e44420-f38b-4d4a-86b0-6012a8897ad9
npx hardhat setActionVars --id f4b5b8d4-82ff-483f-bfae-9fef015790ca
npx hardhat setActionVars --id 191d9631-70b9-43c5-9db4-1dd985fde05c
npx hardhat setActionVars --id e2929f53-db56-49b2-b054-35f7df7fc4fb
npx hardhat setActionVars --id 12c153c8-c5ca-420b-9696-e80c827996d1
npx hardhat setActionVars --id 6e4f764d-4126-45a5-b7d9-1ab90cd3ffd6
Expand All @@ -354,9 +352,6 @@ npx hardhat setActionVars --id b1d831f1-29d4-4943-bb2e-8e625b76e82c
# The Defender autotask client uses generic env var names so we'll set them first from the values in the .env file
export API_KEY=${DEFENDER_TEAM_KEY}
export API_SECRET=${DEFENDER_TEAM_SECRET}
# Holesky
npx defender-autotask update-code 38e44420-f38b-4d4a-86b0-6012a8897ad9 ./dist/registerValidators
npx defender-autotask update-code 191d9631-70b9-43c5-9db4-1dd985fde05c ./dist/doAccounting
# Mainnet
npx defender-autotask update-code f4b5b8d4-82ff-483f-bfae-9fef015790ca ./dist/registerValidators
npx defender-autotask update-code 12c153c8-c5ca-420b-9696-e80c827996d1 ./dist/stakeValidators
Expand Down
41 changes: 41 additions & 0 deletions contracts/contracts/beacon/BeaconConsolidation.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

/**
* @title Library to request validator consolidation on the beacon chain.
* @author Origin Protocol Inc
*/
library BeaconConsolidation {
/// @notice The address the validator consolidation requests are sent
/// See https://eips.ethereum.org/EIPS/eip-7251
address internal constant CONSOLIDATION_REQUEST_ADDRESS =
0x0000BBdDc7CE488642fb579F8B00f3a590007251;

function request(bytes calldata source, bytes calldata target)
internal
returns (uint256 fee_)
{
require(source.length == 48, "Invalid source byte length");
require(target.length == 48, "Invalid target byte length");

fee_ = fee();

// Call the Consolidation Request contract with the public keys of the source and target
// validators packed together.
// This does not have a function signature, so we use a call
(bool success, ) = CONSOLIDATION_REQUEST_ADDRESS.call{ value: fee_ }(
abi.encodePacked(source, target)
);

require(success, "Consolidation request failed");
}

function fee() internal view returns (uint256) {
// Get fee from the consolidation request contract
(bool success, bytes memory result) = CONSOLIDATION_REQUEST_ADDRESS
.staticcall("");

require(success && result.length > 0, "Failed to get fee");
return abi.decode(result, (uint256));
}
}
187 changes: 187 additions & 0 deletions contracts/contracts/beacon/BeaconProofs.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.0;

import { BeaconProofsLib } from "./BeaconProofsLib.sol";
import { IBeaconProofs } from "../interfaces/IBeaconProofs.sol";

/**
* @title Verifies merkle proofs of beacon chain data.
* @author Origin Protocol Inc
*/
contract BeaconProofs is IBeaconProofs {
/// @notice Verifies the validator index is for the given validator public key.
/// Also verify the validator's withdrawal credential points to the withdrawal address.
/// BeaconBlock.state.validators[validatorIndex].pubkey
/// @param beaconBlockRoot The root of the beacon block
/// @param pubKeyHash Hash of validator's public key using the Beacon Chain's format
/// @param proof The merkle proof for the validator public key to the beacon block root.
/// This is 53 witness hashes of 32 bytes each concatenated together starting from the leaf node.
/// @param validatorIndex The validator index
/// @param withdrawalCredentials a value containing the validator type and withdrawal address.
function verifyValidator(
bytes32 beaconBlockRoot,
bytes32 pubKeyHash,
bytes calldata proof,
uint40 validatorIndex,
bytes32 withdrawalCredentials
) external view {
BeaconProofsLib.verifyValidator(
beaconBlockRoot,
pubKeyHash,
proof,
validatorIndex,
withdrawalCredentials
);
}

function verifyValidatorWithdrawable(
bytes32 beaconBlockRoot,
uint40 validatorIndex,
uint64 withdrawableEpoch,
bytes calldata withdrawableEpochProof
) external view {
BeaconProofsLib.verifyValidatorWithdrawableEpoch(
beaconBlockRoot,
validatorIndex,
withdrawableEpoch,
withdrawableEpochProof
);
}

/// @notice Verifies the balances container to the beacon block root
/// BeaconBlock.state.balances
/// @param beaconBlockRoot The root of the beacon block
/// @param balancesContainerRoot The merkle root of the the balances container
/// @param balancesContainerProof The merkle proof for the balances container to the beacon block root.
/// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.
function verifyBalancesContainer(
bytes32 beaconBlockRoot,
bytes32 balancesContainerRoot,
bytes calldata balancesContainerProof
) external view {
BeaconProofsLib.verifyBalancesContainer(
beaconBlockRoot,
balancesContainerRoot,
balancesContainerProof
);
}

/// @notice Verifies the validator balance to the root of the Balances container.
/// @param balancesContainerRoot The merkle root of the Balances container.
/// @param validatorBalanceLeaf The leaf node containing the validator balance with three other balances.
/// @param balanceProof The merkle proof for the validator balance to the Balances container root.
/// This is 39 witness hashes of 32 bytes each concatenated together starting from the leaf node.
/// @param validatorIndex The validator index to verify the balance for
/// @return validatorBalanceGwei The balance in Gwei of the validator at the given index
function verifyValidatorBalance(
bytes32 balancesContainerRoot,
bytes32 validatorBalanceLeaf,
bytes calldata balanceProof,
uint40 validatorIndex
) external view returns (uint256 validatorBalanceGwei) {
validatorBalanceGwei = BeaconProofsLib.verifyValidatorBalance(
balancesContainerRoot,
validatorBalanceLeaf,
balanceProof,
validatorIndex
);
}

/// @notice Verifies the pending deposits container to the beacon block root.
/// BeaconBlock.state.pendingDeposits
/// @param beaconBlockRoot The root of the beacon block.
/// @param pendingDepositsContainerRoot The merkle root of the the pending deposits container.
/// @param proof The merkle proof for the pending deposits container to the beacon block root.
/// This is 9 witness hashes of 32 bytes each concatenated together starting from the leaf node.
function verifyPendingDepositsContainer(
bytes32 beaconBlockRoot,
bytes32 pendingDepositsContainerRoot,
bytes calldata proof
) external view {
BeaconProofsLib.verifyPendingDepositsContainer(
beaconBlockRoot,
pendingDepositsContainerRoot,
proof
);
}

/// @notice Verified a pending deposit to the root of the Pending Deposits container.
/// @param pendingDepositsContainerRoot The merkle root of the Pending Deposits container.
/// @param pendingDepositRoot The leaf node containing the validator balance with three other balances.
/// @param proof The merkle proof for the pending deposit root to the Pending Deposits container root.
/// This is 28 witness hashes of 32 bytes each concatenated together starting from the leaf node.
/// @param pendingDepositIndex The pending deposit index in the Pending Deposits container
function verifyPendingDeposit(
bytes32 pendingDepositsContainerRoot,
bytes32 pendingDepositRoot,
bytes calldata proof,
uint32 pendingDepositIndex
) external view {
BeaconProofsLib.verifyPendingDeposit(
pendingDepositsContainerRoot,
pendingDepositRoot,
proof,
pendingDepositIndex
);
}

/// @notice If the deposit queue is not empty,
/// verify the slot of the first pending deposit to the beacon block root.
/// BeaconBlock.state.pendingDeposits[0].slot
/// If the deposit queue is empty, verify the root of the first pending deposit is empty
/// BeaconBlock.state.PendingDeposits[0]
/// @param beaconBlockRoot The root of the beacon block.
/// @param slot The beacon chain slot of the first deposit in the beacon chain's deposit queue.
/// Can be anything if the deposit queue is empty.
/// @param firstPendingDepositSlotProof The merkle proof to the beacon block root. Can be either:
/// - 40 witness hashes for BeaconBlock.state.PendingDeposits[0].slot when the deposit queue is not empty.
/// - 37 witness hashes for BeaconBlock.state.PendingDeposits[0] when the deposit queue is empty.
/// The 32 byte witness hashes are concatenated together starting from the leaf node.
/// @return isEmptyDepositQueue True if the deposit queue is empty, false otherwise.
function verifyFirstPendingDeposit(
bytes32 beaconBlockRoot,
uint64 slot,
bytes calldata firstPendingDepositSlotProof
) external view returns (bool isEmptyDepositQueue) {
isEmptyDepositQueue = BeaconProofsLib.verifyFirstPendingDeposit(
beaconBlockRoot,
slot,
firstPendingDepositSlotProof
);
}

/// @notice Merkleizes a beacon chain pending deposit.
/// @param pubKeyHash Hash of validator's public key using the Beacon Chain's format
/// @param withdrawalCredentials The 32 byte withdrawal credentials.
/// @param amountGwei The amount of the deposit in Gwei.
/// @param signature The 96 byte BLS signature.
/// @param slot The beacon chain slot the deposit was made in.
/// @return root The merkle root of the pending deposit.
function merkleizePendingDeposit(
bytes32 pubKeyHash,
bytes calldata withdrawalCredentials,
uint64 amountGwei,
bytes calldata signature,
uint64 slot
) external pure returns (bytes32) {
return
BeaconProofsLib.merkleizePendingDeposit(
pubKeyHash,
withdrawalCredentials,
amountGwei,
signature,
slot
);
}

/// @notice Merkleizes a BLS signature used for validator deposits.
/// @param signature The 96 byte BLS signature.
/// @return root The merkle root of the signature.
function merkleizeSignature(bytes calldata signature)
external
pure
returns (bytes32 root)
{
return BeaconProofsLib.merkleizeSignature(signature);
}
}
Loading