-
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
May 30, 2023
1 parent
1e7c7d2
commit 9a2ad56
Showing
6 changed files
with
253 additions
and
166 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use std::evm | ||
use std::spec | ||
|
||
// #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_255(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) | ||
// ) | ||
// } | ||
|
||
// #invariant | ||
// fn shl_byte(a: u256) { | ||
// spec::given_lte(a, 255) | ||
|
||
// let shl_a: u256 = evm::shl(bits: 248, value: a) | ||
// spec::assert_eq( | ||
// a, | ||
// evm::byte(offset: 0, value: shl_a) | ||
// ) | ||
// } | ||
|
||
const FREE_MEM_PTR: u256 = 4096 | ||
|
||
#invariant | ||
unsafe fn read_byte(a: u8) { | ||
// evm::mstore8(offset: FREE_MEM_PTR, value: a) | ||
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)) | ||
) | ||
} |
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.