mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-10 05:47:59 -05:00
Compare commits
2 Commits
change-p2p
...
rlnc-base-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ace1247cc6 | ||
|
|
7ef3db8cf7 |
10
WORKSPACE
10
WORKSPACE
@@ -255,7 +255,7 @@ filegroup(
|
||||
url = "https://github.com/ethereum/EIPs/archive/5480440fe51742ed23342b68cf106cefd427e39d.tar.gz",
|
||||
)
|
||||
|
||||
consensus_spec_version = "v1.5.0"
|
||||
consensus_spec_version = "v1.5.0-beta.5"
|
||||
|
||||
bls_test_version = "v0.1.1"
|
||||
|
||||
@@ -271,7 +271,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
integrity = "sha256-JljxS/if/t0qvGWcf5CgsX+72fj90yGTg/uEgC56y7U=",
|
||||
integrity = "sha256-H+Pt4z+HCVDnEBAv814yvsjR7f5l1IpumjFoTj2XnLE=",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/general.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@@ -287,7 +287,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
integrity = "sha256-NRba2h4zqb2LAXyDPglHTtkT4gVyuwpY708XmwXKXV8=",
|
||||
integrity = "sha256-Dqiwf5BG7yYyURGf+i87AIdArAyztvcgjoi2kSxrGvo=",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/minimal.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@@ -303,7 +303,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
integrity = "sha256-hpbtKUbc3NHtVcUPk/Zm+Hn57G2ijI9qvXJwl9hc/tM=",
|
||||
integrity = "sha256-xrmsFF243pzXHAjh1EQYKS9gtcwmtHK3wRZDSLlVVRk=",
|
||||
url = "https://github.com/ethereum/consensus-spec-tests/releases/download/%s/mainnet.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
@@ -318,7 +318,7 @@ filegroup(
|
||||
visibility = ["//visibility:public"],
|
||||
)
|
||||
""",
|
||||
integrity = "sha256-Wy3YcJxoXiKQwrGgJecrtjtdokc4X/VUNBmyQXJf0Oc=",
|
||||
integrity = "sha256-c+gGapqifCvFtmtxfhOwieBDO2Syxp13GECWEpWM/Ho=",
|
||||
strip_prefix = "consensus-specs-" + consensus_spec_version[1:],
|
||||
url = "https://github.com/ethereum/consensus-specs/archive/refs/tags/%s.tar.gz" % consensus_spec_version,
|
||||
)
|
||||
|
||||
22
beacon-chain/sync/rlnc/BUILD.bazel
Normal file
22
beacon-chain/sync/rlnc/BUILD.bazel
Normal file
@@ -0,0 +1,22 @@
|
||||
load("@prysm//tools/go:def.bzl", "go_library", "go_test")
|
||||
|
||||
go_library(
|
||||
name = "go_default_library",
|
||||
srcs = ["committer.go"],
|
||||
importpath = "github.com/OffchainLabs/prysm/v6/beacon-chain/sync/rlnc",
|
||||
visibility = ["//visibility:public"],
|
||||
deps = [
|
||||
"//crypto/rand:go_default_library",
|
||||
"@com_github_gtank_ristretto255//:go_default_library",
|
||||
],
|
||||
)
|
||||
|
||||
go_test(
|
||||
name = "go_default_test",
|
||||
srcs = ["committer_test.go"],
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//testing/require:go_default_library",
|
||||
"@com_github_gtank_ristretto255//:go_default_library",
|
||||
],
|
||||
)
|
||||
37
beacon-chain/sync/rlnc/committer.go
Normal file
37
beacon-chain/sync/rlnc/committer.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package rlnc
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/crypto/rand"
|
||||
ristretto "github.com/gtank/ristretto255"
|
||||
)
|
||||
|
||||
// committer is a structure that holds the Ristretto generators.
|
||||
type committer struct {
|
||||
generators []*ristretto.Element
|
||||
}
|
||||
|
||||
// newCommitter creates a new committer with the number of generators.
|
||||
// TODO: read the generators from the config file.
|
||||
func newCommitter(n uint) *committer {
|
||||
generators := make([]*ristretto.Element, n)
|
||||
randomBytes := make([]byte, 64)
|
||||
for i := range generators {
|
||||
_, err := rand.NewGenerator().Read(randomBytes)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
generators[i] = &ristretto.Element{}
|
||||
generators[i].FromUniformBytes(randomBytes)
|
||||
}
|
||||
return &committer{generators}
|
||||
}
|
||||
|
||||
func (c *committer) commit(scalars []*ristretto.Scalar) (*ristretto.Element, error) {
|
||||
if len(scalars) > len(c.generators) {
|
||||
return nil, errors.New("too many scalars")
|
||||
}
|
||||
result := &ristretto.Element{}
|
||||
return result.VarTimeMultiScalarMult(scalars, c.generators), nil
|
||||
}
|
||||
40
beacon-chain/sync/rlnc/committer_test.go
Normal file
40
beacon-chain/sync/rlnc/committer_test.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package rlnc
|
||||
|
||||
import (
|
||||
"crypto/rand"
|
||||
"testing"
|
||||
|
||||
"github.com/OffchainLabs/prysm/v6/testing/require"
|
||||
ristretto "github.com/gtank/ristretto255"
|
||||
)
|
||||
|
||||
func TestCommit(t *testing.T) {
|
||||
n := 5
|
||||
c := newCommitter(uint(n))
|
||||
require.NotNil(t, c)
|
||||
require.Equal(t, n, len(c.generators))
|
||||
|
||||
scalars := make([]*ristretto.Scalar, n)
|
||||
randomBytes := make([]byte, 64)
|
||||
for i := range scalars {
|
||||
_, err := rand.Read(randomBytes)
|
||||
require.NoError(t, err)
|
||||
scalars[i] = &ristretto.Scalar{}
|
||||
scalars[i].FromUniformBytes(randomBytes)
|
||||
}
|
||||
|
||||
msm := &ristretto.Element{}
|
||||
msm.VarTimeMultiScalarMult(scalars, c.generators)
|
||||
|
||||
expected := ristretto.NewElement()
|
||||
summand := &ristretto.Element{}
|
||||
for i, scalar := range scalars {
|
||||
summand.ScalarMult(scalar, c.generators[i])
|
||||
expected.Add(expected, summand)
|
||||
}
|
||||
require.Equal(t, 1, expected.Equal(msm))
|
||||
|
||||
committment, err := c.commit(scalars)
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, 1, committment.Equal(msm))
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
### Changed
|
||||
|
||||
- Update spec to v1.5.0 compliance which changes minimal execution requests size.
|
||||
@@ -37,12 +37,9 @@ var placeholderFields = []string{
|
||||
"EIP7805_FORK_EPOCH",
|
||||
"EIP7805_FORK_VERSION",
|
||||
"EPOCHS_PER_SHUFFLING_PHASE",
|
||||
"MAX_BYTES_PER_INCLUSION_LIST",
|
||||
"MAX_REQUEST_BLOB_SIDECARS_FULU",
|
||||
"MAX_REQUEST_INCLUSION_LIST",
|
||||
"MAX_REQUEST_PAYLOADS", // Compile time constant on BeaconBlockBody.ExecutionRequests
|
||||
"PROPOSER_INCLUSION_LIST_CUT_OFF",
|
||||
"PROPOSER_SCORE_BOOST_EIP7732",
|
||||
"PROPOSER_SELECTION_GAP",
|
||||
"TARGET_NUMBER_OF_PEERS",
|
||||
"UPDATE_TIMEOUT",
|
||||
|
||||
@@ -112,6 +112,8 @@ func MinimalSpecConfig() *BeaconChainConfig {
|
||||
minimalConfig.MaxPerEpochActivationExitChurnLimit = 128000000000
|
||||
minimalConfig.PendingConsolidationsLimit = 64
|
||||
minimalConfig.MaxPartialWithdrawalsPerPayload = 1
|
||||
minimalConfig.MaxWithdrawalRequestsPerPayload = 2
|
||||
minimalConfig.MaxDepositRequestsPerPayload = 4
|
||||
minimalConfig.PendingPartialWithdrawalsLimit = 64
|
||||
minimalConfig.MaxPendingPartialsPerWithdrawalsSweep = 2
|
||||
minimalConfig.PendingDepositsLimit = 134217728
|
||||
|
||||
10
deps.bzl
10
deps.bzl
@@ -373,8 +373,8 @@ def prysm_deps():
|
||||
go_repository(
|
||||
name = "com_github_cespare_cp",
|
||||
importpath = "github.com/cespare/cp",
|
||||
sum = "h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU=",
|
||||
version = "v1.1.1",
|
||||
sum = "h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=",
|
||||
version = "v0.1.0",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_cespare_xxhash",
|
||||
@@ -1395,6 +1395,12 @@ def prysm_deps():
|
||||
sum = "h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg=",
|
||||
version = "v2.25.1",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_gtank_ristretto255",
|
||||
importpath = "github.com/gtank/ristretto255",
|
||||
sum = "h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=",
|
||||
version = "v0.1.2",
|
||||
)
|
||||
go_repository(
|
||||
name = "com_github_guptarohit_asciigraph",
|
||||
importpath = "github.com/guptarohit/asciigraph",
|
||||
|
||||
2
go.mod
2
go.mod
@@ -30,6 +30,7 @@ require (
|
||||
github.com/gostaticanalysis/comment v1.4.2
|
||||
github.com/grpc-ecosystem/go-grpc-middleware v1.2.2
|
||||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
|
||||
github.com/gtank/ristretto255 v0.1.2
|
||||
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d
|
||||
github.com/herumi/bls-eth-go-binary v1.31.0
|
||||
github.com/holiman/uint256 v1.3.2
|
||||
@@ -112,7 +113,6 @@ require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.17.0 // indirect
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
|
||||
github.com/cespare/cp v1.1.1 // indirect
|
||||
github.com/cespare/xxhash/v2 v2.3.0 // indirect
|
||||
github.com/chzyer/readline v1.5.1 // indirect
|
||||
github.com/cockroachdb/errors v1.11.3 // indirect
|
||||
|
||||
6
go.sum
6
go.sum
@@ -110,8 +110,8 @@ github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QH
|
||||
github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8=
|
||||
github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
github.com/cespare/cp v1.1.1 h1:nCb6ZLdB7NRaqsm91JtQTAme2SKJzXVsdPIPkyJr1MU=
|
||||
github.com/cespare/cp v1.1.1/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
||||
github.com/cespare/cp v0.1.0 h1:SE+dxFebS7Iik5LK0tsi1k9ZCxEaFX4AjQmoyA+1dJk=
|
||||
github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s=
|
||||
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
|
||||
github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs=
|
||||
@@ -452,6 +452,8 @@ github.com/grpc-ecosystem/grpc-gateway v1.5.0/go.mod h1:RSKVYQBd5MCa4OVpNdGskqpg
|
||||
github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1 h1:VNqngBF40hVlDloBruUehVYC3ArSgIyScOAyMRqBxRg=
|
||||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.25.1/go.mod h1:RBRO7fro65R6tjKzYgLAFo0t1QEXY1Dp+i/bvpRiqiQ=
|
||||
github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc=
|
||||
github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o=
|
||||
github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE=
|
||||
github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8=
|
||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
||||
|
||||
@@ -6,7 +6,7 @@ import "proto/eth/ext/options.proto";
|
||||
import "proto/engine/v1/execution_engine.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Engine.V1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v5/proto/engine/v1;enginev1";
|
||||
option go_package = "github.com/OffchainLabs/prysm/v6/proto/engine/v1;enginev1";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "ElectraProto";
|
||||
option java_package = "org.ethereum.engine.v1";
|
||||
|
||||
@@ -19,7 +19,7 @@ import "proto/eth/ext/options.proto";
|
||||
import "proto/prysm/v1alpha1/beacon_block.proto";
|
||||
|
||||
option csharp_namespace = "Ethereum.Eth.v1alpha1";
|
||||
option go_package = "github.com/prysmaticlabs/prysm/v5/proto/prysm/v1alpha1;eth";
|
||||
option go_package = "github.com/OffchainLabs/prysm/v6/proto/prysm/v1alpha1;eth";
|
||||
option java_multiple_files = true;
|
||||
option java_outer_classname = "DataColumnsProto";
|
||||
option java_package = "org.ethereum.eth.v1alpha1";
|
||||
|
||||
@@ -65,8 +65,8 @@ minimal = {
|
||||
"max_blob_commitments.size": "32",
|
||||
"max_cell_proofs_length.size": "524288", # CELLS_PER_EXT_BLOB * MAX_BLOB_COMMITMENTS_PER_BLOCK
|
||||
"kzg_commitment_inclusion_proof_depth.size": "10",
|
||||
"max_withdrawal_requests_per_payload.size": "16",
|
||||
"max_deposit_requests_per_payload.size": "8192",
|
||||
"max_withdrawal_requests_per_payload.size": "2",
|
||||
"max_deposit_requests_per_payload.size": "4",
|
||||
"max_attesting_indices.size": "8192",
|
||||
"max_committees_per_slot.size": "4",
|
||||
"committee_bits.size": "1",
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestProposeBeaconBlock_Capella(t *testing.T) {
|
||||
|
||||
jsonCapellaBlock, err := structs.SignedBeaconBlockCapellaFromConsensus(capellaBlock.Capella)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
marshalledBlock, err := json.Marshal(jsonCapellaBlock)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user