github.com/koko1123/flow-go-1@v0.29.6/model/flow/constants.go (about) 1 package flow 2 3 import ( 4 "fmt" 5 "time" 6 ) 7 8 // GenesisTime defines the timestamp of the genesis block. 9 var GenesisTime = time.Date(2018, time.December, 19, 22, 32, 30, 42, time.UTC) 10 11 // DefaultProtocolVersion is the default protocol version, indicating none was 12 // explicitly set during bootstrapping. 13 const DefaultProtocolVersion = 0 14 15 // DefaultTransactionExpiry is the default expiry for transactions, measured in blocks. 16 // The default value is equivalent to 10 minutes for a 1-second block time. 17 // 18 // Let E by the transaction expiry. If a transaction T specifies a reference 19 // block R with height H, then T may be included in any block B where: 20 // * R<-*B - meaning B has R as an ancestor, and 21 // * R.height < B.height <= R.height+E 22 const DefaultTransactionExpiry = 10 * 60 23 24 // DefaultTransactionExpiryBuffer is the default buffer time between a transaction being ingested by a 25 // collection node and being included in a collection and block. 26 const DefaultTransactionExpiryBuffer = 30 27 28 // DefaultMaxTransactionGasLimit is the default maximum value for the transaction gas limit. 29 const DefaultMaxTransactionGasLimit = 9999 30 31 // DefaultMaxTransactionByteSize is the default maximum transaction byte size. (~1.5MB) 32 const DefaultMaxTransactionByteSize = 1_500_000 33 34 // DefaultMaxCollectionByteSize is the default maximum value for a collection byte size. 35 const DefaultMaxCollectionByteSize = 3_000_000 // ~3MB. This is should always be higher than the limit on single tx size. 36 37 // DefaultMaxCollectionTotalGas is the default maximum value for total gas allowed to be included in a collection. 38 const DefaultMaxCollectionTotalGas = 10_000_000 // 10M 39 40 // DefaultMaxCollectionSize is the default maximum number of transactions allowed inside a collection. 41 const DefaultMaxCollectionSize = 100 42 43 // DefaultValueLogGCFrequency is the default frequency in blocks that we call the 44 // badger value log GC. Equivalent to 10 mins for a 1 second block time 45 const DefaultValueLogGCFrequency = 10 * 60 46 47 // DefaultRequiredApprovalsForSealConstruction is the default number of approvals required to construct a candidate seal 48 // for subsequent inclusion in block. 49 // when set to 1, it requires at least 1 approval to build a seal 50 // when set to 0, it can build seal without any approval 51 const DefaultRequiredApprovalsForSealConstruction = uint(1) 52 53 // DefaultRequiredApprovalsForSealValidation is the default number of approvals that should be 54 // present and valid for each chunk. Setting this to 0 will disable counting of chunk approvals 55 // this can be used temporarily to ease the migration to new chunk based sealing. 56 // TODO: 57 // - This value will result in consensus not depending on verification at all for sealing (no approvals required) 58 // - Full protocol should be +2/3 of all currently authorized verifiers. 59 const DefaultRequiredApprovalsForSealValidation = 0 60 61 // DefaultChunkAssignmentAlpha is the default number of verifiers that should be 62 // assigned to each chunk. 63 const DefaultChunkAssignmentAlpha = 3 64 65 // DefaultEmergencySealingActive is a flag which indicates when emergency sealing is active, this is a temporary measure 66 // to make fire fighting easier while seal & verification is under development. 67 const DefaultEmergencySealingActive = false 68 69 // threshold for re-requesting approvals: min height difference between the latest finalized block 70 // and the block incorporating a result 71 const DefaultApprovalRequestsThreshold = uint64(10) 72 73 // DomainTagLength is set to 32 bytes. 74 // 75 // Signatures on Flow that needs to be scoped to a certain domain need to 76 // have the same length in order to avoid tag collision issues, when prefixing the 77 // message to sign. 78 const DomainTagLength = 32 79 80 const TransactionTagString = "FLOW-V0.0-transaction" 81 82 // TransactionDomainTag is the prefix of all signed transaction payloads. 83 // 84 // The tag is the string `TransactionTagString` encoded as UTF-8 bytes, 85 // right padded to a total length of 32 bytes. 86 var TransactionDomainTag = paddedDomainTag(TransactionTagString) 87 88 // paddedDomainTag padds string tags to form the actuatl domain separation tag used for signing 89 // and verifiying. 90 // 91 // A domain tag is encoded as UTF-8 bytes, right padded to a total length of 32 bytes. 92 func paddedDomainTag(s string) [DomainTagLength]byte { 93 var tag [DomainTagLength]byte 94 95 if len(s) > DomainTagLength { 96 panic(fmt.Sprintf("domain tag %s cannot be longer than %d characters", s, DomainTagLength)) 97 } 98 99 copy(tag[:], s) 100 101 return tag 102 }