Skip to content

Commit

Permalink
Updated scenario descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomaszslabon committed Nov 9, 2023
1 parent 9fc585b commit 45a6f5a
Showing 1 changed file with 39 additions and 20 deletions.
59 changes: 39 additions & 20 deletions system-tests/test/deposit-redemption.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,6 @@ import type { SystemTestsContext } from "./utils/context"

chai.use(chaiAsPromised)

/**
* This system test scenario performs a single deposit and redemption.
*
* The scenario consists of the following steps:
* 1. The depositor broadcasts the deposit transaction on BTC chain and reveals
* it to the bridge.
* 2. The wallet broadcasts the sweep transaction of the given deposit on BTC
* chain and submits the sweep proof to the bridge.
* 3. The depositor (redeemer) requests the redemption of its entire bank
* balance.
* 4. The wallet broadcasts the redemption transaction handling the given
* request and submits the redemption proof to the bridge.
*
* Following prerequisites must be fulfilled to make a successful pass:
* - The depositor's BTC balance must allow to perform the deposit
* - tBTC v2 contracts must be deployed on used Ethereum network
* - A fresh live wallet (with no main UTXO yet) must be registered in
* the bridge
*/
describe("System Test - Deposit and redemption", () => {
let systemTestsContext: SystemTestsContext
let electrumClient: ElectrumClient
Expand Down Expand Up @@ -164,6 +145,25 @@ describe("System Test - Deposit and redemption", () => {
})

context("when deposit is made and revealed without a vault", () => {
/**
* This system test scenario performs a single deposit and redemption.
*
* The scenario consists of the following steps:
* 1. The depositor broadcasts the deposit transaction on BTC chain and
* reveals it to the bridge without providing a vault address.
* 2. The wallet broadcasts the sweep transaction of the given deposit on BTC
* chain and submits the sweep proof to the bridge.
* 3. The depositor (redeemer) requests the redemption of its entire bank
* balance.
* 4. The wallet broadcasts the redemption transaction handling the given
* request and submits the redemption proof to the bridge.
*
* Following prerequisites must be fulfilled to make a successful pass:
* - The depositor's BTC balance must allow to perform the deposit
* - tBTC v2 contracts must be deployed on used Ethereum network
* - A fresh live wallet (with no main UTXO yet) must be registered in
* the bridge
*/
before("make and reveal deposit", async () => {
depositReceipt = createDepositReceipt(
systemTestsContext.depositor.address,
Expand Down Expand Up @@ -441,6 +441,25 @@ describe("System Test - Deposit and redemption", () => {
})

context("when deposit is made and revealed with a vault", () => {
/**
* This system test scenario performs a single deposit and redemption.
*
* The scenario consists of the following steps:
* 1. The depositor broadcasts the deposit transaction on BTC chain and
* reveals it to the bridge with the vault address provided.
* 2. The wallet broadcasts the sweep transaction of the given deposit on BTC
* chain and submits the sweep proof to the bridge.
* 3. The depositor (redeemer) requests the redemption of its entire TBTC
* balance.
* 4. The wallet broadcasts the redemption transaction handling the given
* request and submits the redemption proof to the bridge.
*
* Following prerequisites must be fulfilled to make a successful pass:
* - The depositor's BTC balance must allow to perform the deposit
* - tBTC v2 contracts must be deployed on used Ethereum network
* - A live wallet (with the main UTXO from the previous system test) must
* be registered in the bridge
*/
before("make and reveal deposit", async () => {
depositReceipt = createDepositReceipt(
systemTestsContext.depositor.address,
Expand Down Expand Up @@ -636,7 +655,7 @@ describe("System Test - Deposit and redemption", () => {
systemTestsContext.walletBitcoinKeyPair.publicKey.compressed,
sweepUtxo,
redeemerOutputScript,
tbtcBalanceOfDepositor,
tbtcBalanceOfDepositor
)

console.log(
Expand Down

0 comments on commit 45a6f5a

Please sign in to comment.