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

release: prepare release for v1.1.0 #47

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
go.sum
- uses: golangci/golangci-lint-action@v3
with:
version: latest
version: v1.54.2
skip-pkg-cache: true
args: --timeout 10m
github-token: ${{ secrets.github_token }}
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# CHANGELOG

## v1.1.0
This release supports 6 new json rpc queries and also resolves a replay issue.

Features:
* [#42](https://github.com/bnb-chain/greenfield-cometbft/pull/42) feat: add support for some json rpc queries

Bugfixes:
* [#37](https://github.com/bnb-chain/greenfield-cometbft/pull/37) fix: replay issue with mock app


## v1.0.0
This release includes 1 bugfix.

Expand Down
5 changes: 5 additions & 0 deletions consensus/replay_stubs.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ func (mock *mockProxyApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeli
return *r
}

func (mock *mockProxyApp) BeginBlock(req abci.RequestBeginBlock) abci.ResponseBeginBlock {
mock.txCount = 0
return *mock.abciResponses.BeginBlock
}

func (mock *mockProxyApp) EndBlock(req abci.RequestEndBlock) abci.ResponseEndBlock {
mock.txCount = 0
return *mock.abciResponses.EndBlock
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -315,4 +315,5 @@ replace (
github.com/cometbft/cometbft-db => github.com/bnb-chain/greenfield-cometbft-db v0.8.1-alpha.1
// to be compatible with rocksdb v6.22.1
github.com/linxGnu/grocksdb => github.com/linxGnu/grocksdb v1.6.22
github.com/wercker/journalhook => github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117
)
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ github.com/wealdtech/go-eth2-types/v2 v2.5.2/go.mod h1:8lkNUbgklSQ4LZ2oMSuxSdR7W
github.com/wealdtech/go-eth2-util v1.6.3/go.mod h1:0hFMj/qtio288oZFHmAbCnPQ9OB3c4WFzs5NVPKTY4k=
github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4 v1.1.3/go.mod h1:qiIimacW5NhVRy8o+YxWo9YrecXqDAKKbL0+sOa0SJ4=
github.com/wealdtech/go-eth2-wallet-types/v2 v2.8.2/go.mod h1:k6kmiKWSWBTd4OxFifTEkPaBLhZspnO2KFD5XJY9nqg=
github.com/wercker/journalhook v0.0.0-20180428041537-5d0a5ae867b3/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg=
github.com/wercker/journalhook v0.0.0-20230927020745-64542ffa4117/go.mod h1:XCsSkdKK4gwBMNrOCZWww0pX6AOt+2gYc5Z6jBRrNVg=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4=
Expand Down
36 changes: 29 additions & 7 deletions rpc/jsonrpc/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ import (

// Supported EVM json-rpc requests
const (
EthBlockNumber = "eth_blockNumber"
EthGetBlockByNumber = "eth_getBlockByNumber"
EthGetBalance = "eth_getBalance"
EthChainID = "eth_chainId"
NetVersion = "net_version"
EthNetworkID = "eth_networkId"
EthBlockNumber = "eth_blockNumber"
EthGetBlockByNumber = "eth_getBlockByNumber"
EthGetBalance = "eth_getBalance"
EthChainID = "eth_chainId"
NetVersion = "net_version"
EthNetworkID = "eth_networkId"
EthGetCode = "eth_getCode"
EthGasPrice = "eth_gasPrice"
EthEstimateGas = "eth_estimateGas"
EthCall = "eth_call"
EthGetTransactionCount = "eth_getTransactionCount"
EthSendRawTransaction = "eth_sendRawTransaction"
)

var SupportedEthQueryRequests = []string{
Expand All @@ -35,6 +41,12 @@ var SupportedEthQueryRequests = []string{
EthChainID,
NetVersion,
EthNetworkID,
EthGetCode,
EthGasPrice,
EthEstimateGas,
EthCall,
EthGetTransactionCount,
EthSendRawTransaction,
}

// a wrapper to emulate a sum type: jsonrpcid = string | int
Expand Down Expand Up @@ -269,7 +281,17 @@ func NewEthRPCSuccessResponse(id jsonrpcid, res interface{}, method string) RPCR
if err != nil {
return RPCInternalError(id, fmt.Errorf("error decode response: %w", err))
}
// return int string for net_version
// return hex string for EthGasPrice, EthCall, EthGetCode, EthGetTransactionCount, EthEstimateGas
case EthGasPrice, EthCall, EthGetCode, EthGetTransactionCount, EthEstimateGas:
// metamask do not support the Hex signed 2's complement, need to trim the prefix `0`
resultStr := strings.TrimLeft(hex.EncodeToString(bz), "0")
result, err = json.Marshal("0x" + resultStr)
if err != nil {
return RPCInternalError(id, fmt.Errorf("error decode response: %w", err))
}
case EthSendRawTransaction:
return RPCInvalidRequestError(id, fmt.Errorf("transfer BNB through EVM wallet on Greenfield is not available yet, please go to decellar.io or refer to latest docs"))
//return int string for net_version
case NetVersion:
hexStr := hex.EncodeToString(bz)
netVersion, err := strconv.ParseInt(hexStr, 16, 64)
Expand Down
Loading