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 feeHistory spec #212

Merged
merged 1 commit into from
Jun 16, 2021
Merged
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
111 changes: 102 additions & 9 deletions json-rpc/spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,96 @@
"$ref": "#/components/contentDescriptors/GasPrice"
}
},
{
"name": "eth_feeHistory",
"summary": "Transaction fee history",
"description": "Returns base fee per gas and transaction effective priority fee per gas history for the requested block range if available. The range between headBlock-4 and headBlock is guaranteed to be available while retrieving data from the pending block and older history are optional to support. For pre-EIP-1559 blocks the gas prices are returned as rewards and zeroes are returned for the base fee per gas.",
"params": [
{
"name": "blockCount",
"description": "Number of blocks in the requested range. Between 1 and 1024 blocks can be requested in a single query. Less than requested may be returned if not all blocks are available.",
"required": true,
"schema": {
"$ref": "#/components/schemas/Integer"
Copy link
Member

Choose a reason for hiding this comment

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

This should be an integer between 1 and 1024. IMO anything we can encode in the schema, we should.

Copy link
Member

Choose a reason for hiding this comment

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

On second thought, I suppose the description is good enough for now. Eventually we'll should encode in the schema though.

}
},
{
"name": "newestBlock",
"description": "Highest number block of the requested range.",
"required": true,
"schema": {
"$ref": "#/components/schemas/BlockNumberOrTag"
}
},
{
"name": "rewardPercentiles",
"description": "A monotonically increasing list of percentile values to sample from each block's effective priority fees per gas in ascending order, weighted by gas used.",
"schema": {
"title": "rewardPercentiles",
"type": "array",
"items": {
"title": "rewardPercentile",
"description": "Floating point value between 0 and 100.",
"type": "number"
}
}
}
],
"result": {
"name": "feeHistoryResult",
"description": "Fee history for the returned block range. This can be a subsection of the requested range if not all blocks are available.",
"schema": {
"title": "feeHistoryResults",
"description": "Fee history results",
"type": "object",
"required": [
"firstBlock",
"baseFeePerGas",
"gasUsedRatio"
],
"properties": {
"oldestBlock": {
"title": "oldestBlock",
"description": "Lowest number block of the returned range.",
"$ref": "#/components/schemas/BlockNumber"
},
"baseFeePerGas": {
"title": "baseFeePerGasArray",
"description": "An array of block base fees per gas. This includes the next block after the newest of the returned range, because this value can be derived from the newest block. Zeroes are returned for pre-EIP-1559 blocks.",
"type": "array",
"items": {
"$ref": "#/components/schemas/Integer"
}
},
"gasUsedRatio": {
"title": "gasUsedArray",
"description": "An array of block gas used ratios. These are calculated as the ratio of gasUsed and gasLimit.",
"type": "array",
"items": {
"title": "gasUsedRatio",
"description": "Floating point value between 0 and 1.",
"type": "number"
}
},
"reward": {
"title": "rewardArray",
"description": "A two-dimensional array of effective priority fees per gas at the requested block percentiles.",
"type": "array",
"items": {
"title": "rewardPercentileArray",
"description": "An array of effective priority fee per gas data points from a single block. All zeroes are returned if the block is empty.",
"type": "array",
"items": {
"title": "rewardPercentile",
"description": "A given percentile sample of effective priority fees per gas from a single block in ascending order, weighted by gas used. Zeroes are returned if the block is empty.",
"$ref": "#/components/schemas/Integer"
}
}
}
}
}
}
},
{
"name": "eth_getBalance",
"summary": "Returns Ether balance of a given or account or contract",
Expand Down Expand Up @@ -1135,6 +1225,17 @@
"pending"
]
},
"BlockNumberOrTag": {
Copy link
Member

Choose a reason for hiding this comment

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

Did you just pull this out to be more explicit?

"title": "blockNumberOrTag",
"oneOf": [
{
"$ref": "#/components/schemas/BlockNumber"
},
{
"$ref": "#/components/schemas/BlockNumberTag"
}
]
},
"BlockOrNull": {
"title": "blockOrNull",
"oneOf": [
Expand Down Expand Up @@ -1881,15 +1982,7 @@
"name": "blockNumber",
"required": true,
"schema": {
"title": "blockNumberOrTag",
"oneOf": [
{
"$ref": "#/components/schemas/BlockNumber"
},
{
"$ref": "#/components/schemas/BlockNumberTag"
}
]
"$ref": "#/components/schemas/BlockNumberOrTag"
}
},
"TransactionHash": {
Expand Down