-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Grant Wuerker
committed
Jun 16, 2023
1 parent
797586f
commit c179559
Showing
54 changed files
with
3,458 additions
and
47 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,63 @@ | ||
use std::spec | ||
use std::evm | ||
|
||
#invariant | ||
fn de_morgan_true(a: bool, b: bool) { | ||
spec::given_true(a and b) | ||
spec::assert_true(not ((not a) or (not b))) | ||
} | ||
|
||
#invariant | ||
fn de_morgan_false(a: bool, b: bool) { | ||
spec::given_false(a and b) | ||
spec::assert_false(not ((not a) or (not b))) | ||
} | ||
|
||
#invariant | ||
fn shl_shr_248(a: u256) { | ||
spec::given_lte(a, 255) | ||
|
||
let shl_a: u256 = evm::shl(bits: 248, value: a) | ||
spec::assert_eq( | ||
a, | ||
evm::shr(bits: 248, value: shl_a) | ||
) | ||
} | ||
|
||
#invariant | ||
fn shl_shr_n(a: u256, n: u256) { | ||
spec::given_lte(a, 255) | ||
spec::given_lte(n, 248) | ||
|
||
let shl_a: u256 = evm::shl(bits: n, value: a) | ||
spec::assert_eq( | ||
a, | ||
evm::shr(bits: n, value: shl_a) | ||
) | ||
} | ||
|
||
const FREE_MEM_PTR: u256 = 4096 | ||
|
||
#invariant | ||
unsafe fn read_byte_shl_248(a: u8) { | ||
evm::mstore( | ||
offset: FREE_MEM_PTR, | ||
value: evm::shl(bits: 248, value: a) | ||
) | ||
|
||
spec::assert_eq( | ||
a, | ||
evm::shr(bits: 248, value: evm::mload(offset: FREE_MEM_PTR)) | ||
) | ||
} | ||
|
||
// #invariant | ||
// incomplete | ||
// unsafe fn read_byte_mstore8(a: u8) { | ||
// evm::mstore8(offset: FREE_MEM_PTR, value: a) | ||
|
||
// spec::assert_eq( | ||
// a, | ||
// evm::shr(bits: 248, value: evm::mload(offset: FREE_MEM_PTR)) | ||
// ) | ||
// } |
Oops, something went wrong.