Skip to content

Commit e9a60a4

Browse files
committed
Merge branch 'main' into feat/mpsc0x/gho-res-depl
2 parents b54f1a1 + 9b1e7d5 commit e9a60a4

22 files changed

+225
-745
lines changed

.github/actions/install-aptos-cli/action.yml

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,40 +12,52 @@ runs:
1212
steps:
1313
- name: Install Aptos CLI
1414
shell: bash
15+
env:
16+
VERSION: ${{ inputs.version }}
1517
run: |-
16-
VERSION=${{ inputs.version }}
17-
ARCH=$(uname -m)
18-
OS=$(uname -s)
18+
set -Eeuo pipefail
1919
20-
# Determine correct file name based on architecture and OS
20+
ARCH="$(uname -m)"
21+
OS="$(uname -s)"
22+
23+
# Resolve archive name
2124
if [[ "$OS" == "Linux" ]]; then
2225
if [[ "$ARCH" == "x86_64" ]]; then
2326
FILENAME="aptos-cli-${VERSION}-Linux-x86_64.zip"
2427
elif [[ "$ARCH" == "aarch64" ]]; then
2528
FILENAME="aptos-cli-${VERSION}-Linux-aarch64.zip"
2629
else
27-
echo "Unsupported Linux architecture: $ARCH"
28-
exit 1
30+
echo "Unsupported Linux architecture: $ARCH" >&2; exit 1
2931
fi
3032
elif [[ "$OS" == "Darwin" ]]; then
3133
FILENAME="aptos-cli-${VERSION}-MacOS-x86_64.zip"
3234
elif [[ "$OS" == "Windows_NT" ]]; then
3335
FILENAME="aptos-cli-${VERSION}-Windows-x86_64.zip"
3436
else
35-
echo "Unsupported operating system: $OS"
36-
exit 1
37+
echo "Unsupported operating system: $OS" >&2; exit 1
3738
fi
3839
39-
# Download & Install
4040
URL="https://github.com/aptos-labs/aptos-core/releases/download/aptos-cli-v${VERSION}/${FILENAME}"
4141
echo "Downloading Aptos CLI from $URL"
42-
curl -sL "$URL" -o aptos-cli.zip
43-
unzip aptos-cli.zip
44-
chmod +x aptos
45-
mkdir -p $HOME/.local/bin
46-
export PATH="$HOME/.local/bin:$PATH"
47-
sudo mv aptos $HOME/.local/bin
42+
43+
# Ensure unzip exists (some runners may not have it)
44+
if ! command -v unzip >/dev/null 2>&1; then
45+
echo "unzip not found; attempting to install with apt-get (best effort)"
46+
sudo apt-get update -y >/dev/null 2>&1 || true
47+
sudo apt-get install -y unzip >/dev/null 2>&1 || true
48+
fi
49+
50+
curl -fsSL "$URL" -o aptos-cli.zip
51+
unzip -o aptos-cli.zip
52+
53+
# Install to ~/.local/bin and persist PATH
54+
mkdir -p "$HOME/.local/bin"
55+
mv ./aptos "$HOME/.local/bin/aptos"
56+
chmod +x "$HOME/.local/bin/aptos"
57+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
58+
59+
# Make sure movefmt dir is in PATH for later steps
60+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
61+
4862
aptos --version
4963
aptos update movefmt
50-
echo 'Adding movefmt to PATH'
51-
echo "$HOME/.aptos/bin" >> $GITHUB_PATH

.github/workflows/doc.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,21 @@ jobs:
3535
timeout-minutes: 60
3636
steps:
3737
- uses: actions/checkout@v4
38-
- name: Install Aptos CLI
39-
uses: ./.github/actions/install-aptos-cli
40-
with:
41-
version: "7.7.0"
38+
- name: Install Aptos CLI (script)
39+
shell: bash
40+
run: |
41+
set -Eeuo pipefail
42+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
43+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
44+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
45+
46+
- name: Verify Aptos
47+
shell: bash
48+
run: |
49+
set -Eeuo pipefail
50+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
51+
aptos --version
52+
aptos update movefmt
4253
- name: Run Aptos Create Local Testnet
4354
run: |
4455
make local-testnet &

.github/workflows/examples.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,21 @@ jobs:
2424
steps:
2525
- uses: actions/checkout@v4
2626

27-
- name: Install Aptos CLI
28-
uses: ./.github/actions/install-aptos-cli
29-
with:
30-
version: "7.7.0"
27+
- name: Install Aptos CLI (script)
28+
shell: bash
29+
run: |
30+
set -Eeuo pipefail
31+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
32+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
33+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
34+
35+
- name: Verify Aptos
36+
shell: bash
37+
run: |
38+
set -Eeuo pipefail
39+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
40+
aptos --version
41+
aptos update movefmt
3142
3243
- name: Run Aptos Compile All Examples
3344
working-directory: examples

.github/workflows/lint.yml

Lines changed: 39 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,21 @@ jobs:
3838
run: |
3939
sudo apt-get update -y
4040
41-
- name: Install Aptos CLI
42-
uses: ./.github/actions/install-aptos-cli
43-
with:
44-
version: "7.7.0"
41+
- name: Install Aptos CLI (script)
42+
shell: bash
43+
run: |
44+
set -Eeuo pipefail
45+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
46+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
47+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
48+
49+
- name: Verify Aptos
50+
shell: bash
51+
run: |
52+
set -Eeuo pipefail
53+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
54+
aptos --version
55+
aptos update movefmt
4556
4657
- name: Install Node.js
4758
uses: actions/setup-node@v4
@@ -78,13 +89,21 @@ jobs:
7889
run: |
7990
sudo apt-get update -y
8091
81-
- name: Install Aptos CLI
92+
- name: Install Aptos CLI (script)
93+
shell: bash
94+
run: |
95+
set -Eeuo pipefail
96+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
97+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
98+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
99+
100+
- name: Verify Aptos
101+
shell: bash
82102
run: |
83-
curl -fsSL "https://aptos.dev/scripts/install_cli.py" | python3
103+
set -Eeuo pipefail
104+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
84105
aptos --version
85106
aptos update movefmt
86-
echo 'Adding movefmt to PATH'
87-
echo "$HOME/.aptos/bin" >> $GITHUB_PATH
88107
89108
- name: Install Node.js
90109
uses: actions/setup-node@v4
@@ -124,13 +143,21 @@ jobs:
124143
run: |
125144
sudo apt-get update -y
126145
127-
- name: Install Aptos CLI
146+
- name: Install Aptos CLI (script)
147+
shell: bash
148+
run: |
149+
set -Eeuo pipefail
150+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
151+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
152+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
153+
154+
- name: Verify Aptos
155+
shell: bash
128156
run: |
129-
curl -fsSL "https://aptos.dev/scripts/install_cli.py" | python3
157+
set -Eeuo pipefail
158+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
130159
aptos --version
131160
aptos update movefmt
132-
echo 'Adding movefmt to PATH'
133-
echo "$HOME/.aptos/bin" >> $GITHUB_PATH
134161
135162
- name: Install Node.js
136163
uses: actions/setup-node@v4

.github/workflows/testnet-deployment.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,21 @@ jobs:
6363
run: |
6464
sudo apt-get update -y
6565
66-
- name: Install Aptos CLI
67-
uses: ./.github/actions/install-aptos-cli
68-
with:
69-
version: "7.7.0"
66+
- name: Install Aptos CLI (script)
67+
shell: bash
68+
run: |
69+
set -Eeuo pipefail
70+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
71+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
72+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
73+
74+
- name: Verify Aptos
75+
shell: bash
76+
run: |
77+
set -Eeuo pipefail
78+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
79+
aptos --version
80+
aptos update movefmt
7081
7182
- name: Set Aptos Workspace Config
7283
run: make set-workspace-config

.github/workflows/typescript-integration-tests.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,21 @@ jobs:
5151
run: |
5252
sudo apt-get update -y
5353
54-
- name: Install Aptos CLI
55-
uses: ./.github/actions/install-aptos-cli
56-
with:
57-
version: "7.7.0"
54+
- name: Install Aptos CLI (script)
55+
shell: bash
56+
run: |
57+
set -Eeuo pipefail
58+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
59+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
60+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
61+
62+
- name: Verify Aptos
63+
shell: bash
64+
run: |
65+
set -Eeuo pipefail
66+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
67+
aptos --version
68+
aptos update movefmt
5869
5970
- name: Install Node.js
6071
uses: actions/setup-node@v4

.github/workflows/unit_tests.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,21 @@ jobs:
3838
steps:
3939
- uses: actions/checkout@v4
4040

41-
- name: Install Aptos CLI
42-
uses: ./.github/actions/install-aptos-cli
43-
with:
44-
version: "7.7.0"
41+
- name: Install Aptos CLI (script)
42+
shell: bash
43+
run: |
44+
set -Eeuo pipefail
45+
curl -fsSL "https://aptos.dev/scripts/install_cli.sh" | sh
46+
echo "$HOME/.aptos/bin" >> "$GITHUB_PATH"
47+
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
48+
49+
- name: Verify Aptos
50+
shell: bash
51+
run: |
52+
set -Eeuo pipefail
53+
export PATH="$HOME/.aptos/bin:$HOME/.local/bin:$PATH"
54+
aptos --version
55+
aptos update movefmt
4556
4657
- name: Run Aptos Create Local Testnet
4758
run: |

aave-core/aave-math/sources/wad_ray_math.move

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ module aave_math::wad_ray_math {
115115
/// @return c Result of a*b, in ray, rounded down
116116
public fun ray_mul_down(a: u256, b: u256): u256 {
117117
if (a == 0 || b == 0) return 0;
118+
assert!(a <= U256_MAX / b, error_config::get_eoverflow());
118119
(a * b) / RAY
119120
}
120121

@@ -155,6 +156,10 @@ module aave_math::wad_ray_math {
155156
public fun ray_div_down(a: u256, b: u256): u256 {
156157
assert!(b > 0, error_config::get_edivision_by_zero());
157158
if (a == 0) return 0;
159+
assert!(
160+
a <= U256_MAX / RAY,
161+
error_config::get_eoverflow()
162+
);
158163
(a * RAY) / b
159164
}
160165

aave-core/aave-math/tests/wad_ray_math_tests.move

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,4 +445,22 @@ module aave_math::wad_ray_math_tests {
445445
assert!(interest_up == 1050000000000000000000000000, TEST_SUCCESS);
446446
assert!(interest_down == 1050000000000000000000000000, TEST_SUCCESS);
447447
}
448+
449+
#[test]
450+
#[expected_failure(abort_code = EOVERFLOW, location = aave_math::wad_ray_math)]
451+
fun test_ray_div_down_overflow() {
452+
// a * RAY overflows at a = floor(U256_MAX / RAY) + 1
453+
let a = get_u256_max_for_testing() / get_ray_for_testing() + 1;
454+
let b = 1;
455+
ray_div_down(a, b);
456+
}
457+
458+
#[test]
459+
#[expected_failure(abort_code = EOVERFLOW, location = aave_math::wad_ray_math)]
460+
fun test_ray_mul_down_overflow() {
461+
// a * b overflows at a = floor(U256_MAX / b) + 1 (choose b > 0)
462+
let b = 1000000000000000000000000000; // 1 RAY
463+
let a = get_u256_max_for_testing() / b + 1;
464+
ray_mul_down(a, b);
465+
}
448466
}

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

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -718,23 +718,6 @@ module aave_oracle::oracle {
718718
};
719719
}
720720

721-
/// @notice Gets prices and timestamps for multiple assets at once
722-
/// @param assets Vector of asset addresses
723-
/// @return Vectors of corresponding asset prices with their timestamps
724-
fun get_asset_prices_and_timestamps_internal(
725-
assets: vector<address>
726-
): (vector<u256>, vector<u256>) acquires PriceOracleData {
727-
let prices = vector<u256>[];
728-
let timestamps = vector<u256>[];
729-
for (i in 0..vector::length(&assets)) {
730-
let asset = *vector::borrow(&assets, i);
731-
let (price, timestamp) = get_asset_price_internal(asset);
732-
vector::insert(&mut prices, i, price);
733-
vector::insert(&mut timestamps, i, timestamp);
734-
};
735-
(prices, timestamps)
736-
}
737-
738721
/// Max allowed sUSDe/USDe ratio given the snapshot and growth parameters.
739722
/// Assumes parameters were validated in `set_susde_price_adapter`.
740723
/// @param cap Capped asset data

0 commit comments

Comments
 (0)