mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-27 22:28:17 -05:00
Compare commits
6 Commits
docs/docum
...
precommit
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
38eabd1037 | ||
|
|
85aa47c42a | ||
|
|
949129143d | ||
|
|
7b86dc5526 | ||
|
|
61c4a10dfa | ||
|
|
6e6e71a75f |
34
.pre-commit-config.yaml
Normal file
34
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
repos:
|
||||||
|
# First run code formatters
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v4.1.0
|
||||||
|
hooks:
|
||||||
|
- id: end-of-file-fixer # ensures that a file is either empty, or ends with one newline
|
||||||
|
exclude_types: ["proto"]
|
||||||
|
- id: mixed-line-ending # ensures that a file doesn't contain a mix of LF and CRLF
|
||||||
|
- id: no-commit-to-branch # Protect specific branches (default: main/master) from direct checkins
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: gci
|
||||||
|
name: goimports
|
||||||
|
entry: bash -c 'command -v gci >/dev/null 2>&1 || go install github.com/daixiang0/gci@latest; gci write --skip-generated -s standard -s default "$@"; goimports -w "$@"' --
|
||||||
|
language: golang
|
||||||
|
files: \.go$
|
||||||
|
|
||||||
|
- repo: https://github.com/dnephin/pre-commit-golang
|
||||||
|
rev: v0.4.0
|
||||||
|
hooks:
|
||||||
|
- id: go-fmt
|
||||||
|
args: [ -w, -s ] # simplify code and write result to (source) file instead of stdout
|
||||||
|
- id: go-mod-tidy
|
||||||
|
files: go.mod
|
||||||
|
- id: golangci-lint
|
||||||
|
|
||||||
|
# Fix bazel build files
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: gazelle
|
||||||
|
name: bazel-fix
|
||||||
|
entry: .pre-commit/fixbazel.sh
|
||||||
|
language: system
|
||||||
3
.pre-commit/fixbazel.sh
Executable file
3
.pre-commit/fixbazel.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
bazel run //:gazelle -- fix
|
||||||
@@ -175,6 +175,23 @@ $ git push myrepo feature-in-progress-branch -f
|
|||||||
|
|
||||||
**22. Finally, again leave a comment to the Core Contributors on the pull request to let them know that the pull request has been updated.**
|
**22. Finally, again leave a comment to the Core Contributors on the pull request to let them know that the pull request has been updated.**
|
||||||
|
|
||||||
|
### Git hooks and linters.
|
||||||
|
|
||||||
|
Prysm is configured with [pre-commit](https://pre-commit.com) **githooks** that ensures pull
|
||||||
|
requests adhere to a minimum standard and are consistent. It is highly recommended running the githooks locally while developing for faster feedback.
|
||||||
|
|
||||||
|
To install githooks:
|
||||||
|
- Follow installation instructions [here](https://pre-commit.com/#installation) to install the `pre-commit` tool.
|
||||||
|
- Once installed, run `pre-commit install` in the project's root directory. This will set up the hooks.
|
||||||
|
- Note you can skip the hooks by committing with `-n`: `git commit -n -m "look mom no githooks"`
|
||||||
|
|
||||||
|
To update githooks:
|
||||||
|
```sh
|
||||||
|
pre-commit clean
|
||||||
|
```
|
||||||
|
|
||||||
|
The **linter** used is [golangci-lint](https://golangci-lint.run/). It runs as part of the githooks and is configured in [.golangci.yml](.golangci.yml)
|
||||||
|
|
||||||
## Maintaining CHANGELOG.md
|
## Maintaining CHANGELOG.md
|
||||||
|
|
||||||
This project follows the changelog guidelines from [keepachangelog.com](https://keepachangelog.com/en/1.1.0/). In order to minimize conflicts and workflow headaches, we chose to implement a changelog management
|
This project follows the changelog guidelines from [keepachangelog.com](https://keepachangelog.com/en/1.1.0/). In order to minimize conflicts and workflow headaches, we chose to implement a changelog management
|
||||||
|
|||||||
@@ -672,4 +672,3 @@ may consider it more useful to permit linking proprietary applications with
|
|||||||
the library. If this is what you want to do, use the GNU Lesser General
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
Public License instead of this License. But first, please read
|
Public License instead of this License. But first, please read
|
||||||
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
|
|
||||||
|
|||||||
@@ -50,4 +50,3 @@ We reserve the right to revise these Terms, and your rights and obligations are
|
|||||||
These Terms constitute the entire agreement between you and Offchain Labs regarding use of Prysm and will supersede all prior agreements whether, written or oral. No usage of trade or other regular practice or method of dealing between the parties will be used to modify, interpret, supplement, or alter the terms of these Terms.
|
These Terms constitute the entire agreement between you and Offchain Labs regarding use of Prysm and will supersede all prior agreements whether, written or oral. No usage of trade or other regular practice or method of dealing between the parties will be used to modify, interpret, supplement, or alter the terms of these Terms.
|
||||||
|
|
||||||
If any portion of these Terms is held invalid or unenforceable, such invalidity or enforceability will not affect the other provisions of these Terms, which will remain in full force and effect, and the invalid or unenforceable portion will be given effect to the greatest extent possible. The failure of a party to require performance of any provision will not affect that party’s right to require performance at any time thereafter, nor will a waiver of any breach or default of these Terms or any provision of these Terms constitute a waiver of any subsequent breach or default or a waiver of the provision itself.
|
If any portion of these Terms is held invalid or unenforceable, such invalidity or enforceability will not affect the other provisions of these Terms, which will remain in full force and effect, and the invalid or unenforceable portion will be given effect to the greatest extent possible. The failure of a party to require performance of any provision will not affect that party’s right to require performance at any time thereafter, nor will a waiver of any breach or default of these Terms or any provision of these Terms constitute a waiver of any subsequent breach or default or a waiver of the provision itself.
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
package httprest
|
package httprest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/api/server/middleware"
|
"github.com/prysmaticlabs/prysm/v5/api/server/middleware"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers"
|
|
||||||
lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed"
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed"
|
||||||
statefeed "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/state"
|
statefeed "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/feed/state"
|
||||||
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/helpers"
|
||||||
|
lightclient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client"
|
||||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/transition"
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/core/transition"
|
||||||
doublylinkedtree "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/doubly-linked-tree"
|
doublylinkedtree "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/doubly-linked-tree"
|
||||||
forkchoicetypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/types"
|
forkchoicetypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/types"
|
||||||
|
|||||||
@@ -5,15 +5,14 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
|
||||||
light_client "github.com/prysmaticlabs/prysm/v5/consensus-types/light-client"
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
lightClient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client"
|
lightClient "github.com/prysmaticlabs/prysm/v5/beacon-chain/core/light-client"
|
||||||
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
fieldparams "github.com/prysmaticlabs/prysm/v5/config/fieldparams"
|
||||||
|
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||||
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
consensustypes "github.com/prysmaticlabs/prysm/v5/consensus-types"
|
||||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
|
||||||
|
light_client "github.com/prysmaticlabs/prysm/v5/consensus-types/light-client"
|
||||||
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||||
"github.com/prysmaticlabs/prysm/v5/encoding/ssz"
|
"github.com/prysmaticlabs/prysm/v5/encoding/ssz"
|
||||||
v11 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
|
v11 "github.com/prysmaticlabs/prysm/v5/proto/engine/v1"
|
||||||
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
pb "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||||
|
|||||||
@@ -5,17 +5,15 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
dbtest "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/testing"
|
||||||
"github.com/prysmaticlabs/prysm/v5/config/params"
|
"github.com/prysmaticlabs/prysm/v5/config/params"
|
||||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/blocks"
|
||||||
|
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
||||||
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
eth "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1"
|
||||||
|
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
||||||
"github.com/prysmaticlabs/prysm/v5/testing/util"
|
"github.com/prysmaticlabs/prysm/v5/testing/util"
|
||||||
slottest "github.com/prysmaticlabs/prysm/v5/time/slots/testing"
|
slottest "github.com/prysmaticlabs/prysm/v5/time/slots/testing"
|
||||||
"github.com/sirupsen/logrus"
|
"github.com/sirupsen/logrus"
|
||||||
|
|
||||||
dbtest "github.com/prysmaticlabs/prysm/v5/beacon-chain/db/testing"
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/consensus-types/primitives"
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/testing/require"
|
|
||||||
logTest "github.com/sirupsen/logrus/hooks/test"
|
logTest "github.com/sirupsen/logrus/hooks/test"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -7,13 +7,12 @@ import (
|
|||||||
|
|
||||||
"github.com/libp2p/go-libp2p/core/network"
|
"github.com/libp2p/go-libp2p/core/network"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/sirupsen/logrus"
|
|
||||||
"github.com/trailofbits/go-mutexasserts"
|
|
||||||
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p"
|
"github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p"
|
||||||
p2ptypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/types"
|
p2ptypes "github.com/prysmaticlabs/prysm/v5/beacon-chain/p2p/types"
|
||||||
"github.com/prysmaticlabs/prysm/v5/cmd/beacon-chain/flags"
|
"github.com/prysmaticlabs/prysm/v5/cmd/beacon-chain/flags"
|
||||||
leakybucket "github.com/prysmaticlabs/prysm/v5/container/leaky-bucket"
|
leakybucket "github.com/prysmaticlabs/prysm/v5/container/leaky-bucket"
|
||||||
|
"github.com/sirupsen/logrus"
|
||||||
|
"github.com/trailofbits/go-mutexasserts"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultBurstLimit = 5
|
const defaultBurstLimit = 5
|
||||||
|
|||||||
@@ -15,8 +15,6 @@ import (
|
|||||||
"github.com/libp2p/go-libp2p/core/peer"
|
"github.com/libp2p/go-libp2p/core/peer"
|
||||||
gcache "github.com/patrickmn/go-cache"
|
gcache "github.com/patrickmn/go-cache"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/trailofbits/go-mutexasserts"
|
|
||||||
|
|
||||||
"github.com/prysmaticlabs/prysm/v5/async"
|
"github.com/prysmaticlabs/prysm/v5/async"
|
||||||
"github.com/prysmaticlabs/prysm/v5/async/abool"
|
"github.com/prysmaticlabs/prysm/v5/async/abool"
|
||||||
"github.com/prysmaticlabs/prysm/v5/async/event"
|
"github.com/prysmaticlabs/prysm/v5/async/event"
|
||||||
@@ -47,6 +45,7 @@ import (
|
|||||||
"github.com/prysmaticlabs/prysm/v5/runtime"
|
"github.com/prysmaticlabs/prysm/v5/runtime"
|
||||||
prysmTime "github.com/prysmaticlabs/prysm/v5/time"
|
prysmTime "github.com/prysmaticlabs/prysm/v5/time"
|
||||||
"github.com/prysmaticlabs/prysm/v5/time/slots"
|
"github.com/prysmaticlabs/prysm/v5/time/slots"
|
||||||
|
"github.com/trailofbits/go-mutexasserts"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ runtime.Service = (*Service)(nil)
|
var _ runtime.Service = (*Service)(nil)
|
||||||
|
|||||||
3
changelog/dB2510_precommit.md
Normal file
3
changelog/dB2510_precommit.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
### Added
|
||||||
|
|
||||||
|
- Add pre-commit hooks for faster feedback loop
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
### Ignored
|
### Ignored
|
||||||
|
|
||||||
- Cleanup single attestation code for readability.
|
- Cleanup single attestation code for readability.
|
||||||
|
|
||||||
|
|||||||
2
config/params/testdata/e2e_config.yaml
vendored
2
config/params/testdata/e2e_config.yaml
vendored
@@ -123,5 +123,3 @@ CONFIG_NAME: "end-to-end"
|
|||||||
SLOTS_PER_EPOCH: 6
|
SLOTS_PER_EPOCH: 6
|
||||||
EPOCHS_PER_ETH1_VOTING_PERIOD: 2
|
EPOCHS_PER_ETH1_VOTING_PERIOD: 2
|
||||||
MAX_SEED_LOOKAHEAD: 1
|
MAX_SEED_LOOKAHEAD: 1
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16,4 +16,3 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
{
|
{
|
||||||
"proposer_config": {
|
"proposer_config": {
|
||||||
"0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a": {
|
"0xa057816155ad77931185101128655c0191bd0214c201ca48ed887f6c4c6adf334070efcd75140eada5ac83a92506dd7a": {
|
||||||
|
|
||||||
|
|||||||
@@ -14,4 +14,3 @@ def distroless_deps():
|
|||||||
sum = "h1:9B623Cfs+mclYK6dsae7gLSwuIBHvlgmEup87qpqsAQ=",
|
sum = "h1:9B623Cfs+mclYK6dsae7gLSwuIBHvlgmEup87qpqsAQ=",
|
||||||
version = "v0.3.1-0.20230104082527-d6f58551be3f",
|
version = "v0.3.1-0.20230104082527-d6f58551be3f",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -22,4 +22,3 @@ Our keymanager API requires a valid bearer token to run the keymanager.
|
|||||||
You can retrieve this bearer token from the URL displayed when running `validator --web`
|
You can retrieve this bearer token from the URL displayed when running `validator --web`
|
||||||
i.e. `http://127.0.0.1:7500/initialize?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.BEuFWr-FpKIlJEIjgmujTQJlJF2aJRaUfFiuTBYVL3k`
|
i.e. `http://127.0.0.1:7500/initialize?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.e30.BEuFWr-FpKIlJEIjgmujTQJlJF2aJRaUfFiuTBYVL3k`
|
||||||
The token can be copied and pasted into the authorization tab of each Postman request to authenticate.
|
The token can be copied and pasted into the authorization tab of each Postman request to authenticate.
|
||||||
|
|
||||||
|
|||||||
@@ -5,4 +5,3 @@ set -e
|
|||||||
git tag -l 'v*' --sort=creatordate |
|
git tag -l 'v*' --sort=creatordate |
|
||||||
perl -nle 'if (/^v\d+\.\d+\.\d+$/) { print $_ }' |
|
perl -nle 'if (/^v\d+\.\d+\.\d+$/) { print $_ }' |
|
||||||
tail -n1
|
tail -n1
|
||||||
|
|
||||||
|
|||||||
@@ -213,4 +213,3 @@ windows_cc_toolchain_config = rule(
|
|||||||
},
|
},
|
||||||
provides = [CcToolchainConfigInfo],
|
provides = [CcToolchainConfigInfo],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -13,4 +13,3 @@ curl -sLo tarballs/${OSX_SDK}.tar.xz "https://prysmaticlabs.com/uploads/${OSX_SD
|
|||||||
|
|
||||||
echo "${OSX_SDK_SUM}" "tarballs/${OSX_SDK}.tar.xz" | sha256sum -c -
|
echo "${OSX_SDK_SUM}" "tarballs/${OSX_SDK}.tar.xz" | sha256sum -c -
|
||||||
yes "" | SDK_VERSION=12.3 OSX_VERSION_MIN=11.0 OCDEBUG=1 ./build.sh
|
yes "" | SDK_VERSION=12.3 OSX_VERSION_MIN=11.0 OCDEBUG=1 ./build.sh
|
||||||
|
|
||||||
|
|||||||
@@ -42,4 +42,3 @@ To use pcli manual state transition:
|
|||||||
```
|
```
|
||||||
bazel run //tools/pcli:pcli -- state-transition --block-path /path/to/block.ssz --pre-state-path /path/to/state.ssz
|
bazel run //tools/pcli:pcli -- state-transition --block-path /path/to/block.ssz --pre-state-path /path/to/state.ssz
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -2874,7 +2874,7 @@ func TestUpdateValidatorStatusCache(t *testing.T) {
|
|||||||
beaconNodeHosts: []string{"http://localhost:8080", "http://localhost:8081"},
|
beaconNodeHosts: []string{"http://localhost:8080", "http://localhost:8081"},
|
||||||
currentHostIndex: 0,
|
currentHostIndex: 0,
|
||||||
pubkeyToStatus: map[[fieldparams.BLSPubkeyLength]byte]*validatorStatus{
|
pubkeyToStatus: map[[fieldparams.BLSPubkeyLength]byte]*validatorStatus{
|
||||||
[fieldparams.BLSPubkeyLength]byte{0x03}: &validatorStatus{ // add non existent key and status to cache, should be fully removed on update
|
{0x03}: { // add non existent key and status to cache, should be fully removed on update
|
||||||
publicKey: []byte{0x03},
|
publicKey: []byte{0x03},
|
||||||
status: ðpb.ValidatorStatusResponse{
|
status: ðpb.ValidatorStatusResponse{
|
||||||
Status: ethpb.ValidatorStatus_ACTIVE,
|
Status: ethpb.ValidatorStatus_ACTIVE,
|
||||||
|
|||||||
Reference in New Issue
Block a user