def DataDifficultyTest(rpc: RPC) -> None:
    file: IO[Any] = open(
        "e2e/Vectors/Consensus/Difficulties/DataDifficulty.json", "r")
    vectors: Dict[str, Any] = json.loads(file.read())
    file.close()

    #Verify functions.
    vddStarting: Callable[[], None] = lambda: verifyDataDifficulty(rpc, 5)
    vddEarnedVote: Callable[[], None] = lambda: verifyDataDifficulty(rpc, 2)
    vddVoted: Callable[[], None] = lambda: verifyDataDifficulty(rpc, 1)

    def vmr() -> None:
        verifyMeritRemoval(rpc, 52, 52, 0, False)
        vddStarting()

    def vEarnedBack() -> None:
        vddStarting()

    #Create and execute a Liver/Syncer.
    Liver(rpc,
          vectors["blockchain"],
          callbacks={
              26: vddStarting,
              50: vddEarnedVote,
              51: vddVoted,
              52: vmr,
              103: vEarnedBack
          }).live()
    Syncer(rpc, vectors["blockchain"]).sync()
Exemple #2
0
def OOOElementsTest(rpc: RPC) -> None:
    with open("e2e/Vectors/Merit/OutOfOrder/Elements.json", "r") as file:
        vectors: List[Dict[str, Any]] = json.loads(file.read())

        Liver(rpc,
              vectors,
              callbacks={
                  50: lambda: verifyDataDifficulty(rpc, 1),
                  51: lambda: verifyDataDifficulty(rpc, 4)
              }).live()
        Syncer(rpc, vectors).sync()
def DataDifficultyTest(
  rpc: RPC
) -> None:
  #Verify functions.
  vddStarting: Callable[[], None] = lambda: verifyDataDifficulty(rpc, 5)
  vddEarnedVote: Callable[[], None] = lambda: verifyDataDifficulty(rpc, 2)
  vddVoted: Callable[[], None] = lambda: verifyDataDifficulty(rpc, 1)
  def vmr() -> None:
    verifyMeritRemoval(rpc, 52, 52, 0, False)
    vddStarting()

  with open("e2e/Vectors/Consensus/Difficulties/DataDifficulty.json", "r") as file:
    vectors: List[Dict[str, Any]] = json.loads(file.read())
    Liver(
      rpc,
      vectors,
      callbacks={
        26: vddStarting,
        50: vddEarnedVote,
        51: vddVoted,
        52: vmr
      }
    ).live()
    Syncer(rpc, vectors).sync()
Exemple #4
0
 def verifyCountedAndPending() -> None:
     if rpc.call("merit", "getMerit", {"nick": 0})["status"] != "Pending":
         raise Exception(INVALID_TEST)
     verifySendDifficulty(rpc, 2)
     verifyDataDifficulty(rpc, 2)
Exemple #5
0
 def verifyDiscountedAndLocked() -> None:
     if rpc.call("merit", "getMerit", {"nick": 0})["status"] != "Locked":
         raise Exception(INVALID_TEST)
     verifySendDifficulty(rpc, 3)
     verifyDataDifficulty(rpc, 5)
 def verifyVotedAndUnlocked() -> None:
     if rpc.call("merit", "getMerit", [0])["status"] != "Unlocked":
         raise Exception(INVALID_TEST)
     verifySendDifficulty(rpc, 2)
     verifyDataDifficulty(rpc, 2)