Skip to content

Commit

Permalink
Merge pull request #1462 from singnet/development
Browse files Browse the repository at this point in the history
dev to master
  • Loading branch information
prashantramangupta authored Oct 29, 2020
2 parents a600f94 + dcb0976 commit 1ac9f5a
Show file tree
Hide file tree
Showing 75 changed files with 538 additions and 728 deletions.
16 changes: 8 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version: 2
jobs:
build:
docker:
- image: circleci/python:3.6.6-node
- image: circleci/mysql:8.0.4
- image: circleci/python:3.7-node
- image: circleci/mysql:8.0.21
command: [--default-authentication-plugin=mysql_native_password]
environment:
MYSQL_ROOT_PASSWORD: unittest_pwd
Expand All @@ -20,12 +20,12 @@ jobs:
command: |
shasum */requirement*.txt > /tmp/checksum_files_list
sudo chown -R circleci:circleci /usr/local/bin
sudo chown circleci:circleci -R /usr/local/lib/python3.6
sudo chown circleci:circleci -R /usr/local/lib/python3.7
- run:
name: Revert the permissions
command: |
sudo chown root:root -R /usr/local/bin
sudo chown root:root -R /usr/local/lib/python3.6
sudo chown root:root -R /usr/local/lib/python3.7
- run:
# Our primary container isn't MYSQL so run a sleep command until it's ready.
name: Waiting for MySQL to be ready
Expand All @@ -45,9 +45,9 @@ jobs:
- run:
name: Install required packages.
command: |
sudo apt-get update
sudo apt-get install mysql-client -y
sudo pip install coverage coveralls pytest boto3 alembic
sudo apt update
sudo apt install default-mysql-client
sudo pip install coverage coveralls pytest alembic
mysql -h 127.0.0.1 -u root -punittest_pwd -e "create database registry_unittest_db"
mysql -h 127.0.0.1 -u root -punittest_pwd -e "create database verification_unittest_db"
mysql -h 127.0.0.1 -u root -punittest_pwd -e "GRANT ALL PRIVILEGES ON *.* TO 'unittest_root'@'%';"
Expand All @@ -63,4 +63,4 @@ jobs:
- save_cache:
key: dependency-cache-{{ checksum "/tmp/checksum_files_list" }}
paths:
- /usr/local/lib/python3.6/site-packages
- /usr/local/lib/python3.7/site-packages
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ ARG BASE_IMAGE=ubuntu:18.04
FROM $BASE_IMAGE

WORKDIR /opt/app/
COPY wallets/requirement.txt ./
RUN pip3 install --no-cache-dir -r requirement.txt
COPY wallets/requirements.txt ./
RUN pip3 install --upgrade awscli
RUN pip3 install --no-cache-dir -r requirements.txt
COPY wallets/package.json package.json
RUN npm install
COPY wallets/ wallets/
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ These instructions are intended to facilitate the development and testing of Sin

* [python 3.6.5+](https://www.python.org/downloads/)
* pip 9.0.1+
* Additionally you should install the python dependency package present in requirement.txt.
* Additionally you should install the python dependency package present in requirements.txt.
* [npm 3.5.2+](#)
* Additionally you should install the external dependency package present in package.json.

Expand Down
11 changes: 7 additions & 4 deletions common/blockchain_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def sign_transaction_with_private_key(self, private_key, transaction_object):
return self.web3_object.eth.account.signTransaction(transaction_object, private_key).rawTransaction

def create_transaction_object(self, *positional_inputs, method_name, address, contract_path, contract_address_path,
net_id):
net_id, gas=None):
nonce = self.get_nonce(address=address)
self.contract = self.load_contract(path=contract_path)
self.contract_address = self.read_contract_address(net_id=net_id, path=contract_address_path, key='address')
Expand All @@ -91,13 +91,16 @@ def create_transaction_object(self, *positional_inputs, method_name, address, co
logger.info(f"nonce :: {nonce}")
logger.info(f"positional_inputs :: {positional_inputs}")
gas_price = 3 * (self.web3_object.eth.gasPrice)
transaction_object = getattr(self.contract_instance.functions, method_name)(
*positional_inputs).buildTransaction({
options = {
"from": address,
"nonce": nonce,
"gasPrice": gas_price,
"chainId": net_id
})
}
if gas is not None:
options.update({"gas": gas})
transaction_object = getattr(self.contract_instance.functions, method_name)(
*positional_inputs).buildTransaction(options)
return transaction_object

def process_raw_transaction(self, raw_transaction):
Expand Down
7 changes: 4 additions & 3 deletions common/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
web3==4.9.2
rlp==1.2.0
web3==5.10.0
requests==2.22.0
PyMySQL==0.9.2
boto3==1.10.9
PyMySQL==0.10.1
boto3==1.15.9
ipfsapi==0.4.3
10 changes: 0 additions & 10 deletions contract_api/requirement.txt

This file was deleted.

9 changes: 9 additions & 0 deletions contract_api/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
alembic==1.4.3
schema==0.6.8
ipfsapi==0.4.4
rlp==1.2.0
web3==5.10.0
boto3==1.15.9
SQLAlchemy==1.3.19
pymysql==0.10.1
aws-xray-sdk==2.4.2
6 changes: 3 additions & 3 deletions contract_api/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins:
service: contract-api
provider:
name: aws
runtime: python3.6
runtime: python3.7
description: Description of what the lambda function does # optional, Description to publish to AWS
memorySize: 512
timeout: 30
Expand All @@ -23,7 +23,7 @@ provider:

custom:
pythonRequirements:
fileName: contract_api/requirement.txt
fileName: contract_api/requirements.txt
dockerizePip: true
useDownloadCache: true
useStaticCache: true
Expand Down Expand Up @@ -99,7 +99,7 @@ package:
- .circleci/**
- .gitignore/**
- .serverless/**
- requirement.txt
- requirements.txt
- venv/**
- config.ropsten.json
- sls_deploy.sh
Expand Down
2 changes: 1 addition & 1 deletion dapp_user/infrastructure/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ class UserPreference(Base):
status = Column("status", BOOLEAN, nullable=False)
created_on = Column("created_on", TIMESTAMP(timezone=False), nullable=False)
updated_on = Column("updated_on", TIMESTAMP(timezone=False), nullable=False, default=dt.utcnow())
UniqueConstraint(preference_type, communication_type, source, name="uq_usr_pref")
UniqueConstraint(user_row_id, preference_type, communication_type, source, name="user_preference_UN")
9 changes: 0 additions & 9 deletions dapp_user/requirement.txt

This file was deleted.

10 changes: 10 additions & 0 deletions dapp_user/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
ipfsapi==0.4.4
schema==0.6.8
rlp==1.2.0
web3==5.10.0
boto3==1.15.9
SQLAlchemy==1.3.19
pymysql==0.10.1
grpcio==1.32.0
aws-xray-sdk==2.4.2
protobuf==3.9.0
4 changes: 2 additions & 2 deletions dapp_user/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins:
service: dapp-user
custom:
pythonRequirements:
fileName: dapp_user/requirement.txt
fileName: dapp_user/requirements.txt
dockerizePip: true
useDownloadCache: true
useStaticCache: true
Expand Down Expand Up @@ -38,7 +38,7 @@ package:
- .circleci/**
- .gitignore/**
- .serverless/**
- requirement.txt
- requirements.txt
- venv/**
- config.ropsten.json
- sls_deploy.sh
Expand Down
2 changes: 1 addition & 1 deletion event_pubsub/listeners/listener_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, url):

def push_event(self, data):
try:
requests.post(self.url, data)
requests.post(self.url, json.dumps(data))
except Exception as e:
print(e)
raise e
Expand Down
5 changes: 0 additions & 5 deletions event_pubsub/requirement.txt

This file was deleted.

6 changes: 6 additions & 0 deletions event_pubsub/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
rlp==1.2.0
web3==5.10.0
boto3==1.15.9
SQLAlchemy==1.3.19
pymysql==0.10.1
aws-xray-sdk==2.4.2
6 changes: 3 additions & 3 deletions event_pubsub/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins:
service: event-publisher-subscriber
custom:
pythonRequirements:
fileName: event_pubsub/requirement.txt
fileName: event_pubsub/requirements.txt
dockerizePip: true
useDownloadCache: true
useStaticCache: true
Expand All @@ -19,7 +19,7 @@ custom:

provider:
name: aws
runtime: python3.6
runtime: python3.7
description: event_publisher # optional, Description to publish to AWS
memorySize: 512
timeout: 60
Expand All @@ -39,7 +39,7 @@ package:
- .circleci/**
- .gitignore/**
- .serverless/**
- requirement.txt
- requirements.txt
- venv/**
- config.ropsten.json
- test/**
Expand Down
3 changes: 2 additions & 1 deletion notification/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"dependencies": {
"serverless-offline": "5.12.0",
"serverless-plugin-tracing": "2.0.0",
"serverless-prune-plugin": "1.4.1"
"serverless-prune-plugin": "1.4.1",
"serverless-python-requirements": "5.0.0"
}
}
1 change: 1 addition & 0 deletions notification/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
boto3==1.15.9
8 changes: 7 additions & 1 deletion notification/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ plugins:
service: notifcation

custom:
pythonRequirements:
fileName: event_pubsub/requirements.txt
dockerizePip: true
useDownloadCache: true
useStaticCache: true
cacheLocation: '/var/cache/serverless'
prune:
automatic: true
includeLayers: true
Expand All @@ -31,7 +37,7 @@ package:
- .circleci/**
- .gitignore/**
- .serverless/**
- requirement.txt
- requirements.txt
- venv/**
- config.ropsten.json
- sls_deploy.sh
Expand Down
30 changes: 0 additions & 30 deletions orchestrator/requirement.txt

This file was deleted.

7 changes: 7 additions & 0 deletions orchestrator/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
attrdict==2.0.1
rlp==1.2.0
web3==5.10.0
PyMySQL==0.10.1
boto3==1.15.9
SQLAlchemy==1.3.19
aws-xray-sdk==2.4.2
6 changes: 3 additions & 3 deletions orchestrator/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins:
service: orchestrator
custom:
pythonRequirements:
fileName: orchestrator/requirement.txt
fileName: orchestrator/requirements.txt
dockerizePip: true
useDownloadCache: true
useStaticCache: true
Expand All @@ -19,7 +19,7 @@ custom:

provider:
name: aws
runtime: python3.6
runtime: python3.7
description: Orchestrator # optional, Description to publish to AWS
memorySize: 512
timeout: 60
Expand All @@ -39,7 +39,7 @@ package:
- .circleci/**
- .gitignore/**
- .serverless/**
- requirement.txt
- requirements.txt
- venv/**
- config.ropsten.json
- test/**
Expand Down
11 changes: 6 additions & 5 deletions payments/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
web3==4.9.2
requests==2.22.0
paypalrestsdk==1.13.1
PyMySQL==0.9.3
SQLAlchemy==1.3.8
boto3==1.15.9
SQLAlchemy==1.3.19
pymysql==0.10.1
aws-xray-sdk==2.4.2
paypalrestsdk==1.13.1
rlp==1.2.0
web3==5.10.0
4 changes: 2 additions & 2 deletions payments/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ custom:

provider:
name: aws
runtime: python3.6
runtime: python3.7
description: Payment Service #optional, Description to publish to AWS
memorySize: 512
timeout: 60
Expand All @@ -39,7 +39,7 @@ package:
- .circleci/**
- .gitignore/**
- .serverless/**
- requirement.txt
- requirements.txt
- venv/**
- config.ropsten.json
- sls_deploy.sh
Expand Down
Loading

0 comments on commit 1ac9f5a

Please sign in to comment.