Sovryn-smart-contracts icon indicating copy to clipboard operation
Sovryn-smart-contracts copied to clipboard

Find the bug cause of internal failing transactions

Open jjmr007 opened this issue 4 years ago • 1 comments

Tx: 0x8bf5a2b77701981d75e57225aa00c99e76ba3cc39d9862b0ae5702ad122d327d

Tx: 0xcc90582268236201bf322fed034aa9a23a4b34c15bb25f9bf42ebb4b713350b5

jjmr007 avatar Jul 13 '21 11:07 jjmr007

Findings:

1.- Successful transactions with internal revertions are possible when the instruction reverted is a low level staticcall transaction. 2.- Both of the former transactions failed at the same stage, with the exact same staticcall transactions. 3.- In one of the reverted internal transactions, the PriceFeed contract (0x437aC62769f386B2D238409b7f0a7596d36506e4) calls the SovrynProtocol contract (0x5a0D867E0D70FCc6ADe25c3f1B89d618b5B4EaA7) with the view function decimals() which does not belong to that contract, but to a standard ERC20 contract. Thatr's the reason for this kind of revertion. 4.- However about which instruction is ordering the query of "decimals" to a non ERC20 contract, is still unknown. 5.- The former internal transaction is related to an internal call to the queryReturn function of PriceFeed which calls the internal function _queryRate(address sourceToken, address destToken) but this call use as destToken the address of SovrynProtocol (non ERC20 contract) causing a revertion. What instruction is ordering PriceFeeds to do that call with such wrong parameter is still unknown.

jjmr007 avatar Jul 15 '21 16:07 jjmr007