Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go builds are not supported for minimal config #14703

Open
barnabasbusa opened this issue Dec 9, 2024 · 4 comments
Open

go builds are not supported for minimal config #14703

barnabasbusa opened this issue Dec 9, 2024 · 4 comments
Assignees
Labels
Bug Something isn't working

Comments

@barnabasbusa
Copy link
Contributor

barnabasbusa commented Dec 9, 2024

Describe the bug

Related issue.

If I build prysm with bazel it works correctly for mainnet and minimal preset.
If I build prysm with go it works correctly only for mainnet preset.

If I try to run prysm using go build environment (go build -tags="--config=minimal,blst_enabled,blst_portable") I get the following error:

time="2024-12-09 10:08:23" level=warning msg="Running on custom Ethereum network specified in a chain configuration yaml file" prefix=flags
time="2024-12-09 10:08:23" level=warning msg="Using minimal config" prefix=node
....
time="2024-12-09 10:08:23" level=fatal msg="unable to start beacon node: could not start modules: could not start DB: could not load genesis from file: failed to unmarshal state, detected fork=deneb: incorrect size" prefix=main

Another weird observation is that if I use a minimal preset image (using go built) with mainnet network settings the process starts up, but crashes with segfault after about 30 seconds.

segfault:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xe3d6e0]

goroutine 4918 [running]:
github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/doubly-linked-tree.(*Store).setOptimisticToInvalid(0x40001d6960, {0x23dcfd8, 0x4002e94b40}, {0xe4, 0xb7, 0x34, 0xdf, 0xf7, 0xf3, 0x61, ...}, ...)
	/opt/actions-runner/_work/eth-client-docker-image-builder/eth-client-docker-image-builder/source/beacon-chain/forkchoice/doubly-linked-tree/optimistic_sync.go:26 +0x50
github.com/prysmaticlabs/prysm/v5/beacon-chain/forkchoice/doubly-linked-tree.(*ForkChoice).SetOptimisticToInvalid(0x2000?, {0x23dcfd8?, 0x4002e94b40?}, {0xe4, 0xb7, 0x34, 0xdf, 0xf7, 0xf3, 0x61, ...}, ...)
	/opt/actions-runner/_work/eth-client-docker-image-builder/eth-client-docker-image-builder/source/beacon-chain/forkchoice/doubly-linked-tree/forkchoice.go:363 +0x5c
github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).notifyForkchoiceUpdate(0x4002e14200, {0x23dcfd8?, 0x4002e94b40?}, 0x400250e360)
	/opt/actions-runner/_work/eth-client-docker-image-builder/eth-client-docker-image-builder/source/beacon-chain/blockchain/execution_engine.go:93 +0xc58
github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).lateBlockTasks(0x4002e14200, {0x23dcfd8, 0x4002e94b40})
	/opt/actions-runner/_work/eth-client-docker-image-builder/eth-client-docker-image-builder/source/beacon-chain/blockchain/process_block.go:675 +0x9c4
github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).runLateBlockTasks(0x4002e14200)
	/opt/actions-runner/_work/eth-client-docker-image-builder/eth-client-docker-image-builder/source/beacon-chain/blockchain/process_block.go:486 +0x188
created by github.com/prysmaticlabs/prysm/v5/beacon-chain/blockchain.(*Service).Start in goroutine 4857
	/opt/actions-runner/_work/eth-client-docker-image-builder/eth-client-docker-image-builder/source/beacon-chain/blockchain/service.go:211 +0x140

Has this worked before in a previous version?

Not that I'm aware of.

🔬 Minimal Reproduction

kt config:

participants:
  - cl_type: prysm
    cl_image: ethpandaops/prysm-beacon-chain:develop-bazel-minimal-minimal-30a136f # This works
  - cl_type: prysm
    cl_image: ethpandaops/prysm-beacon-chain:develop-go-minimal-minimal-linux-arm64-30a136f # This fails
network_params:
  preset: minimal

To repro the segfault

participants:
  - cl_type: prysm
    cl_image: ethpandaops/prysm-beacon-chain:develop-go-minimal-minimal-linux-arm64-30a136f # This should fail right away, but instead it segfaults
network_params:
  preset: mainnet

Error

Already shared above.

Platform(s)

Mac (Apple Silicon)

What version of Prysm are you running? (Which release)

latest develop commit 30a136f

Anything else relevant (validator index / public key)?

N/A
cc: @mattevans

@barnabasbusa barnabasbusa added the Bug Something isn't working label Dec 9, 2024
@prestonvanloon prestonvanloon self-assigned this Dec 9, 2024
@prestonvanloon
Copy link
Member

Correct flag usage is go build -tags="minimal,blst_enabled,blst_portable"

@prestonvanloon
Copy link
Member

Minimal go builds are indeed broken.

go1.22.4 build -tags="minimal,blst_enabled,blst_portable" -o /tmp/beacon-chain.minimal ./cmd/beacon-chain 
# github.com/prysmaticlabs/prysm/v5/beacon-chain/rpc/prysm/v1alpha1/validator
beacon-chain/rpc/prysm/v1alpha1/validator/proposer_attestations_electra.go:91:21: cannot use cb (variable of type bitfield.Bitvector4) as bitfield.Bitvector64 value in struct literal

@prestonvanloon prestonvanloon reopened this Dec 9, 2024
@prestonvanloon
Copy link
Member

prestonvanloon commented Dec 10, 2024

Still looking into this. At this time, we do not have support for building minimal config with go tooling only. Bazel handles the type substitution at compile time where go is unable to do this.

@prestonvanloon
Copy link
Member

prestonvanloon commented Dec 10, 2024

I'll also add that this is rather low priority for us. If someone is able to propose a PR then we would review and accept it quickly. The gist is that the protobuf templates have to be generated with the correct config, then protoc (with the appropriate plugins) has to regenerate the pb.go files. I don't immediately see a clean fix here for go builds with minimal config at compile time.

Edit: ssz generated code would have to be regenerated too.

@prestonvanloon prestonvanloon changed the title go build for minimal network preset misbehaves go builds are not supported for minimal config Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants