fix: correct line number reporting for missing CHECK errors on duplic…#3918
fix: correct line number reporting for missing CHECK errors on duplic…#3918ayushmishra2005 wants to merge 3 commits intosolana-foundation:masterfrom
Conversation
…ate account names - Fix safety_checks() method to iterate through structs explicitly instead of using generic unsafe_struct_fields() - Add struct name to error messages for better context when duplicate field names exist - Remove unused unsafe_struct_fields() method - Update test expectations to match new error message format Fixes solana-foundation#3915
|
@ayushmishra2005 is attempting to deploy a commit to the Solana Foundation Team on Vercel. A member of the Team first needs to authorize it. |
0x4ka5h
left a comment
There was a problem hiding this comment.
@ayushmishra2005, thanks for the contribution. When I run the tests by creating duplicate accounts, the compiler shows the below error instead of pointing to correct line.
--> programs/duplicate-names/src/lib.rs:5:1
|
5 | #[program]
| ^^^^^^^^^^
|
= help: message: Safety checks failed:
/Users/0x4ka5h/Documents/intern/osec/development/anchor/tests/safety-checks/programs/duplicate-names/src/lib.rs:5:0
Struct field "my_account" in struct "FuncTwo" is unsafe, but is not documented.
Please add a `/// CHECK:` doc comment explaining why no checks through types are necessary.
Alternatively, for reasons like quick prototyping, you may disable the safety checks
by using the `skip-lint` option.
See https://www.anchor-lang.com/docs/the-accounts-struct#safety-checks for more information.
Could you please make sure the changes works as expected and please try to add a test to verify the changes are working and setup CI workflow too.
I have addressed this. |
|
Thanks for the update here!
|
0x4ka5h
left a comment
There was a problem hiding this comment.
please take a look at the above comment
|
The fix: correct line number reporting for missing CHECK is mentioned in #4032 |
Fixes #3915