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
aa69d361
Unverified
Commit
aa69d361
authored
Jun 16, 2021
by
Péter Szilágyi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core, graphql, internal: expose effectiveGasPrice in receipts
parent
7a7abe3d
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
42 additions
and
8 deletions
+42
-8
tx_pool.go
core/tx_pool.go
+1
-1
transaction.go
core/types/transaction.go
+2
-2
graphql.go
graphql/graphql.go
+15
-0
schema.go
graphql/schema.go
+7
-0
api.go
internal/ethapi/api.go
+11
-1
bindata.go
internal/jsre/deps/bindata.go
+3
-3
web3.js
internal/jsre/deps/web3.js
+3
-1
No files found.
core/tx_pool.go
View file @
aa69d361
...
...
@@ -512,7 +512,7 @@ func (pool *TxPool) Pending(enforceTips bool) (map[common.Address]types.Transact
// If the miner requests tip enforcement, cap the lists now
if
enforceTips
&&
!
pool
.
locals
.
contains
(
addr
)
{
for
i
,
tx
:=
range
txs
{
if
tx
.
EffectiveTipIntCmp
(
pool
.
gasPrice
,
pool
.
priced
.
urgent
.
baseFee
)
<
0
{
if
tx
.
Effective
Gas
TipIntCmp
(
pool
.
gasPrice
,
pool
.
priced
.
urgent
.
baseFee
)
<
0
{
txs
=
txs
[
:
i
]
break
}
...
...
core/types/transaction.go
View file @
aa69d361
...
...
@@ -356,8 +356,8 @@ func (tx *Transaction) EffectiveGasTipCmp(other *Transaction, baseFee *big.Int)
return
tx
.
EffectiveGasTipValue
(
baseFee
)
.
Cmp
(
other
.
EffectiveGasTipValue
(
baseFee
))
}
// EffectiveTipIntCmp compares the effective gasTipCap of a transaction to the given gasTipCap.
func
(
tx
*
Transaction
)
EffectiveTipIntCmp
(
other
*
big
.
Int
,
baseFee
*
big
.
Int
)
int
{
// Effective
Gas
TipIntCmp compares the effective gasTipCap of a transaction to the given gasTipCap.
func
(
tx
*
Transaction
)
Effective
Gas
TipIntCmp
(
other
*
big
.
Int
,
baseFee
*
big
.
Int
)
int
{
if
baseFee
==
nil
{
return
tx
.
GasTipCapIntCmp
(
other
)
}
...
...
graphql/graphql.go
View file @
aa69d361
...
...
@@ -236,6 +236,21 @@ func (t *Transaction) GasPrice(ctx context.Context) (hexutil.Big, error) {
}
}
func
(
t
*
Transaction
)
EffectiveGasPrice
(
ctx
context
.
Context
)
(
*
hexutil
.
Big
,
error
)
{
tx
,
err
:=
t
.
resolve
(
ctx
)
if
err
!=
nil
||
tx
==
nil
{
return
nil
,
err
}
header
,
err
:=
t
.
block
.
resolveHeader
(
ctx
)
if
err
!=
nil
||
header
==
nil
{
return
nil
,
err
}
if
header
.
BaseFee
==
nil
{
return
(
*
hexutil
.
Big
)(
tx
.
GasPrice
()),
nil
}
return
(
*
hexutil
.
Big
)(
math
.
BigMin
(
new
(
big
.
Int
)
.
Add
(
tx
.
GasTipCap
(),
header
.
BaseFee
),
tx
.
GasFeeCap
())),
nil
}
func
(
t
*
Transaction
)
MaxFeePerGas
(
ctx
context
.
Context
)
(
*
hexutil
.
Big
,
error
)
{
tx
,
err
:=
t
.
resolve
(
ctx
)
if
err
!=
nil
||
tx
==
nil
{
...
...
graphql/schema.go
View file @
aa69d361
...
...
@@ -118,6 +118,13 @@ const schema string = `
# this transaction. If the transaction has not yet been mined, this field
# will be null.
cumulativeGasUsed: Long
# EffectiveGasPrice is actual value per gas deducted from the sender's
# account. Before EIP-1559, this is equal to the transaction's gas price.
# After EIP-1559, it is baseFeePerGas + min(maxFeePerGas - baseFeePerGas,
# maxPriorityFeePerGas). Legacy transactions and EIP-2930 transactions are
# coerced into the EIP-1559 format by setting both maxFeePerGas and
# maxPriorityFeePerGas as the transaction's gas price.
effectiveGasPrice: BigInt
# CreatedContract is the account that was created by a contract creation
# transaction. If the transaction was not a contract creation transaction,
# or it has not yet been mined, this field will be null.
...
...
internal/ethapi/api.go
View file @
aa69d361
...
...
@@ -1561,7 +1561,17 @@ func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, ha
"logsBloom"
:
receipt
.
Bloom
,
"type"
:
hexutil
.
Uint
(
tx
.
Type
()),
}
// Assign the effective gas price paid
if
!
s
.
b
.
ChainConfig
()
.
IsLondon
(
bigblock
)
{
fields
[
"effectiveGasPrice"
]
=
hexutil
.
Uint64
(
tx
.
GasPrice
()
.
Uint64
())
}
else
{
header
,
err
:=
s
.
b
.
HeaderByHash
(
ctx
,
blockHash
)
if
err
!=
nil
{
return
nil
,
err
}
gasPrice
:=
new
(
big
.
Int
)
.
Add
(
header
.
BaseFee
,
tx
.
EffectiveGasTipValue
(
header
.
BaseFee
))
fields
[
"effectiveGasPrice"
]
=
hexutil
.
Uint64
(
gasPrice
.
Uint64
())
}
// Assign receipt status or post state.
if
len
(
receipt
.
PostState
)
>
0
{
fields
[
"root"
]
=
hexutil
.
Bytes
(
receipt
.
PostState
)
...
...
internal/jsre/deps/bindata.go
View file @
aa69d361
This diff is collapsed.
Click to expand it.
internal/jsre/deps/web3.js
View file @
aa69d361
...
...
@@ -3807,7 +3807,9 @@ var outputTransactionReceiptFormatter = function (receipt){
receipt.transactionIndex = utils.toDecimal(receipt.transactionIndex);
receipt.cumulativeGasUsed = utils.toDecimal(receipt.cumulativeGasUsed);
receipt.gasUsed = utils.toDecimal(receipt.gasUsed);
if(receipt.effectiveGasPrice !== undefined) {
receipt.effectiveGasPrice = utils.toBigNumber(receipt.effectiveGasPrice);
}
if(utils.isArray(receipt.logs)) {
receipt.logs = receipt.logs.map(function(log){
return outputLogFormatter(log);
...
...
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