Skip to content

fix(rpc): remove 0x prefix from admin_peers id to match go-ethereum format#23318

Merged
mattsse merged 1 commit into
paradigmxyz:mainfrom
asdv23:fix/admin-peers-id-no-0x-prefix
Apr 1, 2026
Merged

fix(rpc): remove 0x prefix from admin_peers id to match go-ethereum format#23318
mattsse merged 1 commit into
paradigmxyz:mainfrom
asdv23:fix/admin-peers-id-no-0x-prefix

Conversation

@asdv23
Copy link
Copy Markdown
Contributor

@asdv23 asdv23 commented Apr 1, 2026

Summary

Removes the spurious 0x prefix from admin_peers[].id, making it consistent with go-ethereum which returns bare hex without any prefix.

Root Cause

keccak256(...).to_string() uses alloy-primitives B256::Display, which always prepends 0x (via fmt_hex with prefix = true). Replacing it with alloy_primitives::hex::encode(...) produces a bare 64-character hex string.

As a bonus, the node_info handler in the same file already uses hex::encode at line 160 — so this change makes both handlers consistent.

Change

File: crates/rpc/rpc/src/admin.rs

-id: keccak256(peer.remote_id.as_slice()).to_string(),
+id: alloy_primitives::hex::encode(keccak256(peer.remote_id.as_slice())),

Before / After

Value Length Has 0x?
Before 0x6b36f791352f15eb3ec4f67787074ab8ad9d487e37c4401d383f0561a0a20507 66 chars Yes ❌
After 6b36f791352f15eb3ec4f67787074ab8ad9d487e37c4401d383f0561a0a20507 64 chars No ✅

Closes #23316

Related

…ormat

B256::to_string() / Display always prepends "0x" via alloy-primitives
FixedBytes::fmt_hex. Replace with alloy_primitives::hex::encode() which
emits a bare 64-char hex string, matching go-ethereum's admin_peers output.

The node_info handler already uses the same hex::encode pattern (line 160),
so this change makes the two handlers consistent.
Copy link
Copy Markdown
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. The admin_peers.id serialization now matches geth's bare lowercase hex format.

@github-project-automation github-project-automation Bot moved this from Backlog to In Progress in Reth Tracker Apr 1, 2026
@mattsse mattsse added this pull request to the merge queue Apr 1, 2026
Merged via the queue into paradigmxyz:main with commit 239c262 Apr 1, 2026
36 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in Reth Tracker Apr 1, 2026
@asdv23 asdv23 deleted the fix/admin-peers-id-no-0x-prefix branch April 1, 2026 08:23
github-merge-queue Bot pushed a commit to tempoxyz/tempo that referenced this pull request Apr 3, 2026
Automated nightly update of reth dependencies from `paradigmxyz/reth`
main branch.

## Upstream reth changes


[`f8efc76...c82d435`](paradigmxyz/reth@f8efc76...c82d435)

🔗 Amp thread:
https://ampcode.com/threads/T-019d517e-981b-75fd-b3cf-8ad2455f38f6
**RPC**
- Remove `0x` prefix from `admin_peers` id and return keccak256 node ID
in `admin_nodeInfo.id` to match go-ethereum format
([#23318](paradigmxyz/reth#23318),
[#23319](paradigmxyz/reth#23319))
- Apply count filter only after `after` is consumed in pagination
([#23338](paradigmxyz/reth#23338))
- Pre-allocate vectors in `eth_feeHistory`
([#23334](paradigmxyz/reth#23334))
- Add `bal` RPC methods
([#23330](paradigmxyz/reth#23330))

**Engine**
- Include backpressure in reported `persistence_wait`, make wait-time
mimic CL slot time
([#23308](paradigmxyz/reth#23308))

**Perf**
- Reduce cacheline ping-pong in workers availability
([#23321](paradigmxyz/reth#23321))

**Net**
- Avoid itertools `Format` panic in tracing log
([#23331](paradigmxyz/reth#23331))

**DB**
- Cap `storage_v2` unwind history by MDBX tip
([#23335](paradigmxyz/reth#23335))

**Bench**
- Add warmup step for big blocks mode
([#23323](paradigmxyz/reth#23323))
- Make payload handling ethereum-only
([#23324](paradigmxyz/reth#23324))
- Use repository instead of GitHub Actions cache to track hourly runs
([#23306](paradigmxyz/reth#23306))
- Upload nightly regression results to ClickHouse
([#23344](paradigmxyz/reth#23344))

**Chore**
- Migrate `allow(clippy::` to `expect(clippy::`
([#23340](paradigmxyz/reth#23340))
- Remove unused return value from `dispatch_with_chunking`
([#23341](paradigmxyz/reth#23341))
- Update nixpkgs to 25.11 and refresh flake inputs
([#23342](paradigmxyz/reth#23342))

## Migrations

🔗 Amp thread:
https://ampcode.com/threads/T-019d517e-baf0-727b-a57e-0488240af973
- **Reth dependency bump**: All `reth-*` git dependencies updated from
rev `f8efc76` to `c82d435`
- **New `GetBlockAccessList` trait impl**: `TempoEthApi` now implements
`GetBlockAccessList` (imported from `reth_rpc_eth_api::helpers::bal`),
likely a new required trait added upstream in the reth update

[GitHub
Workflow](https://github.com/tempoxyz/tempo/actions/runs/23933027282)

---------

Co-authored-by: Arsenii Kulikov <klkvrr@gmail.com>
asdv23 added a commit to mantle-xyz/reth that referenced this pull request Apr 9, 2026
…ormat

B256::to_string() / Display always prepends "0x" via alloy-primitives
FixedBytes::fmt_hex. Replace with alloy_primitives::hex::encode() which
emits a bare 64-char hex string, matching go-ethereum's admin_peers output.

Port of paradigmxyz#23318
asdv23 added a commit to mantle-xyz/reth that referenced this pull request Apr 9, 2026
…stamp (#29)

* fix(rpc): remove 0x prefix from admin_peers id to match go-ethereum format

B256::to_string() / Display always prepends "0x" via alloy-primitives
FixedBytes::fmt_hex. Replace with alloy_primitives::hex::encode() which
emits a bare 64-char hex string, matching go-ethereum's admin_peers output.

Port of paradigmxyz#23318

* fix(rpc): admin_nodeInfo.id returns keccak256 node ID matching go-ethereum format

Previously, id2pk(enode.id).map(|pk| pk.to_string()) was used, which calls
the secp256k1 crate's LowerHex implementation that returns the compressed
public key (33 bytes, 66 hex chars, 02/03 prefix).

go-ethereum computes the node ID as keccak256(X||Y) of the raw public key
coordinates (32 bytes, 64 hex chars, no prefix). Since enode.id is already
the raw 64-byte X||Y coordinates (PeerId = B512), calling keccak256 directly
on it produces the correct node ID matching go-ethereum's format.

Also removes now-unused id2pk import.

Port of paradigmxyz#23319

* feat(mantle): add Arsia mainnet hardfork timestamp 1_776_841_200

Add MANTLE_MAINNET_ARSIA_TIMESTAMP constant matching op-geth params/mantle.go.
Update from_chain_and_timestamp and mantle_mainnet() fork list to include
Arsia. Extend tests with fork condition assertion and reverse-lookup coverage.

* feat(chainspec): enable Arsia hardfork for Mantle mainnet at 1_776_841_200

Set mantle_arsia_time to MANTLE_MAINNET_ARSIA_TIMESTAMP in
create_mantle_mainnet_genesis(). Per the Mantle alignment logic in
OpChainSpec::from(Genesis), this activates Canyon/Ecotone/Fjord/Granite/
Holocene/Isthmus/Jovian simultaneously at the Arsia timestamp.

Matches op-geth params/mantle.go: MantleArsiaTime: u64Ptr(1_776_841_200).

* test(chainspec): complete OP fork alignment assertions in verify_hardfork_timestamps

Add missing Fjord/Granite/Isthmus positive assertions and add pre-boundary
negative assertions for Holocene and Jovian, so all 7 OP-layer forks activated
at Arsia timestamp are fully covered.
asdv23 added a commit to mantle-xyz/mantle-v2 that referenced this pull request Apr 10, 2026
…tream reth fix

mantle-xyz/reth v2.2.1 (commit e166f3a9) ported paradigmxyz/reth#23318
and #23319, fixing admin_nodeInfo.id (compressed pubkey → keccak256) and
admin_peers[].id (0x prefix removed). Both formats now match go-ethereum.

Remove the client-side workarounds that were needed before the fix:
- enodeNodeID(): derived node ID from enode URL to avoid admin_nodeInfo.id mismatch
- matchesPeerID(): stripped 0x prefix from admin_peers[].id

Peer comparison now uses admin_nodeInfo.ID directly (p.ID == info.ID).
All other reth compatibility changes (bidirectional addPeer, 90s timeout,
Wipe, WaitUntilValid, SupportsPostFinalizationELSync) are unaffected.

-40 lines, 2 functions removed, 2 imports removed (strings, enode).
asdv23 added a commit to mantle-xyz/mantle-v2 that referenced this pull request Apr 10, 2026
…tream reth fix

mantle-xyz/reth v2.2.1 (commit e166f3a9) ported paradigmxyz/reth#23318
and #23319, fixing admin_nodeInfo.id (compressed pubkey → keccak256) and
admin_peers[].id (0x prefix removed). Both formats now match go-ethereum.

Remove the client-side workarounds that were needed before the fix:
- enodeNodeID(): derived node ID from enode URL to avoid admin_nodeInfo.id mismatch
- matchesPeerID(): stripped 0x prefix from admin_peers[].id

Peer comparison now uses admin_nodeInfo.ID directly (p.ID == info.ID).
All other reth compatibility changes (bidirectional addPeer, 90s timeout,
Wipe, WaitUntilValid, SupportsPostFinalizationELSync) are unaffected.

-40 lines, 2 functions removed, 2 imports removed (strings, enode).
asdv23 added a commit to mantle-xyz/mantle-v2 that referenced this pull request Apr 14, 2026
…assertions

  - Document reth v2.2.1 P2P node ID format invariant on ConnectP2P
    (mantle-xyz/reth e166f3a9, paradigmxyz/reth#23318 #23319)
  - Remove dead if-guard in normalizeSysextCoinbase fallthrough path
  - Restore initial EIP-1559 param assertions for sysgo mode; sysext
    skips them because the devnet may carry prior SystemConfig writes
  - Convert sync_tester_hfs re-enable prose into TODO comments for
    tooling discoverability
  - Add bob.VerifyBalanceExact in transfer test to close recipient-side
    coverage gap after ValidateReceipt → ValidateTransaction migration
  - Soften "avoiding" → "reducing" in transfer test comment; note that
    vault snapshots still use latest-block queries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug: admin_peers[].id has spurious 0x prefix, incompatible with go-ethereum

2 participants