Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
plugin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
link33
plugin
Commits
614c36d2
Commit
614c36d2
authored
Sep 07, 2021
by
hezhengjun
Committed by
33cn
Sep 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set gaslimit to tx fee after message is created
parent
003c1b1c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
exec.go
plugin/dapp/evm/executor/exec.go
+3
-3
No files found.
plugin/dapp/evm/executor/exec.go
View file @
614c36d2
...
...
@@ -30,12 +30,12 @@ func (evm *EVMExecutor) Exec(tx *types.Transaction, index int) (*types.Receipt,
return
nil
,
err
}
return
evm
.
innerExec
(
msg
,
tx
.
Hash
(),
index
,
evm
.
GetTxFee
(
tx
,
index
),
false
)
return
evm
.
innerExec
(
msg
,
tx
.
Hash
(),
index
,
msg
.
GasLimit
(
),
false
)
}
// 通用的EVM合约执行逻辑封装
// readOnly 是否只读调用,仅执行evm abi查询时为true
func
(
evm
*
EVMExecutor
)
innerExec
(
msg
*
common
.
Message
,
txHash
[]
byte
,
index
int
,
txFee
int64
,
readOnly
bool
)
(
receipt
*
types
.
Receipt
,
err
error
)
{
func
(
evm
*
EVMExecutor
)
innerExec
(
msg
*
common
.
Message
,
txHash
[]
byte
,
index
int
,
txFee
u
int64
,
readOnly
bool
)
(
receipt
*
types
.
Receipt
,
err
error
)
{
// 获取当前区块的上下文信息构造EVM上下文
context
:=
evm
.
NewEVMContext
(
msg
,
txHash
)
cfg
:=
evm
.
GetAPI
()
.
GetConfig
()
...
...
@@ -115,7 +115,7 @@ func (evm *EVMExecutor) innerExec(msg *common.Message, txHash []byte, index int,
// 计算消耗了多少费用(实际消耗的费用)
usedFee
,
overflow
:=
common
.
SafeMul
(
usedGas
,
uint64
(
msg
.
GasPrice
()))
// 费用消耗溢出,执行失败
if
overflow
||
usedFee
>
uint64
(
txFee
)
{
if
overflow
||
usedFee
>
txFee
{
// 如果操作没有回滚,则在这里处理
if
curVer
!=
nil
&&
snapshot
>=
curVer
.
GetID
()
&&
curVer
.
GetID
()
>
-
1
{
evm
.
mStateDB
.
RevertToSnapshot
(
snapshot
)
...
...
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