Merge pull request #1439 from maticnetwork/mardizzone/pos-2821

POS-2821: improvements
This commit is contained in:
Marcello Ardizzone 2025-02-08 11:15:00 +01:00 committed by GitHub
commit ec2d46b5b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 941 additions and 203 deletions

View file

@ -29,7 +29,7 @@ jobs:
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: 1.22.x go-version: 1.23.x
- name: Install dependencies on Linux - name: Install dependencies on Linux
if: runner.os == 'Linux' if: runner.os == 'Linux'
@ -61,7 +61,7 @@ jobs:
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: 1.22.x go-version: 1.23.x
- name: Install dependencies on Linux - name: Install dependencies on Linux
if: runner.os == 'Linux' if: runner.os == 'Linux'
@ -89,7 +89,7 @@ jobs:
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: 1.22.x go-version: 1.23.x
- name: Install dependencies on Linux - name: Install dependencies on Linux
if: runner.os == 'Linux' if: runner.os == 'Linux'
@ -140,7 +140,7 @@ jobs:
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: 1.22.x go-version: 1.23.x
- name: Install dependencies on Linux - name: Install dependencies on Linux
if: runner.os == 'Linux' if: runner.os == 'Linux'
@ -196,7 +196,7 @@ jobs:
- uses: actions/setup-go@v5 - uses: actions/setup-go@v5
with: with:
go-version: 1.22.x go-version: 1.23.x
- name: Checkout matic-cli - name: Checkout matic-cli
uses: actions/checkout@v4 uses: actions/checkout@v4

View file

@ -25,7 +25,7 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install Go - name: Install Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5

View file

@ -1,25 +0,0 @@
name: Govuln
on: [ push, pull_request ]
jobs:
govuln:
name: Run govuln check and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Running govulncheck
uses: Templum/govulncheck-action@v1.0.0
continue-on-error: true
env:
DEBUG: "true"
with:
go-version: 1.22
package: ./...
github-token: ${{ secrets.GITHUB_TOKEN }}
fail-on-vuln: true
- name: Upload govulncheck report
uses: actions/upload-artifact@v4.4.0
with:
name: raw-report
path: raw-report.json

23
.github/workflows/govulncheck.yml vendored Normal file
View file

@ -0,0 +1,23 @@
name: Govuln
on: [ push, pull_request ]
jobs:
govulncheck:
name: Run govulncheck
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v5
with:
go-version: "1.23.6"
check-latest: true
- uses: actions/checkout@v4
- uses: technote-space/get-diff-action@v6
with:
PATTERNS: |
**/*.go
go.mod
go.sum
Makefile
- name: govulncheck
run: make vulncheck
if: "env.GIT_DIFF != ''"

View file

@ -24,7 +24,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@master uses: actions/setup-go@master
with: with:
go-version: 1.22.1 go-version: 1.23.6
# Variables # Variables
- name: Adding TAG to ENV - name: Adding TAG to ENV
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV
@ -126,4 +126,4 @@ jobs:
prerelease: true prerelease: true
files: | files: |
packaging/deb/bor**.deb packaging/deb/bor**.deb
packaging/deb/bor**.deb.checksum packaging/deb/bor**.deb.checksum

View file

@ -14,14 +14,14 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Set up Go - name: Set up Go
uses: actions/setup-go@master uses: actions/setup-go@master
with: with:
go-version: 1.22.x go-version: 1.23.x
- name: Prepare - name: Prepare
id: prepare id: prepare

View file

@ -25,7 +25,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@master uses: actions/setup-go@master
with: with:
go-version: 1.22.1 go-version: 1.23.6
- name: Adding TAG to ENV - name: Adding TAG to ENV
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV

View file

@ -24,7 +24,7 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@master uses: actions/setup-go@master
with: with:
go-version: 1.22.1 go-version: 1.23.6
- name: Adding TAG to ENV - name: Adding TAG to ENV
run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV run: echo "GIT_TAG=`echo $(git describe --tags --abbrev=0)`" >> $GITHUB_ENV

View file

@ -18,7 +18,7 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/stale@v5 - uses: actions/stale@v9
with: with:
repo-token: ${{ secrets.GITHUB_TOKEN }} repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.' stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.'

View file

@ -84,7 +84,13 @@ lint:
lintci-deps: lintci-deps:
rm -f ./build/bin/golangci-lint rm -f ./build/bin/golangci-lint
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.57.2 curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.63.4
.PHONY: vulncheck
vulncheck:
@go run golang.org/x/vuln/cmd/govulncheck@latest ./...
goimports: goimports:
goimports -local "$(PACKAGE)" -w . goimports -local "$(PACKAGE)" -w .

View file

@ -1014,7 +1014,7 @@ func TestOOMMaliciousInput(t *testing.T) {
encb, err := hex.DecodeString(test.enc) encb, err := hex.DecodeString(test.enc)
if err != nil { if err != nil {
t.Fatalf("invalid hex: %s" + test.enc) t.Fatalf("invalid hex: %s", test.enc)
} }
_, err = abi.Methods["method"].Outputs.UnpackValues(encb) _, err = abi.Methods["method"].Outputs.UnpackValues(encb)

View file

@ -48,7 +48,7 @@ func BlockFromJSON(forkName string, data []byte) (*BeaconBlock, error) {
case "capella": case "capella":
obj = new(capella.BeaconBlock) obj = new(capella.BeaconBlock)
default: default:
return nil, fmt.Errorf("unsupported fork: " + forkName) return nil, fmt.Errorf("unsupported fork: %s", forkName)
} }
if err := json.Unmarshal(data, obj); err != nil { if err := json.Unmarshal(data, obj); err != nil {
return nil, err return nil, err

View file

@ -46,7 +46,7 @@ func ExecutionHeaderFromJSON(forkName string, data []byte) (*ExecutionHeader, er
case "deneb": case "deneb":
obj = new(deneb.ExecutionPayloadHeader) obj = new(deneb.ExecutionPayloadHeader)
default: default:
return nil, fmt.Errorf("unsupported fork: " + forkName) return nil, fmt.Errorf("unsupported fork: %s", forkName)
} }
if err := json.Unmarshal(data, obj); err != nil { if err := json.Unmarshal(data, obj); err != nil {
return nil, err return nil, err

View file

@ -547,7 +547,7 @@ func TestT9n(t *testing.T) {
switch { switch {
case err != nil: case err != nil:
t.Logf(string(have)) t.Log(string(have))
t.Fatalf("test %d, json parsing failed: %v", i, err) t.Fatalf("test %d, json parsing failed: %v", i, err)
case !ok: case !ok:
t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want)) t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want))
@ -696,7 +696,7 @@ func TestB11r(t *testing.T) {
switch { switch {
case err != nil: case err != nil:
t.Logf(string(have)) t.Log(string(have))
t.Fatalf("test %d, json parsing failed: %v", i, err) t.Fatalf("test %d, json parsing failed: %v", i, err)
case !ok: case !ok:
t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want)) t.Fatalf("test %d: output wrong, have \n%v\nwant\n%v\n", i, string(have), string(want))

View file

@ -155,7 +155,7 @@ func dump(in *inStream, s *rlp.Stream, depth int, out io.Writer) error {
defer s.ListEnd() defer s.ListEnd()
if size == 0 { if size == 0 {
fmt.Fprintf(out, ws(depth)+"[]") fmt.Fprint(out, ws(depth)+"[]")
} else { } else {
fmt.Fprintln(out, ws(depth)+"[") fmt.Fprintln(out, ws(depth)+"[")

View file

@ -422,7 +422,7 @@ func TestBlockReceiptStorage(t *testing.T) {
t.Fatalf("no receipts returned") t.Fatalf("no receipts returned")
} else { } else {
if err := checkReceiptsRLP(rs, receipts); err != nil { if err := checkReceiptsRLP(rs, receipts); err != nil {
t.Fatalf(err.Error()) t.Fatal(err.Error())
} }
} }
// Delete the body and ensure that the receipts are no longer returned (metadata can't be recomputed) // Delete the body and ensure that the receipts are no longer returned (metadata can't be recomputed)
@ -432,7 +432,7 @@ func TestBlockReceiptStorage(t *testing.T) {
} }
// Ensure that receipts without metadata can be returned without the block body too // Ensure that receipts without metadata can be returned without the block body too
if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil { if err := checkReceiptsRLP(ReadRawReceipts(db, hash, 0), receipts); err != nil {
t.Fatalf(err.Error()) t.Fatal(err.Error())
} }
// Sanity check that body alone without the receipt is a full purge // Sanity check that body alone without the receipt is a full purge
WriteBody(db, hash, 0, body) WriteBody(db, hash, 0, body)

View file

@ -478,7 +478,7 @@ func formatLogs(logs []StructLog) []StructLogRes {
formatted[index].Stack = &stack formatted[index].Stack = &stack
} }
if trace.ReturnData != nil && len(trace.ReturnData) > 0 { if len(trace.ReturnData) > 0 {
formatted[index].ReturnData = hexutil.Bytes(trace.ReturnData).String() formatted[index].ReturnData = hexutil.Bytes(trace.ReturnData).String()
} }
if trace.Memory != nil { if trace.Memory != nil {

10
go.mod
View file

@ -1,8 +1,6 @@
module github.com/ethereum/go-ethereum module github.com/ethereum/go-ethereum
go 1.22 go 1.23.6
toolchain go1.22.1
require ( require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
@ -223,7 +221,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect github.com/huandu/xstrings v1.3.2 // indirect
@ -288,7 +286,7 @@ require (
go.opentelemetry.io/otel/trace v1.27.0 go.opentelemetry.io/otel/trace v1.27.0
go.opentelemetry.io/proto/otlp v1.2.0 // indirect go.opentelemetry.io/proto/otlp v1.2.0 // indirect
google.golang.org/api v0.169.0 // indirect google.golang.org/api v0.169.0 // indirect
google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
) )
replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.38.4 replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.38.4
@ -297,7 +295,7 @@ replace github.com/tendermint/tendermint => github.com/maticnetwork/tendermint v
replace github.com/tendermint/tm-db => github.com/tendermint/tm-db v0.2.0 replace github.com/tendermint/tm-db => github.com/tendermint/tm-db v0.2.0
replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v1.3.2 replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v1.5.5
replace github.com/Masterminds/goutils => github.com/Masterminds/goutils v1.1.1 replace github.com/Masterminds/goutils => github.com/Masterminds/goutils v1.1.1

1028
go.sum

File diff suppressed because it is too large Load diff

View file

@ -378,7 +378,7 @@ func (i *SliceStringFlag) UpdateValue(value string) {
} }
func (f *Flagset) SliceStringFlag(s *SliceStringFlag) { func (f *Flagset) SliceStringFlag(s *SliceStringFlag) {
if s.Default == nil || len(s.Default) == 0 { if len(s.Default) == 0 {
f.addFlag(&FlagVar{ f.addFlag(&FlagVar{
Name: s.Name, Name: s.Name,
Usage: s.Usage, Usage: s.Usage,
@ -482,7 +482,7 @@ func (m *MapStringFlag) UpdateValue(value string) {
} }
func (f *Flagset) MapStringFlag(m *MapStringFlag) { func (f *Flagset) MapStringFlag(m *MapStringFlag) {
if m.Default == nil || len(m.Default) == 0 { if len(m.Default) == 0 {
f.addFlag(&FlagVar{ f.addFlag(&FlagVar{
Name: m.Name, Name: m.Name,
Usage: m.Usage, Usage: m.Usage,

View file

@ -14,7 +14,7 @@ func TestRegistryMarshallJSON(t *testing.T) {
enc.Encode(r) enc.Encode(r)
if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" { if s := b.String(); s != "{\"counter\":{\"count\":0}}\n" {
t.Fatalf(s) t.Fatal(s)
} }
} }