Skip to content

Commit

Permalink
Merge branch 'main' into large-runner
Browse files Browse the repository at this point in the history
  • Loading branch information
mvadari authored Oct 25, 2023
2 parents 7a29961 + 85113fc commit 8c9088a
Show file tree
Hide file tree
Showing 19 changed files with 122 additions and 60 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/lint_type_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,36 @@ on:
pull_request:
workflow_dispatch:

env:
POETRY_VERSION: 1.4.2
PYTHON_VERSION: "3.8"

jobs:
lint-and-type-check:
name: Lint and type-check
runs-on: ubuntu-20.04
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Load cached .local
id: cache-poetry
uses: actions/cache@v3
with:
path: /home/runner/.local
key: dotlocal-3.11-${{ hashFiles('.github/workflows') }}
key: dotlocal-${{ env.POETRY_VERSION }}

- name: Install poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
curl -sSL https://install.python-poetry.org/ | python -
curl -sSL https://install.python-poetry.org/ | python - --version ${{ env.POETRY_VERSION }}
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Python + Retrieve Poetry dependencies from cache
uses: actions/setup-python@v4
with:
python-version: "3.11"
python-version: ${{ env.PYTHON_VERSION }}
cache: "poetry"

- name: Display Python version
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,21 @@ on:
branches: [main]
pull_request:
paths-ignore:
- "docs/**"
- "scripts/**"
- "**.md"
- ".vscode/**"
workflow_dispatch:

env:
POETRY_VERSION: 1.4.2

jobs:
test:
name: Test
runs-on: [self-hosted, heavy]
timeout-minutes: 10
strategy:
matrix:
# we have to use 3.7.1 to get around openssl issues
# TODO: add 3.7 once xrpl-py has been updated
python-version: ["3.8", "3.9", "3.10", "3.11"]
fail-fast: false

Expand All @@ -27,20 +28,22 @@ jobs:
uses: actions/checkout@v3

- name: Load cached .local
id: cache-poetry
uses: actions/cache@v3
with:
path: /home/runner/.local
key: dotlocal-${{ matrix.python-version }}-${{ hashFiles('.github/workflows') }}
key: dotlocal-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}

- name: Install poetry
if: steps.cache-poetry.outputs.cache-hit != 'true'
run: |
curl -sSL https://install.python-poetry.org/ | python -
curl -sSL https://install.python-poetry.org/ | python - --version ${{ env.POETRY_VERSION }}
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Python + Retrieve Poetry dependencies from cache
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
python-version: ${{ matrix.python-version }}
cache: "poetry"

- name: Display Python version
Expand All @@ -52,8 +55,8 @@ jobs:

- name: Pull images from docker
run: |
docker pull legleux/rippled-xbridge-test
docker pull legleux/xbridge_witnessd-test
docker pull rippleci/rippled:2.0.0-b4
docker pull rippleci/xbwd
- name: Run tests
id: runTests
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"python.defaultInterpreterPath": ".venv/bin/python",
"python.formatting.provider": "black",
"python.linting.pylintEnabled": false,
"python.linting.flake8Enabled": true,
Expand Down
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

- Throw an error if a transaction fails instead of continuing

### Changed

- Switched to Docker containers with the latest versions of rippled and the witness server

## [0.3.3] - 2023-10-10

### Fixed

- Updated xrpl-py version to the latest to fix `XChainCreateBridge`` serialization

## [0.3.2] - 2023-09-25

### Fixed

- Updated xrpl-py beta version to add support for Network ID feature

## [0.3.1] - 2023-07-12

### Fixed

- Better error handling for the `account_objects` call in `bridge create`
- Fix docker-compose.yml file error when using this package via `pip`

Expand Down
22 changes: 11 additions & 11 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "xbridge-cli"
version = "0.3.1"
version = "0.3.3"
description = "A CLI that helps you set up an XRPL-XRPL bridge."
readme = "README.md"
repository = "https://github.com/xpring-eng/xbridge-cli"
Expand Down Expand Up @@ -30,7 +30,7 @@ websockets = "^10.3"
Jinja2 = "^3.1.2"
psutil = "^5.9.2"
docker = "^6.0.0"
xrpl-py = "2.1.0b0"
xrpl-py = "^2.4.0"
pycryptodome = "^3.17"

[tool.poetry.dev-dependencies]
Expand Down
6 changes: 3 additions & 3 deletions scripts/docker-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ xbridge-cli server start-all --docker
xbridge-cli server list
xbridge-cli explorer
xbridge-cli bridge build --name=bridge --fund-locking
xbridge-cli fund locking_chain raFcdz1g8LWJDJWJE2ZKLRGdmUmsTyxaym
xbridge-cli bridge create-account --from-locking --bridge bridge --from snqs2zzXuMA71w9isKHPTrvFn1HaJ --to rJdTJRJZ6GXCCRaamHJgEqVzB7Zy4557Pi --amount 10
xbridge-cli bridge transfer --bridge bridge --from-locking --amount 10 --from snqs2zzXuMA71w9isKHPTrvFn1HaJ --to snyEJjY2Xi5Dxdh81Jy9Mj3AiYRQM
xbridge-cli fund locking_chain rHLrQ3SjzxmkoYgrZ5d4kgHRPF6MdMWpAV
xbridge-cli bridge create-account --from-locking --bridge bridge --from sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --to rHLrQ3SjzxmkoYgrZ5d4kgHRPF6MdMWpAV --amount 100
xbridge-cli bridge transfer --bridge bridge --from-locking --amount 10 --from sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --to sEdTSHsMvrzomUN9uYgVEd64CEQqwo2
2 changes: 1 addition & 1 deletion scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ xbridge-cli server list
xbridge-cli explorer
xbridge-cli bridge build --name=bridge --fund-locking
xbridge-cli fund locking_chain rHLrQ3SjzxmkoYgrZ5d4kgHRPF6MdMWpAV
xbridge-cli bridge create-account --from-locking --bridge bridge --from sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --to rHLrQ3SjzxmkoYgrZ5d4kgHRPF6MdMWpAV --amount 10
xbridge-cli bridge create-account --from-locking --bridge bridge --from sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --to rHLrQ3SjzxmkoYgrZ5d4kgHRPF6MdMWpAV --amount 100
xbridge-cli bridge transfer --bridge bridge --from-locking --amount 10 --from sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --to sEdTSHsMvrzomUN9uYgVEd64CEQqwo2
6 changes: 3 additions & 3 deletions scripts/tutorial.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ xbridge-cli server list
read -p "Pausing... (hit enter to continue)"
xbridge-cli explorer
xbridge-cli bridge build --name=bridge --fund-locking
xbridge-cli fund locking_chain raFcdz1g8LWJDJWJE2ZKLRGdmUmsTyxaym
xbridge-cli bridge create-account --from-locking --bridge bridge --from snqs2zzXuMA71w9isKHPTrvFn1HaJ --to rJdTJRJZ6GXCCRaamHJgEqVzB7Zy4557Pi --amount 10
xbridge-cli bridge transfer --bridge bridge --from-locking --amount 10 --from snqs2zzXuMA71w9isKHPTrvFn1HaJ --to snyEJjY2Xi5Dxdh81Jy9Mj3AiYRQM --tutorial
xbridge-cli fund locking_chain rHLrQ3SjzxmkoYgrZ5d4kgHRPF6MdMWpAV
xbridge-cli bridge create-account --from-locking --bridge bridge --from sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --to rHLrQ3SjzxmkoYgrZ5d4kgHRPF6MdMWpAV --amount 100
xbridge-cli bridge transfer --bridge bridge --from-locking --amount 10 --from sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --to sEdTSHsMvrzomUN9uYgVEd64CEQqwo2 --tutorial
4 changes: 2 additions & 2 deletions tests/bridge/test_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_bridge_build(self):
],
"xchain_currencies": [{"currency": "XRP"}, {"currency": "XRP"}],
"signature_reward": "100",
"create_account_amounts": ["5000000", "5000000"],
"create_account_amounts": ["10000000", "10000000"],
}

assert config_result["bridges"][0] == expected_result
Expand Down Expand Up @@ -149,7 +149,7 @@ def test_bridge_prod_build_xrp(self):
],
"xchain_currencies": [{"currency": "XRP"}, {"currency": "XRP"}],
"signature_reward": "100",
"create_account_amounts": ["5000000", "5000000"],
"create_account_amounts": ["10000000", "10000000"],
}

assert config_result["bridges"][0] == expected_result
Expand Down
4 changes: 2 additions & 2 deletions tests/bridge/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_bridge_transfer(self):
"--to",
receive_wallet.classic_address,
"--amount",
"10",
"100",
"--verbose",
],
)
Expand Down Expand Up @@ -114,7 +114,7 @@ def test_bridge_transfer_prod(self):
"--to",
receive_wallet.classic_address,
"--amount",
"10",
"100",
"--verbose",
],
)
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ def _base_fixture():
assert stop_result.exit_code == 0, stop_result.output


@pytest.fixture(scope="class")
def basic():
_reset_cli_config()
_create_config_files()


@pytest.fixture(scope="class")
def runner():
with _base_fixture() as cli_runner:
Expand Down
2 changes: 2 additions & 0 deletions tests/server/test_basic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import pytest
from click.testing import CliRunner

from xbridge_cli.main import main


@pytest.mark.usefixtures("basic")
class TestBasicCreation:
def test_start_stop(self):
runner = CliRunner()
Expand Down
4 changes: 2 additions & 2 deletions xbridge_cli/bridge/transfer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""CLI command for setting up a bridge."""

from typing import Any, Dict, cast
from typing import Any, Dict, Union, cast

import click
from xrpl.clients import JsonRpcClient
Expand Down Expand Up @@ -109,7 +109,7 @@ def _submit_tx(
def send_transfer(
bridge: str,
from_locking: bool,
amount: int | float,
amount: Union[int, float],
from_account: str,
to_account: str,
close_ledgers: bool = True,
Expand Down
2 changes: 1 addition & 1 deletion xbridge_cli/misc/fund.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
help="Whether or not to print more verbose information.",
)
def fund_account(
chain: str, accounts: List[str], amount: int = 1000, verbose: bool = False
chain: str, accounts: List[str], amount: int = 10000, verbose: bool = False
) -> None:
"""
Of the form `xbridge-cli fund CHAIN ACCOUNT1 [ACCOUNT2 ...].
Expand Down
Loading

0 comments on commit 8c9088a

Please sign in to comment.