Skip to content

Commit 62b1ca1

Browse files
authored
Merge pull request #50 from deso-protocol/z/pos-bugfixes
Add makefile, fix uint256 encodings to properly format hex strings
2 parents 1731446 + 4428d8a commit 62b1ca1

5 files changed

Lines changed: 156 additions & 3 deletions

File tree

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
dev:
2+
go run .
3+
4+
dev-env:
5+
docker compose -f local.docker-compose.yml build && docker compose -f local.docker-compose.yml up
6+
7+
dev-env-down:
8+
docker compose -f local.docker-compose.yml down --volumes

entries/dao_coin_limit_order.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ func DaoCoinLimitOrderEncoderToPGStruct(daoCoinLimitOrder *lib.DAOCoinLimitOrder
3535
TransactorPkid: consumer.PublicKeyBytesToBase58Check(daoCoinLimitOrder.TransactorPKID[:], params),
3636
BuyingDaoCoinCreatorPkid: consumer.PublicKeyBytesToBase58Check(daoCoinLimitOrder.BuyingDAOCoinCreatorPKID[:], params),
3737
SellingDaoCoinCreatorPkid: consumer.PublicKeyBytesToBase58Check(daoCoinLimitOrder.SellingDAOCoinCreatorPKID[:], params),
38-
ScaledExchangeRateCoinsToSellPerCoinToBuyHex: daoCoinLimitOrder.ScaledExchangeRateCoinsToSellPerCoinToBuy.String(),
39-
QuantityToFillInBaseUnitsHex: daoCoinLimitOrder.QuantityToFillInBaseUnits.String(),
38+
ScaledExchangeRateCoinsToSellPerCoinToBuyHex: daoCoinLimitOrder.ScaledExchangeRateCoinsToSellPerCoinToBuy.Hex(),
39+
QuantityToFillInBaseUnitsHex: daoCoinLimitOrder.QuantityToFillInBaseUnits.Hex(),
4040
OperationType: uint8(daoCoinLimitOrder.OperationType),
4141
FillType: uint8(daoCoinLimitOrder.FillType),
4242
BlockHeight: daoCoinLimitOrder.BlockHeight,

entries/profile.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func ProfileEntryEncoderToPGStruct(profileEntry *lib.ProfileEntry, keyBytes []by
4949
MintingDisabled: profileEntry.CreatorCoinEntry.MintingDisabled,
5050
DesoLockedNanos: profileEntry.CreatorCoinEntry.DeSoLockedNanos,
5151
CcCoinsInCirculationNanos: profileEntry.CreatorCoinEntry.CoinsInCirculationNanos.Uint64(),
52-
DaoCoinsInCirculationNanosHex: profileEntry.DAOCoinEntry.CoinsInCirculationNanos.String(),
52+
DaoCoinsInCirculationNanosHex: profileEntry.DAOCoinEntry.CoinsInCirculationNanos.Hex(),
5353
DaoCoinMintingDisabled: profileEntry.DAOCoinEntry.MintingDisabled,
5454
DaoCoinTransferRestrictionStatus: profileEntry.DAOCoinEntry.TransferRestrictionStatus,
5555
ExtraData: consumer.ExtraDataBytesToString(profileEntry.ExtraData),

entries/utxo_operation.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ func bulkInsertUtxoOperationsEntry(entries []*lib.StateChangeEntry, db bun.IDB,
122122
if !ok {
123123
return fmt.Errorf("entries.bulkInsertUtxoOperationsEntry: Problem with entry %v", entry)
124124
}
125+
125126
// Check to see if the state change entry has an attached block.
126127
// Note that this only happens during the initial sync, in order to speed up the sync process.
127128
if entry.Block != nil {

local.docker-compose.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
version: '3.8'
2+
services:
3+
deso:
4+
# image: docker.io/desoprotocol/backend-dev:451a0a65e27da4ad68cb0705c63b1c964a1ce011
5+
build:
6+
context: ..
7+
dockerfile: backend/Dockerfile
8+
environment:
9+
- ADD_IPS=localhost:19000
10+
- PRIVATE_MODE=true
11+
- RUN_HOT_FEED_ROUTINE=false
12+
- API_PORT=18001
13+
- PROTOCOL_PORT=18000
14+
- TXINDEX=true
15+
- DATA_DIR=/pd/n0_00001
16+
- ACCESS_CONTROL_ALLOW_ORIGINS=*
17+
- SECURE_HEADER_ALLOW_HOSTS=localhost:4200
18+
- SECURE_HEADER_DEVELOPMENT=true
19+
- BLOCK_CYPHER_API_KEY=092dae962ea44b02809a4c74408b42a1
20+
- MIN_SATOSHIS_FOR_PROFILE=0
21+
- EXPOSE_GLOBAL_STATE=false
22+
- SHOW_PROCESSING_SPINNERS=true
23+
- COMP_PROFILE_CREATION=false
24+
25+
# Hypersync Settings:
26+
# - SYNC_TYPE=hypersync
27+
# - HYPERSYNC=true
28+
# Blocksync Settings:
29+
- SYNC_TYPE=blocksync
30+
- HYPERSYNC=false
31+
32+
# Mainnet Settings:
33+
# - REGTEST=false
34+
# - TESTNET=false
35+
# - CONNECT_IPS=35.232.92.5:17000
36+
# - STATE_CHANGE_DIR=/ss/state-changes
37+
38+
# Testnet Settings:
39+
- REGTEST=false
40+
- TESTNET=true
41+
- CONNECT_IPS=35.192.117.201:18000
42+
- STATE_CHANGE_DIR=/ss/state-changes
43+
- TRUSTED_BLOCK_PRODUCER_PUBLIC_KEYS=
44+
- TRUSTED_BLOCK_PRODUCER_START_HEIGHT=10000000
45+
46+
# Regtest Settings:
47+
# - REGTEST=true
48+
# - TESTNET=true
49+
# - STATE_CHANGE_DIR=/ss/state-changes
50+
# - ADMIN_PUBLIC_KEYS=*
51+
# - SUPER_ADMIN_PUBLIC_KEYS=*
52+
# - NUM_MINING_THREADS=1
53+
# - MINER_PUBLIC_KEYS=BC1YLg7Bk5sq9iNY17bAwoAYiChLYpmWEi6nY6q5gnA1UQV6xixHjfV
54+
# - BLOCK_PRODUCER_SEED=essence camp ghost remove document vault ladder swim pupil index apart ring
55+
# - STARTER_DESO_SEED=road congress client market couple bid risk escape artwork rookie artwork food
56+
ports:
57+
- '18000:18000'
58+
- '18001:18001'
59+
- '19000:19000'
60+
volumes:
61+
- pd_volume:/pd
62+
# - /tmp/state-change-files:/ss
63+
- ss_volume:/ss
64+
healthcheck:
65+
test: [ "CMD-SHELL", "wget --quiet --tries=1 --spider http://deso:18001/api/v0/health-check || exit 1" ]
66+
interval: 30s
67+
timeout: 10s
68+
retries: 20
69+
start_period: 10s
70+
command: ["run"]
71+
pdh:
72+
# image: docker.io/desoprotocol/postgres-data-handler:c2ff0e2921911d2581685e1794a1324724997c64
73+
build:
74+
context: ..
75+
dockerfile: postgres-data-handler/Dockerfile
76+
environment:
77+
- DB_HOST=db-ss
78+
- DB_NAME=postgres
79+
- DB_PASSWORD=postgres
80+
- DB_PORT=5432
81+
- DB_USERNAME=postgres
82+
- READONLY_USER_PASSWORD=postgres
83+
- STATE_CHANGE_DIR=/ss/state-changes
84+
- CONSUMER_PROGRESS_DIR=/ss/consumer-progress
85+
- BATCH_BYTES=500000
86+
- THREAD_LIMIT=10
87+
- CALCULATE_EXPLORER_STATISTICS=false
88+
- LOG_QUERIES=false
89+
# Mainnet Settings:
90+
# - IS_TESTNET=false
91+
# Testnet Settings:
92+
- IS_TESTNET=true
93+
command: ["run"]
94+
volumes:
95+
- ss_volume:/ss
96+
depends_on:
97+
db-ss:
98+
condition: service_healthy
99+
# gql:
100+
# image: docker.io/desoprotocol/graphql-api:4255d8c3c5be7911ed7817ef7b1baf979a6d3818
101+
# environment:
102+
# - DB_HOST=db-ss
103+
# - DB_NAME=postgres
104+
# - DB_PASSWORD=postgres
105+
# - DB_PORT=5432
106+
# - DB_USERNAME=postgres
107+
# - DB_OWNER_USERNAME=postgres
108+
# - DB_OWNER_PASSWORD=postgres
109+
# - READONLY_USER_PASSWORD=postgres
110+
# - LOG_SQL=true
111+
# - DESO_NODE_URI=http://deso:18001
112+
# ports:
113+
# - '4000:4000'
114+
# depends_on:
115+
# db-ss:
116+
# condition: service_healthy
117+
# healthcheck:
118+
# test: [ "CMD-SHELL", "wget --quiet --tries=1 --spider --header='Content-Type: application/json' --post-data='{\"query\":\"query {__typename}\"}' http://gql:4000/graphql || exit 1" ]
119+
# interval: 10s
120+
# timeout: 15s
121+
# retries: 30
122+
# start_period: 10s
123+
db-ss:
124+
image: postgres:14
125+
# restart: always
126+
environment:
127+
- PGUSER=postgres
128+
- POSTGRES_USER=postgres
129+
- POSTGRES_PASSWORD=postgres
130+
- POSTGRES_DB=postgres
131+
- POSTGRES_LOG_STATEMENTS=all
132+
ports:
133+
- '5430:5432'
134+
volumes:
135+
- db_ss_volume:/var/lib/postgresql/data
136+
healthcheck:
137+
test: [ "CMD-SHELL", "pg_isready" ]
138+
interval: 10s
139+
timeout: 5s
140+
retries: 100
141+
volumes:
142+
db_ss_volume:
143+
pd_volume:
144+
ss_volume:

0 commit comments

Comments
 (0)