Skip to content

Commit ed26600

Browse files
committed
fix tests
1 parent 2d36f7f commit ed26600

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

cadence/tests/adversarial_reentrancy_test.cdc

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ fun test_reentrancy_recursiveWithdrawSource() {
116116
//
117117
// The goal is to prove the pool rejects the attempt (e.g. via position lock /
118118
// reentrancy guard), rather than allowing nested withdraw/deposit effects.
119-
119+
120120
let res = createReentrantSourcePosition(
121121
signer: user,
122122
vaultStoragePath: FLOW_VAULT_STORAGE_PATH,
@@ -145,10 +145,13 @@ fun test_reentrancy_recursiveWithdrawSource() {
145145
//
146146
// In this test, the topUpSource behavior is adversarial: it attempts to re-enter
147147
// the pool during the pull/deposit flow. We expect the transaction to fail.
148-
let withdrawRes = _executeTransaction(
149-
"./transactions/position-manager/withdraw_from_position.cdc",
150-
[positionID, FLOW_TOKEN_IDENTIFIER, 1_500.0, true],
151-
user
148+
let withdrawRes = withdrawFromPosition(
149+
signer: user,
150+
positionId: positionID,
151+
tokenTypeIdentifier: FLOW_TOKEN_IDENTIFIER,
152+
receiverVaultStoragePath: FLOW_VAULT_STORAGE_PATH,
153+
amount: 1500.0,
154+
pullFromTopUpSource: true
152155
)
153156
Test.expect(withdrawRes, Test.beFailed())
154157

@@ -246,8 +249,8 @@ fun test_reentrancy_guard_position_lock_released_after_failure() {
246249

247250
// trigger reentrancy — must fail
248251
let failRes = _executeTransaction(
249-
"./transactions/position-manager/withdraw_from_position.cdc",
250-
[pid, FLOW_TOKEN_IDENTIFIER, 1_500.0, true],
252+
"./transactions/flow-alp/epositionadmin/withdraw_from_position.cdc",
253+
[pid, FLOW_TOKEN_IDENTIFIER, FLOW_VAULT_STORAGE_PATH, 1_500.0, true],
251254
user
252255
)
253256
Test.expect(failRes, Test.beFailed())
@@ -258,6 +261,7 @@ fun test_reentrancy_guard_position_lock_released_after_failure() {
258261
signer: user,
259262
positionId: pid,
260263
tokenTypeIdentifier: FLOW_TOKEN_IDENTIFIER,
264+
receiverVaultStoragePath: FLOW_VAULT_STORAGE_PATH,
261265
amount: 50.0,
262266
pullFromTopUpSource: false
263267
)
@@ -307,8 +311,8 @@ fun test_reentrancy_state_consistency_no_partial_writes() {
307311

308312
// trigger re-entrant failure
309313
let failRes = _executeTransaction(
310-
"./transactions/position-manager/withdraw_from_position.cdc",
311-
[pid, FLOW_TOKEN_IDENTIFIER, 1_500.0, true],
314+
"./transactions/flow-alp/epositionadmin/withdraw_from_position.cdc",
315+
[pid, FLOW_TOKEN_IDENTIFIER, FLOW_VAULT_STORAGE_PATH, 1_500.0, true],
312316
user
313317
)
314318
Test.expect(failRes, Test.beFailed())

0 commit comments

Comments
 (0)