Great Friam this week. I've attached a (only slightly) cleaned up
drawing from working through how to annotate the Grannoveter diagram for
gas. Here you can see gas tanks added to messages and a proxy object.
On the perimeter I've drawn some ideas that came up:
- Some tickets based on our "paying cash for carnival tickets"
conversation. (The summary of that being: at a carnival I might pay
cash for tickets which I can use at the carnival, hand to less
trustworthy teenagers who might not be trusted for cash. Nonetheless
that might be how I go on local rides. This exchange is nonetheless
not illustrated.)
- A tank with stripes representing "mixed sources" of gas.
I took some notes during the call; they're pretty messy. I'm attempting
to distill them briefly below; feel free to ask for clarifications.
!!!notes start below!!!
Three kinds of "gas":
- global currency
- local boundary currency (eg "carnival tickets")
- general deterministic cost for space/time and etc against some
abstract VM
So now in our scenario:
- Alice has bought some CTickets using GlobalBux.
- Alice hands Bob a reference to Carol allocated with some CTickets.
- C converts CTickets into amount of VM instructions / memory
Approaches to "allocating gas"
- curry onto the reference to carol-for-bob ~directly
- via a proxy object
- some complicated cert chain thing (but can the gas then be extracted?)
- Apply it as an additional purse-argument
(easiest path for bob to go spend that money elsewhere... not great)
- Have the handoff be the place with the "curried with money"
reference, a gift of Carol-plus-gas waiting for B at C (could compose
nicely with cert-handoff approach). I think this was the group
general preference.
- callback to get gas from alice (possibly leaks too much info to the
mint and seemed complicated?)
some mockup of some cert:
{"to": C,
"for": B,
"checkCallback": (sealed-to-C <exported-purse-from-A>),
"accessTo": <Carol>}
Alan about the cert above: "This is too complicated to mock up on a
call" (maybe we can do so here)
This cert could be made easier if A has "tickets" to C (bought with the
more universal currency)
What would using this look like in practice? Here's one where the gas
is "bound to the reference":
#+BEGIN_SRC racket
;; running in alice
(define gassy-bob
(with-tank bob (alice-tank.withdraw 20)))
(define gassy-carol-for-bob
(with-tank carol (alice-tank.withdraw 30)))
(on (<- gassy-bob.foo gassy-carol-for-bob)
(lambda (val)
...))
#+END_SRC
vs one where a gas purse is supplied as an additional argument
(but this also means Bob could go spend the gas elsewhere, and requires
a lot of understanding of what the "purpose of purse arguments" are):
#+BEGIN_SRC racket
;; running in alice
(define gassy-tank-for-bob-to-use-on-carol
(alice-tank.withdraw 30))
(on (<- (with-gas gassy-bob.foo (alice-tank.withdraw 20))
gassy-carol-for-bob
gassy-tank-for-bob-to-use-on-carol)
(lambda (val)
...))
#+END_SRC
Some concerns identified:
- How do you join the system and get your initial gas? Akin to how
you join a captp system anyway, use whatever mechanism that is
- eq? concerns and grant matcher
- Can Bob "extract" this version of Carol for the "raw carol"?
- Can Bob add gas to this Carol reference?
(to those last ones Alan says "think in terms of object references
first and certificate dynamics at a future point")
- Resuming vs re-entrancy?
- Spawning pre-empt'able/resumeable vats when you need them. You might
charge more for computation that suspends than ones where the whole
turn fails
- Implicit refund of gas or no?
- gas all the way down? do you have to pay gas to get gas?
(Alan brought up BGP as something that's handled this as "a protocol
nightmare, but in practice has been effective enough")
Thanks for the call anyone! I'm excited about passing gas!