mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-15 08:23:46 +00:00
Merge pull request #12 from DeBankDeFi/fake-msg
预执行交易不执行 pre check part one 并且 绕过以太坊基础费检查
This commit is contained in:
commit
8757cd15d7
4 changed files with 5 additions and 2 deletions
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
|
|
@ -35,4 +35,4 @@ jobs:
|
||||||
version: v1.42.1
|
version: v1.42.1
|
||||||
only-new-issues: true
|
only-new-issues: true
|
||||||
skip-pkg-cache: true
|
skip-pkg-cache: true
|
||||||
skip-build-cache: true:w
|
skip-build-cache: true
|
||||||
|
|
@ -154,6 +154,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
|
||||||
|
|
||||||
func ApplyTransactionForPreExec(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, msg types.Message, usedGas *uint64, cfg vm.Config) (*types.Receipt, error) {
|
func ApplyTransactionForPreExec(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, msg types.Message, usedGas *uint64, cfg vm.Config) (*types.Receipt, error) {
|
||||||
blockContext := NewEVMBlockContext(header, bc, author)
|
blockContext := NewEVMBlockContext(header, bc, author)
|
||||||
|
blockContext.BaseFee = big.NewInt(0)
|
||||||
vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, config, cfg)
|
vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, config, cfg)
|
||||||
return applyTransaction(msg, config, bc, author, gp, statedb, header.Number, header.Hash(), tx, usedGas, vmenv)
|
return applyTransaction(msg, config, bc, author, gp, statedb, header.Number, header.Hash(), tx, usedGas, vmenv)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ func (api *PreExecAPI) getBlockAndMsg(origin *PreExecTx, number *big.Int) (*type
|
||||||
tx.GasFeeCap(),
|
tx.GasFeeCap(),
|
||||||
tx.GasTipCap(),
|
tx.GasTipCap(),
|
||||||
hexutil.MustDecode(origin.Data),
|
hexutil.MustDecode(origin.Data),
|
||||||
nil, false,
|
nil, true,
|
||||||
)
|
)
|
||||||
|
|
||||||
return block, msg
|
return block, msg
|
||||||
|
|
@ -188,6 +188,7 @@ func (api *PreExecAPI) TraceTransaction(ctx context.Context, origin *PreExecTx,
|
||||||
}
|
}
|
||||||
// Run the transaction with tracing enabled.
|
// Run the transaction with tracing enabled.
|
||||||
vmenv := vm.NewEVM(core.NewEVMBlockContext(d.header, bc, nil), txContext, d.stateDb, bc.Config(), vm.Config{Debug: true, Tracer: tracer})
|
vmenv := vm.NewEVM(core.NewEVMBlockContext(d.header, bc, nil), txContext, d.stateDb, bc.Config(), vm.Config{Debug: true, Tracer: tracer})
|
||||||
|
vmenv.Context.BaseFee = big.NewInt(0)
|
||||||
|
|
||||||
// Call Prepare to clear out the statedb access list
|
// Call Prepare to clear out the statedb access list
|
||||||
d.stateDb.Prepare(d.tx.Hash(), txIndex)
|
d.stateDb.Prepare(d.tx.Hash(), txIndex)
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ func LocalEnv() Environment {
|
||||||
commitRe, _ := regexp.Compile("^([0-9a-f]{40})$")
|
commitRe, _ := regexp.Compile("^([0-9a-f]{40})$")
|
||||||
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
|
if commit := commitRe.FindString(head); commit != "" && env.Commit == "" {
|
||||||
env.Commit = commit
|
env.Commit = commit
|
||||||
|
env.Date = getDate(commit)
|
||||||
}
|
}
|
||||||
return env
|
return env
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue