Zondax / filecoin-solidity

Filecoin Solidity API Library
Apache License 2.0
94 stars 43 forks source link

Consider using staticcall to call read-only built-in actor getters #362

Closed raulk closed 1 year ago

raulk commented 1 year ago

This library uses delegatecall to call the precompile in all occasions, even if the built-in actor method is a getter. This prevents contract using this library from declaring view functions that invoke built-in actor getters, even if those functions are, in practice, read-only functions.

:link: zboto Link

rllola commented 1 year ago

Using staticcall is not allowed by filecoin actor. See https://github.com/filecoin-project/builtin-actors/blob/master/actors/evm/src/interpreter/precompiles/fvm.rs#L130-L132

emmanuelm41 commented 1 year ago

@raulk take a look at this https://github.com/Zondax/filecoin-solidity/blob/b58b5c28caad12f54b7ca203e52b4383cc0f7772/contracts/v0.8/utils/Actor.sol#L85-L91