mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-02-26 09:15:17 +00:00
Added efficiency improvement (two fewer expected SSTOREs per deposit)
This commit is contained in:
parent
722e201109
commit
c8b2755177
@ -653,7 +653,7 @@ DEPOSIT_CONTRACT_TREE_DEPTH: constant(uint256) = 32
|
|||||||
TWO_TO_POWER_OF_TREE_DEPTH: constant(uint256) = 4294967296 # 2**32
|
TWO_TO_POWER_OF_TREE_DEPTH: constant(uint256) = 4294967296 # 2**32
|
||||||
SECONDS_PER_DAY: constant(uint256) = 86400
|
SECONDS_PER_DAY: constant(uint256) = 86400
|
||||||
|
|
||||||
Deposit: event({previous_deposit_root: bytes32, data: bytes[2064], merkle_tree_index: bytes[8]})
|
Deposit: event({previous_deposit_root: bytes32, data: bytes[2064], merkle_tree_index: bytes[8], branch: bytes32[32]})
|
||||||
ChainStart: event({deposit_root: bytes32, time: bytes[8]})
|
ChainStart: event({deposit_root: bytes32, time: bytes[8]})
|
||||||
|
|
||||||
zerohashes: bytes32[32]
|
zerohashes: bytes32[32]
|
||||||
@ -676,7 +676,7 @@ def get_deposit_root() -> bytes32:
|
|||||||
if size % 2 == 1:
|
if size % 2 == 1:
|
||||||
root = sha3(concat(self.branch[h], root))
|
root = sha3(concat(self.branch[h], root))
|
||||||
else:
|
else:
|
||||||
root = sha3(concat(root, self.branch[h]))
|
root = sha3(concat(root, self.zerohashes[h]))
|
||||||
size /= 2
|
size /= 2
|
||||||
return root
|
return root
|
||||||
|
|
||||||
@ -704,12 +704,11 @@ def deposit(deposit_input: bytes[2048]):
|
|||||||
for j in range(32):
|
for j in range(32):
|
||||||
if j < i:
|
if j < i:
|
||||||
value = sha3(concat(self.branch[j], value))
|
value = sha3(concat(self.branch[j], value))
|
||||||
self.branch[j] = self.zerohashes[j]
|
|
||||||
self.branch[i] = value
|
self.branch[i] = value
|
||||||
|
|
||||||
self.deposit_count += 1
|
self.deposit_count += 1
|
||||||
|
|
||||||
log.Deposit(self.get_deposit_root(), deposit_data, merkle_tree_index)
|
log.Deposit(self.get_deposit_root(), deposit_data, merkle_tree_index, self.branch)
|
||||||
|
|
||||||
if msg.value == as_wei_value(MAX_DEPOSIT_AMOUNT, "gwei"):
|
if msg.value == as_wei_value(MAX_DEPOSIT_AMOUNT, "gwei"):
|
||||||
self.full_deposit_count += 1
|
self.full_deposit_count += 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user