add encoding and calculation mutations

This commit is contained in:
zanderbyte-certora 2025-07-30 11:52:01 +03:00
parent d2ca1ae5b1
commit a3992bc0c0
3 changed files with 38 additions and 0 deletions

View 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

View File

@ -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));
}
}

View 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)
);
}