Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/maintest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ jobs:
test:
strategy:
matrix:
go-version: [1.19.x, 1.20.x]
go-version: [1.25.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: ApiTest
run: make test-api
- name: MainTest
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@v5
with:
go-version: ">=1.19.0"
go-version: "1.25.x"
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v4
uses: goreleaser/goreleaser-action@v6
with:
distribution: goreleaser
version: latest
version: v2.17.0-d9421c5f-nightly
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions .github/workflows/swag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ jobs:
doc:
strategy:
matrix:
go-version: [1.19.x, 1.20.x]
go-version: [1.25.x]
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Checkout code
uses: actions/checkout@v4
- name: Swag
run: |
make gen-doc
23 changes: 11 additions & 12 deletions .github/workflows/update.api.page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,19 @@ on:

jobs:
update:
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: ">=1.19.0"
uses: actions/setup-go@v5
with:
go-version: "1.25.x"

- name: Checkout quorum repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Swag Init
run: |
go install github.com/swaggo/swag/cmd/swag@v1.7.0
make gen-doc
- name: Swag Init
run: |
make gen-doc

- name: Check swagger.json generated
id: check_files
Expand All @@ -35,19 +34,19 @@ jobs:
exit 1

- name: Upload swagger.json to artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: quorum-artifact
path: docs/swagger.json

- name: Checkout quorum-api repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: rumsystem/quorum-api
ssh-key: ${{ secrets.QUORUM_API_ACCESS_KEY }}

- name: Download swagger.json from artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: quorum-artifact
path: docs
Expand Down
49 changes: 24 additions & 25 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Make sure to check the documentation at https://goreleaser.com
version: 2
builds:
- id: quorum
env:
Expand All @@ -14,33 +15,30 @@ builds:
-w
-X main.GitCommit={{.ShortCommit}}
hooks:
# Ignores failures, this is just best effort.
post: find dist -name 'quorum*' -type f -print0 | xargs -n 1 -0 upx
post: sh -c 'command -v upx >/dev/null && find dist -name "quorum*" -type f -print0 | xargs -n 1 -0 upx || true'

dockers:
- image_templates:
["ghcr.io/rumsystem/{{ .ProjectName }}:{{ .Version }}-amd64"]
goarch: amd64
goos: linux
dockers_v2:
- id: quorum
ids:
- quorum
images:
- ghcr.io/rumsystem/{{ .ProjectName }}
tags:
- "{{ .Version }}"
- latest
dockerfile: Dockerfile-goreleaser
build_flag_templates:
- --platform=linux/amd64
- --label=org.opencontainers.image.title={{ .ProjectName }}
- --label=org.opencontainers.image.url=https://github.com/rumsystem/{{ .ProjectName }}
- --label=org.opencontainers.image.version={{ .Version }}
- --label=org.opencontainers.image.created={{ time "2006-01-02T15:04:05Z07:00" }}
- --label=org.opencontainers.image.revision={{ .FullCommit }}

docker_manifests:
- name_template: ghcr.io/rumsystem/{{ .ProjectName }}:{{ .Version }}
image_templates:
- ghcr.io/rumsystem/{{ .ProjectName }}:{{ .Version }}-amd64
- name_template: ghcr.io/rumsystem/{{ .ProjectName }}:latest
image_templates:
- ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Version }}-amd64
platforms:
- linux/amd64
labels:
org.opencontainers.image.title: "{{ .ProjectName }}"
org.opencontainers.image.url: "https://github.com/rumsystem/{{ .ProjectName }}"
org.opencontainers.image.version: "{{ .Version }}"
org.opencontainers.image.created: '{{ time "2006-01-02T15:04:05Z07:00" }}'
org.opencontainers.image.revision: "{{ .FullCommit }}"

archives:
- format: tar.gz
- formats:
- tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
Expand All @@ -52,11 +50,12 @@ archives:
# use zip for windows archives
format_overrides:
- goos: windows
format: zip
formats:
- zip
checksum:
name_template: "checksums.txt"
snapshot:
name_template: "{{ incpatch .Version }}-next"
version_template: "{{ incpatch .Version }}-next"
release:
github:
owner: rumsystem
Expand Down
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
FROM golang:1.20-alpine AS build
FROM golang:1.25-alpine AS build
RUN addgroup -S quorum && adduser -S -G quorum quorum
RUN apk add build-base
RUN apk add git
RUN apk add --no-cache git
WORKDIR /src
COPY . .
RUN make linux

FROM scratch
WORKDIR /
COPY --from=build /src/dist/quorum_linux_amd64_v1/quorum /quorum
COPY --from=build /etc/passwd /etc/passwd
COPY --from=build /etc/group /etc/group
COPY --from=build /src/dist/quorum_linux_amd64/quorum /quorum
EXPOSE 8000
EXPOSE 8001
EXPOSE 8002
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile-goreleaser
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM scratch
WORKDIR /
COPY quorum /quorum
ARG TARGETPLATFORM
COPY $TARGETPLATFORM/quorum /quorum
EXPOSE 8000
EXPOSE 8001
EXPOSE 8002
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ A peer-to-peer system must provide economic incentive to minimize the Free-rider

<span id="build_quorum"></span>

Build the quorum binary by running the command: `make linux` or `make buildall`. You can find the binary file in the `dist` dir.
Build the quorum binary by running the command: `make linux` for Linux amd64 or `make buildall` for all supported amd64 targets. You can find the binary file in the `dist` dir.

Release packaging uses GoReleaser separately: run `make goreleaser-build` for a local Linux amd64 snapshot package, `make goreleaser-build-all` for all configured snapshot packages, or `make release` for a release build.

*or*

Expand Down Expand Up @@ -322,7 +324,7 @@ Add more producers to prevent outages.

### Run a RUM peer on server

1. Build the quorum binary by running the command: `make linux` or `make buildall`. You can find the binary file in the `dist` dir.
1. Build the quorum binary by running the command: `make linux` or `make buildall`. You can find the binary file in the `dist` dir.
2. Add a shell script to run the peer:

Using the system environment variable `RUM_KSPASSWD` or add the param `keystorepwd`.
Expand Down
67 changes: 0 additions & 67 deletions Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ You can try:
- [Get group allow/deny list](#api-get-list)
- [API Update for client api](#about-chainconfig-for-client)
- [SnapShot](#about-snapshot)
- [Pubqueue](#about-pubqueue)

Common params:

Expand Down Expand Up @@ -2150,72 +2149,6 @@ Owner will send snapshot every 1 minute regardless if there is anything changed,

Snapshot rule doesn't apply to a producer node. A producer node still need wait till block syncing finished to make new block.

[>>> Back to Top](#top)

<span id="about-pubqueue"></span>

# Pubqueue

pubqueue keeps track of the status of user-sent TRXs, TRXs that succeed will be marked, and failed TRXs will be retried until the 10th failure.

By default, after a client sending TRXs, the client needs to query the corresponding TRXs' follow-up status via pubqueue, and for TRXs that succeed or failed 10 times, the client should ACK these TRXs with specific API (otherwise they will consume your system resources).

If you don't care about the state of TRXs, quorum provides an autoack feature by adding the command line argument `-autoack=true` when starting quorum.

There are two interfaces involved here.


1. GET `/v1/group/:group_id/pubqueue`

example

```
curl "http://localhost:8004/api/v1/group/6bd70de8-addc-4b03-8271-a5a5b02d1ebd/pubqueue" | jq
```


```
{
"GroupId": "6bd70de8-addc-4b03-8271-a5a5b02d1ebd",
"Data": [
{
"GroupId": "6bd70de8-addc-4b03-8271-a5a5b02d1ebd",
"State": "SUCCESS",
"RetryCount": 0,
"UpdateAt": "1650786473293614500",
"Trx": {
"TrxId": "b5433111-f3a1-41e2-a03f-648e47a04dad",
"GroupId": "6bd70de8-addc-4b03-8271-a5a5b02d1ebd",
"Data": "jvFEEhBuwRpu7or2IUt8NdTZ1R/qzlXeJeseU7csZi+XYC28Fufj3aORoKVCAXyxBxZCuHe7kp6tKAScNxClqEX82+As+fKsBK6zTpB9gyO+fn2y",
"TimeStamp": "1650532131665550100",
"Version": "1.0.0",
"Expired": 1650532161665550000,
"Nonce": 24000,
"SenderPubkey": "CAISIQMrNsVK8/ZrJylBFJZEe6BnslK7B5wAygbxde+RG9Hafg==",
"SenderSign": "MEQCIDZlG/ILNC89z/OYEuADqYpHfx81pqA3RnOlLSCeypP3AiAFKLSD8M8TyNr6quYFCnuL1nzMwUlHWiEiVimDFCHlmQ=="
},
"StorageType": "CHAIN"
}
]
}
```


2. POST `POST /v1/trx/ack`

It will return the TRXs that are succeefully acked.

example

```
curl -X POST -H 'Content-Type: application/json' -d '{"trx_ids": ["b5433111-f3a1-41e2-a03f-648e47a04dad"]}' "http://localhost:8004/api/v1/trx/ack"
```

```
["b5433111-f3a1-41e2-a03f-648e47a04dad"]
```


[>>> Back to Top](#top)

<span id="param-list"></span>
Expand Down
48 changes: 2 additions & 46 deletions cmd/cli/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,40 +130,6 @@ func ForceSyncGroup(groupId string) (syncRes *GroupForceSyncRetStruct, err error
return &ret, nil
}

func GetPubQueue(groupId string, trxId string, status string) (*handlers.PubQueueInfo, error) {
url := fmt.Sprintf(
"%s/api/v1/group/%s/pubqueue?trx=%s&status=%s", ApiServer, groupId, trxId, status)
ret := handlers.PubQueueInfo{}
body, err := httpGet(url)
if err != nil {
return nil, err
}
err = json.Unmarshal(body, &ret)
if err != nil || ret.GroupId == "" {
return nil, errors.New(string(body))
}
return &ret, nil
}

func PubQueueAck(trxIds []string) ([]string, error) {
url := fmt.Sprintf("%s/api/v1/trx/ack", ApiServer)
param := qApi.PubQueueAckPayload{trxIds}
payload, err := json.Marshal(&param)
if err != nil {
return nil, err
}
ret := []string{}
body, err := httpPost(url, payload)
if err != nil {
return nil, err
}
err = json.Unmarshal(body, &ret)
if err != nil {
return nil, errors.New(string(body))
}
return ret, nil
}

func IsQuorumContentMessage(content ContentStruct) bool {
// only support Note
if content.TypeUrl == "quorum.pb.Object" {
Expand All @@ -186,14 +152,6 @@ func IsQuorumContentUserInfo(content ContentStruct) bool {
return false
}

func AddGroupConfig(groupId, key, tp, value, memo string) (*handlers.AppConfigResult, error) {
return ModifyGroupConfig("add", groupId, key, tp, value, memo)
}

func DelGroupConfig(groupId, key, tp, value, memo string) (*handlers.AppConfigResult, error) {
return ModifyGroupConfig("del", groupId, key, tp, value, memo)
}

func ModifyGroupConfig(action, groupId, key, tp, value, memo string) (*handlers.AppConfigResult, error) {
data := handlers.AppConfigParam{
Action: action,
Expand Down Expand Up @@ -595,14 +553,12 @@ func ApproveAnnouncedProducer(groupId string, user *handlers.AnnouncedProducerLi
ret := &handlers.GrpProducerResult{}
url := ApiServer + "/api/v1/group/producer"

action := "add"
if removal {
action = "remove"
return nil, errors.New("producer removal is not supported by the current chain API")
}

data := handlers.GrpProducerParam{
Action: action,
ProducerPubkey: user.AnnouncedPubkey,
ProducerPubkey: []string{user.AnnouncedPubkey},
GroupId: groupId,
Memo: "by cli",
}
Expand Down
Loading
Loading