-
Notifications
You must be signed in to change notification settings - Fork 201
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: Adding details about the information that get_execution_info
syscall returns.
#918
Conversation
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
a7fc3f1
to
f559879
Compare
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
There was a problem hiding this 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 3 files reviewed, 6 unresolved discussions (waiting on @stoobie)
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 2 at r2 (raw file):
[id="execution_info"] = Execution information for the current block
Are we sure we like this headline?
I want to say that the tx_info (and the rest of the parameters that are even more specific than the tx_info) are not the same tx info for all transactions run in a given block...
The only think that is for the current block
in this context is the block info...
Code quote:
[id="execution_info"]
= Execution information for the current block
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 11 at r2 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] `block_info: Box<BlockInfo>`:: Contains information about a block. For details, see xref:#block_info[]
Does the link to block_info
work here?
Code quote:
`block_info: Box<BlockInfo>`:: Contains information about a block. For details, see xref:#block_info[]
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 12 at r2 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] `block_info: Box<BlockInfo>`:: Contains information about a block. For details, see xref:#block_info[] `tx_info: Box<TxInfo>`:: Contains information about a transaction.
add xref to tx_info.
Suggestion:
`tx_info: Box<TxInfo>`:: Contains information about a transaction. For details, see xref#tx_info[]
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 22 at r2 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] `_block_number_: u64`:: The number of the block that is currently being executed. When called from an account contracts +`__validate__`+ function, this value is rounded down to the nearest multiple of 100. `_block_timestamp_: u64`:: The timestamp showing the creation time of the block. When called from an account contracts +`__validate__`+ function, this value is rounded down to the nearest hour. #Is this in UTC time? Or seconds since the Unix epoch? Or something else?#
I am not sure. I think it is UTC time...
Code quote:
`_block_timestamp_: u64`:: The timestamp showing the creation time of the block. When called from an account contracts +`__validate__`+ function, this value is rounded down to the nearest hour. #Is this in UTC time? Or seconds since the Unix epoch? Or something else?#
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 36 at r2 (raw file):
This field can be used to prevent replay of testnet transactions on mainnet. `_nonce_: felt252`:: The transaction's nonce. `_resource_bounds_: Span<ResourceBounds>`:: A span of `ResourceBounds` structs.
Not sure I am doing it right - but I believe I have the right spirit.
Suggestion:
`_resource_bounds_: Span<ResourceBounds>`:: A span of `ResourceBounds` structs. For details, see xref#resource_bounds[]
Previously, ArniStarkware (Arnon Hod) wrote…
In this context, the only thing* that is |
There was a problem hiding this 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 3 files reviewed, 6 unresolved discussions (waiting on @ArniStarkware)
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 2 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
In this context, the only thing* that is
for the current block
is the block info.
OK. I changed to "Block execution info" WDYT?
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 11 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Does the link to
block_info
work here?
Done. Fixed.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 12 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
add xref to tx_info.
Done.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 22 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
I am not sure. I think it is UTC time...
Who would know the answer?
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 36 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
Not sure I am doing it right - but I believe I have the right spirit.
Done. :)
…:starknet-io/starknet-docs into steve/get_execution_info_syscall_example
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
Previously, stoobie (Steve Goodman) wrote…
OK, I traced back the source of truth for this number. Under the hood, this |
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
There was a problem hiding this 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 3 files reviewed, 7 unresolved discussions (waiting on @stoobie)
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 2 at r2 (raw file):
Previously, stoobie (Steve Goodman) wrote…
OK. I changed to "Block execution info" WDYT?
How about Execution information
? No specific refer to the block
.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 22 at r4 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] `_block_number_: u64`:: The number of the block that is currently being executed. When called from an account contracts +`__validate__`+ function, this value is rounded down to the nearest multiple of 100.
true for any __validate__
type function. See the comment below.
Code quote:
When called from an account contracts +`__validate__`+ function,
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 23 at r4 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] `_block_number_: u64`:: The number of the block that is currently being executed. When called from an account contracts +`__validate__`+ function, this value is rounded down to the nearest multiple of 100. `_block_timestamp_: u64`:: The timestamp showing the creation time of the block, in seconds since the Unix epoch, based on UTC time, rounded down to the nearest second. When called from an account contract's +`__validate__`+ function, this value is rounded down to the nearest hour.
true for any __validate__
type function. See the comment below.
Code quote:
When called from an account contract's +`__validate__`+ function, this value is rounded down to the nearest hour.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 30 at r4 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] `_version_: felt252`:: The version of the transaction. It is fixed (currently, 1) in the OS, and should be signed by the account contract. This field allows invalidating old transactions, whenever the meaning of the other transaction fields is changed (in the OS).
Suggestion:
`_version_: felt252`:: The version of the transaction. It is fixed (currently, 3) in the OS, and should be signed by the account contract. This field allows invalidating old transactions, whenever the meaning of the other transaction fields is changed (in the OS).
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc
line 68 at r4 (raw file):
In Cairo 1.0, this single system call contains all information for a block, transaction, and execution context. When an account's `+__validate__+` function calls `get_execution_info`:
I am not sure if this is a technical fix.
This statement is true for any "__validate__
type" function.
I mean to say this is true for either of the functions: __validate__
, __validate_declare__
, __validate_deploy__
.
Code quote:
When an account's `+__validate__+` function calls `get_execution_info`:
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc
line 71 at r4 (raw file):
* `block_timestamp` returns the hour, rounded down to the nearest hour. * `block_number` returns the block number, rounded down to the nearest multiple of 100.
A different topic than my last comment:
Here is a suggestion.
It is odd to state what the syscall returns in validate mode but not explain what is returned in any other case.
To see what is usually returned by this syscall, one needs to look into the other file first. maybe link it here as well?
I like that this information is present here. It will help any confused developer dealing with this syscall (dealing with odd bugs related to validate).
Suggestion:
When an account's `+__validate__+` function calls `get_execution_info` some of the returned values are modified:
* `block_timestamp` returns the hour, rounded down to the nearest hour.
* `block_number` returns the block number, rounded down to the nearest multiple of 100.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc
line 82 at r4 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] link:https://github.com/starkware-libs/cairo/blob/main/corelib/src/starknet/info.cairo#L8[`ExecutionInfo`]:: A struct that contains information about the currently executing block and the transactions in the block.
The information is related to either:
The currently executed function.
The currently executed transaction.
The currently executed block.
all of them are tightly connected to the current run. Non of the info is referring to other transactions.
Suggestion:
link:https://github.com/starkware-libs/cairo/blob/main/corelib/src/starknet/info.cairo#L8[`ExecutionInfo`]:: A struct that contains information about the currently executing function, transaction and block.
There was a problem hiding this 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 3 files reviewed, 7 unresolved discussions (waiting on @ArniStarkware)
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 2 at r2 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
How about
Execution information
? No specific refer to theblock
.
Done.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 22 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
true for any
__validate__
type function. See the comment below.
Done.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 23 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
true for any
__validate__
type function. See the comment below.
Done.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/execution_info.adoc
line 30 at r4 (raw file):
[horizontal,labelwidth="25",role="stripes-odd"] `_version_: felt252`:: The version of the transaction. It is fixed (currently, 1) in the OS, and should be signed by the account contract. This field allows invalidating old transactions, whenever the meaning of the other transaction fields is changed (in the OS).
Done.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc
line 68 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
I am not sure if this is a technical fix.
This statement is true for any "
__validate__
type" function.
I mean to say this is true for either of the functions:__validate__
,__validate_declare__
,__validate_deploy__
.
Done.
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc
line 71 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
A different topic than my last comment:
Here is a suggestion.It is odd to state what the syscall returns in validate mode but not explain what is returned in any other case.
To see what is usually returned by this syscall, one needs to look into the other file first. maybe link it here as well?
I like that this information is present here. It will help any confused developer dealing with this syscall (dealing with odd bugs related to validate).
I moved the link to the other page to the top of this section. How's that?
I changed the text to:
When an account's `+__validate__+`, +`__validate_deploy__`+, or +`__validate_declare__`+ function calls `get_execution_info`, the return values for `block_timestamp` and `block_number` are modified as follows:
components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc
line 82 at r4 (raw file):
Previously, ArniStarkware (Arnon Hod) wrote…
The information is related to either:
The currently executed function.
The currently executed transaction.
The currently executed block.all of them are tightly connected to the current run. Non of the info is referring to other transactions.
Done.
Your preview build is ready! ✨ Check the following link in 1-2 minutes: https://starknet-io.github.io/starknet-docs/pr-918/documentation/ . |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 2 files at r3, 2 of 2 files at r5, all commit messages.
Reviewable status: complete! all files reviewed, all discussions resolved (waiting on @stoobie)
Suggestion: `_block_number_: u64`:: The number of the block that is currently being executed. When called from an account contract's +`__validate__`+, +`__validate_deploy__`+, +`__validate_declare__`+, or +`constructor`+ function, this value is rounded down to the nearest multiple of 100. |
Suggestion: When called from an account contract's +`__validate__`+, +`__validate_deploy__`+, +`__validate_declare__`+, or +`constructor`+ function, this value is rounded down to the nearest hour. |
Suggestion: When an account's `+__validate__+`, +`__validate_deploy__`+, +`__validate_declare__`+, or +`constructor`+ function calls `get_execution_info`, the return values for `block_timestamp` and `block_number` are modified as follows: |
…syscall returns. (starknet-io#918) * Adding details about the information that `get_execution_info` syscall returns. * Removed extraneous code block delimiter. * Added 0.13.1 info, and added new page describing execution info. * Update components/Starknet/modules/architecture_and_concepts/nav.adoc * SME comments * Added details for `block_timestamp` * SME comments.
Description of the Changes
This PR addresses issue #917
PR Preview URL
get_execution_info
Check List
<docs/feat/fix/chore>(optional scope): <description>
, e.g:fix: minor typos in code
This change is