diff --git a/cmd/depositverify.go b/cmd/depositverify.go index 7637c07..11125c2 100644 --- a/cmd/depositverify.go +++ b/cmd/depositverify.go @@ -38,6 +38,7 @@ var ( depositVerifyValidatorPubKey string depositVerifyDepositAmount string depositVerifyForkVersion string + depositVerifyCompounding bool ) var depositVerifyCmd = &cobra.Command{ @@ -83,6 +84,9 @@ In quiet mode this will return 0 if the data is verified correctly, otherwise 1. } } + assert(!depositVerifyCompounding || depositVerifyWithdrawalPubKey == "", "--compounding cannot be used with --withdrawalpubkey") + assert(!depositVerifyCompounding || depositVerifyWithdrawalAddress != "", "--compounding requires --withdrawaladdress") + var withdrawalCredentials []byte if depositVerifyWithdrawalPubKey != "" { withdrawalPubKeyBytes, err := hex.DecodeString(strings.TrimPrefix(depositVerifyWithdrawalPubKey, "0x")) @@ -98,6 +102,9 @@ In quiet mode this will return 0 if the data is verified correctly, otherwise 1. assert(len(withdrawalAddressBytes) == 20, "address should be 20 bytes") withdrawalCredentials = make([]byte, 32) withdrawalCredentials[0] = 0x01 // ETH1_ADDRESS_WITHDRAWAL_PREFIX + if depositVerifyCompounding { + withdrawalCredentials[0] = 0x02 // COMPOUNDING_WITHDRAWAL_PREFIX + } copy(withdrawalCredentials[12:], withdrawalAddressBytes) } outputIf(viper.GetBool("debug"), fmt.Sprintf("Withdrawal credentials are %#x", withdrawalCredentials)) @@ -337,4 +344,5 @@ func init() { depositVerifyCmd.Flags().StringVar(&depositVerifyDepositAmount, "depositvalue", "32 Ether", "Value of the amount to be deposited") depositVerifyCmd.Flags().StringVar(&depositVerifyValidatorPubKey, "validatorpubkey", "", "Public key(s) of the account(s) that will be carrying out validation") depositVerifyCmd.Flags().StringVar(&depositVerifyForkVersion, "forkversion", "0x00000000", "Fork version of the chain of the deposit") + depositVerifyCmd.Flags().BoolVar(&depositVerifyCompounding, "compounding", false, "Verify compounding (0x02) withdrawal credentials (requires --withdrawaladdress)") } diff --git a/docs/usage.md b/docs/usage.md index 546cbb5..979eb3a 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -501,6 +501,7 @@ Deposit commands focus on information about deposit data information in a JSON f - `data`: either a path to the JSON file, the JSON itself, or a hex string representing a deposit transaction - `withdrawalpubkey`: the public key of the withdrawal for the deposit. If no value is supplied then withdrawal credentials for deposits will not be checked +- `compounding`: verify compounding (`0x02`) withdrawal credentials instead of `0x01`. Requires `withdrawaladdress` and cannot be combined with `withdrawalpubkey` - `validatorpubkey`: the public key of the validator for the deposit. If no value is supplied then validator public keys will not be checked - `depositvalue`: the value of the Ether being deposited. If no value is supplied then deposit values will not be checked.