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

Updating the Diagnostics Pointer in wrong type for contract. #6849

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Tomer-StarkWare
Copy link
Collaborator

No description provided.

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 4 files at r1, all commit messages.
Reviewable status: 1 of 4 files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware and @Tomer-StarkWare)


crates/cairo-lang-starknet/src/analyzer.rs line 84 at r1 (raw file):

                err.location(db)
                    .unwrap_or_else(|| contract.submodule_id.stable_ptr(db.upcast()).untyped()),
                format!("Failed to generate ABI: {err}"),

if you were supplied with location - you should still use it.

Code quote:

                err.location(db)
                    .unwrap_or_else(|| contract.submodule_id.stable_ptr(db.upcast()).untyped()),
                format!("Failed to generate ABI: {err}"),

crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/interfaces line 1729 at r1 (raw file):

warning: Plugin diagnostic: Failed to generate ABI: Duplicate entry point: 'foo'. This is not currently supported.
 --> lib.cairo:56:5
    #[abi(embed_v0)]

this is definitely a degregation.


crates/cairo-lang-starknet/src/analyzer.rs line 88 at r1 (raw file):

                    break;
                }
            }

Suggestion:

            let mut contract_stable_ptr = if let Some(attr) = contract.module_id().find_attr(db, CONTRACT_ATTR) {
                attr.stable_ptr.untyped()
                } else {
                contract.submodule_id.stable_ptr(db.upcast()).untyped()
            };

@Tomer-StarkWare Tomer-StarkWare force-pushed the tomerc/updating-contract-ABI-ptr branch from 19a9b1c to 2e14e22 Compare December 9, 2024 21:28
Copy link
Collaborator Author

@Tomer-StarkWare Tomer-StarkWare left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 4 files reviewed, 3 unresolved discussions (waiting on @gilbens-starkware and @orizi)


crates/cairo-lang-starknet/src/analyzer.rs line 84 at r1 (raw file):

Previously, orizi wrote…

if you were supplied with location - you should still use it.

Done.


crates/cairo-lang-starknet/src/plugin/plugin_test_data/contracts/interfaces line 1729 at r1 (raw file):

Previously, orizi wrote…

this is definitely a degregation.

Done.


crates/cairo-lang-starknet/src/analyzer.rs line 88 at r1 (raw file):

                    break;
                }
            }

Done.

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @gilbens-starkware and @Tomer-StarkWare)


a discussion (no related file):
do you have any example that is still mapped to full contract?
(As this didn't change any diags)


crates/cairo-lang-starknet/src/analyzer.rs line 91 at r2 (raw file):

                err.location(db).unwrap_or(contract_stable_ptr),
                format!("Failed to generate ABI: {err}"),
            ));

Suggestion:

            let location = err.location(db).unwrap_or_else(
                || if let Ok(Some(attr)) = contract.module_id().find_attr(db, CONTRACT_ATTR) {
                    attr.stable_ptr.untyped()
                } else {
                    contract.submodule_id.stable_ptr(db.upcast()).untyped()
                });

            diagnostics.push(PluginDiagnostic::warning(
                location, format!("Failed to generate ABI: {err}")
            ));

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.

3 participants