From 17b32b6c80864e16883b7a942f0d92108838dc0a Mon Sep 17 00:00:00 2001 From: dylanhuang Date: Mon, 25 Sep 2023 19:31:12 +0800 Subject: [PATCH 1/2] fix: trim the prefix `0` for eth_chainId (#36) --- rpc/jsonrpc/types/types.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/rpc/jsonrpc/types/types.go b/rpc/jsonrpc/types/types.go index 2195e4717..85b9d80f5 100644 --- a/rpc/jsonrpc/types/types.go +++ b/rpc/jsonrpc/types/types.go @@ -255,12 +255,20 @@ func NewEthRPCSuccessResponse(id jsonrpcid, res interface{}, method string) RPCR } switch method { - // return hex string for eth_blockNumber, eth_chainId, eth_networkId, eth_getBalance - case EthBlockNumber, EthChainID, EthNetworkID, EthGetBalance: + // return hex string for eth_blockNumber, eth_networkId, eth_getBalance + case EthBlockNumber, EthNetworkID, EthGetBalance: result, err = json.Marshal("0x" + hex.EncodeToString(bz)) if err != nil { return RPCInternalError(id, fmt.Errorf("error decode response: %w", err)) } + // return hex string for eth_chainId + case EthChainID: + // metamask do not support the Hex signed 2's complement, need to trim the prefix `0` + chainIDStr := strings.TrimLeft(hex.EncodeToString(bz), "0") + result, err = json.Marshal("0x" + chainIDStr) + if err != nil { + return RPCInternalError(id, fmt.Errorf("error decode response: %w", err)) + } // return int string for net_version case NetVersion: hexStr := hex.EncodeToString(bz) From a930c65ef474b77358a69d4fa922a38ed8fcc698 Mon Sep 17 00:00:00 2001 From: forcodedancing Date: Sat, 7 Oct 2023 11:02:42 +0800 Subject: [PATCH 2/2] release: draft release for v1.0.0 (#39) --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e70d4d7b8..383848eb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # CHANGELOG +## v1.0.0 +This release includes 1 bugfix. + +Bugfixes: +* [#36](https://github.com/bnb-chain/greenfield-cometbft/pull/36) fix: trim the prefix 0 for eth_chainId + + ## v0.0.3 This release includes the features and bugfixes in the v0.0.3 alpha versions and 1 new bugfix.