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

fix: field chainId should be acceptable for eth_estimateGas #1601

Merged
merged 1 commit into from
Nov 28, 2023
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
2 changes: 2 additions & 0 deletions core/api/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2273,6 +2273,8 @@ The Web3CallRequest objects.

* `access_list`: `Array<` [`AccessList`](#type-AccessList)`>` - The accessList specifies a list of addresses and storage keys; these addresses and storage keys are added into the accessed_addresses and accessed_storage_keys global sets.

* `chain_id`: [`U64`](#type-U64) - QUANTITY - The id of the chain.

* `max_priority_fee_per_gas`: [`U256`](#type-U256) - QUANTITY - (optional) determined by the user, and is paid directly to miners.

### Type `AccessList`
Expand Down
8 changes: 6 additions & 2 deletions core/api/src/jsonrpc/impl/web3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use protocol::traits::{APIAdapter, Context};
use protocol::types::{
Block, BlockNumber, Bytes, EthAccountProof, Hash, Header, Hex, Proposal, Receipt,
SignedTransaction, TxResp, UnverifiedTransaction, BASE_FEE_PER_GAS, H160, H256,
MAX_FEE_HISTORY, MAX_RPC_GAS_CAP, MIN_TRANSACTION_GAS_LIMIT, U256,
MAX_FEE_HISTORY, MAX_RPC_GAS_CAP, MIN_TRANSACTION_GAS_LIMIT, U256, U64,
};
use protocol::{
async_trait, codec::ProtocolCodec, lazy::PROTOCOL_VERSION, tokio::time::sleep, ProtocolResult,
Expand Down Expand Up @@ -1093,7 +1093,11 @@ fn mock_header_by_call_req(latest_header: Header, call_req: &Web3CallRequest) ->
},
proof: latest_header.proof,
call_system_script_count: 0,
chain_id: latest_header.chain_id,
chain_id: call_req
.chain_id
.as_ref()
.map(U64::low_u64)
.unwrap_or(latest_header.chain_id),
}
}

Expand Down
1 change: 1 addition & 0 deletions core/api/src/jsonrpc/web3_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ pub struct Web3CallRequest {
pub nonce: Option<U256>,
#[serde(skip_serializing_if = "Option::is_none")]
pub access_list: Option<AccessList>,
pub chain_id: Option<U64>,
#[serde(skip_serializing_if = "Option::is_none")]
pub max_priority_fee_per_gas: Option<U256>,
}
Expand Down
Loading