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

Bump starknet foundry to 0.30.0 #1137

Merged
merged 20 commits into from
Sep 11, 2024
Merged

Bump starknet foundry to 0.30.0 #1137

merged 20 commits into from
Sep 11, 2024

Conversation

ggonzalez94
Copy link
Collaborator

@ggonzalez94 ggonzalez94 commented Sep 6, 2024

Fixes #1135 and unblocks #1129

  • Upgrade snforge_std to 0.30.0
  • Add explicit assert_macros dependency, which is required after v0.28.0
  • Update declare functions to use the new DeclareResult enum
  • Fix some issues with expected panic messages. We were using tuples of ByteArray and that no longer works.
  • There's an issue in starknet foundry where addresses and selectors don't have trailing zeros after 0x(e.g. instead of 0x06dd34965d008db405187f4ea6170934a051f8ebb4b72c8aba99cb217a281ad4 starknet foundry returns 0x6dd34965d008db405187f4ea6170934a051f8ebb4b72c8aba99cb217a281ad4), so I created a new function in the common test helpers into_base_16_string_no_padding, which is the same as its padding counterpart but matches the starknet foundry output. We could remove the other one, but it is part of the public api - so I decided to keep it, but don't have a strong opinion about it.

PR Checklist

  • Tests
  • Documentation
  • Added entry to CHANGELOG.md

Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good, Gustavo! I left some comments and questions

docs/modules/ROOT/pages/api/testing.adoc Show resolved Hide resolved
packages/account/src/tests/test_account.cairo Outdated Show resolved Hide resolved
packages/account/src/tests/test_account.cairo Outdated Show resolved Hide resolved
packages/testing/src/deployment.cairo Outdated Show resolved Hide resolved
Copy link
Member

@ericnordelo ericnordelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great @ggonzalez94! I Left just a small suggestion, but besides that, it looks ready to go.

@@ -1,11 +1,16 @@
use crate::panic_data_to_byte_array;
use snforge_std::{ContractClass, ContractClassTrait};
use snforge_std::{ContractClass, ContractClassTrait, DeclareResult};
use starknet::ContractAddress;

/// Declares a contract with a `snforge` `declare` call and unwraps the result.
pub fn declare_class(contract_name: ByteArray) -> ContractClass {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this change affects the declare_and_deploy and declare_and_deploy_at functions behavior, I think it is worth adding a note to those stating that the function will skip declaration if the contract is already declared. A note on this function could be helpful as well.

Copy link
Collaborator Author

@ggonzalez94 ggonzalez94 Sep 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I just updated the inline docs and the antora docs. Let me know what you think.

@ericnordelo ericnordelo mentioned this pull request Sep 9, 2024
4 tasks
@ericnordelo
Copy link
Member

I forgot to mention the CHANGELOG. We have to add the corresponding entries:

  • Scarb bump (Btw, I think we can directly bump to 2.8.2 on this PR)
  • snforge bump (since testing is part of the public API of the library)
  • into_base_16_string_no_padding addition
  • declare_class, declare_and_deploy, and declare_and_deploy_at behavior update.

CHANGELOG.md Outdated Show resolved Hide resolved
CHANGELOG.md Outdated Show resolved Hide resolved
Scarb.toml Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/testing.adoc Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/api/testing.adoc Outdated Show resolved Hide resolved
Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks just about ready! I left a couple suggestions and a question

docs/modules/ROOT/pages/api/testing.adoc Outdated Show resolved Hide resolved
packages/testing/src/common.cairo Outdated Show resolved Hide resolved
Scarb.toml Outdated Show resolved Hide resolved
@ggonzalez94
Copy link
Collaborator Author

@ericnordelo @andrew-fleming I think this is now ready for a final review and hopefully ready to merge 🤞

Copy link
Collaborator

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Collaborator

@immrsd immrsd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, Gustavo! I've left a few minor comments, apart from that everything looks good to me

packages/presets/src/tests/test_erc721.cairo Outdated Show resolved Hide resolved
packages/testing/src/deployment.cairo Outdated Show resolved Hide resolved
packages/testing/src/deployment.cairo Outdated Show resolved Hide resolved
packages/testing/src/deployment.cairo Outdated Show resolved Hide resolved
packages/testing/src/deployment.cairo Outdated Show resolved Hide resolved
@ggonzalez94 ggonzalez94 merged commit 7ced799 into main Sep 11, 2024
7 checks passed
@ericnordelo ericnordelo deleted the update-snforge-0.30.0 branch September 11, 2024 15:06
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.

Upgrade starknet foundry to 0.30.0
4 participants