Documentation ¶
Index ¶
- Constants
- Variables
- func AddCandidateWithStake(t *testing.T, transactor *transactor.Transactor, ethAddr mainchain.Addr, ...)
- func AddValidators(t *testing.T, transactor *transactor.Transactor, ethkss, valaccts []string, ...)
- func CheckCandidate(t *testing.T, transactor *transactor.Transactor, ethAddr mainchain.Addr, ...)
- func CheckDelegator(t *testing.T, transactor *transactor.Transactor, ...)
- func CheckValidator(t *testing.T, transactor *transactor.Transactor, valacct string, ...)
- func CheckValidatorNum(t *testing.T, transactor *transactor.Transactor, expNum int)
- func CheckValidatorStatus(t *testing.T, transactor *transactor.Transactor, valacct string, ...)
- func ChkErr(err error, msg string)
- func ConfirmUnbondedCandidate(auth *bind.TransactOpts, candidateAddr mainchain.Addr) error
- func DelegateStake(fromAuth *bind.TransactOpts, toEthAddress mainchain.Addr, amt *big.Int) error
- func DeployCommand() *cobra.Command
- func DeployDPoSSGNContracts(sgnParams *SGNParams) (*types.Transaction, mainchain.Addr, mainchain.Addr)
- func DeployERC20Contract() (*types.Transaction, mainchain.Addr, *mainchain.ERC20)
- func DeployLedgerContract() mainchain.Addr
- func FundAddrsETH(amt string, recipients []mainchain.Addr) error
- func FundAddrsErc20(erc20Addr mainchain.Addr, addrs []mainchain.Addr, amount string) error
- func GetAuth(ksfile string) (addr mainchain.Addr, auth *bind.TransactOpts, err error)
- func GetEthPrivateKey(ksfile string) (*ecdsa.PrivateKey, error)
- func InitializeCandidate(auth *bind.TransactOpts, sgnAddr sdk.AccAddress, minSelfStake *big.Int, ...) error
- func IntendWithdraw(auth *bind.TransactOpts, candidateAddr mainchain.Addr, amt *big.Int) error
- func LogBlkNum(conn *ethclient.Client)
- func NewTestTransactor(t *testing.T, ...) *transactor.Transactor
- func OpenChannel(peer0, peer1 *TestEthClient) (channelId [32]byte, err error)
- func ParseGatewayQueryResponse(resp *http.Response, cdc *codec.Codec) (json.RawMessage, error)
- func PrepareSignedSimplexState(seqNum uint64, channelId, peerFrom []byte, peer0, peer1 *TestEthClient) (*chain.SignedSimplexState, error)
- func QueryPenalty(cliCtx context.CLIContext, nonce uint64, sigCount int) (penalty slash.Penalty, err error)
- func QueryProposal(cliCtx context.CLIContext, proposalID uint64, status govtypes.ProposalStatus) (proposal govtypes.Proposal, err error)
- func SetContracts(dposAddr, sgnAddr, ledgerAddr mainchain.Addr) error
- func SetEthBaseKs(prefix string)
- func SetupE2eProfile()
- func SetupEthClients()
- func SetupMainchain()
- func SetupNewSGNEnv(sgnParams *SGNParams, manual bool)
- func SetupSidechain()
- func SleepBlocksWithLog(count time.Duration, waitFor string)
- func SleepWithLog(second time.Duration, waitFor string)
- func TearDown(tokill []Killable)
- func WaitMinedWithChk(ctx context.Context, conn *ethclient.Client, tx *ethtypes.Transaction, ...)
- type Killable
- type SGNParams
- type TestEthClient
- type TestProfile
Constants ¶
View Source
const ( // outPathPrefix is the path prefix for all output from e2e (incl. chain data, binaries etc) // the code will append epoch second to this and create the folder // the folder will be deleted after test ends successfully OutRootDirPrefix = "/tmp/celer_e2e_" EnvDir = "../../env" LocalGeth = "http://127.0.0.1:8545" SgnChainID = "sgntest" SgnPassphrase = "12341234" SgnGasPrice = "" SgnCLIAddr = "sgn15h2geedmud70gvpajdwpcaxfs4qcrw4z92zlqe" SgnNodeURI = "tcp://localhost:26657" SgnBlockInterval = 1 DefaultTimeout = 60 * time.Second BlockDelay = 0 PollingInterval = time.Second DisputeTimeout = 100 RetryPeriod = 300 * time.Millisecond RetryLimit = 100 )
Variables ¶
View Source
var ( SgnCLIHomes = [...]string{ "../../../docker-volumes/node0/sgncli", "../../../docker-volumes/node1/sgncli", "../../../docker-volumes/node2/sgncli", "../../../docker-volumes/node3/sgncli", } // validators ValAccounts = [...]string{ "sgn1qehw7sn3u3nhnjeqk8kjccj263rq5fv002l5fk", "sgn1egtta7su5jxjahtw56pe07qerz4lwvrlttac6y", "sgn19q9usqmjcmx8vynynfl5tj5n2k22gc5f6wjvd7", "sgn1rjr9uaewus3qh4vs4sqdkdvepwyxq8ql84udfh", } ValEthKs = [...]string{ "../../keys/vethks0.json", "../../keys/vethks1.json", "../../keys/vethks2.json", "../../keys/vethks3.json", } ValEthAddrs = [...]string{ "00078b31fa8b29a76bce074b5ea0d515a6aeaee7", "0015f5863ddc59ab6610d7b6d73b2eacd43e6b7e", "00290a43e5b2b151d530845b2d5a818240bc7c70", "003ea363bccfd7d14285a34a6b1deb862df0bc84", } // delegators DelEthKs = [...]string{ "../../keys/dethks0.json", "../../keys/dethks1.json", "../../keys/dethks2.json", "../../keys/dethks3.json", } DelEthAddrs = [...]string{ "d0f2596d700c9bd4d605c938e586ec67b01c7364", "d199de50946314ca94b8e967a18d9c1ce5cc9251", "d290938754df5eecf95f05ebd801c50a43c3231f", "d3f716da96b893d4bcefa489f65e4b3e9a3dd3e6", } // state channel clients ClientEthKs = [...]string{ "../../keys/cethks0.json", "../../keys/cethks1.json", } ClientEthAddrs = [...]string{ "c06fdd796e140aee53de5111607e8ded93ebdca3", "c1699e89639adda8f39faefc0fc294ee5c3b462d", } // used by local manual tests SgnNodeURIs = [...]string{ "tcp://localhost:26657", "tcp://localhost:26660", "tcp://localhost:26662", "tcp://localhost:26664", } )
View Source
var ( EthClient *ethclient.Client EtherBaseAuth *bind.TransactOpts DposContract *mainchain.DPoS SgnContract *mainchain.SGN LedgerContract *mainchain.CelerLedger Client0 *TestEthClient Client1 *TestEthClient )
Functions ¶
func AddCandidateWithStake ¶
func AddValidators ¶
func AddValidators(t *testing.T, transactor *transactor.Transactor, ethkss, valaccts []string, amts []*big.Int)
func CheckCandidate ¶
func CheckCandidate(t *testing.T, transactor *transactor.Transactor, ethAddr mainchain.Addr, valacct string, expAmt *big.Int)
func CheckDelegator ¶
func CheckDelegator(t *testing.T, transactor *transactor.Transactor, validatorAddr, delegatorAddr mainchain.Addr, expAmt *big.Int)
func CheckValidator ¶
func CheckValidator(t *testing.T, transactor *transactor.Transactor, valacct string, expAmt *big.Int, expStatus sdk.BondStatus)
func CheckValidatorNum ¶
func CheckValidatorNum(t *testing.T, transactor *transactor.Transactor, expNum int)
func CheckValidatorStatus ¶
func CheckValidatorStatus(t *testing.T, transactor *transactor.Transactor, valacct string, expStatus sdk.BondStatus)
func ConfirmUnbondedCandidate ¶
func ConfirmUnbondedCandidate(auth *bind.TransactOpts, candidateAddr mainchain.Addr) error
func DelegateStake ¶
func DeployCommand ¶
func DeployDPoSSGNContracts ¶
func DeployERC20Contract ¶
func DeployLedgerContract ¶
func FundAddrsErc20 ¶
func GetEthPrivateKey ¶
func GetEthPrivateKey(ksfile string) (*ecdsa.PrivateKey, error)
func InitializeCandidate ¶
func IntendWithdraw ¶
func NewTestTransactor ¶ added in v0.2.3
func NewTestTransactor(t *testing.T, sgnCLIHome, sgnChainID, sgnNodeURI, sgnValAcct, sgnPassphrase string) *transactor.Transactor
func OpenChannel ¶
func OpenChannel(peer0, peer1 *TestEthClient) (channelId [32]byte, err error)
func PrepareSignedSimplexState ¶
func PrepareSignedSimplexState(seqNum uint64, channelId, peerFrom []byte, peer0, peer1 *TestEthClient) (*chain.SignedSimplexState, error)
func QueryPenalty ¶
func QueryProposal ¶
func QueryProposal(cliCtx context.CLIContext, proposalID uint64, status govtypes.ProposalStatus) (proposal govtypes.Proposal, err error)
func SetContracts ¶
func SetEthBaseKs ¶
func SetEthBaseKs(prefix string)
func SetupE2eProfile ¶
func SetupE2eProfile()
func SetupEthClients ¶
func SetupEthClients()
SetupEthClients sets Client part (Client) and Auth part (PrivateKey, Address, Auth) Contracts part (DPoSAddress, DPoS, SGNAddress, SGN, LedgerAddress, Ledger) is set after deploying DPoS and SGN contracts in SetupNewSGNEnv()
func SetupMainchain ¶
func SetupMainchain()
func SetupNewSGNEnv ¶
func SetupSidechain ¶ added in v0.2.3
func SetupSidechain()
func SleepBlocksWithLog ¶
func SleepWithLog ¶
Types ¶
type SGNParams ¶
type SGNParams struct { CelrAddr mainchain.Addr GovernProposalDeposit *big.Int GovernVoteTimeout *big.Int SlashTimeout *big.Int MinValidatorNum *big.Int MaxValidatorNum *big.Int MinStakingPool *big.Int AdvanceNoticePeriod *big.Int // TODO: rename to DposGoLiveTimeout SidechainGoLiveTimeout *big.Int StartGateway bool }
type TestEthClient ¶
func SetupTestEthClient ¶
func SetupTestEthClient(ksfile string) (*TestEthClient, error)
type TestProfile ¶
type TestProfile struct { DisputeTimeout uint64 LedgerAddr mainchain.Addr DPoSAddr mainchain.Addr SGNAddr mainchain.Addr CelrAddr mainchain.Addr CelrContract *mainchain.ERC20 }
var ( // E2eProfile will be updated and used for each test // not support parallel tests E2eProfile *TestProfile )
runtime variables, will be initialized before each test
Click to show internal directories.
Click to hide internal directories.