vyper-smart-contracts icon indicating copy to clipboard operation
vyper-smart-contracts copied to clipboard

Use commit reveal schema for LOP-bounty

Open ssteiger opened this issue 6 years ago • 0 comments

Problem: https://twitter.com/PhABCD/status/1129987674213945344

Solution: Implement a commit reveal schema:

def submitSolution(_solutionHash: bytes32) -> uint256:
   self.submittedSolutions[msg.sender] = _solutionHash

def revealSolution(_x1: unit256, _x2: uint256, _salt: string[16]) -> uint256:
    assert self.submittedSolutions[msg.sender] == keccak(_x1 + _x2 + _salt)
    newSolution: uint256
    newSolution = self._calculateNewSolution(_x1, _x2)
    if self.currentBestSolution < newSolution:
         self.self.currentBestSolution = newSolution
         self.addressOfWinner = msg.sender

ssteiger avatar May 21 '19 12:05 ssteiger