-
Notifications
You must be signed in to change notification settings - Fork 66
Node api finality #1897
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
base: add-network-messages
Are you sure you want to change the base?
Node api finality #1897
Conversation
pkg/wallet/stub.go
Outdated
| func (s Stub) SignTransactionWith(pk crypto.PublicKey, tx proto.Transaction) error { | ||
| panic("Stub.SignTransactionWith: Unsupported operation") | ||
| func (s Stub) SignTransactionWith(_ crypto.PublicKey, _ proto.Transaction) error { | ||
| panic("Stub.SignTransactionWith: Unsopported operation") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the word “unsOpported” exist?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
pkg/wallet/embedded_wallet.go
Outdated
| return crypto.PublicKey{}, ErrPublicKeyNotFound | ||
| } | ||
|
|
||
| func (a *EmbeddedWalletImpl) BlsPairByWavesPK(publicKey crypto.PublicKey) (bls.SecretKey, bls.PublicKey, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Bls" should be "BLS".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
pkg/state/commitments.go
Outdated
|
|
||
| // FindEndorserPKsByIndexes returns BLS endorser public keys using | ||
| // commitment indexes stored in FinalizationVoting.EndorserIndexes. | ||
| func (c *commitments) FindEndorserPKsByIndexes( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why "PKs" and "indexes", not "PK" and "index", the function returns only one public key and accepts only one index.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
pkg/state/finalization.go
Outdated
| "github.com/wavesplatform/gowaves/pkg/proto" | ||
| ) | ||
|
|
||
| const finalizationKey = "finalization" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All keys have to be introduced in
Line 139 in 8b0ac77
| commitmentKeyPrefix |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
pkg/state/finalization.go
Outdated
| var ErrNoFinalizationHistory = errors.New("no finalization in history") | ||
|
|
||
| type finalizationItem struct { | ||
| Block proto.BlockHeader `cbor:"0,keyasint,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to store block header second time here, can be retrieved by height or blockID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
| func (fr *finalizationRecord) unmarshalBinary(data []byte) error { return cbor.Unmarshal(data, fr) } | ||
|
|
||
| type finalizations struct { | ||
| hs *historyStorage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we discussed the finalization storage should not be a history storage. In case of using history the rollback will happen automatically, but the idea of finalization records that they are irreversible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The finalization now contains only one item, I kept the history storage. Moved it to the other PR
pkg/state/appender.go
Outdated
| return false, fmt.Errorf("failed to build endorsement message: %w", err) | ||
| } | ||
|
|
||
| // 2. Восстанавливаем endorser PK по индексам |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no! Please use English only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
pkg/state/appender.go
Outdated
| return nil | ||
| } | ||
|
|
||
| func (a *txAppender) isLastBlockFinalized( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strange naming, is it better to name the function "updateFinalization" or "calculateFinalization"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
pkg/state/appender.go
Outdated
| if err != nil { | ||
| return false, err | ||
| } | ||
| msg, err := proto.EndorsementMessage( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why construct an endorsement message here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see, it's for block header validation. I'd rather move this function to proto package, somewhere near block declaration or even made it a part of Block type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Which file are you suggesting to move it to?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this function EndorsementMessage is already in proto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corresponding `pkg/client' parts have to be implemented.
|
Moved storage to add-network-messages |
No description provided.