Breakout session: cost model

April 2018 developer's conference

Questions addressed

  • When is the measure of the namespace set? and how? 
    • How do regions work? How do regions impact costing?
  • How do you split out rewards for validators?
  • How is rent distributed?
  • How do contracts move across regions?
  • What happens when a contract runs out of Phlo?
  • Does Phlo persist from block to block during computation?
  • If 2 '@foo' contracts are deployed simultaneously, how is it determined which contract points to which wallet 

Participants

  • Joseph Denman (moderator)
  • Nash Foster
  • Kyle Butt
  • Bill Willahan
  • Jamie Cook
  • Jake Gillberg
  • Dan Connley
  • Mirnal Manohar
  • Kevin Valentine
  • ?
  • Eitan
  • Kelly Foster (scribe)

Regions and impact on costing

  • If east costs more than central, and 

    • If there are more validators in a region, then it would cost more to operate in that region

    • IS there a concept of the number (min and max) of the validators in a region?


How do you split out rewards to the validators?

  • PROPOSAL: Distribute rewards evenly (or even stake-weighted) to validators

    • Problem: Free-riding: 
  • CONCERN: What if a validator turns on and off every 45 seconds, and then they get rewards (free-riding)

    • Free rider is a validator who watches the results of other validators and says they did it to get the reward
    • This problem is not unique to RChain. It is a problem that needs to be solved.

    • IDEA - TSA solution: To solve for an inattention problem, TSA inserts knives into bags that are not there. 

      • Insert a bogus transaction to force the network to ID, those who validate are free-riders
    • IDEA - The abusive boyfriend protocol
      • You know there are lies out there, if you sign something without checking it, then you are a free-rider
      • This is part of the consensus protocol
    • IDEA - Rewards are only distributed after the block is finalized. If you're block is not doing anything, then no rewards for you "Little Red Hen" concept

Ways to make REV

  • Inflation
  • Validation fees

How and when do fees change?

  • Cost of storage 

When is the measure of the namespace determined? How is it established?

  • ANSWER: It is determined by the region (the sum of measure of the regions) determined by the genesis block.
    • Regions establish the cost measures
  • Why can't it be the namespace?
    • Example: namespaces could come up with a costs model (A v B), but then C wants to join
    • ANSWER: This is prohibitive because it would require storage at the top
  • It is important that the measures of the regions don't change frequently because it will impact trust
  • You want namespaces that are in a federated, competitive market
    • You may decide to trade slowness for safety
    • You may decide to trade fastness for insecurity
    • What we want from the network is to have both extremes in the network

How is rent distributed?

  • Costs increase as safety goes up
    • Ideal is to find a place in the middle where the least achievable amount of safety is allowed.

What's the difference between a region and a namespace?

  • Nothing
  • A region is the smallest version of a namespace
  • This makes top-level transactions very expensive
  • It's cheaper to interact with your trusted network
  • Introduces competition based on cost (market economics)

Should validators decide costs by region?

  • Should there be a default for the region?
  • Regions determine costs, not namespaces

Contract mobility and region fee-setting

  • How do you move a contract from region 1 to region 2?
  • What if a region becomes a cartel?
    • Can validators in a region alter the price?
    • There is a dis-incentive because no one will want to join
    • But the ones stuck there will be held hostage
  • The solution is that to become a validator you have to be approved at the top level.
    • Local price information is published globally
    • You need agreement globally to change the price regionally
  • Are costs determined by humans?
    • Humans establish the region and standards and push for global consensus
    • Then the market can choose to participate in the region or not
  • If a region can identify a region that is a cartel, you can set a standard not to process those transactions. You can set the stand
    • How much would Target spend to underprice Walmart?
    • You want everyone to lower the price as much as possible to encourage transaction volume (like multiple fast food locations at a single intersection)

If 2 '@foo' contracts are deployed simultaneously, how is it determined which contract points to which wallet 

  • ANSWER  - When you deploy something there is a wallet in the same message, so you just pass the wallet

What happens when a contract runs out of Phlo?

  • The block records what has happened so far and add a notice that it's out of phlo
  • The network would store a record (a try) of contracts that ran out of phlo
    • Hash the computation and store the effect as a record in a log of contracts that ran out of phlo
    • Need to avoid replay attacks, where more than one person adds phlo to refuel the contract

OPTION A - Storage

  • As time goes on the number of effects you have to keep track of more and more 
  • You do have to keep track of what has been revived - this is the tricker part, trickier than reviving
    • What data structure would you use to track?
    • A complete try leaves a hole, which results in rewriting the try

Option B - Running to quiescence

  •  
  • Runs until there is nothing left to run
  • Allows you to track when you're done
  • It doesn't have to be sequential
  • Kyle advocates to not run code that creates multiple races
    • The network will decide who wins what race
      • Could create slowness on the network
        • If you don't want to slowness due to resourcing for race designs, then don't write code like that. Suggestion is to write it differently.
        • Is it expensive and slow for the person writing it or for the validators?
  • If running to quiescence then, one validator decides the race
    • Race winners are fair. They are just non-deterministic
    • If you want fair, write better code
  • Example: Network has 100 validators, you opt for validation from three.
    • Transaction sent to 3 with a bunch of serial races, each validator calculates a trace and broadcasts to the network, the network decides the winner
    • No single actor knows which one will be selected as the winner (it's safe and not fair)
  • You deploy and pay for all computation until it reaches quiescence
    • This disincentives others for writing on the platform (ex data feed will be expensive)
    • Nash, don't do this because no one will write an oracle if this is the case (required to run to quiescence)
    • Joe proposes deployer pays. If you invoke someone else's contract, you pay for it.
  • This is Kyle's recommendation

Does phlo persist from block to block during a computation?

  • Deploy (P) and Deploy (Q) exist and don't overlap overlap in the tuplespace.
    •  
    • Henry needs to know this as it relates to storage
    • We want to be able to persist code is such a way that when someone runs it you continue paying
  • What happens when the cost of running a contract fluctuates?
    • The phlo-balance-pointer solves for this
  • Deployer pays until quiescence
    • Mike wants I want to send data and not pay for it
    • Think about each term of a contract being it's own tiny contract
  • Would people have phlo wallets?
    • No. You don't get phlo back if it runs to quiescence
    • If there is any phlo let at the end of all your reductions, then you get change
      • Incentivizes running the contract to completion
      • Storage layer keeps a reference counter. If phlo not zero, then give change.
  • If your code produces things in another namespace, your reference count remains 1 until you hear back from the other namespace that they've reached quiescense
    • Your phlo number would have to be synced across namespaces if contract is run across namespaces

How does rent work?

  • Example, chess clock. Timed when contract is in the tuplespace, timed when contract is being executed. Rent is being charged when you're not running