Skip to content

Commit fb4b011

Browse files
authored
Merge pull request #105 from qubic/tx-body-digest
Implement quorum structure changes
2 parents 41e2234 + f95e41b commit fb4b011

16 files changed

Lines changed: 1364 additions & 1102 deletions

File tree

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Test branch and deploy to Github Container Registry
2+
3+
on:
4+
push:
5+
branches:
6+
- 'tx-body-digest'
7+
8+
jobs:
9+
test:
10+
name: "Perform GO tests"
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
go-version: [ '1.22.x' ]
16+
17+
steps:
18+
- name: "Git checkout"
19+
uses: actions/checkout@v4
20+
21+
- name: "Setup go environment"
22+
uses: actions/setup-go@v4
23+
with:
24+
go-version: ${{matrix.go-version}}
25+
cache: false
26+
27+
- name: "Perform tests"
28+
run: 'go test ./...'
29+
30+
publish:
31+
name: "Build package and deploy to Github Container Registry"
32+
runs-on: ubuntu-latest
33+
needs: test
34+
35+
steps:
36+
- name: "Git checkout"
37+
uses: actions/checkout@v4
38+
39+
- name: "Log into Github Container Registry"
40+
uses: docker/login-action@v3
41+
with:
42+
registry: "ghcr.io"
43+
username: ${{github.actor}}
44+
password: ${{secrets.GITHUB_TOKEN}}
45+
46+
- name: "Build package"
47+
run: 'docker build . --tag ghcr.io/qubic/qubic-archiver:${{github.ref_name}}'
48+
49+
- name: "Publish package"
50+
run: 'docker push ghcr.io/qubic/qubic-archiver:${{github.ref_name}}'

go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@ require (
77
github.com/cloudflare/circl v1.5.0
88
github.com/cockroachdb/pebble v1.1.2
99
github.com/google/go-cmp v0.6.0
10-
github.com/google/martian v2.1.0+incompatible
1110
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0
1211
github.com/pkg/errors v0.9.1
13-
github.com/qubic/go-node-connector v0.10.2
12+
github.com/qubic/go-node-connector v0.11.0
1413
github.com/qubic/go-schnorrq v1.0.1
1514
github.com/stretchr/testify v1.10.0
1615
go.uber.org/zap v1.27.0

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
148148
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
149149
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
150150
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
151-
github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no=
152151
github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs=
153152
github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0=
154153
github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
@@ -235,8 +234,8 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
235234
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
236235
github.com/prometheus/procfs v0.7.3 h1:4jVXhlkAyzOScmCkXBTOLRLTz8EeU+eyjrwB/EPq0VU=
237236
github.com/prometheus/procfs v0.7.3/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
238-
github.com/qubic/go-node-connector v0.10.2 h1:GRa+HI7JABJXn2rC/MSh2VgGpGBpNdqtS/Z0MZsUkhM=
239-
github.com/qubic/go-node-connector v0.10.2/go.mod h1:jLbmYx2GUh8Ctk5zULFepgho7yoGZXrU8/tMk+fcuEc=
237+
github.com/qubic/go-node-connector v0.11.0 h1:7gNoMN1UnODiuLRs4fjdxS4/d3Qc3+FjJJKUByH1BP0=
238+
github.com/qubic/go-node-connector v0.11.0/go.mod h1:jLbmYx2GUh8Ctk5zULFepgho7yoGZXrU8/tMk+fcuEc=
240239
github.com/qubic/go-schnorrq v1.0.1 h1:F0R/BQVf+O7Bp57NGJmc3uXlqsaIzerg/1bmU4jMLLE=
241240
github.com/qubic/go-schnorrq v1.0.1/go.mod h1:j2qw/zHiyjH9GAScAAETWpZk6iELbjYnzIg7CQwc5wM=
242241
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=

main.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ func run() error {
5050
IdleTimeout time.Duration `conf:"default:15s"`
5151
}
5252
Qubic struct {
53-
NodePort string `conf:"default:21841"`
54-
StorageFolder string `conf:"default:store"`
55-
ProcessTickTimeout time.Duration `conf:"default:5s"`
53+
NodePort string `conf:"default:21841"`
54+
StorageFolder string `conf:"default:store"`
55+
ProcessTickTimeout time.Duration `conf:"default:5s"`
56+
DisableTransactionStatusAddon bool `conf:"default:false"`
5657
ArbitratorIdentity string `conf:"default:AFZPUAIYVPNUYGJRQVLUKOPPVLHAZQTGLYAAUUNBXFTVTAMSBKQBLEIEPCVJ"`
5758
}
5859
Store struct {
@@ -183,7 +184,7 @@ func run() error {
183184
return errors.Wrapf(err, "getting arbitrator public key from [%s]", cfg.Qubic.ArbitratorIdentity)
184185
}
185186

186-
proc := processor.NewProcessor(p, ps, cfg.Qubic.ProcessTickTimeout, arbitratorPubKey)
187+
proc := processor.NewProcessor(p, ps, cfg.Qubic.ProcessTickTimeout, arbitratorPubKey, cfg.Qubic.DisableTransactionStatusAddon)
187188
procErrors := make(chan error, 1)
188189

189190
// Start the service listening for requests.

processor/processor.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ type Processor struct {
3030
ps *store.PebbleStore
3131
arbitratorPubKey [32]byte
3232
processTickTimeout time.Duration
33+
disableStatusAddon bool
3334
}
3435

35-
func NewProcessor(p *qubic.Pool, ps *store.PebbleStore, processTickTimeout time.Duration, arbitratorPubKey [32]byte) *Processor {
36+
func NewProcessor(p *qubic.Pool, ps *store.PebbleStore, processTickTimeout time.Duration, arbitratorPubKey [32]byte, disableStatusAddon bool) *Processor {
3637
return &Processor{
3738
pool: p,
3839
ps: ps,
3940
processTickTimeout: processTickTimeout,
4041
arbitratorPubKey: arbitratorPubKey,
42+
disableStatusAddon: disableStatusAddon,
4143
}
4244
}
4345

@@ -98,7 +100,7 @@ func (p *Processor) processOneByOne() error {
98100
}
99101

100102
val := validator.New(client, p.ps, p.arbitratorPubKey)
101-
err = val.ValidateTick(ctx, tickInfo.InitialTick, nextTick.TickNumber)
103+
err = val.ValidateTick(ctx, tickInfo.InitialTick, nextTick.TickNumber, p.disableStatusAddon)
102104
if err != nil {
103105
return errors.Wrapf(err, "validating tick %d", nextTick.TickNumber)
104106
}

0 commit comments

Comments
 (0)