diff --git a/contracts-abi/abi/VanillaRegistry.abi b/contracts-abi/abi/VanillaRegistry.abi index 340d65a9b..47c5f260f 100644 --- a/contracts-abi/abi/VanillaRegistry.abi +++ b/contracts-abi/abi/VanillaRegistry.abi @@ -172,7 +172,7 @@ { "name": "", "type": "tuple", - "internalType": "struct IVanillaRegistry.StakedValidator", + "internalType": "struct IVanillaRegistryV2.StakedValidator", "components": [ { "name": "exists", diff --git a/contracts-abi/clients/VanillaRegistry/VanillaRegistry.go b/contracts-abi/clients/VanillaRegistry/VanillaRegistry.go index 5a77053a7..54fc18aa1 100644 --- a/contracts-abi/clients/VanillaRegistry/VanillaRegistry.go +++ b/contracts-abi/clients/VanillaRegistry/VanillaRegistry.go @@ -35,8 +35,8 @@ type BlockHeightOccurrenceOccurrence struct { BlockHeight *big.Int } -// IVanillaRegistryStakedValidator is an auto generated low-level Go binding around an user-defined struct. -type IVanillaRegistryStakedValidator struct { +// IVanillaRegistryV2StakedValidator is an auto generated low-level Go binding around an user-defined struct. +type IVanillaRegistryV2StakedValidator struct { Exists bool WithdrawalAddress common.Address Balance *big.Int @@ -45,7 +45,7 @@ type IVanillaRegistryStakedValidator struct { // VanillaregistryMetaData contains all meta data concerning the Vanillaregistry contract. var VanillaregistryMetaData = &bind.MetaData{ - ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"fallback\",\"stateMutability\":\"payable\"},{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"UPGRADE_INTERFACE_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addStake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"claimForceWithdrawnFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"delegateStake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"forceWithdrawalAsOwner\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"forceWithdrawnFunds\",\"inputs\":[{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"amountToClaim\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAccumulatedSlashingFunds\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBlocksTillWithdrawAllowed\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStakedAmount\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStakedValidator\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIVanillaRegistry.StakedValidator\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"unstakeOccurrence\",\"type\":\"tuple\",\"internalType\":\"structBlockHeightOccurrence.Occurrence\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"blockHeight\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"_minStake\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_slashOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_slashReceiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_unstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_slashingPayoutPeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"isSlashingPayoutDue\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isUnstaking\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isValidatorOptedIn\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"manuallyTransferSlashingFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"minStake\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"removeWhitelistedStakers\",\"inputs\":[{\"name\":\"stakers\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setMinStake\",\"inputs\":[{\"name\":\"newMinStake\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashOracle\",\"inputs\":[{\"name\":\"newSlashOracle\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashReceiver\",\"inputs\":[{\"name\":\"newSlashReceiver\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashingPayoutPeriodBlocks\",\"inputs\":[{\"name\":\"newSlashingPayoutPeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUnstakePeriodBlocks\",\"inputs\":[{\"name\":\"newUnstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slash\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"payoutIfDue\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slashOracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"slashingFundsTracker\",\"inputs\":[],\"outputs\":[{\"name\":\"recipient\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"accumulatedAmount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"lastPayoutBlock\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"payoutPeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"stake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"stakedValidators\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"unstakeOccurrence\",\"type\":\"tuple\",\"internalType\":\"structBlockHeightOccurrence.Occurrence\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"blockHeight\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unstake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unstakePeriodBlocks\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"whitelistStakers\",\"inputs\":[{\"name\":\"stakers\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"whitelistedStakers\",\"inputs\":[{\"name\":\"staker\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"whitelisted\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"FeeTransfer\",\"inputs\":[{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"recipient\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"MinStakeSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newMinStake\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SlashOracleSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashOracle\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SlashReceiverSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashReceiver\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Slashed\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"slashReceiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SlashingPayoutPeriodBlocksSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashingPayoutPeriodBlocks\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakeAdded\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newBalance\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakeWithdrawn\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Staked\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakerRemovedFromWhitelist\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"staker\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakerWhitelisted\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"staker\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TotalStakeWithdrawn\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"totalAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UnstakePeriodBlocksSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newUnstakePeriodBlocks\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unstaked\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"AddressEmptyCode\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AtLeastOneRecipientRequired\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ERC1967InvalidImplementation\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1967NonPayable\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"EnforcedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ExpectedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FailedInnerCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FeeRecipientIsZero\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidBLSPubKeyLength\",\"inputs\":[{\"name\":\"expected\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"InvalidFallback\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidReceive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MustUnstakeToWithdraw\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoFundsToWithdraw\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotInitializing\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OwnableInvalidOwner\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"OwnableUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"PayoutPeriodMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SenderIsNotSlashOracle\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"slashOracle\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"SenderIsNotWhitelistedStaker\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"SenderIsNotWithdrawalAddress\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"SlashAmountMustBeLessThanMinStake\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashAmountMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashOracleMustBeSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashReceiverMustBeSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashingPayoutPeriodMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashingTransferFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"StakeTooLowForNumberOfKeys\",\"inputs\":[{\"name\":\"msgValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"required\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"StakerAlreadyWhitelisted\",\"inputs\":[{\"name\":\"staker\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"StakerNotWhitelisted\",\"inputs\":[{\"name\":\"staker\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"TransferToRecipientFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnauthorizedCallContext\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnsupportedProxiableUUID\",\"inputs\":[{\"name\":\"slot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"UnstakePeriodMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ValidatorCannotBeUnstaking\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"ValidatorRecordMustExist\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"ValidatorRecordMustNotExist\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"WithdrawalAddressMismatch\",\"inputs\":[{\"name\":\"actualWithdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"expectedWithdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"WithdrawalAddressMustBeSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"WithdrawalFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"WithdrawingTooSoon\",\"inputs\":[]}]", + ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"fallback\",\"stateMutability\":\"payable\"},{\"type\":\"receive\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"UPGRADE_INTERFACE_VERSION\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"acceptOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"addStake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"claimForceWithdrawnFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"delegateStake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"forceWithdrawalAsOwner\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"forceWithdrawnFunds\",\"inputs\":[{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"amountToClaim\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getAccumulatedSlashingFunds\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getBlocksTillWithdrawAllowed\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStakedAmount\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"getStakedValidator\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"tuple\",\"internalType\":\"structIVanillaRegistryV2.StakedValidator\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"unstakeOccurrence\",\"type\":\"tuple\",\"internalType\":\"structBlockHeightOccurrence.Occurrence\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"blockHeight\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initialize\",\"inputs\":[{\"name\":\"_minStake\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_slashOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_slashReceiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_unstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_slashingPayoutPeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"isSlashingPayoutDue\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isUnstaking\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"isValidatorOptedIn\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"manuallyTransferSlashingFunds\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"minStake\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"owner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"paused\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"pendingOwner\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proxiableUUID\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"removeWhitelistedStakers\",\"inputs\":[{\"name\":\"stakers\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setMinStake\",\"inputs\":[{\"name\":\"newMinStake\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashOracle\",\"inputs\":[{\"name\":\"newSlashOracle\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashReceiver\",\"inputs\":[{\"name\":\"newSlashReceiver\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashingPayoutPeriodBlocks\",\"inputs\":[{\"name\":\"newSlashingPayoutPeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setUnstakePeriodBlocks\",\"inputs\":[{\"name\":\"newUnstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slash\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"payoutIfDue\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slashOracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"slashingFundsTracker\",\"inputs\":[],\"outputs\":[{\"name\":\"recipient\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"accumulatedAmount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"lastPayoutBlock\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"payoutPeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"stake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"stakedValidators\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"unstakeOccurrence\",\"type\":\"tuple\",\"internalType\":\"structBlockHeightOccurrence.Occurrence\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"blockHeight\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transferOwnership\",\"inputs\":[{\"name\":\"newOwner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unpause\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unstake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"unstakePeriodBlocks\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"upgradeToAndCall\",\"inputs\":[{\"name\":\"newImplementation\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"data\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"whitelistStakers\",\"inputs\":[{\"name\":\"stakers\",\"type\":\"address[]\",\"internalType\":\"address[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"whitelistedStakers\",\"inputs\":[{\"name\":\"staker\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"whitelisted\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"FeeTransfer\",\"inputs\":[{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"recipient\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Initialized\",\"inputs\":[{\"name\":\"version\",\"type\":\"uint64\",\"indexed\":false,\"internalType\":\"uint64\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"MinStakeSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newMinStake\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferStarted\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"OwnershipTransferred\",\"inputs\":[{\"name\":\"previousOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newOwner\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Paused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SlashOracleSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashOracle\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SlashReceiverSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashReceiver\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Slashed\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"slashReceiver\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"SlashingPayoutPeriodBlocksSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashingPayoutPeriodBlocks\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakeAdded\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"},{\"name\":\"newBalance\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakeWithdrawn\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Staked\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakerRemovedFromWhitelist\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"staker\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"StakerWhitelisted\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"staker\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"TotalStakeWithdrawn\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"totalAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unpaused\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"indexed\":false,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"UnstakePeriodBlocksSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newUnstakePeriodBlocks\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Unstaked\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"indexed\":false,\"internalType\":\"bytes\"},{\"name\":\"amount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Upgraded\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"}],\"anonymous\":false},{\"type\":\"error\",\"name\":\"AddressEmptyCode\",\"inputs\":[{\"name\":\"target\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"AtLeastOneRecipientRequired\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ERC1967InvalidImplementation\",\"inputs\":[{\"name\":\"implementation\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"ERC1967NonPayable\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"EnforcedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ExpectedPause\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FailedInnerCall\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"FeeRecipientIsZero\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidBLSPubKeyLength\",\"inputs\":[{\"name\":\"expected\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"actual\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"InvalidFallback\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidReceive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"MustUnstakeToWithdraw\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NoFundsToWithdraw\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotInitializing\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"OwnableInvalidOwner\",\"inputs\":[{\"name\":\"owner\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"OwnableUnauthorizedAccount\",\"inputs\":[{\"name\":\"account\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"PayoutPeriodMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SenderIsNotSlashOracle\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"slashOracle\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"SenderIsNotWhitelistedStaker\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"SenderIsNotWithdrawalAddress\",\"inputs\":[{\"name\":\"sender\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"SlashAmountMustBeLessThanMinStake\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashAmountMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashOracleMustBeSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashReceiverMustBeSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashingPayoutPeriodMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"SlashingTransferFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"StakeTooLowForNumberOfKeys\",\"inputs\":[{\"name\":\"msgValue\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"required\",\"type\":\"uint256\",\"internalType\":\"uint256\"}]},{\"type\":\"error\",\"name\":\"StakerAlreadyWhitelisted\",\"inputs\":[{\"name\":\"staker\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"StakerNotWhitelisted\",\"inputs\":[{\"name\":\"staker\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"TransferToRecipientFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnauthorizedCallContext\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnsupportedProxiableUUID\",\"inputs\":[{\"name\":\"slot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"type\":\"error\",\"name\":\"UnstakePeriodMustBePositive\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"ValidatorCannotBeUnstaking\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"ValidatorRecordMustExist\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"ValidatorRecordMustNotExist\",\"inputs\":[{\"name\":\"valBLSPubKey\",\"type\":\"bytes\",\"internalType\":\"bytes\"}]},{\"type\":\"error\",\"name\":\"WithdrawalAddressMismatch\",\"inputs\":[{\"name\":\"actualWithdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"expectedWithdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}]},{\"type\":\"error\",\"name\":\"WithdrawalAddressMustBeSet\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"WithdrawalFailed\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"WithdrawingTooSoon\",\"inputs\":[]}]", } // VanillaregistryABI is the input ABI used to generate the binding from. @@ -352,15 +352,15 @@ func (_Vanillaregistry *VanillaregistryCallerSession) GetStakedAmount(valBLSPubK // GetStakedValidator is a free data retrieval call binding the contract method 0x1fc7c7c8. // // Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,address,uint256,(bool,uint256))) -func (_Vanillaregistry *VanillaregistryCaller) GetStakedValidator(opts *bind.CallOpts, valBLSPubKey []byte) (IVanillaRegistryStakedValidator, error) { +func (_Vanillaregistry *VanillaregistryCaller) GetStakedValidator(opts *bind.CallOpts, valBLSPubKey []byte) (IVanillaRegistryV2StakedValidator, error) { var out []interface{} err := _Vanillaregistry.contract.Call(opts, &out, "getStakedValidator", valBLSPubKey) if err != nil { - return *new(IVanillaRegistryStakedValidator), err + return *new(IVanillaRegistryV2StakedValidator), err } - out0 := *abi.ConvertType(out[0], new(IVanillaRegistryStakedValidator)).(*IVanillaRegistryStakedValidator) + out0 := *abi.ConvertType(out[0], new(IVanillaRegistryV2StakedValidator)).(*IVanillaRegistryV2StakedValidator) return out0, err @@ -369,14 +369,14 @@ func (_Vanillaregistry *VanillaregistryCaller) GetStakedValidator(opts *bind.Cal // GetStakedValidator is a free data retrieval call binding the contract method 0x1fc7c7c8. // // Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,address,uint256,(bool,uint256))) -func (_Vanillaregistry *VanillaregistrySession) GetStakedValidator(valBLSPubKey []byte) (IVanillaRegistryStakedValidator, error) { +func (_Vanillaregistry *VanillaregistrySession) GetStakedValidator(valBLSPubKey []byte) (IVanillaRegistryV2StakedValidator, error) { return _Vanillaregistry.Contract.GetStakedValidator(&_Vanillaregistry.CallOpts, valBLSPubKey) } // GetStakedValidator is a free data retrieval call binding the contract method 0x1fc7c7c8. // // Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,address,uint256,(bool,uint256))) -func (_Vanillaregistry *VanillaregistryCallerSession) GetStakedValidator(valBLSPubKey []byte) (IVanillaRegistryStakedValidator, error) { +func (_Vanillaregistry *VanillaregistryCallerSession) GetStakedValidator(valBLSPubKey []byte) (IVanillaRegistryV2StakedValidator, error) { return _Vanillaregistry.Contract.GetStakedValidator(&_Vanillaregistry.CallOpts, valBLSPubKey) } diff --git a/contracts-abi/script.sh b/contracts-abi/script.sh index 343174af9..986b865ca 100755 --- a/contracts-abi/script.sh +++ b/contracts-abi/script.sh @@ -34,7 +34,7 @@ extract_and_save_abi "$BASE_DIR/out/SettlementGateway.sol/SettlementGateway.json # Extract ABI for L1Gateway.json extract_and_save_abi "$BASE_DIR/out/L1Gateway.sol/L1Gateway.json" "$ABI_DIR/L1Gateway.abi" -extract_and_save_abi "$BASE_DIR/out/VanillaRegistry.sol/VanillaRegistry.json" "$ABI_DIR/VanillaRegistry.abi" +extract_and_save_abi "$BASE_DIR/out/VanillaRegistryV2.sol/VanillaRegistryV2.json" "$ABI_DIR/VanillaRegistry.abi" extract_and_save_abi "$BASE_DIR/out/BlockTracker.sol/BlockTracker.json" "$ABI_DIR/BlockTracker.abi" diff --git a/contracts/.solhintignore b/contracts/.solhintignore index 9153096bf..103506f75 100644 --- a/contracts/.solhintignore +++ b/contracts/.solhintignore @@ -1,3 +1,4 @@ lib/ test/ node_modules/ +contracts/upgrades/ \ No newline at end of file diff --git a/contracts/contracts/interfaces/IValidatorOptInRouter.sol b/contracts/contracts/interfaces/IValidatorOptInRouter.sol index 559346bc7..5a0bb52b6 100644 --- a/contracts/contracts/interfaces/IValidatorOptInRouter.sol +++ b/contracts/contracts/interfaces/IValidatorOptInRouter.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSL 1.1 pragma solidity 0.8.26; -import {IVanillaRegistry} from "./IVanillaRegistry.sol"; +import {IVanillaRegistry} from "../upgrades/IVanillaRegistry.sol"; import {IMevCommitAVS} from "./IMevCommitAVS.sol"; import {IMevCommitMiddleware} from "./IMevCommitMiddleware.sol"; diff --git a/contracts/contracts/interfaces/IVanillaRegistryV2.sol b/contracts/contracts/interfaces/IVanillaRegistryV2.sol new file mode 100644 index 000000000..2881bcabf --- /dev/null +++ b/contracts/contracts/interfaces/IVanillaRegistryV2.sol @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: BSL 1.1 +pragma solidity 0.8.26; + +import { BlockHeightOccurrence } from "../utils/Occurrence.sol"; + +/// @title IVanillaRegistryV2 +/// @notice Interface for the VanillaRegistry contract for validators. +interface IVanillaRegistryV2 { + + /// @dev Struct representing a validator staked with the registry. + struct StakedValidator { + bool exists; + address withdrawalAddress; + uint256 balance; + BlockHeightOccurrence.Occurrence unstakeOccurrence; + } + + /// @dev Event emitted when a validator is staked. + event Staked(address indexed msgSender, address indexed withdrawalAddress, bytes valBLSPubKey, uint256 amount); + + /// @dev Event emitted when ETH is added to the staked balance a validator. + event StakeAdded(address indexed msgSender, address indexed withdrawalAddress, bytes valBLSPubKey, uint256 amount, uint256 newBalance); + + /// @dev Event emitted when a validator is unstaked. + event Unstaked(address indexed msgSender, address indexed withdrawalAddress, bytes valBLSPubKey, uint256 amount); + + /// @dev Event emitted when a validator's stake is withdrawn. + event StakeWithdrawn(address indexed msgSender, address indexed withdrawalAddress, bytes valBLSPubKey, uint256 amount); + + /// @dev Event emitted when total stake is withdrawn. + event TotalStakeWithdrawn(address indexed msgSender, address indexed withdrawalAddress, uint256 totalAmount); + + /// @dev Event emitted when a validator is slashed. + event Slashed(address indexed msgSender, address indexed slashReceiver, address indexed withdrawalAddress, bytes valBLSPubKey, uint256 amount); + + /// @dev Event emitted when the min stake parameter is set. + event MinStakeSet(address indexed msgSender, uint256 newMinStake); + + /// @dev Event emitted when the slash oracle parameter is set. + event SlashOracleSet(address indexed msgSender, address newSlashOracle); + + /// @dev Event emitted when the slash receiver parameter is set. + event SlashReceiverSet(address indexed msgSender, address newSlashReceiver); + + /// @dev Event emitted when the unstake period blocks parameter is set. + event UnstakePeriodBlocksSet(address indexed msgSender, uint256 newUnstakePeriodBlocks); + + /// @dev Event emitted when the slashing payout period blocks parameter is set. + event SlashingPayoutPeriodBlocksSet(address indexed msgSender, uint256 newSlashingPayoutPeriodBlocks); + + /// @dev Event emitted when a staker is whitelisted. + event StakerWhitelisted(address indexed msgSender, address staker); + + /// @dev Event emitted when a staker is removed from the whitelist. + event StakerRemovedFromWhitelist(address indexed msgSender, address staker); + + error ValidatorRecordMustExist(bytes valBLSPubKey); + error ValidatorRecordMustNotExist(bytes valBLSPubKey); + error ValidatorCannotBeUnstaking(bytes valBLSPubKey); + error SenderIsNotWithdrawalAddress(address sender, address withdrawalAddress); + error InvalidBLSPubKeyLength(uint256 expected, uint256 actual); + error SenderIsNotSlashOracle(address sender, address slashOracle); + error WithdrawalAddressMustBeSet(); + error MustUnstakeToWithdraw(); + error AtLeastOneRecipientRequired(); + error StakeTooLowForNumberOfKeys(uint256 msgValue, uint256 required); + error WithdrawingTooSoon(); + error WithdrawalAddressMismatch(address actualWithdrawalAddress, address expectedWithdrawalAddress); + error WithdrawalFailed(); + error NoFundsToWithdraw(); + error SlashingTransferFailed(); + error SlashAmountMustBePositive(); + error SlashAmountMustBeLessThanMinStake(); + error SlashOracleMustBeSet(); + error SlashReceiverMustBeSet(); + error UnstakePeriodMustBePositive(); + error SlashingPayoutPeriodMustBePositive(); + error SenderIsNotWhitelistedStaker(address sender); + error StakerAlreadyWhitelisted(address staker); + error StakerNotWhitelisted(address staker); + + /// @dev Initializes the contract with the provided parameters. + function initialize( + uint256 _minStake, + address _slashOracle, + address _slashReceiver, + uint256 _unstakePeriodBlocks, + uint256 _slashingPayoutPeriodBlocks, + address _owner + ) external; + + /* + * @dev Stakes ETH on behalf of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The validator BLS public keys to stake. + */ + function stake(bytes[] calldata blsPubKeys) external payable; + + /* + * @dev Stakes ETH on behalf of one or multiple validators via their BLS pubkey, + * and specifies an address other than msg.sender to be the withdrawal address. + * @param blsPubKeys The validator BLS public keys to stake. + * @param withdrawalAddress The address to receive the staked ETH. + */ + function delegateStake(bytes[] calldata blsPubKeys, address withdrawalAddress) external payable; + + /* + * @dev Adds ETH to the staked balance of one or multiple validators via their BLS pubkey. + * @dev A staking entry must already exist for each provided BLS pubkey. + * @param blsPubKeys The BLS public keys to add stake to. + */ + function addStake(bytes[] calldata blsPubKeys) external payable; + + /* + * @dev Unstakes ETH on behalf of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The BLS public keys to unstake. + */ + function unstake(bytes[] calldata blsPubKeys) external; + + /* + * @dev Withdraws ETH on behalf of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The BLS public keys to withdraw. + */ + function withdraw(bytes[] calldata blsPubKeys) external; + + /// @dev Allows oracle to slash some portion of stake for one or multiple validators via their BLS pubkey. + /// @param blsPubKeys The BLS public keys to slash. + /// @param payoutIfDue Whether to payout slashed funds to receiver if the payout period is due. + function slash(bytes[] calldata blsPubKeys, bool payoutIfDue) external; + + /// @dev Enables the owner to pause the contract. + function pause() external; + + /// @dev Enables the owner to unpause the contract. + function unpause() external; + + /// @dev Enables the owner to set the minimum stake parameter. + function setMinStake(uint256 newMinStake) external; + + /// @dev Enables the owner to set the slash oracle parameter. + function setSlashOracle(address newSlashOracle) external; + + /// @dev Enables the owner to set the slash receiver parameter. + function setSlashReceiver(address newSlashReceiver) external; + + /// @dev Enables the owner to set the unstake period parameter. + function setUnstakePeriodBlocks(uint256 newUnstakePeriodBlocks) external; + + /// @dev Returns true if a validator is considered "opted-in" to mev-commit via this registry. + function isValidatorOptedIn(bytes calldata valBLSPubKey) external view returns (bool); + + /// @dev Returns stored staked validator struct for a given BLS pubkey. + function getStakedValidator(bytes calldata valBLSPubKey) external view returns (StakedValidator memory); + + /// @dev Returns the staked amount for a given BLS pubkey. + function getStakedAmount(bytes calldata valBLSPubKey) external view returns (uint256); + + /// @dev Returns true if a validator is currently unstaking. + function isUnstaking(bytes calldata valBLSPubKey) external view returns (bool); + + /// @dev Returns the number of blocks remaining until an unstaking validator can withdraw their staked ETH. + function getBlocksTillWithdrawAllowed(bytes calldata valBLSPubKey) external view returns (uint256); +} diff --git a/contracts/contracts/interfaces/IVanillaRegistry.sol b/contracts/contracts/upgrades/IVanillaRegistry.sol similarity index 94% rename from contracts/contracts/interfaces/IVanillaRegistry.sol rename to contracts/contracts/upgrades/IVanillaRegistry.sol index 930ee223d..e722014cc 100644 --- a/contracts/contracts/interfaces/IVanillaRegistry.sol +++ b/contracts/contracts/upgrades/IVanillaRegistry.sol @@ -48,12 +48,6 @@ interface IVanillaRegistry { /// @dev Event emitted when the slashing payout period blocks parameter is set. event SlashingPayoutPeriodBlocksSet(address indexed msgSender, uint256 newSlashingPayoutPeriodBlocks); - /// @dev Event emitted when a staker is whitelisted. - event StakerWhitelisted(address indexed msgSender, address staker); - - /// @dev Event emitted when a staker is removed from the whitelist. - event StakerRemovedFromWhitelist(address indexed msgSender, address staker); - error ValidatorRecordMustExist(bytes valBLSPubKey); error ValidatorRecordMustNotExist(bytes valBLSPubKey); error ValidatorCannotBeUnstaking(bytes valBLSPubKey); @@ -69,15 +63,13 @@ interface IVanillaRegistry { error WithdrawalFailed(); error NoFundsToWithdraw(); error SlashingTransferFailed(); + error MinStakeMustBePositive(); error SlashAmountMustBePositive(); error SlashAmountMustBeLessThanMinStake(); error SlashOracleMustBeSet(); error SlashReceiverMustBeSet(); error UnstakePeriodMustBePositive(); error SlashingPayoutPeriodMustBePositive(); - error SenderIsNotWhitelistedStaker(address sender); - error StakerAlreadyWhitelisted(address staker); - error StakerNotWhitelisted(address staker); /// @dev Initializes the contract with the provided parameters. function initialize( @@ -159,4 +151,4 @@ interface IVanillaRegistry { /// @dev Returns the number of blocks remaining until an unstaking validator can withdraw their staked ETH. function getBlocksTillWithdrawAllowed(bytes calldata valBLSPubKey) external view returns (uint256); -} +} \ No newline at end of file diff --git a/contracts/contracts/validator-registry/VanillaRegistry.sol b/contracts/contracts/upgrades/VanillaRegistry.sol similarity index 92% rename from contracts/contracts/validator-registry/VanillaRegistry.sol rename to contracts/contracts/upgrades/VanillaRegistry.sol index 266fc0eb9..64be2054d 100644 --- a/contracts/contracts/validator-registry/VanillaRegistry.sol +++ b/contracts/contracts/upgrades/VanillaRegistry.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSL 1.1 pragma solidity 0.8.26; -import {IVanillaRegistry} from "../interfaces/IVanillaRegistry.sol"; +import {IVanillaRegistry} from "./IVanillaRegistry.sol"; import {VanillaRegistryStorage} from "./VanillaRegistryStorage.sol"; import {BlockHeightOccurrence} from "../utils/Occurrence.sol"; import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; @@ -31,28 +31,12 @@ contract VanillaRegistry is IVanillaRegistry, VanillaRegistryStorage, _; } - /// @dev Modifier to confirm the sender is whitelisted. - modifier onlyWhitelistedStaker() { - require(whitelistedStakers[msg.sender], IVanillaRegistry.SenderIsNotWhitelistedStaker(msg.sender)); - _; - } - /// @dev See https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#initializing_the_implementation_contract /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } - /// @dev Receive function is disabled for this contract to prevent unintended interactions. - receive() external payable { - revert Errors.InvalidReceive(); - } - - /// @dev Fallback function to revert all calls, ensuring no unintended interactions. - fallback() external payable { - revert Errors.InvalidFallback(); - } - /// @dev Initializes the contract with the provided parameters. function initialize( uint256 _minStake, @@ -62,7 +46,6 @@ contract VanillaRegistry is IVanillaRegistry, VanillaRegistryStorage, uint256 _slashingPayoutPeriodBlocks, address _owner ) external initializer { - __Pausable_init(); _setMinStake(_minStake); _setSlashOracle(_slashOracle); _setUnstakePeriodBlocks(_unstakePeriodBlocks); @@ -70,12 +53,22 @@ contract VanillaRegistry is IVanillaRegistry, VanillaRegistryStorage, __Ownable_init(_owner); } + /// @dev Receive function is disabled for this contract to prevent unintended interactions. + receive() external payable { + revert Errors.InvalidReceive(); + } + + /// @dev Fallback function to revert all calls, ensuring no unintended interactions. + fallback() external payable { + revert Errors.InvalidFallback(); + } + /* * @dev Stakes ETH on behalf of one or multiple validators via their BLS pubkey. * @param blsPubKeys The validator BLS public keys to stake. */ function stake(bytes[] calldata blsPubKeys) external payable - onlyValidBLSPubKeys(blsPubKeys) onlyWhitelistedStaker() whenNotPaused() { + onlyValidBLSPubKeys(blsPubKeys) whenNotPaused() { _stake(blsPubKeys, msg.sender); } @@ -96,7 +89,7 @@ contract VanillaRegistry is IVanillaRegistry, VanillaRegistryStorage, * @dev A staking entry must already exist for each provided BLS pubkey. * @param blsPubKeys The BLS public keys to add stake to. */ - function addStake(bytes[] calldata blsPubKeys) external payable onlyWhitelistedStaker() whenNotPaused() { + function addStake(bytes[] calldata blsPubKeys) external payable whenNotPaused() { _addStake(blsPubKeys); } @@ -186,26 +179,6 @@ contract VanillaRegistry is IVanillaRegistry, VanillaRegistryStorage, FeePayout.transferToRecipient(slashingFundsTracker); } - /// @dev Enables the owner to whitelist stakers. - function whitelistStakers(address[] calldata stakers) external onlyOwner { - uint256 len = stakers.length; - for (uint256 i = 0; i < len; ++i) { - require(!whitelistedStakers[stakers[i]], IVanillaRegistry.StakerAlreadyWhitelisted(stakers[i])); - whitelistedStakers[stakers[i]] = true; - emit StakerWhitelisted(msg.sender, stakers[i]); - } - } - - /// @dev Enables the owner to remove stakers from the whitelist. - function removeWhitelistedStakers(address[] calldata stakers) external onlyOwner { - uint256 len = stakers.length; - for (uint256 i = 0; i < len; ++i) { - require(whitelistedStakers[stakers[i]], IVanillaRegistry.StakerNotWhitelisted(stakers[i])); - whitelistedStakers[stakers[i]] = false; - emit StakerRemovedFromWhitelist(msg.sender, stakers[i]); - } - } - /// @dev Returns true if a validator is considered "opted-in" to mev-commit via this registry. function isValidatorOptedIn(bytes calldata valBLSPubKey) external view returns (bool) { return _isValidatorOptedIn(valBLSPubKey); @@ -392,6 +365,7 @@ contract VanillaRegistry is IVanillaRegistry, VanillaRegistryStorage, /// @dev Internal function to set the minimum stake parameter. function _setMinStake(uint256 newMinStake) internal { + require(newMinStake != 0, IVanillaRegistry.MinStakeMustBePositive()); minStake = newMinStake; emit MinStakeSet(msg.sender, newMinStake); } @@ -426,13 +400,11 @@ contract VanillaRegistry is IVanillaRegistry, VanillaRegistryStorage, /// @dev Internal function to check if a validator is considered "opted-in" to mev-commit via this registry. function _isValidatorOptedIn(bytes calldata valBLSPubKey) internal view returns (bool) { - return !_isUnstaking(valBLSPubKey) && - stakedValidators[valBLSPubKey].balance >= minStake && - whitelistedStakers[stakedValidators[valBLSPubKey].withdrawalAddress]; + return !_isUnstaking(valBLSPubKey) && stakedValidators[valBLSPubKey].balance >= minStake; } /// @dev Internal function to check if a validator is currently unstaking. function _isUnstaking(bytes calldata valBLSPubKey) internal view returns (bool) { return stakedValidators[valBLSPubKey].unstakeOccurrence.exists; } -} +} \ No newline at end of file diff --git a/contracts/contracts/validator-registry/VanillaRegistryStorage.sol b/contracts/contracts/upgrades/VanillaRegistryStorage.sol similarity index 82% rename from contracts/contracts/validator-registry/VanillaRegistryStorage.sol rename to contracts/contracts/upgrades/VanillaRegistryStorage.sol index bad13a36a..58eaf3da8 100644 --- a/contracts/contracts/validator-registry/VanillaRegistryStorage.sol +++ b/contracts/contracts/upgrades/VanillaRegistryStorage.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSL 1.1 pragma solidity 0.8.26; -import {IVanillaRegistry} from "../interfaces/IVanillaRegistry.sol"; +import {IVanillaRegistry} from "./IVanillaRegistry.sol"; import {FeePayout} from "../utils/FeePayout.sol"; /// @title VanillaRegistryStorage @@ -26,9 +26,6 @@ contract VanillaRegistryStorage { /// @dev Mapping of withdrawal addresses to claimable ETH that was force withdrawn by the owner. mapping(address withdrawalAddress => uint256 amountToClaim) public forceWithdrawnFunds; - /// @dev Mapping of staker addresses to whether they are whitelisted. - mapping(address staker => bool whitelisted) public whitelistedStakers; - /// @dev See https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps - uint256[47] private __gap; -} + uint256[48] private __gap; +} \ No newline at end of file diff --git a/contracts/contracts/validator-registry/ValidatorOptInRouter.sol b/contracts/contracts/validator-registry/ValidatorOptInRouter.sol index 3d0af3d6f..2f7a9bebf 100644 --- a/contracts/contracts/validator-registry/ValidatorOptInRouter.sol +++ b/contracts/contracts/validator-registry/ValidatorOptInRouter.sol @@ -3,7 +3,7 @@ pragma solidity 0.8.26; import {ValidatorOptInRouterStorage} from "./ValidatorOptInRouterStorage.sol"; import {IValidatorOptInRouter} from "../interfaces/IValidatorOptInRouter.sol"; -import {IVanillaRegistry} from "../interfaces/IVanillaRegistry.sol"; +import {IVanillaRegistry} from "../upgrades/IVanillaRegistry.sol"; import {IMevCommitAVS} from "../interfaces/IMevCommitAVS.sol"; import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; diff --git a/contracts/contracts/validator-registry/ValidatorOptInRouterStorage.sol b/contracts/contracts/validator-registry/ValidatorOptInRouterStorage.sol index 46b221ad2..a874617c5 100644 --- a/contracts/contracts/validator-registry/ValidatorOptInRouterStorage.sol +++ b/contracts/contracts/validator-registry/ValidatorOptInRouterStorage.sol @@ -1,7 +1,7 @@ // SPDX-License-Identifier: BSL 1.1 pragma solidity 0.8.26; -import {IVanillaRegistry} from "../interfaces/IVanillaRegistry.sol"; +import {IVanillaRegistry} from "../upgrades/IVanillaRegistry.sol"; import {IMevCommitAVS} from "../interfaces/IMevCommitAVS.sol"; import {IMevCommitMiddleware} from "../interfaces/IMevCommitMiddleware.sol"; diff --git a/contracts/contracts/validator-registry/VanillaRegistryStorageV2.sol b/contracts/contracts/validator-registry/VanillaRegistryStorageV2.sol new file mode 100644 index 000000000..83731e2e1 --- /dev/null +++ b/contracts/contracts/validator-registry/VanillaRegistryStorageV2.sol @@ -0,0 +1,34 @@ +// SPDX-License-Identifier: BSL 1.1 +pragma solidity 0.8.26; + +import {IVanillaRegistryV2} from "../interfaces/IVanillaRegistryV2.sol"; +import {FeePayout} from "../utils/FeePayout.sol"; + +/// @title VanillaRegistryStorage +/// @notice Storage components of the VanillaRegistry contract. +contract VanillaRegistryStorageV2 { + + /// @dev Minimum stake required for validators, also used as the slash amount. + uint256 public minStake; + + /// @dev Permissioned account that is able to invoke slashes. + address public slashOracle; + + /// @dev Number of blocks required between unstake initiation and withdrawal. + uint256 public unstakePeriodBlocks; + + /// @dev Struct enabling automatic slashing funds payouts + FeePayout.Tracker public slashingFundsTracker; + + /// @dev Mapping of BLS pubkeys to stored staked validator structs. + mapping(bytes => IVanillaRegistryV2.StakedValidator) public stakedValidators; + + /// @dev Mapping of withdrawal addresses to claimable ETH that was force withdrawn by the owner. + mapping(address withdrawalAddress => uint256 amountToClaim) public forceWithdrawnFunds; + + /// @dev Mapping of staker addresses to whether they are whitelisted. + mapping(address staker => bool whitelisted) public whitelistedStakers; + + /// @dev See https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps + uint256[47] private __gap; +} diff --git a/contracts/contracts/validator-registry/VanillaRegistryV2.sol b/contracts/contracts/validator-registry/VanillaRegistryV2.sol new file mode 100644 index 000000000..30106a4c1 --- /dev/null +++ b/contracts/contracts/validator-registry/VanillaRegistryV2.sol @@ -0,0 +1,439 @@ +// SPDX-License-Identifier: BSL 1.1 +pragma solidity 0.8.26; + +import {IVanillaRegistryV2} from "../interfaces/IVanillaRegistryV2.sol"; +import {VanillaRegistryStorageV2} from "./VanillaRegistryStorageV2.sol"; +import {BlockHeightOccurrence} from "../utils/Occurrence.sol"; +import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol"; +import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; +import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; +import {Errors} from "../utils/Errors.sol"; +import {FeePayout} from "../utils/FeePayout.sol"; + +/// @title Vanilla Registry +/// @notice Logic contract enabling L1 validators to opt-in to mev-commit +/// via simply staking ETH outside what's staked with the beacon chain. +/// @custom:oz-upgrades-from VanillaRegistry +contract VanillaRegistryV2 is IVanillaRegistryV2, VanillaRegistryStorageV2, + Ownable2StepUpgradeable, PausableUpgradeable, UUPSUpgradeable { + + /// @dev Modifier to confirm all provided BLS pubkeys are valid length. + modifier onlyValidBLSPubKeys(bytes[] calldata blsPubKeys) { + uint256 len = blsPubKeys.length; + for (uint256 i = 0; i < len; ++i) { + require(blsPubKeys[i].length == 48, IVanillaRegistryV2.InvalidBLSPubKeyLength(48, blsPubKeys[i].length)); + } + _; + } + + /// @dev Modifier to confirm the sender is the oracle account. + modifier onlySlashOracle() { + require(msg.sender == slashOracle, IVanillaRegistryV2.SenderIsNotSlashOracle(msg.sender, slashOracle)); + _; + } + + /// @dev Modifier to confirm the sender is whitelisted. + modifier onlyWhitelistedStaker() { + require(whitelistedStakers[msg.sender], IVanillaRegistryV2.SenderIsNotWhitelistedStaker(msg.sender)); + _; + } + + /// @dev See https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#initializing_the_implementation_contract + /// @custom:oz-upgrades-unsafe-allow constructor + constructor() { + _disableInitializers(); + } + + /// @dev Receive function is disabled for this contract to prevent unintended interactions. + receive() external payable { + revert Errors.InvalidReceive(); + } + + /// @dev Fallback function to revert all calls, ensuring no unintended interactions. + fallback() external payable { + revert Errors.InvalidFallback(); + } + + /// @dev Initializes the contract with the provided parameters. + function initialize( + uint256 _minStake, + address _slashOracle, + address _slashReceiver, + uint256 _unstakePeriodBlocks, + uint256 _slashingPayoutPeriodBlocks, + address _owner + ) external initializer { + __Pausable_init(); + _setMinStake(_minStake); + _setSlashOracle(_slashOracle); + _setUnstakePeriodBlocks(_unstakePeriodBlocks); + FeePayout.init(slashingFundsTracker, _slashReceiver, _slashingPayoutPeriodBlocks); + __Ownable_init(_owner); + } + + /* + * @dev Stakes ETH on behalf of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The validator BLS public keys to stake. + */ + function stake(bytes[] calldata blsPubKeys) external payable + onlyValidBLSPubKeys(blsPubKeys) onlyWhitelistedStaker() whenNotPaused() { + _stake(blsPubKeys, msg.sender); + } + + /* + * @dev Stakes ETH on behalf of one or multiple validators via their BLS pubkey, + * and specifies an address other than msg.sender to be the withdrawal address. + * @param blsPubKeys The validator BLS public keys to stake. + * @param withdrawalAddress The address to receive the staked ETH. + */ + function delegateStake(bytes[] calldata blsPubKeys, address withdrawalAddress) external payable + onlyValidBLSPubKeys(blsPubKeys) onlyOwner { + require(withdrawalAddress != address(0), IVanillaRegistryV2.WithdrawalAddressMustBeSet()); + _stake(blsPubKeys, withdrawalAddress); + } + + /* + * @dev Adds ETH to the staked balance of one or multiple validators via their BLS pubkey. + * @dev A staking entry must already exist for each provided BLS pubkey. + * @param blsPubKeys The BLS public keys to add stake to. + */ + function addStake(bytes[] calldata blsPubKeys) external payable onlyWhitelistedStaker() whenNotPaused() { + _addStake(blsPubKeys); + } + + /* + * @dev Unstakes ETH on behalf of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The BLS public keys to unstake. + */ + function unstake(bytes[] calldata blsPubKeys) external whenNotPaused() { + _unstake(blsPubKeys); + } + + /// @dev Allows owner to withdraw ETH on behalf of one or multiple validators via their BLS pubkey. + /// @param blsPubKeys The BLS public keys to withdraw. + /// @dev msg.sender must be the withdrawal address for every provided validator pubkey as enforced in _withdraw. + function withdraw(bytes[] calldata blsPubKeys) external whenNotPaused() { + uint256 totalAmount = _withdraw(blsPubKeys, msg.sender); + if (totalAmount != 0) { + (bool success, ) = msg.sender.call{value: totalAmount}(""); + require(success, IVanillaRegistryV2.WithdrawalFailed()); + } + } + + /// @dev Allows owner to withdraw ETH on behalf of one or multiple validators via their BLS pubkey. + /// @param blsPubKeys The BLS public keys to withdraw. + /// @param withdrawalAddress The address to receive the staked ETH. + /// @dev withdrawalAddress must be the withdrawal address for every provided validator pubkeyas enforced in _withdraw. + function forceWithdrawalAsOwner(bytes[] calldata blsPubKeys, address withdrawalAddress) external onlyOwner { + uint256 totalAmount = _withdraw(blsPubKeys, withdrawalAddress); + if (totalAmount != 0) { + forceWithdrawnFunds[withdrawalAddress] += totalAmount; + } + } + + /// @dev Allows a withdrawal address to claim any ETH that was force withdrawn by the owner. + function claimForceWithdrawnFunds() external { + uint256 amountToClaim = forceWithdrawnFunds[msg.sender]; + require(amountToClaim != 0, IVanillaRegistryV2.NoFundsToWithdraw()); + forceWithdrawnFunds[msg.sender] = 0; + (bool success, ) = msg.sender.call{value: amountToClaim}(""); + require(success, IVanillaRegistryV2.WithdrawalFailed()); + } + + /// @dev Allows oracle to slash some portion of stake for one or multiple validators via their BLS pubkey. + /// @param blsPubKeys The BLS public keys to slash. + /// @param payoutIfDue Whether to payout slashed funds to receiver if the payout period is due. + function slash(bytes[] calldata blsPubKeys, bool payoutIfDue) external onlySlashOracle whenNotPaused() { + _slash(blsPubKeys, payoutIfDue); + } + + /// @dev Enables the owner to pause the contract. + function pause() external onlyOwner { + _pause(); + } + + /// @dev Enables the owner to unpause the contract. + function unpause() external onlyOwner { + _unpause(); + } + + /// @dev Enables the owner to set the minimum stake parameter. + function setMinStake(uint256 newMinStake) external onlyOwner { + _setMinStake(newMinStake); + } + + /// @dev Enables the owner to set the slash oracle parameter. + function setSlashOracle(address newSlashOracle) external onlyOwner { + _setSlashOracle(newSlashOracle); + } + + /// @dev Enables the owner to set the slash receiver parameter. + function setSlashReceiver(address newSlashReceiver) external onlyOwner { + _setSlashReceiver(newSlashReceiver); + } + + /// @dev Enables the owner to set the unstake period parameter. + function setUnstakePeriodBlocks(uint256 newUnstakePeriodBlocks) external onlyOwner { + _setUnstakePeriodBlocks(newUnstakePeriodBlocks); + } + + /// @dev Enables the owner to set the slashing payout period parameter. + function setSlashingPayoutPeriodBlocks(uint256 newSlashingPayoutPeriodBlocks) external onlyOwner { + _setSlashingPayoutPeriodBlocks(newSlashingPayoutPeriodBlocks); + } + + /// @dev Enables the owner to manually transfer slashing funds. + function manuallyTransferSlashingFunds() external onlyOwner { + FeePayout.transferToRecipient(slashingFundsTracker); + } + + /// @dev Enables the owner to whitelist stakers. + function whitelistStakers(address[] calldata stakers) external onlyOwner { + uint256 len = stakers.length; + for (uint256 i = 0; i < len; ++i) { + require(!whitelistedStakers[stakers[i]], IVanillaRegistryV2.StakerAlreadyWhitelisted(stakers[i])); + whitelistedStakers[stakers[i]] = true; + emit StakerWhitelisted(msg.sender, stakers[i]); + } + } + + /// @dev Enables the owner to remove stakers from the whitelist. + function removeWhitelistedStakers(address[] calldata stakers) external onlyOwner { + uint256 len = stakers.length; + for (uint256 i = 0; i < len; ++i) { + require(whitelistedStakers[stakers[i]], IVanillaRegistryV2.StakerNotWhitelisted(stakers[i])); + whitelistedStakers[stakers[i]] = false; + emit StakerRemovedFromWhitelist(msg.sender, stakers[i]); + } + } + + /// @dev Returns true if a validator is considered "opted-in" to mev-commit via this registry. + function isValidatorOptedIn(bytes calldata valBLSPubKey) external view returns (bool) { + return _isValidatorOptedIn(valBLSPubKey); + } + + /// @dev Returns stored staked validator struct for a given BLS pubkey. + function getStakedValidator(bytes calldata valBLSPubKey) external view returns (StakedValidator memory) { + return stakedValidators[valBLSPubKey]; + } + + /// @dev Returns the staked amount for a given BLS pubkey. + function getStakedAmount(bytes calldata valBLSPubKey) external view returns (uint256) { + return stakedValidators[valBLSPubKey].balance; + } + + /// @dev Returns true if a validator is currently unstaking. + function isUnstaking(bytes calldata valBLSPubKey) external view returns (bool) { + return _isUnstaking(valBLSPubKey); + } + + /// @dev Returns the number of blocks remaining until an unstaking validator can withdraw their staked ETH. + function getBlocksTillWithdrawAllowed(bytes calldata valBLSPubKey) external view returns (uint256) { + require(_isUnstaking(valBLSPubKey), IVanillaRegistryV2.MustUnstakeToWithdraw()); + uint256 blocksSinceUnstakeInitiated = block.number - stakedValidators[valBLSPubKey].unstakeOccurrence.blockHeight; + return blocksSinceUnstakeInitiated > unstakePeriodBlocks ? 0 : unstakePeriodBlocks - blocksSinceUnstakeInitiated; + } + + /// @dev Returns true if the slashing payout period is due. + function isSlashingPayoutDue() external view returns (bool) { + return FeePayout.isPayoutDue(slashingFundsTracker); + } + + function getAccumulatedSlashingFunds() external view returns (uint256) { + return slashingFundsTracker.accumulatedAmount; + } + + /* + * @dev implements _authorizeUpgrade from UUPSUpgradeable to enable only + * the owner to upgrade the implementation contract. + */ + // solhint-disable-next-line no-empty-blocks + function _authorizeUpgrade(address) internal override onlyOwner {} + + /// @dev Internal function that splits msg.value stake to apply an action for each validator. + function _splitStakeAndApplyAction( + bytes[] calldata blsPubKeys, + address withdrawalAddress, + function(bytes calldata, uint256, address) internal action + ) internal { + require(blsPubKeys.length != 0, IVanillaRegistryV2.AtLeastOneRecipientRequired()); + uint256 baseStakeAmount = msg.value / blsPubKeys.length; + uint256 lastStakeAmount = msg.value - (baseStakeAmount * (blsPubKeys.length - 1)); + uint256 numKeys = blsPubKeys.length; + for (uint256 i = 0; i < numKeys; ++i) { + uint256 stakeAmount = (i == numKeys - 1) ? lastStakeAmount : baseStakeAmount; + action(blsPubKeys[i], stakeAmount, withdrawalAddress); + } + } + + /* + * @dev Internal function to stake ETH on behalf of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The validator BLS public keys to stake. + * @param withdrawalAddress The address to receive the staked ETH. + */ + function _stake(bytes[] calldata blsPubKeys, address withdrawalAddress) internal { + // At least minStake must be staked for each pubkey. + require(msg.value >= minStake * blsPubKeys.length, IVanillaRegistryV2.StakeTooLowForNumberOfKeys(msg.value, minStake * blsPubKeys.length)); + _splitStakeAndApplyAction(blsPubKeys, withdrawalAddress, _stakeAction); + } + + /// @dev Internal function that creates a staked validator record and emits a Staked event. + function _stakeAction(bytes calldata pubKey, uint256 stakeAmount, address withdrawalAddress) internal { + require(!stakedValidators[pubKey].exists, IVanillaRegistryV2.ValidatorRecordMustNotExist(pubKey)); + stakedValidators[pubKey] = StakedValidator({ + exists: true, + balance: stakeAmount, + withdrawalAddress: withdrawalAddress, + unstakeOccurrence: BlockHeightOccurrence.Occurrence({ exists: false, blockHeight: 0 }) + }); + emit Staked(msg.sender, withdrawalAddress, pubKey, stakeAmount); + } + + /* + * @dev Internal function to add ETH to the staked balance of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The BLS public keys to add stake to. + */ + function _addStake(bytes[] calldata blsPubKeys) internal { + // At least 1 wei must be added for each pubkey. + require(msg.value >= blsPubKeys.length, IVanillaRegistryV2.StakeTooLowForNumberOfKeys(msg.value, blsPubKeys.length)); + _splitStakeAndApplyAction(blsPubKeys, address(0), _addStakeAction); + } + + /// @dev Internal function that adds stake to an already existing validator record, emitting a StakeAdded event. + function _addStakeAction(bytes calldata pubKey, uint256 stakeAmount, address) internal { + IVanillaRegistryV2.StakedValidator storage validator = stakedValidators[pubKey]; + require(validator.exists, IVanillaRegistryV2.ValidatorRecordMustExist(pubKey)); + require(validator.withdrawalAddress == msg.sender, + IVanillaRegistryV2.SenderIsNotWithdrawalAddress(msg.sender, validator.withdrawalAddress)); + require(!_isUnstaking(pubKey), IVanillaRegistryV2.ValidatorCannotBeUnstaking(pubKey)); + validator.balance += stakeAmount; + emit StakeAdded(msg.sender, validator.withdrawalAddress, pubKey, stakeAmount, validator.balance); + } + + /* + * @dev Internal function to unstake ETH on behalf of one or multiple validators via their BLS pubkey. + * @param blsPubKeys The BLS public keys to unstake. + */ + function _unstake(bytes[] calldata blsPubKeys) internal { + uint256 len = blsPubKeys.length; + for (uint256 i = 0; i < len; ++i) { + IVanillaRegistryV2.StakedValidator storage validator = stakedValidators[blsPubKeys[i]]; + require(validator.exists, IVanillaRegistryV2.ValidatorRecordMustExist(blsPubKeys[i])); + require(!_isUnstaking(blsPubKeys[i]), IVanillaRegistryV2.ValidatorCannotBeUnstaking(blsPubKeys[i])); + require(validator.withdrawalAddress == msg.sender, + IVanillaRegistryV2.SenderIsNotWithdrawalAddress(msg.sender, validator.withdrawalAddress)); + _unstakeSingle(blsPubKeys[i]); + } + } + + /* + * @dev Internal function to unstake ETH on behalf of one validator via their BLS pubkey. + * This function is necessary for slashing. + * @param pubKey The single BLS public key to unstake. + */ + function _unstakeSingle(bytes calldata pubKey) internal { + IVanillaRegistryV2.StakedValidator storage validator = stakedValidators[pubKey]; + BlockHeightOccurrence.captureOccurrence(validator.unstakeOccurrence); + emit Unstaked(msg.sender, validator.withdrawalAddress, pubKey, validator.balance); + } + + + /// @dev Internal function to withdraw ETH on behalf of one or multiple validators via their BLS pubkey. + /// @dev This function also deletes the validator record, and therefore serves a purpose even if no withdawable funds exist. + /// @param blsPubKeys The BLS public keys to withdraw. + /// @param expectedWithdrawalAddress The expected withdrawal address for every provided validator. + /// @return totalAmount The total amount of ETH withdrawn, to be handled by calling function. + /// @dev msg.sender must be contract owner, or the withdrawal address for every provided validator. + function _withdraw(bytes[] calldata blsPubKeys, address expectedWithdrawalAddress) internal returns (uint256) { + uint256 len = blsPubKeys.length; + uint256 totalAmount = 0; + for (uint256 i = 0; i < len; ++i) { + bytes calldata pubKey = blsPubKeys[i]; + IVanillaRegistryV2.StakedValidator storage validator = stakedValidators[pubKey]; + require(validator.exists, IVanillaRegistryV2.ValidatorRecordMustExist(pubKey)); + require(_isUnstaking(pubKey), IVanillaRegistryV2.MustUnstakeToWithdraw()); + require(block.number > validator.unstakeOccurrence.blockHeight + unstakePeriodBlocks, + IVanillaRegistryV2.WithdrawingTooSoon()); + require(validator.withdrawalAddress == expectedWithdrawalAddress, + IVanillaRegistryV2.WithdrawalAddressMismatch(validator.withdrawalAddress, expectedWithdrawalAddress)); + uint256 balance = validator.balance; + totalAmount += balance; + delete stakedValidators[pubKey]; + emit StakeWithdrawn(msg.sender, expectedWithdrawalAddress, pubKey, balance); + } + emit TotalStakeWithdrawn(msg.sender, expectedWithdrawalAddress, totalAmount); + return totalAmount; + } + + /// @dev Internal function to slash minStake worth of ETH on behalf of one or multiple validators via their BLS pubkey. + /// @param blsPubKeys The BLS public keys to slash. + /// @param payoutIfDue Whether to payout slashed funds to receiver if the payout period is due. + function _slash(bytes[] calldata blsPubKeys, bool payoutIfDue) internal { + uint256 len = blsPubKeys.length; + for (uint256 i = 0; i < len; ++i) { + bytes calldata pubKey = blsPubKeys[i]; + IVanillaRegistryV2.StakedValidator storage validator = stakedValidators[pubKey]; + require(validator.exists, IVanillaRegistryV2.ValidatorRecordMustExist(pubKey)); + if (!_isUnstaking(pubKey)) { + _unstakeSingle(pubKey); + } + uint256 toSlash = minStake; + if (validator.balance < minStake) { + toSlash = validator.balance; + } + validator.balance -= toSlash; + slashingFundsTracker.accumulatedAmount += toSlash; + bool isLastEntry = i == len - 1; + if (payoutIfDue && FeePayout.isPayoutDue(slashingFundsTracker) && isLastEntry) { + FeePayout.transferToRecipient(slashingFundsTracker); + } + emit Slashed(msg.sender, slashingFundsTracker.recipient, validator.withdrawalAddress, pubKey, toSlash); + } + } + + /// @dev Internal function to set the minimum stake parameter. + function _setMinStake(uint256 newMinStake) internal { + minStake = newMinStake; + emit MinStakeSet(msg.sender, newMinStake); + } + + /// @dev Internal function to set the slash oracle parameter. + function _setSlashOracle(address newSlashOracle) internal { + require(newSlashOracle != address(0), IVanillaRegistryV2.SlashOracleMustBeSet()); + slashOracle = newSlashOracle; + emit SlashOracleSet(msg.sender, newSlashOracle); + } + + /// @dev Internal function to set the slash receiver parameter. + function _setSlashReceiver(address newSlashReceiver) internal { + require(newSlashReceiver != address(0), IVanillaRegistryV2.SlashReceiverMustBeSet()); + slashingFundsTracker.recipient = newSlashReceiver; + emit SlashReceiverSet(msg.sender, newSlashReceiver); + } + + /// @dev Internal function to set the unstake period parameter. + function _setUnstakePeriodBlocks(uint256 newUnstakePeriodBlocks) internal { + require(newUnstakePeriodBlocks != 0, IVanillaRegistryV2.UnstakePeriodMustBePositive()); + unstakePeriodBlocks = newUnstakePeriodBlocks; + emit UnstakePeriodBlocksSet(msg.sender, newUnstakePeriodBlocks); + } + + /// @dev Internal function to set the slashing payout period parameter in blocks. + function _setSlashingPayoutPeriodBlocks(uint256 newSlashingPayoutPeriodBlocks) internal { + require(newSlashingPayoutPeriodBlocks != 0, IVanillaRegistryV2.SlashingPayoutPeriodMustBePositive()); + slashingFundsTracker.payoutPeriodBlocks = newSlashingPayoutPeriodBlocks; + emit SlashingPayoutPeriodBlocksSet(msg.sender, newSlashingPayoutPeriodBlocks); + } + + /// @dev Internal function to check if a validator is considered "opted-in" to mev-commit via this registry. + function _isValidatorOptedIn(bytes calldata valBLSPubKey) internal view returns (bool) { + return !_isUnstaking(valBLSPubKey) && + stakedValidators[valBLSPubKey].balance >= minStake && + whitelistedStakers[stakedValidators[valBLSPubKey].withdrawalAddress]; + } + + /// @dev Internal function to check if a validator is currently unstaking. + function _isUnstaking(bytes calldata valBLSPubKey) internal view returns (bool) { + return stakedValidators[valBLSPubKey].unstakeOccurrence.exists; + } +} diff --git a/contracts/contracts/validator-registry/rewards/RewardManager.sol b/contracts/contracts/validator-registry/rewards/RewardManager.sol index 532058276..125ea3154 100644 --- a/contracts/contracts/validator-registry/rewards/RewardManager.sol +++ b/contracts/contracts/validator-registry/rewards/RewardManager.sol @@ -8,7 +8,7 @@ import {Ownable2StepUpgradeable} from "@openzeppelin/contracts-upgradeable/acces import {ReentrancyGuardUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/ReentrancyGuardUpgradeable.sol"; import {PausableUpgradeable} from "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; -import {VanillaRegistryStorage} from "../VanillaRegistryStorage.sol"; +import {VanillaRegistryStorageV2} from "../VanillaRegistryStorageV2.sol"; import {MevCommitAVSStorage} from "../avs/MevCommitAVSStorage.sol"; import {MevCommitMiddlewareStorage} from "../middleware/MevCommitMiddlewareStorage.sol"; @@ -203,7 +203,7 @@ contract RewardManager is IRewardManager, RewardManagerStorage, function _setVanillaRegistry(address vanillaRegistry) internal { require(vanillaRegistry != address(0), InvalidAddress()); - _vanillaRegistry = VanillaRegistryStorage(vanillaRegistry); + _vanillaRegistry = VanillaRegistryStorageV2(vanillaRegistry); emit VanillaRegistrySet(vanillaRegistry); } diff --git a/contracts/contracts/validator-registry/rewards/RewardManagerStorage.sol b/contracts/contracts/validator-registry/rewards/RewardManagerStorage.sol index e86f70f55..651578e81 100644 --- a/contracts/contracts/validator-registry/rewards/RewardManagerStorage.sol +++ b/contracts/contracts/validator-registry/rewards/RewardManagerStorage.sol @@ -1,14 +1,14 @@ // SPDX-License-Identifier: BSL 1.1 pragma solidity 0.8.26; -import {VanillaRegistryStorage} from "../VanillaRegistryStorage.sol"; +import {VanillaRegistryStorageV2} from "../VanillaRegistryStorageV2.sol"; import {MevCommitAVSStorage} from "../avs/MevCommitAVSStorage.sol"; import {MevCommitMiddlewareStorage} from "../middleware/MevCommitMiddlewareStorage.sol"; contract RewardManagerStorage { /// Storage reference to the VanillaRegistry contract. - VanillaRegistryStorage internal _vanillaRegistry; + VanillaRegistryStorageV2 internal _vanillaRegistry; /// Storage reference to the MevCommitAVS contract. MevCommitAVSStorage internal _mevCommitAVS; diff --git a/contracts/l1-deployer-cli.sh b/contracts/l1-deployer-cli.sh index edeff5f3a..e80b47684 100755 --- a/contracts/l1-deployer-cli.sh +++ b/contracts/l1-deployer-cli.sh @@ -474,7 +474,7 @@ deploy_contract_generic() { } deploy_vanilla() { - deploy_contract_generic "scripts/validator-registry/DeployVanillaRegistry.s.sol" + deploy_contract_generic "scripts/validator-registry/DeployVanillaRegistryV2.s.sol" } deploy_vanilla_rep() { diff --git a/contracts/scripts/validator-registry/DeployForMockL1.s.sol b/contracts/scripts/validator-registry/DeployForMockL1.s.sol index 5e0f7b257..9bd24d8d5 100644 --- a/contracts/scripts/validator-registry/DeployForMockL1.s.sol +++ b/contracts/scripts/validator-registry/DeployForMockL1.s.sol @@ -8,7 +8,7 @@ pragma solidity 0.8.26; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; -import {VanillaRegistry} from "../../contracts/validator-registry/VanillaRegistry.sol"; +import {VanillaRegistryV2} from "../../contracts/validator-registry/VanillaRegistryV2.sol"; import {ValidatorOptInRouter} from "../../contracts/validator-registry/ValidatorOptInRouter.sol"; contract AlwaysFalseAVS { @@ -35,14 +35,14 @@ contract DeployForMockL1 is Script { address owner = msg.sender; address vanillaRegistryProxy = Upgrades.deployUUPSProxy( - "VanillaRegistry.sol", + "VanillaRegistryV2.sol", abi.encodeCall( - VanillaRegistry.initialize, + VanillaRegistryV2.initialize, (minStake, slashOracle, slashReceiver, unstakePeriodBlocks, payoutPeriodBlocks, owner) ) ); - console.log("_VanillaRegistry:", vanillaRegistryProxy); - VanillaRegistry vanillaRegistry = VanillaRegistry(payable(vanillaRegistryProxy)); + console.log("_VanillaRegistryV2:", vanillaRegistryProxy); + VanillaRegistryV2 vanillaRegistry = VanillaRegistryV2(payable(vanillaRegistryProxy)); address[] memory stakers = new address[](1); stakers[0] = owner; diff --git a/contracts/scripts/validator-registry/DeployVanillaRegistry.s.sol b/contracts/scripts/validator-registry/DeployVanillaRegistryV2.s.sol similarity index 89% rename from contracts/scripts/validator-registry/DeployVanillaRegistry.s.sol rename to contracts/scripts/validator-registry/DeployVanillaRegistryV2.s.sol index 5ccefa0ec..cef242e26 100644 --- a/contracts/scripts/validator-registry/DeployVanillaRegistry.s.sol +++ b/contracts/scripts/validator-registry/DeployVanillaRegistryV2.s.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.26; import {Script} from "forge-std/Script.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; -import {VanillaRegistry} from "../../contracts/validator-registry/VanillaRegistry.sol"; +import {VanillaRegistryV2} from "../../contracts/validator-registry/VanillaRegistryV2.sol"; import {console} from "forge-std/console.sol"; import {MainnetConstants} from "../MainnetConstants.sol"; @@ -20,17 +20,17 @@ contract BaseDeploy is Script { uint256 payoutPeriodBlocks, address owner ) public returns (address) { - console.log("Deploying VanillaRegistry on chain:", block.chainid); + console.log("Deploying VanillaRegistryV2 on chain:", block.chainid); address proxy = Upgrades.deployUUPSProxy( - "VanillaRegistry.sol", + "VanillaRegistryV2.sol", abi.encodeCall( - VanillaRegistry.initialize, + VanillaRegistryV2.initialize, (minStake, slashOracle, slashReceiver, unstakePeriodBlocks, payoutPeriodBlocks, owner) ) ); - console.log("VanillaRegistry UUPS proxy deployed to:", address(proxy)); - VanillaRegistry vanillaRegistry = VanillaRegistry(payable(proxy)); - console.log("VanillaRegistry owner:", vanillaRegistry.owner()); + console.log("VanillaRegistryV2 UUPS proxy deployed to:", address(proxy)); + VanillaRegistryV2 vanillaRegistry = VanillaRegistryV2(payable(proxy)); + console.log("VanillaRegistryV2 owner:", vanillaRegistry.owner()); return proxy; } } diff --git a/contracts/scripts/validator-registry/DeployVanillaReputational.s.sol b/contracts/scripts/validator-registry/DeployVanillaReputational.s.sol index 06e5ec3c3..2d7d6ea17 100644 --- a/contracts/scripts/validator-registry/DeployVanillaReputational.s.sol +++ b/contracts/scripts/validator-registry/DeployVanillaReputational.s.sol @@ -7,7 +7,7 @@ pragma solidity 0.8.26; import {Script} from "forge-std/Script.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; -import {VanillaRegistry} from "../../contracts/validator-registry/VanillaRegistry.sol"; +import {VanillaRegistryV2} from "../../contracts/validator-registry/VanillaRegistryV2.sol"; import {console} from "forge-std/console.sol"; import {MainnetConstants} from "../MainnetConstants.sol"; @@ -20,17 +20,17 @@ contract BaseDeploy is Script { uint256 payoutPeriodBlocks, address owner ) public returns (address) { - console.log("Deploying VanillaReputationalRegistry on chain:", block.chainid); + console.log("Deploying VanillaReputationalRegistryV2 on chain:", block.chainid); address proxy = Upgrades.deployUUPSProxy( - "VanillaRegistry.sol", + "VanillaRegistryV2.sol", abi.encodeCall( - VanillaRegistry.initialize, + VanillaRegistryV2.initialize, (minStake, slashOracle, slashReceiver, unstakePeriodBlocks, payoutPeriodBlocks, owner) ) ); - console.log("VanillaReputationalRegistry UUPS proxy deployed to:", address(proxy)); - VanillaRegistry vanillaRegistry = VanillaRegistry(payable(proxy)); - console.log("VanillaReputationalRegistry owner:", vanillaRegistry.owner()); + console.log("VanillaReputationalRegistryV2 UUPS proxy deployed to:", address(proxy)); + VanillaRegistryV2 vanillaRegistry = VanillaRegistryV2(payable(proxy)); + console.log("VanillaReputationalRegistryV2 owner:", vanillaRegistry.owner()); return proxy; } } diff --git a/contracts/scripts/validator-registry/GetParams.s.sol b/contracts/scripts/validator-registry/GetParams.s.sol index eb280a8f6..388381f96 100644 --- a/contracts/scripts/validator-registry/GetParams.s.sol +++ b/contracts/scripts/validator-registry/GetParams.s.sol @@ -6,9 +6,9 @@ pragma solidity 0.8.26; import {Script} from "forge-std/Script.sol"; -import {VanillaRegistry} from "../../contracts/validator-registry/VanillaRegistry.sol"; +import {VanillaRegistryV2} from "../../contracts/validator-registry/VanillaRegistryV2.sol"; import {console} from "forge-std/console.sol"; -import {VanillaRegistryStorage} from "../../contracts/validator-registry/VanillaRegistryStorage.sol"; +import {VanillaRegistryStorageV2} from "../../contracts/validator-registry/VanillaRegistryStorageV2.sol"; import {MevCommitAVS} from "../../contracts/validator-registry/avs/MevCommitAVS.sol"; import {MevCommitAVSStorage} from "../../contracts/validator-registry/avs/MevCommitAVSStorage.sol"; @@ -17,17 +17,17 @@ contract GetVanillaRegistryParams is Script { console.log("Getting params for VanillaRegistry on chain:", block.chainid); address vanillaRegAddr = 0x47afdcB2B089C16CEe354811EA1Bbe0DB7c335E9; - address owner = VanillaRegistry(payable(vanillaRegAddr)).owner(); + address owner = VanillaRegistryV2(payable(vanillaRegAddr)).owner(); console.log("VanillaRegistry owner:", owner); - bool isPaused = VanillaRegistry(payable(vanillaRegAddr)).paused(); + bool isPaused = VanillaRegistryV2(payable(vanillaRegAddr)).paused(); console.log("VanillaRegistry isPaused:", isPaused); - uint256 minStake = VanillaRegistryStorage(payable(vanillaRegAddr)).minStake(); + uint256 minStake = VanillaRegistryStorageV2(payable(vanillaRegAddr)).minStake(); console.log("VanillaRegistry minStake:", minStake); - address slashOracle = VanillaRegistryStorage(payable(vanillaRegAddr)).slashOracle(); + address slashOracle = VanillaRegistryStorageV2(payable(vanillaRegAddr)).slashOracle(); console.log("VanillaRegistry slashOracle:", slashOracle); - uint256 unstakePeriodBlocks = VanillaRegistryStorage(payable(vanillaRegAddr)).unstakePeriodBlocks(); + uint256 unstakePeriodBlocks = VanillaRegistryStorageV2(payable(vanillaRegAddr)).unstakePeriodBlocks(); console.log("VanillaRegistry unstakePeriodBlocks:", unstakePeriodBlocks); - uint256 accumulatedFunds = VanillaRegistry(payable(vanillaRegAddr)).getAccumulatedSlashingFunds(); + uint256 accumulatedFunds = VanillaRegistryV2(payable(vanillaRegAddr)).getAccumulatedSlashingFunds(); console.log("VanillaRegistry accumulatedFunds:", accumulatedFunds); } } diff --git a/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol b/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol index 14d56b2e5..9221c18bc 100644 --- a/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol +++ b/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol @@ -7,13 +7,13 @@ pragma solidity 0.8.26; import {Script} from "forge-std/Script.sol"; import {console} from "forge-std/console.sol"; -import {VanillaRegistry} from "../../contracts/validator-registry/VanillaRegistry.sol"; -import {IVanillaRegistry} from "../../contracts/interfaces/IVanillaRegistry.sol"; +import {VanillaRegistryV2} from "../../contracts/validator-registry/VanillaRegistryV2.sol"; +import {IVanillaRegistryV2} from "../../contracts/interfaces/IVanillaRegistryV2.sol"; // Script to e2e test the VanillaRegistry contract with anvil, also see makefile. abstract contract ExampleScript is Script { - VanillaRegistry internal _validatorRegistry = VanillaRegistry(payable(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512)); + VanillaRegistryV2 internal _validatorRegistry = VanillaRegistryV2(payable(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512)); // When starting anvil: // @@ -49,7 +49,7 @@ abstract contract ExampleScript is Script { console.log("Staked Amount:", stakedAmount); bool isUnstaking = _validatorRegistry.isUnstaking(blsKeys[i]); console.log("is Unstaking: %s", isUnstaking); - IVanillaRegistry.StakedValidator memory stakedValidator = _validatorRegistry.getStakedValidator(blsKeys[i]); + IVanillaRegistryV2.StakedValidator memory stakedValidator = _validatorRegistry.getStakedValidator(blsKeys[i]); console.log("Staked Validator balance: %s", stakedValidator.balance); console.log("Staked Validator withdrawalAddress: %s", stakedValidator.withdrawalAddress); console.log("Staked Validator unstakeBlockNum: %s", stakedValidator.unstakeOccurrence.blockHeight); diff --git a/contracts/test/validator-registry/ValidatorOptInRouterTest.sol b/contracts/test/validator-registry/ValidatorOptInRouterTest.sol index 540b38777..0978e2c07 100644 --- a/contracts/test/validator-registry/ValidatorOptInRouterTest.sol +++ b/contracts/test/validator-registry/ValidatorOptInRouterTest.sol @@ -2,14 +2,15 @@ pragma solidity 0.8.26; import {Test} from "forge-std/Test.sol"; -import {VanillaRegistry} from "../../contracts/validator-registry/VanillaRegistry.sol"; +import {VanillaRegistryV2} from "../../contracts/validator-registry/VanillaRegistryV2.sol"; import {ValidatorOptInRouter} from "../../contracts/validator-registry/ValidatorOptInRouter.sol"; import {MevCommitAVS} from "../../contracts/validator-registry/avs/MevCommitAVS.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; -import {VanillaRegistryTest} from "./VanillaRegistryTest.sol"; +import {VanillaRegistryV2Test} from "./VanillaRegistryV2Test.sol"; import {MevCommitAVSTest} from "./avs/MevCommitAVSTest.sol"; import {IValidatorOptInRouter} from "../../contracts/interfaces/IValidatorOptInRouter.sol"; -import {IVanillaRegistry} from "../../contracts/interfaces/IVanillaRegistry.sol"; +import {IVanillaRegistryV2} from "../../contracts/interfaces/IVanillaRegistryV2.sol"; +import {IVanillaRegistry} from "../../contracts/upgrades/IVanillaRegistry.sol"; import {IMevCommitAVS} from "../../contracts/interfaces/IMevCommitAVS.sol"; import {IMevCommitMiddleware} from "../../contracts/interfaces/IMevCommitMiddleware.sol"; import {MevCommitMiddleware} from "../../contracts/validator-registry/middleware/MevCommitMiddleware.sol"; @@ -18,8 +19,8 @@ import {MevCommitMiddlewareTestCont} from "./middleware/MevCommitMiddlewareTestC contract ValidatorOptInRouterTest is Test { ValidatorOptInRouter public validatorOptInRouter; - VanillaRegistry public vanillaRegistry; - VanillaRegistryTest public vanillaRegistryTest; + VanillaRegistryV2 public vanillaRegistry; + VanillaRegistryV2Test public vanillaRegistryTest; MevCommitAVS public mevCommitAVS; MevCommitAVSTest public mevCommitAVSTest; MevCommitMiddleware public mevCommitMiddleware; @@ -38,7 +39,7 @@ contract ValidatorOptInRouterTest is Test { user1 = address(0x123); user2 = address(0x456); - vanillaRegistryTest = new VanillaRegistryTest(); + vanillaRegistryTest = new VanillaRegistryV2Test(); vanillaRegistryTest.setUp(); vanillaRegistry = vanillaRegistryTest.validatorRegistry(); @@ -64,12 +65,12 @@ contract ValidatorOptInRouterTest is Test { } function testSetters() public { - IVanillaRegistry newValReg = new VanillaRegistry(); - IVanillaRegistry oldValReg = vanillaRegistry; + IVanillaRegistryV2 newValReg = new VanillaRegistryV2(); + IVanillaRegistryV2 oldValReg = vanillaRegistry; vm.prank(owner); vm.expectEmit(); emit VanillaRegistrySet(address(oldValReg), address(newValReg)); - validatorOptInRouter.setVanillaRegistry(newValReg); + validatorOptInRouter.setVanillaRegistry((IVanillaRegistry((address(newValReg))))); assertEq(address(validatorOptInRouter.vanillaRegistry()), address(newValReg)); IMevCommitAVS newMevCommitAVS = new MevCommitAVS(); diff --git a/contracts/test/validator-registry/VanillaRegistryTest.sol b/contracts/test/validator-registry/VanillaRegistryV2Test.sol similarity index 91% rename from contracts/test/validator-registry/VanillaRegistryTest.sol rename to contracts/test/validator-registry/VanillaRegistryV2Test.sol index c8e87f459..ba3b815a4 100644 --- a/contracts/test/validator-registry/VanillaRegistryTest.sol +++ b/contracts/test/validator-registry/VanillaRegistryV2Test.sol @@ -2,13 +2,13 @@ pragma solidity 0.8.26; import {Test} from"forge-std/Test.sol"; -import {VanillaRegistry} from"../../contracts/validator-registry/VanillaRegistry.sol"; +import {VanillaRegistryV2} from"../../contracts/validator-registry/VanillaRegistryV2.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; -import {IVanillaRegistry} from "../../contracts/interfaces/IVanillaRegistry.sol"; +import {IVanillaRegistryV2} from "../../contracts/interfaces/IVanillaRegistryV2.sol"; import {OwnableUpgradeable} from "openzeppelin-contracts-upgradeable/contracts/access/OwnableUpgradeable.sol"; -contract VanillaRegistryTest is Test { - VanillaRegistry public validatorRegistry; +contract VanillaRegistryV2Test is Test { + VanillaRegistryV2 public validatorRegistry; address public owner; address public user1; address public user2; @@ -46,10 +46,10 @@ contract VanillaRegistryTest is Test { assertEq(user2BLSKey.length, 48); address proxy = Upgrades.deployUUPSProxy( - "VanillaRegistry.sol", - abi.encodeCall(VanillaRegistry.initialize, (MIN_STAKE, SLASH_ORACLE, SLASH_RECEIVER, UNSTAKE_PERIOD, PAYOUT_PERIOD, owner)) + "VanillaRegistryV2.sol", + abi.encodeCall(VanillaRegistryV2.initialize, (MIN_STAKE, SLASH_ORACLE, SLASH_RECEIVER, UNSTAKE_PERIOD, PAYOUT_PERIOD, owner)) ); - validatorRegistry = VanillaRegistry(payable(proxy)); + validatorRegistry = VanillaRegistryV2(payable(proxy)); } function testSecondInitialize() public { @@ -66,7 +66,7 @@ contract VanillaRegistryTest is Test { bytes[] memory validators = new bytes[](1); validators[0] = user1BLSKey; - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.SenderIsNotWhitelistedStaker.selector, user1)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.SenderIsNotWhitelistedStaker.selector, user1)); vm.prank(user1); validatorRegistry.stake{value: MIN_STAKE}(validators); @@ -100,7 +100,7 @@ contract VanillaRegistryTest is Test { validators[0] = user2BLSKey; vm.startPrank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.SenderIsNotWhitelistedStaker.selector, user1)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.SenderIsNotWhitelistedStaker.selector, user1)); validatorRegistry.stake{value: MIN_STAKE}(validators); vm.stopPrank(); @@ -197,7 +197,7 @@ contract VanillaRegistryTest is Test { validators[0] = user1BLSKey; vm.prank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.StakeTooLowForNumberOfKeys.selector, MIN_STAKE/2, MIN_STAKE)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.StakeTooLowForNumberOfKeys.selector, MIN_STAKE/2, MIN_STAKE)); validatorRegistry.stake{value: MIN_STAKE/2}(validators); assertFalse(validatorRegistry.isValidatorOptedIn(user1BLSKey)); @@ -209,11 +209,11 @@ contract VanillaRegistryTest is Test { assertTrue(validatorRegistry.isValidatorOptedIn(user1BLSKey)); vm.prank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.StakeTooLowForNumberOfKeys.selector, 0, 1)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.StakeTooLowForNumberOfKeys.selector, 0, 1)); validatorRegistry.addStake{value: 0}(validators); vm.prank(user2); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.SenderIsNotWithdrawalAddress.selector, user2, user1)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.SenderIsNotWithdrawalAddress.selector, user2, user1)); validatorRegistry.addStake{value: MIN_STAKE/2}(validators); vm.prank(user1); @@ -231,7 +231,7 @@ contract VanillaRegistryTest is Test { assertEq(validatorRegistry.getStakedAmount(user2BLSKey), 0); vm.startPrank(user2); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustExist.selector, user2BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustExist.selector, user2BLSKey)); validatorRegistry.unstake(validators); vm.stopPrank(); assertEq(validatorRegistry.getStakedAmount(user2BLSKey), 0); @@ -242,7 +242,7 @@ contract VanillaRegistryTest is Test { bytes[] memory validators = new bytes[](1); validators[0] = user1BLSKey; vm.startPrank(user2); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.SenderIsNotWithdrawalAddress.selector, user2, user1)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.SenderIsNotWithdrawalAddress.selector, user2, user1)); validatorRegistry.unstake(validators); vm.stopPrank(); } @@ -270,7 +270,7 @@ contract VanillaRegistryTest is Test { bothValidators[0] = user1BLSKey; bothValidators[1] = user2BLSKey; vm.prank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.SenderIsNotWithdrawalAddress.selector, user1, user2)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.SenderIsNotWithdrawalAddress.selector, user1, user2)); validatorRegistry.unstake(bothValidators); } @@ -285,7 +285,7 @@ contract VanillaRegistryTest is Test { vm.roll(500); vm.prank(user2); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.WithdrawalAddressMismatch.selector, + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.WithdrawalAddressMismatch.selector, user1, // actual from validator record user2)); // expected from msg.sender validatorRegistry.withdraw(validators); @@ -318,7 +318,7 @@ contract VanillaRegistryTest is Test { bothValidators[0] = user1BLSKey; bothValidators[1] = user2BLSKey; vm.prank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.WithdrawalAddressMismatch.selector, + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.WithdrawalAddressMismatch.selector, user2, // actual from validator record user1)); // expected from msg.sender validatorRegistry.withdraw(bothValidators); @@ -332,7 +332,7 @@ contract VanillaRegistryTest is Test { validators[0] = user1BLSKey; vm.startPrank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.MustUnstakeToWithdraw.selector)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.MustUnstakeToWithdraw.selector)); validatorRegistry.withdraw(validators); vm.stopPrank(); } @@ -378,14 +378,14 @@ contract VanillaRegistryTest is Test { vm.stopPrank(); vm.startPrank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorCannotBeUnstaking.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorCannotBeUnstaking.selector, user1BLSKey)); validatorRegistry.unstake(validators); vm.stopPrank(); vm.roll(500); vm.startPrank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorCannotBeUnstaking.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorCannotBeUnstaking.selector, user1BLSKey)); validatorRegistry.unstake(validators); vm.stopPrank(); } @@ -407,14 +407,14 @@ contract VanillaRegistryTest is Test { assertEq(validatorRegistry.getStakedAmount(user1BLSKey), MIN_STAKE); vm.startPrank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustNotExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustNotExist.selector, user1BLSKey)); validatorRegistry.stake{value: MIN_STAKE}(validators); vm.stopPrank(); vm.roll(500); vm.startPrank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustNotExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustNotExist.selector, user1BLSKey)); validatorRegistry.stake{value: MIN_STAKE}(validators); vm.stopPrank(); @@ -425,7 +425,7 @@ contract VanillaRegistryTest is Test { vm.deal(user2, 10 ether); vm.startPrank(user2); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustNotExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustNotExist.selector, user1BLSKey)); validatorRegistry.stake{value: MIN_STAKE}(validators); vm.stopPrank(); @@ -483,7 +483,7 @@ contract VanillaRegistryTest is Test { } function testSlashMinStakeIncreased() public { - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustExist.selector, user1BLSKey)); bytes[] memory validators = new bytes[](1); validators[0] = user1BLSKey; vm.prank(SLASH_ORACLE); @@ -514,7 +514,7 @@ contract VanillaRegistryTest is Test { function testUnauthorizedSlash() public { testSelfStake(); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.SenderIsNotSlashOracle.selector, user2, SLASH_ORACLE)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.SenderIsNotSlashOracle.selector, user2, SLASH_ORACLE)); bytes[] memory validators = new bytes[](1); validators[0] = user1BLSKey; vm.prank(user2); @@ -705,7 +705,7 @@ contract VanillaRegistryTest is Test { function testGetBlocksTillWithdrawAllowed() public { testSelfStake(); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.MustUnstakeToWithdraw.selector)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.MustUnstakeToWithdraw.selector)); validatorRegistry.getBlocksTillWithdrawAllowed(user2BLSKey); assertEq(block.number, 1); @@ -734,7 +734,7 @@ contract VanillaRegistryTest is Test { assertEq(blocksTillWithdraw, 1); vm.startPrank(user1); - vm.expectRevert(IVanillaRegistry.WithdrawingTooSoon.selector); + vm.expectRevert(IVanillaRegistryV2.WithdrawingTooSoon.selector); validatorRegistry.withdraw(validators); vm.stopPrank(); @@ -793,7 +793,7 @@ contract VanillaRegistryTest is Test { vm.roll(30); vm.prank(user1); - vm.expectRevert(IVanillaRegistry.WithdrawingTooSoon.selector); + vm.expectRevert(IVanillaRegistryV2.WithdrawingTooSoon.selector); validatorRegistry.withdraw(validators); vm.stopPrank(); @@ -937,7 +937,7 @@ contract VanillaRegistryTest is Test { vm.prank(user1); vm.expectRevert( - abi.encodeWithSelector(IVanillaRegistry.ValidatorCannotBeUnstaking.selector, user1BLSKey) + abi.encodeWithSelector(IVanillaRegistryV2.ValidatorCannotBeUnstaking.selector, user1BLSKey) ); validatorRegistry.addStake{value: MIN_STAKE}(validators); } @@ -959,7 +959,7 @@ contract VanillaRegistryTest is Test { vm.deal(user1, 100 wei); vm.prank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.StakeTooLowForNumberOfKeys.selector, 80, 90)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.StakeTooLowForNumberOfKeys.selector, 80, 90)); validatorRegistry.stake{value: 80 wei}(validators); assertEq(address(validatorRegistry).balance, 0); @@ -999,7 +999,7 @@ contract VanillaRegistryTest is Test { validators[1] = user2BLSKey; vm.prank(owner); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustExist.selector, user1BLSKey)); validatorRegistry.forceWithdrawalAsOwner(validators, user1); testMultiStake(); @@ -1015,13 +1015,13 @@ contract VanillaRegistryTest is Test { validatorRegistry.forceWithdrawalAsOwner(validators, user1); vm.prank(owner); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.WithdrawingTooSoon.selector)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.WithdrawingTooSoon.selector)); validatorRegistry.forceWithdrawalAsOwner(validators, user1); vm.roll(200); vm.prank(owner); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.WithdrawalAddressMismatch.selector, user1, user2)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.WithdrawalAddressMismatch.selector, user1, user2)); validatorRegistry.forceWithdrawalAsOwner(validators, user2); assertEq(address(validatorRegistry).balance, 6 ether); @@ -1052,7 +1052,7 @@ contract VanillaRegistryTest is Test { assertEq(owner.balance, ownerBefore); vm.prank(owner); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustExist.selector, user1BLSKey)); validatorRegistry.forceWithdrawalAsOwner(validators, user1); } @@ -1066,7 +1066,7 @@ contract VanillaRegistryTest is Test { vm.roll(500); - IVanillaRegistry.StakedValidator memory stakedValidator = validatorRegistry.getStakedValidator(user1BLSKey); + IVanillaRegistryV2.StakedValidator memory stakedValidator = validatorRegistry.getStakedValidator(user1BLSKey); assertTrue(stakedValidator.exists); assertEq(stakedValidator.balance, 0); assertEq(stakedValidator.withdrawalAddress, user1); @@ -1102,7 +1102,7 @@ contract VanillaRegistryTest is Test { vm.roll(200); - IVanillaRegistry.StakedValidator memory stakedValidator = validatorRegistry.getStakedValidator(user1BLSKey); + IVanillaRegistryV2.StakedValidator memory stakedValidator = validatorRegistry.getStakedValidator(user1BLSKey); assertTrue(stakedValidator.exists); assertEq(stakedValidator.balance, 2 ether); assertEq(stakedValidator.withdrawalAddress, user1); @@ -1145,17 +1145,17 @@ contract VanillaRegistryTest is Test { vm.deal(user1, 3 * MIN_STAKE); vm.prank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustNotExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustNotExist.selector, user1BLSKey)); validatorRegistry.stake{value: 3 * MIN_STAKE}(validators); vm.deal(owner, 3 * MIN_STAKE); vm.prank(owner); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustNotExist.selector, user1BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustNotExist.selector, user1BLSKey)); validatorRegistry.delegateStake{value: 3 * MIN_STAKE}(validators, user1); validators[2] = user2BLSKey; vm.prank(user1); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.ValidatorRecordMustNotExist.selector, user2BLSKey)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.ValidatorRecordMustNotExist.selector, user2BLSKey)); validatorRegistry.stake{value: 3 * MIN_STAKE}(validators); validators[2] = user3BLSKey; @@ -1176,7 +1176,7 @@ contract VanillaRegistryTest is Test { validatorRegistry.whitelistStakers(stakers); vm.prank(owner); - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.StakerAlreadyWhitelisted.selector, user1)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.StakerAlreadyWhitelisted.selector, user1)); validatorRegistry.whitelistStakers(stakers); } @@ -1184,7 +1184,7 @@ contract VanillaRegistryTest is Test { vm.prank(owner); address[] memory stakers = new address[](1); stakers[0] = user1; - vm.expectRevert(abi.encodeWithSelector(IVanillaRegistry.StakerNotWhitelisted.selector, user1)); + vm.expectRevert(abi.encodeWithSelector(IVanillaRegistryV2.StakerNotWhitelisted.selector, user1)); validatorRegistry.removeWhitelistedStakers(stakers); } diff --git a/contracts/test/validator-registry/rewards/RewardManagerTest.sol b/contracts/test/validator-registry/rewards/RewardManagerTest.sol index dab77bcff..61a36d8cf 100644 --- a/contracts/test/validator-registry/rewards/RewardManagerTest.sol +++ b/contracts/test/validator-registry/rewards/RewardManagerTest.sol @@ -2,14 +2,14 @@ pragma solidity 0.8.26; import {Test} from "forge-std/Test.sol"; -import {VanillaRegistry} from "../../../contracts/validator-registry/VanillaRegistry.sol"; +import {VanillaRegistryV2} from "../../../contracts/validator-registry/VanillaRegistryV2.sol"; import {ValidatorOptInRouter} from "../../../contracts/validator-registry/ValidatorOptInRouter.sol"; import {MevCommitAVS} from "../../../contracts/validator-registry/avs/MevCommitAVS.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; -import {VanillaRegistryTest} from "../VanillaRegistryTest.sol"; +import {VanillaRegistryV2Test} from "../VanillaRegistryV2Test.sol"; import {MevCommitAVSTest} from "../avs/MevCommitAVSTest.sol"; import {IValidatorOptInRouter} from "../../../contracts/interfaces/IValidatorOptInRouter.sol"; -import {IVanillaRegistry} from "../../../contracts/interfaces/IVanillaRegistry.sol"; +import {IVanillaRegistryV2} from "../../../contracts/interfaces/IVanillaRegistryV2.sol"; import {IMevCommitAVS} from "../../../contracts/interfaces/IMevCommitAVS.sol"; import {IMevCommitMiddleware} from "../../../contracts/interfaces/IMevCommitMiddleware.sol"; import {MevCommitMiddleware} from "../../../contracts/validator-registry/middleware/MevCommitMiddleware.sol"; @@ -23,8 +23,8 @@ import "@openzeppelin/contracts-upgradeable/utils/PausableUpgradeable.sol"; contract RewardManagerTest is Test { RewardManager public rewardManager; - VanillaRegistry public vanillaRegistry; - VanillaRegistryTest public vanillaRegistryTest; + VanillaRegistryV2 public vanillaRegistry; + VanillaRegistryV2Test public vanillaRegistryTest; MevCommitAVS public mevCommitAVS; MevCommitAVSTest public mevCommitAVSTest; MevCommitMiddleware public mevCommitMiddleware; @@ -67,7 +67,7 @@ contract RewardManagerTest is Test { user4 = address(0xabc); user5 = address(0xdef); - vanillaRegistryTest = new VanillaRegistryTest(); + vanillaRegistryTest = new VanillaRegistryV2Test(); vanillaRegistryTest.setUp(); vanillaRegistry = vanillaRegistryTest.validatorRegistry(); @@ -96,7 +96,7 @@ contract RewardManagerTest is Test { } function testRMSetters() public { - IVanillaRegistry newRegistry = new VanillaRegistry(); + IVanillaRegistryV2 newRegistry = new VanillaRegistryV2(); vm.prank(owner); vm.expectEmit(); emit VanillaRegistrySet(address(newRegistry)); @@ -177,7 +177,7 @@ contract RewardManagerTest is Test { emit RemovedFromAutoClaimBlacklist(user1); rewardManager.removeFromAutoClaimBlacklist(user1); - VanillaRegistry newRegistry = new VanillaRegistry(); + VanillaRegistryV2 newRegistry = new VanillaRegistryV2(); vm.prank(owner); vm.expectEmit(); emit VanillaRegistrySet(address(newRegistry)); diff --git a/p2p/gen/go/bidderapi/v1/bidderapi_grpc.pb.go b/p2p/gen/go/bidderapi/v1/bidderapi_grpc.pb.go index 1462cf44c..3badbf509 100644 --- a/p2p/gen/go/bidderapi/v1/bidderapi_grpc.pb.go +++ b/p2p/gen/go/bidderapi/v1/bidderapi_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc (unknown) // source: bidderapi/v1/bidderapi.proto @@ -358,46 +358,46 @@ type BidderServer interface { type UnimplementedBidderServer struct{} func (UnimplementedBidderServer) SendBid(*Bid, grpc.ServerStreamingServer[Commitment]) error { - return status.Errorf(codes.Unimplemented, "method SendBid not implemented") + return status.Error(codes.Unimplemented, "method SendBid not implemented") } func (UnimplementedBidderServer) Deposit(context.Context, *DepositRequest) (*DepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") + return nil, status.Error(codes.Unimplemented, "method Deposit not implemented") } func (UnimplementedBidderServer) DepositEvenly(context.Context, *DepositEvenlyRequest) (*DepositEvenlyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DepositEvenly not implemented") + return nil, status.Error(codes.Unimplemented, "method DepositEvenly not implemented") } func (UnimplementedBidderServer) EnableDepositManager(context.Context, *EnableDepositManagerRequest) (*EnableDepositManagerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method EnableDepositManager not implemented") + return nil, status.Error(codes.Unimplemented, "method EnableDepositManager not implemented") } func (UnimplementedBidderServer) DisableDepositManager(context.Context, *DisableDepositManagerRequest) (*DisableDepositManagerResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DisableDepositManager not implemented") + return nil, status.Error(codes.Unimplemented, "method DisableDepositManager not implemented") } func (UnimplementedBidderServer) SetTargetDeposits(context.Context, *SetTargetDepositsRequest) (*SetTargetDepositsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method SetTargetDeposits not implemented") + return nil, status.Error(codes.Unimplemented, "method SetTargetDeposits not implemented") } func (UnimplementedBidderServer) DepositManagerStatus(context.Context, *DepositManagerStatusRequest) (*DepositManagerStatusResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DepositManagerStatus not implemented") + return nil, status.Error(codes.Unimplemented, "method DepositManagerStatus not implemented") } func (UnimplementedBidderServer) RequestWithdrawals(context.Context, *RequestWithdrawalsRequest) (*RequestWithdrawalsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RequestWithdrawals not implemented") + return nil, status.Error(codes.Unimplemented, "method RequestWithdrawals not implemented") } func (UnimplementedBidderServer) GetValidProviders(context.Context, *GetValidProvidersRequest) (*GetValidProvidersResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetValidProviders not implemented") + return nil, status.Error(codes.Unimplemented, "method GetValidProviders not implemented") } func (UnimplementedBidderServer) GetDeposit(context.Context, *GetDepositRequest) (*DepositResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetDeposit not implemented") + return nil, status.Error(codes.Unimplemented, "method GetDeposit not implemented") } func (UnimplementedBidderServer) GetAllDeposits(context.Context, *GetAllDepositsRequest) (*GetAllDepositsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetAllDeposits not implemented") + return nil, status.Error(codes.Unimplemented, "method GetAllDeposits not implemented") } func (UnimplementedBidderServer) Withdraw(context.Context, *WithdrawRequest) (*WithdrawResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Withdraw not implemented") + return nil, status.Error(codes.Unimplemented, "method Withdraw not implemented") } func (UnimplementedBidderServer) GetBidInfo(context.Context, *GetBidInfoRequest) (*GetBidInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetBidInfo not implemented") + return nil, status.Error(codes.Unimplemented, "method GetBidInfo not implemented") } func (UnimplementedBidderServer) ClaimSlashedFunds(context.Context, *EmptyMessage) (*wrapperspb.StringValue, error) { - return nil, status.Errorf(codes.Unimplemented, "method ClaimSlashedFunds not implemented") + return nil, status.Error(codes.Unimplemented, "method ClaimSlashedFunds not implemented") } func (UnimplementedBidderServer) mustEmbedUnimplementedBidderServer() {} func (UnimplementedBidderServer) testEmbeddedByValue() {} @@ -410,7 +410,7 @@ type UnsafeBidderServer interface { } func RegisterBidderServer(s grpc.ServiceRegistrar, srv BidderServer) { - // If the following call pancis, it indicates UnimplementedBidderServer was + // If the following call panics, it indicates UnimplementedBidderServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/p2p/gen/go/debugapi/v1/debugapi_grpc.pb.go b/p2p/gen/go/debugapi/v1/debugapi_grpc.pb.go index 20f4ffc94..fb6c80f6e 100644 --- a/p2p/gen/go/debugapi/v1/debugapi_grpc.pb.go +++ b/p2p/gen/go/debugapi/v1/debugapi_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc (unknown) // source: debugapi/v1/debugapi.proto @@ -109,13 +109,13 @@ type DebugServiceServer interface { type UnimplementedDebugServiceServer struct{} func (UnimplementedDebugServiceServer) GetTopology(context.Context, *EmptyMessage) (*TopologyResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetTopology not implemented") + return nil, status.Error(codes.Unimplemented, "method GetTopology not implemented") } func (UnimplementedDebugServiceServer) GetPendingTransactions(context.Context, *EmptyMessage) (*PendingTransactionsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetPendingTransactions not implemented") + return nil, status.Error(codes.Unimplemented, "method GetPendingTransactions not implemented") } func (UnimplementedDebugServiceServer) CancelTransaction(context.Context, *CancelTransactionReq) (*CancelTransactionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CancelTransaction not implemented") + return nil, status.Error(codes.Unimplemented, "method CancelTransaction not implemented") } func (UnimplementedDebugServiceServer) mustEmbedUnimplementedDebugServiceServer() {} func (UnimplementedDebugServiceServer) testEmbeddedByValue() {} @@ -128,7 +128,7 @@ type UnsafeDebugServiceServer interface { } func RegisterDebugServiceServer(s grpc.ServiceRegistrar, srv DebugServiceServer) { - // If the following call pancis, it indicates UnimplementedDebugServiceServer was + // If the following call panics, it indicates UnimplementedDebugServiceServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/p2p/gen/go/notificationsapi/v1/notifications_grpc.pb.go b/p2p/gen/go/notificationsapi/v1/notifications_grpc.pb.go index e875dbaf6..b2982efc8 100644 --- a/p2p/gen/go/notificationsapi/v1/notifications_grpc.pb.go +++ b/p2p/gen/go/notificationsapi/v1/notifications_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc (unknown) // source: notificationsapi/v1/notifications.proto @@ -82,7 +82,7 @@ type NotificationsServer interface { type UnimplementedNotificationsServer struct{} func (UnimplementedNotificationsServer) Subscribe(*SubscribeRequest, grpc.ServerStreamingServer[Notification]) error { - return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") + return status.Error(codes.Unimplemented, "method Subscribe not implemented") } func (UnimplementedNotificationsServer) mustEmbedUnimplementedNotificationsServer() {} func (UnimplementedNotificationsServer) testEmbeddedByValue() {} @@ -95,7 +95,7 @@ type UnsafeNotificationsServer interface { } func RegisterNotificationsServer(s grpc.ServiceRegistrar, srv NotificationsServer) { - // If the following call pancis, it indicates UnimplementedNotificationsServer was + // If the following call panics, it indicates UnimplementedNotificationsServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/p2p/gen/go/providerapi/v1/providerapi_grpc.pb.go b/p2p/gen/go/providerapi/v1/providerapi_grpc.pb.go index 3a45c4fc3..2cd982b6a 100644 --- a/p2p/gen/go/providerapi/v1/providerapi_grpc.pb.go +++ b/p2p/gen/go/providerapi/v1/providerapi_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc (unknown) // source: providerapi/v1/providerapi.proto @@ -283,37 +283,37 @@ type ProviderServer interface { type UnimplementedProviderServer struct{} func (UnimplementedProviderServer) ReceiveBids(*EmptyMessage, grpc.ServerStreamingServer[Bid]) error { - return status.Errorf(codes.Unimplemented, "method ReceiveBids not implemented") + return status.Error(codes.Unimplemented, "method ReceiveBids not implemented") } func (UnimplementedProviderServer) SendProcessedBids(grpc.ClientStreamingServer[BidResponse, EmptyMessage]) error { - return status.Errorf(codes.Unimplemented, "method SendProcessedBids not implemented") + return status.Error(codes.Unimplemented, "method SendProcessedBids not implemented") } func (UnimplementedProviderServer) Stake(context.Context, *StakeRequest) (*StakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Stake not implemented") + return nil, status.Error(codes.Unimplemented, "method Stake not implemented") } func (UnimplementedProviderServer) GetStake(context.Context, *EmptyMessage) (*StakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetStake not implemented") + return nil, status.Error(codes.Unimplemented, "method GetStake not implemented") } func (UnimplementedProviderServer) GetMinStake(context.Context, *EmptyMessage) (*StakeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetMinStake not implemented") + return nil, status.Error(codes.Unimplemented, "method GetMinStake not implemented") } func (UnimplementedProviderServer) WithdrawStake(context.Context, *EmptyMessage) (*WithdrawalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawStake not implemented") + return nil, status.Error(codes.Unimplemented, "method WithdrawStake not implemented") } func (UnimplementedProviderServer) Unstake(context.Context, *EmptyMessage) (*EmptyMessage, error) { - return nil, status.Errorf(codes.Unimplemented, "method Unstake not implemented") + return nil, status.Error(codes.Unimplemented, "method Unstake not implemented") } func (UnimplementedProviderServer) GetProviderReward(context.Context, *EmptyMessage) (*RewardResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetProviderReward not implemented") + return nil, status.Error(codes.Unimplemented, "method GetProviderReward not implemented") } func (UnimplementedProviderServer) WithdrawProviderReward(context.Context, *EmptyMessage) (*WithdrawalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method WithdrawProviderReward not implemented") + return nil, status.Error(codes.Unimplemented, "method WithdrawProviderReward not implemented") } func (UnimplementedProviderServer) GetCommitmentInfo(context.Context, *GetCommitmentInfoRequest) (*CommitmentInfoResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetCommitmentInfo not implemented") + return nil, status.Error(codes.Unimplemented, "method GetCommitmentInfo not implemented") } func (UnimplementedProviderServer) GetDecryptedTransaction(context.Context, *GetDecryptedTransactionRequest) (*GetDecryptedTransactionResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetDecryptedTransaction not implemented") + return nil, status.Error(codes.Unimplemented, "method GetDecryptedTransaction not implemented") } func (UnimplementedProviderServer) mustEmbedUnimplementedProviderServer() {} func (UnimplementedProviderServer) testEmbeddedByValue() {} @@ -326,7 +326,7 @@ type UnsafeProviderServer interface { } func RegisterProviderServer(s grpc.ServiceRegistrar, srv ProviderServer) { - // If the following call pancis, it indicates UnimplementedProviderServer was + // If the following call panics, it indicates UnimplementedProviderServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O. diff --git a/p2p/gen/go/validatorapi/v1/validatorapi_grpc.pb.go b/p2p/gen/go/validatorapi/v1/validatorapi_grpc.pb.go index 7346eb264..0f6e17675 100644 --- a/p2p/gen/go/validatorapi/v1/validatorapi_grpc.pb.go +++ b/p2p/gen/go/validatorapi/v1/validatorapi_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.5.1 +// - protoc-gen-go-grpc v1.6.0 // - protoc (unknown) // source: validatorapi/v1/validatorapi.proto @@ -69,7 +69,7 @@ type ValidatorServer interface { type UnimplementedValidatorServer struct{} func (UnimplementedValidatorServer) GetValidators(context.Context, *GetValidatorsRequest) (*GetValidatorsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetValidators not implemented") + return nil, status.Error(codes.Unimplemented, "method GetValidators not implemented") } func (UnimplementedValidatorServer) mustEmbedUnimplementedValidatorServer() {} func (UnimplementedValidatorServer) testEmbeddedByValue() {} @@ -82,7 +82,7 @@ type UnsafeValidatorServer interface { } func RegisterValidatorServer(s grpc.ServiceRegistrar, srv ValidatorServer) { - // If the following call pancis, it indicates UnimplementedValidatorServer was + // If the following call panics, it indicates UnimplementedValidatorServer was // embedded by pointer and is nil. This will cause panics if an // unimplemented method is ever invoked, so we test this at initialization // time to prevent it from happening at runtime later due to I/O.