Open pefontana opened 1 month ago
The contract triggered by the tx is Market, which belongs to zkLend. Basically it is in charge of user data maintenance and provides almost all the entrypoints for user operations.
The tx executes the withdraw
entrypoint, which seems to be the one in charge of take some amount from a user's balance. There's a method called sub
, which lives inside the libraries/safe_math
module of the contract's repo:
fn sub(a: felt252, b: felt252) -> felt252 {
assert(Into::<_, u256>::into(b) <= Into::<_, u256>::into(a), errors::SUBTRACTION_UNDERFLOW);
a - b
}
It is executed during this process with which seems to be wrong values that make the assert become true.
Since the contract is constantly interacting with the storage, there's no way we can replicate the error from cairo_native. This because the same error is happens earlier due to a misread of the storage. Thus it is not possible to get the exact same error that the replay is throwing by just executing the contract with cairo native.
Update 29/07 There's another tx reverts with the same error. I've run the same tx both with cairo-native and cairo-vm, and the result is the same error.
One posible reason of this could be the timestamp the contract sometimes uses in calculations (in subtractions for example), which might be different from the original tx. However it is still difficult to say if it really is the source of the issue since it being is read from the storage. Sometimes it is obtained be calling this function
ZkLend repo: https://github.com/zkLend/zklend-v1-core Tx (StarkScan): https://starkscan.co/tx/0x07286e45814889d2dc7dbbf26c5b96b4950280c3fd3f2e38a44d8239a00db336 Contract Account (Market): https://starkscan.co/contract/0x04c0a5193d58f74fbace4b74dcf65481e734ed1714121bdc571da345540efa05
Check this error we are getting in the tx 0x7286e45814889d2dc7dbbf26c5b96b4950280c3fd3f2e38a44d8239a00db336 You can reproduce it with the replate crate. The tx should execute correctly.