Skip to content

Commit

Permalink
Merge pull request #210 from LedgerHQ/cev/B2CA-1777_cleanup_networks
Browse files Browse the repository at this point in the history
B2CA-1777: Remove useless chain bsc
  • Loading branch information
cedelavergne-ledger authored Sep 4, 2024
2 parents cddba3e + c892168 commit 2f8a1f3
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 40 deletions.
21 changes: 7 additions & 14 deletions .github/workflows/lint-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,10 @@ on:
pull_request:

jobs:
job_lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Clone
uses: actions/checkout@v4

- name: Lint
uses: DoozyX/[email protected]
with:
source: './src'
extensions: 'h,c'
clangFormatVersion: 12
check_linting:
name: Check linting using the reusable workflow
uses: LedgerHQ/ledger-app-workflows/.github/workflows/reusable_lint.yml@v1
with:
source: './'
extensions: 'h,c'
version: 12
3 changes: 0 additions & 3 deletions .github/workflows/reusable_swap_functional_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,6 @@ jobs:
- name: solana
repo: ${{ inputs.repo_for_solana }}
branch: ${{ inputs.branch_for_solana }}
- name: bsc
repo: ${{ inputs.repo_for_ethereum }}
branch: ${{ inputs.branch_for_ethereum }}
- name: DOT
repo: ${{ inputs.repo_for_polkadot }}
branch: ${{ inputs.branch_for_polkadot }}
Expand Down
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,37 @@ make delete

## Testing

### Ragger tests

The `./test/python` directory contains files for testing the app and its interactions with other apps. It does not contain the binaries used to test the app.

The sideloaded applications binaries need to be generated in their respective repositories and placed in the `tests/python/library_binaries` directory.
The binaries need to be generated with specific flags:

```shell script
make DEBUG=1 TEST_PUBLIC_KEY=1
```

Tests can be run with a command like:

```shell script
pytest -v --tb=short --device nanox -k eth
```

### Legacy Zemu tests

The `./test` directory contains files for testing the app and its interactions with other apps. It does not contain the binaries used to test the app.
The binaries need to be generated and put in `test/elfs/` before launching the tests.

The exchange binaries need to be generated with the following flags.

```
```shell script
make TESTING=1 TEST_PUBLIC_KEY=1
```

Then the application must be placed in the `test/elfs/` directory, under the name `exchange_nanos.elf`, `exchange_nanox.elf`, or `exchange_nanosp.elf` depending on the SDK:

```
```shell script
// Choose one
// cp bin/app.elf test/elfs/exchange_nanos.elf
// cp bin/app.elf test/elfs/exchange_nanox.elf
Expand All @@ -43,7 +62,8 @@ Then the application must be placed in the `test/elfs/` directory, under the nam

The sideloaded applications binaries need to be generated in their respective repositories and placed in the `test/elfs/` directory.
For the entire test collection to pass, the following binaries must be present
```

```shell script
bitcoin_nanos.elf
bitcoin_nanosp.elf
bitcoin_nanox.elf
Expand Down
4 changes: 4 additions & 0 deletions ledger_app.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,9 @@ build_directory = "./"
sdk = "C"
devices = ["nanos", "nanox", "nanos+", "stax"]

[use_cases]
use_test_keys = "TEST_PUBLIC_KEY=1"
dbg_use_test_keys = "DEBUG=1 TEST_PUBLIC_KEY=1"

[tests]
pytest_directory = "./test/python/"
1 change: 0 additions & 1 deletion test/python/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"litecoin": "Litecoin",
"stellar": "Stellar",
"solana": "Solana",
"bsc": "Binance Smart Chain",
"DOT": "Polkadot",
"tron": "Tron",
}
Expand Down
12 changes: 0 additions & 12 deletions test/python/test_ethereum.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,6 @@ def test_bsc(self, backend, exchange_navigation_helper, test_to_run):



# ExchangeTestRunner implementation for BSC on BNB application
class BSCLegacyTests(GenericEthereumNetworkTests):
chain_id = 56
currency_configuration = cal.BNB_LEGACY_CURRENCY_CONFIGURATION

class TestsBSCLegacy:
@pytest.mark.parametrize('test_to_run', ALL_TESTS_EXCEPT_MEMO_AND_THORSWAP)
def test_bsc_legacy(self, backend, exchange_navigation_helper, test_to_run):
BSCLegacyTests(backend, exchange_navigation_helper).run_test(test_to_run)



# ExchangeTestRunner implementation for Eth token DAI
class DAITests(GenericEthereumNetworkTests):
currency_configuration = cal.DAI_CURRENCY_CONFIGURATION
Expand Down
14 changes: 7 additions & 7 deletions test/python/test_input_robustness.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from .apps.exchange import ExchangeClient, Rate, SubCommand, Errors, Command
from .apps.exchange_transaction_builder import get_partner_curve, craft_and_sign_tx
from .apps.signing_authority import SigningAuthority, LEDGER_SIGNER
from .apps.tezos import encode_address
from .apps import cal as cal

CURRENCY_FROM = cal.XLM_CURRENCY_CONFIGURATION
Expand Down Expand Up @@ -241,19 +242,18 @@ def test_currency_alias(self, backend):
"payin_extra_id": b"",
"refund_address": b"0xDad77910DbDFdE764fC21FCD4E74D71bBACA6D8D",
"refund_extra_id": b"",
"payout_address": b"0xDad77910DbDFdE764fC21FCD4E74D71bBACA6D8D",
"payout_address": "tz1YPjCVqgimTAPmxZX9egDeTFRCmrTRqmp9",
"payout_extra_id": b"",
"currency_from": "ETH",
"currency_to": "BNB",
"currency_to": "XTZ",
"amount_to_provider": int.to_bytes(1000, length=8, byteorder='big'),
"amount_to_wallet": b"\246\333t\233+\330\000",
}
fees = 100

bsc_conf = cal.BNB_CURRENCY_CONFIGURATION.conf # "Binance Smart Chain"
bsc_conf_alias_1 = create_currency_config("BNB", "bsc", ("BNB", 18))
bsc_conf_alias_2 = create_currency_config("BNB", "Bsc", ("BNB", 18))
for conf in bsc_conf, bsc_conf_alias_1, bsc_conf_alias_2:
xtz_conf = cal.XTZ_CURRENCY_CONFIGURATION.conf # "Tezos"
xtz_conf_alias = create_currency_config("XTZ", "Tezos Wallet")
for conf in xtz_conf, xtz_conf_alias:
ex = ExchangeClient(backend, Rate.FIXED, SubCommand.SWAP)
transaction_id = ex.init_transaction().data
backend.wait_for_home_screen()
Expand All @@ -264,5 +264,5 @@ def test_currency_alias(self, backend):
ex.check_transaction_signature(tx_signature)

# If the alias does not work, CHECK_PAYOUT_ADDRESS will crash
payload = prefix_with_len(conf) + LEDGER_SIGNER.sign(conf) + prefix_with_len(CURRENCY_TO.packed_derivation_path)
payload = prefix_with_len(conf) + LEDGER_SIGNER.sign(conf) + prefix_with_len(cal.XTZ_CURRENCY_CONFIGURATION.packed_derivation_path)
ex._exchange(Command.CHECK_PAYOUT_ADDRESS, payload=payload)

0 comments on commit 2f8a1f3

Please sign in to comment.