mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-20 09:21:11 +00:00
Remove unnecessary value transfer check from TransitionDb (#2424)
This commit is contained in:
parent
054581f507
commit
db86092ccd
@ -65,10 +65,6 @@ var (
|
|||||||
// by a transaction is higher than what's left in the block.
|
// by a transaction is higher than what's left in the block.
|
||||||
ErrGasLimitReached = errors.New("gas limit reached")
|
ErrGasLimitReached = errors.New("gas limit reached")
|
||||||
|
|
||||||
// ErrInsufficientFundsForTransfer is returned if the transaction sender doesn't
|
|
||||||
// have enough funds for transfer(topmost call only).
|
|
||||||
ErrInsufficientFundsForTransfer = errors.New("insufficient funds for transfer")
|
|
||||||
|
|
||||||
// ErrInsufficientFunds is returned if the total cost of executing a transaction
|
// ErrInsufficientFunds is returned if the total cost of executing a transaction
|
||||||
// is higher than the balance of the user's account.
|
// is higher than the balance of the user's account.
|
||||||
ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value")
|
ErrInsufficientFunds = errors.New("insufficient funds for gas * price + value")
|
||||||
|
@ -287,7 +287,7 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*Executi
|
|||||||
// 5. there is no overflow when calculating intrinsic gas
|
// 5. there is no overflow when calculating intrinsic gas
|
||||||
// 6. caller has enough balance to cover asset transfer for **topmost** call
|
// 6. caller has enough balance to cover asset transfer for **topmost** call
|
||||||
|
|
||||||
// Check clauses 1-3, buy gas if everything is correct
|
// Check clauses 1-3 and 6, buy gas if everything is correct
|
||||||
if err := st.preCheck(gasBailout); err != nil {
|
if err := st.preCheck(gasBailout); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -308,15 +308,6 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*Executi
|
|||||||
}
|
}
|
||||||
st.gas -= gas
|
st.gas -= gas
|
||||||
|
|
||||||
// Check clause 6
|
|
||||||
var bailout bool
|
|
||||||
if !msg.Value().IsZero() && !st.evm.Context.CanTransfer(st.state, msg.From(), msg.Value()) {
|
|
||||||
if gasBailout {
|
|
||||||
bailout = true
|
|
||||||
} else {
|
|
||||||
return nil, fmt.Errorf("%w: address %v", ErrInsufficientFundsForTransfer, msg.From().Hex())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Set up the initial access list.
|
// Set up the initial access list.
|
||||||
if st.evm.ChainRules.IsBerlin {
|
if st.evm.ChainRules.IsBerlin {
|
||||||
st.state.PrepareAccessList(msg.From(), msg.To(), st.evm.ActivePrecompiles(), msg.AccessList())
|
st.state.PrepareAccessList(msg.From(), msg.To(), st.evm.ActivePrecompiles(), msg.AccessList())
|
||||||
@ -335,7 +326,7 @@ func (st *StateTransition) TransitionDb(refunds bool, gasBailout bool) (*Executi
|
|||||||
} else {
|
} else {
|
||||||
// Increment the nonce for the next transaction
|
// Increment the nonce for the next transaction
|
||||||
st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1)
|
st.state.SetNonce(msg.From(), st.state.GetNonce(sender.Address())+1)
|
||||||
ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value, bailout)
|
ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value, gasBailout)
|
||||||
}
|
}
|
||||||
if refunds {
|
if refunds {
|
||||||
if london {
|
if london {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user