/
interface.go
113 lines (106 loc) · 6.64 KB
/
interface.go
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package integrationTests
import (
"math/big"
"github.com/ElrondNetwork/elrond-go-core/core"
"github.com/ElrondNetwork/elrond-go-core/data/api"
dataApi "github.com/ElrondNetwork/elrond-go-core/data/api"
"github.com/ElrondNetwork/elrond-go-core/data/esdt"
"github.com/ElrondNetwork/elrond-go-core/data/outport"
"github.com/ElrondNetwork/elrond-go-core/data/transaction"
"github.com/ElrondNetwork/elrond-go-core/data/vm"
"github.com/ElrondNetwork/elrond-go/common"
"github.com/ElrondNetwork/elrond-go/debug"
"github.com/ElrondNetwork/elrond-go/epochStart"
"github.com/ElrondNetwork/elrond-go/heartbeat/data"
"github.com/ElrondNetwork/elrond-go/node/external"
"github.com/ElrondNetwork/elrond-go/process"
txSimData "github.com/ElrondNetwork/elrond-go/process/txsimulator/data"
"github.com/ElrondNetwork/elrond-go/sharding/nodesCoordinator"
"github.com/ElrondNetwork/elrond-go/state"
)
// TestBootstrapper extends the Bootstrapper interface with some functions intended to be used only in tests
// as it simplifies the reproduction of edge cases
type TestBootstrapper interface {
process.Bootstrapper
RollBack(revertUsingForkNonce bool) error
SetProbableHighestNonce(nonce uint64)
}
// TestEpochStartTrigger extends the epochStart trigger interface with some functions intended to by used only
// in tests as it simplifies the reproduction of test scenarios
type TestEpochStartTrigger interface {
epochStart.TriggerHandler
GetRoundsPerEpoch() uint64
SetTrigger(triggerHandler epochStart.TriggerHandler)
SetRoundsPerEpoch(roundsPerEpoch uint64)
SetMinRoundsBetweenEpochs(minRoundsPerEpoch uint64)
SetEpoch(epoch uint32)
}
// NodesCoordinatorFactory is used for creating a nodesCoordinator in the integration tests
type NodesCoordinatorFactory interface {
CreateNodesCoordinator(arg ArgIndexHashedNodesCoordinatorFactory) nodesCoordinator.NodesCoordinator
}
// NetworkShardingUpdater defines the updating methods used by the network sharding component
type NetworkShardingUpdater interface {
GetPeerInfo(pid core.PeerID) core.P2PPeerInfo
UpdatePeerIDPublicKeyPair(pid core.PeerID, pk []byte)
PutPeerIdShardId(pid core.PeerID, shardID uint32)
UpdatePeerIDInfo(pid core.PeerID, pk []byte, shardID uint32)
PutPeerIdSubType(pid core.PeerID, peerSubType core.P2PPeerSubType)
IsInterfaceNil() bool
}
// Facade is the node facade used to decouple the node implementation with the web server. Used in integration tests
type Facade interface {
GetBalance(address string, options api.AccountQueryOptions) (*big.Int, api.BlockInfo, error)
GetUsername(address string, options api.AccountQueryOptions) (string, api.BlockInfo, error)
GetCodeHash(address string, options api.AccountQueryOptions) ([]byte, api.BlockInfo, error)
GetValueForKey(address string, key string, options api.AccountQueryOptions) (string, api.BlockInfo, error)
GetAccount(address string, options api.AccountQueryOptions) (dataApi.AccountResponse, api.BlockInfo, error)
GetAccounts(addresses []string, options api.AccountQueryOptions) (map[string]*api.AccountResponse, api.BlockInfo, error)
GetESDTData(address string, key string, nonce uint64, options api.AccountQueryOptions) (*esdt.ESDigitalToken, api.BlockInfo, error)
GetNFTTokenIDsRegisteredByAddress(address string, options api.AccountQueryOptions) ([]string, api.BlockInfo, error)
GetESDTsWithRole(address string, role string, options api.AccountQueryOptions) ([]string, api.BlockInfo, error)
GetAllESDTTokens(address string, options api.AccountQueryOptions) (map[string]*esdt.ESDigitalToken, api.BlockInfo, error)
GetESDTsRoles(address string, options api.AccountQueryOptions) (map[string][]string, api.BlockInfo, error)
GetKeyValuePairs(address string, options api.AccountQueryOptions) (map[string]string, api.BlockInfo, error)
GetBlockByHash(hash string, options api.BlockQueryOptions) (*dataApi.Block, error)
GetBlockByNonce(nonce uint64, options api.BlockQueryOptions) (*dataApi.Block, error)
GetBlockByRound(round uint64, options api.BlockQueryOptions) (*dataApi.Block, error)
Trigger(epoch uint32, withEarlyEndOfEpoch bool) error
IsSelfTrigger() bool
GetTotalStakedValue() (*dataApi.StakeValues, error)
GetDirectStakedList() ([]*dataApi.DirectStakedValue, error)
GetDelegatorsList() ([]*dataApi.Delegator, error)
GetAllIssuedESDTs(tokenType string) ([]string, error)
GetTokenSupply(token string) (*dataApi.ESDTSupply, error)
GetHeartbeats() ([]data.PubKeyHeartbeat, error)
StatusMetrics() external.StatusMetricsHandler
GetQueryHandler(name string) (debug.QueryHandler, error)
GetEpochStartDataAPI(epoch uint32) (*common.EpochStartDataAPI, error)
GetPeerInfo(pid string) ([]core.QueryP2PPeerInfo, error)
CreateTransaction(nonce uint64, value string, receiver string, receiverUsername []byte, sender string, senderUsername []byte, gasPrice uint64,
gasLimit uint64, data []byte, signatureHex string, chainID string, version uint32, options uint32) (*transaction.Transaction, []byte, error)
ValidateTransaction(tx *transaction.Transaction) error
ValidateTransactionForSimulation(tx *transaction.Transaction, bypassSignature bool) error
SendBulkTransactions([]*transaction.Transaction) (uint64, error)
SimulateTransactionExecution(tx *transaction.Transaction) (*txSimData.SimulationResults, error)
GetTransaction(hash string, withResults bool) (*transaction.ApiTransactionResult, error)
ComputeTransactionGasLimit(tx *transaction.Transaction) (*transaction.CostResponse, error)
EncodeAddressPubkey(pk []byte) (string, error)
GetThrottlerForEndpoint(endpoint string) (core.Throttler, bool)
ValidatorStatisticsApi() (map[string]*state.ValidatorApiResponse, error)
ExecuteSCQuery(*process.SCQuery) (*vm.VMOutputApi, error)
DecodeAddressPubkey(pk string) ([]byte, error)
GetProof(rootHash string, address string) (*common.GetProofResponse, error)
GetProofDataTrie(rootHash string, address string, key string) (*common.GetProofResponse, *common.GetProofResponse, error)
GetProofCurrentRootHash(address string) (*common.GetProofResponse, error)
VerifyProof(rootHash string, address string, proof [][]byte) (bool, error)
GetGenesisNodesPubKeys() (map[uint32][]string, map[uint32][]string, error)
GetGenesisBalances() ([]*common.InitialAccountAPI, error)
GetGasConfigs() (map[string]map[string]uint64, error)
GetTransactionsPool(fields string) (*common.TransactionsPoolAPIResponse, error)
GetTransactionsPoolForSender(sender, fields string) (*common.TransactionsPoolForSenderApiResponse, error)
GetLastPoolNonceForSender(sender string) (uint64, error)
GetTransactionsPoolNonceGapsForSender(sender string) (*common.TransactionsPoolNonceGapsForSenderApiResponse, error)
GetAlteredAccountsForBlock(options dataApi.GetAlteredAccountsForBlockOptions) ([]*outport.AlteredAccount, error)
IsInterfaceNil() bool
}