Skip to content

Commit 527e03d

Browse files
authored
Merge pull request #4 from deso-protocol/feature/proof-of-stake
feature/proof-of-stake
2 parents c2ff0e2 + b75893e commit 527e03d

File tree

73 files changed

+4348
-559
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+4348
-559
lines changed

Dockerfile

Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,53 @@
1-
FROM alpine:latest AS daodao
1+
FROM alpine:latest AS postgres-data-handler
22

33
RUN apk update
44
RUN apk upgrade
5-
RUN apk add --update go gcc g++ vips-dev
5+
RUN apk add --update bash go cmake g++ gcc git make vips-dev
66

77
WORKDIR /postgres-data-handler/src
88

99
COPY postgres-data-handler/go.mod postgres-data-handler/
1010
COPY postgres-data-handler/go.sum postgres-data-handler/
11-
COPY core/go.mod core/
12-
COPY core/go.sum core/
11+
COPY core/go.mod core/
12+
COPY core/go.sum core/
13+
COPY backend/go.mod backend/
14+
COPY backend/go.sum backend/
15+
COPY state-consumer/go.mod state-consumer/
16+
COPY state-consumer/go.sum state-consumer/
1317

1418
WORKDIR /postgres-data-handler/src/postgres-data-handler
1519

1620
RUN go mod download
1721

1822
# include postgres data handler src
19-
COPY postgres-data-handler/entries entries
20-
COPY postgres-data-handler/migrations migrations
23+
COPY postgres-data-handler/entries entries
24+
COPY postgres-data-handler/migrations migrations
2125
COPY postgres-data-handler/handler handler
22-
COPY postgres-data-handler/main.go .
26+
COPY postgres-data-handler/main.go .
2327

2428
# include core src
25-
COPY core/desohash ../core/desohash
26-
COPY core/cmd ../core/cmd
27-
COPY core/lib ../core/lib
28-
COPY core/migrate ../core/migrate
29+
COPY core/desohash ../core/desohash
30+
COPY core/consensus ../core/consensus
31+
COPY core/collections ../core/collections
32+
COPY core/bls ../core/bls
33+
COPY core/cmd ../core/cmd
34+
COPY core/lib ../core/lib
35+
COPY core/migrate ../core/migrate
36+
37+
# include backend src
38+
COPY backend/apis ../backend/apis
39+
COPY backend/config ../backend/config
40+
COPY backend/cmd ../backend/cmd
41+
COPY backend/miner ../backend/miner
42+
COPY backend/routes ../backend/routes
43+
COPY backend/countries ../backend/countries
44+
45+
# include state-consumer src
46+
COPY state-consumer/consumer ../state-consumer/consumer
2947

3048
RUN go mod tidy
3149

3250
## build postgres data handler backend
3351
RUN GOOS=linux go build -mod=mod -a -installsuffix cgo -o bin/postgres-data-handler main.go
34-
#
35-
## create tiny image
36-
#FROM alpine:latest
37-
##
38-
#RUN apk add --update vips-dev
39-
##
40-
#COPY --from=daodao /daodao/src/daodao-backend/bin/daodao-backend /daodao/bin/daodao-backend
41-
#ENTRYPOINT ["/daodao/bin/daodao-backend"]
52+
4253
ENTRYPOINT ["/postgres-data-handler/src/postgres-data-handler/bin/postgres-data-handler"]

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/access_group.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func AccessGroupEncoderToPGStruct(accessGroupEntry *lib.AccessGroupEntry, keyByt
5252

5353
// PostBatchOperation is the entry point for processing a batch of post entries. It determines the appropriate handler
5454
// based on the operation type and executes it.
55-
func AccessGroupBatchOperation(entries []*lib.StateChangeEntry, db *bun.DB, params *lib.DeSoParams) error {
55+
func AccessGroupBatchOperation(entries []*lib.StateChangeEntry, db bun.IDB, params *lib.DeSoParams) error {
5656
// We check before we call this function that there is at least one operation type.
5757
// We also ensure before this that all entries have the same operation type.
5858
operationType := entries[0].OperationType
@@ -69,7 +69,7 @@ func AccessGroupBatchOperation(entries []*lib.StateChangeEntry, db *bun.DB, para
6969
}
7070

7171
// bulkInsertAccessGroupEntry inserts a batch of access_group entries into the database.
72-
func bulkInsertAccessGroupEntry(entries []*lib.StateChangeEntry, db *bun.DB, operationType lib.StateSyncerOperationType, params *lib.DeSoParams) error {
72+
func bulkInsertAccessGroupEntry(entries []*lib.StateChangeEntry, db bun.IDB, operationType lib.StateSyncerOperationType, params *lib.DeSoParams) error {
7373
// Track the unique entries we've inserted so we don't insert the same entry twice.
7474
uniqueEntries := consumer.UniqueEntries(entries)
7575
// Create a new array to hold the bun struct.
@@ -94,7 +94,7 @@ func bulkInsertAccessGroupEntry(entries []*lib.StateChangeEntry, db *bun.DB, ope
9494
}
9595

9696
// bulkDeletePostEntry deletes a batch of access_group entries from the database.
97-
func bulkDeleteAccessGroupEntry(entries []*lib.StateChangeEntry, db *bun.DB, operationType lib.StateSyncerOperationType) error {
97+
func bulkDeleteAccessGroupEntry(entries []*lib.StateChangeEntry, db bun.IDB, operationType lib.StateSyncerOperationType) error {
9898
// Track the unique entries we've inserted so we don't insert the same entry twice.
9999
uniqueEntries := consumer.UniqueEntries(entries)
100100

entries/access_group_member.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func AccessGroupMemberEncoderToPGStruct(accessGroupMemberEntry *lib.AccessGroupM
5757

5858
// PostBatchOperation is the entry point for processing a batch of post entries. It determines the appropriate handler
5959
// based on the operation type and executes it.
60-
func AccessGroupMemberBatchOperation(entries []*lib.StateChangeEntry, db *bun.DB, params *lib.DeSoParams) error {
60+
func AccessGroupMemberBatchOperation(entries []*lib.StateChangeEntry, db bun.IDB, params *lib.DeSoParams) error {
6161
// We check before we call this function that there is at least one operation type.
6262
// We also ensure before this that all entries have the same operation type.
6363
operationType := entries[0].OperationType
@@ -74,7 +74,7 @@ func AccessGroupMemberBatchOperation(entries []*lib.StateChangeEntry, db *bun.DB
7474
}
7575

7676
// bulkInsertAccessGroupMemberEntry inserts a batch of access_group_member entries into the database.
77-
func bulkInsertAccessGroupMemberEntry(entries []*lib.StateChangeEntry, db *bun.DB, operationType lib.StateSyncerOperationType, params *lib.DeSoParams) error {
77+
func bulkInsertAccessGroupMemberEntry(entries []*lib.StateChangeEntry, db bun.IDB, operationType lib.StateSyncerOperationType, params *lib.DeSoParams) error {
7878
// Track the unique entries we've inserted so we don't insert the same entry twice.
7979
uniqueEntries := consumer.UniqueEntries(entries)
8080
// Create a new array to hold the bun struct.
@@ -99,7 +99,7 @@ func bulkInsertAccessGroupMemberEntry(entries []*lib.StateChangeEntry, db *bun.D
9999
}
100100

101101
// bulkDeletePostEntry deletes a batch of access_group_member entries from the database.
102-
func bulkDeleteAccessGroupMemberEntry(entries []*lib.StateChangeEntry, db *bun.DB, operationType lib.StateSyncerOperationType) error {
102+
func bulkDeleteAccessGroupMemberEntry(entries []*lib.StateChangeEntry, db bun.IDB, operationType lib.StateSyncerOperationType) error {
103103
// Track the unique entries we've inserted so we don't insert the same entry twice.
104104
uniqueEntries := consumer.UniqueEntries(entries)
105105

entries/balance.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func BalanceEntryEncoderToPGStruct(balanceEntry *lib.BalanceEntry, keyBytes []by
4646

4747
// PostBatchOperation is the entry point for processing a batch of post entries. It determines the appropriate handler
4848
// based on the operation type and executes it.
49-
func BalanceBatchOperation(entries []*lib.StateChangeEntry, db *bun.DB, params *lib.DeSoParams) error {
49+
func BalanceBatchOperation(entries []*lib.StateChangeEntry, db bun.IDB, params *lib.DeSoParams) error {
5050
// We check before we call this function that there is at least one operation type.
5151
// We also ensure before this that all entries have the same operation type.
5252
operationType := entries[0].OperationType
@@ -63,7 +63,7 @@ func BalanceBatchOperation(entries []*lib.StateChangeEntry, db *bun.DB, params *
6363
}
6464

6565
// bulkInsertBalanceEntry inserts a batch of balance entries into the database.
66-
func bulkInsertBalanceEntry(entries []*lib.StateChangeEntry, db *bun.DB, operationType lib.StateSyncerOperationType, params *lib.DeSoParams) error {
66+
func bulkInsertBalanceEntry(entries []*lib.StateChangeEntry, db bun.IDB, operationType lib.StateSyncerOperationType, params *lib.DeSoParams) error {
6767
// Track the unique entries we've inserted so we don't insert the same entry twice.
6868
uniqueEntries := consumer.UniqueEntries(entries)
6969
// Create a new array to hold the bun struct.
@@ -88,7 +88,7 @@ func bulkInsertBalanceEntry(entries []*lib.StateChangeEntry, db *bun.DB, operati
8888
}
8989

9090
// bulkDeletePostEntry deletes a batch of balance entries from the database.
91-
func bulkDeleteBalanceEntry(entries []*lib.StateChangeEntry, db *bun.DB, operationType lib.StateSyncerOperationType) error {
91+
func bulkDeleteBalanceEntry(entries []*lib.StateChangeEntry, db bun.IDB, operationType lib.StateSyncerOperationType) error {
9292
// Track the unique entries we've inserted so we don't insert the same entry twice.
9393
uniqueEntries := consumer.UniqueEntries(entries)
9494

0 commit comments

Comments
 (0)