-
Notifications
You must be signed in to change notification settings - Fork 72
New feature 25 "Deterministic Finality and Ride V9" added. #1834
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alexeykiselev
wants to merge
85
commits into
master
Choose a base branch
from
determenistic-finality-feature
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
85 commits
Select commit
Hold shift + click to select a range
ee9fbe1
New feature 25 "Deterministic Finality and Ride V9" added.
alexeykiselev 547e9da
Merge branch 'master' into determenistic-finality-feature
alexeykiselev bb070a1
Added bls signature methods (#1812)
esuwu 59507b9
Added block finality schemas (#1833)
esuwu 95c9e0f
Merge branch 'master' into determenistic-finality-feature
alexeykiselev c01d622
Ride version 9 added. (#1761)
alexeykiselev 7273f85
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 29fdea9
Merge branch 'master' into determenistic-finality-feature
alexeykiselev f33a9d2
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 4bf39f1
Merge branch 'master' into determenistic-finality-feature
alexeykiselev bb7402c
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 72ac0fe
Merge branch 'master' into determenistic-finality-feature
alexeykiselev c5d3bd5
Protobuf schemas updated to support CommitToGeneration transaction sn…
alexeykiselev af84eee
Merge branch 'master' into determenistic-finality-feature
alexeykiselev f201259
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 5ace672
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 6997f12
Merge branch 'master' into determenistic-finality-feature
alexeykiselev b815c4e
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 46dba65
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 0ee716d
Protobuf schemas submodule updated to the latest commit.
alexeykiselev b5ccda4
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 68ff378
Restore -exclude-generated flag for gosec.
alexeykiselev c60d6cf
Merged from master
esuwu 9526746
Merged from master
esuwu dc5359b
Returned exclude generated
esuwu 999363d
Merge branch 'master' into determenistic-finality-feature
alexeykiselev caae0de
Merge branch 'master' into determenistic-finality-feature
nickeskov ecf096f
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 7b47f39
Protobuf code regenerated.
alexeykiselev a4c2fb9
Merge branch 'master' into determenistic-finality-feature
alexeykiselev d4f42cf
Protobuf schemas updated and code regenerated.
alexeykiselev 6149756
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 099db31
Merge branch 'master' into determenistic-finality-feature
nickeskov 1463fa0
Add commit to generation transaction (#1841)
alexeykiselev 8d9c3fd
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 87af3f3
Add generation balance validation (#1938)
alexeykiselev 6c8360e
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 9320382
Fix semgrep issues (#1946)
alexeykiselev 56620d6
Fix generation commitment atomic snapshot JSON representation. (#1949)
nickeskov 8377e30
Fix generation commitment atomic atomic snapshot from protobuf (#1950)
nickeskov f814f38
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 7284746
Add commit to generation transaction to ride v9 (#1953)
alexeykiselev a11e5aa
Merge branch 'master' into determenistic-finality-feature
alexeykiselev ee8babd
Fix gosec issues. Original errors wrapped.
alexeykiselev 3f4519f
Merge branch 'master' into determenistic-finality-feature
alexeykiselev dbf124b
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 5f2e490
Backport missing LibV9 switch branches from PR #1957. (#1967)
alexeykiselev eae7196
Scala-compatible way of BLS keys generation added. (#1971)
alexeykiselev 4b5b1b7
Merge branch 'master' into determenistic-finality-feature
alexeykiselev bf284d7
P-256 signature verification with Ride V9 (#1957)
nickeskov 62bedbe
Go version updated to 1.25. (#1985)
alexeykiselev f1fafa1
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 4881ec9
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 1396934
Complexities of SHA256 functions updated for RideV9. (#1990)
alexeykiselev ec904d4
Support Finality and Block Endorsements (#1852)
esuwu b8f32c6
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 705cc5c
Added the lower bound finalization calculation, even if finalization …
esuwu 22dd0f3
Cleared endorsement pool caches for rollbacks
esuwu 0f99416
Broken linter directive removed.
alexeykiselev 6249ae7
Signing a CommitToGeneration transaction using API without providing …
alexeykiselev a3be1f3
Added function to combine FinalizationVoting structures. (#2012)
alexeykiselev 4a192c9
Finality forks fix (#2013)
esuwu 528c99b
Modify Ride function SecP256Verify so it accepts message and calculat…
alexeykiselev 44b3b37
Fix bug with 'resetDeposits' method: newest method should be used.
nickeskov 41e821c
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 78a9e73
Update circl to v1.6.3. Update exp to latest version.
alexeykiselev bd950d0
Merge branch 'master' into determenistic-finality-feature
alexeykiselev f6f472b
Merge branch 'master' into determenistic-finality-feature
alexeykiselev b597986
Fix bug with EOF error in 'prepareFinalizationVerification'.
nickeskov ccc7487
Merge branch 'master' into determenistic-finality-feature
alexeykiselev a9d019b
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 33c9773
Merge branch 'master' into determenistic-finality-feature
alexeykiselev e1a3964
Added delayed finalization (#2017)
esuwu 224a6bf
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 522fe19
New event BlockEndorsementEvent added to all states. (#2045)
alexeykiselev 4f5342c
Utility to create CommitToGeneration transactions added. (#2044)
alexeykiselev 6f6bc8b
Merge branch 'master' into determenistic-finality-feature
alexeykiselev 4545807
Merge branch 'master' into determenistic-finality-feature
nickeskov 83ec0e7
Merge branch 'master' into determenistic-finality-feature
alexeykiselev b3afef4
Merge branch 'master' into determenistic-finality-feature
alexeykiselev aeef4e4
Merge branch 'master' into determenistic-finality-feature
alexeykiselev bf64777
Merge branch 'master' into determenistic-finality-feature
alexeykiselev fea0c10
Generators set (#2055)
alexeykiselev 6517b06
Merge branch 'master' into determenistic-finality-feature
alexeykiselev a9ae9e4
Add simple finality itest (#2063)
alexeykiselev File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -18,3 +18,6 @@ cmd/wmd/internal/swagger/ | |
|
|
||
| # Ignore testdata folders | ||
| pkg/state/testdata/ | ||
|
|
||
| # Ignore generated files | ||
| **/*.pb.go | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Utility `commit` | ||
|
|
||
| The `commit` utility creates `CommitToGeneration` transaction with signed proof of possession (PoP) and | ||
| writes it's JSON to stdout. | ||
|
|
||
| ## Command Line Options | ||
|
|
||
| ``` | ||
| -height uint | ||
| Height of generation period start | ||
| -private-key string | ||
| Waves private key in Base58 encoding | ||
| -fee uint | ||
| Transaction fee in wavelets (default: 0.1 Waves) | ||
| -timestamp string | ||
| Transaction timestamp. Accepts: | ||
| (empty) current time in UNIX milliseconds | ||
| HH today at the given hour, e.g. "14" | ||
| HH:MM today at the given hour and minute, e.g. "14:30" | ||
| HH:MM:SS today at the given time, e.g. "14:30:45" | ||
| +<duration> current time shifted forward, e.g. "+1h", "+30m" | ||
| -<duration> current time shifted backward, e.g. "-30m" | ||
| ``` | ||
|
|
||
| ## Example | ||
|
|
||
| ```bash | ||
| ./commit -private-key <base58-private-key> -height 1000000 | ||
| ``` | ||
|
|
||
| The transaction JSON is written to stdout and can be piped to `convert` utility for signing and | ||
| later to the node broadcast endpoint: | ||
|
|
||
| ```bash | ||
| ./commit -private-key <base58-private-key> -height <height> | \ | ||
| ./convert -private-key <base58-private-key> -to-json | \ | ||
| curl -X POST -H 'Content-Type: application/json' --data-binary @- \ | ||
| https://<node-host>/transactions/broadcast | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "errors" | ||
| "flag" | ||
| "fmt" | ||
| "io" | ||
| "os" | ||
| "strings" | ||
| "time" | ||
|
|
||
| "github.com/ccoveille/go-safecast/v2" | ||
|
|
||
| "github.com/wavesplatform/gowaves/pkg/crypto" | ||
| "github.com/wavesplatform/gowaves/pkg/state" | ||
| ) | ||
|
|
||
| const baseFee = state.CommitmentFeeInFeeUnits * state.FeeUnit | ||
|
|
||
| type config struct { | ||
| height uint32 | ||
| sk crypto.SecretKey | ||
| pk crypto.PublicKey | ||
| fee uint64 | ||
| timestamp uint64 | ||
| } | ||
|
|
||
| func (c *config) parse(args []string) error { | ||
| if len(args) < 1 { | ||
| return errors.New("invalid number of arguments") | ||
| } | ||
| fs := flag.NewFlagSet(args[0], flag.ContinueOnError) | ||
| fs.SetOutput(io.Discard) // suppress automatic output; we print usage ourselves below | ||
| var ( | ||
| height uint64 | ||
| privateKey string | ||
| fee uint64 | ||
| ts string | ||
| ) | ||
| fs.Uint64Var(&height, "height", 0, "Height of generation period start") | ||
| fs.StringVar(&privateKey, "private-key", "", "Waves private key in Base58") | ||
| fs.Uint64Var(&fee, "fee", baseFee, "Transaction fee (default: 0.1 Waves)") | ||
| fs.StringVar(&ts, "timestamp", "", | ||
| "Transaction timestamp (default: current time), can be absolute (e.g. '15:04') or relative "+ | ||
| "(e.g. '+1h30m' or '-45s')") | ||
| if err := fs.Parse(args[1:]); err != nil { | ||
| fs.SetOutput(os.Stderr) | ||
| fs.Usage() | ||
| return err | ||
| } | ||
|
|
||
| if height == 0 { | ||
| return errors.New("option -height is required and must be positive") | ||
| } | ||
| h, err := safecast.Convert[uint32](height) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| c.height = h | ||
|
|
||
| if len(privateKey) == 0 { | ||
| return errors.New("option -private-key is required") | ||
| } | ||
| sk, err := crypto.NewSecretKeyFromBase58(privateKey) | ||
| if err != nil { | ||
| return fmt.Errorf("failed to parse private key: %w", err) | ||
| } | ||
| c.sk = sk | ||
| c.pk = crypto.GeneratePublicKey(sk) | ||
|
|
||
| if fee < baseFee { | ||
| return fmt.Errorf("option -fee must be equal or more than base fee %d", baseFee) | ||
| } | ||
| c.fee = fee | ||
|
|
||
| timestamp, tsErr := parseTimestamp(ts) | ||
| if tsErr != nil { | ||
| return tsErr | ||
| } | ||
| c.timestamp = timestamp | ||
| return nil | ||
| } | ||
|
|
||
| func parseTimestamp(ts string) (uint64, error) { | ||
| now := time.Now() | ||
| if len(ts) == 0 { | ||
| ms, err := safecast.Convert[uint64](now.UnixMilli()) | ||
| if err != nil { | ||
| return 0, fmt.Errorf("failed to get current timestamp: %w", err) | ||
| } | ||
| return ms, nil | ||
| } | ||
| if strings.HasPrefix(ts, "+") || strings.HasPrefix(ts, "-") { | ||
| return parseTimestampShift(ts, now) | ||
| } | ||
| return parseTimeString(ts, now) | ||
| } | ||
|
|
||
| func parseTimestampShift(ts string, now time.Time) (uint64, error) { | ||
| d, err := time.ParseDuration(ts) | ||
| if err != nil { | ||
| return 0, fmt.Errorf("invalid time shift: %w", err) | ||
| } | ||
| ms, convErr := safecast.Convert[uint64](now.Add(d).UnixMilli()) | ||
| if convErr != nil { | ||
| return 0, fmt.Errorf("invalid timestamp from time shift %q: %w", ts, convErr) | ||
| } | ||
| return ms, nil | ||
| } | ||
|
|
||
| func parseTimeString(ts string, now time.Time) (uint64, error) { | ||
| const ( | ||
| layoutHours = "15" | ||
| layoutMinutes = "15:04" | ||
| layoutSeconds = "15:04:05" | ||
| ) | ||
| var layout string | ||
| switch strings.Count(ts, ":") { | ||
| case 0: | ||
| layout = layoutHours | ||
| case 1: | ||
| layout = layoutMinutes | ||
| case 2: | ||
| layout = layoutSeconds | ||
| default: | ||
| return 0, fmt.Errorf("invalid timestamp format %q", ts) | ||
| } | ||
| t, err := time.Parse(layout, ts) | ||
| if err != nil { | ||
| return 0, fmt.Errorf("invalid timestamp %q: %w", ts, err) | ||
| } | ||
| y, m, d := now.Date() | ||
| combined := time.Date(y, m, d, t.Hour(), t.Minute(), t.Second(), 0, now.Location()) | ||
| ms, convErr := safecast.Convert[uint64](combined.UnixMilli()) | ||
| if convErr != nil { | ||
| return 0, fmt.Errorf("failed to convert timestamp: %w", convErr) | ||
| } | ||
| return ms, nil | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.