constants

package
v6.5.0-p2p2-beta1+inco... Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2019 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 4 more Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AckStatusInvalid int
	AckStatusUnknown
	AckStatusNotConfirmed
	AckStatusACK
	AckStatus1Minute
	AckStatusDBlockConfirmed
)

Ack status levels

View Source
const (
	AckStatusInvalidString         = "Invalid"
	AckStatusUnknownString         = "Unknown"
	AckStatusNotConfirmedString    = "NotConfirmed"
	AckStatusACKString             = "TransactionACK"
	AckStatus1MinuteString         = "1Minute"
	AckStatusDBlockConfirmedString = "DBlockConfirmed"
)

String forms of acks returned to users

View Source
const (
	EOM_MSG byte = iota // 0
	ACK_MSG             // 1

	FULL_SERVER_FAULT_MSG         // 4
	COMMIT_CHAIN_MSG              // 5
	COMMIT_ENTRY_MSG              // 6
	DIRECTORY_BLOCK_SIGNATURE_MSG // 7
	EOM_TIMEOUT_MSG               // 8
	FACTOID_TRANSACTION_MSG       // 9
	HEARTBEAT_MSG                 // 10
	INVALID_ACK_MSG               // 11
	INVALID_DIRECTORY_BLOCK_MSG   // 12
	REVEAL_ENTRY_MSG              // 13
	REQUEST_BLOCK_MSG             // 14
	SIGNATURE_TIMEOUT_MSG         // 15
	MISSING_MSG                   // 16
	MISSING_DATA                  // 17
	DATA_RESPONSE                 // 18
	MISSING_MSG_RESPONSE          // 19
	DBSTATE_MSG                   // 20
	DBSTATE_MISSING_MSG           // 21
	ADDSERVER_MSG                 // 22
	CHANGESERVER_KEY_MSG          // 23
	REMOVESERVER_MSG              // 24
	BOUNCE_MSG                    // 25	test message
	BOUNCEREPLY_MSG               // 26	test message
	MISSING_ENTRY_BLOCKS          // 27
	ENTRY_BLOCK_RESPONSE          // 28
	INTERNALADDLEADER             // 29
	INTERNALREMOVELEADER          // 30
	INTERNALADDAUDIT              // 31
	INTERNALREMOVEAUDIT           // 32
	INTERNALTIMEOUT               // 33
	INTERNALEOMSIG                // 34
	INTERNALAUTHLIST              // 35
	VOLUNTEERAUDIT                // 36
	VOLUNTEERPROPOSAL             // 37
	VOLUNTEERLEVELVOTE            // 38
	INTERNALSTARTELECTION         // 39
	FEDVOTE_MSG_BASE              // 40
	SYNC_MSG                      // 41

	NUM_MESSAGES // Not used, just a counter for the number of messages.
)

Messages

View Source
const (
	ECIDServerIndexNumber byte = iota // 0 Must be these values, per the specification
	ECIDMinuteNumber                  // 1
	ECIDChainCommit                   // 2
	ECIDEntryCommit                   // 3
	ECIDBalanceIncrease               // 4
)

Entry Credit Block entries

View Source
const (
	// Limits for keeping inputs from flooding our execution
	INMSGQUEUE_HIGH = 10000
	INMSGQUEUE_MED  = 5000
	INMSGQUEUE_LOW  = 1000

	DBSTATE_REQUEST_LIM_HIGH = 200
	DBSTATE_REQUEST_LIM_MED  = 50
	ENTRY_REQUEST_LIMIT      = 100

	///=============== The following are bit fields! ===================
	// Replay -- Dynamic Replay filter based on messages as they are processed.
	INTERNAL_REPLAY = 1
	NETWORK_REPLAY  = 1 << 1
	TIME_TEST       = 1 << 2 // Checks the time_stamp;  Don't put actual hashes into the map with this.
	REVEAL_REPLAY   = 1 << 3 // Checks for Reveal Entry Replays ... No duplicate Entries within our 4 hours!

	// FReplay -- Block based Replay filter constructed by processing the blocks, from the database
	//            then from blocks either passed to a node, or constructed by messages.
	BLOCK_REPLAY = 1 << 4 // Ensures we don't add the same transaction to multiple blocks.

	ADDRESS_LENGTH = 32 // Length of an Address or a Hash or Public Key
	// length of a Private Key
	SIGNATURE_LENGTH     = 64    // Length of a signature
	MAX_TRANSACTION_SIZE = 10240 // 10K like everything else?

	// Cross Boot Replay
	//==================
	// This is the salt filter on rebooting leaders. How long should the filter last for?
	CROSSBOOT_SALT_REPLAY_DURATION = time.Minute * 10

	// Block
	//==================
	MARKER                  = 0x00                       // Byte used to mark minute boundaries in Factoid blocks
	TRANSACTION_PRIOR_LIMIT = int64(12 * 60 * 60 * 1000) // Transactions prior to 12hrs before a block are invalid
	TRANSACTION_POST_LIMIT  = int64(12 * 60 * 60 * 1000) // Transactions after 12hrs following a block are invalid

	//Entry Credit Blocks (For now, everyone gets the same cap)
	EC_CAP = 5 //Number of ECBlocks we start with.

	//Limits and Sizes
	//==================
	//Maximum size for Entry External IDs and the Data
	HASH_LENGTH = int(32) //Length of a Hash

	COMMIT_TIME_WINDOW = time.Duration(12) //Time windows for commit chain and commit entry +/- 12 hours

	//NETWORK constants
	//==================
	VERSION_0               = byte(0)
	MAIN_NETWORK_ID  uint32 = 0xFA92E5A2
	TEST_NETWORK_ID  uint32 = 0xFA92E5A3
	LOCAL_NETWORK_ID uint32 = 0xFA92E5A4
	MaxBlocksPerMsg         = 500
)
View Source
const (
	// NETWORKS:
	NETWORK_MAIN   int = iota // 0
	NETWORK_TEST              // 1
	NETWORK_LOCAL             // 2
	NETWORK_CUSTOM            // 3
)
View Source
const (
	TYPE_MINUTE_NUM                 uint8 = 0x00 // 0
	TYPE_DB_SIGNATURE               uint8 = 0x01 // 1
	TYPE_REVEAL_MATRYOSHKA          uint8 = 0x02 // 2
	TYPE_ADD_MATRYOSHKA             uint8 = 0x03 // 3
	TYPE_ADD_SERVER_COUNT           uint8 = 0x04 // 4
	TYPE_ADD_FED_SERVER             uint8 = 0x05 // 5
	TYPE_ADD_AUDIT_SERVER           uint8 = 0x06 // 6
	TYPE_REMOVE_FED_SERVER          uint8 = 0x07 // 7
	TYPE_ADD_FED_SERVER_KEY         uint8 = 0x08 // 8
	TYPE_ADD_BTC_ANCHOR_KEY         uint8 = 0x09 // 9
	TYPE_SERVER_FAULT               uint8 = 0x0A // 10
	TYPE_COINBASE_DESCRIPTOR        uint8 = 0x0B // 11
	TYPE_COINBASE_DESCRIPTOR_CANCEL uint8 = 0x0C // 12
	TYPE_ADD_FACTOID_ADDRESS        uint8 = 0x0D // 13
	TYPE_ADD_FACTOID_EFFICIENCY     uint8 = 0x0E // 14
)

--------------------------------------------------------------- Types of entries (transactions) for Admin Block https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#adminid-bytes ---------------------------------------------------------------

View Source
const (
	IDENTITY_UNASSIGNED               uint8 = iota // 0
	IDENTITY_FEDERATED_SERVER                      // 1
	IDENTITY_AUDIT_SERVER                          // 2
	IDENTITY_FULL                                  // 3
	IDENTITY_PENDING_FEDERATED_SERVER              // 4
	IDENTITY_PENDING_AUDIT_SERVER                  // 5
	IDENTITY_PENDING_FULL                          // 6
	IDENTITY_SKELETON                              // 7 - Skeleton Identity
	IDENTITY_REGISTRATION_CHAIN                    // 8
)

--------------------------------------------------------------------- Identity Status Types ---------------------------------------------------------------------

View Source
const (
	// Time window for identity to require registration: 24hours = 144 blocks
	IDENTITY_REGISTRATION_BLOCK_WINDOW uint32 = 144
)

Identity Timing

View Source
const (
	// MaxAckHeightDelta is the maximum number of blocks in the
	//	future we will set our HighestAckHeight too. This means
	// 	200 = max number of blocks to set the max height too on top
	//	of our current block height.
	MaxAckHeightDelta = 200
)
View Source
const PreBootWindow = 20 // allow an N minute window before boot where messages will be accepted
View Source
const SaveStateVersion = 13

Fast boot save state version (savestate) To be increased whenever the data being saved changes from the last version

Variables

View Source
var (

	// How often to create coinbase transactions
	//		:: Default = 25
	COINBASE_PAYOUT_FREQUENCY = uint32(25)

	// How many blocks before the coinbase does the coinbase
	// have to appear in the admin block
	//		:: Default = COINBASE_PAYOUT_FREQUENCY*40
	COINBASE_DECLARATION = uint32(COINBASE_PAYOUT_FREQUENCY * 40)

	// The maximum amount of factoshis to be issued per server per payout
	// 		:: Default = 6.4*1e8
	COINBASE_PAYOUT_AMOUNT = uint64(6.4 * 1e8)

	// The height at which coinbase transactions will activate.
	//	 This is useful for updating without needing to take
	// 	 down the network and giving an update period.
	COINBASE_ACTIVATION = uint32(140200)
)

Not a constant because custom nets will modify these values

View Source
var ADMIN_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0a}

Directory Chain

View Source
var CURRENT_SEED = [32]byte{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}

Slices and arrays that should not ever be modified: =================================================== Used as a key in the wallet to find the current seed value.

View Source
var CheckPoints = map[uint32]string{}/* 106 elements not displayed */

--------------------------------------------------------------------- Checkpoints Directory Block KeyMR ---------------------------------------------------------------------

View Source
var D_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0d}

Directory Chain

View Source
var EC_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0c}

Entry Credit Chain

View Source
var FACTOID_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0f}

Factoid chain

View Source
var ZERO = []byte{0}
View Source
var ZERO_HASH = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Zero Hash

Functions

func AckStatusString

func AckStatusString(status int) string

AckStatusString will return the status int to a human readable string

func IdentityStatusString

func IdentityStatusString(i uint8) string

func MessageName

func MessageName(Type byte) string

func NeedsAck

func NeedsAck(t byte) bool

Check is they type needs an ACK to be processed.

func NormallyFullBroadcast

func NormallyFullBroadcast(t byte) bool

Election related messages are full broadcast

func NormallyPeer2Peer

func NormallyPeer2Peer(t byte) bool

Election related messages are full broadcast

func SetCustomCoinBaseConstants

func SetCustomCoinBaseConstants()

set the "constants" to values that are more useful for testing

func SetLocalCoinBaseConstants

func SetLocalCoinBaseConstants()

set the "constants" to values that are more useful for testing

func ShortMessageName

func ShortMessageName(Type byte) string

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL