Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
b1acaf47
Unverified
Commit
b1acaf47
authored
2 years ago
by
aaronbuchwald
Committed by
GitHub
2 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth/gasprice: change feehistory input type from int to uint64 (#26922)
Change input param type from int to uint64
parent
f6c3a534
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
17 additions
and
17 deletions
+17
-17
api_backend.go
eth/api_backend.go
+1
-1
feehistory.go
eth/gasprice/feehistory.go
+7
-7
feehistory_test.go
eth/gasprice/feehistory_test.go
+2
-2
gasprice.go
eth/gasprice/gasprice.go
+3
-3
api.go
internal/ethapi/api.go
+1
-1
backend.go
internal/ethapi/backend.go
+1
-1
transaction_args_test.go
internal/ethapi/transaction_args_test.go
+1
-1
api_backend.go
les/api_backend.go
+1
-1
No files found.
eth/api_backend.go
View file @
b1acaf47
...
...
@@ -327,7 +327,7 @@ func (b *EthAPIBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
return
b
.
gpo
.
SuggestTipCap
(
ctx
)
}
func
(
b
*
EthAPIBackend
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
int
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
firstBlock
*
big
.
Int
,
reward
[][]
*
big
.
Int
,
baseFee
[]
*
big
.
Int
,
gasUsedRatio
[]
float64
,
err
error
)
{
func
(
b
*
EthAPIBackend
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
uint64
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
firstBlock
*
big
.
Int
,
reward
[][]
*
big
.
Int
,
baseFee
[]
*
big
.
Int
,
gasUsedRatio
[]
float64
,
err
error
)
{
return
b
.
gpo
.
FeeHistory
(
ctx
,
blockCount
,
lastBlock
,
rewardPercentiles
)
}
...
...
This diff is collapsed.
Click to expand it.
eth/gasprice/feehistory.go
View file @
b1acaf47
...
...
@@ -142,7 +142,7 @@ func (oracle *Oracle) processBlock(bf *blockFees, percentiles []float64) {
// also returned if requested and available.
// Note: an error is only returned if retrieving the head header has failed. If there are no
// retrievable blocks in the specified range then zero block count is returned with no error.
func
(
oracle
*
Oracle
)
resolveBlockRange
(
ctx
context
.
Context
,
reqEnd
rpc
.
BlockNumber
,
blocks
int
)
(
*
types
.
Block
,
[]
*
types
.
Receipt
,
uint64
,
int
,
error
)
{
func
(
oracle
*
Oracle
)
resolveBlockRange
(
ctx
context
.
Context
,
reqEnd
rpc
.
BlockNumber
,
blocks
uint64
)
(
*
types
.
Block
,
[]
*
types
.
Receipt
,
uint64
,
uint64
,
error
)
{
var
(
headBlock
*
types
.
Header
pendingBlock
*
types
.
Block
...
...
@@ -200,8 +200,8 @@ func (oracle *Oracle) resolveBlockRange(ctx context.Context, reqEnd rpc.BlockNum
return
nil
,
nil
,
0
,
0
,
nil
}
// Ensure not trying to retrieve before genesis.
if
int
(
reqEnd
+
1
)
<
blocks
{
blocks
=
int
(
reqEnd
+
1
)
if
uint64
(
reqEnd
+
1
)
<
blocks
{
blocks
=
uint64
(
reqEnd
+
1
)
}
return
pendingBlock
,
pendingReceipts
,
uint64
(
reqEnd
),
blocks
,
nil
}
...
...
@@ -220,7 +220,7 @@ func (oracle *Oracle) resolveBlockRange(ctx context.Context, reqEnd rpc.BlockNum
//
// Note: baseFee includes the next block after the newest of the returned range, because this
// value can be derived from the newest block.
func
(
oracle
*
Oracle
)
FeeHistory
(
ctx
context
.
Context
,
blocks
int
,
unresolvedLastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
*
big
.
Int
,
[][]
*
big
.
Int
,
[]
*
big
.
Int
,
[]
float64
,
error
)
{
func
(
oracle
*
Oracle
)
FeeHistory
(
ctx
context
.
Context
,
blocks
uint64
,
unresolvedLastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
*
big
.
Int
,
[][]
*
big
.
Int
,
[]
*
big
.
Int
,
[]
float64
,
error
)
{
if
blocks
<
1
{
return
common
.
Big0
,
nil
,
nil
,
nil
,
nil
// returning with no data and no error means there are no retrievable blocks
}
...
...
@@ -249,7 +249,7 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLast
if
err
!=
nil
||
blocks
==
0
{
return
common
.
Big0
,
nil
,
nil
,
nil
,
err
}
oldestBlock
:=
lastBlock
+
1
-
uint64
(
blocks
)
oldestBlock
:=
lastBlock
+
1
-
blocks
var
(
next
=
oldestBlock
...
...
@@ -259,7 +259,7 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLast
for
i
,
p
:=
range
rewardPercentiles
{
binary
.
LittleEndian
.
PutUint64
(
percentileKey
[
i
*
8
:
(
i
+
1
)
*
8
],
math
.
Float64bits
(
p
))
}
for
i
:=
0
;
i
<
maxBlockFetchers
&&
i
<
blocks
;
i
++
{
for
i
:=
0
;
i
<
maxBlockFetchers
&&
i
<
int
(
blocks
)
;
i
++
{
go
func
()
{
for
{
// Retrieve the next block number to fetch with this goroutine
...
...
@@ -314,7 +314,7 @@ func (oracle *Oracle) FeeHistory(ctx context.Context, blocks int, unresolvedLast
if
fees
.
err
!=
nil
{
return
common
.
Big0
,
nil
,
nil
,
nil
,
fees
.
err
}
i
:=
int
(
fees
.
blockNumber
-
oldestBlock
)
i
:=
fees
.
blockNumber
-
oldestBlock
if
fees
.
results
.
baseFee
!=
nil
{
reward
[
i
],
baseFee
[
i
],
baseFee
[
i
+
1
],
gasUsedRatio
[
i
]
=
fees
.
results
.
reward
,
fees
.
results
.
baseFee
,
fees
.
results
.
nextBaseFee
,
fees
.
results
.
gasUsedRatio
}
else
{
...
...
This diff is collapsed.
Click to expand it.
eth/gasprice/feehistory_test.go
View file @
b1acaf47
...
...
@@ -28,8 +28,8 @@ import (
func
TestFeeHistory
(
t
*
testing
.
T
)
{
var
cases
=
[]
struct
{
pending
bool
maxHeader
,
maxBlock
int
count
int
maxHeader
,
maxBlock
uint64
count
uint64
last
rpc
.
BlockNumber
percent
[]
float64
expFirst
uint64
...
...
This diff is collapsed.
Click to expand it.
eth/gasprice/gasprice.go
View file @
b1acaf47
...
...
@@ -42,8 +42,8 @@ var (
type
Config
struct
{
Blocks
int
Percentile
int
MaxHeaderHistory
int
MaxBlockHistory
int
MaxHeaderHistory
uint64
MaxBlockHistory
uint64
Default
*
big
.
Int
`toml:",omitempty"`
MaxPrice
*
big
.
Int
`toml:",omitempty"`
IgnorePrice
*
big
.
Int
`toml:",omitempty"`
...
...
@@ -71,7 +71,7 @@ type Oracle struct {
fetchLock
sync
.
Mutex
checkBlocks
,
percentile
int
maxHeaderHistory
,
maxBlockHistory
int
maxHeaderHistory
,
maxBlockHistory
uint64
historyCache
*
lru
.
Cache
[
cacheKey
,
processedFees
]
}
...
...
This diff is collapsed.
Click to expand it.
internal/ethapi/api.go
View file @
b1acaf47
...
...
@@ -89,7 +89,7 @@ type feeHistoryResult struct {
// FeeHistory returns the fee market history.
func
(
s
*
EthereumAPI
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
math
.
HexOrDecimal64
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
*
feeHistoryResult
,
error
)
{
oldest
,
reward
,
baseFee
,
gasUsed
,
err
:=
s
.
b
.
FeeHistory
(
ctx
,
int
(
blockCount
),
lastBlock
,
rewardPercentiles
)
oldest
,
reward
,
baseFee
,
gasUsed
,
err
:=
s
.
b
.
FeeHistory
(
ctx
,
uint64
(
blockCount
),
lastBlock
,
rewardPercentiles
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
This diff is collapsed.
Click to expand it.
internal/ethapi/backend.go
View file @
b1acaf47
...
...
@@ -44,7 +44,7 @@ type Backend interface {
SyncProgress
()
ethereum
.
SyncProgress
SuggestGasTipCap
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
int
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
*
big
.
Int
,
[][]
*
big
.
Int
,
[]
*
big
.
Int
,
[]
float64
,
error
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
uint64
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
*
big
.
Int
,
[][]
*
big
.
Int
,
[]
*
big
.
Int
,
[]
float64
,
error
)
ChainDb
()
ethdb
.
Database
AccountManager
()
*
accounts
.
Manager
ExtRPCEnabled
()
bool
...
...
This diff is collapsed.
Click to expand it.
internal/ethapi/transaction_args_test.go
View file @
b1acaf47
...
...
@@ -258,7 +258,7 @@ func (b *backendMock) ChainConfig() *params.ChainConfig { return b.config }
// Other methods needed to implement Backend interface.
func
(
b
*
backendMock
)
SyncProgress
()
ethereum
.
SyncProgress
{
return
ethereum
.
SyncProgress
{}
}
func
(
b
*
backendMock
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
int
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
*
big
.
Int
,
[][]
*
big
.
Int
,
[]
*
big
.
Int
,
[]
float64
,
error
)
{
func
(
b
*
backendMock
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
uint64
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
*
big
.
Int
,
[][]
*
big
.
Int
,
[]
*
big
.
Int
,
[]
float64
,
error
)
{
return
nil
,
nil
,
nil
,
nil
,
nil
}
func
(
b
*
backendMock
)
ChainDb
()
ethdb
.
Database
{
return
nil
}
...
...
This diff is collapsed.
Click to expand it.
les/api_backend.go
View file @
b1acaf47
...
...
@@ -272,7 +272,7 @@ func (b *LesApiBackend) SuggestGasTipCap(ctx context.Context) (*big.Int, error)
return
b
.
gpo
.
SuggestTipCap
(
ctx
)
}
func
(
b
*
LesApiBackend
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
int
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
firstBlock
*
big
.
Int
,
reward
[][]
*
big
.
Int
,
baseFee
[]
*
big
.
Int
,
gasUsedRatio
[]
float64
,
err
error
)
{
func
(
b
*
LesApiBackend
)
FeeHistory
(
ctx
context
.
Context
,
blockCount
uint64
,
lastBlock
rpc
.
BlockNumber
,
rewardPercentiles
[]
float64
)
(
firstBlock
*
big
.
Int
,
reward
[][]
*
big
.
Int
,
baseFee
[]
*
big
.
Int
,
gasUsedRatio
[]
float64
,
err
error
)
{
return
b
.
gpo
.
FeeHistory
(
ctx
,
blockCount
,
lastBlock
,
rewardPercentiles
)
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment