Exemple #1
0
    def createInitializeAccount(self, account, creatorAccount, stakedDeposit=1000, waitForTransBlock=False, stakeNet=100, stakeCPU=100, buyRAM=100):
        cmd='%s %s system newaccount -j %s %s %s %s --stake-net "%s %s" --stake-cpu "%s %s" --buy-ram "%s %s"' % (
            Utils.EosClientPath, self.endpointArgs, creatorAccount.name, account.name,
            account.ownerPublicKey, account.activePublicKey,
            stakeNet, CORE_SYMBOL, stakeCPU, CORE_SYMBOL, buyRAM, CORE_SYMBOL)

        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd)
            transId=Node.getTransId(trans)
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during account creation. %s" % (msg))
            return None

        if stakedDeposit > 0:
            self.waitForTransInBlock(transId) # seems like account creation needs to be finalized before transfer can happen
            trans = self.transferFunds(creatorAccount, account, Node.currencyIntToStr(stakedDeposit, CORE_SYMBOL), "init")
            transId=Node.getTransId(trans)

        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None

        return trans
Exemple #2
0
    def publishContract(self, account, contractDir, wastFile, abiFile, waitForTransBlock=False, shouldFail=False):
        cmd="%s %s -v set contract -j %s %s" % (Utils.EosClientPath, self.endpointArgs, account, contractDir)
        cmd += "" if wastFile is None else (" "+ wastFile)
        cmd += "" if abiFile is None else (" " + abiFile)
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd, trace=False)
        except subprocess.CalledProcessError as ex:
            if not shouldFail:
                msg=ex.output.decode("utf-8")
                Utils.Print("ERROR: Exception during code hash retrieval. %s" % (msg))
                return None
            else:
                retMap={}
                retMap["returncode"]=ex.returncode
                retMap["cmd"]=ex.cmd
                retMap["output"]=ex.output
                # commented below as they are available only in Python3.5 and above
                # retMap["stdout"]=ex.stdout
                # retMap["stderr"]=ex.stderr
                return retMap

        if shouldFail:
            Utils.Print("ERROR: The publish contract did not fail as expected.")
            return None

        Node.validateTransaction(trans)
        transId=Node.getTransId(trans)
        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None
        return trans
Exemple #3
0
    def createAccount(self, account, creatorAccount, stakedDeposit=1000, waitForTransBlock=False):
        """Create account and return creation transactions. Return transaction json object.
        waitForTransBlock: wait on creation transaction id to appear in a block."""
        cmd="%s %s create account -j %s %s %s %s" % (
            Utils.EosClientPath, self.endpointArgs, creatorAccount.name, account.name,
            account.ownerPublicKey, account.activePublicKey)

        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd)
            transId=Node.getTransId(trans)
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during account creation. %s" % (msg))
            return None

        if stakedDeposit > 0:
            self.waitForTransInBlock(transId) # seems like account creation needs to be finlized before transfer can happen
            trans = self.transferFunds(creatorAccount, account, "%0.04f %s" % (stakedDeposit/10000, CORE_SYMBOL), "init")
            transId=Node.getTransId(trans)

        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None

        return trans
Exemple #4
0
    def getBlock(self, blockNum, silentErrors=False):
        """Given a blockId will return block details."""
        assert(isinstance(blockNum, int))
        if not self.enableMongo:
            cmd="%s %s get block %d" % (Utils.EosClientPath, self.endpointArgs, blockNum)
            if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
            try:
                block=Utils.runCmdReturnJson(cmd)
                return block
            except subprocess.CalledProcessError as ex:
                if not silentErrors:
                    msg=ex.output.decode("utf-8")
                    Utils.Print("ERROR: Exception during get block. %s" % (msg))
                return None
        else:
            cmd="%s %s" % (Utils.MongoPath, self.mongoEndpointArgs)
            subcommand='db.blocks.findOne( { "block_num": %d } )' % (blockNum)
            if Utils.Debug: Utils.Print("cmd: echo '%s' | %s" % (subcommand, cmd))
            try:
                block=Node.runMongoCmdReturnJson(cmd.split(), subcommand)
                if block is not None:
                    return block
            except subprocess.CalledProcessError as ex:
                if not silentErrors:
                    msg=ex.output.decode("utf-8")
                    Utils.Print("ERROR: Exception during get db node get block. %s" % (msg))
                return None

        return None
Exemple #5
0
 def getTable(self, contract, scope, table):
     cmd="%s %s get table %s %s %s" % (Utils.EosClientPath, self.endpointArgs, contract, scope, table)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg=ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during table retrieval. %s" % (msg))
         return None
Exemple #6
0
 def getServants(self, name):
     cmd="%s %s get servants %s" % (Utils.EosClientPath, self.endpointArgs, name)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg=ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during servants retrieval. %s" % (msg))
         return None
Exemple #7
0
 def getAccountsByKey(self, key):
     cmd="%s %s get accounts %s" % (Utils.EosClientPath, self.endpointArgs, key)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg=ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during accounts by key retrieval. %s" % (msg))
         return None
Exemple #8
0
 def getTable(self, contract, scope, table):
     cmd = "%s %s get table %s %s %s" % (
         Utils.EosClientPath, self.endpointArgs, contract, scope, table)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans = Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg = ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during table retrieval. %s" % (msg))
         return None
Exemple #9
0
 def getEnuAccount(self, name):
     assert(isinstance(name, str))
     cmd="%s %s get account -j %s" % (Utils.EnuClientPath, self.endpointArgs, name)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg=ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during get account. %s" % (msg))
         return None
Exemple #10
0
 def getInfo(self, silentErrors=False):
     cmd="%s %s get info" % (Utils.AacClientPath, self.endpointArgs)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd, silentErrors=silentErrors)
         return trans
     except subprocess.CalledProcessError as ex:
         if not silentErrors:
             msg=ex.output.decode("utf-8")
             Utils.Print("ERROR: Exception during get info. %s" % (msg))
         return None
Exemple #11
0
 def getInfo(self, silentErrors=False):
     cmd="%s %s get info" % (Utils.EosClientPath, self.endpointArgs)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd, silentErrors=silentErrors)
         return trans
     except subprocess.CalledProcessError as ex:
         if not silentErrors:
             msg=ex.output.decode("utf-8")
             Utils.Print("ERROR: Exception during get info. %s" % (msg))
         return None
Exemple #12
0
 def getServants(self, name):
     cmd = "%s %s get servants %s" % (Utils.EosClientPath,
                                      self.endpointArgs, name)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans = Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg = ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during servants retrieval. %s" %
                     (msg))
         return None
Exemple #13
0
 def getAccountsByKey(self, key):
     cmd = "%s %s get accounts %s" % (Utils.EosClientPath,
                                      self.endpointArgs, key)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans = Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg = ex.output.decode("utf-8")
         Utils.Print(
             "ERROR: Exception during accounts by key retrieval. %s" %
             (msg))
         return None
Exemple #14
0
 def getEosAccount(self, name):
     assert(isinstance(name, str))
     if not self.enableMongo:
         cmd="%s %s get account -j %s" % (Utils.EosClientPath, self.endpointArgs, name)
         if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
         try:
             trans=Utils.runCmdReturnJson(cmd)
             return trans
         except subprocess.CalledProcessError as ex:
             msg=ex.output.decode("utf-8")
             Utils.Print("ERROR: Exception during get account. %s" % (msg))
             return None
     else:
         return self.getEosAccountFromDb(name)
Exemple #15
0
    def processCmd(self, cmd, cmdDesc, waitForTransBlock):
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd)
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during %s. %s" % (cmdDesc, msg))
            return None

        transId=Node.getTransId(trans)
        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None
        return trans
Exemple #16
0
    def processCmd(self, cmd, cmdDesc, waitForTransBlock):
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd)
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during %s. %s" % (cmdDesc, msg))
            return None

        transId=Node.getTransId(trans)
        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None
        return trans
Exemple #17
0
    def getActions(self, account, pos=-1, offset=-1):
        assert(isinstance(account, Account))
        assert(isinstance(pos, int))
        assert(isinstance(offset, int))

        cmd="%s %s get actions -j %s %d %d" % (Utils.EnuClientPath, self.endpointArgs, account.name, pos, offset)
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        try:
            actions=Utils.runCmdReturnJson(cmd)
            return actions
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during actions by account retrieval. %s" % (msg))
            return None
Exemple #18
0
 def getCurrencyStats(self, contract, symbol=CORE_SYMBOL):
     """returns Json output from get currency stats."""
     assert(contract)
     assert(isinstance(contract, str))
     assert(symbol)
     assert(isinstance(symbol, str))
     cmd="%s %s get currency stats %s %s" % (Utils.EosClientPath, self.endpointArgs, contract, symbol)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg=ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during get currency stats. %s" % (msg))
         return None
Exemple #19
0
 def getCurrencyStats(self, contract, symbol=CORE_SYMBOL):
     """returns Json output from get currency stats."""
     assert(contract)
     assert(isinstance(contract, str))
     assert(symbol)
     assert(isinstance(symbol, str))
     cmd="%s %s get currency stats %s %s" % (Utils.EnuClientPath, self.endpointArgs, contract, symbol)
     if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
     try:
         trans=Utils.runCmdReturnJson(cmd)
         return trans
     except subprocess.CalledProcessError as ex:
         msg=ex.output.decode("utf-8")
         Utils.Print("ERROR: Exception during get currency stats. %s" % (msg))
         return None
Exemple #20
0
    def setPermission(self, account, code, pType, requirement, waitForTransBlock=False):
        cmd="%s %s set action permission -j %s %s %s %s" % (
            Utils.EosClientPath, self.endpointArgs, account, code, pType, requirement)
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd)
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during set permission. %s" % (msg))
            return None

        transId=Node.getTransId(trans)
        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None
        return trans
Exemple #21
0
    def setPermission(self, account, code, pType, requirement, waitForTransBlock=False):
        cmd="%s %s set action permission -j %s %s %s %s" % (
            Utils.EnuClientPath, self.endpointArgs, account, code, pType, requirement)
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd)
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during set permission. %s" % (msg))
            return None

        transId=Node.getTransId(trans)
        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None
        return trans
Exemple #22
0
    def getActions(self, account, pos=-1, offset=-1):
        assert(isinstance(account, Account))
        assert(isinstance(pos, int))
        assert(isinstance(offset, int))

        if not self.enableMongo:
            cmd="%s %s get actions -j %s %d %d" % (Utils.EosClientPath, self.endpointArgs, account.name, pos, offset)
            if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
            try:
                actions=Utils.runCmdReturnJson(cmd)
                return actions
            except subprocess.CalledProcessError as ex:
                msg=ex.output.decode("utf-8")
                Utils.Print("ERROR: Exception during actions by account retrieval. %s" % (msg))
                return None
        else:
            return self.getActionsMdb(account, pos, offset)
Exemple #23
0
    def getTransaction(self, transId, retry=True, silentErrors=False):
        if not self.enableMongo:
            cmd = "%s %s get transaction %s" % (Utils.EnuClientPath,
                                                self.endpointArgs, transId)
            if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
            try:
                trans = Utils.runCmdReturnJson(cmd)
                return trans
            except subprocess.CalledProcessError as ex:
                msg = ex.output.decode("utf-8")
                if "Failed to connect" in msg:
                    Utils.Print("ERROR: Node is unreachable. %s" % (msg))
                    raise
                if not silentErrors:
                    Utils.Print(
                        "ERROR: Exception during transaction retrieval. %s" %
                        (msg))
                return None
        else:
            for _ in range(2):
                cmd = "%s %s" % (Utils.MongoPath, self.mongoEndpointArgs)
                subcommand = 'db.Transactions.findOne( { $and : [ { "transaction_id": "%s" }, {"pending":false} ] } )' % (
                    transId)
                if Utils.Debug:
                    Utils.Print("cmd: echo '%s' | %s" % (subcommand, cmd))
                try:
                    trans = Node.runMongoCmdReturnJson(cmd.split(), subcommand)
                    return trans
                except subprocess.CalledProcessError as ex:
                    if not silentErrors:
                        msg = ex.output.decode("utf-8")
                        Utils.Print(
                            "ERROR: Exception during get db node get trans. %s"
                            % (msg))
                    return None
                if not retry:
                    break
                if self.mongoSyncTime is not None:
                    if Utils.Debug:
                        Utils.Print("cmd: sleep %d seconds" %
                                    (self.mongoSyncTime))
                    time.sleep(self.mongoSyncTime)

        return None
Exemple #24
0
    def getTransaction(self, transId, silentErrors=False):
        if not self.enableMongo:
            cmd="%s %s get transaction %s" % (Utils.EosClientPath, self.endpointArgs, transId)
            if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
            try:
                trans=Utils.runCmdReturnJson(cmd)
                return trans
            except subprocess.CalledProcessError as ex:
                msg=ex.output.decode("utf-8")
                if "Failed to connect" in msg:
                    Utils.Print("ERROR: Node is unreachable. %s" % (msg))
                    raise
                if not silentErrors:
                    Utils.Print("ERROR: Exception during transaction retrieval. %s" % (msg))
                return None
        else:
            return self.getTransactionMdb(transId, silentErrors)

        return None
Exemple #25
0
    def getBlock(self, blockNum, retry=True, silentErrors=False):
        """Given a blockId will return block details."""
        assert (isinstance(blockNum, int))
        if not self.enableMongo:
            cmd = "%s %s get block %d" % (Utils.EnuClientPath,
                                          self.endpointArgs, blockNum)
            if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
            try:
                trans = Utils.runCmdReturnJson(cmd)
                return trans
            except subprocess.CalledProcessError as ex:
                if not silentErrors:
                    msg = ex.output.decode("utf-8")
                    Utils.Print("ERROR: Exception during get block. %s" %
                                (msg))
                return None
        else:
            for _ in range(2):
                cmd = "%s %s" % (Utils.MongoPath, self.mongoEndpointArgs)
                subcommand = 'db.Blocks.findOne( { "block_num": %d } )' % (
                    blockNum)
                if Utils.Debug:
                    Utils.Print("cmd: echo '%s' | %s" % (subcommand, cmd))
                try:
                    trans = Node.runMongoCmdReturnJson(cmd.split(), subcommand)
                    if trans is not None:
                        return trans
                except subprocess.CalledProcessError as ex:
                    if not silentErrors:
                        msg = ex.output.decode("utf-8")
                        Utils.Print(
                            "ERROR: Exception during get db node get block. %s"
                            % (msg))
                    return None
                if not retry:
                    break
                if self.mongoSyncTime is not None:
                    if Utils.Debug:
                        Utils.Print("cmd: sleep %d seconds" %
                                    (self.mongoSyncTime))
                    time.sleep(self.mongoSyncTime)

        return None
Exemple #26
0
    def getTransaction(self, transId, silentErrors=False):
        if not self.enableMongo:
            cmd="%s %s get transaction %s" % (Utils.EnuClientPath, self.endpointArgs, transId)
            if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
            try:
                trans=Utils.runCmdReturnJson(cmd)
                return trans
            except subprocess.CalledProcessError as ex:
                msg=ex.output.decode("utf-8")
                if "Failed to connect" in msg:
                    Utils.Print("ERROR: Node is unreachable. %s" % (msg))
                    raise
                if not silentErrors:
                    Utils.Print("ERROR: Exception during transaction retrieval. %s" % (msg))
                return None
        else:
            return self.getTransactionMdb(transId, silentErrors)

        return None
Exemple #27
0
    def publishContract(self,
                        account,
                        contractDir,
                        wastFile,
                        abiFile,
                        waitForTransBlock=False,
                        shouldFail=False):
        cmd = "%s %s -v set contract -j %s %s" % (
            Utils.EosClientPath, self.endpointArgs, account, contractDir)
        cmd += "" if wastFile is None else (" " + wastFile)
        cmd += "" if abiFile is None else (" " + abiFile)
        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans = None
        try:
            trans = Utils.runCmdReturnJson(cmd, trace=False)
        except subprocess.CalledProcessError as ex:
            if not shouldFail:
                msg = ex.output.decode("utf-8")
                Utils.Print("ERROR: Exception during code hash retrieval. %s" %
                            (msg))
                return None
            else:
                retMap = {}
                retMap["returncode"] = ex.returncode
                retMap["cmd"] = ex.cmd
                retMap["output"] = ex.output
                # commented below as they are available only in Python3.5 and above
                # retMap["stdout"]=ex.stdout
                # retMap["stderr"]=ex.stderr
                return retMap

        if shouldFail:
            Utils.Print(
                "ERROR: The publish contract did not fail as expected.")
            return None

        Node.validateTransaction(trans)
        transId = Node.getTransId(trans)
        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None
        return trans
Exemple #28
0
    def createInitializeAccount(self,
                                account,
                                creatorAccount,
                                stakedDeposit=1000,
                                waitForTransBlock=False,
                                stakeNet=100,
                                stakeCPU=100,
                                buyRAM=100):
        cmd = '%s %s system newaccount -j %s %s %s %s --stake-net "%s %s" --stake-cpu "%s %s" --buy-ram "%s %s"' % (
            Utils.EosClientPath, self.endpointArgs, creatorAccount.name,
            account.name, account.ownerPublicKey, account.activePublicKey,
            stakeNet, CORE_SYMBOL, stakeCPU, CORE_SYMBOL, buyRAM, CORE_SYMBOL)

        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans = None
        try:
            trans = Utils.runCmdReturnJson(cmd)
            transId = Node.getTransId(trans)
        except subprocess.CalledProcessError as ex:
            msg = ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during account creation. %s" % (msg))
            return None

        if stakedDeposit > 0:
            self.waitForTransInBlock(
                transId
            )  # seems like account creation needs to be finalized before transfer can happen
            trans = self.transferFunds(
                creatorAccount, account,
                Node.currencyIntToStr(stakedDeposit, CORE_SYMBOL), "init")
            transId = Node.getTransId(trans)

        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None

        return trans
Exemple #29
0
    def createAccount(self, account, creatorAccount, stakedDeposit=1000, waitForTransBlock=False):
        cmd="%s %s create account -j %s %s %s %s" % (
            Utils.EnuClientPath, self.endpointArgs, creatorAccount.name, account.name,
            account.ownerPublicKey, account.activePublicKey)

        if Utils.Debug: Utils.Print("cmd: %s" % (cmd))
        trans=None
        try:
            trans=Utils.runCmdReturnJson(cmd)
            transId=Node.getTransId(trans)
        except subprocess.CalledProcessError as ex:
            msg=ex.output.decode("utf-8")
            Utils.Print("ERROR: Exception during account creation. %s" % (msg))
            return None

        if stakedDeposit > 0:
            self.waitForTransInBlock(transId) # seems like account creation needs to be finlized before transfer can happen
            trans = self.transferFunds(creatorAccount, account, "%0.04f %s" % (stakedDeposit/10000, CORE_SYMBOL), "init")
            transId=Node.getTransId(trans)

        if waitForTransBlock and not self.waitForTransInBlock(transId):
            return None

        return trans
                useBiosBootFile=False,
                pfSetupPolicy=PFSetupPolicy.NONE,
                extraNodpicoArgs=
                " --plugin picoio::producer_api_plugin  --http-max-response-time-ms 990000 "
        ) is False:
            cmdError("launcher")
            errorExit("Failed to stand up pico cluster.")

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

    node = cluster.getNode(0)
    cmd = "curl %s/v1/producer/get_supported_protocol_features" % (
        node.endpointHttp)
    Print("try to get supported feature list from Node 0 with cmd: %s" % (cmd))
    feature0 = Utils.runCmdReturnJson(cmd)

    node = cluster.getNode(1)
    cmd = "curl %s/v1/producer/get_supported_protocol_features" % (
        node.endpointHttp)
    Print("try to get supported feature list from Node 1 with cmd: %s" % (cmd))
    feature1 = Utils.runCmdReturnJson(cmd)

    if feature0 != feature1:
        errorExit("feature list mismatch between node 0 and node 1")
    else:
        Print("feature list from node 0 matches with that from node 1")

    if len(feature0) == 0:
        errorExit("No supported feature list")
Exemple #31
0
 def get_block(self, params: str, node: Node) -> json:
     base_cmd_str = ("curl http://%s:%s/v1/") % (TestHelper.LOCAL_HOST, node.port)
     cmd_str = base_cmd_str + "trace_api/get_block  -X POST -d " + ("'{\"block_num\":%s}'") % params
     return Utils.runCmdReturnJson(cmd_str)