Glow-Lang / glow

The Glow language for Blockchain Decentralized Applications.
https://glow-lang.org
Apache License 2.0
58 stars 8 forks source link

[Design RFC] Support explicit timeouts #211

Open kwannoel opened 3 years ago

kwannoel commented 3 years ago

In GitLab by @plotnick on Jul 4, 2021, 07:49

Explicit Timeouts

Timelines

Module 5 ready by 2nd december, 2021 for Glow MOOC.

Design constraints

How interoperable does the currentBlock command have to be? This will change how we implement it.

Should we make it EVM specific first?

Consider all chains we are currently involved with?

First iteration

require! currentBlock() < expectedBlock;

Interoperability

Design

Latest iteration

try A {
    // A does some stuff
} after (t) B {
    // B does some stuff ...
}

Note: each section of the try...catch above has to only be executed either by A or B. They should also be executed within one transaction (why?)

What are the next steps?

kwannoel commented 3 years ago

In GitLab by @plotnick on Jul 4, 2021, 07:49

assigned to @kwanzknoel

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 2, 2021, 23:46

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 22:55

changed title from Support explicit timeouts to Support explicit timeouts{+ (Design RFC)+}

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 22:55

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 22:56

changed title from Support explicit timeouts{- (Design RFC)-} to {+[Design RFC] +}Support explicit timeouts

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 22:56

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 22:59

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:00

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:00

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:03

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:07

changed the description

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:22

Nervos can have deadlines, but they are constrainted to only be one block.

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:23

Recent block can also allow this.

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:34

t would be supplied as an interaction parameter.

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:34

Consider duration (of block numbers) instead? Relative to when the last transaction ended?

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:36

Can we use @A? Nope, @A suggests that this is private to A.

kwannoel commented 3 years ago

In GitLab by @kwanzknoel on Sep 8, 2021, 23:40

Q: assert_time_later_than(t)? Does not allow us to switch blocks based on timeouts.

kwannoel commented 3 years ago

In GitLab by @fahree on Sep 9, 2021, 07:05

At a lower level, for Plutus and similar UTXO blockchains (Nervos?), the client would issue transactions that assert "valid in interval from now to maxtimestamp", where maxtimestamp is

Then, the contract logic would use the now and maxtimestamp to check

The client may have to watch the transaction, and issue a new one with new now/maxtimestamp interval if the previous one didn't make it. (In general, we'll have to watch transactions, anyway, to make sure they go through, in case gas fees increase past a level that make the previous attempt unlikely to succeed.)

At a higher level, in the Glow language, we should try to only expose deadlines without direct access to now. If access is needed for some contracts (e.g. to compute interests), then we should document just how imprecise the clock is on each supported network, in between the network's own notion of time and the need for intervals on some of them.

When using AVOUM, the miners could cooperate to take time into account when malleating transactions.