Merge branch 'master' into bvander/cic-eth-base-image-and-testing
This commit is contained in:
commit
8b7a26abb9
@ -4,32 +4,41 @@
|
|||||||
DOCKERFILE_PATH: docker/Dockerfile_ci
|
DOCKERFILE_PATH: docker/Dockerfile_ci
|
||||||
CONTEXT: $CI_PROJECT_DIR/apps/$APP_NAME
|
CONTEXT: $CI_PROJECT_DIR/apps/$APP_NAME
|
||||||
|
|
||||||
.cic_eth_changes_target:
|
.cic_eth_mr_changes_target:
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
#changes:
|
changes:
|
||||||
#- $CONTEXT/$APP_NAME/**/*
|
- $CONTEXT/$APP_NAME/**/*
|
||||||
when: always
|
when: always
|
||||||
|
|
||||||
build-mr-cic-eth:
|
build-mr-cic-eth:
|
||||||
extends:
|
extends:
|
||||||
- .cic_eth_variables
|
- .cic_eth_variables
|
||||||
|
<<<<<<< HEAD
|
||||||
- .cic_eth_changes_target
|
- .cic_eth_changes_target
|
||||||
- .py_build_target_dev
|
- .py_build_target_dev
|
||||||
|
=======
|
||||||
|
- .cic_eth_mr_changes_target
|
||||||
|
- .py_build_target_test
|
||||||
|
>>>>>>> master
|
||||||
|
|
||||||
test-mr-cic-eth:
|
test-mr-cic-eth:
|
||||||
stage: test
|
stage: test
|
||||||
extends:
|
extends:
|
||||||
- .cic_eth_variables
|
- .cic_eth_variables
|
||||||
|
<<<<<<< HEAD
|
||||||
- .cic_eth_changes_target
|
- .cic_eth_changes_target
|
||||||
image: $MR_IMAGE_TAG
|
image: $MR_IMAGE_TAG
|
||||||
|
=======
|
||||||
|
- .cic_eth_mr_changes_target
|
||||||
|
stage: test
|
||||||
|
image: $IMAGE_TAG_BASE
|
||||||
|
>>>>>>> master
|
||||||
script:
|
script:
|
||||||
- cd apps/$APP_NAME/
|
- cd apps/$APP_NAME/
|
||||||
- pip install -r test_requirements.txt
|
- pip install -r test_requirements.txt
|
||||||
- pytest -x --cov=cic_eth --cov-fail-under=90 --cov-report term-missing tests
|
- pytest -x --cov=cic_eth --cov-fail-under=90 --cov-report term-missing tests
|
||||||
needs: ["build-mr-cic-eth"]
|
|
||||||
|
|
||||||
build-push-cic-eth:
|
build-push-cic-eth:
|
||||||
extends:
|
extends:
|
||||||
- .py_build_push
|
- .py_build_push
|
||||||
- .cic_eth_variables
|
|
||||||
|
5
apps/cic-eth/admin_requirements.txt
Normal file
5
apps/cic-eth/admin_requirements.txt
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
SQLAlchemy==1.3.20
|
||||||
|
cic-eth-registry~=0.5.6a1
|
||||||
|
hexathon~=0.0.1a7
|
||||||
|
chainqueue~=0.0.2b5
|
||||||
|
eth-erc20==0.0.10a2
|
@ -5,4 +5,3 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from .api_task import Api
|
from .api_task import Api
|
||||||
from .api_admin import AdminApi
|
|
||||||
|
@ -8,11 +8,10 @@ import logging
|
|||||||
|
|
||||||
# external imports
|
# external imports
|
||||||
import celery
|
import celery
|
||||||
from cic_eth_registry import CICRegistry
|
|
||||||
from chainlib.chain import ChainSpec
|
from chainlib.chain import ChainSpec
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.db.enum import LockEnum
|
from cic_eth.enum import LockEnum
|
||||||
|
|
||||||
app = celery.current_app
|
app = celery.current_app
|
||||||
|
|
||||||
|
@ -1,158 +1 @@
|
|||||||
# standard imports
|
from cic_eth.enum import *
|
||||||
import enum
|
|
||||||
|
|
||||||
|
|
||||||
@enum.unique
|
|
||||||
class StatusBits(enum.IntEnum):
|
|
||||||
"""Individual bit flags that are combined to define the state and legacy of a queued transaction
|
|
||||||
|
|
||||||
"""
|
|
||||||
QUEUED = 0x01 # transaction should be sent to network
|
|
||||||
IN_NETWORK = 0x08 # transaction is in network
|
|
||||||
|
|
||||||
DEFERRED = 0x10 # an attempt to send the transaction to network has failed
|
|
||||||
GAS_ISSUES = 0x20 # transaction is pending sender account gas funding
|
|
||||||
|
|
||||||
LOCAL_ERROR = 0x100 # errors that originate internally from the component
|
|
||||||
NODE_ERROR = 0x200 # errors originating in the node (invalid RLP input...)
|
|
||||||
NETWORK_ERROR = 0x400 # errors that originate from the network (REVERT)
|
|
||||||
UNKNOWN_ERROR = 0x800 # unclassified errors (the should not occur)
|
|
||||||
|
|
||||||
FINAL = 0x1000 # transaction processing has completed
|
|
||||||
OBSOLETE = 0x2000 # transaction has been replaced by a different transaction with higher fee
|
|
||||||
MANUAL = 0x8000 # transaction processing has been manually overridden
|
|
||||||
|
|
||||||
|
|
||||||
@enum.unique
|
|
||||||
class StatusEnum(enum.IntEnum):
|
|
||||||
"""
|
|
||||||
|
|
||||||
- Inactive, not finalized. (<0)
|
|
||||||
* PENDING: The initial state of a newly added transaction record. No action has been performed on this transaction yet.
|
|
||||||
* SENDFAIL: The transaction was not received by the node.
|
|
||||||
* RETRY: The transaction is queued for a new send attempt after previously failing.
|
|
||||||
* READYSEND: The transaction is queued for its first send attempt
|
|
||||||
* OBSOLETED: A new transaction with the same nonce and higher gas has been sent to network.
|
|
||||||
* WAITFORGAS: The transaction is on hold pending gas funding.
|
|
||||||
- Active state: (==0)
|
|
||||||
* SENT: The transaction has been sent to the mempool.
|
|
||||||
- Inactive, finalized. (>0)
|
|
||||||
* FUBAR: Unknown error occurred and transaction is abandoned. Manual intervention needed.
|
|
||||||
* CANCELLED: The transaction was sent, but was not mined and has disappered from the mempool. This usually follows a transaction being obsoleted.
|
|
||||||
* OVERRIDDEN: Transaction has been manually overriden.
|
|
||||||
* REJECTED: The transaction was rejected by the node.
|
|
||||||
* REVERTED: The transaction was mined, but exception occurred during EVM execution. (Block number will be set)
|
|
||||||
* SUCCESS: THe transaction was successfully mined. (Block number will be set)
|
|
||||||
|
|
||||||
"""
|
|
||||||
PENDING = 0
|
|
||||||
|
|
||||||
SENDFAIL = StatusBits.DEFERRED | StatusBits.LOCAL_ERROR
|
|
||||||
RETRY = StatusBits.QUEUED | StatusBits.DEFERRED
|
|
||||||
READYSEND = StatusBits.QUEUED
|
|
||||||
|
|
||||||
OBSOLETED = StatusBits.OBSOLETE | StatusBits.IN_NETWORK
|
|
||||||
|
|
||||||
WAITFORGAS = StatusBits.GAS_ISSUES
|
|
||||||
|
|
||||||
SENT = StatusBits.IN_NETWORK
|
|
||||||
FUBAR = StatusBits.FINAL | StatusBits.UNKNOWN_ERROR
|
|
||||||
CANCELLED = StatusBits.IN_NETWORK | StatusBits.FINAL | StatusBits.OBSOLETE
|
|
||||||
OVERRIDDEN = StatusBits.FINAL | StatusBits.OBSOLETE | StatusBits.MANUAL
|
|
||||||
|
|
||||||
REJECTED = StatusBits.NODE_ERROR | StatusBits.FINAL
|
|
||||||
REVERTED = StatusBits.IN_NETWORK | StatusBits.FINAL | StatusBits.NETWORK_ERROR
|
|
||||||
SUCCESS = StatusBits.IN_NETWORK | StatusBits.FINAL
|
|
||||||
|
|
||||||
|
|
||||||
@enum.unique
|
|
||||||
class LockEnum(enum.IntEnum):
|
|
||||||
"""
|
|
||||||
STICKY: When set, reset is not possible
|
|
||||||
CREATE: Disable creation of accounts
|
|
||||||
SEND: Disable sending to network
|
|
||||||
QUEUE: Disable queueing new or modified transactions
|
|
||||||
"""
|
|
||||||
STICKY=1
|
|
||||||
INIT=2
|
|
||||||
CREATE=4
|
|
||||||
SEND=8
|
|
||||||
QUEUE=16
|
|
||||||
QUERY=32
|
|
||||||
ALL=int(0xfffffffffffffffe)
|
|
||||||
|
|
||||||
|
|
||||||
def status_str(v, bits_only=False):
|
|
||||||
"""Render a human-readable string describing the status
|
|
||||||
|
|
||||||
If the bit field exactly matches a StatusEnum value, the StatusEnum label will be returned.
|
|
||||||
|
|
||||||
If a StatusEnum cannot be matched, the string will be postfixed with "*", unless explicitly instructed to return bit field labels only.
|
|
||||||
|
|
||||||
:param v: Status bit field
|
|
||||||
:type v: number
|
|
||||||
:param bits_only: Only render individual bit labels.
|
|
||||||
:type bits_only: bool
|
|
||||||
:returns: Status string
|
|
||||||
:rtype: str
|
|
||||||
"""
|
|
||||||
s = ''
|
|
||||||
if not bits_only:
|
|
||||||
try:
|
|
||||||
s = StatusEnum(v).name
|
|
||||||
return s
|
|
||||||
except ValueError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if v == 0:
|
|
||||||
return 'NONE'
|
|
||||||
|
|
||||||
for i in range(16):
|
|
||||||
b = (1 << i)
|
|
||||||
if (b & 0xffff) & v:
|
|
||||||
n = StatusBits(b).name
|
|
||||||
if len(s) > 0:
|
|
||||||
s += ','
|
|
||||||
s += n
|
|
||||||
if not bits_only:
|
|
||||||
s += '*'
|
|
||||||
return s
|
|
||||||
|
|
||||||
|
|
||||||
def all_errors():
|
|
||||||
"""Bit mask of all error states
|
|
||||||
|
|
||||||
:returns: Error flags
|
|
||||||
:rtype: number
|
|
||||||
"""
|
|
||||||
return StatusBits.LOCAL_ERROR | StatusBits.NODE_ERROR | StatusBits.NETWORK_ERROR | StatusBits.UNKNOWN_ERROR
|
|
||||||
|
|
||||||
|
|
||||||
def is_error_status(v):
|
|
||||||
"""Check if value is an error state
|
|
||||||
|
|
||||||
:param v: Status bit field
|
|
||||||
:type v: number
|
|
||||||
:returns: True if error
|
|
||||||
:rtype: bool
|
|
||||||
"""
|
|
||||||
return bool(v & all_errors())
|
|
||||||
|
|
||||||
|
|
||||||
def dead():
|
|
||||||
"""Bit mask defining whether a transaction is still likely to be processed on the network.
|
|
||||||
|
|
||||||
:returns: Bit mask
|
|
||||||
:rtype: number
|
|
||||||
"""
|
|
||||||
return StatusBits.FINAL | StatusBits.OBSOLETE
|
|
||||||
|
|
||||||
|
|
||||||
def is_alive(v):
|
|
||||||
"""Check if transaction is still likely to be processed on the network.
|
|
||||||
|
|
||||||
The contingency of "likely" refers to the case a transaction has been obsoleted after sent to the network, but the network still confirms the obsoleted transaction. The return value of this method will not change as a result of this, BUT the state itself will (as the FINAL bit will be set).
|
|
||||||
|
|
||||||
:returns:
|
|
||||||
"""
|
|
||||||
return bool(v & dead() == 0)
|
|
||||||
|
158
apps/cic-eth/cic_eth/enum.py
Normal file
158
apps/cic-eth/cic_eth/enum.py
Normal file
@ -0,0 +1,158 @@
|
|||||||
|
# standard imports
|
||||||
|
import enum
|
||||||
|
|
||||||
|
|
||||||
|
@enum.unique
|
||||||
|
class StatusBits(enum.IntEnum):
|
||||||
|
"""Individual bit flags that are combined to define the state and legacy of a queued transaction
|
||||||
|
|
||||||
|
"""
|
||||||
|
QUEUED = 0x01 # transaction should be sent to network
|
||||||
|
IN_NETWORK = 0x08 # transaction is in network
|
||||||
|
|
||||||
|
DEFERRED = 0x10 # an attempt to send the transaction to network has failed
|
||||||
|
GAS_ISSUES = 0x20 # transaction is pending sender account gas funding
|
||||||
|
|
||||||
|
LOCAL_ERROR = 0x100 # errors that originate internally from the component
|
||||||
|
NODE_ERROR = 0x200 # errors originating in the node (invalid RLP input...)
|
||||||
|
NETWORK_ERROR = 0x400 # errors that originate from the network (REVERT)
|
||||||
|
UNKNOWN_ERROR = 0x800 # unclassified errors (the should not occur)
|
||||||
|
|
||||||
|
FINAL = 0x1000 # transaction processing has completed
|
||||||
|
OBSOLETE = 0x2000 # transaction has been replaced by a different transaction with higher fee
|
||||||
|
MANUAL = 0x8000 # transaction processing has been manually overridden
|
||||||
|
|
||||||
|
|
||||||
|
@enum.unique
|
||||||
|
class StatusEnum(enum.IntEnum):
|
||||||
|
"""
|
||||||
|
|
||||||
|
- Inactive, not finalized. (<0)
|
||||||
|
* PENDING: The initial state of a newly added transaction record. No action has been performed on this transaction yet.
|
||||||
|
* SENDFAIL: The transaction was not received by the node.
|
||||||
|
* RETRY: The transaction is queued for a new send attempt after previously failing.
|
||||||
|
* READYSEND: The transaction is queued for its first send attempt
|
||||||
|
* OBSOLETED: A new transaction with the same nonce and higher gas has been sent to network.
|
||||||
|
* WAITFORGAS: The transaction is on hold pending gas funding.
|
||||||
|
- Active state: (==0)
|
||||||
|
* SENT: The transaction has been sent to the mempool.
|
||||||
|
- Inactive, finalized. (>0)
|
||||||
|
* FUBAR: Unknown error occurred and transaction is abandoned. Manual intervention needed.
|
||||||
|
* CANCELLED: The transaction was sent, but was not mined and has disappered from the mempool. This usually follows a transaction being obsoleted.
|
||||||
|
* OVERRIDDEN: Transaction has been manually overriden.
|
||||||
|
* REJECTED: The transaction was rejected by the node.
|
||||||
|
* REVERTED: The transaction was mined, but exception occurred during EVM execution. (Block number will be set)
|
||||||
|
* SUCCESS: THe transaction was successfully mined. (Block number will be set)
|
||||||
|
|
||||||
|
"""
|
||||||
|
PENDING = 0
|
||||||
|
|
||||||
|
SENDFAIL = StatusBits.DEFERRED | StatusBits.LOCAL_ERROR
|
||||||
|
RETRY = StatusBits.QUEUED | StatusBits.DEFERRED
|
||||||
|
READYSEND = StatusBits.QUEUED
|
||||||
|
|
||||||
|
OBSOLETED = StatusBits.OBSOLETE | StatusBits.IN_NETWORK
|
||||||
|
|
||||||
|
WAITFORGAS = StatusBits.GAS_ISSUES
|
||||||
|
|
||||||
|
SENT = StatusBits.IN_NETWORK
|
||||||
|
FUBAR = StatusBits.FINAL | StatusBits.UNKNOWN_ERROR
|
||||||
|
CANCELLED = StatusBits.IN_NETWORK | StatusBits.FINAL | StatusBits.OBSOLETE
|
||||||
|
OVERRIDDEN = StatusBits.FINAL | StatusBits.OBSOLETE | StatusBits.MANUAL
|
||||||
|
|
||||||
|
REJECTED = StatusBits.NODE_ERROR | StatusBits.FINAL
|
||||||
|
REVERTED = StatusBits.IN_NETWORK | StatusBits.FINAL | StatusBits.NETWORK_ERROR
|
||||||
|
SUCCESS = StatusBits.IN_NETWORK | StatusBits.FINAL
|
||||||
|
|
||||||
|
|
||||||
|
@enum.unique
|
||||||
|
class LockEnum(enum.IntEnum):
|
||||||
|
"""
|
||||||
|
STICKY: When set, reset is not possible
|
||||||
|
CREATE: Disable creation of accounts
|
||||||
|
SEND: Disable sending to network
|
||||||
|
QUEUE: Disable queueing new or modified transactions
|
||||||
|
"""
|
||||||
|
STICKY=1
|
||||||
|
INIT=2
|
||||||
|
CREATE=4
|
||||||
|
SEND=8
|
||||||
|
QUEUE=16
|
||||||
|
QUERY=32
|
||||||
|
ALL=int(0xfffffffffffffffe)
|
||||||
|
|
||||||
|
|
||||||
|
def status_str(v, bits_only=False):
|
||||||
|
"""Render a human-readable string describing the status
|
||||||
|
|
||||||
|
If the bit field exactly matches a StatusEnum value, the StatusEnum label will be returned.
|
||||||
|
|
||||||
|
If a StatusEnum cannot be matched, the string will be postfixed with "*", unless explicitly instructed to return bit field labels only.
|
||||||
|
|
||||||
|
:param v: Status bit field
|
||||||
|
:type v: number
|
||||||
|
:param bits_only: Only render individual bit labels.
|
||||||
|
:type bits_only: bool
|
||||||
|
:returns: Status string
|
||||||
|
:rtype: str
|
||||||
|
"""
|
||||||
|
s = ''
|
||||||
|
if not bits_only:
|
||||||
|
try:
|
||||||
|
s = StatusEnum(v).name
|
||||||
|
return s
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
if v == 0:
|
||||||
|
return 'NONE'
|
||||||
|
|
||||||
|
for i in range(16):
|
||||||
|
b = (1 << i)
|
||||||
|
if (b & 0xffff) & v:
|
||||||
|
n = StatusBits(b).name
|
||||||
|
if len(s) > 0:
|
||||||
|
s += ','
|
||||||
|
s += n
|
||||||
|
if not bits_only:
|
||||||
|
s += '*'
|
||||||
|
return s
|
||||||
|
|
||||||
|
|
||||||
|
def all_errors():
|
||||||
|
"""Bit mask of all error states
|
||||||
|
|
||||||
|
:returns: Error flags
|
||||||
|
:rtype: number
|
||||||
|
"""
|
||||||
|
return StatusBits.LOCAL_ERROR | StatusBits.NODE_ERROR | StatusBits.NETWORK_ERROR | StatusBits.UNKNOWN_ERROR
|
||||||
|
|
||||||
|
|
||||||
|
def is_error_status(v):
|
||||||
|
"""Check if value is an error state
|
||||||
|
|
||||||
|
:param v: Status bit field
|
||||||
|
:type v: number
|
||||||
|
:returns: True if error
|
||||||
|
:rtype: bool
|
||||||
|
"""
|
||||||
|
return bool(v & all_errors())
|
||||||
|
|
||||||
|
|
||||||
|
def dead():
|
||||||
|
"""Bit mask defining whether a transaction is still likely to be processed on the network.
|
||||||
|
|
||||||
|
:returns: Bit mask
|
||||||
|
:rtype: number
|
||||||
|
"""
|
||||||
|
return StatusBits.FINAL | StatusBits.OBSOLETE
|
||||||
|
|
||||||
|
|
||||||
|
def is_alive(v):
|
||||||
|
"""Check if transaction is still likely to be processed on the network.
|
||||||
|
|
||||||
|
The contingency of "likely" refers to the case a transaction has been obsoleted after sent to the network, but the network still confirms the obsoleted transaction. The return value of this method will not change as a result of this, BUT the state itself will (as the FINAL bit will be set).
|
||||||
|
|
||||||
|
:returns:
|
||||||
|
"""
|
||||||
|
return bool(v & dead() == 0)
|
@ -12,7 +12,7 @@ from chainlib.eth.constant import ZERO_ADDRESS
|
|||||||
from chainlib.eth.address import is_checksum_address
|
from chainlib.eth.address import is_checksum_address
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.api import AdminApi
|
from cic_eth.api.admin import AdminApi
|
||||||
from cic_eth.db.enum import LockEnum
|
from cic_eth.db.enum import LockEnum
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
|
@ -12,10 +12,8 @@ import confini
|
|||||||
import celery
|
import celery
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.api import (
|
from cic_eth.api import Api
|
||||||
Api,
|
from cic_eth.api.admin import AdminApi
|
||||||
AdminApi,
|
|
||||||
)
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
@ -11,7 +11,7 @@ from chainlib.chain import ChainSpec
|
|||||||
from chainlib.eth.connection import EthHTTPConnection
|
from chainlib.eth.connection import EthHTTPConnection
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.api.api_admin import AdminApi
|
from cic_eth.api.admin import AdminApi
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
@ -12,7 +12,7 @@ from chainlib.chain import ChainSpec
|
|||||||
from xdg.BaseDirectory import xdg_config_home
|
from xdg.BaseDirectory import xdg_config_home
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.api import AdminApi
|
from cic_eth.api.admin import AdminApi
|
||||||
from cic_eth.db import dsn_from_config
|
from cic_eth.db import dsn_from_config
|
||||||
from cic_eth.db.models.base import SessionBase
|
from cic_eth.db.models.base import SessionBase
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ from chainlib.eth.connection import EthHTTPConnection
|
|||||||
from hexathon import add_0x
|
from hexathon import add_0x
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.api import AdminApi
|
from cic_eth.api.admin import AdminApi
|
||||||
from cic_eth.db.enum import (
|
from cic_eth.db.enum import (
|
||||||
StatusEnum,
|
StatusEnum,
|
||||||
status_str,
|
status_str,
|
||||||
|
@ -8,9 +8,9 @@ import semver
|
|||||||
|
|
||||||
version = (
|
version = (
|
||||||
0,
|
0,
|
||||||
11,
|
12,
|
||||||
1,
|
0,
|
||||||
'alpha.3',
|
'alpha.1',
|
||||||
)
|
)
|
||||||
|
|
||||||
version_object = semver.VersionInfo(
|
version_object = semver.VersionInfo(
|
||||||
|
@ -1,25 +1,3 @@
|
|||||||
cic-base==0.1.3a3+build.984b5cff
|
|
||||||
celery==4.4.7
|
celery==4.4.7
|
||||||
crypto-dev-signer~=0.4.14b6
|
chainlib~=0.0.5a1
|
||||||
confini~=0.3.6rc3
|
|
||||||
cic-eth-registry~=0.5.6a1
|
|
||||||
redis==3.5.3
|
|
||||||
alembic==1.4.2
|
|
||||||
websockets==8.1
|
|
||||||
requests~=2.24.0
|
|
||||||
eth_accounts_index~=0.0.12a1
|
|
||||||
erc20-transfer-authorization~=0.3.2a1
|
|
||||||
uWSGI==2.0.19.1
|
|
||||||
semver==2.13.0
|
semver==2.13.0
|
||||||
websocket-client==0.57.0
|
|
||||||
moolb~=0.1.1b2
|
|
||||||
eth-address-index~=0.1.2a1
|
|
||||||
chainlib-eth~=0.0.5a1
|
|
||||||
hexathon~=0.0.1a7
|
|
||||||
chainsyncer[sql]~=0.0.3a3
|
|
||||||
chainqueue~=0.0.2b5
|
|
||||||
sarafu-faucet~=0.0.4a1
|
|
||||||
erc20-faucet~=0.2.2a1
|
|
||||||
coincurve==15.0.0
|
|
||||||
potaahto~=0.0.1a2
|
|
||||||
pycryptodome==3.10.1
|
|
||||||
|
7
apps/cic-eth/services_requirements.txt
Normal file
7
apps/cic-eth/services_requirements.txt
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
chainsyncer[sql]~=0.0.3a3
|
||||||
|
chainqueue~=0.0.2b5
|
||||||
|
alembic==1.4.2
|
||||||
|
confini~=0.3.6rc4
|
||||||
|
redis==3.5.3
|
||||||
|
hexathon~=0.0.1a7
|
||||||
|
pycryptodome==3.10.1
|
@ -45,16 +45,16 @@ scripts =
|
|||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
console_scripts =
|
console_scripts =
|
||||||
# daemons
|
# daemons
|
||||||
cic-eth-taskerd = cic_eth.runnable.daemons.tasker:main
|
cic-eth-taskerd = cic_eth.runnable.daemons.tasker:main [services]
|
||||||
cic-eth-trackerd = cic_eth.runnable.daemons.tracker:main
|
cic-eth-trackerd = cic_eth.runnable.daemons.tracker:main [services]
|
||||||
cic-eth-dispatcherd = cic_eth.runnable.daemons.dispatcher:main
|
cic-eth-dispatcherd = cic_eth.runnable.daemons.dispatcher:main [services]
|
||||||
cic-eth-retrierd = cic_eth.runnable.daemons.retry:main
|
cic-eth-retrierd = cic_eth.runnable.daemons.retry:main [services]
|
||||||
# tools
|
# tools
|
||||||
cic-eth-create = cic_eth.runnable.create:main
|
cic-eth-create = cic_eth.runnable.create:main [tools]
|
||||||
cic-eth-inspect = cic_eth.runnable.view:main
|
cic-eth-inspect = cic_eth.runnable.view:main [tools]
|
||||||
cic-eth-ctl = cic_eth.runnable.ctrl:main
|
cic-eth-ctl = cic_eth.runnable.ctrl:main [tools]
|
||||||
cic-eth-info = cic_eth.runnable.info:main
|
cic-eth-info = cic_eth.runnable.info:main [tools]
|
||||||
# TODO: Merge this with ctl when subcmds sorted to submodules
|
# TODO: Merge this with ctl when subcmds sorted to submodules
|
||||||
cic-eth-tag = cic_eth.runnable.tag:main
|
cic-eth-tag = cic_eth.runnable.tag:main [tools]
|
||||||
cic-eth-resend = cic_eth.runnable.resend:main
|
cic-eth-resend = cic_eth.runnable.resend:main [tools]
|
||||||
cic-eth-transfer = cic_eth.runnable.transfer:main
|
cic-eth-transfer = cic_eth.runnable.transfer:main [tools]
|
||||||
|
@ -11,6 +11,41 @@ while True:
|
|||||||
requirements.append(l.rstrip())
|
requirements.append(l.rstrip())
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
admin_requirements = []
|
||||||
|
f = open('admin_requirements.txt', 'r')
|
||||||
|
while True:
|
||||||
|
l = f.readline()
|
||||||
|
if l == '':
|
||||||
|
break
|
||||||
|
admin_requirements.append(l.rstrip())
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tools_requirements = []
|
||||||
|
f = open('tools_requirements.txt', 'r')
|
||||||
|
while True:
|
||||||
|
l = f.readline()
|
||||||
|
if l == '':
|
||||||
|
break
|
||||||
|
tools_requirements.append(l.rstrip())
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
services_requirements = []
|
||||||
|
f = open('services_requirements.txt', 'r')
|
||||||
|
while True:
|
||||||
|
l = f.readline()
|
||||||
|
if l == '':
|
||||||
|
break
|
||||||
|
services_requirements.append(l.rstrip())
|
||||||
|
f.close()
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
install_requires=requirements
|
install_requires=requirements,
|
||||||
|
extras_require = {
|
||||||
|
'tools': tools_requirements,
|
||||||
|
'admin_api': admin_requirements,
|
||||||
|
'services': services_requirements,
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
@ -2,6 +2,8 @@ pytest==6.0.1
|
|||||||
pytest-celery==0.0.0a1
|
pytest-celery==0.0.0a1
|
||||||
pytest-mock==3.3.1
|
pytest-mock==3.3.1
|
||||||
pytest-cov==2.10.1
|
pytest-cov==2.10.1
|
||||||
|
pytest-redis==2.0.0
|
||||||
|
redis==3.5.3
|
||||||
eth-tester==0.5.0b3
|
eth-tester==0.5.0b3
|
||||||
py-evm==0.3.0a20
|
py-evm==0.3.0a20
|
||||||
eth-erc20==0.0.10a2
|
eth-erc20~=0.0.10a2
|
||||||
|
@ -40,7 +40,7 @@ from chainqueue.sql.query import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.api import AdminApi
|
from cic_eth.api.admin import AdminApi
|
||||||
from cic_eth.db.models.role import AccountRole
|
from cic_eth.db.models.role import AccountRole
|
||||||
from cic_eth.db.enum import LockEnum
|
from cic_eth.db.enum import LockEnum
|
||||||
from cic_eth.error import InitializationError
|
from cic_eth.error import InitializationError
|
||||||
|
@ -35,7 +35,7 @@ from eth_erc20 import ERC20
|
|||||||
from cic_eth_registry import CICRegistry
|
from cic_eth_registry import CICRegistry
|
||||||
|
|
||||||
# local imports
|
# local imports
|
||||||
from cic_eth.api.api_admin import AdminApi
|
from cic_eth.api.admin import AdminApi
|
||||||
from cic_eth.eth.gas import cache_gas_data
|
from cic_eth.eth.gas import cache_gas_data
|
||||||
from cic_eth.eth.erc20 import cache_transfer_data
|
from cic_eth.eth.erc20 import cache_transfer_data
|
||||||
|
|
||||||
|
8
apps/cic-eth/tools_requirements.txt
Normal file
8
apps/cic-eth/tools_requirements.txt
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
crypto-dev-signer~=0.4.14b6
|
||||||
|
chainqueue~=0.0.2b5
|
||||||
|
confini~=0.3.6rc4
|
||||||
|
cic-eth-registry~=0.5.6a1
|
||||||
|
redis==3.5.3
|
||||||
|
hexathon~=0.0.1a7
|
||||||
|
pycryptodome==3.10.1
|
||||||
|
pyxdg==0.27
|
@ -1,4 +1,4 @@
|
|||||||
cic_base[full_graph]==0.1.3a3+build.984b5cff
|
cic_base[full_graph]==0.1.3a3+build.984b5cff
|
||||||
cic-eth~=0.11.1a3
|
cic-eth~=0.12.0a1
|
||||||
cic-notify~=0.4.0a7
|
cic-notify~=0.4.0a7
|
||||||
cic-types~=0.1.0a11
|
cic-types~=0.1.0a11
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#eth-contract-registry==0.5.5a3
|
#eth-contract-registry==0.5.5a3
|
||||||
#erc20-demurrage-token==0.0.1b4
|
#erc20-demurrage-token==0.0.2a3
|
||||||
#eth-address-index==0.1.1a12
|
#eth-address-index==0.1.1a12
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
cic_base[full]==0.1.3a3+build.984b5cff
|
cic_base[full]==0.1.3a4+build.ce68c833
|
||||||
sarafu-faucet~=0.0.4a1
|
sarafu-faucet~=0.0.4a1
|
||||||
cic-eth~=0.11.1a2
|
cic-eth==0.11.1a3+build.a3c49324
|
||||||
erc20-demurrage-token==0.0.2a1
|
eth-erc20~=0.0.10a3
|
||||||
|
erc20-demurrage-token==0.0.2a3
|
||||||
|
@ -2,10 +2,18 @@
|
|||||||
|
|
||||||
set -a
|
set -a
|
||||||
|
|
||||||
|
default_token=giftable_erc20_token
|
||||||
CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT}
|
CIC_DEFAULT_TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL:-GFT}
|
||||||
TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL}
|
TOKEN_SYMBOL=${CIC_DEFAULT_TOKEN_SYMBOL}
|
||||||
|
TOKEN_NAME=${TOKEN_NAME:-$TOKEN_SYMBOL}
|
||||||
|
TOKEN_TYPE=${TOKEN_TYPE:-$default_token}
|
||||||
|
if [ $TOKEN_TYPE == 'default' ]; then
|
||||||
|
>&2 echo resolving "default" token to $default_token
|
||||||
|
TOKEN_TYPE=$default_token
|
||||||
|
fi
|
||||||
cat <<EOF
|
cat <<EOF
|
||||||
external token settings:
|
external token settings:
|
||||||
|
token_type: $TOKEN_TYPE
|
||||||
token_symbol: $TOKEN_SYMBOL
|
token_symbol: $TOKEN_SYMBOL
|
||||||
token_name: $TOKEN_NAME
|
token_name: $TOKEN_NAME
|
||||||
token_decimals: $TOKEN_DECIMALS
|
token_decimals: $TOKEN_DECIMALS
|
||||||
@ -31,11 +39,6 @@ if [ ! -z $DEV_ETH_GAS_PRICE ]; then
|
|||||||
>&2 echo using static gas price $DEV_ETH_GAS_PRICE
|
>&2 echo using static gas price $DEV_ETH_GAS_PRICE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $TOKEN_SYMBOL != 'GFT' && $TOKEN_SYMBOL != 'SRF' ]]; then
|
|
||||||
>&2 echo TOKEN_SYMBOL must be one of [GFT,SRF], but was $TOKEN_SYMBOL
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "environment:"
|
echo "environment:"
|
||||||
printenv
|
printenv
|
||||||
echo \n
|
echo \n
|
||||||
@ -72,15 +75,20 @@ if [[ -n "${ETH_PROVIDER}" ]]; then
|
|||||||
./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}"
|
./wait-for-it.sh "${ETH_PROVIDER_HOST}:${ETH_PROVIDER_PORT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $TOKEN_SYMBOL == 'GFT' ]; then
|
if [ $TOKEN_TYPE == $default_token ]; then
|
||||||
>&2 echo "deploying 'giftable token'"
|
>&2 echo deploying default token $TOKEN_TYPE
|
||||||
DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww --name "Giftable Token" --symbol "GFT" --decimals 6 -vv`
|
DEV_RESERVE_ADDRESS=`giftable-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww --name $TOKEN_NAME --symbol $TOKEN_SYMBOL --decimals 6 -vv`
|
||||||
else
|
elif [ $TOKEN_TYPE == 'erc20_demurrage_token' ]; then
|
||||||
>&2 echo "deploying 'redistributed demurrage token'"
|
>&2 echo deploying token $TOKEN_TYPE
|
||||||
if [ -z $TOKEN_SINK_ADDRESS && ! -z $TOKEN_REDISTRIBUTION_PERIOD ]; then
|
if [ -z $TOKEN_SINK_ADDRESS ]; then
|
||||||
|
if [ ! -z $TOKEN_REDISTRIBUTION_PERIOD ]; then
|
||||||
>&2 echo -e "\033[;93mtoken sink address not set, so redistribution will be BURNED\033[;39m"
|
>&2 echo -e "\033[;93mtoken sink address not set, so redistribution will be BURNED\033[;39m"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
DEV_RESERVE_ADDRESS=`erc20-demurrage-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww`
|
DEV_RESERVE_ADDRESS=`erc20-demurrage-token-deploy $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -ww`
|
||||||
|
else
|
||||||
|
>&2 echo unknown token type $TOKEN_TYPE
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
giftable-token-gift $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT
|
giftable-token-gift $gas_price_arg -p $ETH_PROVIDER -y $DEV_ETH_KEYSTORE_FILE -i $CIC_CHAIN_SPEC -vv -w -a $DEV_RESERVE_ADDRESS $DEV_RESERVE_AMOUNT
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
cic_base[full_graph]==0.1.3a3+build.984b5cff
|
|
||||||
sarafu-faucet==0.0.4a1
|
sarafu-faucet==0.0.4a1
|
||||||
cic-eth==0.11.1a1
|
cic-eth[tools]==0.12.0a1
|
||||||
cic-types==0.1.0a13
|
cic-types==0.1.0a13
|
||||||
crypto-dev-signer==0.4.14b6
|
crypto-dev-signer==0.4.14b6
|
||||||
|
@ -23,14 +23,11 @@ variables:
|
|||||||
.py_build_target_dev:
|
.py_build_target_dev:
|
||||||
stage: build
|
stage: build
|
||||||
variables:
|
variables:
|
||||||
CI_DEBUG_TRACE: "true"
|
IMAGE_TAG_BASE: $CI_REGISTRY_IMAGE/$APP_NAME:mr-unittest-$CI_COMMIT_SHORT_SHA
|
||||||
script:
|
script:
|
||||||
- mkdir -p /kaniko/.docker
|
- mkdir -p /kaniko/.docker
|
||||||
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
|
- echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REGISTRY_PASSWORD\"}}}" > "/kaniko/.docker/config.json"
|
||||||
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --cache-repo $CI_REGISTRY_IMAGE --target dev --tarPath $APP_NAME-test-image.tar --destination $MR_IMAGE_TAG
|
- /kaniko/executor --context $CONTEXT --dockerfile $DOCKERFILE_PATH $KANIKO_CACHE_ARGS --cache-repo $CI_REGISTRY_IMAGE --target dev --tarPath $APP_NAME-test-image.tar --destination $MR_IMAGE_TAG
|
||||||
rules:
|
|
||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
||||||
when: always
|
|
||||||
|
|
||||||
.py_build_push:
|
.py_build_push:
|
||||||
stage: build
|
stage: build
|
||||||
|
@ -73,6 +73,7 @@ services:
|
|||||||
contract-migration:
|
contract-migration:
|
||||||
build:
|
build:
|
||||||
dockerfile: contract-migration/docker/Dockerfile
|
dockerfile: contract-migration/docker/Dockerfile
|
||||||
|
# target: compile-image
|
||||||
args:
|
args:
|
||||||
pip_index_url: ${PIP_DEFAULT_INDEX_URL:-https://pypi.org/simple}
|
pip_index_url: ${PIP_DEFAULT_INDEX_URL:-https://pypi.org/simple}
|
||||||
pip_extra_args: $PIP_EXTRA_ARGS
|
pip_extra_args: $PIP_EXTRA_ARGS
|
||||||
@ -110,6 +111,7 @@ services:
|
|||||||
TOKEN_SUPPLY_LIMIT: $TOKEN_SUPPLY_LIMIT
|
TOKEN_SUPPLY_LIMIT: $TOKEN_SUPPLY_LIMIT
|
||||||
TOKEN_DEMURRAGE_LEVEL: ${TOKEN_DEMURRAGE_LEVEL:-196454828847045000000000000000000}
|
TOKEN_DEMURRAGE_LEVEL: ${TOKEN_DEMURRAGE_LEVEL:-196454828847045000000000000000000}
|
||||||
TOKEN_SINK_ADDRESS: $TOKEN_SINK_ADDRESS
|
TOKEN_SINK_ADDRESS: $TOKEN_SINK_ADDRESS
|
||||||
|
TOKEN_TYPE: ${TOKEN_TYPE:-default}
|
||||||
#CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config}
|
#CONFINI_DIR: ${CONFINI_DIR:-/tmp/cic/config}
|
||||||
command: ["./run_job.sh"]
|
command: ["./run_job.sh"]
|
||||||
#command: ["./reset.sh"]
|
#command: ["./reset.sh"]
|
||||||
|
Loading…
Reference in New Issue
Block a user