예제 #1
0
    def checkBlockLog(blockLog, blockNumsToFind, firstBlockNum=1):
        foundBlockNums = []
        nextBlockNum = firstBlockNum
        previous = 0
        nextIndex = 0
        for block in blockLog:
            blockNum = block["block_num"]
            if nextBlockNum != blockNum:
                Utils.errorExit(
                    "BlockLog should progress to the next block number, expected block number %d but got %d"
                    % (nextBlockNum, blockNum))
            if nextIndex < len(blockNumsToFind
                               ) and blockNum == blockNumsToFind[nextIndex]:
                foundBlockNums.append(True)
                nextIndex += 1
            nextBlockNum += 1
        while nextIndex < len(blockNumsToFind):
            foundBlockNums.append(False)
            if nextIndex < len(blockNumsToFind) - 1:
                assert blockNumsToFind[nextIndex + 1] > blockNumsToFind[
                    nextIndex], "expects passed in array, blockNumsToFind to increase from smallest to largest, %d is less than or equal to %d" % (
                        next, previous)
            nextIndex += 1

        return foundBlockNums
예제 #2
0
def verifyProductionRounds(trans, node, prodsActive, rounds):
    temp = Utils.Debug
    Utils.Debug = False

    prods = []
    for k,v in prodsActive.items():
        if v:
            prods.append(k)
    maxBlocks = (schedulePeriodFactor + 1) * totalProducers * 2 + ((totalProducers*2//3)+1)*2
    blockNum, synced = node.waitActiveSchedule(prods, maxBlocks)
    if not synced:
        blockNum = syncWithShuffle(node, blockNum)

    Utils.Print("Verify %s complete rounds of all producers producing" % (rounds))
    for i in range(0, rounds):
        prodsSeen = {}
        reserveMax = reserve_producers
        for j in range(0, totalProducers):
            reserveMax = validBlockProducer(prodsActive, prodsSeen, blockNum, node, reserveMax)
            blockNum += 1

        # make sure that we have seen all `top_producers` producers
        prodsSeenKeys=prodsSeen.keys()
        if len(prodsSeenKeys)!=top_producers:
            Utils.cmdError("only saw %s producers of expected %i. At blockNum %s only the following producers were seen: %s" % (
                len(prodsSeenKeys), top_producers, blockNum, ",".join(prodsSeenKeys)))
            Utils.errorExit("Failed because of missing block producers")

    Utils.Debug = temp
def validBlockProducer(prodsActive, prodsSeen, blockNum, node):
    blockProducer=node.getBlockProducerByNum(blockNum)
    if blockProducer not in prodsActive:
        Utils.cmdError("unexpected block producer %s at blockNum=%s" % (blockProducer,blockNum))
        Utils.errorExit("Failed because of invalid block producer")
    if not prodsActive[blockProducer]:
        Utils.cmdError("block producer %s for blockNum=%s not elected, belongs to node %s" % (blockProducer, blockNum, ProducerToNode.map[blockProducer]))
        Utils.errorExit("Failed because of incorrect block producer")
    prodsSeen[blockProducer]=True
예제 #4
0
    def findAvailablePort(self):
        for i in range(WalletMgr.__MaxPort):
            port=self.port+i
            if port > WalletMgr.__MaxPort:
                port-=WalletMgr.__MaxPort
            if Utils.arePortsAvailable(port):
                return port
            if Utils.Debug: Utils.Print("Port %d not available for %s" % (port, Utils.GstWalletPath))

        Utils.errorExit("Failed to find free port to use for %s" % (Utils.GstWalletPath))
예제 #5
0
    def create(self, name, accounts=None, exitOnError=True):
        wallet=self.wallets.get(name)
        if wallet is not None:
            if Utils.Debug: Utils.Print("Wallet \"%s\" already exists. Returning same." % name)
            return wallet
        p = re.compile(r'\n\"(\w+)\"\n', re.MULTILINE)
        cmdDesc="wallet create"
        cmd="%s %s %s --name %s --to-console" % (Utils.GstClientPath, self.getArgs(), cmdDesc, name)
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        retStr=None
        maxRetryCount=4
        retryCount=0
        while True:
            try:
                retStr=Utils.checkOutput(cmd.split())
                break
            except subprocess.CalledProcessError as ex:
                retryCount+=1
                if retryCount<maxRetryCount:
                    delay=10
                    pgrepCmd=Utils.pgrepCmd(Utils.GstWalletName)
                    psOut=Utils.checkOutput(pgrepCmd.split())
                    portStatus="N/A"
                    if self.isLocal():
                        if Utils.arePortsAvailable(self.port):
                            portStatus="AVAILABLE"
                        else:
                            portStatus="NOT AVAILABLE"
                    if Utils.Debug: Utils.Print("%s was not accepted, delaying for %d seconds and trying again. port %d is %s. %s - {%s}" % (cmdDesc, delay, self.port, pgrepCmd, psOut))
                    time.sleep(delay)
                    continue

                msg=ex.output.decode("utf-8")
                errorMsg="ERROR: Failed to create wallet - %s. %s" % (name, msg)
                if exitOnError:
                    Utils.errorExit("%s" % (errorMsg))
                Utils.Print("%s" % (errorMsg))
                return None

        m=p.search(retStr)
        if m is None:
            if exitOnError:
                Utils.cmdError("could not create wallet %s" % (name))
                Utils.errorExit("Failed  to create wallet %s" % (name))

            Utils.Print("ERROR: wallet password parser failure")
            return None
        p=m.group(1)
        wallet=Wallet(name, p, self.host, self.port)
        self.wallets[name] = wallet

        if accounts:
            self.importKeys(accounts,wallet)

        return wallet
예제 #6
0
    def launch(self):
        if not self.walletd:
            Utils.Print(
                "ERROR: Wallet Manager wasn't configured to launch kpaybchaind"
            )
            return False

        if self.isLaunched():
            return True

        if self.isLocal():
            self.port = self.findAvailablePort()

        pgrepCmd = Utils.pgrepCmd(Utils.EosWalletName)
        if Utils.Debug:
            portTaken = False
            if self.isLocal():
                if not Utils.arePortsAvailable(self.port):
                    portTaken = True
            psOut = Utils.checkOutput(pgrepCmd.split(), ignoreError=True)
            if psOut or portTaken:
                statusMsg = ""
                if psOut:
                    statusMsg += " %s - {%s}." % (pgrepCmd, psOut)
                if portTaken:
                    statusMsg += " port %d is NOT available." % (self.port)
                Utils.Print(
                    "Launching %s, note similar processes running. %s" %
                    (Utils.EosWalletName, statusMsg))

        cmd = "%s --data-dir %s --config-dir %s --http-server-address=%s:%d --verbose-http-errors" % (
            Utils.EosWalletPath, WalletMgr.__walletDataDir,
            WalletMgr.__walletDataDir, self.host, self.port)
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        with open(WalletMgr.__walletLogOutFile,
                  'w') as sout, open(WalletMgr.__walletLogErrFile,
                                     'w') as serr:
            popen = subprocess.Popen(cmd.split(), stdout=sout, stderr=serr)
            self.__walletPid = popen.pid

        # Give kpaybchaind time to warm up
        time.sleep(2)

        try:
            if Utils.Debug:
                Utils.Print("Checking if %s launched. %s" %
                            (Utils.EosWalletName, pgrepCmd))
            psOut = Utils.checkOutput(pgrepCmd.split())
            if Utils.Debug:
                Utils.Print("Launched %s. {%s}" % (Utils.EosWalletName, psOut))
        except subprocess.CalledProcessError as ex:
            Utils.errorExit("Failed to launch the wallet manager")

        return True
예제 #7
0
 def waitIfNeeded(self, blockNum):
     delta=self.cachedHeadBlockNum-blockNum
     if delta >= 0:
         return
     previousHeadBlockNum=self.cachedHeadBlockNum
     delta=-1*delta
     timeout=(delta+1)/2 + 3 # round up to nearest second and 3 second extra leeway
     self.node.waitForBlock(blockNum, timeout=timeout)
     self.cachedHeadBlockNum=node.getBlockNum()
     if blockNum > self.cachedHeadBlockNum:
         Utils.errorExit("Failed to advance from block number %d to %d in %d seconds.  Only got to block number %d" % (previousHeadBlockNum, blockNum, timeout, self.cachedHeadBlockNum))
예제 #8
0
 def waitForBlock(node,
                  blockNum,
                  blockType=BlockType.head,
                  timeout=None,
                  reportInterval=20):
     if not node.waitForBlock(blockNum,
                              timeout=timeout,
                              blockType=blockType,
                              reportInterval=reportInterval):
         info = node.getInfo()
         headBlockNum = info["head_block_num"]
         libBlockNum = info["last_irreversible_block_num"]
         Utils.errorExit(
             "Failed to get to %s block number %d. Last had head block number %d and lib %d"
             % (blockType, blockNum, headBlockNum, libBlockNum))
예제 #9
0
def validBlockProducer(prodsActive, prodsSeen, blockNum, node, reserveMax):
    blockProducer=node.getBlockProducerByNum(blockNum)
    if blockProducer not in prodsActive:
        Utils.cmdError("unexpected block producer %s at blockNum=%s" % (blockProducer,blockNum))
        Utils.errorExit("Failed because of invalid block producer")
    if not prodsActive[blockProducer]:
        reserveMax -= 1
        if reserveMax < 0:
            Utils.cmdError("block producer %s for blockNum=%s not elected, belongs to node %s" % (blockProducer, blockNum, ProducerToNode.map[blockProducer]))
            Utils.errorExit("Failed because of incorrect block producer")
        else:
            Utils.Print("found reserve block producer %s for blockNum=%s; max:%i" % (blockProducer, blockNum, reserveMax))
        return reserveMax
    if blockProducer in prodsSeen:
        Utils.cmdError("block producer %s for blockNum=%s already produced in this round" % (blockProducer, blockNum))
        Utils.errorExit("Failed because of incorrect block producer")
    prodsSeen[blockProducer]=True
    return reserveMax
예제 #10
0
    subprocess.check_call(['scripts/postgres_control.sh', 'start', reset_statement])
    if not dontKill:
        atexit.register(subprocess.call, ['scripts/postgres_control.sh', 'stop'])

    extraProducerAccounts = Cluster.createAccountKeys(1)
    vltproducerAccount = extraProducerAccounts[0]

    Print("Stand up cluster")
    if cluster.launch(onlyBios=False, pnodes=1, totalNodes=totalNodes,
                    useBiosBootFile=False, onlySetProds=False,
                    extraNodeosArgs=" --blocks-log-stride 20 --max-retained-block-files 3 --logconf %s" % loggingFile,
                    specificExtraNodeosArgs={
                        1:"--plugin eosio::blockvault_client_plugin --block-vault-backend postgresql://postgres:password@localhost"},
                    manualProducerNodeConf={ 1: { 'key': vltproducerAccount, 'names': ['vltproducera']}}) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up eos cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    node0 = cluster.getNode(0)
    node1 = cluster.getNode(1)

    Print("Wait for blocks produced by vltproducera(node 1) seen by node 0")
    assert node0.waitForIrreversibleBlockProducedBy("vltproducera"), "failed to see blocks produced by vltproducera"

    Print("Wait until block 1 is no longer retrievable, this ensures newly joined nodeos cannot sync from net plugin")
    while os.path.exists('var/lib/node_00/archive/blocks-1-20.log'):
        time.sleep(2)

    Print("#################################################################################")
예제 #11
0
testSuccessful=False
killRsnInstances=not dontKill
killWallet=not dontKill

WalletdName="awallet"
ClientName="arisecli"

try:
    TestHelper.printSystemInfo("BEGIN")

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount, onlyBios=False, dontKill=dontKill, pnodes=totalNodes, totalNodes=totalNodes, totalProducers=totalNodes*21, p2pPlugin=p2pPlugin, useBiosBootFile=False) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up ARISEN cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    accounts=cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name="tester111111"
    accounts[1].name="tester222222"
    accounts[2].name="tester333333"
    accounts[3].name="tester444444"
    accounts[4].name="tester555555"

    testWalletName="test"
예제 #12
0
    # ***   setup topogrophy   ***

    # "bridge" shape connects defprocera through defproducerk (in node0) to each other and defproducerl through defproduceru (in node01)
    # and the only connection between those 2 groups is through the bridge node

    if cluster.launch(
            prodCount=prodCount,
            topo="bridge",
            pnodes=totalProducerNodes,
            totalNodes=totalNodes,
            totalProducers=totalProducers,
            useBiosBootFile=False,
            specificExtraNodeosArgs=specificExtraNodeosArgs) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up eos cluster.")
    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    # ***   create accounts to vote in desired producers   ***

    accounts = cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name = "tester111111"
    accounts[1].name = "tester222222"
    accounts[2].name = "tester333333"
    accounts[3].name = "tester444444"
    accounts[4].name = "tester555555"

    testWalletName = "test"
예제 #13
0
ClientName="clroxe"

try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    specificExtraNodroxeArgs={}
    txnGenNodeNum=pnodes  # next node after producer nodes
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum+startedNonProdNodes):
        specificExtraNodroxeArgs[nodeNum]="--plugin roxe::txn_test_gen_plugin --txn-test-gen-account-prefix txntestacct"
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount, onlyBios=False, pnodes=pnodes, totalNodes=totalNodes, totalProducers=pnodes*prodCount,
                      useBiosBootFile=False, specificExtraNodroxeArgs=specificExtraNodroxeArgs, unstartedNodes=catchupCount, loadSystemContract=False) is False:
        Utils.errorExit("Failed to stand up roxe cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    Print("Create txn generate nodes")
    txnGenNodes=[]
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum+startedNonProdNodes):
        txnGenNodes.append(cluster.getNode(nodeNum))

    Print("Create accounts for generated txns")
    txnGenNodes[0].txnGenCreateTestAccounts(cluster.roxeAccount.name, cluster.roxeAccount.activePrivateKey)

    def lib(node):
        return node.getBlockNum(BlockType.lib)
예제 #14
0
CliName = "vectrum-cli"

try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      pnodes=pnodes,
                      totalNodes=totalNodes,
                      totalProducers=pnodes * prodCount,
                      useBiosBootFile=False) is False:
        Utils.errorExit("Failed to stand up VECTRUM cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    biosNode = cluster.biosNode
    node0 = cluster.getNode(0)
    node1 = cluster.getNode(1)

    blockNum = 100
    Print("Wait till we at least get to block %d" % (blockNum))
    node0.waitForBlock(blockNum, blockType=BlockType.lib)
    info = node0.getInfo(exitOnError=True)
    headBlockNum = info["head_block_num"]
    lib = info["last_irreversible_block_num"]
예제 #15
0
try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      pnodes=totalNodes,
                      totalNodes=totalNodes,
                      totalProducers=totalNodes * 21,
                      p2pPlugin=p2pPlugin,
                      useBiosBootFile=False) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up DA-DAPPS cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    accounts = cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name = "tester111111"
    accounts[1].name = "tester222222"
    accounts[2].name = "tester333333"
    accounts[3].name = "tester444444"
    accounts[4].name = "tester555555"

    testWalletName = "test"
예제 #16
0
    specificExtraNodpicoArgs = {}
    txnGenNodeNum = pnodes  # next node after producer nodes
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum + startedNonProdNodes):
        specificExtraNodpicoArgs[
            nodeNum] = "--plugin picoio::txn_test_gen_plugin --txn-test-gen-account-prefix txntestacct"
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      pnodes=pnodes,
                      totalNodes=totalNodes,
                      totalProducers=pnodes * prodCount,
                      useBiosBootFile=False,
                      specificExtraNodpicoArgs=specificExtraNodpicoArgs,
                      unstartedNodes=catchupCount,
                      loadSystemContract=False) is False:
        Utils.errorExit("Failed to stand up pico cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    Print("Create txn generate nodes")
    txnGenNodes = []
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum + startedNonProdNodes):
        txnGenNodes.append(cluster.getNode(nodeNum))

    Print("Create accounts for generated txns")
    txnGenNodes[0].txnGenCreateTestAccounts(
        cluster.picoioAccount.name, cluster.picoioAccount.activePrivateKey)

    def lib(node):
        return node.getBlockNum(BlockType.lib)
예제 #17
0
try:
    TestHelper.printSystemInfo("BEGIN")

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      dontKill=dontKill,
                      pnodes=totalNodes,
                      totalNodes=totalNodes,
                      totalProducers=totalNodes * 21,
                      p2pPlugin=p2pPlugin,
                      useBiosBootFile=False) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up enu cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    accounts = cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name = "tester111111"
    accounts[1].name = "tester222222"
    accounts[2].name = "tester333333"
    accounts[3].name = "tester444444"
    accounts[4].name = "tester555555"

    testWalletName = "test"
예제 #18
0
def analyzeBPs(bps0, bps1, expectDivergence):
    start = 0
    index = None
    length = len(bps0)
    firstDivergence = None
    errorInDivergence = False
    analysysPass = 0
    bpsStr = None
    bpsStr0 = None
    bpsStr1 = None
    while start < length:
        analysysPass += 1
        bpsStr = None
        for i in range(start, length):
            bp0 = bps0[i]
            bp1 = bps1[i]
            if bpsStr is None:
                bpsStr = ""
            else:
                bpsStr += ", "
            blockNum0 = bp0["blockNum"]
            prod0 = bp0["prod"]
            blockNum1 = bp1["blockNum"]
            prod1 = bp1["prod"]
            numDiff = True if blockNum0 != blockNum1 else False
            prodDiff = True if prod0 != prod1 else False
            if numDiff or prodDiff:
                index = i
                if firstDivergence is None:
                    firstDivergence = min(blockNum0, blockNum1)
                if not expectDivergence:
                    errorInDivergence = True
                break
            bpsStr += str(blockNum0) + "->" + prod0

        if index is None:
            if expectDivergence:
                errorInDivergence = True
                break
            return None

        bpsStr0 = None
        bpsStr2 = None
        start = length
        for i in range(index, length):
            if bpsStr0 is None:
                bpsStr0 = ""
                bpsStr1 = ""
            else:
                bpsStr0 += ", "
                bpsStr1 += ", "
            bp0 = bps0[i]
            bp1 = bps1[i]
            blockNum0 = bp0["blockNum"]
            prod0 = bp0["prod"]
            blockNum1 = bp1["blockNum"]
            prod1 = bp1["prod"]
            numDiff = "*" if blockNum0 != blockNum1 else ""
            prodDiff = "*" if prod0 != prod1 else ""
            if not numDiff and not prodDiff:
                start = i
                index = None
                if expectDivergence:
                    errorInDivergence = True
                break
            bpsStr0 += str(blockNum0) + numDiff + "->" + prod0 + prodDiff
            bpsStr1 += str(blockNum1) + numDiff + "->" + prod1 + prodDiff
        if errorInDivergence:
            break

    if errorInDivergence:
        msg = "Failed analyzing block producers - "
        if expectDivergence:
            msg += "nodes indicate different block producers for the same blocks, but did not expect them to diverge."
        else:
            msg += "did not expect nodes to indicate different block producers for the same blocks."
        msg += "\n  Matching Blocks= %s \n  Diverging branch node0= %s \n  Diverging branch node1= %s" % (
            bpsStr, bpsStr0, bpsStr1)
        Utils.errorExit(msg)

    return firstDivergence
예제 #19
0
    # ***   setup topogrophy   ***

    # "bridge" shape connects defprocera through defproducerk (in node0) to each other and defproducerl through defproduceru (in node01)
    # and the only connection between those 2 groups is through the bridge node
    if cluster.launch(
            prodCount=2,
            topo="bridge",
            pnodes=totalProducerNodes,
            totalNodes=totalNodes,
            totalProducers=totalProducers,
            useBiosBootFile=False,
            specificExtraNodebitconchArgs=specificExtraNodebitconchArgs,
            onlySetProds=True) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up bitconch cluster.")
    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    # ***   identify each node (producers and non-producing node)   ***

    nonProdNode = None
    prodNodes = []
    producers = []
    for i in range(0, totalNodes):
        node = cluster.getNode(i)
        node.producers = Cluster.parseProducers(i)
        numProducers = len(node.producers)
        Print("node has producers=%s" % (node.producers))
        if numProducers == 0:
            if nonProdNode is None:
    txnGenNodeNum = pnodes  # next node after producer nodes
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum + startedNonProdNodes):
        specificExtraNodebitconchArgs[
            nodeNum] = "--plugin bitconchio::txn_test_gen_plugin --txn-test-gen-account-prefix txntestacct"
    Print("Stand up cluster")
    if cluster.launch(
            prodCount=prodCount,
            onlyBios=False,
            pnodes=pnodes,
            totalNodes=totalNodes,
            totalProducers=pnodes * prodCount,
            useBiosBootFile=False,
            specificExtraNodebitconchArgs=specificExtraNodebitconchArgs,
            unstartedNodes=catchupCount,
            loadSystemContract=False) is False:
        Utils.errorExit("Failed to stand up bitconch cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    Print("Create txn generate nodes")
    txnGenNodes = []
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum + startedNonProdNodes):
        txnGenNodes.append(cluster.getNode(nodeNum))

    Print("Create accounts for generated txns")
    txnGenNodes[0].txnGenCreateTestAccounts(
        cluster.bitconchioAccount.name,
        cluster.bitconchioAccount.activePrivateKey)

    def lib(node):
killBitconchInstances=not dontKill
killWallet=not dontKill

WalletdName=Utils.BitconchWalletName
ClientName="clbitconch"

try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount, onlyBios=False, pnodes=totalNodes, totalNodes=totalNodes, totalProducers=totalNodes*21, useBiosBootFile=False) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up bitconch cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    accounts=cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name="tester111111"
    accounts[1].name="tester222222"
    accounts[2].name="tester333333"
    accounts[3].name="tester444444"
    accounts[4].name="tester555555"

    testWalletName="test"
예제 #22
0
    assert(b'Subcommands:' in help_text)


def cli11_bugfix_test():
    completed_process = subprocess.run(
        ['./programs/cleos/cleos', '-u', 'http://localhost:0/',
         'push', 'action', 'accout', 'action', '["data"]', '-p', 'wallet'],
        check=False,
        stderr=subprocess.PIPE)

    # The above command must fail because there is no server running
    # on localhost:0
    assert(completed_process.returncode != 0)

    # Make sure that the command failed because of the connection error,
    # not the command line parsing error.
    assert(b'Failed to connect to nodeos' in completed_process.stderr)


try:
    nodeos_help_test()

    cleos_help_test(['--help'])
    cleos_help_test(['system', '--help'])
    cleos_help_test(['version', '--help'])
    cleos_help_test(['wallet', '--help'])

    cli11_bugfix_test()
except Exception as e:
    Utils.errorExit("cli_test: " + str(e))
예제 #23
0
try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      pnodes=totalNodes,
                      totalNodes=totalNodes,
                      totalProducers=totalNodes * 21,
                      useBiosBootFile=False) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up roxe cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    accounts = cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name = "tester111111"
    accounts[1].name = "tester222222"
    accounts[2].name = "tester333333"
    accounts[3].name = "tester444444"
    accounts[4].name = "tester555555"

    testWalletName = "test"
예제 #24
0
    TestHelper.printSystemInfo("BEGIN")

    cluster.setWalletMgr(walletMgr)
    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    specificExtraNodeosArgs={}
    # non-producing nodes are at the end of the cluster's nodes, so reserving the last one for state_history_plugin
    shipNodeNum = totalNodes - 1
    specificExtraNodeosArgs[shipNodeNum]="--plugin eosio::state_history_plugin --disable-replay-opts --sync-fetch-span 200 --plugin eosio::net_api_plugin "

    if cluster.launch(pnodes=totalProducerNodes,
                      totalNodes=totalNodes, totalProducers=totalProducers,
                      useBiosBootFile=False, specificExtraNodeosArgs=specificExtraNodeosArgs) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up eos cluster.")

    # ***   identify each node (producers and non-producing node)   ***

    shipNode = cluster.getNode(shipNodeNum)
    prodNode = cluster.getNode(0)

    #verify nodes are in sync and advancing
    cluster.waitOnClusterSync(blockAdvancing=5)
    Print("Cluster in Sync")

    javascriptClient = "tests/ship_client.js"
    cmd = "node %s --num-requests %d" % (javascriptClient, args.num_requests)
    if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
    clients = []
    files = []
예제 #25
0
    # "bridge" shape connects defprocera through defproducerk (in node0) to each other and defproducerl through defproduceru (in node01)
    # and the only connection between those 2 groups is through the bridge node

    if cluster.launch(
            prodCount=prodCount,
            onlyBios=False,
            topo="bridge",
            pnodes=totalProducerNodes,
            totalNodes=totalNodes,
            totalProducers=totalProducers,
            p2pPlugin=p2pPlugin,
            useBiosBootFile=False,
            specificExtraSnaxnodeArgs=specificExtraSnaxnodeArgs) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up snax cluster.")
    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    # ***   create accounts to vote in desired producers   ***

    accounts = cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name = "tester111111"
    accounts[1].name = "tester222222"
    accounts[2].name = "tester333333"
    accounts[3].name = "tester444444"
    accounts[4].name = "tester555555"

    testWalletName = "test"
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      pnodes=totalNodes,
                      totalNodes=totalNodes,
                      totalProducers=totalNodes,
                      useBiosBootFile=False,
                      onlySetProds=True,
                      sharedProducers=1) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up roxe cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    node0 = cluster.getNode(0)
    node1 = cluster.getNode(1)
    node2 = cluster.getNode(2)

    node = node0
    numprod = totalNodes + 1

    trans = None
    prodsActive = {}
    prodsActive["shrproducera"] = True
    prodsActive["defproducera"] = True
예제 #27
0
try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      pnodes=totalNodes,
                      totalNodes=totalNodes,
                      totalProducers=totalNodes * 21,
                      useBiosBootFile=False) is False:
        Utils.cmdError("launcher")
        Utils.errorExit("Failed to stand up VECTRUM cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    accounts = cluster.createAccountKeys(5)
    if accounts is None:
        Utils.errorExit("FAILURE - create keys")
    accounts[0].name = "tester111111"
    accounts[1].name = "tester222222"
    accounts[2].name = "tester333333"
    accounts[3].name = "tester444444"
    accounts[4].name = "tester555555"

    testWalletName = "test"
예제 #28
0
ClientName="clmtp"

try:
    TestHelper.printSystemInfo("BEGIN")
    cluster.setWalletMgr(walletMgr)

    cluster.killall(allInstances=killAll)
    cluster.cleanup()
    specificExtraNodmtpArgs={}
    txnGenNodeNum=pnodes  # next node after producer nodes
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum+startedNonProdNodes):
        specificExtraNodmtpArgs[nodeNum]="--plugin mtpio::txn_test_gen_plugin --txn-test-gen-account-prefix txntestacct"
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount, onlyBios=False, pnodes=pnodes, totalNodes=totalNodes, totalProducers=pnodes*prodCount,
                      useBiosBootFile=False, specificExtraNodmtpArgs=specificExtraNodmtpArgs, unstartedNodes=catchupCount, loadSystemContract=False) is False:
        Utils.errorExit("Failed to stand up mtp cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    Print("Create txn generate nodes")
    txnGenNodes=[]
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum+startedNonProdNodes):
        txnGenNodes.append(cluster.getNode(nodeNum))

    Print("Create accounts for generated txns")
    txnGenNodes[0].txnGenCreateTestAccounts(cluster.mtpioAccount.name, cluster.mtpioAccount.activePrivateKey)

    def lib(node):
        return node.getBlockNum(BlockType.lib)
예제 #29
0
def verifyProductionRounds(trans, node, prodsActive, rounds):
    blockNum = node.getNextCleanProductionCycle(trans)
    Utils.Print("Validating blockNum=%s" % (blockNum))

    temp = Utils.Debug
    Utils.Debug = False
    Utils.Print("FIND VALID BLOCK PRODUCER")
    blockProducer = node.getBlockProducerByNum(blockNum)
    lastBlockProducer = blockProducer
    adjust = False
    while not isValidBlockProducer(prodsActive, blockNum, node):
        adjust = True
        blockProducer = node.getBlockProducerByNum(blockNum)
        if lastBlockProducer != blockProducer:
            Utils.Print(
                "blockProducer=%s for blockNum=%s is for node=%s" %
                (blockProducer, blockNum, ProducerToNode.map[blockProducer]))
        lastBlockProducer = blockProducer
        blockNum += 1

    Utils.Print("VALID BLOCK PRODUCER")
    saw = 0
    sawHigh = 0
    startingFrom = blockNum
    doPrint = 0
    invalidCount = 0
    while adjust:
        invalidCount += 1
        if lastBlockProducer == blockProducer:
            saw += 1
        else:
            if saw >= 12:
                startingFrom = blockNum
                if saw > 12:
                    Utils.Print(
                        "ERROR!!!!!!!!!!!!!!      saw=%s, blockProducer=%s, blockNum=%s"
                        % (saw, blockProducer, blockNum))
                break
            else:
                if saw > sawHigh:
                    sawHigh = saw
                    Utils.Print("sawHigh=%s" % (sawHigh))
                if doPrint < 5:
                    doPrint += 1
                    Utils.Print("saw=%s, blockProducer=%s, blockNum=%s" %
                                (saw, blockProducer, blockNum))
                lastBlockProducer = blockProducer
                saw = 1
        blockProducer = node.getBlockProducerByNum(blockNum)
        blockNum += 1

    if adjust:
        blockNum -= 1

    Utils.Print("ADJUSTED %s blocks" % (invalidCount - 1))

    prodsSeen = None
    Utils.Print("Verify %s complete rounds of all producers producing" %
                (rounds))
    for i in range(0, rounds):
        prodsSeen = {}
        lastBlockProducer = None
        for j in range(0, 21):
            # each new set of 12 blocks should have a different blockProducer
            if lastBlockProducer is not None and lastBlockProducer == node.getBlockProducerByNum(
                    blockNum):
                Utils.cmdError(
                    "expected blockNum %s to be produced by any of the valid producers except %s"
                    % (blockNum, lastBlockProducer))
                Utils.errorExit(
                    "Failed because of incorrect block producer order")

            # make sure that the next set of 12 blocks all have the same blockProducer
            lastBlockProducer = node.getBlockProducerByNum(blockNum)
            for k in range(0, 12):
                validBlockProducer(prodsActive, prodsSeen, blockNum, node1)
                blockProducer = node.getBlockProducerByNum(blockNum)
                if lastBlockProducer != blockProducer:
                    printStr = ""
                    newBlockNum = blockNum - 18
                    for l in range(0, 36):
                        printStr += "%s" % (newBlockNum)
                        printStr += ":"
                        newBlockProducer = node.getBlockProducerByNum(
                            newBlockNum)
                        printStr += "%s" % (newBlockProducer)
                        printStr += "  "
                        newBlockNum += 1
                    Utils.cmdError(
                        "expected blockNum %s (started from %s) to be produced by %s, but produded by %s: round=%s, prod slot=%s, prod num=%s - %s"
                        % (blockNum, startingFrom, lastBlockProducer,
                           blockProducer, i, j, k, printStr))
                    Utils.errorExit(
                        "Failed because of incorrect block producer order")
                blockNum += 1

    # make sure that we have seen all 21 producers
    prodsSeenKeys = prodsSeen.keys()
    if len(prodsSeenKeys) != 21:
        Utils.cmdError(
            "only saw %s producers of expected 21. At blockNum %s only the following producers were seen: %s"
            % (len(prodsSeenKeys), blockNum, ",".join(prodsSeenKeys)))
        Utils.errorExit("Failed because of missing block producers")

    Utils.Debug = temp
예제 #30
0
    specificExtraNodeArgs = {}
    txnGenNodeNum = pnodes  # next node after producer nodes
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum + startedNonProdNodes):
        specificExtraNodeArgs[
            nodeNum] = "--plugin eosio::txn_test_gen_plugin --txn-test-gen-account-prefix txntestacct"
    Print("Stand up cluster")
    if cluster.launch(prodCount=prodCount,
                      onlyBios=False,
                      pnodes=pnodes,
                      totalNodes=totalNodes,
                      totalProducers=pnodes * prodCount,
                      useBiosBootFile=False,
                      specificExtraNodeArgs=specificExtraNodeArgs,
                      unstartedNodes=catchupCount,
                      loadSystemContract=False) is False:
        Utils.errorExit("Failed to stand up VECTRUM cluster.")

    Print("Validating system accounts after bootstrap")
    cluster.validateAccounts(None)

    Print("Create txn generate nodes")
    txnGenNodes = []
    for nodeNum in range(txnGenNodeNum, txnGenNodeNum + startedNonProdNodes):
        txnGenNodes.append(cluster.getNode(nodeNum))

    Print("Create accounts for generated txns")
    txnGenNodes[0].txnGenCreateTestAccounts(
        cluster.eosioAccount.name, cluster.eosioAccount.activePrivateKey)

    def lib(node):
        return node.getBlockNum(BlockType.lib)