-
Notifications
You must be signed in to change notification settings - Fork 21.9k
core, all: split vm.Context into BlockContext and TxContext #21672
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -230,8 +230,8 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { | |
| } | ||
| msg := st.msg | ||
| sender := vm.AccountRef(msg.From()) | ||
| homestead := st.evm.ChainConfig().IsHomestead(st.evm.BlockNumber) | ||
| istanbul := st.evm.ChainConfig().IsIstanbul(st.evm.BlockNumber) | ||
| homestead := st.evm.ChainConfig().IsHomestead(st.evm.Context.BlockNumber) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The PR contains a lot of these changes -- might be better to leave it as is, to make the change smaller?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Edit: ignore that. You made the Context explicit now, so the change is needed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps a follow-up PR can do some changes that cleans up some names, e.g. changing |
||
| istanbul := st.evm.ChainConfig().IsIstanbul(st.evm.Context.BlockNumber) | ||
| contractCreation := msg.To() == nil | ||
|
|
||
| // Check clauses 4-5, subtract intrinsic gas if everything is correct | ||
|
|
@@ -245,7 +245,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { | |
| st.gas -= gas | ||
|
|
||
| // Check clause 6 | ||
| if msg.Value().Sign() > 0 && !st.evm.CanTransfer(st.state, msg.From(), msg.Value()) { | ||
| if msg.Value().Sign() > 0 && !st.evm.Context.CanTransfer(st.state, msg.From(), msg.Value()) { | ||
| return nil, ErrInsufficientFundsForTransfer | ||
| } | ||
| var ( | ||
|
|
@@ -260,7 +260,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) { | |
| ret, st.gas, vmerr = st.evm.Call(sender, st.to(), st.data, st.gas, st.value) | ||
| } | ||
| st.refundGas() | ||
| st.state.AddBalance(st.evm.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.gasPrice)) | ||
| st.state.AddBalance(st.evm.Context.Coinbase, new(big.Int).Mul(new(big.Int).SetUint64(st.gasUsed()), st.gasPrice)) | ||
|
|
||
| return &ExecutionResult{ | ||
| UsedGas: st.gasUsed(), | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.