Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save dangerousfood/4086c2e0e9227c66ee1003d62b8910d4 to your computer and use it in GitHub Desktop.
Save dangerousfood/4086c2e0e9227c66ee1003d62b8910d4 to your computer and use it in GitHub Desktop.
@public
@constant
def get_deposit_root() -> bytes32:
root: bytes32 = 0x0000000000000000000000000000000000000000000000000000000000000000
size: uint256 = self.deposit_count
for h in range(DEPOSIT_CONTRACT_TREE_DEPTH):
if bitwise_and(size, 1) == 1:
root = sha3(concat(self.branch[h], root))
else:
root = sha3(concat(root, self.zerohashes[h]))
size /= 2
return root
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment