Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions cmd/depositverify.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var (
depositVerifyValidatorPubKey string
depositVerifyDepositAmount string
depositVerifyForkVersion string
depositVerifyCompounding bool
)

var depositVerifyCmd = &cobra.Command{
Expand Down Expand Up @@ -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"))
Expand All @@ -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))
Expand Down Expand Up @@ -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)")
}
1 change: 1 addition & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down