Skip to content

Commit c632f75

Browse files
committed
fix: fixed oracle price overflow assertion with new error
1 parent 79085d9 commit c632f75

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

.secrets.baseline

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
"filename": "aave-core/aave-config/sources/error_config.move",
134134
"hashed_secret": "ba29d6bfac4cd7b866a3d05103c38031a921ba88",
135135
"is_verified": false,
136-
"line_number": 1160
136+
"line_number": 1168
137137
}
138138
],
139139
"aave-core/aave-config/tests/error_tests.move": [
@@ -11151,5 +11151,5 @@
1115111151
}
1115211152
]
1115311153
},
11154-
"generated_at": "2025-08-22T08:39:13Z"
11154+
"generated_at": "2025-09-15T09:59:27Z"
1115511155
}

aave-core/aave-config/sources/error_config.move

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ module aave_config::error_config {
257257
const EINVALID_SNAPSHOT_TIMESTAMP: u64 = 1228;
258258
/// The assigned custom price is above the price cap
259259
const ECUSTOM_PRICE_ABOVE_PRICE_CAP: u64 = 1229;
260+
/// The oracle price computation causes an overflow
261+
const EORACLE_PRICE_OVERFLOW: u64 = 1230;
260262

261263
// aave_rate module error code range from 1301 to 1400.
262264
/// @notice Account is not the rate's owner
@@ -867,6 +869,12 @@ module aave_config::error_config {
867869
ECUSTOM_PRICE_ABOVE_PRICE_CAP
868870
}
869871

872+
/// @notice Returns the error code for oracle price overflow
873+
/// @return Error code as u64
874+
public fun get_eoracle_price_overflow(): u64 {
875+
EORACLE_PRICE_OVERFLOW
876+
}
877+
870878
/// @notice Returns the error code for invalid optimal usage ratio
871879
/// @return Error code as u64
872880
public fun get_einvalid_optimal_usage_ratio(): u64 {

aave-core/aave-config/tests/error_tests.move

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ module aave_config::error_tests {
170170
get_einvalid_snapshot_delay,
171171
get_einvalid_snapshot_ratio,
172172
get_einvalid_snapshot_timestamp,
173-
get_ecustom_price_above_price_cap
173+
get_ecustom_price_above_price_cap,
174+
get_eoracle_price_overflow
174175
};
175176

176177
const TEST_SUCCESS: u64 = 1;
@@ -441,6 +442,8 @@ module aave_config::error_tests {
441442
const EINVALID_SNAPSHOT_TIMESTAMP: u64 = 1228;
442443
/// The assigned custom price is above the price cap
443444
const ECUSTOM_PRICE_ABOVE_PRICE_CAP: u64 = 1229;
445+
/// The oracle price computation causes an overflow
446+
const EORACLE_PRICE_OVERFLOW: u64 = 1230;
444447

445448
// aave_rate module error code range from 1301 to 1400.
446449

@@ -1325,6 +1328,14 @@ module aave_config::error_tests {
13251328
);
13261329
}
13271330

1331+
#[test]
1332+
public fun test_eoracle_price_overflow() {
1333+
assert!(
1334+
get_eoracle_price_overflow() == EORACLE_PRICE_OVERFLOW,
1335+
TEST_SUCCESS
1336+
);
1337+
}
1338+
13281339
#[test]
13291340
public fun test_get_einvalid_ratio_timestamp() {
13301341
assert!(get_einvalid_ratio_timestamp() == EINVALID_RATIO_TIMESTAMP, TEST_SUCCESS);

aave-core/aave-oracle/sources/oracle.move

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -863,7 +863,7 @@ module aave_oracle::oracle {
863863
fun validate_oracle_price(price: u256) {
864864
assert!(
865865
price <= I192_MAX,
866-
error_config::get_enegative_oracle_price()
866+
error_config::get_eoracle_price_overflow()
867867
);
868868
assert!(
869869
price > 0,

0 commit comments

Comments
 (0)