@@ -8,15 +8,10 @@ package protocol
8
8
9
9
import (
10
10
"context"
11
- "strings"
12
11
13
- "github.com/iotexproject/iotex-address/address"
14
12
"github.com/pkg/errors"
15
13
16
- "github.com/iotexproject/go-pkgs/hash"
17
14
"github.com/iotexproject/iotex-core/action"
18
- "github.com/iotexproject/iotex-core/db"
19
- "github.com/iotexproject/iotex-core/state"
20
15
)
21
16
22
17
var (
@@ -47,61 +42,3 @@ type ActionEnvelopeValidator interface {
47
42
type ActionHandler interface {
48
43
Handle (context.Context , action.Action , StateManager ) (* action.Receipt , error )
49
44
}
50
-
51
- // ChainManager defines the blockchain interface
52
- type ChainManager interface {
53
- // ChainID returns the chain ID
54
- ChainID () uint32
55
- // CandidatesByHeight returns the candidate list by a given height
56
- CandidatesByHeight (height uint64 ) ([]* state.Candidate , error )
57
- // ProductivityByEpoch returns the number of produced blocks per delegate in an epoch
58
- ProductivityByEpoch (epochNum uint64 ) (uint64 , map [string ]uint64 , error )
59
- // SimulateExecution simulates a running of smart contract operation
60
- SimulateExecution (caller address.Address , ex * action.Execution ) ([]byte , * action.Receipt , error )
61
- }
62
-
63
- // StateManager defines the state DB interface atop IoTeX blockchain
64
- type StateManager interface {
65
- // Accounts
66
- Height () uint64
67
- Snapshot () int
68
- Revert (int ) error
69
- // General state
70
- State (hash.Hash160 , interface {}) error
71
- PutState (hash.Hash160 , interface {}) error
72
- DelState (pkHash hash.Hash160 ) error
73
- GetDB () db.KVStore
74
- GetCachedBatch () db.CachedBatch
75
- }
76
-
77
- // MockChainManager mocks ChainManager interface
78
- type MockChainManager struct {
79
- }
80
-
81
- // Nonce mocks base method
82
- func (m * MockChainManager ) Nonce (addr string ) (uint64 , error ) {
83
- if strings .EqualFold ("io1emxf8zzqckhgjde6dqd97ts0y3q496gm3fdrl6" , addr ) {
84
- return 0 , errors .New ("MockChainManager nonce error" )
85
- }
86
- return 2 , nil
87
- }
88
-
89
- // ChainID return chain ID
90
- func (m * MockChainManager ) ChainID () uint32 {
91
- return 0
92
- }
93
-
94
- // CandidatesByHeight returns the candidate list by a given height
95
- func (m * MockChainManager ) CandidatesByHeight (height uint64 ) ([]* state.Candidate , error ) {
96
- return nil , nil
97
- }
98
-
99
- // ProductivityByEpoch returns the number of produced blocks per delegate in an epoch
100
- func (m * MockChainManager ) ProductivityByEpoch (epochNum uint64 ) (uint64 , map [string ]uint64 , error ) {
101
- return 0 , nil , nil
102
- }
103
-
104
- // SimulateExecution simulates a running of smart contract operation
105
- func (m * MockChainManager ) SimulateExecution (caller address.Address , ex * action.Execution ) ([]byte , * action.Receipt , error ) {
106
- return nil , nil , nil
107
- }
0 commit comments