Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore!: made ResourceCache consider resource owner #3697

Merged
merged 134 commits into from
Mar 6, 2025

Conversation

Torres-ssf
Copy link
Contributor

@Torres-ssf Torres-ssf commented Feb 11, 2025

Release notes

In this release, we:

  • Adapted ResourceCache to conform with new coinsToSpend limitations

Summary

This PR addresses three things:

1 - Resources IDs are now cached, considering their owner.

2 - A check has been added to prevent Provider.getResourcesToSpend from being called with more cached resource IDs than the max_inputs value.

3 - All resource cache-related tests from provider.test.ts have been moved to resource-cache.test.ts to reduce the number of test cases in the original file, which was already too large.

Breaking Changes

//before
provider.cache?.getActiveData();
provider.cache?.isCached(key);
//after
const owner = wallet.address.toB256();

provider.cache?.getActiveData(owner)
provider.cache?.isCached(owner, key);

Checklist

  • All changes are covered by tests (or not applicable)
  • All changes are documented (or not applicable)
  • I reviewed the entire PR myself (preferably, on GH UI)
  • I described all Breaking Changes (or there's none)

Copy link
Contributor

github-actions bot commented Mar 5, 2025

Coverage Report:

Lines Branches Functions Statements
77.19%(+0.07%) 70.96%(+0.17%) 75.26%(+0.07%) 77.18%(+0.06%)
Changed Files:
Ok File (✨=New File) Lines Branches Functions Statements
🔴 packages/account/src/providers/provider.ts 67.5%
(-0.41%)
61.9%
(+1.34%)
69.3%
(+0.68%)
67.34%
(-0.4%)
🔴 packages/account/src/providers/resource-cache.ts 97.95%
(+1.8%)
90%
(-2.85%)
100%
(+0%)
97.95%
(+1.53%)
✨ packages/account/src/providers/utils/helpers.ts 100%
(+100%)
100%
(+100%)
100%
(+100%)
100%
(+100%)

@Torres-ssf Torres-ssf merged commit 260f64f into master Mar 6, 2025
44 of 46 checks passed
@Torres-ssf Torres-ssf deleted the st/chore/made-resource-cache-owner-specific branch March 6, 2025 08:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Issue is a chore
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make ResourceCache Owner-Aware
4 participants