-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Instrumentable spec #100
Instrumentable spec #100
Conversation
we have to add proper attribution to the files we copy from elsewhere |
Just a heads up regarding the commit you're about to see (TLA noise). Apalache translates |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First set of comments – I haven't looked at the TLA+ yet
-
I don't understand why you diverge from the existing scripts in
ContractExamples/scripts/
so much. They would be much easier to use if they all follow the same function + style. -
There's a LICENSE on
solarkraft-examples
that we have to comply with.
--token $TOKEN\ | ||
--amount 1 \ | ||
--claimants "[\"$(soroban keys address bob)\"]"\ | ||
--time_bound '{"kind": "After", "timestamp": 0}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe use a more realistic whitespace here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I meant more realistic timestamp 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"After 0" should mean that the claimants can claim whenever, which I thought would be easy to follow-up test. If you hardcode any fixed timestamp you either a) functionally get the same thing as 0 if that time has already passed, or b) have to actually wait before calling claim
.
Looks to me like you should emit Otherwise,
it sounds like we'd have to discourage use of |
I'll try do dig up the conversation in the Apalache repo explaining why we translate unchanged as an assignment, but from memory, the TLDR is that Edit: I found the Apalache issue 1346, but it unfortunately just says "per our discussions" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
second set of comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty
instance_set(key, env) == | ||
env.storage_after \ env.storage_before = {key} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idk what the semantics of this are meant to be, but I would expect
key \in (env.storage_after \ env.storage_before)
In any case, the intention seems to be ambiguous and worth adding a comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the original code here was
instance_storage' = instance_storage \union {key}
My understanding of the intent here was that the interpretation of this was "exactly key
gets set" (since "key is set" could have been tested just via key \in instance_storage'
), and I rewrote it that way, because A = B \cup {x}
is true iff A
differs from B
by exactly x
or if they both contain x
, which I assumed to have been an oversight.
Your suggestion, x \in A\B
would evaluate to true if A \ B
equaled {x, y, z, ...}
too (which may or may not have been the actual intent). Perhaps @andrey-kuprianov can comment best on what the intended semantics here were.
|
||
\* @type: ($storageKey, $env) => Bool; | ||
instance_remove(key, env) == | ||
env.storage_before \ env.storage_after = {key} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a very quick view at the PR:
- Why don't we link the soroban examples via git modules? Otherwise, it would be real hard to keep code in sync, when soroban-examples are updated. Also, what's the point of copying the code from another project? We would have to take care of the licenses and other uninteresting stuff.
- I don't get the discussion about
UNCHANGED
. Yes, we thought that forcingUNCHANGED
to be an assignment was a good idea, but why do we introduce two assignments in the first place?
Co-authored-by: Thomas Pani <[email protected]>
We could, but to my knowledge, there's no way to submodule in only a part of the repository, so we'd have to include all of
Assume that you have
which expands to
You have two options:
If you do (2), you cannot ever reference any primed variable inside your |
I don't want to block this PR on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is fine – not the kind of PR I would've liked to review multiple times.
The discussion on UNCHANGED
is lost on me, maybe @konnov still wants to comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unblocking this given Igors comment
Co-authored-by: Thomas Pani <[email protected]>
Implements half of #99 (only
deposit
for now)Makes the following changes:
timelock
,token
) fromsoroban_examples
underContractExamples/contracts
docs/timelock
, together with a type hints file to use withfetch
Docker
and populatesoroban
with aliasesdeposit
callenv
now gets instrumented with two additional fields, tracking which values were set in storage before and after the transactionNext
is changed, so that it initializes before calling the method operator, avoiding use-before-assignment in the case where the method operator references primed variablesVariants!Variant
arguments are passed is fixed.