-
Notifications
You must be signed in to change notification settings - Fork 995
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When configuring a private Besu network with mixed cryptographic curves (bootnode using secp256r1, validators using default secp256k1), the network becomes completely inoperable. Validators fail to mine blocks due to incompatible peer discovery protocols, resulting in a permanent network lock.
Severity
Critical - This issue causes 100% network failure with no recovery possible.
Environment
- Besu Version: 23.10.0
- Java Version: OpenJDK 11.0.20
- OS: Ubuntu 22.04 LTS
- Docker: 24.0.7 (if applicable)
Steps to Reproduce
- Set up a local Besu network using
isbe-local-besu-deployer - Configure bootnode with secp256r1 curve in genesis:
"config": { "chainId": 1337, "ethash": {}, "crypto": { "curve": "secp256r1" } }
- Configure validator nodes with the default secp256k1 curve
- Start the network and attempt a peer connection
- Result: Network becomes permanently locked
Expected Behaviour
- The network should detect curve mismatch during the initial handshake
- Incompatible peers should be rejected gracefully with clear error logging
- Validators should continue mining with compatible peers
- No network lockup should occur
Actual Behaviour
- 100% network failure: Validators never mine blocks
- Complete network lock: No peer discovery or communication occurs
- Repeated errors: "Could not recover public key" exceptions in logs
- No graceful rejection: IllegalArgumentException instead of proper peer filtering
Error Logs
2025-12-23 13:11:16.443+0000 | vert.x-eventloop-thread-3 | ERROR | VertxPeerDiscoveryAgent | Encountered error while handling packet
java.lang.IllegalArgumentException: Could not recover public key
at org.hyperledger.besu.crypto.SECP256K1.recoverPublicKeyFromSignature(SECP256K1.java:139)
at org.hyperledger.besu.ethereum.p2p.discovery.internal.packet.PacketFactory.create(PacketFactory.java:126)
at org.hyperledger.besu.ethereum.p2p.discovery.internal.packet.PacketDeserializer.decode(PacketDeserializer.java:104)
at org.hyperledger.besu.ethereum.p2p.discovery.VertxPeerDiscoveryAgent.lambda$handlePacket$9(VertxPeerDiscoveryAgent.java:331)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$5(ContextImpl.java:205)
Root Cause Analysis
- Discovery Protocol Failure: SECP256K1 signature verification attempts to process secp256r1 signatures, causing exceptions
- No Handshake Validation: Crypto algorithm information is not exchanged during the initial handshake
- Exception Propagation: IllegalArgumentException instead of proper peer rejection
- Cascading Failure: Discovery failures prevent block production entirely
Suggested Fixes (Priority Order)
- Add crypto algorithm exchange during handshake - Include curve information in initial discovery packets
- Implement graceful peer rejection - Validate curve compatibility before signature verification
- Improve error logging - Provide clear messages about curve incompatibility
- Add network validation - Warn if mixed curves are detected during network setup
Additional Information
- Reproduction Repository: https://github.com/red-isbe/isbe-besu-local-deployer
- Key observations:
- Error occurs in
SECP256K1.recoverPublicKeyFromSignature()during signature verification - Incompatibility should be detected before the signature verification attempt
- Current implementation lacks a proper peer filtering mechanism
- The issue is 100% reproducible with a mixed curve configuration
- Error occurs in
Code References
org.hyperledger.besu.crypto.SECP256K1.recoverPublicKeyFromSignature(line 139)org.hyperledger.besu.ethereum.p2p.discovery.internal.packet.PacketFactory.create(line 126)org.hyperledger.besu.ethereum.p2p.discovery.VertxPeerDiscoveryAgent.handlePacket(line 331)
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working