diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cc6ec6985..b847ba0ba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -188,6 +188,9 @@ jobs: - name: Install Hardhat run: npm install -g hardhat + + - name: Install solhint + run: npm install -g solhint - name: Install Dependencies run: npm install @@ -198,6 +201,7 @@ jobs: node --version npm --version forge --version + solhint --version - name: Build run: npm run build --if-present @@ -216,6 +220,10 @@ jobs: git diff --name-only --exit-code . || (echo "Generated files not in parity with the source files." && exit 1) git reset --hard HEAD working-directory: contracts-abi + + - name: Run solhint solidity linter + run: solhint '**/*.sol' + working-directory: contracts infrastructure: uses: ./.github/workflows/infrastructure.yml diff --git a/contracts-abi/abi/ValidatorRegistryV1.abi b/contracts-abi/abi/ValidatorRegistryV1.abi index db20fb149..42c81e94a 100644 --- a/contracts-abi/abi/ValidatorRegistryV1.abi +++ b/contracts-abi/abi/ValidatorRegistryV1.abi @@ -122,16 +122,16 @@ "type": "bool", "internalType": "bool" }, - { - "name": "balance", - "type": "uint256", - "internalType": "uint256" - }, { "name": "withdrawalAddress", "type": "address", "internalType": "address" }, + { + "name": "balance", + "type": "uint256", + "internalType": "uint256" + }, { "name": "unstakeHeight", "type": "tuple", @@ -455,16 +455,16 @@ "type": "bool", "internalType": "bool" }, - { - "name": "balance", - "type": "uint256", - "internalType": "uint256" - }, { "name": "withdrawalAddress", "type": "address", "internalType": "address" }, + { + "name": "balance", + "type": "uint256", + "internalType": "uint256" + }, { "name": "unstakeHeight", "type": "tuple", diff --git a/contracts-abi/clients/ValidatorRegistryV1/ValidatorRegistryV1.go b/contracts-abi/clients/ValidatorRegistryV1/ValidatorRegistryV1.go index b039007c6..7db225f91 100644 --- a/contracts-abi/clients/ValidatorRegistryV1/ValidatorRegistryV1.go +++ b/contracts-abi/clients/ValidatorRegistryV1/ValidatorRegistryV1.go @@ -38,14 +38,14 @@ type EventHeightLibEventHeight struct { // IValidatorRegistryV1StakedValidator is an auto generated low-level Go binding around an user-defined struct. type IValidatorRegistryV1StakedValidator struct { Exists bool - Balance *big.Int WithdrawalAddress common.Address + Balance *big.Int UnstakeHeight EventHeightLibEventHeight } // Validatorregistryv1MetaData contains all meta data concerning the Validatorregistryv1 contract. var Validatorregistryv1MetaData = &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\":\"delegateStake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"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\":\"structIValidatorRegistryV1.StakedValidator\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"unstakeHeight\",\"type\":\"tuple\",\"internalType\":\"structEventHeightLib.EventHeight\",\"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\":\"_slashAmount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_slashOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_slashReceiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_unstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"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\":\"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\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setMinStake\",\"inputs\":[{\"name\":\"newMinStake\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashAmount\",\"inputs\":[{\"name\":\"newSlashAmount\",\"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\":\"setUnstakePeriodBlocks\",\"inputs\":[{\"name\":\"newUnstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slash\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slashAmount\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"slashOracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"slashReceiver\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"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\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"unstakeHeight\",\"type\":\"tuple\",\"internalType\":\"structEventHeightLib.EventHeight\",\"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\":\"withdraw\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"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\":\"SlashAmountSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"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\":\"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\":\"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\":\"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\":\"InvalidFallback\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidReceive\",\"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\":\"UUPSUnauthorizedCallContext\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnsupportedProxiableUUID\",\"inputs\":[{\"name\":\"slot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]}]", + 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\":\"delegateStake\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"payable\"},{\"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\":\"structIValidatorRegistryV1.StakedValidator\",\"components\":[{\"name\":\"exists\",\"type\":\"bool\",\"internalType\":\"bool\"},{\"name\":\"withdrawalAddress\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"balance\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"unstakeHeight\",\"type\":\"tuple\",\"internalType\":\"structEventHeightLib.EventHeight\",\"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\":\"_slashAmount\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_slashOracle\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_slashReceiver\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_unstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"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\":\"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\":\"renounceOwnership\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setMinStake\",\"inputs\":[{\"name\":\"newMinStake\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"setSlashAmount\",\"inputs\":[{\"name\":\"newSlashAmount\",\"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\":\"setUnstakePeriodBlocks\",\"inputs\":[{\"name\":\"newUnstakePeriodBlocks\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slash\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"slashAmount\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"slashOracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"slashReceiver\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"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\":\"unstakeHeight\",\"type\":\"tuple\",\"internalType\":\"structEventHeightLib.EventHeight\",\"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\":\"withdraw\",\"inputs\":[{\"name\":\"blsPubKeys\",\"type\":\"bytes[]\",\"internalType\":\"bytes[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"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\":\"SlashAmountSet\",\"inputs\":[{\"name\":\"msgSender\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"newSlashAmount\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"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\":\"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\":\"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\":\"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\":\"InvalidFallback\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInitialization\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidReceive\",\"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\":\"UUPSUnauthorizedCallContext\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"UUPSUnsupportedProxiableUUID\",\"inputs\":[{\"name\":\"slot\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]}]", } // Validatorregistryv1ABI is the input ABI used to generate the binding from. @@ -289,7 +289,7 @@ func (_Validatorregistryv1 *Validatorregistryv1CallerSession) GetStakedAmount(va // GetStakedValidator is a free data retrieval call binding the contract method 0x1fc7c7c8. // -// Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,uint256,address,(bool,uint256))) +// Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,address,uint256,(bool,uint256))) func (_Validatorregistryv1 *Validatorregistryv1Caller) GetStakedValidator(opts *bind.CallOpts, valBLSPubKey []byte) (IValidatorRegistryV1StakedValidator, error) { var out []interface{} err := _Validatorregistryv1.contract.Call(opts, &out, "getStakedValidator", valBLSPubKey) @@ -306,14 +306,14 @@ func (_Validatorregistryv1 *Validatorregistryv1Caller) GetStakedValidator(opts * // GetStakedValidator is a free data retrieval call binding the contract method 0x1fc7c7c8. // -// Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,uint256,address,(bool,uint256))) +// Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,address,uint256,(bool,uint256))) func (_Validatorregistryv1 *Validatorregistryv1Session) GetStakedValidator(valBLSPubKey []byte) (IValidatorRegistryV1StakedValidator, error) { return _Validatorregistryv1.Contract.GetStakedValidator(&_Validatorregistryv1.CallOpts, valBLSPubKey) } // GetStakedValidator is a free data retrieval call binding the contract method 0x1fc7c7c8. // -// Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,uint256,address,(bool,uint256))) +// Solidity: function getStakedValidator(bytes valBLSPubKey) view returns((bool,address,uint256,(bool,uint256))) func (_Validatorregistryv1 *Validatorregistryv1CallerSession) GetStakedValidator(valBLSPubKey []byte) (IValidatorRegistryV1StakedValidator, error) { return _Validatorregistryv1.Contract.GetStakedValidator(&_Validatorregistryv1.CallOpts, valBLSPubKey) } @@ -630,11 +630,11 @@ func (_Validatorregistryv1 *Validatorregistryv1CallerSession) SlashReceiver() (c // StakedValidators is a free data retrieval call binding the contract method 0xfced6425. // -// Solidity: function stakedValidators(bytes ) view returns(bool exists, uint256 balance, address withdrawalAddress, (bool,uint256) unstakeHeight) +// Solidity: function stakedValidators(bytes ) view returns(bool exists, address withdrawalAddress, uint256 balance, (bool,uint256) unstakeHeight) func (_Validatorregistryv1 *Validatorregistryv1Caller) StakedValidators(opts *bind.CallOpts, arg0 []byte) (struct { Exists bool - Balance *big.Int WithdrawalAddress common.Address + Balance *big.Int UnstakeHeight EventHeightLibEventHeight }, error) { var out []interface{} @@ -642,8 +642,8 @@ func (_Validatorregistryv1 *Validatorregistryv1Caller) StakedValidators(opts *bi outstruct := new(struct { Exists bool - Balance *big.Int WithdrawalAddress common.Address + Balance *big.Int UnstakeHeight EventHeightLibEventHeight }) if err != nil { @@ -651,8 +651,8 @@ func (_Validatorregistryv1 *Validatorregistryv1Caller) StakedValidators(opts *bi } outstruct.Exists = *abi.ConvertType(out[0], new(bool)).(*bool) - outstruct.Balance = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) - outstruct.WithdrawalAddress = *abi.ConvertType(out[2], new(common.Address)).(*common.Address) + outstruct.WithdrawalAddress = *abi.ConvertType(out[1], new(common.Address)).(*common.Address) + outstruct.Balance = *abi.ConvertType(out[2], new(*big.Int)).(**big.Int) outstruct.UnstakeHeight = *abi.ConvertType(out[3], new(EventHeightLibEventHeight)).(*EventHeightLibEventHeight) return *outstruct, err @@ -661,11 +661,11 @@ func (_Validatorregistryv1 *Validatorregistryv1Caller) StakedValidators(opts *bi // StakedValidators is a free data retrieval call binding the contract method 0xfced6425. // -// Solidity: function stakedValidators(bytes ) view returns(bool exists, uint256 balance, address withdrawalAddress, (bool,uint256) unstakeHeight) +// Solidity: function stakedValidators(bytes ) view returns(bool exists, address withdrawalAddress, uint256 balance, (bool,uint256) unstakeHeight) func (_Validatorregistryv1 *Validatorregistryv1Session) StakedValidators(arg0 []byte) (struct { Exists bool - Balance *big.Int WithdrawalAddress common.Address + Balance *big.Int UnstakeHeight EventHeightLibEventHeight }, error) { return _Validatorregistryv1.Contract.StakedValidators(&_Validatorregistryv1.CallOpts, arg0) @@ -673,11 +673,11 @@ func (_Validatorregistryv1 *Validatorregistryv1Session) StakedValidators(arg0 [] // StakedValidators is a free data retrieval call binding the contract method 0xfced6425. // -// Solidity: function stakedValidators(bytes ) view returns(bool exists, uint256 balance, address withdrawalAddress, (bool,uint256) unstakeHeight) +// Solidity: function stakedValidators(bytes ) view returns(bool exists, address withdrawalAddress, uint256 balance, (bool,uint256) unstakeHeight) func (_Validatorregistryv1 *Validatorregistryv1CallerSession) StakedValidators(arg0 []byte) (struct { Exists bool - Balance *big.Int WithdrawalAddress common.Address + Balance *big.Int UnstakeHeight EventHeightLibEventHeight }, error) { return _Validatorregistryv1.Contract.StakedValidators(&_Validatorregistryv1.CallOpts, arg0) diff --git a/contracts/.solhint.json b/contracts/.solhint.json new file mode 100644 index 000000000..ce108eda5 --- /dev/null +++ b/contracts/.solhint.json @@ -0,0 +1,21 @@ +{ + "extends": "solhint:recommended", + "rules": { + "max-line-length": ["error", 1000], + "func-visibility": ["error", { "ignoreConstructors": true }], + "modifier-name-mixedcase": "error", + "func-param-name-mixedcase": "error", + "gas-calldata-parameters": "error", + "gas-increment-by-one": "error", + "gas-struct-packing": "error", + "no-unused-vars": "error", + "interface-starts-with-i": "error", + "reason-string": "warn", + "private-vars-leading-underscore": "warn", + "gas-length-in-loops": "warn", + "gas-strict-inequalities": "warn", + "ordering": "warn", + "gas-indexed-events": "warn", + "gas-custom-errors": "warn" + } +} diff --git a/contracts/.solhintignore b/contracts/.solhintignore new file mode 100644 index 000000000..9153096bf --- /dev/null +++ b/contracts/.solhintignore @@ -0,0 +1,3 @@ +lib/ +test/ +node_modules/ diff --git a/contracts/Makefile b/contracts/Makefile index 0d1e4139a..6f3d7c0fd 100644 --- a/contracts/Makefile +++ b/contracts/Makefile @@ -1,3 +1,10 @@ +solhint: + if !command -v solhint &>/dev/null; then \ + echo "Install solhint with 'npm install -g solhint'"; \ + exit 1; \ + fi + solhint '**/*.sol' + deploy-val-reg: forge clean forge script scripts/validator-registry/DeployValidatorRegistryV1.s.sol:DeployAnvil \ diff --git a/contracts/contracts/BlockTracker.sol b/contracts/contracts/BlockTracker.sol index 68d3908e6..25c26aa33 100644 --- a/contracts/contracts/BlockTracker.sol +++ b/contracts/contracts/BlockTracker.sol @@ -76,7 +76,7 @@ contract BlockTracker is Ownable2StepUpgradeable, UUPSUpgradeable { * @param builderAddress The Ethereum address of the builder. */ function addBuilderAddress( - string memory builderName, + string calldata builderName, address builderAddress ) external onlyOracle { blockBuilderNameToAddress[builderName] = builderAddress; diff --git a/contracts/contracts/Oracle.sol b/contracts/contracts/Oracle.sol index be43877dd..f81647096 100644 --- a/contracts/contracts/Oracle.sol +++ b/contracts/contracts/Oracle.sol @@ -6,8 +6,8 @@ import {UUPSUpgradeable} from "@openzeppelin/contracts-upgradeable/proxy/utils/U import {PreConfCommitmentStore} from "./PreConfCommitmentStore.sol"; import {IProviderRegistry} from "./interfaces/IProviderRegistry.sol"; -import {IPreConfCommitmentStore} from './interfaces/IPreConfCommitmentStore.sol'; -import {IBidderRegistry} from './interfaces/IBidderRegistry.sol'; +import {IPreConfCommitmentStore} from "./interfaces/IPreConfCommitmentStore.sol"; +import {IBidderRegistry} from "./interfaces/IBidderRegistry.sol"; import {IBlockTracker} from "./interfaces/IBlockTracker.sol"; /// @title Oracle Contract @@ -50,7 +50,7 @@ contract Oracle is Ownable2StepUpgradeable, UUPSUpgradeable { /// @dev Reference to the BlockTracker contract interface. IBlockTracker private blockTrackerContract; - function _authorizeUpgrade(address) internal override onlyOwner {} + function _authorizeUpgrade(address) internal override onlyOwner {} // solhint-disable no-empty-blocks /** * @dev Initializes the contract with a PreConfirmations contract. diff --git a/contracts/contracts/PreConfCommitmentStore.sol b/contracts/contracts/PreConfCommitmentStore.sol index 493252404..9adc059a2 100644 --- a/contracts/contracts/PreConfCommitmentStore.sol +++ b/contracts/contracts/PreConfCommitmentStore.sol @@ -503,7 +503,7 @@ contract PreConfCommitmentStore is Ownable2StepUpgradeable, UUPSUpgradeable { blockNumber ); - commitmentsCount[commiterAddress] += 1; + ++commitmentsCount[commiterAddress]; emit CommitmentStored( commitmentIndex, @@ -619,7 +619,7 @@ contract PreConfCommitmentStore is Ownable2StepUpgradeable, UUPSUpgradeable { require(!commitment.isUsed, "Commitment already used"); commitment.isUsed = true; - commitmentsCount[commitment.commiter] -= 1; + --commitmentsCount[commitment.commiter]; uint256 windowToSettle = WindowFromBlockNumber.getWindowFromBlockNumber( commitment.blockNumber, @@ -653,7 +653,7 @@ contract PreConfCommitmentStore is Ownable2StepUpgradeable, UUPSUpgradeable { ); commitment.isUsed = true; - commitmentsCount[commitment.commiter] -= 1; + --commitmentsCount[commitment.commiter]; bidderRegistry.retrieveFunds( windowToSettle, diff --git a/contracts/contracts/interfaces/IValidatorRegistryV1.sol b/contracts/contracts/interfaces/IValidatorRegistryV1.sol index a643f4e82..4fd095019 100644 --- a/contracts/contracts/interfaces/IValidatorRegistryV1.sol +++ b/contracts/contracts/interfaces/IValidatorRegistryV1.sol @@ -40,8 +40,8 @@ interface IValidatorRegistryV1 { /// @dev Struct representing a validator staked with the registry. struct StakedValidator { bool exists; - uint256 balance; address withdrawalAddress; + uint256 balance; EventHeightLib.EventHeight unstakeHeight; } diff --git a/contracts/contracts/standard-bridge/Gateway.sol b/contracts/contracts/standard-bridge/Gateway.sol index cd0746e01..67abb7183 100644 --- a/contracts/contracts/standard-bridge/Gateway.sol +++ b/contracts/contracts/standard-bridge/Gateway.sol @@ -27,7 +27,7 @@ abstract contract Gateway is Ownable2StepUpgradeable, UUPSUpgradeable { // The counterparty's finalization fee (wei), included for UX purposes uint256 public counterpartyFee; - function _authorizeUpgrade(address) internal override onlyOwner {} + function _authorizeUpgrade(address) internal override onlyOwner {} // solhint-disable no-empty-blocks function initiateTransfer(address _recipient, uint256 _amount ) external payable returns (uint256 returnIdx) { diff --git a/contracts/contracts/validator-registry/avs/MevCommitAVS.sol b/contracts/contracts/validator-registry/avs/MevCommitAVS.sol index 3d0fc9bd9..93d5cfc33 100644 --- a/contracts/contracts/validator-registry/avs/MevCommitAVS.sol +++ b/contracts/contracts/validator-registry/avs/MevCommitAVS.sol @@ -157,11 +157,11 @@ contract MevCommitAVS is IMevCommitAVS, MevCommitAVSStorage, } /// @dev Authorizes contract upgrades, restricted to contract owner. - function _authorizeUpgrade(address newImplementation) internal override onlyOwner { } + function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} // solhint-disable no-empty-blocks /// @dev Registers an operator with the MevCommitAVS. function registerOperator ( - ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature + ISignatureUtils.SignatureWithSaltAndExpiry calldata operatorSignature ) external whenNotPaused() onlyNonRegisteredOperator() onlyEigenCoreOperator() { _registerOperator(operatorSignature); } @@ -235,7 +235,7 @@ contract MevCommitAVS is IMevCommitAVS, MevCommitAVSStorage, } /// @dev Allows any account to unfreeze validators which have been frozen, for a fee. - function unfreeze(bytes[] calldata valPubKey) payable external + function unfreeze(bytes[] calldata valPubKey) external payable whenNotPaused() onlyRegisteredValidators(valPubKey) onlyFrozenValidators(valPubKey) { uint256 requiredFee = unfreezeFee * valPubKey.length; require(msg.value >= requiredFee, @@ -323,7 +323,7 @@ contract MevCommitAVS is IMevCommitAVS, MevCommitAVSStorage, } /// @dev Updates the eigenlayer metadata URI, restricted to contract owner. - function updateMetadataURI(string memory metadataURI_) external onlyOwner { + function updateMetadataURI(string calldata metadataURI_) external onlyOwner { _updateMetadataURI(metadataURI_); } @@ -501,50 +501,50 @@ contract MevCommitAVS is IMevCommitAVS, MevCommitAVSStorage, } /// @dev Internal function to set the freeze oracle account. - function _setFreezeOracle(address _freezeOracle) internal { - freezeOracle = _freezeOracle; - emit FreezeOracleSet(_freezeOracle); + function _setFreezeOracle(address freezeOracle_) internal { + freezeOracle = freezeOracle_; + emit FreezeOracleSet(freezeOracle_); } /// @dev Internal function to set the unfreeze fee. - function _setUnfreezeFee(uint256 _unfreezeFee) internal { - unfreezeFee = _unfreezeFee; - emit UnfreezeFeeSet(_unfreezeFee); + function _setUnfreezeFee(uint256 unfreezeFee_) internal { + unfreezeFee = unfreezeFee_; + emit UnfreezeFeeSet(unfreezeFee_); } /// @dev Internal function to set the unfreeze receiver. - function _setUnfreezeReceiver(address _unfreezeReceiver) internal { - unfreezeReceiver = _unfreezeReceiver; - emit UnfreezeReceiverSet(_unfreezeReceiver); + function _setUnfreezeReceiver(address unfreezeReceiver_) internal { + unfreezeReceiver = unfreezeReceiver_; + emit UnfreezeReceiverSet(unfreezeReceiver_); } /// @dev Internal function to set the unfreeze period in blocks. - function _setUnfreezePeriodBlocks(uint256 _unfreezePeriodBlocks) internal { - unfreezePeriodBlocks = _unfreezePeriodBlocks; - emit UnfreezePeriodBlocksSet(_unfreezePeriodBlocks); + function _setUnfreezePeriodBlocks(uint256 unfreezePeriodBlocks_) internal { + unfreezePeriodBlocks = unfreezePeriodBlocks_; + emit UnfreezePeriodBlocksSet(unfreezePeriodBlocks_); } /// @dev Internal function to set the operator deregistration period in blocks. - function _setOperatorDeregPeriodBlocks(uint256 _operatorDeregPeriodBlocks) internal { - operatorDeregPeriodBlocks = _operatorDeregPeriodBlocks; - emit OperatorDeregPeriodBlocksSet(_operatorDeregPeriodBlocks); + function _setOperatorDeregPeriodBlocks(uint256 operatorDeregPeriodBlocks_) internal { + operatorDeregPeriodBlocks = operatorDeregPeriodBlocks_; + emit OperatorDeregPeriodBlocksSet(operatorDeregPeriodBlocks_); } /// @dev Internal function to set the validator deregistration period in blocks. - function _setValidatorDeregPeriodBlocks(uint256 _validatorDeregPeriodBlocks) internal { - validatorDeregPeriodBlocks = _validatorDeregPeriodBlocks; - emit ValidatorDeregPeriodBlocksSet(_validatorDeregPeriodBlocks); + function _setValidatorDeregPeriodBlocks(uint256 validatorDeregPeriodBlocks_) internal { + validatorDeregPeriodBlocks = validatorDeregPeriodBlocks_; + emit ValidatorDeregPeriodBlocksSet(validatorDeregPeriodBlocks_); } /// @dev Internal function to set the LST restaker deregistration period in blocks. - function _setLstRestakerDeregPeriodBlocks(uint256 _lstRestakerDeregPeriodBlocks) internal { - lstRestakerDeregPeriodBlocks = _lstRestakerDeregPeriodBlocks; - emit LSTRestakerDeregPeriodBlocksSet(_lstRestakerDeregPeriodBlocks); + function _setLstRestakerDeregPeriodBlocks(uint256 lstRestakerDeregPeriodBlocks_) internal { + lstRestakerDeregPeriodBlocks = lstRestakerDeregPeriodBlocks_; + emit LSTRestakerDeregPeriodBlocksSet(lstRestakerDeregPeriodBlocks_); } /// @dev Internal function to update the eigenlayer metadata URI. - function _updateMetadataURI(string memory _metadataURI) internal { - _eigenAVSDirectory.updateAVSMetadataURI(_metadataURI); + function _updateMetadataURI(string memory metadataURI_) internal { + _eigenAVSDirectory.updateAVSMetadataURI(metadataURI_); } /// @dev Returns the list of restakeable strategies. diff --git a/contracts/contracts/validator-registry/avs/MevCommitAVSStorage.sol b/contracts/contracts/validator-registry/avs/MevCommitAVSStorage.sol index 9c2b4ea17..e765100e4 100644 --- a/contracts/contracts/validator-registry/avs/MevCommitAVSStorage.sol +++ b/contracts/contracts/validator-registry/avs/MevCommitAVSStorage.sol @@ -3,7 +3,6 @@ pragma solidity 0.8.20; import {IMevCommitAVS} from "../../interfaces/IMevCommitAVS.sol"; -import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import {IDelegationManager} from "eigenlayer-contracts/src/contracts/interfaces/IDelegationManager.sol"; import {IEigenPodManager} from "eigenlayer-contracts/src/contracts/interfaces/IEigenPodManager.sol"; import {IStrategyManager} from "eigenlayer-contracts/src/contracts/interfaces/IStrategyManager.sol"; diff --git a/contracts/scripts/DeployScripts.s.sol b/contracts/scripts/DeployScripts.s.sol index ffeb7d46a..d3c498804 100644 --- a/contracts/scripts/DeployScripts.s.sol +++ b/contracts/scripts/DeployScripts.s.sol @@ -1,13 +1,19 @@ // SPDX-License-Identifier: BSL 1.1 + +// solhint-disable no-console +// solhint-disable one-contract-per-file + pragma solidity 0.8.20; -import "forge-std/Script.sol"; -import "../contracts/BidderRegistry.sol"; -import "../contracts/ProviderRegistry.sol"; -import "../contracts/PreConfCommitmentStore.sol"; -import "../contracts/Oracle.sol"; -import "../contracts/Whitelist.sol"; + +import {Script} from "forge-std/Script.sol"; +import {BidderRegistry} from "../contracts/BidderRegistry.sol"; +import {ProviderRegistry} from "../contracts/ProviderRegistry.sol"; +import {PreConfCommitmentStore} from "../contracts/PreConfCommitmentStore.sol"; +import {Oracle} from "../contracts/Oracle.sol"; +import {Whitelist} from "../contracts/Whitelist.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; -import "../contracts/BlockTracker.sol"; +import {BlockTracker} from "../contracts/BlockTracker.sol"; +import {console} from "forge-std/console.sol"; // Deploys core contracts contract DeployScript is Script { @@ -90,7 +96,7 @@ contract DeployWhitelist is Script { address hypERC20Addr = vm.envAddress("HYP_ERC20_ADDR"); require( hypERC20Addr != address(0), - "Address to whitelist not provided" + "hypERC20 addr not provided" ); address whitelistProxy = Upgrades.deployUUPSProxy( diff --git a/contracts/scripts/DeployStandardBridge.s.sol b/contracts/scripts/DeployStandardBridge.s.sol index 5cbff6668..4cc647ae2 100644 --- a/contracts/scripts/DeployStandardBridge.s.sol +++ b/contracts/scripts/DeployStandardBridge.s.sol @@ -1,11 +1,17 @@ // SPDX-License-Identifier: BSL 1.1 + +// solhint-disable no-console +// solhint-disable one-contract-per-file + pragma solidity 0.8.20; -import "forge-std/Script.sol"; + +import {Script} from "forge-std/Script.sol"; import {SettlementGateway} from "../contracts/standard-bridge/SettlementGateway.sol"; import {L1Gateway} from "../contracts/standard-bridge/L1Gateway.sol"; import {Whitelist} from "../contracts/Whitelist.sol"; import {Strings} from "@openzeppelin/contracts/utils/Strings.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; +import {console} from "forge-std/console.sol"; contract DeploySettlementGateway is Script { function run() external { @@ -39,11 +45,11 @@ contract DeploySettlementGateway is Script { console.log("Settlement gateway has been whitelisted. Gateway contract address:", address(gateway)); string memory jsonOutput = string.concat( - '{"settlement_gateway_addr": "', + "{'settlement_gateway_addr': '", Strings.toHexString(address(gateway)), - '", "whitelist_addr": "', + "', 'whitelist_addr': '", Strings.toHexString(address(whitelist)), - '"}' + "'}" ); console.log("JSON_DEPLOY_ARTIFACT:", jsonOutput); @@ -70,9 +76,9 @@ contract DeployL1Gateway is Script { address(gateway)); string memory jsonOutput = string.concat( - '{"l1_gateway_addr": "', + "{'l1_gateway_addr': '", Strings.toHexString(address(gateway)), - '"}' + "'}" ); console.log("JSON_DEPLOY_ARTIFACT:", jsonOutput); diff --git a/contracts/scripts/validator-registry/DeployValidatorRegistryV1.s.sol b/contracts/scripts/validator-registry/DeployValidatorRegistryV1.s.sol index 0738e7e2d..f9f54519a 100644 --- a/contracts/scripts/validator-registry/DeployValidatorRegistryV1.s.sol +++ b/contracts/scripts/validator-registry/DeployValidatorRegistryV1.s.sol @@ -1,9 +1,14 @@ // SPDX-License-Identifier: BSL 1.1 + +// solhint-disable no-console +// solhint-disable one-contract-per-file + pragma solidity 0.8.20; -import "forge-std/Script.sol"; +import {Script} from "forge-std/Script.sol"; import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; import {ValidatorRegistryV1} from "../../contracts/validator-registry/ValidatorRegistryV1.sol"; +import {console} from "forge-std/console.sol"; contract BaseDeploy is Script { function deployValidatorRegistry( @@ -13,7 +18,7 @@ contract BaseDeploy is Script { address slashReceiver, uint256 unstakePeriodBlocks, address owner - ) internal returns (address) { + ) public returns (address) { console.log("Deploying ValidatorRegistryV1 on chain:", block.chainid); address proxy = Upgrades.deployUUPSProxy( "ValidatorRegistryV1.sol", @@ -30,11 +35,11 @@ contract BaseDeploy is Script { } contract DeployHolesky is BaseDeploy { - uint256 constant MIN_STAKE = 0.0001 ether; // 10k vals = 1 ETH cost - uint256 constant SLASH_AMOUNT = 0.00003 ether; - address constant SLASH_ORACLE = 0x4535bd6fF24860b5fd2889857651a85fb3d3C6b1; - address constant SLASH_RECEIVER = 0x4535bd6fF24860b5fd2889857651a85fb3d3C6b1; - uint256 constant UNSTAKE_PERIOD_BLOCKS = 32 * 3; // 2 epoch finalization time + settlement buffer + uint256 constant public MIN_STAKE = 0.0001 ether; // 10k vals = 1 ETH cost + uint256 constant public SLASH_AMOUNT = 0.00003 ether; + address constant public SLASH_ORACLE = 0x4535bd6fF24860b5fd2889857651a85fb3d3C6b1; + address constant public SLASH_RECEIVER = 0x4535bd6fF24860b5fd2889857651a85fb3d3C6b1; + uint256 constant public UNSTAKE_PERIOD_BLOCKS = 32 * 3; // 2 epoch finalization time + settlement buffer function run() external { require(block.chainid == 17000, "must deploy on Holesky"); @@ -46,11 +51,11 @@ contract DeployHolesky is BaseDeploy { } contract DeployAnvil is BaseDeploy { - uint256 constant MIN_STAKE = 3 ether; - uint256 constant SLASH_AMOUNT = 1 ether; - address constant SLASH_ORACLE = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8; - address constant SLASH_RECEIVER = 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC; - uint256 constant UNSTAKE_PERIOD_BLOCKS = 100; + uint256 constant public MIN_STAKE = 3 ether; + uint256 constant public SLASH_AMOUNT = 1 ether; + address constant public SLASH_ORACLE = 0x70997970C51812dc3A010C7d01b50e0d17dc79C8; + address constant public SLASH_RECEIVER = 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC; + uint256 constant public UNSTAKE_PERIOD_BLOCKS = 100; function run() external { require(block.chainid == 31337, "must deploy on anvil"); diff --git a/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol b/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol index b7c85aaae..ad4c9ee54 100644 --- a/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol +++ b/contracts/scripts/validator-registry/ValidatorExampleScript.s.sol @@ -1,9 +1,13 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.20; +// SPDX-License-Identifier: BSL 1.1 -import "forge-std/Script.sol"; -import "forge-std/console.sol"; -import "../../contracts/validator-registry/ValidatorRegistryV1.sol"; +// solhint-disable no-console +// solhint-disable one-contract-per-file + +pragma solidity 0.8.20; + +import {Script} from "forge-std/Script.sol"; +import {console} from "forge-std/console.sol"; +import {ValidatorRegistryV1} from "../../contracts/validator-registry/ValidatorRegistryV1.sol"; import {IValidatorRegistryV1} from "../../contracts/interfaces/IValidatorRegistryV1.sol"; // Script to e2e test the ValidatorRegistryV1 contract with anvil, also see makefile. @@ -34,7 +38,7 @@ abstract contract ExampleScript is Script { console.log("Checking Staking related state..."); console.log("--------------------"); - for (uint i = 0; i < blsKeys.length; ++i) { + for (uint256 i = 0; i < blsKeys.length; ++i) { bool isStaked = _validatorRegistry.isValidatorOptedIn(blsKeys[i]); console.log("--------------------"); console.log("BLS Key: "); @@ -54,7 +58,7 @@ abstract contract ExampleScript is Script { console.log("--------------------"); console.log("Checking Withdrawal related state..."); console.log("--------------------"); - for (uint i = 0; i < blsKeys.length; ++i) { + for (uint256 i = 0; i < blsKeys.length; ++i) { uint256 blocksTillWithdrawAllowed = _validatorRegistry.getBlocksTillWithdrawAllowed(blsKeys[i]); console.log("--------------------"); console.log("BLS Key: "); @@ -70,7 +74,7 @@ contract StakeExample is ExampleScript { function run() external { vm.startBroadcast(); - require(msg.sender == defaultEOA, "must be 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"); + require(msg.sender == defaultEOA, "sender must be default EOA"); console.log("Balance of 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb922266:", defaultEOA.balance); bytes[] memory validators = new bytes[](3); @@ -100,8 +104,8 @@ contract UnstakeExample is ExampleScript { function run() external { vm.startBroadcast(); - require(msg.sender == defaultEOA, "must be 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"); - console.log("Balance of 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266:", defaultEOA.balance); + require(msg.sender == defaultEOA, "sender must be default EOA"); + console.log("Balance of 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb922266:", defaultEOA.balance); bytes[] memory validators = new bytes[](3); validators[0] = hex"a97794deb52ea4529d37d283213ca7e298ea9be0a2fec1bb3134a1464ab8cf9eb2c703d1b42dd68d97b5f1c8e74cc0df"; @@ -128,7 +132,7 @@ contract WithdrawExample is ExampleScript { function run() external { vm.startBroadcast(); - require(msg.sender == defaultEOA, "must be 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266"); + require(msg.sender == defaultEOA, "sender must be default EOA"); console.log("Balance of 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266:", defaultEOA.balance); bytes[] memory validators = new bytes[](3); @@ -155,7 +159,7 @@ contract SlashExample is ExampleScript { function run() external { vm.startBroadcast(); - require(msg.sender == defaultEOA2, "slash oracle must be 0x70997970C51812dc3A010C7d01b50e0d17dc79C8"); + require(msg.sender == defaultEOA2, "slash oracle must be defaultEOA2"); console.log("Balance of slash oracle @ 0x70997970C51812dc3A010C7d01b50e0d17dc79C8:", defaultEOA2.balance); bytes[] memory validators = new bytes[](3); diff --git a/contracts/scripts/validator-registry/avs/ReleaseAddrConsts.sol b/contracts/scripts/validator-registry/avs/ReleaseAddrConsts.sol index 23ff0c0e0..9d1207de9 100644 --- a/contracts/scripts/validator-registry/avs/ReleaseAddrConsts.sol +++ b/contracts/scripts/validator-registry/avs/ReleaseAddrConsts.sol @@ -1,5 +1,9 @@ -// SPDX-License-Identifier: MIT -pragma solidity ^0.8.0; +// SPDX-License-Identifier: BSL 1.1 + +// solhint-disable no-console +// solhint-disable one-contract-per-file + +pragma solidity 0.8.20; // TODO: Confirm every addr here with the markdown diff --git a/contracts/test/PreConfirmationConfTest.sol b/contracts/test/PreConfirmationConfTest.sol index 80e839476..c1beedc43 100644 --- a/contracts/test/PreConfirmationConfTest.sol +++ b/contracts/test/PreConfirmationConfTest.sol @@ -7,7 +7,7 @@ import {PreConfCommitmentStore} from "../contracts/PreConfCommitmentStore.sol"; import "../contracts/ProviderRegistry.sol"; import "../contracts/BidderRegistry.sol"; import "../contracts/BlockTracker.sol"; -import "forge-std/console.sol"; + import {Upgrades} from "openzeppelin-foundry-upgrades/Upgrades.sol"; import {WindowFromBlockNumber} from "../contracts/utils/WindowFromBlockNumber.sol";