Skip to content
This repository has been archived by the owner on Apr 11, 2021. It is now read-only.

Commit

Permalink
blocknumber: fix (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
tynes authored Mar 17, 2021
1 parent b54a387 commit 2e46827
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
3 changes: 3 additions & 0 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
}
// Create a new context to be used in the EVM environment
context := NewEVMContext(msg, header, bc, author)
if vm.UsingOVM {
context.BlockNumber = msg.L1BlockNumber()
}
// Create a new environment which holds all relevant information
// about the transaction and calling mechanisms.
vmenv := vm.NewEVM(context, statedb, config, cfg)
Expand Down
16 changes: 8 additions & 8 deletions core/state_transition_ovm.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ import (
var ZeroAddress = common.HexToAddress("0x0000000000000000000000000000000000000000")

type ovmTransaction struct {
Timestamp *big.Int "json:\"timestamp\""
BlockNumber *big.Int "json:\"blockNumber\""
L1QueueOrigin uint8 "json:\"l1QueueOrigin\""
L1TxOrigin common.Address "json:\"l1TxOrigin\""
Entrypoint common.Address "json:\"entrypoint\""
GasLimit *big.Int "json:\"gasLimit\""
Data []uint8 "json:\"data\""
Timestamp *big.Int `json:"timestamp"`
BlockNumber *big.Int `json:"blockNumber"`
L1QueueOrigin uint8 `json:"l1QueueOrigin"`
L1TxOrigin common.Address `json:"l1TxOrigin"`
Entrypoint common.Address `json:"entrypoint"`
GasLimit *big.Int `json:"gasLimit"`
Data []uint8 `json:"data"`
}

func toExecutionManagerRun(evm *vm.EVM, msg Message) (Message, error) {
tx := ovmTransaction{
evm.Context.Time,
evm.Context.BlockNumber, // TODO (what's the correct block number?)
msg.L1BlockNumber(),
uint8(msg.QueueOrigin().Uint64()),
*msg.L1MessageSender(),
*msg.To(),
Expand Down

0 comments on commit 2e46827

Please sign in to comment.