Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Bob forgot that each deploy submitted to the network should be paid for or won't be executed, so he tries to run the same contract as Alice did. He deploys contract to validator node0.testnet.rchain-dev.tk and wait for validator to propose a new block expecting to see balance of his wallet as a visible sign of deploy execution.

    rnode --grpc-host node0.testnet.rchain-dev.tk deploy --phlo-limit 100000 --phlo-price 1 --private-key 4021c7b19e7442cd299b5d541761ab86af34fcb74f24f5cd44360838d19618b7 bob_checks_balance.rho

    Code Block
    titlebob_checks_balance.rho
    new 
      rl(`rho:registry:lookup`), stdout(`rho:io:stdout`), 
      revVaultCh, vaultCh, balanceCh, log
    in {
      rl!(`rho:rchain:revVault`, *revVaultCh) |
      for (@(_, revVault) <- revVaultCh) {
        match "1111iNXW2k2S3S5bWL3W8w87itK1ky3y1ywySFBt9DkfPiZYo3KNU" {
          revAddress => {
            @revVault!("findOrCreate", revAddress, *vaultCh) |
            for (@(true, vault) <- vaultCh) {
              @vault!("balance", *balanceCh) |
              for (@balance <- balanceCh) {
                log!("Balance of " ++ revAddress ++ " is ${balance}."%%{"balance":balance})
              }
            }
          }
        }
      } |
    
      contract log(@data) = {
        stdout!("COST ACCOUNTING TEST: Bob deploys. " ++ data)
      }
    }


  2. Now you have to listen to proposing validators, as peers wont get this deploy at all.
    curl --no-buffer -s http://node0.testnet.rchain-dev.tk:8181/logs/name:rnode | grep -v "Must wait for more blocks from other validators\|Streamed packet\|Streaming packet\|Received request for block"
    When validator proposes block, so executes deploy - observe "Insufficient funds" message. Next repeat this test again but listen to another validator to observe that there are no signs of deploy execution there. Which means deploy was not included in a block as it was not paid for.