Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateExpectedResults(fieldValuesPerVoter [][]*types.BigInt) []*types.BigInt
- func CreateCensusProof(origin types.CensusOrigin, pid types.ProcessID, address common.Address) (types.CensusProof, error)
- func CurrentCensusOrigin() types.CensusOrigin
- func EnsureVotesStatus(cli *client.HTTPclient, pid types.ProcessID, voteIDs []types.VoteID, ...) (bool, []types.VoteID, error)
- func FetchProcessOnChainOverwrittenVotesCount(contracts *web3.Contracts, pid types.ProcessID) (int, error)
- func FetchProcessVotersCountOnChain(contracts *web3.Contracts, pid types.ProcessID) (int, error)
- func FetchResultsOnChain(contracts *web3.Contracts, pid types.ProcessID) ([]*types.BigInt, error)
- func FinishProcessOnChain(contracts *web3.Contracts, pid types.ProcessID) error
- func HasAddressAlreadyVoted(cli *client.HTTPclient, pid types.ProcessID, address common.Address) (bool, error)
- func IsCSPCensus() bool
- func IsDebugTest() bool
- func MaxTestTimeout(t *testing.T) time.Duration
- func NewCensusWithRandomVoters(ctx context.Context, origin types.CensusOrigin, nVoters int) ([]byte, string, []*ethereum.Signer, error)
- func NewCensusWithVoters(ctx context.Context, origin types.CensusOrigin, signers ...*ethereum.Signer) ([]byte, string, []*ethereum.Signer, error)
- func NewProcess(contracts *web3.Contracts, cli *client.HTTPclient) (types.ProcessID, *types.EncryptionKey, error)
- func NewProcessOnChain(contracts *web3.Contracts, censusOrigin types.CensusOrigin, censusURI string, ...) (types.ProcessID, error)
- func NewVote(pid types.ProcessID, bm spec.BallotMode, encKey *types.EncryptionKey, ...) (api.Vote, error)
- func NewVoteFromNonCensusVoter(pid types.ProcessID, bm spec.BallotMode, encKey *types.EncryptionKey) (api.Vote, error)
- func NewVoteWithRandomFields(pid types.ProcessID, bm spec.BallotMode, encKey *types.EncryptionKey, ...) (api.Vote, []*types.BigInt, error)
- func UpdateCensusOnChain(contracts *web3.Contracts, pid types.ProcessID, census types.Census) error
- func UpdateMaxVotersOnChain(contracts *web3.Contracts, pid types.ProcessID, numVoters int) error
- func WaitUntilCondition(ctx context.Context, interval time.Duration, condition func() bool) error
- type TestServices
Constants ¶
View Source
const ( // first account private key created by anvil with default mnemonic LocalAccountPrivKey = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" LocalCSPSeed = "1f1e0cd27b4ecd1b71b6333790864ace2870222c" WorkerSeed = "test-seed" WorkerTokenExpiration = 24 * time.Hour WorkerTimeout = time.Second * 5 // envarionment variable names DeployerServerPortEnvVarName = "DEPLOYER_SERVER" // environment variable name for deployer server port ContractsBranchNameEnvVarName = "SEQUENCER_CONTRACTS_BRANCH" // environment variable name for z-contracts branch ContractsCommitHashEnvVarName = "SEQUENCER_CONTRACTS_COMMIT" // environment variable name for z-contracts commit hash PrivKeyEnvVarName = "SEQUENCER_PRIV_KEY" // environment variable name for private key RPCUrlEnvVarName = "SEQUENCER_RPC_URL" // environment variable name for RPC URL AnvilPortEnvVarName = "ANVIL_PORT_RPC_HTTP" // environment variable name for Anvil port ProcessRegistryEnvVarName = "SEQUENCER_PROCESS_REGISTRY" // environment variable name for process registry ResultsVerifierEnvVarName = "SEQUENCER_RESULTS_ZK_VERIFIER" // environment variable name for results zk verifier StateTransitionVerifierEnvVarName = "SEQUENCER_STATE_TRANSITION_ZK_VERIFIER" // environment variable name for state transition zk verifier CSPCensusEnvVarName = "CSP_CENSUS" // environment variable name to select between csp or merkle tree census (by default merkle tree) DefaultBatchTimeWindow = 45 * time.Second // default batch time window for sequencer )
Variables ¶
View Source
var ( DefaultAPIPort = util.RandomInt(40000, 60000) DefaultCensus3Port = util.RandomInt(40000, 60000) DefaultCensus3URL = fmt.Sprintf("http://localhost:%d", DefaultCensus3Port) )
Functions ¶
func CalculateExpectedResults ¶ added in v0.0.2
func CreateCensusProof ¶
func CreateCensusProof(origin types.CensusOrigin, pid types.ProcessID, address common.Address) (types.CensusProof, error)
func CurrentCensusOrigin ¶
func CurrentCensusOrigin() types.CensusOrigin
func EnsureVotesStatus ¶
func FetchResultsOnChain ¶
func FinishProcessOnChain ¶
func HasAddressAlreadyVoted ¶ added in v0.0.2
func IsCSPCensus ¶
func IsCSPCensus() bool
func IsDebugTest ¶
func IsDebugTest() bool
func NewCensusWithVoters ¶
func NewProcess ¶
func NewProcess( contracts *web3.Contracts, cli *client.HTTPclient, ) (types.ProcessID, *types.EncryptionKey, error)
func NewProcessOnChain ¶
func NewVoteFromNonCensusVoter ¶
func NewVoteFromNonCensusVoter(pid types.ProcessID, bm spec.BallotMode, encKey *types.EncryptionKey) (api.Vote, error)
func NewVoteWithRandomFields ¶
func UpdateCensusOnChain ¶
func UpdateMaxVotersOnChain ¶
Types ¶
type TestServices ¶
type TestServices struct {
API *service.APIService
Census3 *c3service.Service
Sequencer *sequencer.Sequencer
CensusDownloader *service.CensusDownloader
Storage *storage.Storage
Contracts *web3.Contracts
HTTPClient *client.HTTPclient
}
TestServices struct holds all test services
func NewTestServices ¶
Click to show internal directories.
Click to hide internal directories.