Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bridge functionalities test cases #1

Draft
wants to merge 4 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
61 changes: 61 additions & 0 deletions tests/BridgeFee/genesis.feature
@@ -0,0 +1,61 @@
Feature: Genesis
The BridgeFee genesis initialize params, token infos and token target infos.

Scenario: Import genesis
Given a pocket network with <ChainID>
And genesis with following values
| |
"bridgefee": {
"params": {
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
}
}
| |
When user queries params
When typing "pocket query bridgefee-params"
Then the params should initialized with correct value put on genesis
| |
{
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
}
| |
When user queries token infos
When typing "pocket query all-token-infos"
Then the signers should be displaying following values
| |
{
"Infos": []
}
| |
When user queries token target infos
When typing "pocket query all-token-target-infos"
Then the liquidities should be displaying following values
| |
{
"Infos": []
}
| |

Scenario: Export genesis
Given a pocket network with <ChainID>
And genesis is initialized with following values
| |
"bridgefee": {
"params": {
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
}
}
| |
And the node is stopped
When user export genesis
When typing "pocket util export-genesis-for-reset <height> <newChainID>"
Then the the response should include following result
| |
"bridgefee": {
"params": {
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
},
"tokenInfos": [],
"tokenTargets": []
}
| |
48 changes: 48 additions & 0 deletions tests/BridgeFee/tax-distribution.feature
@@ -0,0 +1,48 @@
Feature: Tax distribution
The BridgeFee module distribute fees to targets at the time of withdraw signed operation.

Scenario: Tax distribution for small amount when fee is lower than buffer size
Given a pocket network with <ChainID>
And target network allowed by module admin
And enough liquidity available on the bridgepool module account
And token info and token target info set
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 execute withdraw signed operation with small amount
When typing "pocket bridgepool withdraw-signed <fromAddr> <payee> <amount> <salt> <signature> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query the balance of the account
When typing "pocket query balance 169869f67cd3f78a722fb4795b69949fb4bc9084"
Then the amount should be increased
When user query the balace of bridgepool module account
When typing "pocket query balance 07c4372d065678d64711a7162e194d729c2b3fa0"
Then the amount should be decreased
When user query the balace of bridgefee module account
When typing "pocket query balance 56abb3c7677bf17098ef768a58c570fafc3221ca"
Then the amount should be increased
When user query the balace of fee target account
When typing "pocket query balance <fee_target>"
Then the amount should be empty

Scenario: Tax distribution for bigger amount where fee is bigger than buffer size
Given a pocket network with <ChainID>
And target network allowed by module admin
And enough liquidity available on the bridgepool module account
And token info and token target info set
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 execute withdraw signed operation with large amount
When typing "pocket bridgepool withdraw-signed <fromAddr> <payee> <amount> <salt> <signature> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query the balance of the account
When typing "pocket query balance 169869f67cd3f78a722fb4795b69949fb4bc9084"
Then the amount should be increased
When user query the balace of bridgepool module account
When typing "pocket query balance 07c4372d065678d64711a7162e194d729c2b3fa0"
Then the amount should be decreased
When user query the balace of bridgefee module account
When typing "pocket query balance 56abb3c7677bf17098ef768a58c570fafc3221ca"
Then the amount should be zero
When user query the balace of fee target account
When typing "pocket query balance <fee_target>"
Then the amount should be positive
25 changes: 25 additions & 0 deletions tests/BridgeFee/token-info.feature
@@ -0,0 +1,25 @@
Feature: Token Info
The BridgeFee has token info managed by module admin. Token info describes token buffer
and token specific configuration when processing fees.

Scenario: Set token info
Given a pocket network with <ChainID>
And an account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 which is module admin exists
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 set token info
When typing "pocket bridgefee set-token-info <fromAddr> <token> <bufferSize> <tokenSpecificConfig> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query the fee rates
When typing "pocket query all-token-infos"
Then the signer should be added
| |
{
"Infos": [
{
"bufferSize": "1000",
"token": "upokt"
}
]
}
| |
68 changes: 68 additions & 0 deletions tests/BridgeFee/token-target.feature
@@ -0,0 +1,68 @@
Feature: Token Target Info
The BridgeFee has token target info managed by module admin. Token target info describes where to send fees.

Scenario: Set token target info
Given a pocket network with <ChainID>
And an account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 which is module admin exists
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 set token targets info
When typing "pocket bridgefee set-token-target-infos <fromAddr> <token> <targets> <weights> <targetTypes> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query token targets
When typing "pocket query all-token-target-infos"
Then the signer should be added
| |
{
"Infos": [
{
"targets": [
{
"tType": 2,
"target": "924364bbf0347842e1e0fa9cd2167dc630fc3c0c",
"weight": "1"
},
{
"tType": 2,
"target": "a9cb5f27e7a4b2be3045439f151d3e68108cd65c",
"weight": "1"
}
],
"token": "upokt"
}
]
}
| |

Scenario: Set global token target info
Given a pocket network with <ChainID>
And an account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 which is module admin exists
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 set global token targets info
When typing "pocket bridgefee set-global-target-infos <fromAddr> <targets> <weights> <targetTypes> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query token targets
When typing "pocket query all-token-target-infos"
Then the signer should be added
| |
{
"Infos": [
{
"targets": [
{
"tType": 2,
"target": "924364bbf0347842e1e0fa9cd2167dc630fc3c0c",
"weight": "1"
},
{
"tType": 2,
"target": "a9cb5f27e7a4b2be3045439f151d3e68108cd65c",
"weight": "1"
}
],
"token": ""
}
]
}
| |
43 changes: 43 additions & 0 deletions tests/BridgePool/allowed-target.feature
@@ -0,0 +1,43 @@
Feature: Allowed Target
The BridgePool manages allowed targets by module admin. Allowed target describes
which targets are being supported by the bridge.

Scenario: Add allowed target
Given a pocket network with <ChainID>
And an account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 which is module admin exists
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 add an allowed target
When typing "pocket bridgepool allow-target <fromAddr> <token> <targetChainId> <targetToken> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query the allowed targets
When typing "pocket query allowed-targets"
Then the target should be added
| |
{
"AllowedTargets": [
{
"chainId": "137",
"targetToken": "0xa5e0829caced8ffdd4de3c43696c57f7d7a678ff",
"token": "upokt"
}
]
}
| |
Scenario: Remove allowed target
Given a pocket network with <ChainID>
And an account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 which is module admin exists
And an allow target exists
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 disallow the target
When typing "pocket bridgepool disallow-target <fromAddr> <token> <targetChainId> <targetToken> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query the allowed targets
When typing "pocket query allowed-targets"
Then the target should be removed
| |
{
"AllowedTargets": []
}
| |
24 changes: 24 additions & 0 deletions tests/BridgePool/fee-rate.feature
@@ -0,0 +1,24 @@
Feature: Fee Rates
The BridgePool has fee rates per token that is managed by module admin.

Scenario: Set fee rate
Given a pocket network with <ChainID>
And an account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 which is module admin exists
When the account with address 169869f67cd3f78a722fb4795b69949fb4bc9084 add a fee rate
When typing "pocket bridgepool set-fee <fromAddr> <token> <fee-rate> <fee> <chainId>"
Then user should be prompted to enter its passphrase: "Enter Passphrase: "
When passphrase is provided
And the details of the transaction should show "success: true"
When user query the fee rates
When typing "pocket query fee-rates"
Then the signer should be added
| |
{
"FeeRates": [
{
"rate": "100",
"token": "upokt"
}
]
}
| |
78 changes: 78 additions & 0 deletions tests/BridgePool/genesis.feature
@@ -0,0 +1,78 @@
Feature: Genesis
The BridgePool genesis initialize params, signer, liquidities, fees, targets, used withdraw messages.

Scenario: Import genesis
Given a pocket network with <ChainID>
And genesis with following values
| |
"bridgepool": {
"params": {
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
}
}
| |
When user queries params
When typing "pocket query bridgepool-params"
Then the params should initialized with correct value put on genesis
| |
{
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
}
| |
When user queries signers
When typing "pocket query signers"
Then the signers should be displaying following values
| |
{
"Signers": []
}
| |
When user queries liquidities
When typing "pocket query liquidities"
Then the liquidities should be displaying following values
| |
{
"Liquidities": []
}
| |
When user queries fee rates
When typing "pocket query fee-rates"
Then the fee rates should be displaying following values
| |
{
"FeeRates": []
}
| |
When user queries allowed targets
When typing "pocket query allowed-targets"
Then the fee rates should be displaying following values
| |
{
"AllowedTargets": []
}
| |

Scenario: Export genesis
Given a pocket network with <ChainID>
And genesis is initialized with following values
| |
"bridgepool": {
"params": {
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
}
}
| |
And the node is stopped
When user export genesis
When typing "pocket util export-genesis-for-reset <height> <newChainID>"
Then the the response should include following result
| |
"bridgepool": {
"allowedTargets": [],
"fees": [],
"liquidities": [],
"params": {
"owner": "169869f67cd3f78a722fb4795b69949fb4bc9084"
}
},
| |