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

Release v24.6.0 #651

Merged
merged 54 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
c0baa2f
v24.6 doc
YoshihitoAso Mar 30, 2024
5c3b270
Migrate to hardhat
purplesmoke05 Apr 3, 2024
4f43da0
Fix unit tests
purplesmoke05 Apr 3, 2024
f76da55
Fix docker compose command in github actions
purplesmoke05 Apr 3, 2024
d7354ca
fix tests
purplesmoke05 Apr 3, 2024
8a174e1
fix unit tests
purplesmoke05 Apr 4, 2024
e8b51dd
Merge pull request #612 from BoostryJP/feature/#609
YoshihitoAso Apr 4, 2024
85f4548
Upgrade python to 3.12
YoshihitoAso Apr 4, 2024
1f4cdbc
Merge pull request #614 from BoostryJP/feature/#613
YoshihitoAso Apr 5, 2024
99bf8d3
Support ibetSecurityToken v24.6
YoshihitoAso Apr 6, 2024
a9114ed
fix api documents
YoshihitoAso Apr 7, 2024
fd5ccf8
datetime.utcnow -> datetime.now(UTC)
YoshihitoAso Apr 8, 2024
f8687ac
fix
YoshihitoAso Apr 8, 2024
0542dd8
Merge pull request #615 from BoostryJP/feature/#610
YoshihitoAso Apr 8, 2024
8099124
Add an indexer of DVP delivery event
purplesmoke05 Apr 11, 2024
dbd17ff
Merge pull request #616 from BoostryJP/feature/#606_1
YoshihitoAso Apr 12, 2024
4aae313
Add API endpoints for DVP delivery operation
purplesmoke05 Apr 15, 2024
1af4dd4
Fix unused import
purplesmoke05 Apr 15, 2024
b4efbf9
Remove check logic of DVP agent account
purplesmoke05 Apr 15, 2024
0519218
Merge pull request #617 from BoostryJP/feature/#606_2
YoshihitoAso Apr 15, 2024
2d4f5a4
Add CLI tools for DVP delivery operation
purplesmoke05 Apr 18, 2024
15da04a
Fix
purplesmoke05 Apr 18, 2024
fc67dfb
Fixed to update token attributes of `require_personal_info_registered`
purplesmoke05 Apr 18, 2024
dbe15da
Merge pull request #621 from BoostryJP/fix/#619
YoshihitoAso Apr 19, 2024
dba7b5d
Merge pull request #618 from BoostryJP/feature/#606_3
YoshihitoAso Apr 19, 2024
2cb1f2d
Bump hardhat
YoshihitoAso Apr 21, 2024
cf71f88
Merge pull request #622 from BoostryJP/bump-hardhat
YoshihitoAso Apr 21, 2024
5c70cfe
Add query items to the transfer history API (#623)
YoshihitoAso Apr 23, 2024
e781dcc
Make it more precise about the value of `personal_info_not_registered…
purplesmoke05 Apr 23, 2024
b3d5fc8
Fix backward compatibility for some_personal_info_not_registered
YoshihitoAso May 1, 2024
7f30a5d
Merge pull request #626 from BoostryJP/fix-determination-registered
YoshihitoAso May 1, 2024
a440ced
Add personal info history API
YoshihitoAso May 14, 2024
2554e57
Add account_address filter
YoshihitoAso May 14, 2024
3c66f20
Merge pull request #628 from BoostryJP/feature/#627
YoshihitoAso May 14, 2024
2288607
Reuse imported RSA key to decode personal information (#629)
purplesmoke05 May 21, 2024
b1bbd7a
Bump packages
YoshihitoAso May 28, 2024
1161ada
Merge pull request #630 from BoostryJP/upgrade-uvicorn
YoshihitoAso May 29, 2024
f90ac41
Fix the logic of __get_personal_info used in ledger history API (#634)
purplesmoke05 May 31, 2024
63ed23f
Add memray (#635)
YoshihitoAso May 31, 2024
6148c61
Add query filter about amount+pending_transfer to ibet token holder API
purplesmoke05 Jun 3, 2024
e0d10ed
Merge pull request #636 from BoostryJP/feature/#631
YoshihitoAso Jun 3, 2024
c027f06
Store the block_timestamp of personal information as history data (#638)
purplesmoke05 Jun 5, 2024
9fc0812
Upgrade web3py to v7 (#639)
purplesmoke05 Jun 5, 2024
e170346
Fix the logic of __get_personal_info used in ledger history API (#641)
purplesmoke05 Jun 7, 2024
e63b624
Make it enable to search/sort with multibyte name on transfers list A…
purplesmoke05 Jun 11, 2024
22f0ed4
Reorganize test folder structure
purplesmoke05 Jun 12, 2024
e9d2175
Rename test files
purplesmoke05 Jun 12, 2024
d7b459b
Merge pull request #645 from BoostryJP/feature/#632
YoshihitoAso Jun 13, 2024
067ca35
Use COALESCE function on summed column to replace NULL with 0 (#648)
purplesmoke05 Jun 13, 2024
5bfa30a
Remove unnecessary debug print
purplesmoke05 Jun 18, 2024
90ab89d
Merge pull request #649 from BoostryJP/remove/debug-print
YoshihitoAso Jun 18, 2024
c2b361b
Suppress error logs raised by web3 module
purplesmoke05 Jun 24, 2024
65ad224
Merge pull request #650 from BoostryJP/fix/suppress-web3-req-logger
YoshihitoAso Jun 24, 2024
d2d83c7
Fix the number of poetry max workers (#652)
purplesmoke05 Jun 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.github/
.python-version
/node_modules/
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: run unit test using postgres
run: docker-compose run ibet-prime-postgres
run: docker compose run ibet-prime-postgres
migration-test-postgres:
name: 'Migration tests (PostgreSQL)'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: run unit test using postgres
run: docker-compose run ibet-prime-postgres bash --login -c "cd /app/ibet-Prime && pytest -vv --test-alembic -m 'alembic'"
run: docker compose run ibet-prime-postgres bash --login -c "cd /app/ibet-Prime && pytest -vv --test-alembic -m 'alembic'"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ __pycache__/
# pyenv
.python-version

# Node
node_modules/

# Intellij
.idea
/*.iml
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 24.1.1
rev: 24.4.2
hooks:
- id: black
language_version: python3.11
language_version: python3.12
13 changes: 7 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,16 @@ RUN echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~apl/.bash_profile \
# install python
USER apl
RUN . ~/.bash_profile \
&& pyenv install 3.11.2 \
&& pyenv global 3.11.2 \
&& pyenv install 3.12.2 \
&& pyenv global 3.12.2 \
&& pip install --upgrade pip setuptools

# install poetry
RUN . ~/.bash_profile \
&& python -m pip install poetry==1.7.1
&& python -m pip install poetry==1.8.2
RUN . ~/.bash_profile \
&& poetry config virtualenvs.create false
&& poetry config virtualenvs.create false \
&& poetry config installer.max-workers 1

# install python packages
USER root
Expand Down Expand Up @@ -88,10 +89,10 @@ COPY pyproject.toml /app/ibet-Prime/pyproject.toml
COPY poetry.lock /app/ibet-Prime/poetry.lock
RUN . ~/.bash_profile \
&& cd /app/ibet-Prime \
&& poetry install --only main --no-root -E ibet-explorer \
&& poetry install --only main --no-root --all-extras \
&& rm -f /app/ibet-Prime/pyproject.toml \
&& rm -f /app/ibet-Prime/poetry.lock
ENV PYTHONPATH /app/ibet-Prime
ENV PYTHONPATH /app/ibet-Prime:/app/ibet-Prime/cmd

# command deploy
USER apl
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.PHONY: isort black test run
.PHONY: format isort black doc test test_migrations run

install:
poetry install --no-root -E ibet-explorer
poetry install --no-root --all-extras
poetry run pre-commit install

update:
Expand All @@ -15,6 +15,9 @@ isort:
black:
black .

doc:
poetry run python docs/generate_openapi_doc.py

test:
pytest tests/

Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ibet-Prime

<p>
<img alt="Version" src="https://img.shields.io/badge/version-24.3-blue.svg?cacheSeconds=2592000" />
<img alt="Version" src="https://img.shields.io/badge/version-24.6-blue.svg?cacheSeconds=2592000" />
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
</p>

Expand All @@ -22,11 +22,11 @@ English | [日本語](./README_JA.md)

## Dependencies

- [Python3](https://www.python.org/downloads/release/python-3811/) - version 3.11
- [Python3](https://www.python.org/downloads/release/python-3811/) - version 3.12
- [PostgreSQL](https://www.postgresql.org/) - version 15
- [GoQuorum](https://github.com/ConsenSys/quorum)
- We support the official GoQuorum node of [ibet-Network](https://github.com/BoostryJP/ibet-Network).
- We use [ganache](https://github.com/trufflesuite/ganache) for local development and unit testing, and we use the latest version.
- We use [hardhat network](https://hardhat.org/hardhat-network/) for local development and unit testing, and we use the latest version.


## Supported ibet smart contract version
Expand All @@ -52,14 +52,19 @@ English | [日本語](./README_JA.md)

Install python packages with:
```bash
$ poetry install --no-root --only main -E ibet-explorer
$ poetry install --no-root --only main --all-extras
```

### Install pre-commit hook
```bash
$ poetry run pre-commit install
```

### Install hardhat
```bash
$ npm install
```

### Setting environment variables

The main environment variables are as follows.
Expand Down
13 changes: 9 additions & 4 deletions README_JA.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# ibet-Prime

<p>
<img alt="Version" src="https://img.shields.io/badge/version-24.3-blue.svg?cacheSeconds=2592000" />
<img alt="Version" src="https://img.shields.io/badge/version-24.6-blue.svg?cacheSeconds=2592000" />
<img alt="License: Apache--2.0" src="https://img.shields.io/badge/License-Apache--2.0-yellow.svg" />
</p>

Expand All @@ -23,11 +23,11 @@

## 依存

- [Python3](https://www.python.org/downloads/release/python-3811/) - バージョン 3.11
- [Python3](https://www.python.org/downloads/release/python-3811/) - バージョン 3.12
- [PostgreSQL](https://www.postgresql.org/) - バージョン 15
- [GoQuorum](https://github.com/ConsenSys/quorum)
- [ibet-Network](https://github.com/BoostryJP/ibet-Network) の公式の GoQuorum をサポートしています。
- 最新の [ganache](https://github.com/trufflesuite/ganache) (ganache-cli) をローカル開発およびユニットテストで利用しています。
- 最新の [hardhat network](https://hardhat.org/hardhat-network/) をローカル開発およびユニットテストで利用しています。

## コントラクトのバージョン

Expand All @@ -53,14 +53,19 @@

以下のコマンドで Python パッケージをインストールします。
```bash
$ poetry install --no-root --only main -E ibet-explorer
$ poetry install --no-root --only main --all-extras
```

### pre-commit hookのインストール
```bash
$ poetry run pre-commit install
```

### hardhatのインストール
```bash
$ npm install
```

### 環境変数の設定

主要な環境変数は以下の通りです。
Expand Down
9 changes: 9 additions & 0 deletions app/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ class Integer64bitLimitExceededError(AppError):
code = 5


class OperationNotSupportedVersionError(AppError):
"""
The token version for which the operation is not supported
"""

status_code = status.HTTP_400_BAD_REQUEST
code = 6


class OperationNotAllowedStateError(AppError):
"""
Error returned when server-side data is not ready to process the request
Expand Down
9 changes: 7 additions & 2 deletions app/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import logging
import sys
import urllib
from datetime import datetime
from datetime import UTC, datetime

from fastapi import Request, Response

Expand All @@ -34,6 +34,9 @@
ACCESS_LOG = logging.getLogger("issuer_api_access")
ACCESS_LOG.propagate = False

logging.getLogger("web3.manager.RequestManager").propagate = False
logging.getLogger("web3.manager.RequestManager").addHandler(logging.NullHandler())

INFO_FORMAT = "[%(asctime)s] {}[%(process)d] [%(levelname)s] %(message)s"
DEBUG_FORMAT = "[%(asctime)s] {}[%(process)d] [%(levelname)s] %(message)s [in %(pathname)s:%(lineno)d]"
TIMESTAMP_FORMAT = "%Y-%m-%d %H:%M:%S %z"
Expand Down Expand Up @@ -108,7 +111,9 @@ def output_access_log(req: Request, res: Response, request_start_time: datetime)
method = req.scope.get("method", "")
http_version = req.scope.get("http_version", "")
status_code = res.status_code
response_time = (datetime.utcnow() - request_start_time).total_seconds()
response_time = (
datetime.now(UTC).replace(tzinfo=None) - request_start_time
).total_seconds()
access_msg = ACCESS_FORMAT % (
method,
url,
Expand Down
22 changes: 18 additions & 4 deletions app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
SPDX-License-Identifier: Apache-2.0
"""

from datetime import datetime
from datetime import UTC, datetime

from fastapi import FastAPI, Request
from fastapi.encoders import jsonable_encoder
Expand All @@ -40,6 +40,7 @@
ledger,
notification,
position,
settlement,
share,
token_holders,
)
Expand All @@ -62,7 +63,7 @@
app = FastAPI(
title="ibet Prime",
description="Security token management system for ibet network",
version="24.3.0",
version="24.6",
contact={"email": "dev@boostry.co.jp"},
license_info={
"name": "Apache 2.0",
Expand All @@ -74,7 +75,7 @@

@app.middleware("http")
async def api_call_handler(request: Request, call_next):
request_start_time = datetime.utcnow()
request_start_time = datetime.now(UTC).replace(tzinfo=None)
response = await call_next(request)
output_access_log(request, response, request_start_time)
return response
Expand Down Expand Up @@ -105,6 +106,7 @@ async def root():
app.include_router(token_holders.router)
app.include_router(bc_explorer.router)
app.include_router(freeze_log.router)
app.include_router(settlement.router)


###############################################################
Expand Down Expand Up @@ -206,7 +208,7 @@ async def response_limit_exceeded_error_handler(
)


# 400:ResponseLimitExceededError
# 400:Integer64bitLimitExceededError
@app.exception_handler(Integer64bitLimitExceededError)
async def response_limit_exceeded_error_handler(
request: Request, exc: Integer64bitLimitExceededError
Expand All @@ -218,6 +220,18 @@ async def response_limit_exceeded_error_handler(
)


# 400:OperationNotSupportedVersionError
@app.exception_handler(OperationNotSupportedVersionError)
async def operation_not_supported_version_error_handler(
request: Request, exc: OperationNotSupportedVersionError
):
meta = {"code": 6, "title": "OperationNotSupportedVersionError"}
return JSONResponse(
status_code=exc.status_code,
content=jsonable_encoder({"meta": meta, "detail": exc.args[0]}),
)


# 400:OperationNotAllowedStateError
@app.exception_handler(OperationNotAllowedStateError)
async def operation_not_permitted_error_handler(
Expand Down
26 changes: 26 additions & 0 deletions app/model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
SPDX-License-Identifier: Apache-2.0
"""

from datetime import datetime
from typing import Annotated, Any

from pydantic import WrapValidator
Expand All @@ -37,3 +38,28 @@ def ethereum_address_validator(


EthereumAddress = Annotated[str, WrapValidator(ethereum_address_validator)]


def datetime_string_validator(
value: Any, handler: ValidatorFunctionWrapHandler, *args, **kwargs
):
"""Validate string datetime format

- %Y/%m/%d %H:%M:%S
"""
if value is not None:
datetime_format = "%Y-%m-%d %H:%M:%S"

if not isinstance(value, str):
raise ValueError(f"value must be of string datetime format")

try:
converted = datetime.strptime(value, datetime_format)
if value != converted.strftime(datetime_format):
raise ValueError(f"value must be string datetime format")
except ValueError:
raise ValueError(f"value must be of string datetime format")
return value


ValidatedDatetimeStr = Annotated[str, WrapValidator(datetime_string_validator)]
2 changes: 1 addition & 1 deletion app/model/blockchain/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from .e2e_messaging import E2EMessaging
from .exchange import IbetExchangeInterface, IbetSecurityTokenEscrow
from .freeze_log import FreezeLogContract
from .personal_info import PersonalInfoContract
from .personal_info import ContractPersonalInfoType, PersonalInfoContract
from .token import (
IbetSecurityTokenInterface,
IbetShareContract,
Expand Down
Loading
Loading