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

add params to estimateGas api #3305

Merged
merged 1 commit into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 2 additions & 2 deletions app/rpc/namespaces/eth/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -1122,7 +1122,7 @@ func (api *PublicEthereumAPI) simDoCall(args rpctypes.CallArgs, cap uint64) (uin
}

// EstimateGas returns an estimate of gas usage for the given smart contract call.
func (api *PublicEthereumAPI) EstimateGas(args rpctypes.CallArgs) (hexutil.Uint64, error) {
func (api *PublicEthereumAPI) EstimateGas(args rpctypes.CallArgs, blockNrOrHash rpctypes.BlockNumberOrHash) (hexutil.Uint64, error) {
monitor := monitor.GetMonitor("eth_estimateGas", api.logger, api.Metrics).OnBegin()
defer monitor.OnEnd("args", args)
rateLimiter := api.GetRateLimiter("eth_estimateGas")
Expand Down Expand Up @@ -1673,7 +1673,7 @@ func (api *PublicEthereumAPI) generateFromArgs(args rpctypes.SendTxArgs) (*evmty
Value: args.Value,
Data: &input,
}
gl, err := api.EstimateGas(callArgs)
gl, err := api.EstimateGas(callArgs, rpctypes.BlockNumberOrHash{})
if err != nil {
return nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions app/rpc/tests/rpc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -913,7 +913,7 @@ func (suite *RPCTestSuite) TestEth_EstimateGas_WithoutArgs() {
}

func (suite *RPCTestSuite) TestEth_EstimateGas_Transfer() {
param := make([]map[string]string, 1)
param := make([]map[string]string, 2)
param[0] = make(map[string]string)
param[0]["from"] = senderAddr.Hex()
param[0]["to"] = "0x1122334455667788990011223344556677889900"
Expand All @@ -933,7 +933,7 @@ func (suite *RPCTestSuite) TestEth_EstimateGas_Transfer() {
func (suite *RPCTestSuite) TestEth_EstimateGas_ContractDeployment() {
bytecode := "0x608060405234801561001057600080fd5b5060117f775a94827b8fd9b519d36cd827093c664f93347070a554f65e4a6f56cd73889860405160405180910390a260d08061004d6000396000f3fe6080604052348015600f57600080fd5b506004361060285760003560e01c8063eb8ac92114602d575b600080fd5b606060048036036040811015604157600080fd5b8101908080359060200190929190803590602001909291905050506062565b005b8160008190555080827ff3ca124a697ba07e8c5e80bebcfcc48991fc16a63170e8a9206e30508960d00360405160405180910390a3505056fea265627a7a723158201d94d2187aaf3a6790527b615fcc40970febf0385fa6d72a2344848ebd0df3e964736f6c63430005110032"

param := make([]map[string]string, 1)
param := make([]map[string]string, 1, 2)
param[0] = make(map[string]string)
param[0]["from"] = senderAddr.Hex()
param[0]["data"] = bytecode
Expand Down