Skip to content
11 changes: 7 additions & 4 deletions cadence/tests/adversarial_recursive_withdraw_source_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,13 @@ fun testRecursiveWithdrawSource() {
//
// In this test, the topUpSource behavior is adversarial: it attempts to re-enter
// the pool during the pull/deposit flow. We expect the transaction to fail.
let withdrawRes = executeTransaction(
"./transactions/flow-alp/pool-management/withdraw_from_position.cdc",
[positionID, flowTokenIdentifier, 1500.0, true], // pullFromTopUpSource: true
userAccount
let withdrawRes = withdrawFromPosition(
signer: userAccount,
positionId: positionID,
tokenTypeIdentifier: flowTokenIdentifier,
receiverVaultStoragePath: FLOW_VAULT_STORAGE_PATH,
amount: 1500.0,
pullFromTopUpSource: true
)
Test.expect(withdrawRes, Test.beFailed())

Expand Down
11 changes: 7 additions & 4 deletions cadence/tests/adversarial_type_spoofing_test.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ fun testMaliciousSource() {
Test.expect(openRes, Test.beSucceeded())

// withdraw 1337 Flow from the position
let withdrawRes = executeTransaction(
"./transactions/flow-alp/pool-management/withdraw_from_position.cdc",
[1 as UInt64, flowTokenIdentifier, 1337.0, true],
hackerAccount
let withdrawRes = withdrawFromPosition(
signer: hackerAccount,
positionId: 1,
tokenTypeIdentifier: flowTokenIdentifier,
receiverVaultStoragePath: FLOW_VAULT_STORAGE_PATH,
amount: 1337.0,
pullFromTopUpSource: true
)
Test.expect(withdrawRes, Test.beFailed())

Expand Down
Loading
Loading