Documentation ¶
Index ¶
- Constants
- Variables
- func AccountFromFctSecret(s string) *testAccount
- func AddFNode()
- func AdjustAuthoritySet(adjustingNodes string)
- func AssertAuthoritySet(t *testing.T, givenNodes string)
- func CheckAuthoritySet(t *testing.T)
- func ClearContextResponseWriter(context *web.Context)
- func CloneFnodeData(fnode int, copyToNode int, t *testing.T)
- func ComposeChainCommit(pkey *primitives.PrivateKey, c *factom.Chain) (*messages.CommitChainMsg, error)
- func ComposeCommitEntryMsg(pkey *primitives.PrivateKey, e factom.Entry) (*messages.CommitEntryMsg, error)
- func ComposeRevealEntryMsg(pkey *primitives.PrivateKey, e *factom.Entry) (*messages.RevealEntryMsg, error)
- func CopyDir(src, dst string) error
- func CountAuthoritySet() (int, int, int)
- func CreateAndPopulateStaleHolding() *state.State
- func CreateAndPopulateTestDatabaseOverlay() *databaseOverlay.Overlay
- func CreateAndPopulateTestDatabaseOverlayForFER(testEntries []FEREntryWithHeight, desiredHeight int) *databaseOverlay.Overlay
- func CreateAndPopulateTestState() *state.State
- func CreateAndPopulateTestStateAndStartValidator() *state.State
- func CreateAndPopulateTestStateForFER(testEntries []FEREntryWithHeight, desiredHeight int) *state.State
- func CreateEmptyTestDatabaseOverlay() *databaseOverlay.Overlay
- func CreateEmptyTestState() *state.State
- func CreateFirstAnchorEntry() *entryBlock.Entry
- func CreateFirstTestEntry() *entryBlock.Entry
- func CreatePopulateAndExecuteTestState() *state.State
- func CreateTestAdminBlock(prev *adminBlock.AdminBlock) *adminBlock.AdminBlock
- func CreateTestAdminHeader(prev *adminBlock.AdminBlock) *adminBlock.ABlockHeader
- func CreateTestAnchorEnry(dBlock *directoryBlock.DirectoryBlock) *entryBlock.Entry
- func CreateTestAnchorEntryBlock(p interfaces.IEntryBlock, prevDBlock *directoryBlock.DirectoryBlock) (*entryBlock.EBlock, []*entryBlock.Entry)
- func CreateTestDBStateList() []interfaces.IMsg
- func CreateTestDirBlockInfo(prev *dbInfo.DirBlockInfo) *dbInfo.DirBlockInfo
- func CreateTestDirectoryBlock(prevBlock *directoryBlock.DirectoryBlock) *directoryBlock.DirectoryBlock
- func CreateTestDirectoryBlockHeader(prevBlock *directoryBlock.DirectoryBlock) *directoryBlock.DBlockHeader
- func CreateTestDirectoryBlockHeaderWithNetworkID(prevBlock *directoryBlock.DirectoryBlock, networkID uint32) *directoryBlock.DBlockHeader
- func CreateTestDirectoryBlockWithNetworkID(prevBlock *directoryBlock.DirectoryBlock, networkID uint32) *directoryBlock.DirectoryBlock
- func CreateTestEntry(n uint32) *entryBlock.Entry
- func CreateTestEntryBlock(p interfaces.IEntryBlock) (*entryBlock.EBlock, []*entryBlock.Entry)
- func CreateTestEntryBlockForFER(p interfaces.IEntryBlock, height uint32) (*entryBlock.EBlock, []*entryBlock.Entry)
- func CreateTestEntryBlockWithContentN(p interfaces.IEntryBlock, content uint32) (*entryBlock.EBlock, []*entryBlock.Entry)
- func CreateTestEntryCreditBlock(prev interfaces.IEntryCreditBlock) interfaces.IEntryCreditBlock
- func CreateTestFEREntry(n uint32) *entryBlock.Entry
- func CreateTestFactoidBlock(prev interfaces.IFBlock) interfaces.IFBlock
- func CreateTestFactoidBlockWithCoinbase(prev interfaces.IFBlock, address interfaces.IAddress, amount uint64) interfaces.IFBlock
- func CreateTestFactoidBlockWithTransaction(prev interfaces.IFBlock, sentSecret string, receivePublic []byte, amt uint64) interfaces.IFBlock
- func CreateWebContext() *web.Context
- func ExecuteAllBlocksFromDatabases(s *state.State)
- func GetAllDBStateMsgsFromDatabase(s *state.State) []interfaces.IMsg
- func GetAnchorChainID() interfaces.IHash
- func GetBankAccount() *testAccount
- func GetBody(context *web.Context) string
- func GetChainID() interfaces.IHash
- func GetLongTestHome(t *testing.T) string
- func GetRandomAccount() *testAccount
- func GetRespMap(context *web.Context) map[string]interface{}
- func GetRespText(context *web.Context) string
- func GetSimTestHome(t *testing.T) string
- func GetTestName() (name string)
- func Halt(t *testing.T)
- func IntToByteSlice(n int) []byte
- func NewCommitChain(eBlock *entryBlock.EBlock) *entryCreditBlock.CommitChain
- func NewCommitEntry(eBlock *entryBlock.EBlock) *entryCreditBlock.CommitEntry
- func NewECAddress(n uint64) interfaces.IAddress
- func NewECAddressPublicKeyString(n uint64) string
- func NewECAddressString(n uint64) string
- func NewFactoidAddress(n uint64) interfaces.IAddress
- func NewFactoidAddressStrings(n uint64) (string, string, string)
- func NewFactoidRCDAddress(n uint64) interfaces.IRCD
- func NewFactoidRCDAddressString(n uint64) string
- func NewFullPrivKey(n uint64) []byte
- func NewPrimitivesPrivateKey(n uint64) *primitives.PrivateKey
- func NewPrivKey(n uint64) []byte
- func NewPrivKeyString(n uint64) string
- func NewRepeatingHash(b byte) interfaces.IHash
- func PopulateTestDatabaseOverlay(dbo *databaseOverlay.Overlay)
- func PrintList(title string, list map[string]uint64)
- func PrivateKeyToECAddress(key *primitives.PrivateKey) *factom.ECAddress
- func PrivateKeyToEDPub(priv []byte) []byte
- func ResetSimHome(t *testing.T) string
- func ResetTestHome(homeDir string, t *testing.T)
- func RunCmd(cmd string)
- func SetInputFilter(apiRegex string) (*http.Response, error)
- func SetOutputFilter(apiRegex string) (*http.Response, error)
- func SetupSim(GivenNodes string, UserAddedOptions map[string]string, height int, ...) *state.State
- func ShutDownEverything(t *testing.T)
- func SignCommit(n uint64, tx interfaces.ISignable)
- func SignFactoidTransaction(n uint64, tx interfaces.ITransaction)
- func StartSim(GivenNodes string, UserAddedOptions map[string]string) *state.State
- func StatusEveryMinute(s *state.State)
- func SystemCall(cmd string) []byte
- func TestABlockEntryFunctions(a interfaces.IABEntry, b interfaces.IABEntry, t *testing.T)
- func TestMarshaling(a interfaces.BinaryMarshallable, b interfaces.BinaryMarshallable, ...)
- func TimeNow(s *state.State)
- func UnmarshalResp(context *web.Context, dst interface{})
- func UnmarshalRespDirectly(context *web.Context, dst interface{})
- func WaitBlocks(s *state.State, blks int)
- func WaitForAllNodes(state *state.State)
- func WaitForAnyEcBalance(s *state.State, ecPub string) int64
- func WaitForAnyFctBalance(s *state.State, fctPub string) int64
- func WaitForBlock(s *state.State, newBlock int)
- func WaitForEcBalanceOver(s *state.State, ecPub string, target int64) int64
- func WaitForEcBalanceUnder(s *state.State, ecPub string, target int64) int64
- func WaitForEntry(s *state.State, hash interfaces.IHash) bool
- func WaitForFctBalanceOver(s *state.State, fctPub string, target int64) int64
- func WaitForFctBalanceUnder(s *state.State, fctPub string, target int64) int64
- func WaitForMinute(s *state.State, newMinute int)
- func WaitForQuiet(s *state.State, newBlock int, newMinute int)
- func WaitForZeroEC(s *state.State, ecPub string) int64
- func WaitMinutes(s *state.State, min int)
- func WriteConfigFile(identityNumber int, fnode int, extra string, t *testing.T)
- type BlockSet
- func CreateFullTestBlockSet() []*BlockSet
- func CreateTestBlockSet(prev *BlockSet) *BlockSet
- func CreateTestBlockSetForFER(prev *BlockSet, db *databaseOverlay.Overlay, testEntries []FEREntryWithHeight) *BlockSet
- func CreateTestBlockSetWithNetworkID(prev *BlockSet, networkID uint32, transactions bool) *BlockSet
- type FEREntryWithHeight
- type TestResponseWriter
Constants ¶
const ( DBlockHeadPrimaryIndex = "e8e28ca4dfd65075cc113c522bf9476ffdf78235d553e8a192f477ee8c659cd0" DBlockHeadSecondaryIndex = "5a0654af6690ff20f2a50970e2859daec94390a623e39598ffe79c76cbe45a4b" ABlockHeadPrimaryIndex = "073bd46185217fddbd6d422cc23f28fe8ea58bf63c2e7521b7de3623b52e3b41" ABlockHeadSecondaryIndex = "4d4d40eff3c48e054226d7308ac6a8e2230dc489be7ca39631abac258f33902b" ECBlockHeadPrimaryIndex = "6b1aa04211ffd258c19f3ae4d0299f2b71ccabb8105489ed35dd881fc40a1e68" ECBlockHeadSecondaryIndex = "25a030e3a0eb491f7b5c0be7ee31575e8c274effc80854eafb1bf6c4ec4ea1e2" FBlockHeadPrimaryIndex = "84c8ac94c639117ef1b80d00c48f03c4a14bd74f17d86d56a8d8a4a73e6f91a8" FBlockHeadSecondaryIndex = "5f4d14e8b4bf5d8545d7ccaccccc99d2757b6ef5eaf5ffac03705457bb9d65ac" EBlockHeadPrimaryIndex = "6e7e64ac45ff57edbf8537a0c99fba2e9ee351ef3d3f4abd93af9f01107e592c" EBlockHeadSecondaryIndex = "e79fb46ad81f0b4fac7f1e66728b40b390f8fcc3806e93f94550eec041eecff2" AnchorBlockHeadPrimaryIndex = "df3ade9eec4b08d5379cc64270c30ea7315d8a8a1a69efe2b98a60ecdd69e604" AnchorBlockHeadSecondaryIndex = "c4e4c26a0f280425cc4acafa66205cf2643e8d9c2c13cf6905edcfa1e5f90983" )
Variables ¶
var BlockCount int = 10
var DefaultCoinbaseAmount uint64 = 100000000
var ExpectedHeight, Leaders, Audits, Followers int
var RanSimTest = false // only run 1 sim test at a time
Functions ¶
func AccountFromFctSecret ¶
func AccountFromFctSecret(s string) *testAccount
func AdjustAuthoritySet ¶
func AdjustAuthoritySet(adjustingNodes string)
func AssertAuthoritySet ¶
func CheckAuthoritySet ¶
func ComposeChainCommit ¶
func ComposeChainCommit(pkey *primitives.PrivateKey, c *factom.Chain) (*messages.CommitChainMsg, error)
func ComposeCommitEntryMsg ¶
func ComposeCommitEntryMsg(pkey *primitives.PrivateKey, e factom.Entry) (*messages.CommitEntryMsg, error)
func ComposeRevealEntryMsg ¶
func ComposeRevealEntryMsg(pkey *primitives.PrivateKey, e *factom.Entry) (*messages.RevealEntryMsg, error)
func CountAuthoritySet ¶
func CreateAndPopulateTestDatabaseOverlay ¶
func CreateAndPopulateTestDatabaseOverlay() *databaseOverlay.Overlay
func CreateAndPopulateTestDatabaseOverlayForFER ¶
func CreateAndPopulateTestDatabaseOverlayForFER(testEntries []FEREntryWithHeight, desiredHeight int) *databaseOverlay.Overlay
func CreateAndPopulateTestStateForFER ¶
func CreateAndPopulateTestStateForFER(testEntries []FEREntryWithHeight, desiredHeight int) *state.State
func CreateEmptyTestDatabaseOverlay ¶
func CreateEmptyTestDatabaseOverlay() *databaseOverlay.Overlay
func CreateEmptyTestState ¶
func CreateFirstAnchorEntry ¶
func CreateFirstAnchorEntry() *entryBlock.Entry
func CreateFirstTestEntry ¶
func CreateFirstTestEntry() *entryBlock.Entry
func CreateTestAdminBlock ¶
func CreateTestAdminBlock(prev *adminBlock.AdminBlock) *adminBlock.AdminBlock
func CreateTestAdminHeader ¶
func CreateTestAdminHeader(prev *adminBlock.AdminBlock) *adminBlock.ABlockHeader
func CreateTestAnchorEnry ¶
func CreateTestAnchorEnry(dBlock *directoryBlock.DirectoryBlock) *entryBlock.Entry
func CreateTestAnchorEntryBlock ¶
func CreateTestAnchorEntryBlock(p interfaces.IEntryBlock, prevDBlock *directoryBlock.DirectoryBlock) (*entryBlock.EBlock, []*entryBlock.Entry)
func CreateTestDBStateList ¶
func CreateTestDBStateList() []interfaces.IMsg
func CreateTestDirBlockInfo ¶
func CreateTestDirBlockInfo(prev *dbInfo.DirBlockInfo) *dbInfo.DirBlockInfo
func CreateTestDirectoryBlock ¶
func CreateTestDirectoryBlock(prevBlock *directoryBlock.DirectoryBlock) *directoryBlock.DirectoryBlock
func CreateTestDirectoryBlockHeader ¶
func CreateTestDirectoryBlockHeader(prevBlock *directoryBlock.DirectoryBlock) *directoryBlock.DBlockHeader
func CreateTestDirectoryBlockHeaderWithNetworkID ¶
func CreateTestDirectoryBlockHeaderWithNetworkID(prevBlock *directoryBlock.DirectoryBlock, networkID uint32) *directoryBlock.DBlockHeader
func CreateTestDirectoryBlockWithNetworkID ¶
func CreateTestDirectoryBlockWithNetworkID(prevBlock *directoryBlock.DirectoryBlock, networkID uint32) *directoryBlock.DirectoryBlock
func CreateTestEntry ¶
func CreateTestEntry(n uint32) *entryBlock.Entry
func CreateTestEntryBlock ¶
func CreateTestEntryBlock(p interfaces.IEntryBlock) (*entryBlock.EBlock, []*entryBlock.Entry)
func CreateTestEntryBlockForFER ¶
func CreateTestEntryBlockForFER(p interfaces.IEntryBlock, height uint32) (*entryBlock.EBlock, []*entryBlock.Entry)
func CreateTestEntryBlockWithContentN ¶
func CreateTestEntryBlockWithContentN(p interfaces.IEntryBlock, content uint32) (*entryBlock.EBlock, []*entryBlock.Entry)
func CreateTestEntryCreditBlock ¶
func CreateTestEntryCreditBlock(prev interfaces.IEntryCreditBlock) interfaces.IEntryCreditBlock
func CreateTestFEREntry ¶
func CreateTestFEREntry(n uint32) *entryBlock.Entry
func CreateTestFactoidBlock ¶
func CreateTestFactoidBlock(prev interfaces.IFBlock) interfaces.IFBlock
func CreateTestFactoidBlockWithCoinbase ¶
func CreateTestFactoidBlockWithCoinbase(prev interfaces.IFBlock, address interfaces.IAddress, amount uint64) interfaces.IFBlock
func CreateTestFactoidBlockWithTransaction ¶
func CreateTestFactoidBlockWithTransaction(prev interfaces.IFBlock, sentSecret string, receivePublic []byte, amt uint64) interfaces.IFBlock
func CreateWebContext ¶
func GetAllDBStateMsgsFromDatabase ¶
func GetAllDBStateMsgsFromDatabase(s *state.State) []interfaces.IMsg
func GetAnchorChainID ¶
func GetAnchorChainID() interfaces.IHash
func GetBankAccount ¶
func GetBankAccount() *testAccount
This account has a balance from initial coinbase
func GetChainID ¶
func GetChainID() interfaces.IHash
func GetRespMap ¶
func GetRespText ¶
func IntToByteSlice ¶
func NewCommitChain ¶
func NewCommitChain(eBlock *entryBlock.EBlock) *entryCreditBlock.CommitChain
func NewCommitEntry ¶
func NewCommitEntry(eBlock *entryBlock.EBlock) *entryCreditBlock.CommitEntry
func NewECAddress ¶
func NewECAddress(n uint64) interfaces.IAddress
func NewECAddressString ¶
func NewFactoidAddress ¶
func NewFactoidAddress(n uint64) interfaces.IAddress
func NewFactoidRCDAddress ¶
func NewFactoidRCDAddress(n uint64) interfaces.IRCD
func NewFullPrivKey ¶
Create a full 64 bit key holding both private and public key
func NewPrimitivesPrivateKey ¶
func NewPrimitivesPrivateKey(n uint64) *primitives.PrivateKey
func NewPrivKey ¶
Create 32 bit private key (without the public key part)
func NewPrivKeyString ¶
func NewRepeatingHash ¶
func NewRepeatingHash(b byte) interfaces.IHash
func PopulateTestDatabaseOverlay ¶
func PopulateTestDatabaseOverlay(dbo *databaseOverlay.Overlay)
func PrivateKeyToECAddress ¶
func PrivateKeyToECAddress(key *primitives.PrivateKey) *factom.ECAddress
func PrivateKeyToEDPub ¶
func ResetSimHome ¶
func ResetTestHome ¶
remove files from a home dir and remake .factom config dir
func SetupSim ¶
func SetupSim(GivenNodes string, UserAddedOptions map[string]string, height int, electionsCnt int, RoundsCnt int, t *testing.T) *state.State
EX. state0 := SetupSim("LLLLLLLLLLLLLLLAAAAAAAAAA", map[string]string {"--controlpanelsetting" : "readwrite"}, t)
func ShutDownEverything ¶
func SignCommit ¶
func SignCommit(n uint64, tx interfaces.ISignable)
func SignFactoidTransaction ¶
func SignFactoidTransaction(n uint64, tx interfaces.ITransaction)
func StartSim ¶
start simulation without promoting nodes to the authority set this is useful for creating scripts that will start/stop a simulation outside of the context of a unit test this allows for consistent tweaking of a simulation to induce load add message loss or adjust timing
func StatusEveryMinute ¶
print the status for every minute for a state
func SystemCall ¶
func TestABlockEntryFunctions ¶
func TestABlockEntryFunctions(a interfaces.IABEntry, b interfaces.IABEntry, t *testing.T)
func TestMarshaling ¶
func TestMarshaling(a interfaces.BinaryMarshallable, b interfaces.BinaryMarshallable, extraBytes int, t *testing.T)
TestMarshaling will test a marshing and unmarshal operation. Do the comparison of equality yourself. Extrabytes adds a random number of bytes up to extrabytes in length
func UnmarshalResp ¶
func UnmarshalRespDirectly ¶
func WaitForAllNodes ¶
func WaitForAnyEcBalance ¶
wait for non-zero EC balance
func WaitForAnyFctBalance ¶
wait for non-zero FCT balance
func WaitForEcBalanceOver ¶
loop until balance is >= target
func WaitForEcBalanceUnder ¶
loop until balance is < target
func WaitForEntry ¶
func WaitForEntry(s *state.State, hash interfaces.IHash) bool
func WaitForFctBalanceOver ¶
loop until balance is <= target
func WaitForFctBalanceUnder ¶
loop until balance is >= target
func WaitForQuiet ¶
Wait till block = newBlock and minute = newMinute
func WaitForZeroEC ¶
wait for exactly Zero EC balance REVIEW: should we ditch this?
func WaitMinutes ¶
Types ¶
type BlockSet ¶
type BlockSet struct { DBlock *directoryBlock.DirectoryBlock ABlock *adminBlock.AdminBlock ECBlock interfaces.IEntryCreditBlock FBlock interfaces.IFBlock EBlock *entryBlock.EBlock AnchorEBlock *entryBlock.EBlock Entries []*entryBlock.Entry Height int }
func CreateFullTestBlockSet ¶
func CreateFullTestBlockSet() []*BlockSet
func CreateTestBlockSet ¶
func CreateTestBlockSetForFER ¶
func CreateTestBlockSetForFER(prev *BlockSet, db *databaseOverlay.Overlay, testEntries []FEREntryWithHeight) *BlockSet
type FEREntryWithHeight ¶
type FEREntryWithHeight struct { AnFEREntry interfaces.IEBEntry Height uint32 }
type TestResponseWriter ¶
func (*TestResponseWriter) Header ¶
func (t *TestResponseWriter) Header() http.Header
func (*TestResponseWriter) WriteHeader ¶
func (t *TestResponseWriter) WriteHeader(h int)