You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An idea via @jsuresh (working with me on token API design).
Re-entrancy bugs are rather common in existing blockchain systems (see The DAO hack and many others), and Filecoin isn't immune. They can sometimes be exploited/attacked by a malicious receiver.
Some cases could be prevented if a caller could restrict the capabilities of a callee method, such as to disallow the use of send(). Then a high-value contract could call hooks/receivers/getters with no risk of a malicious receiver calling back to exploit an unsaved state. Similarly a method could be forced to be read-only by restricting writes. I imagine these restrictions might be switched with a flag to the send() syscall.
An alternative to runtime enforcement would be compile-time, e.g. a readonly attribute on a method, enforced by the VM. But note that this would have to be done in a way that callers can rely on. E.g. if a standard API specified a GetThing() readonly method, it must be impossible for an actor to implement GetThing (not readonly) and satisfy the API. I can't think how to do that at the moment, given internal dispatch.
I would note that preventing send() would restrict some otherwise positive design patterns like delegation, and the general preference for many small interacting contracts over monoliths.
These runtime restrictions could share mechanism with similar restrictions for account abstraction.
The text was updated successfully, but these errors were encountered:
Transactional memory: the actor SDK could check to see if the state-root has changed since last reading/writing it, and fail (unless the method was marked as "safe" for re-entrency). Unfortunately, this doesn't:
Prevent reads while the actor is in some invalid state.
Prevent the ABA problem (unless we introduce a state version, which honestly wouldn't be a terrible idea).
Reverts: Filecoin already has state-tree transactions, and we could expose those to users. That is:
An idea via @jsuresh (working with me on token API design).
Re-entrancy bugs are rather common in existing blockchain systems (see The DAO hack and many others), and Filecoin isn't immune. They can sometimes be exploited/attacked by a malicious receiver.
Some cases could be prevented if a caller could restrict the capabilities of a callee method, such as to disallow the use of
send()
. Then a high-value contract could call hooks/receivers/getters with no risk of a malicious receiver calling back to exploit an unsaved state. Similarly a method could be forced to be read-only by restricting writes. I imagine these restrictions might be switched with a flag to thesend()
syscall.An alternative to runtime enforcement would be compile-time, e.g. a
readonly
attribute on a method, enforced by the VM. But note that this would have to be done in a way that callers can rely on. E.g. if a standard API specified aGetThing() readonly
method, it must be impossible for an actor to implementGetThing
(not readonly) and satisfy the API. I can't think how to do that at the moment, given internal dispatch.I would note that preventing
send()
would restrict some otherwise positive design patterns like delegation, and the general preference for many small interacting contracts over monoliths.These runtime restrictions could share mechanism with similar restrictions for account abstraction.
The text was updated successfully, but these errors were encountered: