-
Notifications
You must be signed in to change notification settings - Fork 154
Expand file tree
/
Copy patharbitrum_hooks.go
More file actions
74 lines (64 loc) · 3.2 KB
/
arbitrum_hooks.go
File metadata and controls
74 lines (64 loc) · 3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
// Copyright 2014 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
package core
import (
"context"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
)
// Installs an Arbitrum TxProcessor, enabling ArbOS for this state transition (see vm/evm_arbitrum.go)
var ReadyEVMForL2 func(evm *vm.EVM, msg *Message)
// Allows ArbOS to swap out or return early from an RPC message to support the NodeInterface virtual contract
var InterceptRPCMessage = func(
msg *Message,
ctx context.Context,
statedb *state.StateDB,
header *types.Header,
backend NodeInterfaceBackendAPI,
blockCtx *vm.BlockContext,
) (*Message, *ExecutionResult, error) {
return msg, nil, nil
}
// Gets ArbOS's maximum intended gas per second
var GetArbOSSpeedLimitPerSecond func(statedb *state.StateDB) (uint64, error)
// While processing RPC only - Ask ArbOS what are the poster costs for this message.
var RPCPostingGasHook = func(msg *Message, header *types.Header, statedb *state.StateDB) (uint64, error) { return 0, nil }
// Renders a solidity error in human-readable form
var RenderRPCError func(data []byte) error
// TxFilterer provides address-based transaction filtering.
type TxFilterer interface {
// Setup activates address filtering on statedb.
Setup(statedb *state.StateDB)
// TouchFromTo marks the sender and recipient addresses for filtering.
TouchFromTo(statedb *state.StateDB, from common.Address, to *common.Address)
// TouchScheduledTxAddresses marks sender, recipient, aliased, and retryable addresses of a scheduled transaction for filtering.
TouchScheduledTxAddresses(statedb *state.StateDB, tx *types.Transaction, sender common.Address)
// ApplyEventsAndCheckFiltered applies event filtering and returns state.ErrArbTxFilter if any touched address is filtered.
ApplyEventsAndCheckFiltered(statedb *state.StateDB) error
}
type NodeInterfaceBackendAPI interface {
ChainConfig() *params.ChainConfig
CurrentBlock() *types.Header
BlockByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Block, error)
HeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*types.Header, error)
GetLogs(ctx context.Context, blockHash common.Hash, number uint64) ([][]*types.Log, error)
GetEVM(ctx context.Context, state *state.StateDB, header *types.Header, vmConfig *vm.Config, blockCtx *vm.BlockContext) *vm.EVM
TxFilter() TxFilterer
}