Skip to content
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

Support rollback draft #1610

Open
wants to merge 60 commits into
base: node-updates-plugin-l2
Choose a base branch
from

Conversation

esuwu
Copy link
Contributor

@esuwu esuwu commented Feb 19, 2025

No description provided.

dependabot bot and others added 26 commits January 15, 2025 14:32
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.2 to 1.69.4.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.69.2...v1.69.4)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps google.golang.org/protobuf from 1.36.2 to 1.36.3.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps golang from 1.23.4-alpine3.20 to 1.23.5-alpine3.20.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 5.2.0 to 5.3.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](actions/setup-go@v5.2.0...v5.3.0)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
#1579)

* Add NewHeader constructor function. Remove duplicat functions MakeHeader and buildHeader.
Use NewHeader everywhere is possible.

* WIP.
Add WriteTo and ReadFrom functions to message payloads.
Move message payload types to separate file payloads.go.
Add Header validation function.
Add ChecksumReader that wraps io.Reader and calculates checksum then reading payloads.
Functions ParseMessage, ReadMessage and WriteMessage made public.
ReadFrom functions of all messages reimplemented using ReadMessage function.
Fix linter issues. Unused functions removed.

* Fixed ReadFrom function of BlockID.
Fixed read and write of BlockIDsPayload (list of BlockIDs).
Added PeersPayload.
Fixed writing of messages with empty payloads.
U8String moved to payloads.go.
Writing of all messages implemented usign function WriteMessage.
Unused BulkMessage type removed.
Test on mixed BlockIDs in GetBlockIDsMessage added.
TestProtocolMarshaling test reimplemented to check all possible ways of serialization/deserialization of messages and fixed to deserialize in empty structures.

* Fixed PR issues.
BlockID ReadFrom completely reimplemented. Tests on BlockID ReadFrom added.

* Update pkg/proto/block.go

Co-authored-by: Nikolay Eskov <[email protected]>

* Message length check clarified.

---------

Co-authored-by: Nikolay Eskov <[email protected]>
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.69.4 to 1.70.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.69.4...v1.70.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/throttled/throttled/v2](https://github.com/throttled/throttled) from 2.12.0 to 2.13.0.
- [Release notes](https://github.com/throttled/throttled/releases)
- [Changelog](https://github.com/throttled/throttled/blob/master/CHANGELOG.md)
- [Commits](throttled/throttled@v2.12.0...v2.13.0)

---
updated-dependencies:
- dependency-name: github.com/throttled/throttled/v2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps google.golang.org/protobuf from 1.36.3 to 1.36.4.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: chuangjinglu <[email protected]>
Co-authored-by: Alexey Kiselev <[email protected]>
Bumps [github.com/spf13/pflag](https://github.com/spf13/pflag) from 1.0.5 to 1.0.6.
- [Release notes](https://github.com/spf13/pflag/releases)
- [Commits](spf13/pflag@v1.0.5...v1.0.6)

---
updated-dependencies:
- dependency-name: github.com/spf13/pflag
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bump github.com/consensys/gnark-crypto from 0.14.0 to 0.16.0
Bumps golang from 1.23.5-alpine3.20 to 1.24rc2-alpine3.20.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.29.0 to 0.30.0.
- [Commits](golang/sys@v0.29.0...v0.30.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kiselev <[email protected]>
Bumps [golang.org/x/sync](https://github.com/golang/sync) from 0.10.0 to 0.11.0.
- [Commits](golang/sync@v0.10.0...v0.11.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sync
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps google.golang.org/protobuf from 1.36.4 to 1.36.5.

---
updated-dependencies:
- dependency-name: google.golang.org/protobuf
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kiselev <[email protected]>
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.32.0 to 0.33.0.
- [Commits](golang/crypto@v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps golang from 1.24rc2-alpine3.20 to 1.24rc3-alpine3.20.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kiselev <[email protected]>
* Deprecated linter "tenv" replaced with "usetesting".

* Update GolangCI-Lint version to 1.64.4.
Bumps alpine from 3.21.2 to 3.21.3.

---
updated-dependencies:
- dependency-name: alpine
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Comment on lines 106 to 115
func (e *BlockchainUpdatesExtension) Close() {
if e.BUpdatesChannel != nil {
close(e.BUpdatesChannel)
}
if e.BuPatchChannel != nil {
close(e.BuPatchChannel)
}
close(e.bUpdatesChannel)
e.bUpdatesChannel = nil
e.BUpdatesChannel = nil
e.BuPatchChannel = nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data race. Must be protected by a mutex.

cmd/node/node.go Outdated
patch = append(patch, dataEntry)
}
bUpdatesExtension.WriteBUPatch(patch)
case <-bUpdatesExtension.Ctx.Done():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here you should rely on ctx about, not bUpdatesExtension.Ctx

cmd/node/node.go Outdated
for {
var patch []proto.DataEntry
select {
case dataEntryKeys := <-bUpdatesExtension.BuPatchRequestChannel:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No handling of closed channel

size int
}

// NewHistoryJournal создаёт и инициализирует новый экземпляр HistoryJournal.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment

// FetchKeysUntilBlockID goes from top to bottom and fetches all keys.
// If the blockID is found, it returns the keys up to and including that element and true.
// If the blockID is not found - nil and false.
func (hj *HistoryJournal) FetchKeysUntilBlockID(blockID proto.BlockID) ([]string, bool) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this method really necessary? For what do you want to use it?

Comment on lines 193 to 195
if updates.BlockUpdatesInfo.Height > previousState.BlockUpdatesInfo.Height {
return false
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The height can be the same, so that's not always true. Especially when node is on a top of blockchain.

Comment on lines 196 to 198
if _, _, blockIDFound := bu.historyJournal.SearchByBlockID(updates.BlockUpdatesInfo.BlockID); blockIDFound {
return true
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BlockID can't be found if it's a new block or a block from fork. You should check the parent blockID of a new block.

@@ -11,30 +12,35 @@ import (
const ChannelWriteTimeout = 10 * time.Second

type BlockchainUpdatesExtension struct {
ctx context.Context
Ctx context.Context
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's internal think, should not be public I think

cmd/node/node.go Outdated
}
bUpdatesExtension.WriteBUPatch(patch)
case <-bUpdatesExtension.Ctx.Done():
bUpdatesExtension.Close()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only writer should close a channel, though it's applicable here because channel closing logic is placed inside. But a bit scary

dependabot bot and others added 3 commits February 20, 2025 12:21
Bumps [appleboy/ssh-action](https://github.com/appleboy/ssh-action) from 1.2.0 to 1.2.1.
- [Release notes](https://github.com/appleboy/ssh-action/releases)
- [Changelog](https://github.com/appleboy/ssh-action/blob/master/.goreleaser.yaml)
- [Commits](appleboy/ssh-action@v1.2.0...v1.2.1)

---
updated-dependencies:
- dependency-name: appleboy/ssh-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.20.5 to 1.21.0.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.20.5...v1.21.0)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nikolay Eskov <[email protected]>
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.33.0 to 0.34.0.
- [Commits](golang/crypto@v0.33.0...v0.34.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
esuwu and others added 30 commits February 25, 2025 12:19
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.34.0 to 0.35.0.
- [Commits](golang/crypto@v0.34.0...v0.35.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.70.0 to 1.71.0.
- [Release notes](https://github.com/grpc/grpc-go/releases)
- [Commits](grpc/grpc-go@v1.70.0...v1.71.0)

---
updated-dependencies:
- dependency-name: google.golang.org/grpc
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [github.com/prometheus/client_golang](https://github.com/prometheus/client_golang) from 1.21.0 to 1.21.1.
- [Release notes](https://github.com/prometheus/client_golang/releases)
- [Changelog](https://github.com/prometheus/client_golang/blob/main/CHANGELOG.md)
- [Commits](prometheus/client_golang@v1.21.0...v1.21.1)

---
updated-dependencies:
- dependency-name: github.com/prometheus/client_golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nikolay Eskov <[email protected]>
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.30.0 to 0.31.0.
- [Commits](golang/sys@v0.30.0...v0.31.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.35.0 to 0.36.0.
- [Commits](golang/crypto@v0.35.0...v0.36.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nikolay Eskov <[email protected]>
Bumps [securego/gosec](https://github.com/securego/gosec) from 2.22.1 to 2.22.2.
- [Release notes](https://github.com/securego/gosec/releases)
- [Changelog](https://github.com/securego/gosec/blob/master/.goreleaser.yml)
- [Commits](securego/gosec@v2.22.1...v2.22.2)

---
updated-dependencies:
- dependency-name: securego/gosec
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Alexey Kiselev <[email protected]>
* Replace deprecated 'golang.org/x/exp/rand' to 'math/rand/v2'

For more info see https://go.dev/issue/61716.

* Add 'nosec' comment for gosec linter.
* Fix incorrect error return.

* Changed err handling a bit.
Signed-off-by: kevincatty <[email protected]>
Co-authored-by: Alexey Kiselev <[email protected]>
Excluded because rules in this ruleset contain 'security-severity'
field with a string type value, while SARIF format accepts only numerical.
For more info see semgrep/semgrep#10834.

Co-authored-by: Alexey Kiselev <[email protected]>
* Add semgrep rule 'if-inplace-func-incorrect-nil-err-return'.

* Add experimental semgrep rule 'if-incorrect-nil-err-return'

Put in experimental directory because of huge count of false positives.

* Add '.semgrep/rules' config to semgrep CI job.

* Semgrep rule 'if-incorrect-nil-err-return' moved to regular rules.

---------

Co-authored-by: Alexey Kiselev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants