-
Notifications
You must be signed in to change notification settings - Fork 677
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
[Clarity] rules for determining which Clarity version to run #3131
Comments
@kantai does this make sense to you? |
I don't think this is feasible: a I think this answer also makes it pretty clear how your second point should be interpreted:
Yes, I think that's right, but I'd still frame this specification in terms of the contract that the
I'm not sure that this is true. If an So what I'd propose as the versioning rules:
|
That sounds much better than what I was suggesting. Thank you for that. What do you think about runtime costs? Which Also, how do you see this affecting PoX? If I have an |
Yep -- the costs are defined by the block: the cost tracker is instantiated only once per block, and it uses the epoch defined costs contract (as the default costs: if a cost vote passes, it uses the results of that for a given cost function). This is true through
It won't fail as currently implemented in |
Re: the |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Now that there are multiple versions of Clarity, with different keywords and different interpretations of existing keywords, we need to determine the rules for how
(at-block)
,contract-call?
and smart contract deployment should work. I suggest the following:The Clarity version used in a transaction is immutable over the transaction's lifetime. Moreover, the Clarity version used is determined early -- i.e. at or before the instantiation of the transaction's
GlobalContext
.A
ContractCall
transaction runs with the Clarity version of the contract it calls, not the current epoch. Similarly, aSmartContract
transaction runs with the Clarity version it indicates in its pragma ([Chainstate]SmartContract
tx wire format to indicate which Clarity version to use #2719), not the current epoch (the current epoch is only used to infer the Clarity version if theSmartContract
payload indicates to do so). If the contract is deployed with Clarity1 rules, then all top-level contract calls into it use Clarity1. If a contract is deployed with Clarity1 rules, and it calls other contracts as part of its code-body evaluation, then these contract-calls follow Clarity1 rules as well. Same goes for the use of Clarity2.The closure in
(at-block)
runs with the Clarity version of the caller, not the target block. So, if a Clarity2 contract calls(at-block)
, its code body runs with Clarity2 rules even if the block was mined before Clarity2 was allowed. Similarly, if a Clarity1 contract calls(at-block)
, its code body runs with Clarity1 rules even if the block was mined when Clarity2 was allowed. If the closure fails for any reason -- even viaCheckErrors
resulting from the Clarity version's rules rendering the closure's code invalid -- the error is always (re-)interpreted as a runtime error ([clarity] All check errors must be handled as runtime errors #3107) so the transaction can still be mined.The closure in
(at-block)
can only call other contracts that have been successfully instantiated. This precludes calling a contract that uses Clarity2 keywords but was deployed in epoch 2.05 or earlier via(at-block)
-- the call should fail even if the contract could have worked in Clarity2, because the contract itself should not have passed the analysis check when its transaction was mined.The text was updated successfully, but these errors were encountered: