From 89a7a3805b3d435a275b2f6f96ab6659186fbc35 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 19:18:38 +0200 Subject: [PATCH 01/10] Test branch --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 68b06b9..96d9563 100644 --- a/README.md +++ b/README.md @@ -71,3 +71,10 @@ poetry shell ape test ``` +## More information + +- [Join Discord for any questions](https://tradingstrategy.ai/community). +- [Watch tutorials on YouTube](https://www.youtube.com/@tradingstrategyprotocol) +- [Follow on Twitter](https://twitter.com/TradingProtocol) +- [Follow on Telegram](https://t.me/trading_protocol) +- [Follow on LinkedIn](https://www.linkedin.com/company/trading-strategy/) From 26859feb8c481f41f6b0038fd28af767da3f5e90 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 19:20:28 +0200 Subject: [PATCH 02/10] Why does not it run --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7601d45..5ed66d3 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,3 +1,4 @@ +# Run ape test on Github CI name: Automated test suite on: @@ -19,12 +20,8 @@ jobs: cancel-in-progress: true steps: - # TODO: we only need contracts/aave-v3-deploy for tests - # but there does not seem to be an option to choose which submodules to checkout # https://github.com/actions/checkout - uses: actions/checkout@v3 - with: - submodules: true - name: Install poetry run: pipx install poetry - name: Set up Python 3.12 From c95aac248c3142a1e8b3e1bcf1cda4e08c5a895c Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 19:53:15 +0200 Subject: [PATCH 03/10] Make main branch default --- .github/workflows/test.yml | 4 ++-- README.md | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5ed66d3..ebebf5e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -3,9 +3,9 @@ name: Automated test suite on: push: - branches: [ master ] + branches: [ main ] pull_request: - branches: [ master ] + branches: [ main ] jobs: diff --git a/README.md b/README.md index 96d9563..adf21d3 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ has accepted the latest terms of service. - Record on-chain that users have accepted some sort of a disclaimer - Enforce users to accept disclaimers when they use with the smart contract +- User signs an [EIP-191 message](https://eips.ethereum.org/EIPS/eip-191) from their wallet +- Multisignature wallet and protocol friendly [EIP-1271](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/cryptography/SignatureChecker.sol) is supported ## Requirements From 77f54da1d5fe1e3642936a1928c85d78d5bca761 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 20:59:29 +0200 Subject: [PATCH 04/10] See if this fixes Github CI problem --- poetry.lock | 18 +++++++++++++++++- pyproject.toml | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/poetry.lock b/poetry.lock index 800e5dc..a5a8c31 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2960,6 +2960,22 @@ files = [ dev = ["Django (>=1.11)", "check-manifest", "colorama (<=0.4.1)", "coverage", "flake8", "nose2", "readme-renderer (<25.0)", "tox", "wheel", "zest.releaser[recommended]"] doc = ["Sphinx", "sphinx-rtd-theme"] +[[package]] +name = "setuptools" +version = "69.0.3" +description = "Easily download, build, install, upgrade, and uninstall Python packages" +optional = false +python-versions = ">=3.8" +files = [ + {file = "setuptools-69.0.3-py3-none-any.whl", hash = "sha256:385eb4edd9c9d5c17540511303e39a147ce2fc04bc55289c322b9e5904fe2c05"}, + {file = "setuptools-69.0.3.tar.gz", hash = "sha256:be1af57fc409f93647f2e8e4573a142ed38724b8cdd389706a867bb4efcf1e78"}, +] + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9.3)", "jaraco.tidelift (>=1.4)", "pygments-github-lexers (==0.0.5)", "rst.linker (>=1.9)", "sphinx (<7.2.5)", "sphinx (>=3.5)", "sphinx-favicon", "sphinx-inline-tabs", "sphinx-lint", "sphinx-notfound-page (>=1,<2)", "sphinx-reredirects", "sphinxcontrib-towncrier"] +testing = ["build[virtualenv]", "filelock (>=3.4.0)", "flake8-2020", "ini2toml[lite] (>=0.9)", "jaraco.develop (>=7.21)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "pip (>=19.1)", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=2.2)", "pytest-mypy (>=0.9.1)", "pytest-perf", "pytest-ruff", "pytest-timeout", "pytest-xdist", "tomli-w (>=1.0.0)", "virtualenv (>=13.0.0)", "wheel"] +testing-integration = ["build[virtualenv] (>=1.0.3)", "filelock (>=3.4.0)", "jaraco.envs (>=2.2)", "jaraco.path (>=3.2.0)", "packaging (>=23.1)", "pytest", "pytest-enabler", "pytest-xdist", "tomli", "virtualenv (>=13.0.0)", "wheel"] + [[package]] name = "six" version = "1.16.0" @@ -3573,4 +3589,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.10" -content-hash = "e85e046f95fa5f4622128f03a56dc646155752d66597c0fe4acbeef6694dd810" +content-hash = "4dd4bc2b2c74c66cd833d296dbc91df8142a64ea0a163914f2d5d1b0199cc3da" diff --git a/pyproject.toml b/pyproject.toml index 1c6d460..1f8369e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,6 +10,7 @@ packages = [{include = "terms_of_service"}] [tool.poetry.dependencies] python = "^3.10" eth-ape = "^0.7.3" +setuptools = "^69.0.3" [tool.poetry.group.dev.dependencies] From e26f9fc64cd0333c1a7db8b0a4617cf4e25f24a6 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 21:26:22 +0200 Subject: [PATCH 05/10] Figuring out Ape in CI --- .github/workflows/test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ebebf5e..8c71fba 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,6 +33,12 @@ jobs: run: | poetry env use '3.12' poetry install --all-extras + - name: Compile dependencies + run: | + ape pm compile + - name: Compile smart contracts + run: | + ape compile - name: Run test scripts run: | poetry run pytest From e62c9c1a9fb589f711c9fa9958e1b51bf6dca852 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 21:39:06 +0200 Subject: [PATCH 06/10] See if poetry prefix makes commands work --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c71fba..4d2d9d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,10 +35,10 @@ jobs: poetry install --all-extras - name: Compile dependencies run: | - ape pm compile + poetry run ape pm compile - name: Compile smart contracts run: | - ape compile + poetry run ape compile - name: Run test scripts run: | poetry run pytest From 525449a2484ef5b9d4a4aa0632d2142074cc9598 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 22:12:08 +0200 Subject: [PATCH 07/10] Install Ape plugins on Github CI --- .github/workflows/test.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4d2d9d1..1e59c29 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -29,11 +29,14 @@ jobs: with: python-version: '3.12' cache: 'poetry' - - name: Install dependencies + - name: Install Ape and dependencies run: | poetry env use '3.12' poetry install --all-extras - - name: Compile dependencies + - name: Install Ape plugins + run: | + poetry run ape plugins install . + - name: Compile smart contract packages run: | poetry run ape pm compile - name: Compile smart contracts From 2769ba62561170e8ceafa97c0ccd1621e3d3c35e Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 22:29:12 +0200 Subject: [PATCH 08/10] Fix tests --- .github/workflows/test.yml | 4 ++-- tests/test_update_terms_of_service.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1e59c29..f4f04f8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -36,10 +36,10 @@ jobs: - name: Install Ape plugins run: | poetry run ape plugins install . - - name: Compile smart contract packages + - name: Compile smart contract dependency packages run: | poetry run ape pm compile - - name: Compile smart contracts + - name: Compile our smart contracts run: | poetry run ape compile - name: Run test scripts diff --git a/tests/test_update_terms_of_service.py b/tests/test_update_terms_of_service.py index 4150776..fa8775e 100644 --- a/tests/test_update_terms_of_service.py +++ b/tests/test_update_terms_of_service.py @@ -26,7 +26,7 @@ def tos(networks, project, deployer): def test_start_zero_version(tos: ContractInstance): assert tos.latestTermsOfServiceVersion() == 0 - assert tos.latestTermsOfServiceHash() == HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000') + assert tos.latestAcceptanceMessageHash() == HexBytes('0x0000000000000000000000000000000000000000000000000000000000000000') def test_first_terms_of_service(tos: ContractInstance, deployer: TestAccount): @@ -34,13 +34,13 @@ def test_first_terms_of_service(tos: ContractInstance, deployer: TestAccount): new_hash = random.randbytes(32) tx = tos.updateTermsOfService(new_version, new_hash, sender=deployer) assert tos.latestTermsOfServiceVersion() == 1 - assert tos.latestTermsOfServiceHash() == new_hash + assert tos.latestAcceptanceMessageHash() == new_hash # https://academy.apeworx.io/articles/testing logs = list(tx.decode_logs(tos.UpdateTermsOfService)) assert len(logs) == 1 assert logs[0].version == new_version - assert logs[0].textHash == new_hash + assert logs[0].acceptanceMessageHash == new_hash assert tos.getTextHash(new_version) == new_hash @@ -50,13 +50,13 @@ def test_second_terms_of_service(tos: ContractInstance, deployer: TestAccount): new_hash = random.randbytes(32) tos.updateTermsOfService(new_version, new_hash, sender=deployer) assert tos.latestTermsOfServiceVersion() == 1 - assert tos.latestTermsOfServiceHash() == new_hash + assert tos.latestAcceptanceMessageHash() == new_hash new_version = 2 new_hash = random.randbytes(32) tos.updateTermsOfService(new_version, new_hash, sender=deployer) assert tos.latestTermsOfServiceVersion() == 2 - assert tos.latestTermsOfServiceHash() == new_hash + assert tos.latestAcceptanceMessageHash() == new_hash def test_wrong_owner(tos: ContractInstance, random_user: TestAccount): From f71ad414e809549b4dea500c25df6a81a417ff50 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 22:32:34 +0200 Subject: [PATCH 09/10] Change Poetry install recipe --- .github/workflows/test.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f4f04f8..83d2249 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,15 +20,18 @@ jobs: cancel-in-progress: true steps: - # https://github.com/actions/checkout - uses: actions/checkout@v3 - - name: Install poetry - run: pipx install poetry - name: Set up Python 3.12 - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: '3.12' cache: 'poetry' + - name: Install Poetry + uses: snok/install-poetry@v1 + with: + virtualenvs-create: true + virtualenvs-in-project: true + installer-parallel: true - name: Install Ape and dependencies run: | poetry env use '3.12' From 15ab29952a3293b425825921b923740b327bcc0e Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Mon, 8 Jan 2024 22:35:41 +0200 Subject: [PATCH 10/10] See if we can figure out Py 3.12 checkout --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 83d2249..b342047 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -20,12 +20,11 @@ jobs: cancel-in-progress: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python 3.12 uses: actions/setup-python@v4 with: python-version: '3.12' - cache: 'poetry' - name: Install Poetry uses: snok/install-poetry@v1 with: