Skip to content

Commit dcda7dc

Browse files
committed
Merge remote-tracking branch 'origin/develop' into poet-issue-501
2 parents 8302f4c + c4e59b6 commit dcda7dc

File tree

86 files changed

+9838
-1254
lines changed

Some content is hidden

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

86 files changed

+9838
-1254
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ jobs:
8686
make test-fmt
8787
make test-tidy
8888
make test-generate
89+
- name: Check for vulnerabilities
90+
run: make vulncheck
8991

9092
lint:
9193
runs-on: ubuntu-22.04
@@ -203,7 +205,7 @@ jobs:
203205
- name: test coverage
204206
run: make cover
205207
- name: Upload to codecov.io
206-
uses: codecov/codecov-action@v4
208+
uses: codecov/codecov-action@v5
207209
with:
208210
token: ${{ secrets.CODECOV_TOKEN }}
209211

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ See [RELEASE](./RELEASE.md) for workflow instructions.
66

77
### Improvements
88

9-
* [#6431](https://github.com/spacemeshos/go-spacemesh/pull/6431) Fix db-allow-schema-drift handling
109
* [#6408](https://github.com/spacemeshos/go-spacemesh/pull/6408) Prevent empty DB connection pool by freeing connections
1110
upon errors during DB operations. This mostly fixes issues when a node is under heavy load from the API.
1211

@@ -16,6 +15,13 @@ See [RELEASE](./RELEASE.md) for workflow instructions.
1615
* [#6422](https://github.com/spacemeshos/go-spacemesh/pull/6422) Further improved performance of the proposal building
1716
process to avoid late proposals.
1817

18+
* [#6443](https://github.com/spacemeshos/go-spacemesh/pull/6443) Improve eviction of ineffectual transactions in the database
19+
which will now show up as ineffectual when querying them from the API.
20+
21+
* [#6431](https://github.com/spacemeshos/go-spacemesh/pull/6431) Fix db-allow-schema-drift handling
22+
23+
* [#6451](https://github.com/spacemeshos/go-spacemesh/pull/6451) Fix a possible deadloop in the beacon protocol.
24+
1925
## v1.7.6
2026

2127
### Upgrade information

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
44

55
GOLANGCI_LINT_VERSION := v1.61.0
66
GOTESTSUM_VERSION := v1.12.0
7+
GOVULNCHECK_VERSION := v1.1.3
78
GOSCALE_VERSION := v1.2.0
89
MOCKGEN_VERSION := v0.5.0
910

@@ -68,6 +69,7 @@ install:
6869
go install github.com/spacemeshos/go-scale/scalegen@$(GOSCALE_VERSION)
6970
go install go.uber.org/mock/mockgen@$(MOCKGEN_VERSION)
7071
go install gotest.tools/gotestsum@$(GOTESTSUM_VERSION)
72+
go install golang.org/x/vuln/cmd/govulncheck@$(GOVULNCHECK_VERSION)
7173
.PHONY: install
7274

7375
build: go-spacemesh get-profiler get-postrs-service
@@ -146,6 +148,10 @@ cover: get-libs
146148
@$(ULIMIT) CGO_LDFLAGS="$(CGO_TEST_LDFLAGS)" go test -coverprofile=cover.out -p 1 -timeout 30m -coverpkg=./... $(UNIT_TESTS)
147149
.PHONY: cover
148150

151+
vulncheck: get-libs
152+
govulncheck ./...
153+
.PHONY: vulncheck
154+
149155
list-versions:
150156
@echo "Latest 5 tagged versions:\n"
151157
@git for-each-ref --sort=-creatordate --count=5 --format '%(creatordate:short): %(refname:short)' refs/tags

activation/handler.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ func NewHandler(
146146
fetcher: fetcher,
147147
beacon: beacon,
148148
tortoise: tortoise,
149-
malPublisher: &MalfeasancePublisher{},
149+
malPublisher: &MalfeasancePublisher{}, // TODO(mafa): pass real publisher when available
150150
},
151151
}
152152

activation/handler_test.go

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"errors"
66
"fmt"
7+
"slices"
78
"sort"
89
"testing"
910
"testing/quick"
@@ -128,7 +129,7 @@ type handlerMocks struct {
128129
mValidator *MocknipostValidator
129130
mbeacon *MockAtxReceiver
130131
mtortoise *mocks.MockTortoise
131-
mMalPublish *MockmalfeasancePublisher
132+
mMalPublish *MockatxMalfeasancePublisher
132133
}
133134

134135
type testHandler struct {
@@ -159,6 +160,7 @@ func (h *handlerMocks) expectAtxV1(atx *wire.ActivationTxV1, nodeId types.NodeID
159160
}
160161
h.mockFetch.EXPECT().RegisterPeerHashes(gomock.Any(), gomock.Any())
161162
h.mockFetch.EXPECT().GetPoetProof(gomock.Any(), types.BytesToHash(atx.NIPost.PostMetadata.Challenge))
163+
deps := []types.ATXID{atx.PrevATXID, atx.PositioningATXID}
162164
if atx.PrevATXID == types.EmptyATXID {
163165
h.mValidator.EXPECT().InitialNIPostChallengeV1(gomock.Any(), gomock.Any(), h.goldenATXID)
164166
h.mValidator.EXPECT().
@@ -170,9 +172,17 @@ func (h *handlerMocks) expectAtxV1(atx *wire.ActivationTxV1, nodeId types.NodeID
170172
time.Sleep(settings.postVerificationDuration)
171173
return nil
172174
})
175+
deps = append(deps, *atx.CommitmentATXID)
173176
} else {
174177
h.mValidator.EXPECT().NIPostChallengeV1(gomock.Any(), gomock.Any(), nodeId)
175178
}
179+
deps = slices.Compact(deps)
180+
deps = slices.DeleteFunc(deps, func(dep types.ATXID) bool {
181+
return dep == types.EmptyATXID || dep == h.goldenATXID
182+
})
183+
if len(deps) > 0 {
184+
h.mockFetch.EXPECT().GetAtxs(gomock.Any(), deps, gomock.Any())
185+
}
176186
h.mValidator.EXPECT().PositioningAtx(atx.PositioningATXID, gomock.Any(), h.goldenATXID, atx.PublishEpoch)
177187
h.mValidator.EXPECT().
178188
NIPost(gomock.Any(), nodeId, h.goldenATXID, gomock.Any(), gomock.Any(), atx.NumUnits, gomock.Any()).
@@ -194,7 +204,7 @@ func newTestHandlerMocks(tb testing.TB, golden types.ATXID) handlerMocks {
194204
mValidator: NewMocknipostValidator(ctrl),
195205
mbeacon: NewMockAtxReceiver(ctrl),
196206
mtortoise: mocks.NewMockTortoise(ctrl),
197-
mMalPublish: NewMockmalfeasancePublisher(ctrl),
207+
mMalPublish: NewMockatxMalfeasancePublisher(ctrl),
198208
}
199209
}
200210

@@ -205,6 +215,8 @@ func newTestHandler(tb testing.TB, goldenATXID types.ATXID, opts ...HandlerOptio
205215
edVerifier := signing.NewEdVerifier()
206216

207217
mocks := newTestHandlerMocks(tb, goldenATXID)
218+
// TODO(mafa): make mandatory parameter when real publisher is available
219+
opts = append(opts, func(h *Handler) { h.v2.malPublisher = mocks.mMalPublish })
208220
atxHdlr := NewHandler(
209221
"localID",
210222
cdb,
@@ -341,7 +353,6 @@ func TestHandler_ProcessAtxStoresNewVRFNonce(t *testing.T) {
341353
atx2.VRFNonce = (*uint64)(&nonce2)
342354
atx2.Sign(sig)
343355
atxHdlr.expectAtxV1(atx2, sig.NodeID())
344-
atxHdlr.mockFetch.EXPECT().GetAtxs(gomock.Any(), gomock.Any(), gomock.Any())
345356
require.NoError(t, atxHdlr.HandleGossipAtx(context.Background(), "", codec.MustEncode(atx2)))
346357

347358
got, err = atxs.VRFNonce(atxHdlr.cdb, sig.NodeID(), atx2.PublishEpoch+1)
@@ -391,7 +402,6 @@ func TestHandler_HandleGossipAtx(t *testing.T) {
391402

392403
// second is now valid (deps are in)
393404
atxHdlr.expectAtxV1(second, sig.NodeID())
394-
atxHdlr.mockFetch.EXPECT().GetAtxs(gomock.Any(), []types.ATXID{second.PrevATXID}, gomock.Any())
395405
require.NoError(t, atxHdlr.HandleGossipAtx(context.Background(), "", codec.MustEncode(second)))
396406
}
397407

@@ -695,7 +705,6 @@ func TestHandler_AtxWeight(t *testing.T) {
695705
buf = codec.MustEncode(atx2)
696706

697707
atxHdlr.expectAtxV1(atx2, sig.NodeID(), func(o *atxHandleOpts) { o.poetLeaves = leaves })
698-
atxHdlr.mockFetch.EXPECT().GetAtxs(gomock.Any(), []types.ATXID{atx1.ID()}, gomock.Any())
699708
require.NoError(t, atxHdlr.HandleSyncedAtx(context.Background(), atx2.ID().Hash32(), peer, buf))
700709

701710
stored2, err := atxHdlr.cdb.GetAtx(atx2.ID())

0 commit comments

Comments
 (0)