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

docs: add validate warnings and refactor the account's functions page #1302

Merged
merged 3 commits into from
Jul 4, 2024

Conversation

ArielElp
Copy link
Collaborator

@ArielElp ArielElp commented Jun 27, 2024

Description of the Changes

Added warnings regarding important validations that should manually be added to __execute__.
Slightly refactored the page, and removed most of the last section since the function's signatures don't add new information.

PR Preview URL

https://starknet-io.github.io/starknet-docs/pr-1302/architecture-and-concepts/accounts/account-functions/

Check List

  • Changes have been done against main branch, and PR does not conflict
  • PR title follows the convention: <docs/feat/fix/chore>(optional scope): <description>, e.g: fix: minor typos in code

This change is Reviewable

@ArielElp ArielElp requested a review from odednaor June 27, 2024 13:14
@starknet-bot
Copy link
Collaborator

Oops, your pull request failed to pass the Typo tests stage :( . see the result:
error: absense should be absence
--> ./components/Starknet/modules/architecture-and-concepts/pages/accounts/account-functions.adoc:19:112
|
19 | At the moment of writing (Starknet 0.13.2), two critical validations must happen in +__execute__+, and their absense can lead to draining of the account's funds:
| ^^^^^^^
|

Please fix the typo, commit and push!

@starknet-bot
Copy link
Collaborator

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1302/ .

Copy link
Collaborator

@iliav-starkware iliav-starkware left a comment

Choose a reason for hiding this comment

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

melekh


(1) `assert!(get_caller_address().is_zero())`

This asserts that the account's `execute` is not called from another contract, thus skipping validations (in later versions we may disallow calling `__execute__` from another contract at the protocol level)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
This asserts that the account's `execute` is not called from another contract, thus skipping validations (in later versions we may disallow calling `__execute__` from another contract at the protocol level)
This asserts that the account's `+__execute__+` is not called from another contract, thus skipping `+__validate__+` (in future Starknet versions, we may disallow calling `__execute__` from another contract at the protocol level)


(2) `assert!(get_tx_info().unbox().version.into() >= 1_u32)`

This asserts that the transaction's version is at least 1, preventing your account from accepting v0 transactions. It's critical to explicitly disallow the deprecated v0 transaction type, as v0 transactions assume that the signature verification happens in `+__execute__+`, and are thus skipping `+__validate__+` entirely.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
This asserts that the transaction's version is at least 1, preventing your account from accepting v0 transactions. It's critical to explicitly disallow the deprecated v0 transaction type, as v0 transactions assume that the signature verification happens in `+__execute__+`, and are thus skipping `+__validate__+` entirely.
This asserts that the transaction's version is at least 1, preventing the account from accepting `INVOKE` v0 transactions. It is critical to explicitly disallow the deprecated v0 transaction type, as v0 transactions assume that the signature verification happens in `+__execute__+` and thus skip `+__validate__+` entirely.

Copy link
Collaborator

@odednaor odednaor left a comment

Choose a reason for hiding this comment

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

@ArielElp Made some comments

@starknet-bot
Copy link
Collaborator

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1302/ .

3 similar comments
@starknet-bot
Copy link
Collaborator

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1302/ .

@starknet-bot
Copy link
Collaborator

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1302/ .

@starknet-bot
Copy link
Collaborator

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1302/ .

Copy link
Collaborator Author

@ArielElp ArielElp 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 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @odednaor)


components/Starknet/modules/architecture-and-concepts/pages/accounts/account-functions.adoc line 23 at r2 (raw file):

Previously, odednaor wrote…
This asserts that the account's `+__execute__+` is not called from another contract, thus skipping `+__validate__+` (in future Starknet versions, we may disallow calling `__execute__` from another contract at the protocol level)

replace the first, re second, I think it's easier if we say what's going wrong (no validations)


components/Starknet/modules/architecture-and-concepts/pages/accounts/account-functions.adoc line 27 at r2 (raw file):

Previously, odednaor wrote…
This asserts that the transaction's version is at least 1, preventing the account from accepting `INVOKE` v0 transactions. It is critical to explicitly disallow the deprecated v0 transaction type, as v0 transactions assume that the signature verification happens in `+__execute__+` and thus skip `+__validate__+` entirely.

Done.

@starknet-bot
Copy link
Collaborator

Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-1302/ .

Copy link
Collaborator

@odednaor odednaor left a comment

Choose a reason for hiding this comment

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

lgtm

@ArielElp ArielElp merged commit 194633e into main Jul 4, 2024
1 of 2 checks passed
@ArielElp ArielElp deleted the validate_warnings branch July 4, 2024 05:53
stoobie pushed a commit that referenced this pull request Jul 8, 2024
…#1302)

* add validate warnings and refactor account functions page

* fix typo

* minor fixes
raizo07 pushed a commit to raizo07/starknet-docs that referenced this pull request Jul 9, 2024
…starknet-io#1302)

* add validate warnings and refactor account functions page

* fix typo

* minor fixes
LandauRaz added a commit that referenced this pull request Aug 8, 2024
* doc: compiled class hash

* further improvement to the doc

* fix: Dir structure changes for SEO (#1261)

* Changed /documentation/ to /root/ in antora.yml.

* Changed root to ROOT.

* Change file names for SEO:
* underscores to hyphens
* uppercase to lowercase

* Change file names for SEO to be match content matter

* Added broken links from 3rd party sites

* Update messaging-mechanism.adoc to latest on main.

* Updated xrefs in messaging-mechanism.adoc.

* Updated URL for preview to drop `/documentation/`

* fix: Change "cross-chain" to "cross-layer" in L1-L2 Messaging mechanism (#1289)

* Change "cross-chain" to "cross-layer" in L1-L2 Messaging mechanism

* Apply suggestions from code review

* Removed `seo-optimization` branch from playbook. (#1299)

* docs: add messaging_reference.adoc (#1094)

* create messaging_reference.adoc
* add messaging_reference.adoc to nav
* add the functions implemented in StarknetMessaging.sol but not part of the IStarknetMessaging.sol
* Explain `deployer_address`
* Added links between consumeMessageFromL2 function and ConsumedMessageToL2 event.
* Added links between consumeMessageFromL2 function and ConsumedMessageToL2 event.
* modify event descriptions and add event heading for functions
* fix directory structure
* Comment out events from internal `processMessages` function

* docs: Update Starknet book ToC (#1297)

* Update Starknet book ToC: Update outdated information about Starknet book

---------

Co-authored-by: Steve Goodman <39279277+stoobie@users.noreply.github.com>

* fix typo adding class hashes in tx v3 invoke computation (#1292)

* Update playbook.yml to use main branch for ui-bundle.zip (#1306)

* Fix hash calculation documentation: change 1 to 0 in v1 (deprecated) hash calculation (#1304)

* docs: Update transactions.adoc with txs v3 fee estimation (#1296)

* Update transactions.adoc with txs v3 fee estimation

* Update transactions.adoc

* Update transactions.adoc

* Update transactions.adoc

---------

Co-authored-by: Steve Goodman <39279277+stoobie@users.noreply.github.com>

* Update transaction-life-cycle.adoc with finality status of deploy_account and declare transactions (#1295)

* Update transaction-life-cycle.adoc with finality status of deploy_account and declare transactions

---------

Co-authored-by: Steve Goodman <39279277+stoobie@users.noreply.github.com>

* docs: add validate warnings and refactor the account's functions page (#1302)

* add validate warnings and refactor account functions page

* fix typo

* minor fixes

* Update serialization-of-cairo-types.adoc (#1307)

* docs: Migrate Provers topic from the Starknet Book (#1270)

* Migrating Provers topic from the Starknet Book at https://book.starknet.io/ch03-03-provers.html.

* Import sharp.adoc from the Book in order to bring in a commit with multiple contributors.

* Edits, and removed sharp.adoc
---------

Co-authored-by: Omar U. Espejel <espejelomar@gmail.com>

* Update README.adoc

* docs: add L1HandlerTransaction table and info on caller address (#1275)

* feat: add l1 handler transaction type version

* fix: fix typo

* fix: fix typo

* fix: add a new ref to l1 handler transaction

* fix: reword L1HandlerTransaction to L1 handler transaction in normal text

* fix: reword for consistent format and better readability

* Update components/Starknet/modules/architecture-and-concepts/pages/network-architecture/messaging-mechanism.adoc

* Update components/Starknet/modules/architecture-and-concepts/pages/network-architecture/messaging-mechanism.adoc

* fix: remove old file

* Update components/Starknet/modules/architecture-and-concepts/pages/network-architecture/transactions.adoc

Co-authored-by: Steve Goodman <39279277+stoobie@users.noreply.github.com>

* fix: reword as suggested

---------

Co-authored-by: Steve Goodman <39279277+stoobie@users.noreply.github.com>

* Added a link to info on the L1 handler tx type from the tx versions table. (#1312)

* Update components/Starknet/modules/architecture-and-concepts/nav.adoc

* change file name to use hyphens

* implement reviewed changes

* Update nav.adoc

---------

Co-authored-by: Steve Goodman <39279277+stoobie@users.noreply.github.com>
Co-authored-by: xiaolou86 <20718693+xiaolou86@users.noreply.github.com>
Co-authored-by: Lauri Peltonen <20242241+microbecode@users.noreply.github.com>
Co-authored-by: antiyro <74653697+antiyro@users.noreply.github.com>
Co-authored-by: Nnaji Benjamin <60315147+Benjtalkshow@users.noreply.github.com>
Co-authored-by: odednaor <odednaor@gmail.com>
Co-authored-by: ArielElp <86294909+ArielElp@users.noreply.github.com>
Co-authored-by: jumpman <57270771+kkawula@users.noreply.github.com>
Co-authored-by: Omar U. Espejel <espejelomar@gmail.com>
Co-authored-by: Raz Landau <125185051+LandauRaz@users.noreply.github.com>
Co-authored-by: glihm <dev@glihm.net>
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.

4 participants