Skip to content

Commit 21ce7ac

Browse files
committed
1.11.5 rebase
1 parent ac0325f commit 21ce7ac

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

.github/workflows/go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up Go 1.x
1616
uses: actions/setup-go@v2
1717
with:
18-
go-version: ^1.13
18+
go-version: ^1.19
1919
id: go
2020

2121
- name: Check out code into the Go module directory

core/state_processor.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func applyTransaction(msg *Message, config *params.ChainConfig, gp *GasPool, sta
142142
return receipt, err
143143
}
144144

145-
func applyTransactionWithResult(msg types.Message, config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, evm *vm.EVM) (*types.Receipt, *ExecutionResult, error) {
145+
func applyTransactionWithResult(msg *Message, config *params.ChainConfig, gp *GasPool, statedb *state.StateDB, blockNumber *big.Int, blockHash common.Hash, tx *types.Transaction, usedGas *uint64, evm *vm.EVM) (*types.Receipt, *ExecutionResult, error) {
146146
// Create a new context to be used in the EVM environment.
147147
txContext := NewEVMTxContext(msg)
148148
evm.Reset(txContext, statedb)
@@ -155,10 +155,10 @@ func applyTransactionWithResult(msg types.Message, config *params.ChainConfig, b
155155

156156
// Update the state with pending changes.
157157
var root []byte
158-
if config.IsByzantium(header.Number) {
158+
if config.IsByzantium(blockNumber) {
159159
statedb.Finalise(true)
160160
} else {
161-
root = statedb.IntermediateRoot(config.IsEIP158(header.Number)).Bytes()
161+
root = statedb.IntermediateRoot(config.IsEIP158(blockNumber)).Bytes()
162162
}
163163
*usedGas += result.UsedGas
164164

@@ -174,15 +174,15 @@ func applyTransactionWithResult(msg types.Message, config *params.ChainConfig, b
174174
receipt.GasUsed = result.UsedGas
175175

176176
// If the transaction created a contract, store the creation address in the receipt.
177-
if msg.To() == nil {
177+
if msg.To == nil {
178178
receipt.ContractAddress = crypto.CreateAddress(evm.TxContext.Origin, tx.Nonce())
179179
}
180180

181181
// Set the receipt logs and create the bloom filter.
182-
receipt.Logs = statedb.GetLogs(tx.Hash(), header.Hash())
182+
receipt.Logs = statedb.GetLogs(tx.Hash(), blockNumber.Uint64(), blockHash)
183183
receipt.Bloom = types.CreateBloom(types.Receipts{receipt})
184-
receipt.BlockHash = header.Hash()
185-
receipt.BlockNumber = header.Number
184+
receipt.BlockHash = blockHash
185+
receipt.BlockNumber = blockNumber
186186
receipt.TransactionIndex = uint(statedb.TxIndex())
187187
return receipt, result, err
188188
}
@@ -203,12 +203,12 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
203203
}
204204

205205
func ApplyTransactionWithResult(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, usedGas *uint64, cfg vm.Config) (*types.Receipt, *ExecutionResult, error) {
206-
msg, err := tx.AsMessage(types.MakeSigner(config, header.Number), header.BaseFee)
206+
msg, err := TransactionToMessage(tx, types.MakeSigner(config, header.Number), header.BaseFee)
207207
if err != nil {
208208
return nil, nil, err
209209
}
210210
// Create a new context to be used in the EVM environment
211211
blockContext := NewEVMBlockContext(header, bc, author)
212212
vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, config, cfg)
213-
return applyTransactionWithResult(msg, config, bc, author, gp, statedb, header, tx, usedGas, vmenv)
213+
return applyTransactionWithResult(msg, config, gp, statedb, header.Number, header.Hash(), tx, usedGas, vmenv)
214214
}

internal/ethapi/api.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2227,7 +2227,7 @@ func (s *BundleAPI) CallBundle(ctx context.Context, args CallBundleArgs) (map[st
22272227
}
22282228

22292229
coinbaseBalanceBeforeTx := state.GetBalance(coinbase)
2230-
state.Prepare(tx.Hash(), i)
2230+
state.SetTxContext(tx.Hash(), i)
22312231

22322232
receipt, result, err := core.ApplyTransactionWithResult(s.b.ChainConfig(), s.chain, &coinbase, gp, state, header, tx, &header.GasUsed, vmconfig)
22332233
if err != nil {
@@ -2382,7 +2382,7 @@ func (s *BundleAPI) EstimateGasBundle(ctx context.Context, args EstimateGasBundl
23822382
rand.Read(randomHash[:])
23832383

23842384
// New random hash since its a call
2385-
statedb.Prepare(randomHash, i)
2385+
statedb.SetTxContext(randomHash, i)
23862386

23872387
// Convert tx args to msg to apply state transition
23882388
msg, err := txArgs.ToMessage(globalGasCap, header.BaseFee)

0 commit comments

Comments
 (0)