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

feat: library improvements #2396

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

enitrat
Copy link
Contributor

@enitrat enitrat commented Aug 26, 2024

Closes #2395
Closes #2392

Introduced changes

  • Replaced all @Array<T> by Span<T>
  • Replaced useless Clone derivation by Copy
  • Updated .tool-version to scarb 2.7.1 (and re-formatted)
  • Exposed with pub some attributes (no effect)
  • Derived Debug on some items

How to adapt your codebase:

Search and replace with regex:



deploy\(@array!\[(.*?)\]\)
deploy([$1].span())

deploy\(@ArrayTrait::new()\)
deploy([].span())

deploy\(@(.*?)\)
deploy($1.span())

deploy_at\(@ArrayTrait::new()\)
deploy_at([].span())

deploy_at\(@array!\[(.*?)\]\)
deploy_at([$1].span())

deploy_at\(@(.*?)\)
deploy_at($1.span())

precalculate_address\(@array!\[(.*?)\]\)
precalculate_address([$1].span())

precalculate_address\(@ArrayTrait::new()\)
precalculate_address([].span())

precalculate_address\(@(.*?)\)
precalculate_address($1.span())



Checklist

  • Linked relevant issue
  • Updated relevant documentation
  • Added relevant tests
  • Performed self-review of the code
  • Added changes to CHANGELOG.md

@enitrat enitrat reopened this Aug 26, 2024
@enitrat
Copy link
Contributor Author

enitrat commented Aug 27, 2024

any idea how I can debug what fails in the deploy_at and trace tests?

@cptartur
Copy link
Member

cptartur commented Aug 28, 2024

Hey, thanks for the PR, but first we want to figure out a way we can introduce changes to snforge_std in a less breaking manner as it is becoming an increasingly bigger concern.

We're happy to merge the non breaking improvements.

@enitrat
Copy link
Contributor Author

enitrat commented Aug 29, 2024

Hi @cptartur sure, let me know. Perhaps you could use the #[deprecated()] attributes and keep old items at the same time.

@enitrat
Copy link
Contributor Author

enitrat commented Sep 2, 2024

opened #2421 for non breaking changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: stop using @Array<T> in snforge_std and use Span<T> instead derive copy on DeclareResult
2 participants