Reduce on-chain computation
This commit is contained in:
parent
92b9253ecb
commit
130e45ee39
|
@ -608,6 +608,7 @@ MAX_DEPOSIT: constant(uint256) = 32 # ETH
|
|||
GWEI_PER_ETH: constant(uint256) = 1000000000 # 10**9
|
||||
CHAIN_START_FULL_DEPOSIT_THRESHOLD: constant(uint256) = 16384 # 2**14
|
||||
DEPOSIT_CONTRACT_TREE_DEPTH: constant(uint256) = 32
|
||||
TWO_TO_POWER_OF_TREE_DEPTH: constant(uint256) = 4294967296 # 2**32
|
||||
SECONDS_PER_DAY: constant(uint256) = 86400
|
||||
|
||||
Eth1Deposit: event({previous_receipt_root: bytes32, data: bytes[2064], deposit_count: uint256})
|
||||
|
@ -623,7 +624,7 @@ def deposit(deposit_parameters: bytes[2048]):
|
|||
assert msg.value >= as_wei_value(MIN_DEPOSIT, "ether")
|
||||
assert msg.value <= as_wei_value(MAX_DEPOSIT, "ether")
|
||||
|
||||
index: uint256 = self.deposit_count + 2**DEPOSIT_CONTRACT_TREE_DEPTH
|
||||
index: uint256 = self.deposit_count + TWO_TO_POWER_OF_TREE_DEPTH
|
||||
msg_gwei_bytes8: bytes[8] = slice(concat("", convert(msg.value / GWEI_PER_ETH, bytes32)), start=24, len=8)
|
||||
timestamp_bytes8: bytes[8] = slice(concat("", convert(block.timestamp, bytes32)), start=24, len=8)
|
||||
deposit_data: bytes[2064] = concat(msg_gwei_bytes8, timestamp_bytes8, deposit_parameters)
|
||||
|
|
Loading…
Reference in New Issue