-
Notifications
You must be signed in to change notification settings - Fork 1k
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
CountedGroups and CountedContracts witness scopes #2583
Comments
|
This seems to be the most straightforward option.
Compatibility? |
What if the BAD contract could change the contract call chain?
After BAD Attack:
|
We're toast. Still, it's better than the current situation where |
Add |
Is not the same as |
|
Summary or problem description
At the moment we have
None
,CalledByEntry
,CustomContracts
,CustomGroups
andGlobal
witness scopes (see #544 also). The most widely known areCalledByEntry
andGlobal
with the latter working just everywhere and the former only in a contract called by the entry script. WhileCalledByEntry
covers most of regular needs, there are cases whereCustomContracts
orCustomGroups
are useful, these are:Entry -> A1 -> A2
withA1
andA2
belonging to the same group andA2
requiring witness)Entry -> A -> B
scenario without grouping, but withB
requiring witness)While all of this works one may notice that
CustomGroups
andCustomContracts
scopes are not limited in where in the chain of calls the witness is checked and how many times it's checked. So a well-known scenario ofEntry -> A -> BAD -> A
withBAD
doing bad things to user's assets inA
which is known to be a problem ofGlobal
(although withGlobal
it might as well beEntry -> A -> BAD -> B
) suddenly is relevant both forCustomGroups
andCustomContracts
if we're to specifyA
group of hash there.Do you have any solution you want to propose?
Introduce
CountedGroups
andCountedContracts
scopes that will carry a counter of allowed invocations along with group keys/contract hashes. So aCountedContracts
witness for (A
, 1) will be valid for:Entry -> A
Entry -> B -> A
Entry -> C -> B -> A
But not valid for the second A invocation in chains like:
Entry -> A -> B -> A
Entry -> B -> A -> C -> A
CountedGroups
can count entries to a group of contracts so that while contracts in the same group call each other this counter won't be incremented, but upon leaving and reentering it will. ValidCountedGroups
witness for (A*
, 1):Entry -> A1
Entry -> A1 -> A2
Invalid for the second entry into the same group:
Entry -> A1 -> A2 -> B -> A3
This is a compatible extension that can be rolled out pretty easy.
Neo Version
Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: