types

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: AGPL-3.0 Imports: 4 Imported by: 12

README

package types

This package is used by other packages in this repository. It contains the generic types that are used by the other packages. Specific types are defined in the packages that use them.

This package must not import any other package from this repository in order to avoid circular dependencies. If you need to import another package, you should move the type to that package.

Documentation

Index

Constants

View Source
const (

	// ModeOracle starts vocdoninode as an oracle
	ModeOracle = "oracle"
	// ModeMiner starts vocdoninode as a miner
	ModeMiner = "miner"
	// ModeSeed starts vocdoninode as a seed node
	ModeSeed = "seed"
	// ModeGateway starts the vocdoninode as a gateway
	ModeGateway = "gateway"

	// ProcessIDsize is the size of a process id
	ProcessIDsize = 32
	// EthereumAddressSize is the size of an ethereum address
	EthereumAddressSize = 20

	// EntityIDsizeV2 legacy: in the past we used hash(addr)
	// this is a temporal work around to support both
	EntityIDsize = 20
	// VoteNullifierSize is the size of a vote nullifier
	VoteNullifierSize = 32
	// KeyIndexSeparator is the default char used to split keys
	KeyIndexSeparator = ":"
	// EthereumConfirmationsThreshold is the minimum amout of blocks
	// that should pass before considering a tx final
	EthereumConfirmationsThreshold = 6

	// ENTITY RESOLVER
	// EntityResolverDomain is the default entity resolver ENS domain
	EntityResolverDomain = "entities.voc.eth"
	// EntityResolverStageDomain is the default entity resolver ENS domain
	EntityResolverStageDomain = "entities.stg.voc.eth"
	// EntityResolverDevelopmentDomain is the default entity resolver ENS domain
	EntityResolverDevelopmentDomain = "entities.dev.voc.eth"

	// PROCESSES
	// ProcessesDomain
	ProcessesDomain = "processes.voc.eth"
	// ProcessesStageDomain
	ProcessesStageDomain = "processes.stg.voc.eth"
	// ProcessesDevelopmentDomain
	ProcessesDevelopmentDomain = "processes.dev.voc.eth"

	// NAMESPACES
	// NamespacesDomain
	NamespacesDomain = "namespaces.voc.eth"
	// NamespacesStageDomain
	NamespacesStageDomain = "namespaces.stg.voc.eth"
	// NamespacesDevelopmentDomain
	NamespacesDevelopmentDomain = "namespaces.dev.voc.eth"

	// ERC20 PROOFS
	// ERC20ProofsDomain
	ERC20ProofsDomain = "erc20.proofs.voc.eth"
	// ERC20ProofsStageDomain
	ERC20ProofsStageDomain = "erc20.proofs.stg.voc.eth"
	// ERC20ProofsDevelopmentDomain
	ERC20ProofsDevelopmentDomain = "erc20.proofs.dev.voc.eth"

	// GENESIS
	// GenesisDomain
	GenesisDomain = "genesis.voc.eth"
	// GenesisStageDomain
	GenesisStageDomain = "genesis.stg.voc.eth"
	// GenesisDevelopmentDomain
	GenesisDevelopmentDomain = "genesis.dev.voc.eth"

	// RESULTS
	// ResultsDomain
	ResultsDomain = "results.voc.eth"
	// ResultsStageDomain
	ResultsStageDomain = "results.stg.voc.eth"
	// ResultsDevelopmentDomain
	ResultsDevelopmentDomain = "results.dev.voc.eth"

	// EntityMetaKey is the key of an ENS text record for the entity metadata
	EntityMetaKey = "vnd.vocdoni.meta"

	// EthereumReadTimeout is the max amount of time for reading anything on
	// the Ethereum network to wait until canceling it's context
	EthereumReadTimeout = 1 * time.Minute
	// EthereumWriteTimeout is the max amount of time for writing anything on
	// the Ethereum network to wait until canceling it's context
	EthereumWriteTimeout = 1 * time.Minute
	// EthereumDialMaxRetry is the max number of attempts an ethereum client will
	// make in order to dial to an endpoint before considering the endpoint unreachable
	EthereumDialMaxRetry = 10

	// IndexerLiveProcessPrefix is used for sotring temporary results on live
	IndexerLiveProcessPrefix = byte(0x21)
	// IndexerEntityPrefix is the prefix for the storage entity keys
	IndexerEntityPrefix = byte(0x22)
	// IndexerResultsPrefix is the prefix of the storage results summary keys
	IndexerResultsPrefix = byte(0x24)
	// IndexerProcessEndingPrefix is the prefix for keep track of the processes ending
	// on a specific block
	IndexerProcessEndingPrefix = byte(0x25)

	// PetitionSign contains the string that needs to match with the received vote type
	// for petition-sign
	PetitionSign = "petition-sign"
	// PollVote contains the string that needs to match with the received vote type for poll-vote
	PollVote = "poll-vote"
	// EncryptedPoll contains the string that needs to match with the received vote type
	// for encrypted-poll
	EncryptedPoll = "encrypted-poll"
	// SnarkVote contains the string that needs to match with the received vote type for snark-vote
	SnarkVote = "snark-vote"

	// KeyKeeperMaxKeyIndex is the maxim number of allowed encryption keys
	KeyKeeperMaxKeyIndex = 16

	TxVote              = "vote"
	TxNewProcess        = "newProcess"
	TxCancelProcess     = "cancelProcess" // legacy
	TxSetProcess        = "setProcess"
	TxAddValidator      = "addValidator"
	TxRemoveValidator   = "removeValidator"
	TxAddOracle         = "addOracle"
	TxRemoveOracle      = "removeOracle"
	TxAddProcessKeys    = "addProcessKeys"
	TxRevealProcessKeys = "revealProcessKeys"

	// ProcessesContractMaxProcessMode represents the max value that a uint8 can have
	// with the current smart contract bitmask describing the supported process mode
	ProcessesContractMaxProcessMode = 31
	// ProcessesContractMaxEnvelopeType represents the max value that a uint8 can have
	// with the current smart contract bitmask describing the supported envelope types
	ProcessesContractMaxEnvelopeType = 31

	// ProcessesContractMinBlockCount represents the minimum number of vochain blocks
	// that a process should last
	ProcessesContractMinBlockCount = 2

	// ProcessesParamsSignatureSize represents the size of a signature on ethereum
	ProcessesParamsSignatureSize = 32

	VochainWsReadLimit = 20 << 20 // tendermint requires 20 MiB minimum
	Web3WsReadLimit    = 5 << 20  // go-ethereum accepts maximum 5 MiB

	MaxURLLength = 2083
)

Variables

View Source
var (
	False = Bool(false)
	True  = Bool(true)
)

These exported variables should be treated as constants, to be used in API responses which require *bool fields.

Functions

func Bool

func Bool(b bool) *bool

Types

type AccountID added in v1.4.0

type AccountID = HexBytes

type BigInt added in v1.3.0

type BigInt big.Int

BigInt is a big.Int wrapper which marshals JSON to a string representation of the big number

func (*BigInt) Add added in v1.3.0

func (i *BigInt) Add(x *BigInt, y *BigInt) *BigInt

Add sum x+y

func (*BigInt) Bytes added in v1.3.0

func (i *BigInt) Bytes() []byte

Bytes returns the bytes representation of the big number

func (*BigInt) Equal added in v1.3.0

func (i *BigInt) Equal(j *BigInt) bool

Equal helps us with go-cmp.

func (*BigInt) GobDecode added in v1.3.0

func (i *BigInt) GobDecode(buf []byte) error

func (*BigInt) GobEncode added in v1.3.0

func (i *BigInt) GobEncode() ([]byte, error)

func (BigInt) MarshalText added in v1.3.0

func (i BigInt) MarshalText() ([]byte, error)

func (*BigInt) MathBigInt added in v1.4.0

func (i *BigInt) MathBigInt() *big.Int

MathBigInt converts b to a math/big *Int.

func (*BigInt) Mul added in v1.3.0

func (i *BigInt) Mul(x *BigInt, y *BigInt) *BigInt

Mul multiplies x*y

func (*BigInt) SetBytes added in v1.3.0

func (i *BigInt) SetBytes(buf []byte) *BigInt

SetBytes interprets buf as big-endian unsigned integer

func (*BigInt) SetString added in v1.4.0

func (i *BigInt) SetString(s string) (*BigInt, error)

SetString interprets the string as a big number

func (*BigInt) SetUint64 added in v1.3.0

func (i *BigInt) SetUint64(x uint64) *BigInt

SetUint64 sets the value of x to the big number

func (*BigInt) String added in v1.3.0

func (i *BigInt) String() string

String returns the string representation of the big number

func (*BigInt) Sub added in v1.4.0

func (i *BigInt) Sub(x *BigInt, y *BigInt) *BigInt

Sub subs x-y

func (*BigInt) UnmarshalText added in v1.3.0

func (i *BigInt) UnmarshalText(data []byte) error

type CensusRoot added in v1.3.0

type CensusRoot = []byte

type DataStore

type DataStore struct {
	Datadir string
}

type EncodedProtoBuf added in v1.3.0

type EncodedProtoBuf = []byte

type EntityID added in v1.3.0

type EntityID = []byte

type Hash added in v1.4.0

type Hash = []byte

type HexBytes

type HexBytes []byte

HexBytes is a []byte which encodes as hexadecimal in json, as opposed to the base64 default.

func HexStringToHexBytes added in v1.6.0

func HexStringToHexBytes(hexString string) HexBytes

HexStringToHexBytes converts a hex string to a HexBytes. It strips a leading '0x' or '0X' if found, for backwards compatibility. Panics if the string is not a valid hex string.

func (HexBytes) MarshalJSON

func (b HexBytes) MarshalJSON() ([]byte, error)

func (*HexBytes) String added in v1.4.0

func (b *HexBytes) String() string

func (*HexBytes) UnmarshalJSON

func (b *HexBytes) UnmarshalJSON(data []byte) error

type Nullifier added in v1.3.0

type Nullifier = []byte

type ProcessID added in v1.3.0

type ProcessID = []byte

Jump to

Keyboard shortcuts

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