Skip to content

Commit

Permalink
Merge branch 'master' into fulu-support
Browse files Browse the repository at this point in the history
  • Loading branch information
pk910 committed Dec 17, 2024
2 parents b93c64f + 948bf7b commit 6790a41
Show file tree
Hide file tree
Showing 12 changed files with 348 additions and 547 deletions.
30 changes: 15 additions & 15 deletions .github/workflows/_shared-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
# upload artifacts
- name: "Upload artifact: ui-package"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ./ui-package/dist/*
name: ui-package
Expand All @@ -99,7 +99,7 @@ jobs:
# download UI build artifacts
- name: Download UI build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ui-package
path: ./ui-package/dist
Expand All @@ -113,7 +113,7 @@ jobs:

# upload artifacts
- name: "Upload artifact: explorer_linux_amd64"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ./bin/*
name: explorer_linux_amd64
Expand Down Expand Up @@ -146,7 +146,7 @@ jobs:
# download UI build artifacts
- name: Download UI build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ui-package
path: ./ui-package/dist
Expand All @@ -160,7 +160,7 @@ jobs:

# upload artifacts
- name: "Upload artifact: explorer_linux_arm64"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ./bin/*
name: explorer_linux_arm64
Expand All @@ -187,7 +187,7 @@ jobs:
# download UI build artifacts
- name: Download UI build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ui-package
path: ./ui-package/dist
Expand All @@ -201,7 +201,7 @@ jobs:

# upload artifacts
- name: "Upload artifact: explorer_windows_amd64"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ./bin/*
name: explorer_windows_amd64
Expand All @@ -228,7 +228,7 @@ jobs:
# download UI build artifacts
- name: Download UI build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ui-package
path: ./ui-package/dist
Expand All @@ -242,7 +242,7 @@ jobs:

# upload artifacts
- name: "Upload artifact: explorer_darwin_amd64"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ./bin/*
name: explorer_darwin_amd64
Expand All @@ -269,7 +269,7 @@ jobs:
# download UI build artifacts
- name: Download UI build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ui-package
path: ./ui-package/dist
Expand All @@ -283,7 +283,7 @@ jobs:

# upload artifacts
- name: "Upload artifact: explorer_darwin_arm64"
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
path: ./bin/*
name: explorer_darwin_arm64
Expand Down Expand Up @@ -313,12 +313,12 @@ jobs:

# download build artifacts
- name: Download UI build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ui-package
path: ./ui-package/dist
- name: Download build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: explorer_linux_amd64
path: ./bin
Expand Down Expand Up @@ -367,12 +367,12 @@ jobs:

# download build artifacts
- name: Download UI build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ui-package
path: ./ui-package/dist
- name: Download build artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: explorer_linux_arm64
path: ./bin
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ jobs:
steps:
# download build artifacts
- name: "Download build artifacts"
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

# (re)create snapshot binary release
- name: Update snapshot tag & remove previous snapshot release
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
# download build artifacts
- name: "Download build artifacts"
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4

# create draft release
- name: Create latest release
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/mashingan/smapping v0.1.19
github.com/mitchellh/mapstructure v1.5.0
github.com/pk910/dynamic-ssz v0.0.5
github.com/pressly/goose/v3 v3.23.0
github.com/pressly/goose/v3 v3.23.1
github.com/protolambda/bls12-381-util v0.1.0
github.com/protolambda/zrnt v0.32.3
github.com/protolambda/ztyp v0.2.2
Expand All @@ -34,7 +34,7 @@ require (
github.com/tdewolff/minify v2.3.6+incompatible
github.com/timandy/routine v1.1.4
github.com/urfave/negroni v1.0.0
golang.org/x/crypto v0.30.0
golang.org/x/crypto v0.31.0
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa
golang.org/x/text v0.21.0
golang.org/x/time v0.8.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pressly/goose/v3 v3.23.0 h1:57hqKos8izGek4v6D5+OXBa+Y4Rq8MU//+MmnevdpVA=
github.com/pressly/goose/v3 v3.23.0/go.mod h1:rpx+D9GX/+stXmzKa+uh1DkjPnNVMdiOCV9iLdle4N8=
github.com/pressly/goose/v3 v3.23.1 h1:bwjOXvep4HtuiiIqtrXmCkQu0IW9O9JAqA6UQNY9ntk=
github.com/pressly/goose/v3 v3.23.1/go.mod h1:0oK0zcK7cmNqJSVwMIOiUUW0ox2nDIz+UfPMSOaw2zY=
github.com/prometheus/client_golang v1.20.0 h1:jBzTZ7B099Rg24tny+qngoynol8LtVYlA2bqx3vEloI=
github.com/prometheus/client_golang v1.20.0/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
Expand Down Expand Up @@ -503,8 +503,8 @@ golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.20.0/go.mod h1:Xwo95rrVNIoSMx9wa1JroENMToLWn3RNVrTBpLHgZPQ=
golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY=
golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI=
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
Expand Down
63 changes: 47 additions & 16 deletions indexer/beacon/duties/duties.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@ func UintToBytes(data any) []byte {
}

func BytesToUint(data []byte) uint64 {
return binary.LittleEndian.Uint64(data)
switch len(data) {
case 1:
return uint64(data[0])
case 2:
return uint64(binary.LittleEndian.Uint16(data))
case 4:
return uint64(binary.LittleEndian.Uint32(data))
case 8:
return binary.LittleEndian.Uint64(data)
default:
return 0
}
}

func SplitOffset(listSize, chunks, index uint64) uint64 {
Expand Down Expand Up @@ -160,29 +171,49 @@ func GetProposerIndex(spec *consensus.ChainSpec, state *BeaconState, slot phase0

seed := Hash(seedData)

maxEffectiveBalance := spec.MaxEffectiveBalance
if spec.ElectraForkEpoch != nil && phase0.Epoch(slot/phase0.Slot(spec.SlotsPerEpoch)) >= phase0.Epoch(*spec.ElectraForkEpoch) {
maxEffectiveBalance = spec.MaxEffectiveBalanceElectra
}

activeIndicesCount := state.GetActiveCount()
if activeIndicesCount == 0 {
return 0, fmt.Errorf("empty active indices list")
}
maxRandomByte := uint64(1<<8 - 1)

for i := uint64(0); ; i++ {
candidateIndex, err := ComputeShuffledIndex(spec, i%activeIndicesCount, activeIndicesCount, seed, true)
if err != nil {
return 0, err
if spec.ElectraForkEpoch != nil && epoch >= phase0.Epoch(*spec.ElectraForkEpoch) {
// Electra fork
maxRandomValue := uint64(1<<16 - 1)

for i := uint64(0); ; i++ {
candidateIndex, err := ComputeShuffledIndex(spec, i%activeIndicesCount, activeIndicesCount, seed, true)
if err != nil {
return 0, err
}
b := append(seed[:], UintToBytes(i/16)...)
offset := (i % 16) * 2
hash := Hash(b)
randomValue := BytesToUint(hash[offset : offset+2])

effectiveBal := uint64(state.GetEffectiveBalance(ActiveIndiceIndex(candidateIndex)))

if effectiveBal*maxRandomValue >= spec.MaxEffectiveBalanceElectra*uint64(randomValue) {
return ActiveIndiceIndex(candidateIndex), nil
}
}
b := append(seed[:], UintToBytes(i/32)...)
randomByte := Hash(b)[i%32]

effectiveBal := uint64(state.GetEffectiveBalance(ActiveIndiceIndex(candidateIndex)))
} else {
// pre-Electra fork
maxRandomByte := uint64(1<<8 - 1)

for i := uint64(0); ; i++ {
candidateIndex, err := ComputeShuffledIndex(spec, i%activeIndicesCount, activeIndicesCount, seed, true)
if err != nil {
return 0, err
}
b := append(seed[:], UintToBytes(i/32)...)
randomByte := Hash(b)[i%32]

effectiveBal := uint64(state.GetEffectiveBalance(ActiveIndiceIndex(candidateIndex)))

if effectiveBal*maxRandomByte >= maxEffectiveBalance*uint64(randomByte) {
return ActiveIndiceIndex(candidateIndex), nil
if effectiveBal*maxRandomByte >= spec.MaxEffectiveBalance*uint64(randomByte) {
return ActiveIndiceIndex(candidateIndex), nil
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion indexer/execution/consolidation_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/ethpandaops/dora/utils"
)

const ConsolidationContractAddr = "0x01aBEa29659e5e97C95107F20bb753cD3e09bBBb"
const ConsolidationContractAddr = "0x00431F263cE400f4455c2dCf564e53007Ca4bbBb"

// ConsolidationIndexer is the indexer for the eip-7251 consolidation system contract
type ConsolidationIndexer struct {
Expand Down
2 changes: 1 addition & 1 deletion indexer/execution/withdrawal_indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"github.com/ethpandaops/dora/utils"
)

const WithdrawalContractAddr = "0x09Fc772D0857550724b07B850a4323f39112aAaA"
const WithdrawalContractAddr = "0x0c15F14308530b7CDB8460094BbB9cC28b9AaaAA"

// WithdrawalIndexer is the indexer for the eip-7002 consolidation system contract
type WithdrawalIndexer struct {
Expand Down
Loading

0 comments on commit 6790a41

Please sign in to comment.