mirror of
https://gitlab.com/pulsechaincom/staking-deposit-cli.git
synced 2024-12-22 19:50:34 +00:00
Verify deposit_data.json amounts within [1, 32] ETH
This commit is contained in:
parent
b9975f2fed
commit
5e3300d387
@ -4,6 +4,7 @@ import json
|
||||
from typing import Dict, List
|
||||
from py_ecc.bls import G2ProofOfPossession as bls
|
||||
|
||||
from eth2deposit.exceptions import ValidationError
|
||||
from eth2deposit.key_handling.key_derivation.path import mnemonic_and_path_to_key
|
||||
from eth2deposit.key_handling.keystore import (
|
||||
Keystore,
|
||||
@ -11,6 +12,8 @@ from eth2deposit.key_handling.keystore import (
|
||||
)
|
||||
from eth2deposit.utils.constants import (
|
||||
BLS_WITHDRAWAL_PREFIX,
|
||||
ETH2GWEI,
|
||||
MAX_DEPOSIT_AMOUNT,
|
||||
)
|
||||
from eth2deposit.utils.crypto import SHA256
|
||||
from eth2deposit.utils.ssz import (
|
||||
@ -57,6 +60,8 @@ class Credential:
|
||||
|
||||
@property
|
||||
def deposit_message(self) -> DepositMessage:
|
||||
if self.amount > MAX_DEPOSIT_AMOUNT:
|
||||
raise ValidationError(f"{self.amount / ETH2GWEI} ETH is more than the maximum allowed deposit.")
|
||||
return DepositMessage(
|
||||
pubkey=self.signing_pk,
|
||||
withdrawal_credentials=self.withdrawal_credentials,
|
||||
|
@ -7,8 +7,9 @@ ZERO_BYTES32 = b'\x00' * 32
|
||||
DOMAIN_DEPOSIT = bytes.fromhex('03000000')
|
||||
BLS_WITHDRAWAL_PREFIX = bytes.fromhex('00')
|
||||
|
||||
MIN_DEPOSIT_AMOUNT = 2 ** 0 * 10 ** 9
|
||||
MAX_DEPOSIT_AMOUNT = 2 ** 5 * 10 ** 9
|
||||
ETH2GWEI = 10 ** 9
|
||||
MIN_DEPOSIT_AMOUNT = 2 ** 0 * ETH2GWEI
|
||||
MAX_DEPOSIT_AMOUNT = 2 ** 5 * ETH2GWEI
|
||||
|
||||
|
||||
# File/folder constants
|
||||
|
Loading…
Reference in New Issue
Block a user