-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b047334
commit 7e88649
Showing
24 changed files
with
1,960 additions
and
313 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,236 @@ | ||
package testchain | ||
|
||
import ( | ||
"math/big" | ||
"strings" | ||
"sync/atomic" | ||
|
||
"github.com/nspcc-dev/neo-go/pkg/config" | ||
"github.com/nspcc-dev/neo-go/pkg/core/block" | ||
"github.com/nspcc-dev/neo-go/pkg/core/blockchainer" | ||
"github.com/nspcc-dev/neo-go/pkg/core/mempool" | ||
"github.com/nspcc-dev/neo-go/pkg/core/state" | ||
"github.com/nspcc-dev/neo-go/pkg/core/transaction" | ||
"github.com/nspcc-dev/neo-go/pkg/crypto" | ||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys" | ||
"github.com/nspcc-dev/neo-go/pkg/smartcontract/trigger" | ||
"github.com/nspcc-dev/neo-go/pkg/util" | ||
"github.com/nspcc-dev/neo-go/pkg/vm" | ||
) | ||
|
||
type TestChain struct { | ||
Blockheight uint32 | ||
UtilityTokenBalance *big.Int | ||
FeePerByteValue int64 | ||
P2PSigExtEnabled bool | ||
DepositBalance *big.Int | ||
DepositExpiration uint32 | ||
NotaryScriptHash util.Uint160 | ||
MaxNotValidBeforeDelta uint32 | ||
} | ||
|
||
func (chain TestChain) ApplyPolicyToTxSet([]*transaction.Transaction) []*transaction.Transaction { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetConfig() config.ProtocolConfiguration { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) CalculateClaimable(util.Uint160, uint32) (*big.Int, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) FeePerByte() int64 { | ||
if chain.FeePerByteValue != 0 { | ||
return chain.FeePerByteValue | ||
} | ||
panic("TODO") | ||
} | ||
func (chain TestChain) P2PSigExtensionsEnabled() bool { | ||
return chain.P2PSigExtEnabled | ||
} | ||
|
||
func (chain TestChain) GetMaxBlockSystemFee() int64 { | ||
panic("TODO") | ||
} | ||
|
||
func (chain TestChain) GetMaxBlockSize() uint32 { | ||
panic("TODO") | ||
} | ||
|
||
func (chain TestChain) AddHeaders(...*block.Header) error { | ||
panic("TODO") | ||
} | ||
func (chain *TestChain) AddBlock(block *block.Block) error { | ||
if block.Index == chain.Blockheight+1 { | ||
atomic.StoreUint32(&chain.Blockheight, block.Index) | ||
} | ||
return nil | ||
} | ||
func (chain *TestChain) AddStateRoot(r *state.MPTRoot) error { | ||
panic("TODO") | ||
} | ||
func (chain *TestChain) BlockHeight() uint32 { | ||
return atomic.LoadUint32(&chain.Blockheight) | ||
} | ||
func (chain *TestChain) Close() { | ||
panic("TODO") | ||
} | ||
func (chain *TestChain) GetDepositExpiration(acc util.Uint160) uint32 { | ||
if chain.DepositExpiration != 0 { | ||
return chain.DepositExpiration | ||
} | ||
panic("TODO") | ||
} | ||
func (chain *TestChain) GetDepositBalance(acc util.Uint160) *big.Int { | ||
if chain.DepositBalance != nil { | ||
return chain.DepositBalance | ||
} | ||
panic("TODO") | ||
} | ||
func (chain *TestChain) GetMaxNotValidBeforeDelta() uint32 { | ||
if chain.MaxNotValidBeforeDelta != 0 { | ||
return chain.MaxNotValidBeforeDelta | ||
} | ||
panic("TODO") | ||
} | ||
func (chain *TestChain) GetMaxVerificationGAS() int64 { | ||
panic("TODO") | ||
} | ||
func (chain *TestChain) GetPolicer() blockchainer.Policer { | ||
return chain | ||
} | ||
func (chain *TestChain) RegisterPostBlock(f func(blockchainer.Blockchainer, *mempool.Pool, *block.Block)) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) HeaderHeight() uint32 { | ||
return 0 | ||
} | ||
func (chain TestChain) GetAppExecResults(hash util.Uint256, trig trigger.Type) ([]state.AppExecResult, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetBlock(hash util.Uint256) (*block.Block, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetCommittee() (keys.PublicKeys, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetContractState(hash util.Uint160) *state.Contract { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetContractScriptHash(id int32) (util.Uint160, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetNativeContractScriptHash(name string) (util.Uint160, error) { | ||
switch strings.ToLower(name) { | ||
case "notary": | ||
if !chain.NotaryScriptHash.Equals(util.Uint160{}) { | ||
return chain.NotaryScriptHash, nil | ||
} | ||
} | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetHeaderHash(int) util.Uint256 { | ||
return util.Uint256{} | ||
} | ||
func (chain TestChain) GetHeader(hash util.Uint256) (*block.Header, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetNextBlockValidators() ([]*keys.PublicKey, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) ForEachNEP17Transfer(util.Uint160, func(*state.NEP17Transfer) (bool, error)) error { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetNEP17Balances(util.Uint160) *state.NEP17Balances { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetValidators() ([]*keys.PublicKey, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetStandByCommittee() keys.PublicKeys { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetStandByValidators() keys.PublicKeys { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetEnrollments() ([]state.Validator, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetStateProof(util.Uint256, []byte) ([][]byte, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetStateRoot(height uint32) (*state.MPTRootState, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetStorageItem(id int32, key []byte) *state.StorageItem { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetTestVM(tx *transaction.Transaction, b *block.Block) *vm.VM { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetStorageItems(id int32) (map[string]*state.StorageItem, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) CurrentHeaderHash() util.Uint256 { | ||
return util.Uint256{} | ||
} | ||
func (chain TestChain) CurrentBlockHash() util.Uint256 { | ||
return util.Uint256{} | ||
} | ||
func (chain TestChain) HasBlock(util.Uint256) bool { | ||
return false | ||
} | ||
func (chain TestChain) HasTransaction(util.Uint256) bool { | ||
return false | ||
} | ||
func (chain TestChain) GetTransaction(util.Uint256) (*transaction.Transaction, uint32, error) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetMemPool() *mempool.Pool { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetGoverningTokenBalance(acc util.Uint160) (*big.Int, uint32) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) GetUtilityTokenBalance(uint160 util.Uint160) *big.Int { | ||
if chain.UtilityTokenBalance != nil { | ||
return chain.UtilityTokenBalance | ||
} | ||
panic("TODO") | ||
} | ||
func (chain TestChain) PoolTx(*transaction.Transaction, ...*mempool.Pool) error { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) RunWithCurrentState(f func() error) error { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) SubscribeForBlocks(ch chan<- *block.Block) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) SubscribeForExecutions(ch chan<- *state.AppExecResult) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) SubscribeForNotifications(ch chan<- *state.NotificationEvent) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) SubscribeForTransactions(ch chan<- *transaction.Transaction) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) VerifyTx(*transaction.Transaction) error { | ||
panic("TODO") | ||
} | ||
func (TestChain) VerifyWitness(util.Uint160, crypto.Verifiable, *transaction.Witness, int64) error { | ||
panic("TODO") | ||
} | ||
|
||
func (chain TestChain) UnsubscribeFromBlocks(ch chan<- *block.Block) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) UnsubscribeFromExecutions(ch chan<- *state.AppExecResult) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) UnsubscribeFromNotifications(ch chan<- *state.NotificationEvent) { | ||
panic("TODO") | ||
} | ||
func (chain TestChain) UnsubscribeFromTransactions(ch chan<- *transaction.Transaction) { | ||
panic("TODO") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.