mirror of
https://github.com/logos-storage/logos-storage-contracts-eth.git
synced 2026-01-11 01:33:08 +00:00
add encoding and calculation mutations
This commit is contained in:
parent
d2ca1ae5b1
commit
a3992bc0c0
13
certora/mutations/017_accountId_encoding_corruption.patch
Normal file
13
certora/mutations/017_accountId_encoding_corruption.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/contracts/vault/Accounts.sol b/contracts/vault/Accounts.sol
|
||||
index 3066e7d..ae138ae 100644
|
||||
--- a/contracts/vault/Accounts.sol
|
||||
+++ b/contracts/vault/Accounts.sol
|
||||
@@ -50,7 +50,7 @@ library Accounts {
|
||||
) internal pure returns (AccountId) {
|
||||
bytes32 left = bytes32(bytes20(holder));
|
||||
bytes32 right = bytes32(uint256(uint96(discriminator)));
|
||||
- return AccountId.wrap(left | right);
|
||||
+ return AccountId.wrap(left & right);
|
||||
}
|
||||
|
||||
/// Extracts the account holder and the discriminator from the the account id
|
||||
@ -0,0 +1,12 @@
|
||||
diff --git a/contracts/Timestamps.sol b/contracts/Timestamps.sol
|
||||
index 945eced..3132942 100644
|
||||
--- a/contracts/Timestamps.sol
|
||||
+++ b/contracts/Timestamps.sol
|
||||
@@ -65,6 +65,6 @@ library Timestamps {
|
||||
Timestamp start,
|
||||
Timestamp end
|
||||
) internal pure returns (Duration) {
|
||||
- return Duration.wrap(Timestamp.unwrap(end) - Timestamp.unwrap(start));
|
||||
+ return Duration.wrap(Timestamp.unwrap(start) - Timestamp.unwrap(end));
|
||||
}
|
||||
}
|
||||
13
certora/mutations/019_period_calculation_round_up.patch
Normal file
13
certora/mutations/019_period_calculation_round_up.patch
Normal file
@ -0,0 +1,13 @@
|
||||
diff --git a/contracts/Periods.sol b/contracts/Periods.sol
|
||||
index 189fb02..a54c439 100644
|
||||
--- a/contracts/Periods.sol
|
||||
+++ b/contracts/Periods.sol
|
||||
@@ -20,7 +20,7 @@ contract Periods {
|
||||
function _periodOf(Timestamp timestamp) internal view returns (Period) {
|
||||
return
|
||||
Period.wrap(
|
||||
- Timestamp.unwrap(timestamp) / Duration.unwrap(_secondsPerPeriod)
|
||||
+ (Timestamp.unwrap(timestamp) + Duration.unwrap(_secondsPerPeriod) - 1) / Duration.unwrap(_secondsPerPeriod)
|
||||
);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user