Closed jayz22 closed 7 months ago
Using this to track a couple of other issue surfaced during the same review:
On line 1018 in auth.rs in function snapshot you seem to allocate a vector to store authorization snapshots but then charge for the allocation afterwards. Can you confirm that the charge should happen before the allocation?
and
On lines 694-700 in auth.rs in the function new_enforcing (for AuthorizationManager) I noticed that you allocate a vector of AccountAuthorizationTrackers of size num_entries. However, the vector you allocate is of type Vec<RefCell
> so the amount of memory allocated is actually num_entries(sizeof(RefCell )). The difference in memory allocated is n (sizeof(RefCell) - sizeof(AccountAuthorizationTracker)). Why not try and account for the difference when charging?
https://github.com/stellar/rs-soroban-env/blob/9c5394083725bacf32a56107d7fa2adf643dc7b5/soroban-env-host/src/auth.rs#L855-L856