Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
0ec2268
Introduce proxy/db_scheme.py
vasiliy-zaznobin Feb 18, 2022
43d1b28
Merge remote-tracking branch 'origin/develop' into 368-Move_SQL_schem…
vasiliy-zaznobin Feb 18, 2022
075273e
Debug
vasiliy-zaznobin Feb 18, 2022
768bf09
Introduce run-db-creation.sh
vasiliy-zaznobin Feb 21, 2022
09bf1ac
Use entrypoint: proxy/run-db-creation.sh
vasiliy-zaznobin Feb 21, 2022
f2cac17
Add dbcreation.log
vasiliy-zaznobin Feb 21, 2022
d8ecf1b
Debug
vasiliy-zaznobin Feb 21, 2022
68a7841
Debug
vasiliy-zaznobin Feb 21, 2022
d34c8f7
Merge remote-tracking branch 'origin/develop' into 368-Move_SQL_schem…
vasiliy-zaznobin Feb 21, 2022
6a47f6b
Add dbcreation.log
vasiliy-zaznobin Feb 21, 2022
2058f0a
Use from ..proxy
vasiliy-zaznobin Feb 21, 2022
295568e
Debug
vasiliy-zaznobin Feb 21, 2022
8a7047f
Debug
vasiliy-zaznobin Feb 21, 2022
3cf914e
Introduce dbcreation_mode to run proxy
vasiliy-zaznobin Feb 21, 2022
550c46e
Change paths
vasiliy-zaznobin Feb 21, 2022
f22a780
Will run in dbcreation mode with SOLANA_URL and EVM_LOADER
vasiliy-zaznobin Feb 21, 2022
e6c0e43
Debug
vasiliy-zaznobin Feb 21, 2022
acf7bce
Debug
vasiliy-zaznobin Feb 21, 2022
eaf23d2
Debug
vasiliy-zaznobin Feb 21, 2022
5a0306b
SOLANA_URL: http://solana:8899
vasiliy-zaznobin Feb 21, 2022
27c0e68
Add logged_groups
vasiliy-zaznobin Feb 21, 2022
0ac19fa
Debug
vasiliy-zaznobin Feb 21, 2022
33515b4
Log schema
vasiliy-zaznobin Feb 21, 2022
f1c2c50
Use psql
vasiliy-zaznobin Feb 21, 2022
8865af4
Add postgresql-client-common in the docker image
vasiliy-zaznobin Feb 21, 2022
1eb1bf9
Add postgresql-client in the docker image
vasiliy-zaznobin Feb 21, 2022
cf47fad
Set network_mode: container:postgres
vasiliy-zaznobin Feb 21, 2022
7b9167c
Remove networks
vasiliy-zaznobin Feb 21, 2022
9355411
Use network_mode: service:postgres
vasiliy-zaznobin Feb 21, 2022
505b3eb
Remove hostname
vasiliy-zaznobin Feb 21, 2022
11fa1bc
Remove hostname
vasiliy-zaznobin Feb 21, 2022
6d9c6ca
ports:
vasiliy-zaznobin Feb 21, 2022
b9c2f7a
networks:
vasiliy-zaznobin Feb 21, 2022
1586797
Add ports:
vasiliy-zaznobin Feb 21, 2022
31b8048
Add networks:
vasiliy-zaznobin Feb 21, 2022
d9154eb
Try to use links: - postgres
vasiliy-zaznobin Feb 21, 2022
b66b803
Use export PGPASSWORD=${POSTGRES_PASSWORD} to set the password for psql
vasiliy-zaznobin Feb 21, 2022
a12fe00
Use run_dbcreation()
vasiliy-zaznobin Feb 21, 2022
7803d3c
Merge remote-tracking branch 'origin/develop' into 368-Move_SQL_schem…
vasiliy-zaznobin Feb 21, 2022
0360208
Merge remote-tracking branch 'origin/develop' into 368-Move_SQL_schem…
vasiliy-zaznobin Feb 23, 2022
94f733a
Correction after the prev merge
vasiliy-zaznobin Feb 23, 2022
92d0201
Correction after the prev merge
vasiliy-zaznobin Feb 23, 2022
ea0dbdc
Lowercase in function names
vasiliy-zaznobin Feb 23, 2022
d02bfee
Refactor to introduce scheme.sql
vasiliy-zaznobin Feb 24, 2022
df19f2d
Debug
vasiliy-zaznobin Feb 24, 2022
6a38f0c
Debug
vasiliy-zaznobin Feb 24, 2022
c94126b
Debug
vasiliy-zaznobin Feb 24, 2022
6bf4cfc
Add table airdrop_scheduled
vasiliy-zaznobin Feb 24, 2022
7560704
Revert some changes
vasiliy-zaznobin Feb 24, 2022
5ab70f3
Fixed: psql:proxy/db/scheme.sql:73: ERROR: syntax error at or near "{"
vasiliy-zaznobin Feb 24, 2022
f6d17d2
Use run_indexer(solana_url)
vasiliy-zaznobin Feb 24, 2022
bb07118
Merge remote-tracking branch 'origin/develop' into 368-Move_SQL_schem…
vasiliy-zaznobin Feb 24, 2022
db54d3b
Use run_airdropper with 7 args
vasiliy-zaznobin Feb 24, 2022
ffab8cd
Remove creation.py
vasiliy-zaznobin Feb 24, 2022
3881bac
Remove creation.py
vasiliy-zaznobin Feb 24, 2022
e5f8f64
Remove dbcreation_mode
vasiliy-zaznobin Feb 25, 2022
37ebf6a
Merge branch 'develop' into 368-Move_SQL_schema_to_distinct_file
rozhkovdmitrii Mar 11, 2022
4832f03
check it
rozhkovdmitrii Mar 11, 2022
46e1c2b
check it
rozhkovdmitrii Mar 11, 2022
f5891cb
Catch "Operator has NO resources!" exception
rozhkovdmitrii Mar 11, 2022
b5811da
Catch "Operator has NO resources!" exception
rozhkovdmitrii Mar 11, 2022
06ae9df
Get rid of create_table in sql_dict.py
rozhkovdmitrii Mar 12, 2022
d05f9d1
Get rid of stuff from sql_dict
rozhkovdmitrii Mar 12, 2022
4ec9a14
Get rid of crating table stuff from TrxReceiptsStorage
rozhkovdmitrii Mar 12, 2022
b092d3d
Roll back NEON_ERC20_MAX_AMOUNT
rozhkovdmitrii Mar 12, 2022
8dd8800
Spit and polish
rozhkovdmitrii Mar 12, 2022
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
Prev Previous commit
Next Next commit
Correction after the prev merge
  • Loading branch information
vasiliy-zaznobin committed Feb 23, 2022
commit 94f733a9cb12ccfef1ab2884a34db6a0f651c547
64 changes: 28 additions & 36 deletions proxy/db/scheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@


def CREATE_TABLE_OPERATOR_COST() -> Tuple[str, str]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function name should be lowercase

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

TABLE_NAME_OPERATOR_COST = 'OPERATOR_COST'
table_name = 'OPERATOR_COST'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_OPERATOR_COST} (
CREATE TABLE IF NOT EXISTS {table_name} (
id SERIAL PRIMARY KEY,
hash char(64),
cost bigint,
Expand All @@ -15,13 +15,13 @@ def CREATE_TABLE_OPERATOR_COST() -> Tuple[str, str]:
status varchar(100),
reason varchar(100)
);
""", TABLE_NAME_OPERATOR_COST
""", table_name


def CREATE_TABLE_NEON_ACCOUNTS() -> Tuple[str, str]:
TABLE_NAME_NEON_ACCOUNTS = 'neon_accounts'
table_name = 'neon_accounts'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_NEON_ACCOUNTS} (
CREATE TABLE IF NOT EXISTS {table_name} (
neon_account CHAR(42),
pda_account VARCHAR(50),
code_account VARCHAR(50),
Expand All @@ -30,45 +30,38 @@ def CREATE_TABLE_NEON_ACCOUNTS() -> Tuple[str, str]:

UNIQUE(pda_account, code_account)
);
""", TABLE_NAME_NEON_ACCOUNTS
""", table_name


def CREATE_TABLE_FAILED_AIRDROP_ATTEMPTS() -> Tuple[str, str]:
TABLE_NAME_FAILED_AIRDROP_ATTEMPTS = 'failed_airdrop_attempts'
table_name = 'failed_airdrop_attempts'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_FAILED_AIRDROP_ATTEMPTS} (
CREATE TABLE IF NOT EXISTS {table_name} (
attempt_time BIGINT,
eth_address TEXT,
reason TEXT
);
CREATE INDEX IF NOT EXISTS failed_attempt_time_idx ON {TABLE_NAME_FAILED_AIRDROP_ATTEMPTS} (attempt_time);
""", TABLE_NAME_FAILED_AIRDROP_ATTEMPTS
CREATE INDEX IF NOT EXISTS failed_attempt_time_idx ON {table_name} (attempt_time);
""", table_name


def CREATE_TABLE_AIRDROP_READY() -> Tuple[str, str]:
TABLE_NAME_AIRDROP_READY = 'airdrop_ready'
table_name = 'airdrop_ready'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_AIRDROP_READY} (
CREATE TABLE IF NOT EXISTS {table_name} (
eth_address TEXT UNIQUE,
scheduled_ts BIGINT,
finished_ts BIGINT,
duration INTEGER,
amount_galans INTEGER
);
""", TABLE_NAME_AIRDROP_READY
""", table_name


def CREATE_TABLE_SOLANA_BLOCK() -> Tuple[str, str]:
TABLE_NAME_SOLANA_BLOCK = 'solana_block'
table_name = 'solana_block'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_SOLANA_BLOCK}_heights (
slot BIGINT,
height BIGINT,

UNIQUE(slot),
UNIQUE(height)
);
CREATE TABLE IF NOT EXISTS {TABLE_NAME_SOLANA_BLOCK}_hashes (
CREATE TABLE IF NOT EXISTS {table_name} (
slot BIGINT,
hash CHAR(66),

Expand All @@ -79,13 +72,13 @@ def CREATE_TABLE_SOLANA_BLOCK() -> Tuple[str, str]:
UNIQUE(slot),
UNIQUE(hash)
);
""", TABLE_NAME_SOLANA_BLOCK
""", table_name


def CREATE_TABLE_NEON_TRANSACTION_LOGS() -> Tuple[str, str]:
TABLE_NAME_NEON_TRANSACTION_LOGS = 'neon_transaction_logs'
table_name = 'neon_transaction_logs'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_NEON_TRANSACTION_LOGS} (
CREATE TABLE IF NOT EXISTS {table_name} (
address CHAR(42),
blockHash CHAR(66),
blockNumber BIGINT,
Expand All @@ -98,16 +91,16 @@ def CREATE_TABLE_NEON_TRANSACTION_LOGS() -> Tuple[str, str]:

UNIQUE(blockNumber, transactionHash, transactionLogIndex)
);
CREATE INDEX IF NOT EXISTS {TABLE_NAME_NEON_TRANSACTION_LOGS}_block_hash ON {TABLE_NAME_NEON_TRANSACTION_LOGS}(blockHash);
CREATE INDEX IF NOT EXISTS {TABLE_NAME_NEON_TRANSACTION_LOGS}_address ON {TABLE_NAME_NEON_TRANSACTION_LOGS}(address);
CREATE INDEX IF NOT EXISTS {TABLE_NAME_NEON_TRANSACTION_LOGS}_topic ON {TABLE_NAME_NEON_TRANSACTION_LOGS}(topic);
""", TABLE_NAME_NEON_TRANSACTION_LOGS
CREATE INDEX IF NOT EXISTS {table_name}_block_hash ON {table_name}(blockHash);
CREATE INDEX IF NOT EXISTS {table_name}_address ON {table_name}(address);
CREATE INDEX IF NOT EXISTS {table_name}_topic ON {table_name}(topic);
""", table_name


def CREATE_TABLE_SOLANA_NEON_TRANSACTIONS() -> Tuple[str, str]:
TABLE_NAME_SOLANA_NEON_TRANSACTIONS = 'solana_neon_transactions'
table_name = 'solana_neon_transactions'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_SOLANA_NEON_TRANSACTIONS} (
CREATE TABLE IF NOT EXISTS {table_name} (
sol_sign CHAR(88),
neon_sign CHAR(66),
slot BIGINT,
Expand All @@ -116,18 +109,17 @@ def CREATE_TABLE_SOLANA_NEON_TRANSACTIONS() -> Tuple[str, str]:
UNIQUE(sol_sign, neon_sign, idx),
UNIQUE(neon_sign, sol_sign, idx)
);
""", TABLE_NAME_SOLANA_NEON_TRANSACTIONS
""", table_name


def CREATE_TABLE_NEON_TRANSACTIONS() -> Tuple[str, str]:
TABLE_NAME_NEON_TRANSACTIONS = 'neon_transactions'
table_name = 'neon_transactions'
return f"""
CREATE TABLE IF NOT EXISTS {TABLE_NAME_NEON_TRANSACTIONS} (
CREATE TABLE IF NOT EXISTS {table_name} (
neon_sign CHAR(66),
from_addr CHAR(42),
sol_sign CHAR(88),
slot BIGINT,
block_height BIGINT,
block_hash CHAR(66),
idx INT,

Expand All @@ -154,7 +146,7 @@ def CREATE_TABLE_NEON_TRANSACTIONS() -> Tuple[str, str]:
UNIQUE(neon_sign),
UNIQUE(sol_sign, idx)
);
""", TABLE_NAME_NEON_TRANSACTIONS
""", table_name


def CREATE_TABLE_TRANSACTION_RECEIPTS(table_name='transaction_receipts') -> Tuple[str, str]:
Expand Down
6 changes: 4 additions & 2 deletions proxy/docker-compose-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ services:
SOLANA_URL: http://solana:8899
RUST_LOG: solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=debug,solana_bpf_loader=debug,solana_rbpf=debug
hostname: solana
ports:
- 127.0.0.1:8899:8899
expose:
- "8899"
- "9900"
Expand Down Expand Up @@ -122,11 +124,11 @@ services:
WEB3_RPC_URL: 'http://proxy:9090/solana'
WEB3_PRIVATE_KEY: ''
NEON_ERC20_TOKENS:
NEON_ERC20_MAX_AMOUNT: 1000
NEON_ERC20_MAX_AMOUNT: 2000
FAUCET_SOLANA_ENABLE: 'true'
SOLANA_URL: 'http://solana:8899'
NEON_OPERATOR_KEYFILE: '/root/.config/solana/id.json'
NEON_ETH_MAX_AMOUNT: 1000
NEON_ETH_MAX_AMOUNT: 2000
TEST_FAUCET_INIT_NEON_BALANCE: 100000
hostname: faucet
ports:
Expand Down