-
Notifications
You must be signed in to change notification settings - Fork 7
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
Cached defs will fail with recursive call patterns #55
Comments
In the past, I've done similar caching in the data layer. If we move caching into the data layer between our service and etherscan, 4byte, etc. then all calls to block explorers that use the same route, would return the same result instantly (assuming the call is in the cache). We don't have to worry about any other logic that operates against the cache, because we know that that interface is static. The data returned never changes, so we don't have to worry about breaking the cache. |
Just had the thought that we can just reconstruct a function def string using the def returned from https://docs.ethers.io/v5/api/utils/abi/interface/ Specifically something like this:
Edit: I think we already have this function in |
That's fine but we don't currently have a service that can do this and we don't have SDK functionality to handle one. It also doesn't really solve the problem in this issue because we still need some way to map a def to something we can use to attempt decoding of |
Sorry--"service" is the wrong term. I meant the SDK in this case.
I'm confused. the process as I understand is:
The fetching of data doesn't accept any params or other options. It's just a simple Where am I not understanding? |
We initially implemented decoder caching in #53, but there is an issue that will present itself with recursive definitions, namely that all nested ABIs remain associated to a single parent selector. The purpose of e.g.
multicall
is to map a single contract call (multicall
def) to a set of nested contract calls (nested defs). If one instance ofmulticall
is cached with nested defs A and B, but then a second request is made tomulticall
with defs A and C nested, the keyring will still pull upmulticall
from the cache, but the request will fail to decode on the Lattice and, I believe, will be automatically rejected by firmware.Unfortunately there is no simple solution to this issue, since
tx.input
does not innately map todef
-- you need an ABI definition for this. For recursive defs, you need multiple ABI definitions.I believe the only way to really handle this is to cache select ABI data as well. We need some way to sanity check that the cached def will actually decode
tx.input
. Unless we want to build a new decoder in TS (we could), the only other solution would be to cache ABI definitions themselves (just for the function(s) being called).In any event, we cannot release v0.12.1 as it will result in big problems for people using these patterns. We may want to revert #53 and push a new v0.12.2.
The text was updated successfully, but these errors were encountered: