Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ee9fbe1
New feature 25 "Deterministic Finality and Ride V9" added.
alexeykiselev Sep 22, 2025
547e9da
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Sep 24, 2025
bb070a1
Added bls signature methods (#1812)
esuwu Sep 29, 2025
59507b9
Added block finality schemas (#1833)
esuwu Sep 29, 2025
95c9e0f
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Sep 30, 2025
c01d622
Ride version 9 added. (#1761)
alexeykiselev Sep 30, 2025
7273f85
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Sep 30, 2025
29fdea9
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Oct 6, 2025
f33a9d2
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Oct 10, 2025
4bf39f1
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Oct 10, 2025
bb7402c
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Oct 15, 2025
72ac0fe
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Oct 15, 2025
c5d3bd5
Protobuf schemas updated to support CommitToGeneration transaction sn…
alexeykiselev Oct 15, 2025
af84eee
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Oct 29, 2025
f201259
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Nov 1, 2025
5ace672
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Nov 5, 2025
6997f12
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Nov 6, 2025
b815c4e
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Nov 18, 2025
46dba65
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Nov 20, 2025
0ee716d
Protobuf schemas submodule updated to the latest commit.
alexeykiselev Nov 21, 2025
b5ccda4
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Nov 25, 2025
68ff378
Restore -exclude-generated flag for gosec.
alexeykiselev Nov 25, 2025
c60d6cf
Merged from master
esuwu Dec 4, 2025
9526746
Merged from master
esuwu Dec 4, 2025
dc5359b
Returned exclude generated
esuwu Dec 4, 2025
999363d
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 5, 2025
caae0de
Merge branch 'master' into determenistic-finality-feature
nickeskov Dec 9, 2025
ecf096f
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 10, 2025
7b47f39
Protobuf code regenerated.
alexeykiselev Dec 10, 2025
a4c2fb9
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 11, 2025
d4f42cf
Protobuf schemas updated and code regenerated.
alexeykiselev Dec 15, 2025
6149756
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 15, 2025
099db31
Merge branch 'master' into determenistic-finality-feature
nickeskov Dec 15, 2025
1463fa0
Add commit to generation transaction (#1841)
alexeykiselev Dec 16, 2025
8d9c3fd
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 16, 2025
87af3f3
Add generation balance validation (#1938)
alexeykiselev Dec 16, 2025
6c8360e
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 17, 2025
9320382
Fix semgrep issues (#1946)
alexeykiselev Dec 17, 2025
56620d6
Fix generation commitment atomic snapshot JSON representation. (#1949)
nickeskov Dec 18, 2025
8377e30
Fix generation commitment atomic atomic snapshot from protobuf (#1950)
nickeskov Dec 18, 2025
f814f38
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 18, 2025
7284746
Add commit to generation transaction to ride v9 (#1953)
alexeykiselev Dec 29, 2025
a11e5aa
Merge branch 'master' into determenistic-finality-feature
alexeykiselev Dec 29, 2025
ee8babd
Fix gosec issues. Original errors wrapped.
alexeykiselev Dec 29, 2025
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
4 changes: 2 additions & 2 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:
uses: securego/gosec@424fc4cd9c82ea0fd6bee9cd49c2db2c3cc0c93f # v2.22.11
with:
# with '-no-fail' we let the report trigger content trigger a failure using the GitHub Security features.
args: "-no-fail -fmt sarif -out gosec.sarif ./..."
args: "-no-fail -exclude-generated -fmt sarif -out gosec.sarif ./..."
- name: Transform gosec SARIF to meet SARIF 2.1.0 schema requirements
# Produces SARIF file has two incompatibilities with SARIF 2.1.0 schema all of them are in `fixes` object:
# 1. Field `description` contains only `markdown` property, but `text` property is mandatory.
# 2. Property `artifactChanges` must be non-empty array with valid `artifactChange` object.
# To fix those issues the first part of jq query copies content of `markdown` field into `text` field
# if it's not present. In the second part if the `fixes` object has null array as `artifactChanges` the empty
# valid `artifactChange` object inserted.
# After fix of mentioned gosec issues this step can be removed.
# After fix of mentioned gosec issues this step can be removed.
run: |
set -e
jq 'walk(if type=="object" and has("markdown") and (.text == null or .text == "") then .text = .markdown else . end) | (.runs[].results[]? .fixes[]? .artifactChanges) |= (if . == null then [{"artifactLocation": { "uri": "" }, "replacements": [{"deletedRegion": {"byteOffset": 0, "byteLength": 0 }}]}] else . end)' gosec.sarif > gosec_fixed.sarif
Expand Down
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "pkg/grpc/protobuf-schemas"]
path = pkg/grpc/protobuf-schemas
url = https://github.com/wavesplatform/protobuf-schemas
branch = deterministic-finality
3 changes: 3 additions & 0 deletions .semgrepignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ cmd/wmd/internal/swagger/

# Ignore testdata folders
pkg/state/testdata/

# Ignore generated files
**/*.pb.go
30 changes: 16 additions & 14 deletions cmd/statecmp/statecmp.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import (
"github.com/pkg/errors"

"github.com/wavesplatform/gowaves/pkg/client"
"github.com/wavesplatform/gowaves/pkg/crypto"
"github.com/wavesplatform/gowaves/pkg/logging"
"github.com/wavesplatform/gowaves/pkg/proto"
)
Expand Down Expand Up @@ -43,10 +44,10 @@ func checkAndUpdateURL(s string) (string, error) {
return u.String(), nil
}

func loadStateHash(ctx context.Context, cl *client.Client, height uint64, tries int) (*proto.StateHash, error) {
func loadStateHash(ctx context.Context, cl *client.Client, height uint64, tries int) (proto.StateHash, error) {
ctx, cancel := context.WithTimeout(ctx, 60*time.Second)
defer cancel()
var sh *proto.StateHash
var sh proto.StateHash
var err error
for range tries {
sh, _, err = cl.Debug.StateHash(ctx, height)
Expand All @@ -61,12 +62,12 @@ type printer struct {
lock sync.Mutex
}

func (p *printer) printDifferentResults(height uint64, res map[proto.FieldsHashes]*nodesGroup) {
func (p *printer) printDifferentResults(height uint64, res map[crypto.Digest]*nodesGroup) {
p.lock.Lock()
defer p.lock.Unlock()

for fh, nodes := range res {
hashJs, err := json.Marshal(fh)
for sh, nodes := range res {
hashJs, err := json.Marshal(sh)
if err != nil {
panic(err)
}
Expand All @@ -76,7 +77,7 @@ func (p *printer) printDifferentResults(height uint64, res map[proto.FieldsHashe
}

type stateHashInfo struct {
hash *proto.StateHash
sh proto.StateHash
node string
}

Expand All @@ -87,12 +88,13 @@ type hashResult struct {

type nodesGroup struct {
nodes []string
sh proto.StateHash
}

func newNodesGroup(first string) *nodesGroup {
func newNodesGroup(first string, sh proto.StateHash) *nodesGroup {
nodes := make([]string, 1)
nodes[0] = first
return &nodesGroup{nodes: nodes}
return &nodesGroup{nodes: nodes, sh: sh}
}

func (ng *nodesGroup) addNode(node string) {
Expand All @@ -112,27 +114,27 @@ func manageHeight(
sh, err := loadStateHash(ctx, cl, height, tries)
res := hashResult{
res: stateHashInfo{
hash: sh,
sh: sh,
node: node,
},
err: err,
}
results <- res
}(cl, node)
}
differentResults := make(map[proto.FieldsHashes]*nodesGroup)
differentResults := make(map[crypto.Digest]*nodesGroup)
for range clients {
hr := <-results
if hr.err != nil {
cancel()
return hr.err
}
fh := hr.res.hash.FieldsHashes
nodesGroup, ok := differentResults[fh]
sh := hr.res.sh
ng, ok := differentResults[sh.GetSumHash()]
if !ok {
differentResults[fh] = newNodesGroup(hr.res.node)
differentResults[sh.GetSumHash()] = newNodesGroup(hr.res.node, sh)
} else {
nodesGroup.addNode(hr.res.node)
ng.addNode(hr.res.node)
}
}
if len(differentResults) != 1 {
Expand Down
34 changes: 21 additions & 13 deletions cmd/statehash/statehash.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ func findLastEqualStateHashes(
) (uint64, error) {
var err error
var r uint64
var lsh, rsh *proto.StateHashDebug
var lsh, rsh proto.StateHashDebug
var start uint64 = 1
for start <= stop {
middle := (start + stop) / 2
Expand All @@ -279,7 +279,7 @@ func findLastEqualStateHashes(
return r, nil
}

func stateHashToString(sh *proto.StateHashDebug) string {
func stateHashToString(sh proto.StateHashDebug) string {
js, err := json.Marshal(sh)
if err != nil {
slog.Error("Failed to render state hash to text", logging.Error(err))
Expand All @@ -288,24 +288,25 @@ func stateHashToString(sh *proto.StateHashDebug) string {
return string(js)
}

func compareStateHashes(sh1, sh2 *proto.StateHashDebug, onlyLegacy bool) (bool, error) {
if sh1.BlockID != sh2.BlockID {
return false, fmt.Errorf("different block IDs: '%s' != '%s'", sh1.BlockID.String(), sh2.BlockID.String())
func compareStateHashes(sh1, sh2 proto.StateHashDebug, onlyLegacy bool) (bool, error) {
if sh1.GetBlockID() != sh2.GetBlockID() {
return false, fmt.Errorf("different block IDs: '%s' != '%s'",
sh1.GetBlockID().String(), sh2.GetBlockID().String())
}
legacyEqual := sh1.SumHash == sh2.SumHash
legacyEqual := sh1.GetSumHash() == sh2.GetSumHash()
if onlyLegacy {
return legacyEqual, nil
}
return legacyEqual && sh1.SnapshotHash == sh2.SnapshotHash, nil
return legacyEqual && sh1.GetSnapshotHash() == sh2.GetSnapshotHash(), nil
}

func compareWithRemote(
ctx context.Context,
sh *proto.StateHashDebug,
sh proto.StateHashDebug,
c *client.Client,
h uint64,
onlyLegacy bool,
) (bool, *proto.StateHashDebug, error) {
) (bool, proto.StateHashDebug, error) {
rsh, err := getRemoteStateHash(ctx, c, h)
if err != nil {
return false, nil, err
Expand All @@ -314,15 +315,15 @@ func compareWithRemote(
return ok, rsh, err
}

func getRemoteStateHash(ctx context.Context, c *client.Client, h uint64) (*proto.StateHashDebug, error) {
func getRemoteStateHash(ctx context.Context, c *client.Client, h uint64) (proto.StateHashDebug, error) {
sh, _, err := c.Debug.StateHashDebug(ctx, h)
if err != nil {
return nil, fmt.Errorf("failed to get state hash at %d height: %w", h, err)
}
return sh, nil
}

func getLocalStateHash(st state.StateInfo, h uint64) (*proto.StateHashDebug, error) {
func getLocalStateHash(st state.StateInfo, h uint64) (proto.StateHashDebug, error) {
const localVersion = "local"
lsh, err := st.LegacyStateHashAtHeight(h)
if err != nil {
Expand All @@ -332,8 +333,15 @@ func getLocalStateHash(st state.StateInfo, h uint64) (*proto.StateHashDebug, err
if err != nil {
return nil, fmt.Errorf("failed to get snapshot state hash at %d height: %w", h, err)
}
shd := proto.NewStateHashJSDebug(*lsh, h, localVersion, snapSH)
return &shd, nil
finalityActivated, err := st.IsActiveAtHeight(int16(settings.DeterministicFinality), h)
if err != nil {
return nil, fmt.Errorf("failed to determine finality activation at %d height: %w", h, err)
}
bh, bhErr := st.BlockByHeight(h)
if bhErr != nil {
return nil, fmt.Errorf("failed to get block at %d height: %w", h, bhErr)
}
return proto.NewStateHashDebug(finalityActivated, lsh, h, localVersion, snapSH, bh.BaseTarget)
}

func showUsage() {
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ require (
github.com/ccoveille/go-safecast/v2 v2.0.0
github.com/cenkalti/backoff/v4 v4.3.0
github.com/cespare/xxhash/v2 v2.3.0
github.com/cloudflare/circl v1.6.1
github.com/consensys/gnark v0.14.0
github.com/consensys/gnark-crypto v0.19.2
github.com/coocood/freecache v1.2.4
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0=
github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs=
github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ=
github.com/consensys/gnark v0.14.0 h1:RG+8WxRanFSFBSlmCDRJnYMYYKpH3Ncs5SMzg24B5HQ=
github.com/consensys/gnark v0.14.0/go.mod h1:1IBpDPB/Rdyh55bQRR4b0z1WvfHQN1e0020jCvKP2Gk=
Expand Down
22 changes: 11 additions & 11 deletions itests/clients/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type HTTPClient struct {
timeout time.Duration
}

func NewHTTPClient(t *testing.T, impl Implementation, port string) *HTTPClient {
func NewHTTPClient(t testing.TB, impl Implementation, port string) *HTTPClient {
c, err := client.NewClient(client.Options{
BaseUrl: "http://" + config.DefaultIP + ":" + port + "/",
Client: &http.Client{Timeout: d.DefaultTimeout},
Expand All @@ -37,7 +37,7 @@ func NewHTTPClient(t *testing.T, impl Implementation, port string) *HTTPClient {
}
}

func (c *HTTPClient) GetHeight(t *testing.T, opts ...config.WaitOption) *client.BlocksHeight {
func (c *HTTPClient) GetHeight(t testing.TB, opts ...config.WaitOption) *client.BlocksHeight {
params := config.NewWaitParams(opts...)
ctx, cancel := context.WithTimeout(params.Ctx, params.Timeout)
defer cancel()
Expand All @@ -46,7 +46,7 @@ func (c *HTTPClient) GetHeight(t *testing.T, opts ...config.WaitOption) *client.
return h
}

func (c *HTTPClient) StateHash(t *testing.T, height uint64, opts ...config.WaitOption) *proto.StateHash {
func (c *HTTPClient) StateHash(t testing.TB, height uint64, opts ...config.WaitOption) proto.StateHash {
params := config.NewWaitParams(opts...)
ctx, cancel := context.WithTimeout(params.Ctx, params.Timeout)
defer cancel()
Expand All @@ -55,7 +55,7 @@ func (c *HTTPClient) StateHash(t *testing.T, height uint64, opts ...config.WaitO
return stateHash
}

func (c *HTTPClient) PrintMsg(t *testing.T, msg string) {
func (c *HTTPClient) PrintMsg(t testing.TB, msg string) {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
_, err := c.cli.Debug.PrintMsg(ctx, msg)
Expand All @@ -69,7 +69,7 @@ func (c *HTTPClient) GetAssetDetails(assetID crypto.Digest) (*client.AssetsDetai
return details, err
}

func (c *HTTPClient) TransactionInfo(t *testing.T, id crypto.Digest) proto.Transaction {
func (c *HTTPClient) TransactionInfo(t testing.TB, id crypto.Digest) proto.Transaction {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
info, _, err := c.cli.Transactions.Info(ctx, id)
Expand All @@ -89,7 +89,7 @@ func (c *HTTPClient) TransactionBroadcast(transaction proto.Transaction) (*clien
return c.cli.Transactions.Broadcast(ctx, transaction)
}

func (c *HTTPClient) WavesBalance(t *testing.T, address proto.WavesAddress) *client.AddressesBalance {
func (c *HTTPClient) WavesBalance(t testing.TB, address proto.WavesAddress) *client.AddressesBalance {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
balance, _, err := c.cli.Addresses.Balance(ctx, address)
Expand All @@ -98,7 +98,7 @@ func (c *HTTPClient) WavesBalance(t *testing.T, address proto.WavesAddress) *cli
}

func (c *HTTPClient) AssetBalance(
t *testing.T, address proto.WavesAddress, assetID crypto.Digest,
t testing.TB, address proto.WavesAddress, assetID crypto.Digest,
) *client.AssetsBalanceAndAsset {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()
Expand All @@ -118,7 +118,7 @@ func (c *HTTPClient) ConnectedPeersCtx(ctx context.Context) ([]*client.PeersConn
return connectedPeers, resp, err
}

func (c *HTTPClient) BlockHeader(t *testing.T, height proto.Height) *client.Headers {
func (c *HTTPClient) BlockHeader(t testing.TB, height proto.Height) *client.Headers {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()

Expand All @@ -127,7 +127,7 @@ func (c *HTTPClient) BlockHeader(t *testing.T, height proto.Height) *client.Head
return header
}

func (c *HTTPClient) Rewards(t *testing.T) *client.RewardInfo {
func (c *HTTPClient) Rewards(t testing.TB) *client.RewardInfo {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()

Expand All @@ -136,7 +136,7 @@ func (c *HTTPClient) Rewards(t *testing.T) *client.RewardInfo {
return rewardInfo
}

func (c *HTTPClient) RewardsAtHeight(t *testing.T, height proto.Height) *client.RewardInfo {
func (c *HTTPClient) RewardsAtHeight(t testing.TB, height proto.Height) *client.RewardInfo {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()

Expand All @@ -145,7 +145,7 @@ func (c *HTTPClient) RewardsAtHeight(t *testing.T, height proto.Height) *client.
return rewardInfo
}

func (c *HTTPClient) RollbackToHeight(t *testing.T, height uint64, returnTxToUtx bool) *proto.BlockID {
func (c *HTTPClient) RollbackToHeight(t testing.TB, height uint64, returnTxToUtx bool) *proto.BlockID {
ctx, cancel := context.WithTimeout(context.Background(), c.timeout)
defer cancel()

Expand Down
Loading
Loading