Closed joticajulian closed 2 months ago
I have also requested @sgerbino's review on this PR to ensure correctness and usability before we release it to contract devs.
With the implicit calls to
getArguments
andgetCaller
in function signatures, do we want to add some internal caching so when those calls are made multiple times, we can short circuit and return the cached object?
Good suggestion. I just added a cache value for these 2 functions.
Sorry for the delay in review. LGTM, I want @sgerbino to look at it as well before we merge.
I've been very busy in other topics. I'd appreciate if someone can work in the unit tests.
Brief description
This PR takes advantage of the new system contract called "get_contract_metadata", which is used to determine if an account has a contract or not. This is useful to improve the security of the assets (see references).
Changes:
System.getContractMetadata
System.checkAuthority
has been renamed toSystem.checkAuthorityLegacy
System.checkAuthority
which calls getContractMetadata internally.System.checkCallContractAuthority
which calls the checkAuthority and fill the arguments.System.requireAuthority
updated.References
Checklist
Demonstration
I deployed 3 contracts in mainnet: smart wallet, assets contract, and third party contract. These contracts interact between them to demonstrate the advantages of the new system call. They are working as expected. You can follow the tests described in this post but using these addresses for mainnet: