NEAR-Edu / near-certification-tools

2 stars 2 forks source link

Providing a suggestion to remove `unsafe` code from invalidate.rs #55

Closed sccheruku closed 2 years ago

sccheruku commented 2 years ago

Using the suggestion found on this doc, https://www.near-sdk.io/promises/create-account & https://github.com/near/near-sdk-rs/blob/master/near-sdk/src/types/account_id.rs#L53

I found that we can still create an account with an empty string using the new_unchecked method.

render[bot] commented 2 years ago

Your Render PR Server URL is https://near-certification-tools-pr-55.onrender.com.

Follow its progress at https://dashboard.render.com/web/srv-c9nue1kgqg4f6e5t41q0.

sccheruku commented 2 years ago

@encody Let me know what you think. Thanks.

encody commented 2 years ago

Hi @sccheruku, thanks for the PR. Unfortunately, using new_unchecked causes tests to fail, since it still performs the validity checks during debug mode. See discussion here.

ryancwalsh commented 2 years ago

@encody Can you please reply here with the link to whatever issue you said you were going to create (I think in the Rust SDK)? Thanks.

encody commented 2 years ago

@encody Can you please reply here with the link to whatever issue you said you were going to create (I think in the Rust SDK)? Thanks.

https://github.com/near/near-sdk-rs/issues/808

sccheruku commented 2 years ago

Got it! thanks for your comment @encody
For what it's worth, running tests with cargo tests --release prevents the assert from triggering. But I'm not sure if that's really a happy path.