-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol): enhance ZKP handling & change proofs order (#288)
- Loading branch information
Showing
11 changed files
with
176 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// SPDX-License-Identifier: MIT | ||
// | ||
// ╭━━━━╮╱╱╭╮╱╱╱╱╱╭╮╱╱╱╱╱╭╮ | ||
// ┃╭╮╭╮┃╱╱┃┃╱╱╱╱╱┃┃╱╱╱╱╱┃┃ | ||
// ╰╯┃┃┣┻━┳┫┃╭┳━━╮┃┃╱╱╭━━┫╰━┳━━╮ | ||
// ╱╱┃┃┃╭╮┣┫╰╯┫╭╮┃┃┃╱╭┫╭╮┃╭╮┃━━┫ | ||
// ╱╱┃┃┃╭╮┃┃╭╮┫╰╯┃┃╰━╯┃╭╮┃╰╯┣━━┃ | ||
// ╱╱╰╯╰╯╰┻┻╯╰┻━━╯╰━━━┻╯╰┻━━┻━━╯ | ||
pragma solidity ^0.8.9; | ||
|
||
import "@openzeppelin/contracts-upgradeable/utils/math/SafeCastUpgradeable.sol"; | ||
|
||
import "../../libs/LibMath.sol"; | ||
import "../LibData.sol"; | ||
|
||
/// @author dantaik <dan@taiko.xyz> | ||
library V1Utils { | ||
uint64 public constant MASK_HALT = 1 << 0; | ||
|
||
event Halted(bool halted); | ||
|
||
function halt(LibData.State storage s, bool toHalt) public { | ||
require(isHalted(s) != toHalt, "L1:precondition"); | ||
setBit(s, MASK_HALT, toHalt); | ||
emit Halted(toHalt); | ||
} | ||
|
||
function isHalted(LibData.State storage s) public view returns (bool) { | ||
return isBitOne(s, MASK_HALT); | ||
} | ||
|
||
function setBit(LibData.State storage s, uint64 mask, bool one) private { | ||
s.statusBits = one ? s.statusBits | mask : s.statusBits & ~mask; | ||
} | ||
|
||
function isBitOne( | ||
LibData.State storage s, | ||
uint64 mask | ||
) private view returns (bool) { | ||
return s.statusBits & mask != 0; | ||
} | ||
} |
Oops, something went wrong.