Skip to content

Commit

Permalink
Merge pull request #1 from taikoxyz/taiko
Browse files Browse the repository at this point in the history
build prysm devnet
  • Loading branch information
mask-pp authored Jun 9, 2024
2 parents 8413660 + 4e5ae67 commit 30a9a8a
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 4 deletions.
69 changes: 69 additions & 0 deletions .github/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: "Push docker image to GAR"

on:
push:
branches: [ develop ]
tags:
- "v*"

jobs:
push-docker-image:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Login to GAR
uses: docker/login-action@v2
with:
registry: us-docker.pkg.dev
username: _json_key
password: ${{ secrets.GAR_JSON_KEY }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
us-docker.pkg.dev/evmchain/images/client-go
tags: |
type=ref,event=branch
type=ref,event=pr
type=ref,event=tag
type=sha
- name: Cache Go build
uses: actions/cache@v4
with:
path: |
${{ runner.os }}-go_build-platforms
key: ${{ runner.os }}-go_build-platforms
restore-keys: |
${{ runner.os }}-go_build-platforms
- name: Inject cache into docker
uses: reproducible-containers/[email protected]
with:
cache-map: |
{
"${{ runner.os }}-go_build-platforms": "/root/.cache/go-build"
}
skip-extraction: ${{ steps.cache.outputs.cache-hit }}

- name: Build and push
uses: docker/build-push-action@v2
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
25 changes: 21 additions & 4 deletions beacon-chain/blockchain/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/pkg/errors"
"go.opencensus.io/trace"

"github.com/ethereum/go-ethereum/common"
"github.com/prysmaticlabs/prysm/v5/async/event"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain/kzg"
"github.com/prysmaticlabs/prysm/v5/beacon-chain/cache"
Expand Down Expand Up @@ -290,10 +291,6 @@ func (s *Service) StartFromSavedState(saved state.BeaconState) error {
fRoot := s.ensureRootNotZeros(bytesutil.ToBytes32(finalized.Root))
s.cfg.ForkChoiceStore.Lock()
defer s.cfg.ForkChoiceStore.Unlock()
if err := s.cfg.ForkChoiceStore.UpdateJustifiedCheckpoint(s.ctx, &forkchoicetypes.Checkpoint{Epoch: justified.Epoch,
Root: bytesutil.ToBytes32(justified.Root)}); err != nil {
return errors.Wrap(err, "could not update forkchoice's justified checkpoint")
}
if err := s.cfg.ForkChoiceStore.UpdateFinalizedCheckpoint(&forkchoicetypes.Checkpoint{Epoch: finalized.Epoch,
Root: bytesutil.ToBytes32(finalized.Root)}); err != nil {
return errors.Wrap(err, "could not update forkchoice's finalized checkpoint")
Expand All @@ -307,6 +304,26 @@ func (s *Service) StartFromSavedState(saved state.BeaconState) error {
if err := s.cfg.ForkChoiceStore.InsertNode(s.ctx, st, fRoot); err != nil {
return errors.Wrap(err, "could not insert finalized block to forkchoice")
}

var (
roots [][32]byte
states []state.BeaconState
jRoot = s.ensureRootNotZeros(bytesutil.ToBytes32(justified.Root))
)
for parentRoot := jRoot; common.BytesToHash(fRoot[:]) != common.BytesToHash(parentRoot[:]); {
parentState, err := s.cfg.StateGen.StateByRoot(s.ctx, parentRoot)
if err != nil {
return errors.Wrap(err, "could not get parent state")
}
roots = append(roots, parentRoot)
states = append(states, parentState)
parentRoot = bytesutil.ToBytes32(parentState.LatestBlockHeader().ParentRoot)
}
for i := len(roots) - 1; i >= 0; i-- {
if err := s.cfg.ForkChoiceStore.InsertNode(s.ctx, states[i], roots[i]); err != nil {
return errors.Wrap(err, "could not insert block to forkchoice")
}
}
if !features.Get().EnableStartOptimistic {
lastValidatedCheckpoint, err := s.cfg.BeaconDB.LastValidatedCheckpoint(s.ctx)
if err != nil {
Expand Down

0 comments on commit 30a9a8a

Please sign in to comment.