diff --git a/components/Starknet/antora.yml b/components/Starknet/antora.yml index 1a7b1f9386..f569b5d7e7 100644 --- a/components/Starknet/antora.yml +++ b/components/Starknet/antora.yml @@ -2,10 +2,12 @@ name: documentation version: ~ title: Starknet nav: - - modules/ROOT/nav.adoc # What is Starknet (temporary landing page) + - modules/ROOT/nav.adoc # Home + - modules/quick_start/nav.adoc # Quick start - modules/starknet_versions/nav.adoc # What is Starknet (temporary landing page) - - modules/architecture_and_concepts/nav.adoc # Developing on Starknet - - modules/getting_started/nav.adoc # Hello Starknet tutorial - - modules/tools/nav.adoc # Network tools - - modules/useful_info/nav.adoc # Useful Info - - modules/end_of_life_and_deprecated_features/nav.adoc # eol \ No newline at end of file + - modules/architecture_and_concepts/nav.adoc # Architecture and concepts + - modules/cairo/nav.adoc # Smart contract reference + - modules/cli/nav.adoc # Starknet CLI +# - modules/api/nav.adoc # API reference + - modules/tools/nav.adoc # Developer tools and resources +# - modules/contribute/nav.adoc # Contribute diff --git a/components/Starknet/modules/ROOT/pages/index.adoc b/components/Starknet/modules/ROOT/pages/index.adoc index 8d701b1aa0..72f57fcee8 100644 --- a/components/Starknet/modules/ROOT/pages/index.adoc +++ b/components/Starknet/modules/ROOT/pages/index.adoc @@ -1,5 +1,5 @@ [id="overview"] -= Introduction += Overview Starknet is a permissionless decentralized Validity-Rollup (also known as a _ZK-Rollup_). It operates as an L2 network over Ethereum, enabling any dApp to achieve unlimited scale for its computation – without compromising Ethereum’s composability and security – thanks to Starknet’s reliance on the safest and most scalable cryptographic proof system: STARK. diff --git a/components/Starknet/modules/api/nav.adoc b/components/Starknet/modules/api/nav.adoc new file mode 100644 index 0000000000..b1fa9094e9 --- /dev/null +++ b/components/Starknet/modules/api/nav.adoc @@ -0,0 +1,2 @@ +* API reference +** xref:api-reference.adoc[Starknet API reference] \ No newline at end of file diff --git a/components/Starknet/modules/api/pages/api-reference.adoc b/components/Starknet/modules/api/pages/api-reference.adoc new file mode 100644 index 0000000000..c67cc01243 --- /dev/null +++ b/components/Starknet/modules/api/pages/api-reference.adoc @@ -0,0 +1,14 @@ += Starknet API reference + + +[subs="html"] +---- +
+---- + + +// Todo: https://github.com/open-rpc/playground integrate the OpenRPC playground into the docs site + +// Source files +// https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_trace_api_openrpc.json +// https://github.com/starkware-libs/starknet-specs/blob/master/api/starknet_write_api.json \ No newline at end of file diff --git a/components/Starknet/modules/architecture_and_concepts/nav.adoc b/components/Starknet/modules/architecture_and_concepts/nav.adoc index 4f97226162..fa4d738efe 100644 --- a/components/Starknet/modules/architecture_and_concepts/nav.adoc +++ b/components/Starknet/modules/architecture_and_concepts/nav.adoc @@ -1,37 +1,41 @@ -* Architecture and concepts - -** Starknet accounts -*** xref:Account_Abstraction/introduction.adoc[Introduction to account abstraction] -*** xref:Account_Abstraction/approach.adoc[Starknet account structure] -*** xref:Account_Abstraction/validate_and_execute.adoc[Validate and execute] -*** xref:Account_Abstraction/deploying_new_accounts.adoc[Deploying new accounts] -*** xref:Account_Abstraction/simplified_transaction_flow.adoc[Simplified transaction flow] - -** Smart contracts -*** xref:Contracts/contract-classes.adoc[Contract classes] -*** xref:Contracts/contract-address.adoc[Contract address] -*** xref:Contracts/contract-storage.adoc[Contract storage] -*** xref:Contracts/contract-abi.adoc[Contract ABI] - -** Blocks and transactions -*** xref:Blocks/header.adoc[Block structure] -*** xref:Blocks/transaction-life-cycle.adoc[Transaction lifecycle] -*** xref:Blocks/transactions.adoc[Transaction types] - -** xref:Fees/fee-mechanism.adoc[Gas and transaction fees] -** xref:L1-L2_Communication/token-bridge.adoc[Starkgate bridge] -** xref:L1-L2_Communication/messaging-mechanism.adoc[L1-L2 messaging] -** xref:Events/starknet-events.adoc[Events] -** xref:Data_Availability/on-chain-data.adoc[Data availability] -** xref:State/starknet-state.adoc[Starknet state] -** xref:Contracts/class-hash.adoc[Class hash] -** xref:Hashing/hash-functions.adoc[Hash functions] - -** System Calls -*** xref:Contracts/system-calls-cairo1.adoc[Cairo 1.0] -*** xref:Contracts/system-calls-cairo0.adoc[Cairo 0] - - -** Cairo on Starknet -*** xref:Cairo_on_Starknet/cairo-1-and-sierra.adoc[Cairo 1.0 and Sierra] -*** xref:Cairo_on_Starknet/contract-syntax.adoc[Contract Syntax - Migration Guide] +* Architecture + +** Blockchain architecture + +*** Blocks and transactions +**** xref:Network_Architecture/Blocks/header.adoc[Block structure] +**** xref:Network_Architecture/Blocks/transaction-life-cycle.adoc[Transaction lifecycle] +**** xref:Network_Architecture/Blocks/transactions.adoc[Transaction types] +**** xref:Network_Architecture/Fees/fee-mechanism.adoc[Gas and transaction fees] + +*** State +**** xref:Network_Architecture/State/starknet-state.adoc[Starknet state] +**** xref:Network_Architecture/Data_Availability/on-chain-data.adoc[Data availability] + +*** L1-L2 messaging +**** xref:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc[L1-L2 messaging] +**** xref:Network_Architecture/L1-L2_Communication/token-bridge.adoc[Starkgate bridge] + +** Accounts +*** xref:Accounts/introduction.adoc[Introduction to account abstraction] +*** xref:Accounts/approach.adoc[Starknet account structure] +*** xref:Accounts/validate_and_execute.adoc[Validate and execute] +*** xref:Accounts/deploying_new_accounts.adoc[Deploying new accounts] +*** xref:Accounts/simplified_transaction_flow.adoc[Simplified transaction flow] + +** Contracts +*** xref:Smart_Contracts/contract-classes.adoc[Contract classes] +*** xref:Smart_Contracts/class-hash.adoc[Class hash] +*** xref:Smart_Contracts/contract-address.adoc[Contract address] +*** xref:Smart_Contracts/contract-storage.adoc[Contract storage] +*** xref:Smart_Contracts/contract-abi.adoc[Contract ABI] +*** xref:Smart_Contracts/Events/starknet-events.adoc[Events] +*** xref:Smart_Contracts/contract-syntax.adoc[Contract migration guide] +*** xref:Smart_Contracts/cairo-and-sierra.adoc[Cairo and Sierra] +*** xref:Smart_Contracts/system-calls-cairo1.adoc[System calls] + +** Cryptography +*** xref:Cryptography/p-value.adoc[Field element type] +*** xref:Cryptography/hash-functions.adoc[Hash functions] +*** xref:Cryptography/stark-curve.adoc[Stark curve] + diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/approach.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/approach.adoc similarity index 100% rename from components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/approach.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Accounts/approach.adoc diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/deploying_new_accounts.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/deploying_new_accounts.adoc similarity index 100% rename from components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/deploying_new_accounts.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Accounts/deploying_new_accounts.adoc diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/introduction.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/introduction.adoc similarity index 97% rename from components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/introduction.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Accounts/introduction.adoc index faf0926172..1dd8e89fa1 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/introduction.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/introduction.adoc @@ -1,7 +1,7 @@ [id="what_is_an_account"] = What is an account? -An account is a user's representation on-chain and the way of interacting with the blockchain. +An account represents a user on-chain, and enables that user to interact with the blockchain. Through an account, you may send transactions and interact with other contracts. To "own" an on-chain asset (e.g. ERC20 token or an NFT), it has to be associated with your account address. diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/simplified_transaction_flow.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/simplified_transaction_flow.adoc similarity index 91% rename from components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/simplified_transaction_flow.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Accounts/simplified_transaction_flow.adoc index a720cdc2db..badb7e128e 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/simplified_transaction_flow.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/simplified_transaction_flow.adoc @@ -12,4 +12,4 @@ The key stages of transaction lifetime are: The sequencer receives fees in ETH in return for including transactions in a block. -For more details on how the transaction fee is computed, see xref:Fees/fee-mechanism.adoc[the fees section] \ No newline at end of file +For more details on how the transaction fee is computed, see xref:../Network_Architecture/Fees/fee-mechanism.adoc[the fees section] \ No newline at end of file diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/validate_and_execute.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/validate_and_execute.adoc similarity index 96% rename from components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/validate_and_execute.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Accounts/validate_and_execute.adoc index f3c5fb9c29..dc30c574ca 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Account_Abstraction/validate_and_execute.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Accounts/validate_and_execute.adoc @@ -16,7 +16,8 @@ The `__validate__` function ensures that any transac Without this mechanism, a forged transaction can result in the sequencer stealing the user's funds. In short, `__validate__` ensures that the sequencer may only include transactions that were approved by the account owner. -The arbitrary logic allowed in the `__validate__` function gives the account's designer the ability to determine what it means for a transaction to be valid. This gives rise to the usage of different signature schemes and other xref:architecture_and_concepts:Account_Abstraction/introduction.adoc#examples[exotic accounts]. +The arbitrary logic allowed in the `__validate__` function gives the account's designer the ability to determine what it means for a transaction to be valid. This gives rise to the usage of different signature schemes +and other xref:architecture_and_concepts:Accounts/introduction.adoc#examples[exotic accounts]. [id="invalid_transactions"] == Invalid transactions diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Cairo_on_Starknet/cairo-1-and-sierra.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Cairo_on_Starknet/cairo-1-and-sierra.adoc deleted file mode 100644 index 8fe1dc4b54..0000000000 --- a/components/Starknet/modules/architecture_and_concepts/pages/Cairo_on_Starknet/cairo-1-and-sierra.adoc +++ /dev/null @@ -1,83 +0,0 @@ -[id="sierra"] -= Cairo 1.0 and Sierra - -Up until xref:documentation:starknet_versions:upcoming_versions.adoc[Starknet Alpha v0.11.0] users would write contracts in Cairo 0 and compile them locally to Cairo assembly (or Casm for short). Next, the user would submit the compilation output (the xref:documentation:architecture_and_concepts:Contracts/contract-classes.adoc[contract class]) to the Starknet sequencer via a `declare` transaction. - -With Cairo 1.0, the contract class resulting from xref:documentation:architecture_and_concepts:Contracts/class-hash.adoc#cairo1_class[compiling Cairo 1.0] does not include Casm. Instead of Casm, it includes instructions in an intermediate representation called Sierra (Safe Intermediate Representation). This new contract class is then compiled by the sequencer, via the Sierra → Casm compiler, to generate the Cairo assembly associated with this class. - -== Why do we need Casm? - -Starknet is a validity rollup, which means that the execution inside every block needs to be proven, and this is where STARKs come in handy. However, STARK proofs can address statements that are formulated in the language of polynomial constraints, and have no knowledge of smart contract execution. To overcome this gap, we developed link:https://github.com/starknet-io/starknet-stack-resources/blob/main/Cairo/Cairo%20%E2%80%93%20a%20Turing-complete%20STARK-friendly%20CPU%20architecture.pdf[Cairo]. - -Cairo instructions (which we referred to previously as Casm) are translated to polynomial constraints that enforce the correct execution of a program (according to semantics the of Cairo). - -Thanks to Cairo, we can formulate the statement "this Starknet block is valid" in a way that we can prove. -Note that we can only prove things about Casm. That is, regardless of what the user sends to the Starknet sequencer, what's proven is the correct Casm execution. - -This means that we need a way to translate Sierra into Casm, and this is achieved with the Sierra → Casm compiler. - - -== Why do we need Sierra? - -To understand why we chose to add an additional layer between the code that the user writes (Cairo 1.0) and the code that is being proven (Casm), we need to consider more components in the system and the limitations of Cairo. - -=== Reverted transactions, unsatisfiable AIRs, and DOS attacks - -A crucial property of every decentralized L2 is that the sequencers are guaranteed to be compensated for the work they do. The notion of reverted transactions is a good example: even if the user's transaction failed mid-execution, the sequencer should be able to include it in a block and charge execution fees up to the point of failure. - -If the sequencer cannot charge for such transactions, then sending transactions that will eventually fail (after a lot of computation steps) is an obvious DOS attack on the sequencer. However, the sequencer cannot look at a transaction and conclude that it would fail without actually doing the work (this is equivalent to solving the undecidable halting problem). - - -The obvious solution to the above predicament is to include such transactions in the block, similar to Ethereum. However, this may not be as simple to do in a validity rollup. With Cairo 0, there is no separating layer between the user code and what is being proven. - -This means that users can write code that is unprovable in some cases. In fact, such code is very easy to write, e.g. `assert 0=1` is a valid Cairo instruction that cannot be proven, as it translates to polynomial constraints that are not satisfiable. As such, any Casm execution that contains this instruction cannot be proven. Sierra is, therefore, the layer between the user code and the provable statement, that allows us to make sure all transactions are eventually provable. - -=== Safe Casm - -The method by which Sierra guarantees that user code is always provable is by compiling Sierra instructions to a subset of Casm, which we call "safe Casm". The important property that we require from safe Casm is being provable for _all_ inputs. A canonical example of safe Casm is using `if/else` instructions instead of `assert`, i.e. making sure all failures are graceful. - -To better understand the considerations that go into designing the Sierra → Casm compiler, consider the `find_element` function from the common library of Cairo 0: - -[source,cairo] ----- -func find_element{range_check_ptr}(array_ptr: felt*, elm_size, n_elms, key) -> (elm_ptr: felt*) { - alloc_locals; - local index; - %{ - ... - %} - assert_nn_le(a=index, b=n_elms - 1); - tempvar elm_ptr = array_ptr + elm_size * index; - assert [elm_ptr] = key; - return (elm_ptr=elm_ptr); -} ----- - -[NOTE] -==== -Below we abuse the "Casm" notation by not distinguishing Cairo 0 from Casm and referring to the -above as Casm (while we actually refer to the compilation result of the above). -==== - -For brevity, we have omitted the hint in the above snippet, but it's clear that this function can only execute correctly if the requested element exists in the array (otherwise it would fail for every possible hint, as there is nothing we can substitute `index` for that will make the following lines run successfully). - -Such Casm cannot be generated by the Sierra→Casm compiler. Furthermore, simply replacing the assertion with an if/else statement doesn't do, as this results in a non-deterministic execution (that is, different hint values can yield different results for the same input). A malicious prover can use this freedom to harm the user - in this example, they are able to make it seem as if an element isn't part of the array, even though it actually is. - -The safe Casm for finding an element in an array behaves like the above snippet in the happy flow (the element is there): an index is given in a hint, and we verify that the array at the hinted index contains the requested element. However, in the unhappy flow (the element isn't there), we *must* go over the entire array to verify this. - -This was not the case in Cairo 0, as we were fine with certain paths not being provable (in the above snippet, the unhappy flow in which the element isn't in the array is never provable). - -[NOTE] -==== -Sierra's gas metering adds further complications to the above example. - -If we take gas limitations into consideration, the user may have enough gas for the happy flow, but not for the unhappy one, making the execution stop mid-search, and allowing the prover to get away with lying about the element not being present. - -The way we plan to handle this is by requiring the user to have enough gas for the unhappy flow before actually calling `find_element`. -==== - -=== Hints in Cairo 1.0 - -Smart contracts written with Cairo 1.0 cannot contain user-defined hints. This is already somewhat true for Cairo 0 contracts (only whitelisted hints are accepted), but with Cairo 1.0 the hints in use are determined only by the Sierra → Casm compiler. Since this compilation is there to ensure that only safe Casm is generated, there is no room for hints that are not generated by the compiler. - -In the future, native Cairo 1.0 may contain hint syntax similar to Cairo 0, but it will not be available in Starknet smart contracts (such functionality may be used by link:https://medium.com/starkware/fractal-scaling-from-l2-to-l3-7fe238ecfb4f[L3s] on top of Starknet). Note that this is currently not part of Starknet's roadmap. \ No newline at end of file diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls-cairo0.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls-cairo0.adoc deleted file mode 100644 index 5d7381b8d4..0000000000 --- a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls-cairo0.adoc +++ /dev/null @@ -1,634 +0,0 @@ -= System Calls - -Writing smart contracts requires various associated operations, such as calling another contract or accessing the contract’s storage, that standalone programs do not require. The Starknet contract language supports these operations by using system calls. System calls enable a contract to require services from the Starknet OS. You can use system calls in a function to get information that depends on the broader state of Starknet, which would otherwise be inaccessible, rather than local variables that appear in the function’s scope. - -[id="getters"] -== Getters - -Below we describe the collection of system calls that can be used to get information regarding the block, transaction, or execution context during runtime (e.g. block number, account address, and caller address). - -[id="get_block_number"] -=== `get_block_number` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func get_block_number{syscall_ptr : felt*}() -> (__block_number__ : felt) ----- - -[discrete] -==== Description - -Gets the number of the block in which the transaction is executed. - -[discrete] -==== Arguments - -None. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_block_number_`:: The number of the block in which the transaction is executed. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L161[`syscalls.cairo`^] - - -[id="get_block_timestamp"] -=== `get_block_timestamp` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func get_block_timestamp{syscall_ptr : felt*}() -> (__block_timestamp__ : felt) ----- - -[discrete] -==== Description - -Gets the timestamp of the block in which the transaction is executed. - -[discrete] -==== Arguments - -None. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_block_timestamp_`:: The timestamp of the block in which the transaction is executed. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L210[`syscalls.cairo`^] - - -[id="get_caller_address"] -=== `get_caller_address` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func get_caller_address{syscall_ptr : felt*}() -> (__caller_address__ : felt) ----- - -[discrete] -==== Description - -Returns the address of the calling contract, or 0 if the call was not initiated by another contract. - -[discrete] -==== Arguments - -None. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`__caller_address__`:: The address of the calling contract, or 0 if the call was not initiated by another contract. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/common/syscalls.cairo#L200[`syscalls.cairo`^] - - -[id="get_contract_address"] -=== `get_contract_address` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func get_contract_address{syscall_ptr : felt*}() -> (__contract_address__ : felt) ----- - -[discrete] -==== Description - -Gets the address of the contract who raised the system call. - -[discrete] -==== Arguments - -None. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_contract_address_`:: The address of the contract that raised the system call. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L186[`syscalls.cairo`^] - - -[id="get_sequencer_address"] -=== `get_sequencer_address` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func get_sequencer_address{syscall_ptr : felt*}() -> (__sequencer_address__ : felt) ----- - -[discrete] -==== Description - -Returns the address of the sequencer that generated the current block. - -[discrete] -==== Arguments - -None. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_sequencer_address_`:: The address of the sequencer that generated the current block. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L138[`syscalls.cairo`^] - - -[id="get_transaction_info"] -=== `get_transaction_info` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func get_tx_info{syscall_ptr : felt*}() -> (__tx_info__ : TxInfo*) ----- - -[discrete] -==== Description - -Gets information about the original transaction. - -[discrete] -==== Arguments - -None. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_tx_info_`:: The following information about the original transaction: -+ -* The version of the transaction. -* The address of the account that initiated this transaction. -* The maximum fee that is allowed to be charged for the inclusion of this transaction. -* The signature of the account that initiated this transaction. -* The transaction's hash. -* The intended chain id. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L351[`syscalls.cairo`^] - - -[id="call_contract"] -== `call_contract` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func call_contract{syscall_ptr : felt*}( - __contract_address__ : felt, __function_selector__ : felt, __calldata_size__ : felt, __calldata__ : felt* -) -> (__retdata_size__ : felt, __retdata__ : felt*) ----- - -[discrete] -==== Description - -Calls a given contract. This system call expects the address of the called contract, a selector for a function within that contract, and call arguments. - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_contract_address_`:: The address of the contract you want to call. -`_function_selector_`:: A selector for a function within that contract. -`_calldata_size_`:: The size, in number of felts, of the calldata. -`_calldata_`:: The calldata. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_retdata_size_`:: The size, in number of felts, of the return data. -`_retdata_`:: The return data. - - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/common/syscalls.cairo#L42[`syscalls.cairo`^] - -[NOTE] -==== -This is considered a lower-level syntax for calling contracts. - -If the interface of the called contract is available, then you can use a more straightforward syntax. -==== - - -[id="deploy"] -== `deploy` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func deploy{syscall_ptr : felt*}( - __class_hash__ : felt, - __contract_address_salt__ : felt, - __constructor_calldata_size__ : felt, - __constructor_calldata__ : felt*, - __deploy_from_zero__: felt, -) -> (__contract_address__ : felt) ----- - -[discrete] -==== Description - -Deploys a new instance of a previously declared class. - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_class_hash_`:: The class hash of the contract to be deployed. -`_contract_address_salt_`:: The salt, an arbitrary value provided by the sender, used in the computation of the xref:Contracts/contract-address.adoc[contract's address]. -`_constructor_calldata_size_`:: The number of arguments to pass to the constructor, equal to the number of felts in `_constructor_calldata_`. -`_constructor_calldata_`:: The constructor's calldata. An array of felts. -`__deploy_from_zero__`:: A flag used for the contract address computation. If set, the new contract's deployer address will be `0`. Otherwise, the caller's address will be used. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_contract_address_`:: The address of the deployed contract. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/common/syscalls.cairo#L157[`syscalls.cairo`^] - - -[id="emit_event"] -== `emit_event` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func emit_event{syscall_ptr : felt*}(__keys_len__ : felt, __keys__ : felt*, __data_len__ : felt, __data__ : felt*) ----- - -[discrete] -==== Description - -Emits an event with a given set of keys and data. - -For more information, and for a higher-level syntax for emitting events, see xref:Events/starknet-events.adoc[Starknet events]. - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_keys_len_`:: The number of keys in the event. Analogous to Ethereum's event topics, you can use the link:https://github.com/starkware-libs/starknet-specs/blob/c270b8170684bb09741672a7a4ae5003670c3f43/api/starknet_api_openrpc.json#L569RPC[starknet_getEvents] method to filter by these keys. -`_keys_`:: The event's keys. -`_data_len_`:: The number of data elements in the event. -`_data_`:: The event's data. - -[discrete] -==== Return values - -None. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L301[`syscalls.cairo`^] - -[discrete] -==== Example - -The following example emits an event with two keys, the https://www.cairo-lang.org/docs/how_cairo_works/consts.html#short-string-literals[strings] `status` and `deposit` and three data elements: `1`, `2`, and `3`. - -[source,cairo] ----- -let (keys : felt*) = alloc() -assert keys[0] = 'status' -assert keys[1] = 'deposit' -let (data : felt*) = alloc() -assert data[0] = 1 -assert data[1] = 2 -assert data[2] = 3 -emit_event(2, keys, 3, data) ----- - - -[id="library_call"] -== `library_call` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func library_call{syscall_ptr : felt*}( - __class_hash__ : felt, __function_selector__ : felt, __calldata_size__ : felt, __calldata__ : felt* -) -> (__retdata_size__ : felt, __retdata__ : felt*) ----- - -[discrete] -==== Description - -Calls the requested function in any previously declared class. The class is only used for its logic. - -This system call replaces the known delegate call functionality from Ethereum, with the important difference that there is only one contract involved. - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_class_hash_`:: The hash of the class you want to use. -`_function_selector_`:: A selector for a function within that class. -`_calldata_size_`:: The size, in number of felts, of the calldata. -`_calldata_`:: The calldata. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_retdata_size_`:: The size, in number of felts, of the return data. -`_retdata_`:: The return data. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/common/syscalls.cairo#L85[`syscalls.cairo`^] - - -[id="library_call_l1_handler"] -== `library_call_l1_handler` - -[WARNING] -==== -This system call is not currently not supported in Cairo 1.0. -In practice, this was only used for proxy contracts, which in Cairo 1.0 can be implemented instead via the `replace_class` system call, making `library_call_l1_handler` redundant. -==== - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func library_call_l1_handler{syscall_ptr : felt*}( - __class_hash__ : felt, __function_selector__ : felt, __calldata_size__ : felt, __calldata__ : felt* -) -> (__retdata_size__ : felt, __retdata__ : felt*) ----- - -[discrete] -==== Description - -Calls the requested L1 handler in any previously declared class. - -Same as the `library_call` system call, but also enables you to call an L1 handler that cannot otherwise be called directly. For more information, see Starknet's xref:L1-L2_Communication/messaging-mechanism.adoc#l1-l2_messages[messaging mechanism] (note that when you invoke an L1 handler with this system call, the sequencer does not consume an L1->L2 message). - -[TIP] -==== -It is recommended to raise this system call only inside an L1 handler in order to use the logic inside an L1 handler of a different class. -==== - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_class_hash_`:: The hash of the class you want to use. -`_function_selector_`:: A selector for an L1 handler function within that class. -`_calldata_size_`:: The size, in number of felts, of the calldata. -`_calldata_`:: The calldata. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_retdata_size_`:: The size, in number of felts, of the return data. -`_retdata_`:: The return data. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/common/syscalls.cairo#L107[`syscalls.cairo`^] - - -[id="send_message_to_L1"] -== `send_message_to_L1` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func send_message_to_l1{syscall_ptr : felt*}( - __to_address__ : felt, __payload_size__ : felt, __payload__ : felt* -) ----- - -[discrete] -==== Description - -Sends a message to L1. - -This system call includes the message parameters as part of the proof's output and exposes these parameters to the Starknet Core contract on L1 once the state update, including the transaction, is received. - -For more information, see Starknet's xref:L1-L2_Communication/messaging-mechanism.adoc[messaging mechanism]. - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_to_address_`:: The recipient's L1 address. -`_payload_size_`:: The size of the message payload. -`_payload_`:: A pointer to an array containing the contents of the message. - -[discrete] -==== Return values - -None. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/common/messages.cairo[`messages.cairo`^] - -[discrete] -==== Example - -The following example sends a message whose content is `(1,2)` to the L1 contract whose address is `3423542542364363`. - -[source,cairo,subs="+quotes,+macros"] ----- -let payload = alloc() -payload[0] = 1 -payload[1] = 2 -send_message_to_l1(3423542542364363,2,payload) ----- - - -[id="replace_class"] -== `replace_class` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -replace_class(class_hash: felt) ----- - -[discrete] -==== Description -Once `replace_class` is called, the class of the calling contract (i.e. the contract whose address is returned by `get_contract_address` at the time the syscall is called) will be replaced -by the class whose hash is given by the class_hash argument. - -[NOTE] -==== -After calling `replace_class`, the code currently executing from the old class will finish running. - - -The new class will be used from the next transaction onwards or if the contract is called via -the call_contract syscall in the same transaction (after the replacement). -==== - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_class_hash_`:: The hash of the class you want to use as a replacement. - -[discrete] -==== Return values - -None. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/common/syscalls.cairo#L463[`syscalls.cairo`^] - -[id="storage_read"] -== `storage_read` - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func storage_read{syscall_ptr : felt*}(__address__ : felt) -> (__value__ : felt) ----- - -[discrete] -==== Description - -Gets the value of a key in the storage of the calling contract. - -This system call provides direct access to any possible key in storage, in contrast with `var.read()`, which enables you to read storage variables that are defined explicitly in the contract. - -For information on accessing storage by using the storage variables, see xref:./contract-storage.adoc#storage_variables[storage variables]. - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_address_`:: The address of the storage key you want to read. - -[discrete] -==== Return values - -[horizontal,labelwidth=35] -`_value_`:: The value of the key. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L264[`syscalls.cairo`^] - -[discrete] -==== Example - -[source,cairo,subs="+quotes,+macros"] ----- -let value = storage_read(3534535754756246375475423547453) ----- - -[id="storage_write"] -== `storage_write` - -Sets the value of a key in the storage of the calling contract. - -[discrete] -==== Syntax - -[source,cairo,subs="+quotes,+macros"] ----- -func storage_write{syscall_ptr : felt*}(__address__ : felt, __value__ : felt) ----- - -[discrete] -==== Description - -Sets the value of a key in the storage of the calling contract. - -This system call provides direct access to any possible key in storage, in contrast with `var.write()`, which enables you to write to storage variables that are defined explicitly in the contract. - -For information on accessing storage by using the storage variables, see xref:./contract-storage.adoc#storage_variables[storage variables]. - -[discrete] -==== Arguments - -[horizontal,labelwidth=35] -`_address_`:: The address of the storage key to which you want to write. -`_value_`:: The value to write to the key. - -[discrete] -==== Return values - -None. - -[discrete] -==== Common library - -link:https://github.com/starkware-libs/cairo-lang/blob/2abd303e1808612b724bc1412b2b5babd04bb4e7/src/starkware/starknet/common/syscalls.cairo#L282[`syscalls.cairo`^] diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/hash-functions.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/hash-functions.adoc new file mode 100644 index 0000000000..45b8a1589e --- /dev/null +++ b/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/hash-functions.adoc @@ -0,0 +1,85 @@ +[id="hash_functions"] += Hash functions +:stem: latexmath + +[id="domain_and_range"] +== Domain and range + +All hashes outputs are eventually mapped to elements in stem:[$\mathbb{F}_p$] with stem:[$p=2^{251}+17\cdot 2^{192}+1$]. + +There are three hash functions used throughout Starknet's specifications: + +* stem:[$sn\_keccak: \{0,1\}^* \rightarrow \mathbb{F}_p$] +* stem:[$pedersen: \mathbb{F}_p^2\rightarrow\mathbb{F}_p$] +* stem:[$poseidon: \mathbb{F}_p^*\rightarrow \mathbb{F}_p$] + +[id="starknet_keccak"] +== Starknet Keccak + +Starknet keccak, usually denoted by stem:[$sn\_keccak$], is defined as the first 250 bits of the Keccak256 hash (this is just Keccak256 augmented +in order to fit into a field element). + +[id="pedersen_hash"] +== Pedersen hash + + + +[id="poseidon_hash"] +== Poseidon hash + +link:https://www.poseidon-hash.info/[Poseidon] is a family of hash functions designed for being very efficient as algebraic circuits. As such, they may be very useful in ZK proving systems such as STARKs and others. + +Poseidon is a sponge construction based on the Hades permutation. Starknet's version of Poseidon is based on a three element state permutation (see exact parameters below). + +We define the Poseidon hash of up to 2 elements below, see xref:#poseidon_array_hash[below] the arbitrary number of inputs version. + +[stem] +++++ +poseidon_1(x) := \left[\text{hades_permutation}(x,0,1)\right]_0 +++++ + + +[stem] +++++ +poseidon_2(x,y) := \left[\text{hades_permutation}(x,y,2)\right]_0 +++++ + +Where latexmath:[[\cdot\]_j] denotes taking the j'th coordinate of a tuple + +Useful resources: + +* The exact link:https://github.com/starkware-industries/poseidon/blob/main/poseidon3.txt[parameters] defining the permutation used in Starknet +* A link:https://github.com/CryptoExperts/poseidon[reference implementation] (in c and assembly) of the above by CryptoExperts + + +[id="array_hashing"] +== Array hashing + +[id="pedersen_array_hash"] +=== Pedersen + +Let stem:[$h$] denote the pedersen hash function, then given an array stem:[$a_1,...,a_n$] of stem:[$n$] field elements +we define stem:[$h(a_1,...,a_n)$] to be: + +[stem] +++++ +h(...h(h(0, a_1),a_2),...,a_n),n) +++++ + +[id="poseidon_array_hash"] +=== Poseidon + +Let stem:[$\text{hades}:\mathbb{F}_p^3\rightarrow\mathbb{F}_p^3$] denote the Hades permutation (with Starknet's parameters), then given an array stem:[$a_1,...,a_n$] of stem:[$n$] field elements +we define stem:[$poseidon(a_1,...,a_n)$] to be the first coordinate of stem:[$H(a_1,...,a_n;0,0,0)$], where: + +[stem] +++++ +H(a_1,...,a_n;s_1,s_2,s_3)=\begin{cases} +H\big(a_3,...,a_n;\text{hades}(s_1+a_1, s_2+a_2, s_3)\big), & \text{if } n\ge 2 \\ +\text{hades}(s_1+a_1,s_2+1,s_3), & \text{if } n=1 \\ +\text{hades}(s_1+1,s_2,s_3), & \text{if } n=0 \\ +\end{cases} +++++ + +You can find an implementation of the above in Python link:https://github.com/starkware-libs/cairo-lang/blob/12ca9e91bbdc8a423c63280949c7e34382792067/src/starkware/cairo/common/poseidon_hash.py#L46[here], +and an equivalent Cairo implementation link:https://github.com/starkware-libs/cairo-lang/blob/12ca9e91bbdc8a423c63280949c7e34382792067/src/starkware/cairo/common/builtin_poseidon/poseidon.cairo#L28[here]. diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/p-value.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/p-value.adoc new file mode 100644 index 0000000000..442ab6678c --- /dev/null +++ b/components/Starknet/modules/architecture_and_concepts/pages/Cryptography/p-value.adoc @@ -0,0 +1,5 @@ += `P` value + +The field element type in Starknet is based on the field in the underlying Cairo VM. In other words, a value stem:[$$x$$] of a field element type is an integer in the range of stem:[$$0≤x` | Additional information given by the sender, used to validate the transaction. @@ -185,8 +186,8 @@ declare_v2_tx_hash = ℎ( Where: -* stem:[$h$] is the xref:documentation:architecture_and_concepts:Hashing/hash-functions.adoc#poseidon_hash[Poseidon hash function] -* `class_hash` is the hash of the contract class. See xref:Contracts/class-hash.adoc#computing_the_cairo_1_class_hash[Class Hash] +* stem:[$h$] is the xref:Cryptography/hash-functions.adoc#poseidon_hash[Poseidon hash function] +* `class_hash` is the hash of the contract class. See xref:Smart_Contracts/class-hash.adoc#computing_the_cairo_1_class_hash[Class Hash] for details about how the hash is computed * `compiled_class_hash` is the hash of the xref:starknet_versions:upcoming_versions.adoc#what_to_expect[compiled class] @@ -239,12 +240,11 @@ declare_v1_tx_hash = ℎ( Where: * stem:[\text{declare}] is a constant prefix string, encoded in ASCII. -* stem:[\text{class_hash}] is the hash of the xref:../Contracts/contract-classes.adoc[contract -class]. See xref:../Contracts/class-hash.adoc[Class Hash] for details about how the hash is +* stem:[\text{class_hash}] is the hash of the xref:architecture_and_concepts:Smart_Contracts/contract-classes.adoc[contract class]. See xref:architecture_and_concepts:Smart_Contracts/class-hash.adoc[Class Hash] for details about how the hash is computed. * The placeholder zero is used to align the hash computation for the different types of transactions. -* stem:[\text{chain_id}] is a constant value that specifies the network to which this transaction is sent. See xref:chain-id[Chain-Id]. -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#pedersen_hash[Pedersen] hash +* stem:[\text{chain_id}] is a constant value that specifies the network to which this transaction is sent. See xref:#chain-id[Chain-Id]. +* stem:[$h$] is the xref:../Cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash ==== v0 hash calculation @@ -269,12 +269,14 @@ Where: * stem:[\text{declare}] is a constant prefix string, encoded in ASCII. * The placeholder zeros are used to align the hash computation for the different types of transactions. -* stem:[\text{class_hash}] is the hash of the xref:../Contracts/contract-classes.adoc[contract -class]. See xref:../Contracts/class-hash.adoc[Class Hash] for details about how the hash is +* stem:[\text{class_hash}] is the hash of the xref:architecture_and_concepts:Smart_Contracts/contract-classes.adoc[contract +class]. See xref:architecture_and_concepts:Smart_Contracts/class-hash.adoc[Class Hash] for details about how the hash is computed. * stem:[\text{chain_id}] is a constant value that specifies the network to which this transaction is sent. See xref:chain-id[Chain-Id]. -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#pedersen_hash[Pedersen] hash +* stem:[$h$] is the xref:../Cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash + +[id=deploy_account_transaction] ## Deploy account transaction Since xref:starknet_versions:version_notes.adoc#version0.10.1[StarkNet v0.10.1] the `deploy_account` @@ -282,7 +284,7 @@ transaction replaces the `deploy` transaction for deploying account contracts. To use it, you should first pre-fund your would-be account address so that you could pay the -transaction fee (see xref:Account_Abstraction/deploying_new_accounts.adoc[here] for more details) +transaction fee (see xref:Accounts/deploying_new_accounts.adoc[here] for more details) . You can then send the `deploy_account` transaction. @@ -296,7 +298,7 @@ A `deploy_account` transaction has the following fields: | `class_hash` | `FieldElement` | The hash of the desired account class. | `constructor_calldata` | `List` | The arguments to the account constructor. -| `contract_address_salt` | `FieldElement` | A random salt that determines the xref:Contracts/contract-address.adoc[account address]. +| `contract_address_salt` | `FieldElement` | A random salt that determines the xref:Smart_Contracts/contract-address.adoc[account address]. | `signature` | `List` | Additional information given by the sender, used to validate the transaction. | `max_fee` | `FieldElement` | The maximum fee that the sender is willing to pay for the transaction | `nonce` | `FieldElement` | The transaction nonce. @@ -322,9 +324,10 @@ deploy_account_tx_hash = ℎ( ) ---- +[id="signature"] == Signature -While Starknet does not have a specific signature scheme built into the protocol, the Cairo language, in which smart contracts are written, does have an efficient implementation for ECDSA signature with respect to a xref:../Hashing/hash-functions.adoc#stark_curve[STARK-friendly curve]. +While Starknet does not have a specific signature scheme built into the protocol, the Cairo language, in which smart contracts are written, does have an efficient implementation for ECDSA signature with respect to a xref:../Cryptography/hash-functions.adoc#stark_curve[STARK-friendly curve]. The generator used in the ECDSA algorithm is stem:[G=\left(g_x, g_y\right)] where: diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Data_Availability/on-chain-data.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/Data_Availability/on-chain-data.adoc similarity index 92% rename from components/Starknet/modules/architecture_and_concepts/pages/Data_Availability/on-chain-data.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/Data_Availability/on-chain-data.adoc index 4194ff592c..3cbffa56d9 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Data_Availability/on-chain-data.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/Data_Availability/on-chain-data.adoc @@ -62,8 +62,7 @@ Next, we have information about newly declared classes: === v0.11.0 example Below we show an example of on chain data that was extracted from L1, and proceed to decode it -according to the xref:documentation:architecture_and_concepts:Data_Availability/on-chain-data.adoc#v0.11.0_format -[above format]. +according to the xref:#v0.11.0_format[above format]. [source,json] ---- @@ -89,9 +88,11 @@ according to the xref:documentation:architecture_and_concepts:Data_Availability/ to `200`) * Next we have the new declare section: `1` means that we had a single -xref:documentation:architecture_and_concepts:Blocks/transactions.adoc#declare_v2[declare v2] in this state update, and the next two elements + +xref:Network_Architecture/Blocks/transactions.adoc#declare_v2[declare v2] in this state update, and the next two elements encode -xref:documentation:architecture_and_concepts:Contracts/class-hash.adoc[the class hash] and + +xref:../Smart_Contracts/class-hash.adoc[the class hash] and xref:starknet_versions:upcoming_versions.adoc#what_to_expect[compiled class hash] of the declared class @@ -104,11 +105,14 @@ The state diffs contain information on every contract whose storage was updated * Number of cells that encode contract deployments * For each deployed contract, we have: - ** `contract_address` - the xref:../Contracts/contract-address.adoc[address] of the deployed contract - ** `contract_hash` - the xref:../Contracts/class-hash.adoc[hash] of the class + +xref:Smart_Contracts/contract-address.adoc + + ** `contract_address` - the xref:Network_Architecture/Data_Availability/on-chain-data.adoc[address] of the deployed contract + ** `contract_hash` - the xref:../Smart_Contracts/class-hash.adoc[hash] of the class * Number of contracts whose storage is updated * For each such contract, we have: - ** `contract_address` - the xref:../Contracts/contract-address.adoc[address] of the contract + ** `contract_address` - the xref:../Network_Architecture/Data_Availability/on-chain-data.adoc[address] of the contract ** `num_of_storage_updates` - number of storage updates ** `nonce, num of storage updates ` - a uint256 value that encodes both the number of storage updates for that contract and the updated nonce: + diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Fees/fee-mechanism.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/Fees/fee-mechanism.adoc similarity index 92% rename from components/Starknet/modules/architecture_and_concepts/pages/Fees/fee-mechanism.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/Fees/fee-mechanism.adoc index 320832f7ae..59f130f129 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Fees/fee-mechanism.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/Fees/fee-mechanism.adoc @@ -4,18 +4,19 @@ In this section, we will review Starknet Alpha fee mechanism. If you want to skip the motivation and deep dive into the mechanism, you can skip directly to the final xref:overall_fee[formula]. -This section focuses on fees paid by an account on L2. For information about messaging fees that are paid on L1, see xref:../L1-L2_Communication/messaging-mechanism.adoc#l1-l2_message-fees[L1 → L2 message fees]. +This section focuses on fees paid by an account on L2. For information about messaging fees that are paid on L1, see xref:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc#l1-l2-message-fees[L1 → L2 +message fees]. == Introduction -Users can specify the maximum fee that they are willing to pay for a transaction via the `max_fee` xref:../Blocks/transactions.adoc[field]. +Users can specify the maximum fee that they are willing to pay for a transaction via the `max_fee` xref:Network_Architecture/Blocks/transactions.adoc[field]. The only limitation on the sequencer (enforced by the Starknet OS) is that the actual fee charged is bounded by `max_fee`, but for now, StarkWare's sequencer will only charge the fee required to cover the proof cost (potentially less than the max fee). Presently, the sequencer only takes into account L1 costs involving proof submission. There are two components affecting the L1 footprint of a transaction: * xref:computation[Computational complexity]: the heavier the transaction, the larger its portion in the proof verification cost. -* xref:_on_chain_data[On chain data]: L1 calldata cost originating from xref:Data_Availability/on-chain-data.adoc[data availability] and L2→L1 messages. +* xref:_on_chain_data[On chain data]: L1 calldata cost originating from xref:architecture_and_concepts:Network_Architecture/Data_Availability/on-chain-data.adoc[data availability] and L2→L1 messages. == Fee units @@ -100,7 +101,7 @@ The on-chain data associated with a transaction is composed of three parts ==== Storage updates -Whenever a transaction updates a key at the storage of some contract, the following xref:Data_Availability/on-chain-data.adoc[data] +Whenever a transaction updates a key at the storage of some contract, the following data reaches L1: * Contract_address @@ -133,7 +134,7 @@ For example, if different transactions within the same block update the same sto ==== L2→L1 messages -When a transaction that raises the `send_message_to_l1` syscall is included in a state update, the following xref:../Data_Availability/on-chain-data.adoc[data] reaches L1: +When a transaction that raises the `send_message_to_l1` syscall is included in a state update, the following data reaches L1: * L2 sender address * L1 destination address @@ -151,7 +152,7 @@ where stem:[$c_w$] is the calldata cost (in gas) per 32-byte word. ==== Deployed contracts -When a transaction that raises the `deploy` syscall is included in a state update, the following xref:../Data_Availability/on-chain-data.adoc#format[data] reaches L1: +When a transaction that raises the `deploy` syscall is included in a state update, the following data reaches L1: * Contract address * Class hash diff --git a/components/Starknet/modules/architecture_and_concepts/pages/L1-L2_Communication/messaging-mechanism.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc similarity index 94% rename from components/Starknet/modules/architecture_and_concepts/pages/L1-L2_Communication/messaging-mechanism.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc index c09e8f8d87..2f8721c3a8 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/L1-L2_Communication/messaging-mechanism.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc @@ -60,7 +60,7 @@ keccak256( NOTE: As the hash of the message being sent needs to be written to L1 storage (in the Starknet Core contract) there is always a fixed 20k gas cost associated with sending an L2 to L1 message. -[id="l1-l2_messages"] +[id="l1-l2-messages"] == L1 → L2 messages Contracts on L1 can interact asynchronously with contracts on L2 via the L1→L2 messaging protocol. The protocol consists of the following stages: @@ -107,7 +107,7 @@ The reason for the delay is to protect the sequencer from a DOS attack in the fo Note that this flow should only be used in edge cases such as bugs on the Layer 2 contract preventing message consumption. -[id="l1-l2_message_fees"] +[id="l1-l2-message-fees"] === L1 → L2 message fees An L1 → L2 message induces a transaction on L2, which, unlike regular transactions, is not sent by an account. This calls for a different mechanism for paying the transaction's fee, for otherwise the sequencer has no incentive of including L1 handler transactions inside a block. @@ -116,7 +116,8 @@ To avoid having to interact with both L1 and L2 when sending a message, L1 → L The sequencer takes this fee in exchange for handling the message. The sequencer charges the fee in full upon updating the L1 state with the consumption of this message. -The fee itself is calculated in the xref:../Fees/fee-mechanism.adoc#overall_fee[same manner] as "regular" L2 transactions. You can use the xref:tools:CLI/commands.adoc#starknet_estimate_fee[CLI] to get an estimate of an L1 → L2 message fee. +The fee itself is calculated in the xref:../Network_Architecture/Fees/fee-mechanism.adoc#overall_fee[same manner] as +"regular" L2 transactions. You can use the xref:documentation:cli:commands.adoc#starknet-estimate_fee[CLI] to get an estimate of an L1 → L2 message fee. [id="structure_and_hashing_l1-l2"] === L1 → L2 structure and hashing @@ -174,8 +175,8 @@ l1_handler_tx_hash = ℎ( Where: - stem:[\text{l1_handler}] is a constant prefix, encoded in bytes (ASCII), with big-endian. -- stem:[\text{chain_id}] is a constant value that specifies the network to which this transaction is sent. See xref:../Blocks/transactions.adoc#chain-id[Chain-Id]. -- stem:[$$h$$] is the xref:../Hashing/hash-functions.adoc#pedersen_hash[Pedersen] hash +- stem:[\text{chain_id}] is a constant value that specifies the network to which this transaction is sent. +- stem:[$$h$$] is the xref:../Cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash [NOTE] ==== diff --git a/components/Starknet/modules/architecture_and_concepts/pages/L1-L2_Communication/token-bridge.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/L1-L2_Communication/token-bridge.adoc similarity index 95% rename from components/Starknet/modules/architecture_and_concepts/pages/L1-L2_Communication/token-bridge.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/L1-L2_Communication/token-bridge.adoc index 82b250b81e..75815f389d 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/L1-L2_Communication/token-bridge.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/L1-L2_Communication/token-bridge.adoc @@ -55,7 +55,8 @@ The user calls the function `deposit` (see https://github.com/starkware-libs/sta * Emits a deposit https://github.com/starkware-libs/starkgate-contracts/blob/28f4032b101003b2c6682d753ea61c86b732012c/src/starkware/starknet/apps/starkgate/solidity/StarknetTokenBridge.sol#L101[event] with the sender address on L1, the recipient address on L2, and the amount * Sends a message to the relevant L2 bridge with the amount to be transferred, and the recipient address as parameters. Note that, since every single bridge is dedicated to one token type, the token type doesn't have to be explicit here. -At the end of this step (i.e., after the execution on L1) the deposit transaction is known to Starknet's sequencer, yet sequencers may wait for enough L1 confirmations before the corresponding deposit transaction is initiated on L2. During this step, the status of the L2 deposit transaction is xref:../Blocks/transaction-life-cycle.adoc#not_received[`NOT_RECEIVED`]. +At the end of this step (i.e., after the execution on L1) the deposit transaction is known to Starknet's sequencer, yet sequencers may wait for enough L1 confirmations before the corresponding deposit transaction is initiated on L2. During this +step, the status of the L2 deposit transaction is xref:Network_Architecture/Blocks/transaction-life-cycle.adoc#not_received[`NOT_RECEIVED`]. [id="step_2_deposit_triggered_on_starknet"] === Step 2: deposit triggered on Starknet @@ -66,7 +67,7 @@ https://github.com/starkware-libs/starkgate-contracts/blob/28f4032b101003b2c6682 The function `handle_deposit` verifies that the deposit indeed came from the corresponding L1 bridge. It then calls to the relevant ERC-20 contract (e.g. the ERC-20 representing ETH on Starknet) and mints the tokens for the user. -At the end of this step (i.e., after the sequencer processed this transaction, but before a proof is generated), the status of the deposit request will be xref:../Blocks/transaction-life-cycle.adoc#accepted_on_l2[`ACCEPTED_ON_L2`]. +At the end of this step (i.e., after the sequencer processed this transaction, but before a proof is generated), the status of the deposit request will be xref:Network_Architecture/Blocks/transaction-life-cycle.adoc#accepted_on_l2[`ACCEPTED_ON_L2`]. [id="step_3_the_block_that_includes_the_transfer_is_proved"] === Step 3: The block that includes the transfer is proved diff --git a/components/Starknet/modules/architecture_and_concepts/pages/State/starknet-state.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/State/starknet-state.adoc similarity index 71% rename from components/Starknet/modules/architecture_and_concepts/pages/State/starknet-state.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/State/starknet-state.adoc index 8cba567697..6e4073d679 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/State/starknet-state.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/State/starknet-state.adoc @@ -5,20 +5,24 @@ The state of Starknet consists of: -* xref:architecture_and_concepts:Contracts/contract-classes.adoc[Contract classes]: a mapping between class hash and the class definition -* xref:architecture_and_concepts:Contracts/contract-classes.adoc[Contract instances]: a mapping between addresses (251-bit field elements) and the contract's state. +* xref:architecture_and_concepts:Smart_Contracts/contract-classes.adoc[Contract classes]: a mapping +between class hash and the class definition +* xref:architecture_and_concepts:Smart_Contracts/contract-classes.adoc[Contract instances]: a mapping between addresses (251-bit field elements) and the contract's state. A contract state consists of: -* xref:../Contracts/class-hash.adoc[Class hash]: defines the functionality of the contract -* xref:../Contracts/contract-storage.adoc[Contract storage]: a key-value mapping where the key/values are field elements -* xref:../Account_Abstraction/approach.adoc#replay_protection[Contract nonce]: the number of transactions sent from this contract +* xref:Smart_Contracts/class-hash.adoc[Class hash]: defines the functionality of the contract +* xref:Smart_Contracts/contract-storage.adoc[Contract storage]: a key-value mapping where the key/values are field elements +* xref:Accounts/approach.adoc#replay_protection[Contract nonce]: the number of transactions sent from this contract With the above definition, we can provide a brief sketch of Starknet's transition function. A transaction stem:[$tx$] transitions the system from state stem:[$S$] to state stem:[$S'$] if: -* stem:[$tx$] is an xref:../Blocks/transactions.adoc#invoke_transaction[invoke] transaction, and the storage of stem:[$S'$] is the result of executing the target contract code with respect to the previous state stem:[$S$] (the arguments, contract address, and the specific entry point are part of the transaction) -* stem:[$tx$] is a xref:../Blocks/transactions.adoc#deploy_account_transaction[deploy_account] transaction, and stem:[$S'$] contains the new contract's state at the contract's address. Additionally, the storage of stem:[$S$] is updated according to the execution of the contract's constructor. -* stem:[$tx$] is a xref:../Blocks/transactions.adoc#declare_transaction[declare] transaction, and stem:[$S'$] contains the class hash and definition in the contract classes mapping +* stem:[$tx$] is an xref:Network_Architecture/Blocks/transactions.adoc#invoke_transaction[invoke] transaction, and the storage of stem:[$S'$] is the result of executing the target contract code with respect to the previous state stem:[$S$] (the arguments, +contract +address, and the specific entry point are part of the transaction) +* stem:[$tx$] is a xref:Network_Architecture/Blocks/transactions.adoc#deploy_account_transaction[deploy_account] transaction, and stem:[$S'$] contains the new contract's state at the contract's address. Additionally, the storage of stem:[$S$] is updated +according to the execution of the contract's constructor. +* stem:[$tx$] is a xref:Network_Architecture/Blocks/transactions.adoc#declare-transaction[declare] transaction, and stem:[$S'$] contains the class hash and definition in the contract classes mapping [id="state_commitment"] == State commitment @@ -37,7 +41,8 @@ state_commitment = ℎ( Where: -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#poseidon_hash[Poseidon] hash function +* stem:[$h$] is the xref:Cryptography/hash-functions.adoc#poseidon_hash[Poseidon] hash +function * `STARKNET_STATE_V0` is a constant prefix string encoded in ASCII (and represented as a field element). * `contracts_tree_root` is the root of the Merkle-Patricia tree whose leaves are the contracts states, see xref:#contracts_tree[below] * `classes_tree_root` is the root of the Merkle-Patricia tree whose leaves are the compiled class hashes, see xref:#classes_tree[below] @@ -54,15 +59,16 @@ h(h(h(\text{class_hash}, \text{storage_root}), \text{nonce}),0) Where: -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#pedersen_hash[Pedersen] hash function. -* stem:[$\text{class_hash}$] is the hash of the contract's definition discussed xref:documentation:architecture_and_concepts:Contracts/class-hash.adoc[here] +* stem:[$h$] is the xref:../Cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash function. +* stem:[$\text{class_hash}$] is the hash of the contract's definition discussed xref:../Smart_Contracts/class-hash.adoc[here] * stem:[$\text{storage_root}$] is the root of another Merkle-Patricia tree of height 251 that is constructed from the contract's storage * stem:[$\text{nonce}$] is the current nonce of the contract [id="classes_tree"] === The classes tree -The classes tree encodes the information about the existing xref:../Contracts/contract-classes.adoc#[classes] in the state of Starknet. It maps (Cairo 1.0) xref:../Contracts/class-hash.adoc#cairo1_class[class hashes] to their +The classes tree encodes the information about the existing +xref:../Smart_Contracts/contract-classes.adoc[classes] in the state of Starknet. It maps (Cairo 1.0) xref:Smart_Contracts/class-hash.adoc#cairo1_class[class hashes] to their compiled class hashes. The value of a leaf at a path corresponding to some class hash is given by: @@ -73,18 +79,18 @@ compiled class hashes. The value of a leaf at a path corresponding to some class Where: -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#poseidon_hash[Poseidon] hash function +* stem:[$h$] is the xref:../Cryptography/hash-functions.adoc#poseidon_hash[Poseidon] hash function * `CONTRACT_CLASS_LEAF_V0` is a constant prefix string encoded in ASCII (and represented as a field element). * `compiled_class_hash` is the hash of the Cairo assembly resulting from compiling the given class via the Sierra→Casm compiler [NOTE] ==== -Cairo 1.0 classes that are part of the commitment are defined with Sierra, an intermediate representation between Cairo 1.0 and Cairo assembly (see xref:architecture_and_concepts:Contracts/system-calls-cairo1.adoc[here] for more information). +Cairo 1.0 classes that are part of the commitment are defined with Sierra, an intermediate representation between Cairo 1.0 and Cairo assembly (see xref:Smart_Contracts/system-calls-cairo1.adoc[here] for more information). However, the prover only deals with Cairo assembly. This means that unless we want the compilation from Sierra to Casm to be part of every block in which the class is used, the commitment must have some information about the associated Cairo assembly. -Today, the user signs the `compiled_class_hash` as part of a xref:../Blocks/transactions.adoc#declare_v2[declare v2] transaction. If the transaction was included in a block, then this `compiled_class_hash` becomes part of the commitment. +Today, the user signs the `compiled_class_hash` as part of a xref:Network_Architecture/Blocks/transactions.adoc#declare_v2[declare v2] transaction. If the transaction was included in a block, then this `compiled_class_hash` becomes part of the commitment. In the future, when Sierra→Casm compilation becomes part of the Starknet OS, this value may be updated via a proof of the Sierra→Casm compiler execution, showing that compiling the same class with a newer compiler version results in some new compiled class hash. ==== diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/oracles.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/oracles.adoc new file mode 100644 index 0000000000..51fdd497bd --- /dev/null +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/oracles.adoc @@ -0,0 +1 @@ += Oracles \ No newline at end of file diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/storage-proofs.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/storage-proofs.adoc new file mode 100644 index 0000000000..3acbcb0aa4 --- /dev/null +++ b/components/Starknet/modules/architecture_and_concepts/pages/Network_Architecture/storage-proofs.adoc @@ -0,0 +1 @@ += Storage proofs \ No newline at end of file diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Events/starknet-events.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/Events/starknet-events.adoc similarity index 89% rename from components/Starknet/modules/architecture_and_concepts/pages/Events/starknet-events.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/Events/starknet-events.adoc index f332c84cf6..3f9a7ab3fc 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Events/starknet-events.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/Events/starknet-events.adoc @@ -60,7 +60,7 @@ message_received.emit(1, 2); -The emit function emits an event with a single key, which is an identifier of the event, given by stem:[$\text{sn_keccak(event_name)}$], where stem:[$\text{event_name}$] is the ASCII encoding of the event's name and stem:[$\text{sn_keccak}$] is defined xref:../Hashing/hash-functions.adoc#starknet_keccak[here]. +The emit function emits an event with a single key, which is an identifier of the event, given by stem:[$\text{sn_keccak(event_name)}$], where stem:[$\text{event_name}$] is the ASCII encoding of the event's name and stem:[$\text{sn_keccak}$] is defined xref:../Cryptography/hash-functions.adoc#starknet_keccak[here]. To emit custom keys, one should use the low level `emit_event` system call: @@ -132,7 +132,7 @@ message_received.emit(2, data, p) ==== -The emitted events are part of the xref:../Blocks/transaction-life-cycle.adoc#transaction_receipt[transaction receipt]. +The emitted events are part of the xref:Network_Architecture/Blocks/transaction-life-cycle.adoc#transaction-receipt[transaction receipt]. [id="event_abi"] == Event ABI @@ -202,7 +202,7 @@ h(h(h(h(0,\text{from_address}),\text{keys_hash}),\text{data_hash}),3) Where: -* stem:[$\text{keys_hash}$], stem:[$\text{data_hash}$] are the hashes of the keys list and data list correspondingly (see xref:../Hashing/hash-functions.adoc#array_hashing[array hashing]). -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#pedersen_hash[Pedersen] hash function. +* stem:[$\text{keys_hash}$], stem:[$\text{data_hash}$] are the hashes of the keys list and data list correspondingly (see xref:../Cryptography/hash-functions.adoc#array_hashing[array hashing]). +* stem:[$h$] is the xref:../Cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash function. -The event hashes are included in the xref:../Blocks/header.adoc[`event_commitment`] field of a block. \ No newline at end of file +The event hashes are included in the xref:Network_Architecture/Blocks/header.adoc[`event_commitment`] field of a block. \ No newline at end of file diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/cairo-and-sierra.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/cairo-and-sierra.adoc new file mode 100644 index 0000000000..bf73594611 --- /dev/null +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/cairo-and-sierra.adoc @@ -0,0 +1,106 @@ +[id="sierra"] += Cairo and Sierra + +Up until xref:starknet_versions:upcoming_versions.adoc[Starknet Alpha v0.11.0] users would write contracts in Cairo 0 and compile them locally to Cairo assembly (or Casm for short). +Next, the user would submit the compilation output (the xref:Smart_Contracts/contract-classes.adoc[contract class]) to the Starknet sequencer via a `declare` transaction. + +With Cairo 1.0, the contract class resulting from xref:Smart_Contracts/class-hash.adoc#cairo1_class[compiling Cairo 1.0] does not include Casm. Instead of Casm, it includes instructions in an intermediate representation called Sierra (Safe Intermediate Representation). +This new contract class is then compiled by the sequencer, via the Sierra → Casm compiler, to generate the Cairo assembly associated with this class. + +== Why do we need Casm? + +Starknet is a validity rollup, which means that the execution inside every block needs to be proven, and this is where STARKs come in handy. +However, STARK proofs can address statements that are formulated in the language of polynomial +constraints, and have no knowledge of smart contract execution. +To overcome this gap, we developed link:https://github.com/starknet-io/starknet-stack-resources/blob/main/Cairo/Cairo%20%E2%80%93%20a%20Turing-complete%20STARK-friendly%20CPU%20architecture.pdf[Cairo]. + +Cairo instructions (which we referred to previously by Casm) are translated to polynomial constraints that enforce the correct execution of a program (according to the Cairo semantics defined in the paper). + +Thanks to Cairo, we can formulate the statement "this Starknet block is valid" in a way that we can prove. +Note that we can only prove things about Casm. That is, regardless of what the user sends to the Starknet sequencer, what's proven is the correct Casm execution. + +This means that we need a way to translate Sierra into Casm, and this is achieved with the Sierra +→ +Casm compiler. + + +== Why do we need Sierra? + +To understand why we chose to add an additional layer between the code that the user writes (Cairo 1.0) and the code that is being proven (Casm), +we need to consider more components in the system, and the limitations of Cairo. + +=== Reverted transactions, unsatisfiable AIRs, and DOS attacks + +A crucial property of every decentralized L2 is that the sequencers are guaranteed to be compensated for work they do. +The notion of reverted transactions is a good example: even if the user's transaction failed mid execution, the sequencer should be able to include it in a block and charge execution fees up to the point of failure. + +If the sequencer cannot charge for such transactions, then sending transactions that will eventually fail (after a lot of computation steps) is an obvious DOS attack on the sequencer. +The sequencer cannot look at a transaction and conclude that it would fail without actually doing the work (this is equivalent to solving the halting problem). + + +The obvious solution to the above predicament is to include such transactions in the block, similar to Ethereum. However, this may not be as simple to do in a validity rollup. +With Cairo 0, there is no separating layer between user code and what is being proven. + +This means that users can write code which is unprovable in some cases. In fact, such code is very easy to write, e.g. `assert 0=1` is a valid +Cairo instruction that cannot be proven, as it translates to polynomial constraints that are not satisfiable. Any Casm execution that contains this instruction cannot be proven. +Sierra is the layer between user code and the provable statement, that allows us to make sure all transactions are eventually provable. + +=== Safe Casm + +The method by which Sierra guarantees that user code is always provable is by compiling Sierra instructions to a subset of Casm, which we call "safe Casm". +The important property that we require from safe Casm is being provable for all inputs. A canonical example for safe Casm is using `if/else` instructions instead of `assert`, that is, making sure all failures are +graceful. + +To better understand the considerations that go into designing the Sierra → Casm compiler, +consider the `find_element` function from the common library of Cairo 0: + +[source,cairo] +---- +func find_element{range_check_ptr}(array_ptr: felt*, elm_size, n_elms, key) -> (elm_ptr: felt*) { + alloc_locals; + local index; + %{ + ... + %} + assert_nn_le(a=index, b=n_elms - 1); + tempvar elm_ptr = array_ptr + elm_size * index; + assert [elm_ptr] = key; + return (elm_ptr=elm_ptr); +} +---- + +[NOTE] +==== +Below we abuse the "Casm" notation by not distinguishing Cairo 0 from Casm and referring to the +above as Casm (while we actually refer to the compilation result of the above). +==== + +For brevity, we have omitted the hint in the above snippet, but it's clear that this function can only execute correctly if the requested element exists in the array (otherwise it would fail for every possible hint - +there is nothing we can substitute `index` for, that makes the following lines run successfully). + +Such Casm cannot be generated by the Sierra→Casm compiler. +Furthermore, simply replacing the assertion with an if/else statement doesn't do, as this results in non-deterministic execution. That is, for the same input, different hint values can yield different results. +A malicious prover can use this freedom to harm the user - in this example, they are able to make it seem as if an element isn't part of the array, even though it actually is. + +The safe Casm for finding an element in an array behaves like the above snippet in the happy flow (element is there): an index is given in a hint, and we verify that the array at the hinted index contains the requested element. +However, in the unhappy flow (element isn't there), we *must* go over the entire array to verify this. + +This was not the case in Cairo 0, as we were fine with certain paths not being provable (in the above snippet, the unhappy flow in which the element isn't in the array is never provable). + +[NOTE] +==== +Sierra's gas metering adds further complications to the above example. Even looking through the array to verify that the element isn't there may leave some flexibility to the prover. + +If we take gas limitations into consideration, the user may have enough gas for the happy flow, but not for the unhappy one, making the execution stop mid-search, and allowing the prover to get away with lying about the element not being present. + +The way we plan to handle this is by requiring the user to have enough gas for the unhappy flow before actually calling `find_element`. +==== + +=== Hints in Cairo 1.0 + +Smart contracts written with Cairo 1.0 cannot contain user defined hints. This is already true with Cairo 0 contracts (only whitelisted hints are accepted), but with Cairo 1.0 the hints in use are +determined by the Sierra → Casm compiler. Since this compilation is there to ensure that only +"safe" Casm is generated, there is no room for hints that are not generated by the compiler. + +In the future, native Cairo 1.0 may contain hint syntax similar to Cairo 0, but it will not be available in Starknet smart contracts (link:https://medium.com/starkware/fractal-scaling-from-l2-to-l3-7fe238ecfb4f[L3s] on top of Starknet may make use of such functionality). +Note that this is currently not part of Starknet's roadmap. diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/class-hash.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/class-hash.adoc similarity index 77% rename from components/Starknet/modules/architecture_and_concepts/pages/Contracts/class-hash.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/class-hash.adoc index f2070bb0d5..d78f67cc61 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/class-hash.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/class-hash.adoc @@ -8,7 +8,7 @@ The class hash is a hash chain of the definition of the class. == Definition of a (Cairo 1) class Classes that were written in Cairo 1 are defined by their Sierra code ( -resulting from the compilation of the Cairo code into Sierra, see xref:../Cairo_on_Starknet/cairo-1-and-sierra.adoc[here] for more details). +resulting from the compilation of the Cairo code into Sierra, see xref: xref:cairo-1-and-sierra.adoc[here] for more details). The elements that define a class are: @@ -19,9 +19,10 @@ Array of external functions entry points:: An entry point is a pair `(_selector_ + [NOTE] ==== -The selector is an identifier through which the function is callable in transactions or in other classes. The selector is the xref:../Hashing/hash-functions.adoc#starknet_keccak[starknet_keccak] hash of the function name, encoded in ASCII. +The selector is an identifier through which the function is callable in transactions or in other classes. The selector is the xref:../Cryptography/hash-functions.adoc#starknet_keccak[starknet_keccak] hash of the function name, encoded in ASCII. ==== -Array of xref:documentation:architecture_and_concepts:L1-L2_Communication/messaging-mechanism.adoc#l1-l2_message_fees[L1 handlers] entry points :: - + +Array of xref:architecture_and_concepts:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc#l1-l2-message-fees[L1 handlers] entry points :: - Array of constructors entry points:: Currently, the compiler allows only one constructor. ABI:: A string representing the ABI of the class. The ABI hash (which affects the class hash) is given by: + @@ -58,9 +59,9 @@ class_hash = ℎ( Where -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#poseidon_hash[Poseidon] hash function +* stem:[$h$] is the xref:../Cryptography/hash-functions.adoc#poseidon_hash[Poseidon] hash function * The hash of an entry point array stem:[$(selector,index)_{i=1}^n$] is given by stem:[$h(\text{selector}_1,\text{index}_1,...,\text{selector}_n,\text{index}_n)$] -* The `sierra_program_hash` is the xref:../Hashing/hash-functions.adoc#poseidon_hash[Poseidon] hash of the bytecode array +* The `sierra_program_hash` is the xref:../Cryptography/hash-functions.adoc#poseidon_hash[Poseidon] hash of the bytecode array [NOTE] ==== @@ -85,12 +86,12 @@ Array of external functions entry points:: An entry point is a pair `(_selector_ + [NOTE] ==== -The selector is an identifier through which the function is callable in transactions or in other classes. The selector is the xref:../Hashing/hash-functions.adoc#starknet_keccak[starknet_keccak] hash of the function name, encoded in ASCII. +The selector is an identifier through which the function is callable in transactions or in other classes. The selector is the xref:../Cryptography/hash-functions.adoc#starknet_keccak[starknet_keccak] hash of the function name, encoded in ASCII. ==== -Array of xref:documentation:architecture_and_concepts:L1-L2_Communication/messaging-mechanism.adoc#l1-l2_messages[L1 handlers] entry points :: - +Array of xref:architecture_and_concepts:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc#l1-l2-messages[L1 handlers] entry points :: - Array of constructors entry points:: Currently, the compiler allows only one constructor. Array of used builtin names:: An ASCII-encode array, ordered by declaration. -Program hash:: The xref:../Hashing/hash-functions.adoc#starknet_keccak[starknet_keccak] of the class's program. The class's program is the abi and program part of the `.json` file that the Starknet compiler outputs when you run the following command: +Program hash:: The xref:../Cryptography/hash-functions.adoc#starknet_keccak[starknet_keccak] of the class's program. The class's program is the abi and program part of the `.json` file that the Starknet compiler outputs when you run the following command: + [source,shell] ---- @@ -119,7 +120,7 @@ class_hash = ℎ( Where -* stem:[$h$] is the xref:../Hashing/hash-functions.adoc#pedersen_hash[Pedersen] hash function +* stem:[$h$] is the xref:../Cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash function * The hash of an entry point array stem:[$(\text{selector},\text{offset})_{i=1}^n$] is given by stem:[$h(\text{selector}_1,\text{offset}_1,...,\text{selector}_n,\text{offset}_n)$] * The `program_hash` is the `starknet_keccak` of the json described above -* The `bytecode_hash` is the xref:../Hashing/hash-functions.adoc#pedersen_hash[Pedersen] hash of the bytecode array +* The `bytecode_hash` is the xref:../Cryptography/hash-functions.adoc#pedersen_hash[Pedersen] hash of the bytecode array diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-abi.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-abi.adoc similarity index 100% rename from components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-abi.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-abi.adoc diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-address.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-address.adoc similarity index 87% rename from components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-address.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-address.adoc index 9b00ff4238..c747d89823 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-address.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-address.adoc @@ -7,7 +7,7 @@ The contract address is a unique identifier of the contract on Starknet. It is a * `deployer_address` - The deployer address, unless `deploy_from_zero` is `true`, in which case it is `0`. * `salt` - The salt passed by the contract calling the syscall. * `class_hash` - See xref:./class-hash.adoc#computing_the_cairo_1_class_hash[the class hash documentation]. -* `constructor_calldata_hash` - xref:../Hashing/hash-functions.adoc#pedersen_array_hash[Array hash] of the inputs to the constructor. +* `constructor_calldata_hash` - xref:Cryptography/hash-functions.adoc#pedersen_array_hash[Array hash] of the inputs to the constructor. The address is computed as follows: diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-classes.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-classes.adoc similarity index 67% rename from components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-classes.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-classes.adoc index b5c5290291..1419214ed4 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-classes.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-classes.adoc @@ -5,7 +5,7 @@ Taking inspiration from object-oriented programming, Starknet distinguishes betw A contract class is the definition of the contract: Cairo byte code, hint information, entry point names, and everything that defines its semantics unambiguously. -Each class is identified by its xref:architecture_and_concepts:Contracts/class-hash.adoc[class hash], which is analogous +Each class is identified by its xref:architecture_and_concepts:Smart_Contracts/class-hash.adoc[class hash], which is analogous to a class name in an object-oriented programming language. A contract instance is a deployed contract corresponding to a class. @@ -16,11 +16,11 @@ can be called by transactions or other contracts. A contract class does not nece [id="using_classes"] == Using Classes -New classes can be added to the state of Starknet with the xref:../Blocks/transactions.adoc#declare_transaction[`declare`] transaction. New instances of a previously declared class -can be deployed via the xref:architecture_and_concepts:Contracts/system-calls.adoc#deploy[`deploy`] +New classes can be added to the state of Starknet with the xref:architecture_and_concepts:Network_Architecture/Blocks/transactions.adoc#declare-transaction[`declare`] transaction. New instances of a previously declared class +can be deployed via the xref:architecture_and_concepts:Smart_Contracts/system-calls-cairo1.adoc#deploy[`deploy`] system call. To use the functionality of a declared class, without deploying an instance of that class, you -can use the xref:Contracts/system-calls.adoc#library_call[`library_call`] system call. This system call is an +can use the xref:architecture_and_concepts:Smart_Contracts/system-calls-cairo1.adoc#library_call[`library_call`] system call. This system call is an analogue of Ethereum's delegate call in the world of classes. You can use class code directly, instead of having a placeholder contract deployed, which is used only for its code. diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-storage.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-storage.adoc similarity index 100% rename from components/Starknet/modules/architecture_and_concepts/pages/Contracts/contract-storage.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-storage.adoc diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Cairo_on_Starknet/contract-syntax.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-syntax.adoc similarity index 100% rename from components/Starknet/modules/architecture_and_concepts/pages/Cairo_on_Starknet/contract-syntax.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/contract-syntax.adoc diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls-cairo1.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc similarity index 97% rename from components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls-cairo1.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc index 4dd9b84930..2ab939b61e 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls-cairo1.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls-cairo1.adoc @@ -141,7 +141,7 @@ Deploys a new instance of a previously declared class. [horizontal,labelwidth=35] `_class_hash_`:: The class hash of the contract to be deployed. -`_contract_address_salt_`:: The salt, an arbitrary value provided by the sender, used in the computation of the xref:Contracts/contract-address.adoc[contract's address]. +`_contract_address_salt_`:: The salt, an arbitrary value provided by the sender, used in the computation of the xref:Smart_Contracts/contract-address.adoc[contract's address]. `_calldata_`:: The constructor's calldata. An array of felts. `_deploy_from_zero_`:: A flag used for the contract address computation. If not set, the caller address will be used as the new contract's deployer address, otherwise 0 is used. @@ -175,7 +175,7 @@ extern fn emit_event_syscall( Emits an event with a given set of keys and data. -For more information, and for a higher-level syntax for emitting events, see xref:Events/starknet-events.adoc[Starknet events]. +For more information, and for a higher-level syntax for emitting events, see xref:architecture_and_concepts:Smart_Contracts/Events/starknet-events.adoc[Starknet events]. [discrete] ==== Arguments @@ -269,7 +269,7 @@ Sends a message to L1. This system call includes the message parameters as part of the proof's output and exposes these parameters to the Starknet Core contract on L1 once the state update, including the transaction, is received. -For more information, see Starknet's xref:L1-L2_Communication/messaging-mechanism.adoc[messaging mechanism]. +For more information, see Starknet's xref:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc[messaging mechanism]. [discrete] ==== Arguments diff --git a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls.adoc b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls.adoc similarity index 97% rename from components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls.adoc rename to components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls.adoc index 2c134e5c7d..cd30f67dba 100644 --- a/components/Starknet/modules/architecture_and_concepts/pages/Contracts/system-calls.adoc +++ b/components/Starknet/modules/architecture_and_concepts/pages/Smart_Contracts/system-calls.adoc @@ -315,7 +315,7 @@ Deploys a new instance of a previously declared class. [horizontal,labelwidth=35] `_class_hash_`:: The class hash of the contract to be deployed -`_contract_address_salt_`:: The salt, an arbitrary value provided by the sender, used in the computation of the xref:Contracts/contract-address.adoc[contract's address]. +`_contract_address_salt_`:: The salt, an arbitrary value provided by the sender, used in the computation of the xref:Smart_Contracts/contract-address.adoc[contract's address]. `_constructor_calldata_size_`:: The number of arguments to pass to the constructor, equal to the number of felts in `_constructor_calldata_`. `_constructor_calldata_`:: The constructor's calldata. An array of felts. `__deploy_from_zero__`:: A flag used for the contract address computation. If not set, the caller address will be used as the new contract's deployer address, otherwise 0 is used. @@ -357,7 +357,7 @@ extern fn emit_event_syscall( Emits an event with a given set of keys and data. -For more information, and for a higher level syntax for emitting events, see xref:Events/starknet-events.adoc[Starknet events]. +For more information, and for a higher level syntax for emitting events, see xref:architecture_and_concepts:Smart_Contracts/Events/starknet-events.adoc[Starknet events]. .Arguments @@ -483,7 +483,7 @@ func library_call_l1_handler{syscall_ptr : felt*}( Calls the requested L1 handler in any previously declared class. -Same as the `library_call` system call, but also enables you to call an L1 handler that cannot otherwise be called directly. For more information, see Starknet's xref:L1-L2_Communication/messaging-mechanism.adoc#l1-l2_messages[messaging mechanism]. +Same as the `library_call` system call, but also enables you to call an L1 handler that cannot otherwise be called directly. For more information, see Starknet's xref:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc#l1-l2_messages[messaging mechanism]. When you invoke an L1 handler with this system call, the sequencer does not consume an L1->L2 message. @@ -544,7 +544,7 @@ Sends a message to L1. This system call includes the message parameters as part of the proof's output, and exposes these parameters to the Starknet Core contract on L1 once the state update, including the transaction, is received. -For more information, see Starknet's xref:L1-L2_Communication/messaging-mechanism.adoc[messaging mechanism]. +For more information, see Starknet's xref:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc[messaging mechanism]. .Arguments diff --git a/components/Starknet/modules/architecture_and_concepts/pages/index.adoc b/components/Starknet/modules/architecture_and_concepts/pages/index.adoc new file mode 100644 index 0000000000..7d31881199 --- /dev/null +++ b/components/Starknet/modules/architecture_and_concepts/pages/index.adoc @@ -0,0 +1 @@ += Architecture diff --git a/components/Starknet/modules/cli/nav.adoc b/components/Starknet/modules/cli/nav.adoc new file mode 100644 index 0000000000..e69de29bb2 diff --git a/components/Starknet/modules/tools/pages/CLI/commands.adoc b/components/Starknet/modules/cli/pages/commands.adoc similarity index 91% rename from components/Starknet/modules/tools/pages/CLI/commands.adoc rename to components/Starknet/modules/cli/pages/commands.adoc index eab4322612..015fe95bba 100644 --- a/components/Starknet/modules/tools/pages/CLI/commands.adoc +++ b/components/Starknet/modules/cli/pages/commands.adoc @@ -3,7 +3,7 @@ [WARNING] ==== -The Starknet CLI will be deprecated soon in favour of xref:CLI/starkli.adoc[Starkli CLI]. +The Starknet CLI will be deprecated soon in favour of xref:starkli.adoc[Starkli CLI]. ==== @@ -125,17 +125,19 @@ Calls a Starknet contract without affecting the state, accepts the following arg - `arguments`* - inputs to the function being called, represented by a list of space-delimited values - `block_hash` - the hash of the block used as the context for the call operation. If this argument is omitted, the latest block is used - `block_number` - same as block_hash, but specifies the context block by number or xref:block_tag[tag] -- `signature_information` - list of field elements as described xref:architecture_and_concepts:Blocks/transactions.adoc#signature[here] +- `signature_information` - list of field elements as described xref:architecture_and_concepts:Network_Architecture/Blocks/transactions.adoc#signature[here] - `wallet_name` - the name of the desired wallet, use xref:starknet_deploy_account[deploy_account] to set-up new accounts in the CLI - `nonce` - account nonce, only relevant if the call is going through an account + + [id="block_tag"] [NOTE] ==== *Block Tag* -A block context can be specified via the `latest` or `pending` tags, where the former refers to the latest accepted on L2 block and the latter refers to the xref:architecture_and_concepts:Blocks/transaction-life-cycle.adoc#the-pending-block[pending block]. +A block context can be specified via the `latest` or `pending` tags, where the former refers to the latest accepted on L2 block and the latter refers to the xref:architecture_and_concepts:Network_Architecture/Blocks/transaction-life-cycle.adoc#the-pending-block[pending block]. ==== @@ -212,7 +214,7 @@ $ export STARKNET_WALLET=starkware.starknet.wallets.open_zeppelin.OpenZeppelinAc Using the builtin wallet providers that are part of the cairo-lang package (starkware.starknet.wallets...) is _not secure_ (for example, the private key may be kept not encrypted and without backup in your home directory). You should only use them if you’re not overly concerned with losing access to your accounts (for example, for testing purposes). ==== - +[id="starknet-estimate_fee"] == `starknet estimate_fee` [source,terminal] @@ -227,7 +229,7 @@ starknet estimate_fee Returns the fee estimation for a given contract call. Accepts the following arguments: - `address`* - the address of the contract being called -- `contract_abi`* - a path to a JSON file that contains the xref:architecture_and_concepts:Contracts/contract-abi.adoc[abi] of the contract being called +- `contract_abi`* - a path to a JSON file that contains the xref:architecture_and_concepts:Smart_Contracts/contract-abi.adoc[abi] of the contract being called - `function_name`*- the name of the function being called - `arguments`* - inputs to the function being called, represented by a list of space-delimited values` @@ -242,12 +244,13 @@ starknet estimate_message_fee --function --inputs ---- +Returns the fee estimation for a given xref:architecture_and_concepts:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc#l1-l2-message-fees[L1 handler] application. Accepts the following arguments: + -Returns the fee estimation for a given xref:architecture_and_concepts:L1-L2_Communication/messaging-mechanism.adoc#l1-l2-message-fees[L1 handler] application. Accepts the following arguments: - `from_address`* - the L1 address of the sender - `to_address`* - the L2 address of the recipient -- `contract_abi`* - a path to a JSON file containing the xref:architecture_and_concepts:/Contracts/contract-abi.adoc[abi] of the receiving contract on L2 +- `contract_abi`* - a path to a JSON file containing the xref:architecture_and_concepts:Smart_Contracts/contract-abi.adoc[abi] of the receiving contract on L2 - `function_name`*- the name of the desired L1 handler - `arguments`* - inputs to the called handler, represented by a list of space-delimited values @@ -322,7 +325,7 @@ Returns the requested transaction, expects the following argument: starknet get_transaction_receipt --hash ---- -Returns the xref:architecture_and_concepts:Blocks/transaction-life-cycle.adoc#transaction-receipt[receipt] associated with the transaction, expects the following argument: +Returns the xref:architecture_and_concepts:Network_Architecture/Blocks/transaction-life-cycle.adoc#transaction-receipt[receipt] associated with the transaction, expects the following argument: * `transaction_hash`* - hash of the requested transaction starknet invoke @@ -349,7 +352,7 @@ Sends a transaction to the Starknet sequencer, accepts the following arguments: * `contract_abi`* - a path to a JSON file that contains the https://www.cairo-lang.org/docs/hello_starknet/intro.html#the-contract-s-abi[abi] of the contract being called * `function_name`*- the name of the function being called * `arguments`* - inputs to the function being called, represented by a list of space-delimited values -* `signature_information` - list of field elements as described xref:architecture_and_concepts:Blocks/transactions.adoc#signature[here] +* `signature_information` - list of field elements as described xref:architecture_and_concepts:Network_Architecture/Blocks/transactions.adoc#signature[here] * `wallet_name` - the name of the desired wallet, use xref:starknet_deploy_account[deploy_account] to set-up new accounts in the CLI. * `nonce` - account nonce, only relevant if the call is going through an account @@ -385,4 +388,4 @@ The possible statuses of a transaction are: * `ACCEPTED_ON_L2` * `ACCEPTED_ON_L1` -Refer to xref:architecture_and_concepts:Blocks/transaction-life-cycle.adoc[this] section for more information about the transaction lifecycle. \ No newline at end of file +Refer to xref:architecture_and_concepts:Network_Architecture/Blocks/transaction-life-cycle.adoc[this] section for more information about the transaction lifecycle. \ No newline at end of file diff --git a/components/Starknet/modules/cli/pages/starkli.adoc b/components/Starknet/modules/cli/pages/starkli.adoc new file mode 100644 index 0000000000..7a30b38a1b --- /dev/null +++ b/components/Starknet/modules/cli/pages/starkli.adoc @@ -0,0 +1,406 @@ +[id="starkli_cli"] += StarkLi CLI + +xref:starkli.adoc#legacy[Starknet CLI], the legacy command line interface (CLI) for Starknet, built by StarkWare, is deprecated, and support will be removed in Starknet v0.13.0. + +Instead, use link:https://github.com/xJonathanLEI/starkli[Starkli]. Starkli is a CLI powered by link:https://github.com/xJonathanLEI/starknet-rs[starknet-rs] and developed by +Starknet community contributor link:https://github.com/xJonathanLEI[@xJonathanLEI]. + +For full documentation, see the link:https://book.starkli.rs/[Starkli Book]. + +[NOTE] +==== +As of Starknet v0.13.0, Starknet CLI will no longer be supported. +==== + + +[id="legacy"] +== Starknet legacy CLI (deprecated) + +[WARNING] +==== +The Starknet CLI is deprecated in favour of the xref:starkli.adoc#starkli_cli[StarkLi CLI]. +==== + +[id="basic_command_line_syntax"] +=== Basic command line syntax + +To enter a starknet command, use the following syntax: + +[source,bash] +---- +$ starknet +---- + +Where: + +`` represents a single command that executes an operation on Starknet. + +`` represents zero or more command line options, each of which modifies the operation of the command. + +[id="setting_the_starknet_network_environment"] +=== Setting the Starknet network environment + +You need to set your Starknet network environment to use either testnet or Mainnet. + +You can set the environment using either a command-line option or an environment variable. + +Possible values are: + +`alpha-goerli`:: Sets the Starknet network to testnet +`alpha-mainnet`:: Sets the Starknet network to Mainnet + +.Setting the network environment using a command-line option + +When you enter any command, include the `--network` option. For example to use Mainnet, enter a command as follows: + +[source,bash] +---- +$ starknet --network alpha-mainnet +---- + +[NOTE] +==== +You can place the `--network` option before or after any other option. +==== + +.Setting the network environment using an environment variable + +Set the `STARKNET_NETWORK` environment variable as follows: + +[source,bash] +---- +$ export STARKNET_NETWORK= +---- + +For example, to use testnet, enter the following command: + +[source,bash] +---- +$ export STARKNET_NETWORK=alpha-goerli +---- + +=== Setting custom endpoints + +When working with the CLI, you can manually set the endpoints for the gateways that enable you to +interact with Starknet, by including the following options: + +`--feeder_gateway_url`:: Sets the custom endpoint for read commands. +`--gateway_url`:: Sets the custom endpoint for write commands. + +The following are the endpoints for Starknet testnet and Mainnet: + +* Testnet feeder gateway URL: https://alpha4.starknet.io/feeder_gateway/ +* Mainnet feeder gateway URL: https://alpha-mainnet.starknet.io/feeder_gateway/ +* Testnet gateway URL: https://alpha4.starknet.io/gateway/ +* Mainnet gateway URL: https://alpha-mainnet.starknet.io/gateway/ + +.Example: Setting a custom read endpoint + +The following command returns the ABI using the Mainnet feeder gateway. + +[source,bash] +---- +$ starknet get_code --feeder_gateway_url https://alpha-mainnet.starknet.io/feeder_gateway/ +---- + +.Example: Setting a custom write endpoint + +The following command sends a transaction to the Starknet sequencer +using the Mainnet gateway. + +[source,bash] +---- +$ starknet invoke --gateway_url https://alpha-mainnet.starknet.io/gateway/ +---- + + +[id="starknet_call"] +=== `starknet call` + +[source,terminal] +---- +starknet call + --address + --abi + --function + --inputs + --block_hash + --block_number + --signature + --wallet + --nonce +---- + +Calls a Starknet contract without affecting the state, accepts the following arguments: + +- `contract_address`* - address of the contract being called +- `contract_abi`* - a path to a JSON file that contains the link:https://www.cairo-lang.org/docs/hello_starknet/intro.html#the-contract-s-abi[abi] of the contract being called +- `function_name`* - name of the function which is called +- `arguments`* - inputs to the function being called, represented by a list of space-delimited values +- `block_hash` - the hash of the block used as the context for the call operation. If this argument is omitted, the latest block is used +- `block_number` - same as block_hash, but specifies the context block by number or xref:block_tag[tag] +- `signature_information` - list of field elements as described xref:architecture_and_concepts:Network_Architecture/Blocks/transactions.adoc#signature[here] +- `wallet_name` - the name of the desired wallet, use xref:starknet_deploy_account[deploy_account] to set-up new accounts in the CLI +- `nonce` - account nonce, only relevant if the call is going through an account + + + +[id="block_tag"] + +[NOTE] +==== +*Block Tag* + +A block context can be specified via the `latest` or `pending` tags, where the former refers to the latest accepted on L2 block and the latter refers to the xref:architecture_and_concepts:Network_Architecture/Blocks/transaction-life-cycle.adoc#the-pending-block[pending block]. +==== + + +[id="starknet_declare"] +=== `starknet declare` + +[source,terminal] +---- +starknet declare +--contract +---- + +Declares a new contract class on Starknet, accepts the following arguement: + +- `contract_class` - path to a JSON file containing the contract’s compiled code + + +[id="starknet_deploy"] +=== `starknet deploy` + +[source,terminal] +---- +starknet deploy + --salt + --contract + --inputs + --token +---- + +Deploys a new contract, accepts the following arguments: + +- `salt` - a seed that is used in the computation of the contract’s address (if not specified, the sequencer will choose a random string) +- `contract_definition`* - path to a JSON file containing the contract’s bytecode and abi (can be obtained by executing link:https://www.cairo-lang.org/docs/hello_starknet/intro.html#compile-the-contract[starknet-compile]) +- `constructor_inputs`* - the arguments given to the contract’s constructor, represented by a list of space-delimited values +- `token` - a token allowing contract deployment (can be obtained by applying link:https://forms.reform.app/starkware/SN-Alpha-Contract-Deployment/l894lu[here]). Only used in the Alpha stages and will be deprecated in the future + +[NOTE] +==== +The deploy token is a temporary measure which will be deprecated when fees are incorporated in the system. Only relevant for Mainnet. +==== + + +[id="starknet_deploy_account"] +=== `starknet deploy_account` + +[source,terminal] +---- +starknet deploy_account + --wallet + --account +---- + +Deploys an account contract, accepts the following arguments: + +- `account_name` - the name given to the account, used for managing multiple accounts from the CLI (if not specified, the name +`+__default__+` is used. +- `wallet_provider`* - the path to module which manages the account (responsible for key generation, signing, etc.) + +[NOTE] +==== + +Today, the Starknet CLI only works with the link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/third_party/open_zeppelin/Account.cairo[OpenZeppelin account contract]. +The CLI uses this specific link:https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/wallets/open_zeppelin.py[wallet provider]. +To use this provider, either set up the following environment variable or pass the same value directly to the `wallet_provider` parameter: + +[source,bash] +---- +$ export STARKNET_WALLET=starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount +---- +==== + +[CAUTION] +==== +Using the builtin wallet providers that are part of the cairo-lang package (starkware.starknet.wallets...) is _not secure_ (for example, the private key may be kept not encrypted and without backup in your home directory). You should only use them if you’re not overly concerned with losing access to your accounts (for example, for testing purposes). +==== + +[id="starknet-estimate_fee"] +=== `starknet estimate_fee` + +[source,terminal] +---- +starknet estimate_fee + --address + --abi + --function + --inputs +---- + +Returns the fee estimation for a given contract call. Accepts the following arguments: + +- `address`* - the address of the contract being called +- `contract_abi`* - a path to a JSON file that contains the xref:architecture_and_concepts:Smart_Contracts/contract-abi.adoc[abi] of the contract being called +- `function_name`*- the name of the function being called +- `arguments`* - inputs to the function being called, represented by a list of space-delimited values` + + +=== `starknet estimate_message_fee` + +[source,terminal] +---- +starknet estimate_message_fee + --from_address + --to_address + --function + --inputs +---- +Returns the fee estimation for a given xref:architecture_and_concepts:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc#l1-l2-message-fees[L1 handler] application. Accepts the following arguments: + + + +- `from_address`* - the L1 address of the sender +- `to_address`* - the L2 address of the recipient +- `contract_abi`* - a path to a JSON file containing the xref:architecture_and_concepts:Smart_Contracts/contract-abi.adoc[abi] of the receiving contract on L2 +- `function_name`*- the name of the desired L1 handler +- `arguments`* - inputs to the called handler, represented by a list of space-delimited values + +=== `starknet get_block` + +[source,terminal] +---- +starknet get_block + --hash + --number +---- + +Returns the requested block, exactly one of the following arguments must be given: + +* `block_hash` - hash of the requested block +* `block_number` - number or <> of the requested block + +[id="starknet_get_code"] +=== `starknet get_code` + +[source,terminal] +---- +starknet get_code + --contract_address + --block_hash + --block_number +---- + +Returns the ABI and the byte code of the requested contract, accepts the following arguments: + +- `contact_address`* - address of the requested contract +- `block_hash` - the hash of the block used as the context for the operation. If this argument is omitted, the latest block is used +- `block_number` - same as block_hash, but specifies the context block by number or xref:block_tag[tag] + + +=== `starknet get_storage_at` + +[source,terminal] +---- +starknet get_storage_at + --contract_address + --key + --block_hash + --block_number +---- + +Queries a contract's storage at a specific key, accepts the following arguments: + +* `contract_address` *- address of the requested contract +* `key`* - the requested key from the given contract's storage +* `block_hash` - the hash of the block relative to which the storage will be provided. In case this argument is not given, the latest block is used +* `block_number` - same as block_hash, but specifies the context block by number or <> + + +[id="starknet_get_transaction"] +=== `starknet get_transaction` + +[source,terminal] +---- +starknet get_transaction --hash +---- + +Returns the requested transaction, expects the following argument: + +- `transaction_hash`* - hash of the requested transaction + + +=== `starknet get_transaction_receipt` + +[source,terminal] +---- +starknet get_transaction_receipt --hash +---- + +Returns the xref:architecture_and_concepts:Network_Architecture/Blocks/transaction-life-cycle.adoc#transaction-receipt[receipt] associated with the transaction, expects the following argument: + +* `transaction_hash`* - hash of the requested transaction +starknet invoke +starknet tx_status + + +=== `starknet invoke` + +[source,terminal] +---- +starknet invoke + --address + --abi + --function + --inputs + --signature + --wallet + --nonce +---- + +Sends a transaction to the Starknet sequencer, accepts the following arguments: + +* `address`* - the address of the contract being called +* `contract_abi`* - a path to a JSON file that contains the https://www.cairo-lang.org/docs/hello_starknet/intro.html#the-contract-s-abi[abi] of the contract being called +* `function_name`*- the name of the function being called +* `arguments`* - inputs to the function being called, represented by a list of space-delimited values +* `signature_information` - list of field elements as described xref:architecture_and_concepts:Network_Architecture/Blocks/transactions.adoc#signature[here] +* `wallet_name` - the name of the desired wallet, use xref:starknet_deploy_account[deploy_account] to set-up new accounts in the CLI. +* `nonce` - account nonce, only relevant if the call is going through an account + +[TIP] +==== + +Today, interaction with Starknet may be done either via account or by a direct call. The `signature` argument can only be provided in the case of a direct call, since otherwise providing the signature is the responsibility of the account module. To use an account you must specify `wallet_name`, otherwise a direct call will be used (you may also explicitly perform a direct call by adding `--no_wallet` to the command). Note that in the future direct calls will be deprecated and the only way to interact with the system would be through accounts. +==== + + +=== `starknet tx_status` + +[source,terminal] +---- +starknet tx_status + --hash + --contract + --error_message +---- + +Returns the transaction status, accepts the following arguments: + +* `transaction_hash`* - hash of the requested transaction +* `contract_definition` - path to a JSON file containing the compiled contract to which the transaction was addressed. If supplied, the debug information from the compiled contract will be used to add error locations. +* `error_message` - if specified, only the error message will be returned (or empty response in case the transaction was successful) + +The possible statuses of a transaction are: + +* `NOT_RECEIVED` +* `RECEIVED` +* `PENDING` +* `REJECTED` +* `ACCEPTED_ON_L2` +* `ACCEPTED_ON_L1` + +Refer to xref:architecture_and_concepts:Network_Architecture/Blocks/transaction-life-cycle.adoc[this] section for more information about the transaction lifecycle. \ No newline at end of file diff --git a/components/Starknet/modules/tools/pages/CLI/starknet-compiler-options.adoc b/components/Starknet/modules/cli/pages/starknet-compiler-options.adoc similarity index 97% rename from components/Starknet/modules/tools/pages/CLI/starknet-compiler-options.adoc rename to components/Starknet/modules/cli/pages/starknet-compiler-options.adoc index 06a3fd3ec8..8f47ddce38 100644 --- a/components/Starknet/modules/tools/pages/CLI/starknet-compiler-options.adoc +++ b/components/Starknet/modules/cli/pages/starknet-compiler-options.adoc @@ -27,7 +27,7 @@ starknet-compile [-h] [--abi _ABI_] [--disable_hint_validation] The following example compiles the file `contract.cairo`. It generates two files: [horizontal] -contract_compiled.json:: The contract class. This file contains the bytecode and all other information necessary to execute a contract. For information on contract classes, see xref:architecture_and_concepts:Contracts/contract-classes.adoc[]. +contract_compiled.json:: The contract class. This file contains the bytecode and all other information necessary to execute a contract. For information on contract classes, see xref:architecture_and_concepts:Smart_Contracts/contract-classes.adoc[]. contract_abi.json:: The contract's ABI. [source,shell] diff --git a/components/Starknet/modules/contribute/nav.adoc b/components/Starknet/modules/contribute/nav.adoc new file mode 100644 index 0000000000..820c790409 --- /dev/null +++ b/components/Starknet/modules/contribute/nav.adoc @@ -0,0 +1,3 @@ +* Contribute to Starknet +** xref: +** link:https://community.starknet.io/[Community forum] diff --git a/components/Starknet/modules/contribute/pages/bug-bounty.adoc b/components/Starknet/modules/contribute/pages/bug-bounty.adoc new file mode 100644 index 0000000000..f141d12ebf --- /dev/null +++ b/components/Starknet/modules/contribute/pages/bug-bounty.adoc @@ -0,0 +1,9 @@ += Bug bounty + +A successful audit doesn't gurantee that the underlying code is free of bugs. For that purpose, we started a bug bounty program for StarkNet. + +Currently, the bounty program focuses on the StarkNet OS and related L1 contracts that define the protocol. + +In the future it may be extended to cover some of the mathematical foundations described above. +You're welcome to report issues in our link:https://starknet.io/discord[discord]. + diff --git a/components/Starknet/modules/contribute/pages/completed-audits.adoc b/components/Starknet/modules/contribute/pages/completed-audits.adoc new file mode 100644 index 0000000000..5c5f2546d6 --- /dev/null +++ b/components/Starknet/modules/contribute/pages/completed-audits.adoc @@ -0,0 +1,24 @@ += Completed audits + +The following audits have been completed for the Starknet stack: + + + +* An audit for StarkWare's solidity STARK verifier +* An audit for StarkWare's solidity Cairo and the SHARP verifiers +* An audit for StarkWare's Cairo STARK/Cairo verifiers + + +[cols="1,1"] +|=== +|Audit focus|Link: + +|StarkWare's solidity STARK verifier +|https://github.com/starknet-io/starknet-stack-resources/blob/main/Audits/EVM_STARK_Verifier_v4.0_Audit_Report.pdf + +|StarkWare's solidity Cairo and the SHARP verifiers +|https://github.com/starknet-io/starknet-stack-resources/blob/main/Audits/Cairo%20&%20SHARP%20Verifiers.pdf + +|StarkWare's Cairo STARK/Cairo verifiers +|https://github.com/starknet-io/starknet-stack-resources/blob/main/Audits/STARK_Cairo%20Verifiers%20(in%20Cairo)%20Audit%20Report.pdf +|=== \ No newline at end of file diff --git a/components/Starknet/modules/contribute/pages/conduct.adoc b/components/Starknet/modules/contribute/pages/conduct.adoc new file mode 100644 index 0000000000..a0477100f2 --- /dev/null +++ b/components/Starknet/modules/contribute/pages/conduct.adoc @@ -0,0 +1 @@ += Starknet contribution: code of conduct \ No newline at end of file diff --git a/components/Starknet/modules/end_of_life_and_deprecated_features/nav.adoc b/components/Starknet/modules/end_of_life_and_deprecated_features/nav.adoc deleted file mode 100644 index ff0f3e35f3..0000000000 --- a/components/Starknet/modules/end_of_life_and_deprecated_features/nav.adoc +++ /dev/null @@ -1,2 +0,0 @@ - -* xref:index.adoc[Deprecated and obsolete features] \ No newline at end of file diff --git a/components/Starknet/modules/getting_started/pages/deploying_contracts.adoc b/components/Starknet/modules/getting_started/pages/deploying_contracts.adoc deleted file mode 100644 index f01529e42e..0000000000 --- a/components/Starknet/modules/getting_started/pages/deploying_contracts.adoc +++ /dev/null @@ -1,247 +0,0 @@ -[id="deploying_contracts"] - -= Deploying Starknet contracts - -In this section, you will learn to compile, deploy and interact with a Starknet contract written in Cairo. - -Follow the below steps in order to accomplish your goal! - -== Set up an RPC Provider - -In order to interact with the Starknet main chain or any testnets, you'll need an RPC provider. Please refer to https://docs.alchemy.com/reference/starknet-api-quickstart/?a=starknet-docs[Alchemy's quickstart guide] to start developing with Starknet APIs! - -== Setting up environment variables - -The following commands must run every time you open a new terminal to interact with Starknet. Setting them saves you time when using the CLI within the same terminal session. - -[,Bash] ----- -# Use Starknet testnet -export STARKNET_NETWORK=alpha-goerli -# Set the default wallet implementation to be used by the CLI -export STARKNET_WALLET=starkware.starknet.wallets.open_zeppelin.OpenZeppelinAccount -# Set the path to the cairo 1 compiler binary. Adapt this path to fit your installation if needed -export CAIRO_COMPILER_DIR=~/.cairo/target/release/ -# Compiler arguments -export CAIRO_COMPILER_ARGS=--add-pythonic-hints ----- - -== Setting up an account - -You need to set up your CLI with an account contract and fund it. -____ -Starknet accounts are smart contracts. As such, creating one involves sending a transaction, and takes a bit longer than creating an EOA on other networks. -You can learn more in the https://docs.starknet.io/documentation/architecture_and_concepts/Account_Abstraction/introduction/[accounts] section of the documentation. -____ - -This process will involve three steps: - -* Generating your account address locally -* Funding it -* Deploying it - -The Starknet account declared through the CLI are stored on your machine in folder `~/.starknet_accounts/`. - -[,Bash] ----- -starknet new_account --account account_name ----- - -Your terminal will return your account's address. -[,Bash] ----- -Account address: 0x00d9d851f600d539a9f7811de4d9613a6b3c2634f8c0386a305c03216bd67559 -Public key: 0x0293d6625d860b9a37a0319d1e3c1eecc27685075cbeaae4ef29ed717d93c58b -Move the appropriate amount of funds to the account, and then deploy the account -by invoking the 'starknet deploy_account' command. - -NOTE: This is a modified version of the OpenZeppelin account contract. The signature is computed -differently. ----- - -Next step is to fund it. - -* Use the https://faucet.goerli.starknet.io[faucet] to get some funds and send them to the account -* Bridge funds using https://goerli.starkgate.starknet.io/[Starkgate] - -However you chose to do it, please make sure that the funding transaction reaches the "PENDING" status before moving on. You can look for it on https://testnet.starkscan.co/[Starkscan] or https://goerli.voyager.online/[Voyager] - -[,Bash] ----- -starknet deploy_account --account account_name ----- - -Your sample output should look something like this: - -[,Bash] ----- -Sending the transaction with max_fee: 0.000568 ETH (568383605914463 WEI). -Sent deploy account contract transaction. -Contract address: 0x03f42fc2355be54197a8b270ff2cb8e2eb7902e777b3498f8ad58c6c147cce60 -Transaction hash: 0x3d15e05389ecd1ff65555220be57f0ab43729877b20ca086048276917ed2838 ----- - -Monitor the transaction until it passes the "PENDING" state. - -== Create and compile a contract - -Before we get started, make sure that the below commands are working properly on your system. If -they don't, please check the xref:documentation:getting_started:environment_setup.adoc[Setting up - your environment] section. - -[,Bash] ----- -starknet --version -starknet-compile --version ----- - -You can now create a folder of your choice (in any location) where you would like to practice -your Cairo skills . Inside the new folder, create a file name `hello_starknet.cairo`. - -Navigate to your home directory: - -[,Bash] ----- -cd ~/ ----- - -Make a new directory named `cairo_practice` and navigate into the directory: -[,Bash] ----- -mkdir cairo_practice && cd cairo_practice ----- - -Create a new file called `hello_starknet.cairo` - -[,Bash] ----- -touch hello_starknet.cairo ----- - - -Copy and paste the following piece of code into your `hello_starknet.cairo` file: - -[,Rust] ----- -#[contract] -mod HelloStarknet { - use starknet::get_caller_address; - use starknet::ContractAddress; - - #[event] - fn Hello(from:ContractAddress, value:felt252) {} - - #[external] - fn say_hello(message:felt252) { - let caller=get_caller_address(); - Hello(caller, message); - } - -} ----- - -Customize the above code by adding a new type of event. Find a name that is unique (this is important). -Add the following code: - ----- - #[event] - fn My_Unique_Event_Name(from:ContractAddress, value:felt252) {} ----- - -Compile the above Starknet contract using the following command: - -[,Bash] ----- -starknet-compile hello_starknet.cairo hello_starknet.json ----- - -The above command should compile to produce a `hello_starknet.json` file in the same folder. - -== Declare a contract class - -On Starknet, the deployment process is in two steps: - -* Declaring the class of your contract, or sending your contract's code to the network -* Deploying a contract, or creating an instance of the code you previously declared - -Let's start with declaring the above code. -[,Bash] ----- -starknet declare --contract hello_starknet.json --account account_name ----- -____ -The above command may fail if you are using code that has already been declared by someone else! Please make sure to add custom code to your contract to create a new contract class. -____ - -You will see something like: - -[,Bash] ----- -Sending the transaction with max_fee: 0.000132 ETH (131904173791637 WEI). -Declare transaction was sent. -Contract class hash: 0x8ceb9796d2809438d1e992b8ac17cfe83d0cf5944dbad948a370e0b5d5924f -Transaction hash: 0x334f16d9da30913c4a30194057793379079f35efa6bf5753bc6e724a591e9f0 ----- -The transaction hash allows you to track when the network will have received your contract's code. Once this transaction has moved to "PENDING", you can deploy an instance of your contract. - -== Deploy a contract - -Using the above generated class hash, deploy the contract: - -[,Bash] ----- -starknet deploy --class_hash 0x8ceb9796d2809438d1e992b8ac17cfe83d0cf5944dbad948a370e0b5d5924f --account account_name ----- - -____ -If you run into any fee related issues, please add the flag `--max_fee 100000000000000000` to your CLI commands to set an arbitrary high gas limit for your deploy transaction. -____ - -You will see something like: - -[,Bash] ----- -Sending the transaction with max_fee: 0.000197 ETH (197273405375932 WEI). -Invoke transaction for contract deployment was sent. -Contract address: 0x03a5cac216edec20350e1fd8369536fadebb20b83bfceb0c33aab0175574d35d -Transaction hash: 0x7895267b3e967e1c9c2f7da145e323bed60dfdd1b8ecc8efd243c9d587d579a ----- - -Monitor the deploy transaction. Once it has passed "PENDING", your contract has been successfully -deployed! - -Wohooo! You have just deployed your first Cairo 1.0 contract on StarkNet! Congratulations. - -== Interact with your contract - -If you quickly browse through the above contract (`hello_starknet.cairo`), you can see the -contract has a simple function: `say_hello` which we are going to learn to trigger. - -[,Bash] ----- -#[external] -fn say_hello(message:felt252) { - let caller=get_caller_address(); - Hello(caller, message); -} ----- - -The syntax to invoke a function in your contract is: - -[,Bash] ----- -starknet invoke --function --address
--account - -# Invoking our say_hello function -starknet invoke --function say_hello --address 0x03a5cac216edec20350e1fd8369536fadebb20b83bfceb0c33aab0175574d35d --input 152 --account account_name ----- - -You will see something like: - -[,Bash] ----- -Sending the transaction with max_fee: 0.000080 ETH (79590795788372 WEI). -Invoke transaction was sent. -Contract address: 0x03a5cac216edec20350e1fd8369536fadebb20b83bfceb0c33aab0175574d35d -Transaction hash: 0xbfb3ec183b4ee58db67113cf8832c31e78fe8000f091cc598d5aa9ca6a62af ----- diff --git a/components/Starknet/modules/getting_started/nav.adoc b/components/Starknet/modules/quick_start/nav.adoc similarity index 80% rename from components/Starknet/modules/getting_started/nav.adoc rename to components/Starknet/modules/quick_start/nav.adoc index b7259a6516..a3767941cd 100644 --- a/components/Starknet/modules/getting_started/nav.adoc +++ b/components/Starknet/modules/quick_start/nav.adoc @@ -1,4 +1,4 @@ -* Getting Started +* Quick start ** xref:environment_setup.adoc[Setting up your environment] ** xref:account_setup.adoc[Setting up your account] @@ -10,7 +10,3 @@ *** xref:account_setup.adoc#simulate-account-deployment[Simulate account deployment] *** xref:account_setup.adoc#deploying-an-account[Deploying an account] - - -//** xref:deploying_contracts.adoc[Deploying smart contracts] -//** xref:writing_first_contract.adoc[Writing your first Starknet contract] \ No newline at end of file diff --git a/components/Starknet/modules/getting_started/pages/account_setup.adoc b/components/Starknet/modules/quick_start/pages/account_setup.adoc similarity index 98% rename from components/Starknet/modules/getting_started/pages/account_setup.adoc rename to components/Starknet/modules/quick_start/pages/account_setup.adoc index c127af0eb4..29c6eaa9b9 100644 --- a/components/Starknet/modules/getting_started/pages/account_setup.adoc +++ b/components/Starknet/modules/quick_start/pages/account_setup.adoc @@ -19,8 +19,7 @@ account on Starknet you will need to complete the following steps: Starknet natively uses Account Abstraction at the protocol layer for account implementation. You can learn more about Starknet Account Abstraction -xref:architecture_and_concepts:Account_Abstraction/introduction.adoc[here]. - +xref:architecture_and_concepts:Accounts/introduction.adoc[here]. [id="setting-up-the-network"] == Setting up the network diff --git a/components/Starknet/modules/getting_started/pages/environment_setup.adoc b/components/Starknet/modules/quick_start/pages/environment_setup.adoc similarity index 100% rename from components/Starknet/modules/getting_started/pages/environment_setup.adoc rename to components/Starknet/modules/quick_start/pages/environment_setup.adoc diff --git a/components/Starknet/modules/quick_start/pages/index.adoc b/components/Starknet/modules/quick_start/pages/index.adoc new file mode 100644 index 0000000000..51c80d5cc2 --- /dev/null +++ b/components/Starknet/modules/quick_start/pages/index.adoc @@ -0,0 +1,10 @@ +[id="getting_started"] += Getting started + +Starknet is a permissionless decentralized ZK-Rollup operating as an L2 network over Ethereum, +where any dApp can achieve unlimited scale for its computation, without compromising Ethereum’s +composability and security. + +Currently, Starknet’s first step, Starknet Alpha, is deployed. This tutorial walks you through +writing and deploying a Starknet contract. + diff --git a/components/Starknet/modules/starknet_versions/nav.adoc b/components/Starknet/modules/starknet_versions/nav.adoc index 0dcee7922d..1319657b86 100644 --- a/components/Starknet/modules/starknet_versions/nav.adoc +++ b/components/Starknet/modules/starknet_versions/nav.adoc @@ -1,7 +1,4 @@ -* Starknet versions - -** xref:version_notes.adoc[Starknet version notes] +* Versions +** xref:version_notes.adoc[Starknet release notes] ** xref:upcoming_versions.adoc[Upcoming Starknet versions] -** xref:juno_versions.adoc[Juno version notes] -** xref:pathfinder_versions.adoc[Pathfinder version notes] -** xref:limits_and_triggers.adoc[Current limits and triggers] +** xref:deprecated.adoc[Deprecated and removed features] diff --git a/components/Starknet/modules/end_of_life_and_deprecated_features/pages/index.adoc b/components/Starknet/modules/starknet_versions/pages/deprecated.adoc similarity index 85% rename from components/Starknet/modules/end_of_life_and_deprecated_features/pages/index.adoc rename to components/Starknet/modules/starknet_versions/pages/deprecated.adoc index 0bf177192b..326a068a4e 100644 --- a/components/Starknet/modules/end_of_life_and_deprecated_features/pages/index.adoc +++ b/components/Starknet/modules/starknet_versions/pages/deprecated.adoc @@ -18,7 +18,7 @@ The following features have been deprecated or removed from Starknet in recent r [%autowidth.stretch] |=== |Name|Description -|Starknet CLI | The Starknet CLI will be deprecated soon and replaced by xref:tools:CLI/starkli.adoc[Starkli]. +|Starknet CLI | The Starknet CLI will be deprecated soon and replaced by xref:cli:starkli.adoc[Starkli]. Support for Starknet CLI will be removed in Starknet v0.13.0. |Cairo 0 | xref:starknet_versions:version_notes.adoc#version0.11.0[Starknet v0.11.0] introduces Cairo 1.0 smart contracts. @@ -34,12 +34,12 @@ Support for Starknet CLI will be removed in Starknet v0.13.0. From xref:starknet_versions:version_notes.adoc#version0.11.0[Starknet v0.11.0], the fee mechanism is enforced and the ability to send L1->L2 messages without the corresponding L2 fee has been removed. -See xref:documentation:architecture_and_concepts:L1-L2_Communication/messaging-mechanism.adoc#l1-l2_message_fees[here] for more details. +See xref:architecture_and_concepts:Network_Architecture/L1-L2_Communication/messaging-mechanism.adoc#l1-l2-message-fees[here] for more details. |`invoke` transaction v0 |`invoke` transaction v0 has been removed since xref:starknet_versions:version_notes.adoc#version0.11.0[Starknet v0.11.0]. |`declare` transaction v0 |`declare` transaction v0 has been removed since xref:starknet_versions:version_notes.adoc#version0.11.0[Starknet v0.11.0]. |`deploy` transaction|The `deploy` transaction has been removed since xref:documentation:starknet_versions:version_notes.adoc#version0.10.3[Starknet v0.10.3]. -To deploy new contract instances, you can use the xref:architecture_and_concepts:Contracts/system-calls.adoc#deploy[`deploy` system call]. +To deploy new contract instances, you can use the xref:architecture_and_concepts:Smart_Contracts/system-calls-cairo1.adoc#deploy[`deploy` system call]. |=== \ No newline at end of file diff --git a/components/Starknet/modules/starknet_versions/pages/juno_versions.adoc b/components/Starknet/modules/starknet_versions/pages/juno_versions.adoc index 9cf2abbce2..396f61fd38 100644 --- a/components/Starknet/modules/starknet_versions/pages/juno_versions.adoc +++ b/components/Starknet/modules/starknet_versions/pages/juno_versions.adoc @@ -1,5 +1,5 @@ [id="juno"] -= Juno versions += Juno release notes # Juno image::juno_banner.png[width=800] diff --git a/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc b/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc index 071ade1a9d..7c34ebb57f 100644 --- a/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc +++ b/components/Starknet/modules/starknet_versions/pages/pathfinder_versions.adoc @@ -1,5 +1,5 @@ [id="pathfinder"] -= Pathfinder versions += Pathfinder release notes # Pathfinder Pathfinder is a Starknet full node giving you a safe view into Starknet. diff --git a/components/Starknet/modules/starknet_versions/pages/upcoming_versions.adoc b/components/Starknet/modules/starknet_versions/pages/upcoming_versions.adoc index 63adb61e1a..a15b00c87b 100644 --- a/components/Starknet/modules/starknet_versions/pages/upcoming_versions.adoc +++ b/components/Starknet/modules/starknet_versions/pages/upcoming_versions.adoc @@ -4,6 +4,8 @@ ## Starknet Alpha v0.12.1 + +[id="what_to_expect"] ### What to expect The focus of Starknet v0.12.1 is on improving the efficiency of the sequencer capacity. The proposed changes aim to address the issue of processing failed transactions and optimize the network's potential for valid transactions. diff --git a/components/Starknet/modules/starknet_versions/pages/version_notes.adoc b/components/Starknet/modules/starknet_versions/pages/version_notes.adoc index 4885a9a58d..783fd76d62 100644 --- a/components/Starknet/modules/starknet_versions/pages/version_notes.adoc +++ b/components/Starknet/modules/starknet_versions/pages/version_notes.adoc @@ -1,5 +1,5 @@ [id="upcoming"] -= Version notes += Starknet release notes The following version notes cover the ongoing version changes to Starknet. To get the latest version updates delivered to you, please subscribe to our mailing list https://cdn.forms-content.sg-form.com/2fb14a4a-f24d-11ed-97a1-2255cc459392[here]. diff --git a/components/Starknet/modules/tools/nav.adoc b/components/Starknet/modules/tools/nav.adoc index 52673130dc..e6d747d28a 100644 --- a/components/Starknet/modules/tools/nav.adoc +++ b/components/Starknet/modules/tools/nav.adoc @@ -1,6 +1,21 @@ -* Tools -** xref:CLI/starkli.adoc[Starkli CLI (recommended)] -** xref:CLI/commands.adoc[Starknet CLI reference (deprecated)] -** xref:api_rpc.adoc[Starknet full-nodes and API services] -** xref:ref_block_explorers.adoc[Starknet block explorers] -** xref:CLI/starknet-compiler-options.adoc[Starknet compiler reference] \ No newline at end of file +* Developer tools and resources + +** xref:starknet-book.adoc[The Starknet book] + +** Command line interface +*** xref:cli:starkli.adoc[Starkli CLI] +*** xref:cli:starknet-compiler-options.adoc[Compiler CLI reference] + +** Full nodes and API services +*** xref:api-services.adoc[Full nodes and API services] +*** xref:starknet_versions:juno_versions.adoc[Juno release notes] +*** xref:starknet_versions:pathfinder_versions.adoc[Pathfinder release notes] + +** xref:important_addresses.adoc[Important addresses] +** xref:limits_and_triggers.adoc[Current limits and triggers] +** xref:ref_block_explorers.adoc[Block explorers] +** xref:audit.adoc[Audit providers] + + + + diff --git a/components/Starknet/modules/tools/pages/CLI/starkli.adoc b/components/Starknet/modules/tools/pages/CLI/starkli.adoc deleted file mode 100644 index 89def42b99..0000000000 --- a/components/Starknet/modules/tools/pages/CLI/starkli.adoc +++ /dev/null @@ -1,14 +0,0 @@ -[id="commands"] -= StarkLi CLI - -xref:CLI/commands.adoc[Starknet CLI], the current command line interface (CLI) for Starknet, built by StarkWare, is deprecated, and support will be removed in Starknet v0.13.0. - -Instead, you should use link:https://github.com/xJonathanLEI/starkli[Starkli]. Starkli is a CLI powered by link:https://github.com/xJonathanLEI/starknet-rs[starknet-rs] and developed by -Starknet community contributor link:https://github.com/xJonathanLEI[@xJonathanLEI]. - -For full documentation, see the link:https://book.starkli.rs/[Starkli Book]. - -[NOTE] -==== -As of Starknet v0.13.0, Starknet CLI will no longer be supported. -==== \ No newline at end of file diff --git a/components/Starknet/modules/tools/pages/api-services.adoc b/components/Starknet/modules/tools/pages/api-services.adoc new file mode 100644 index 0000000000..5f6720ba51 --- /dev/null +++ b/components/Starknet/modules/tools/pages/api-services.adoc @@ -0,0 +1,25 @@ += Full nodes & API services + +A list of recommended full-node & API providers. + +.API providers +[cols="1,2,1",stripes=even] +[%header,cols="2,2,1"] +|=== +| Provider name | Description | More information +|Alchemy |An API service for Starknet | link:https://www.alchemy.com/starknet[www.alchemy.com/starknet] +|Bware labs | An API service for Starknet| link:https://blastapi.io/public-api/starknet[blastapi.io/public-api/starknet] +|Chainstack | An API service for Starknet| link:https://chainstack.com/build-better-with-starknet/[chainstack.com/build-better-with-starknet] +|Infura | An API service for Starknet|link:https://www.infura.io/networks/ethereum/starknet^[www.infura.io/networks/ethereum/starknet] +|Lava Protocol|An open-source protocol for reliable access to RPC data | link:https://www.lavanet.xyz/[www.lavanet.xyz] +|=== + +.Node providers +[cols="1,2,1",stripes=even] +[%header,cols="2,2,1"] +|=== +| Provider name | Description | More information +|Juno|A Starknet full-node written in go-lang by Nethermind |link:https://github.com/NethermindEth/juno[github.com/NethermindEth/juno] +|Papyrus|A Starknet full-node written in Rust by StarkWare | link:https://github.com/starkware-libs/papyrus[github.com/starkware-libs/papyrus] +|Pathfinder|A Starknet full-node written in Rust by Equilibrium |link:https://github.com/eqlabs/pathfinder[github.com/eqlabs/pathfinder] +|=== \ No newline at end of file diff --git a/components/Starknet/modules/useful_info/pages/audit.adoc b/components/Starknet/modules/tools/pages/audit.adoc similarity index 100% rename from components/Starknet/modules/useful_info/pages/audit.adoc rename to components/Starknet/modules/tools/pages/audit.adoc diff --git a/components/Starknet/modules/useful_info/pages/index.adoc b/components/Starknet/modules/tools/pages/important_addresses.adoc similarity index 97% rename from components/Starknet/modules/useful_info/pages/index.adoc rename to components/Starknet/modules/tools/pages/important_addresses.adoc index 49f7114312..40ef67e1c7 100644 --- a/components/Starknet/modules/useful_info/pages/index.adoc +++ b/components/Starknet/modules/tools/pages/important_addresses.adoc @@ -35,4 +35,4 @@ Decimals:: Number of decimal places used to get the user representation. l1_token_address:: Address of the L1 ERC-20 contract. l2_token_address:: Address of the L2 ERC-20 contract. l1_bridge_address:: Address of the L1 bridge contract. -l2_bridge_address:: Address of the L2 bridge contract. \ No newline at end of file +l2_bridge_address:: Address of the L2 bridge contract. diff --git a/components/Starknet/modules/starknet_versions/pages/limits_and_triggers.adoc b/components/Starknet/modules/tools/pages/limits_and_triggers.adoc similarity index 98% rename from components/Starknet/modules/starknet_versions/pages/limits_and_triggers.adoc rename to components/Starknet/modules/tools/pages/limits_and_triggers.adoc index fa902996ec..1efd28381c 100644 --- a/components/Starknet/modules/starknet_versions/pages/limits_and_triggers.adoc +++ b/components/Starknet/modules/tools/pages/limits_and_triggers.adoc @@ -8,7 +8,7 @@ Starknet alpha currently has a number of limits and triggers in place in order These are subject to revisions and change on a regular basis ==== -.StarkNet current limits and triggers +.Starknet current limits and triggers [%header, stripes=even] [%autowidth.stretch] |=== diff --git a/components/Starknet/modules/tools/pages/api_rpc.adoc b/components/Starknet/modules/tools/pages/rpc.adoc similarity index 94% rename from components/Starknet/modules/tools/pages/api_rpc.adoc rename to components/Starknet/modules/tools/pages/rpc.adoc index 529923b716..ce053612ed 100644 --- a/components/Starknet/modules/tools/pages/api_rpc.adoc +++ b/components/Starknet/modules/tools/pages/rpc.adoc @@ -1,6 +1,6 @@ -= Full-nodes and API services += Full nodes and API services -A list of recommended full-nodes and API providers. +A list of recommended full nodes and API providers. .Node providers [cols="1,2,1",stripes=even] diff --git a/components/Starknet/modules/tools/pages/starknet-book.adoc b/components/Starknet/modules/tools/pages/starknet-book.adoc new file mode 100644 index 0000000000..dc4fb6863e --- /dev/null +++ b/components/Starknet/modules/tools/pages/starknet-book.adoc @@ -0,0 +1,12 @@ +[id="starknet_book"] += The Starknet book + +The link:https://book.starknet.io[Starknet Book] serves as a comprehensive walkthrough, providing valuable insights into the +world of Starknet and Cairo. Designed to cater to various objectives and interests, this resource offers a curated selection of paths to guide your exploration. + +Whether you are a complete beginner starting from scratch or an experienced developer looking for specific insights, the Starknet Book has you covered. + +From smart contract development to frontend integration, node operation to security analysis, and +even delving into the underlying architecture and cryptography, each chapter presents a focused and informative journey. Mix and match these paths to tailor your learning experience based on your unique interests and requirements. + +The Starknet Book is your trusted companion on the quest for deepening your understanding of the Starknet ecosystem. diff --git a/components/Starknet/modules/useful_info/nav.adoc b/components/Starknet/modules/useful_info/nav.adoc deleted file mode 100644 index 2efc22ac0a..0000000000 --- a/components/Starknet/modules/useful_info/nav.adoc +++ /dev/null @@ -1,3 +0,0 @@ -* Useful Info -** xref:index.adoc[Important addresses] -** xref:audit.adoc[Audit providers] \ No newline at end of file diff --git a/playbook.yml b/playbook.yml index 2f25c7f0df..4248a70eab 100644 --- a/playbook.yml +++ b/playbook.yml @@ -38,12 +38,8 @@ asciidoc: antora: extensions: - # Installing the lunr-extension requires installing it, and including the following line in your playbook.yml file. - # For info on installing the lunr-extension, see https://gitlab.com/antora/antora-lunr-extension#user-content-ui-assumptions. - # The lunr-tokenizer enables search results that include strings within code samples. - # For example, without the lunr-tokenizer, searching for `foo` will find `The foo function`, but it won't find `foo(arg1)`. -# - require: './lunr-tokenizer' -# - require: '@antora/lunr-extension' + - require: './lunr-tokenizer' + - require: '@antora/lunr-extension' index_latest_only: true output: diff --git a/server.sh b/server.sh new file mode 100644 index 0000000000..6d169430f4 --- /dev/null +++ b/server.sh @@ -0,0 +1,3 @@ +#! /bin/bash +http-server . -c-1 + diff --git a/ui/src/css/vendor/rpc.css b/ui/src/css/vendor/rpc.css new file mode 100644 index 0000000000..30560e8793 --- /dev/null +++ b/ui/src/css/vendor/rpc.css @@ -0,0 +1,31 @@ +/* Styling for JSON container */ +#jsonContainer { + font-family: monospace; + margin: 20px; +} + +/* Styling for JSON keys */ +.json-key { + font-weight: bold; + cursor: pointer; +} + +/* Styling for collapsible sections */ +.json-section { + margin-left: 20px; + padding-left: 10px; + border-left: 1px solid #ccc; + cursor: pointer; +} + +.json-content { + display: none; +} + +.json-section.collapsed .json-content { + display: none; +} + +.json-section.collapsed .json-toggle { + transform: rotate(-45deg); +} diff --git a/ui/src/js/vendor/rpc.js b/ui/src/js/vendor/rpc.js new file mode 100644 index 0000000000..575e6c7b6d --- /dev/null +++ b/ui/src/js/vendor/rpc.js @@ -0,0 +1,98 @@ +function createJsonElement(data, indent) { + const type = typeof data; + + if (Array.isArray(data)) { + const element = document.createElement("div"); + element.classList.add("json-array"); + + if (indent > 0) { + element.classList.add("json-indent"); + } + + data.forEach((item) => { + const itemElement = createJsonElement(item, indent + 1); + element.appendChild(itemElement); + }); + + return element; + } else if (type === "object" && data !== null) { + const element = document.createElement("div"); + element.classList.add("json-object"); + + if (indent > 0) { + element.classList.add("json-indent"); + } + + Object.keys(data).forEach((key) => { + const value = data[key]; + + if (key === "name") { + const keyElement = document.createElement("span"); + keyElement.classList.add("json-key"); + keyElement.textContent = `${key}: `; + + const valueElement = createJsonElement(value, indent + 1); + + const sectionElement = document.createElement("div"); + sectionElement.classList.add("json-section"); + sectionElement.appendChild(keyElement); + sectionElement.appendChild(valueElement); + + sectionElement.addEventListener("click", () => { + sectionElement.classList.toggle("collapsed"); + }); + + element.appendChild(sectionElement); + } else { + const nestedElement = createJsonElement(value, indent + 1); + element.appendChild(nestedElement); + } + }); + + return element; + } else { + const element = document.createElement("span"); + element.classList.add("json-value"); + + if (type === "string") { + element.classList.add("token", "string"); + element.textContent = `"${data}"`; + } else if (type === "number") { + element.classList.add("token", "number"); + element.textContent = data.toString(); + } else if (type === "boolean") { + element.classList.add("token", "boolean"); + element.textContent = data.toString(); + } else if (type === "null") { + element.classList.add("token", "null"); + element.textContent = "null"; + } + + return element; + } +} + +function fetchAndDisplayJSON() { + var url = "https://raw.githubusercontent.com/starkware-libs/starknet-specs/master/api/starknet_api_openrpc.json?token=ASNPSF625O5JPOCD2SYH5D3BO3AAM&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:darkMode%5D=true&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false"; + + fetch(url) + .then((response) => { + if (!response.ok) { + throw new Error("Error fetching JSON: " + response.status); + } + return response.json(); + }) + .then((jsonData) => { + var jsonContainer = document.getElementById("jsonContainer"); + var methodsData = jsonData.methods || {}; + + jsonContainer.innerHTML = ""; + jsonContainer.appendChild(createJsonElement(methodsData, 0)); + }) + .catch((error) => { + console.error(error); + }); +} + +// Call the fetchAndDisplayJSON function when the page has loaded +document.addEventListener("DOMContentLoaded", fetchAndDisplayJSON); diff --git a/yarn.lock b/yarn.lock index c8bc7683a8..175a41933d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -298,7 +298,7 @@ dependencies: yargs "16.2.0" -"@asciidoctor/core@2.2.6", "@asciidoctor/core@~2.2": +"@asciidoctor/core@^2.0.0-rc.1", "@asciidoctor/core@~2.2", "@asciidoctor/core@2.2.6": version "2.2.6" resolved "https://registry.npmjs.org/@asciidoctor/core/-/core-2.2.6.tgz" integrity sha512-TmB2K5UfpDpSbCNBBntXzKHcAk2EA3/P68jmWvmJvglVUdkO9V6kTAuXVe12+h6C4GK0ndwuCrHHtEVcL5t6pQ== @@ -372,14 +372,6 @@ resolved "https://registry.npmjs.org/@types/normalize-package-data/-/normalize-package-data-2.4.1.tgz" integrity sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw== -JSONStream@^1.0.4: - version "1.3.5" - resolved "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz" - integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== - dependencies: - jsonparse "^1.2.0" - through ">=2.2.7 <3" - abort-controller@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz" @@ -653,16 +645,16 @@ color-convert@^2.0.1: dependencies: color-name "~1.1.4" -color-name@1.1.3: - version "1.1.3" - resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" - integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== - color-name@~1.1.4: version "1.1.4" resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== +color-name@1.1.3: + version "1.1.3" + resolved "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz" + integrity sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw== + colorette@^2.0.7: version "2.0.19" resolved "https://registry.npmjs.org/colorette/-/colorette-2.0.19.tgz" @@ -728,7 +720,7 @@ conventional-changelog-config-spec@2.1.0: resolved "https://registry.npmjs.org/conventional-changelog-config-spec/-/conventional-changelog-config-spec-2.1.0.tgz" integrity sha512-IpVePh16EbbB02V+UA+HQnnPIohgXvJRxHcS5+Uwk4AT5LjzCZJm5sp/yqs5C6KZJ1jMsV4paEV13BN1pvDuxQ== -conventional-changelog-conventionalcommits@4.6.3, conventional-changelog-conventionalcommits@^4.5.0: +conventional-changelog-conventionalcommits@^4.5.0, conventional-changelog-conventionalcommits@4.6.3: version "4.6.3" resolved "https://registry.npmjs.org/conventional-changelog-conventionalcommits/-/conventional-changelog-conventionalcommits-4.6.3.tgz" integrity sha512-LTTQV4fwOM4oLPad317V/QNQ1FY4Hju5qeBIM1uTHbrnCE+Eg4CdRZ3gO2pUeR+tzWdp80M2j3qFFEDWVqOV4g== @@ -843,8 +835,8 @@ conventional-commits-parser@^3.2.0: resolved "https://registry.npmjs.org/conventional-commits-parser/-/conventional-commits-parser-3.2.4.tgz" integrity sha512-nK7sAtfi+QXbxHCYfhpZsfRtaitZLIA6889kFIouLvz6repszQDgxBu7wf2WbU+Dco7sAnNCJYERCwt54WPC2Q== dependencies: - JSONStream "^1.0.4" is-text-path "^1.0.1" + JSONStream "^1.0.4" lodash "^4.17.15" meow "^8.0.0" split2 "^3.0.0" @@ -1289,19 +1281,19 @@ glob-stream@~7.0: to-absolute-glob "^2.0.2" unique-stream "^2.3.1" -glob@7.1.3: - version "7.1.3" - resolved "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz" - integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== +glob@^7.1.1: + version "7.2.3" + resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" + integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== dependencies: fs.realpath "^1.0.0" inflight "^1.0.4" inherits "2" - minimatch "^3.0.4" + minimatch "^3.1.1" once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.2.0: +glob@^7.2.0: version "7.2.3" resolved "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -1324,6 +1316,18 @@ glob@^8.0.0: minimatch "^5.0.1" once "^1.3.0" +glob@7.1.3: + version "7.1.3" + resolved "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz" + integrity sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ== + dependencies: + fs.realpath "^1.0.0" + inflight "^1.0.4" + inherits "2" + minimatch "^3.0.4" + once "^1.3.0" + path-is-absolute "^1.0.0" + graceful-fs@^4.0.0, graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.2.10" resolved "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz" @@ -1463,7 +1467,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3: +inherits@^2.0.1, inherits@^2.0.3, inherits@~2.0.0, inherits@~2.0.3, inherits@2: version "2.0.4" resolved "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -1647,6 +1651,14 @@ jsonparse@^1.2.0: resolved "https://registry.npmjs.org/jsonparse/-/jsonparse-1.3.1.tgz" integrity sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg== +JSONStream@^1.0.4: + version "1.3.5" + resolved "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.5.tgz" + integrity sha512-E+iruNOY8VV9s4JEbe1aNEm6MiszPRr/UfcHMz0TQh1BXSxHK+ASV1R6W4HpjBhSeS+54PIsAMCBmwD06LLsqQ== + dependencies: + jsonparse "^1.2.0" + through ">=2.2.7 <3" + kind-of@^6.0.3: version "6.0.3" resolved "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz" @@ -1792,7 +1804,14 @@ min-indent@^1.0.0: resolved "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz" integrity sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg== -minimatch@^3.0.4, minimatch@^3.1.1: +minimatch@^3.0.4: + version "3.1.2" + resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" + integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== + dependencies: + brace-expansion "^1.1.7" + +minimatch@^3.1.1: version "3.1.2" resolved "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz" integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw== @@ -1862,7 +1881,17 @@ neo-async@^2.6.0: resolved "https://registry.npmjs.org/neo-async/-/neo-async-2.6.2.tgz" integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw== -normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: +normalize-package-data@^2.3.2: + version "2.5.0" + resolved "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz" + integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== + dependencies: + hosted-git-info "^2.1.4" + resolve "^1.10.0" + semver "2 || 3 || 4 || 5" + validate-npm-package-license "^3.0.1" + +normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.5.0.tgz" integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== @@ -1944,7 +1973,14 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" -p-limit@^2.0.0, p-limit@^2.2.0: +p-limit@^2.0.0: + version "2.3.0" + resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" + integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== + dependencies: + p-try "^2.0.0" + +p-limit@^2.2.0: version "2.3.0" resolved "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz" integrity sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w== @@ -2161,7 +2197,7 @@ process@^0.11.10: resolved "https://registry.npmjs.org/process/-/process-0.11.10.tgz" integrity sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A== -progress@~2.0: +progress@^2.0.0, progress@~2.0: version "2.0.3" resolved "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz" integrity sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA== @@ -2271,16 +2307,59 @@ read-pkg@^5.2.0: parse-json "^5.0.0" type-fest "^0.6.0" -readable-stream@3, readable-stream@^3.0.0, readable-stream@^3.0.2, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.6.0: - version "3.6.0" - resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" - integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== +readable-stream@^2.0.0, readable-stream@^2.1.5, readable-stream@^2.3.3: + version "2.3.7" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== dependencies: - inherits "^2.0.3" - string_decoder "^1.1.1" - util-deprecate "^1.0.1" + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^2.0.1: + version "2.3.7" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^2.0.5: + version "2.3.7" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + +readable-stream@^2.3.5: + version "2.3.7" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" -readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.5, readable-stream@^2.1.5, readable-stream@^2.3.3, readable-stream@^2.3.5, readable-stream@^2.3.6, readable-stream@~2.3.6: +readable-stream@^2.3.6: version "2.3.7" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== @@ -2293,6 +2372,51 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.5, readable string_decoder "~1.1.1" util-deprecate "~1.0.1" +readable-stream@^3.0.0, readable-stream@3: + version "3.6.0" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-stream@^3.0.2: + version "3.6.0" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-stream@^3.1.1: + version "3.6.0" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-stream@^3.4.0: + version "3.6.0" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + +readable-stream@^3.6.0: + version "3.6.0" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz" + integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== + dependencies: + inherits "^2.0.3" + string_decoder "^1.1.1" + util-deprecate "^1.0.1" + readable-stream@^4.0.0: version "4.2.0" resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-4.2.0.tgz" @@ -2303,6 +2427,19 @@ readable-stream@^4.0.0: events "^3.3.0" process "^0.11.10" +readable-stream@~2.3.6: + version "2.3.7" + resolved "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz" + integrity sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw== + dependencies: + core-util-is "~1.0.0" + inherits "~2.0.3" + isarray "~1.0.0" + process-nextick-args "~2.0.0" + safe-buffer "~5.1.1" + string_decoder "~1.1.1" + util-deprecate "~1.0.1" + real-require@^0.2.0: version "0.2.0" resolved "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz" @@ -2401,11 +2538,6 @@ selderee@^0.6.0: dependencies: parseley "^0.7.0" -"semver@2 || 3 || 4 || 5": - version "5.7.1" - resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" - integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== - semver@^6.0.0: version "6.3.0" resolved "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz" @@ -2418,6 +2550,11 @@ semver@^7.1.1, semver@^7.3.4: dependencies: lru-cache "^6.0.0" +"semver@2 || 3 || 4 || 5": + version "5.7.1" + resolved "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz" + integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== + sha.js@^2.4.9: version "2.4.11" resolved "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz" @@ -2492,6 +2629,13 @@ spdx-license-ids@^3.0.0: resolved "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.12.tgz" integrity sha512-rr+VVSXtRhO4OHbXUiAF7xW3Bo9DuuF6C5jH+q/x15j2jniycgKbxU09Hr0WqlSLUs4i4ltHGXqTe7VHclYWyA== +split@^1.0.0: + version "1.0.1" + resolved "https://registry.npmjs.org/split/-/split-1.0.1.tgz" + integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== + dependencies: + through "2" + split2@^3.0.0: version "3.2.2" resolved "https://registry.npmjs.org/split2/-/split2-3.2.2.tgz" @@ -2504,13 +2648,6 @@ split2@^4.0.0: resolved "https://registry.npmjs.org/split2/-/split2-4.1.0.tgz" integrity sha512-VBiJxFkxiXRlUIeyMQi8s4hgvKCSjtknJv/LVYbrgALPwf5zSKmEwV9Lst25AkvMDnvxODugjdl6KZgwKM1WYQ== -split@^1.0.0: - version "1.0.1" - resolved "https://registry.npmjs.org/split/-/split-1.0.1.tgz" - integrity sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg== - dependencies: - through "2" - standard-version@^9.3.2: version "9.5.0" resolved "https://registry.npmjs.org/standard-version/-/standard-version-9.5.0.tgz" @@ -2536,15 +2673,6 @@ stream-shift@^1.0.0: resolved "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.1.tgz" integrity sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ== -string-width@^4.1.0, string-width@^4.2.0: - version "4.2.3" - resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" - integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== - dependencies: - emoji-regex "^8.0.0" - is-fullwidth-code-point "^3.0.0" - strip-ansi "^6.0.1" - string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz" @@ -2559,6 +2687,15 @@ string_decoder@~1.1.1: dependencies: safe-buffer "~5.1.0" +string-width@^4.1.0, string-width@^4.2.0: + version "4.2.3" + resolved "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz" + integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== + dependencies: + emoji-regex "^8.0.0" + is-fullwidth-code-point "^3.0.0" + strip-ansi "^6.0.1" + stringify-package@^1.0.1: version "1.0.1" resolved "https://registry.npmjs.org/stringify-package/-/stringify-package-1.0.1.tgz" @@ -2612,6 +2749,11 @@ thread-stream@^2.0.0: dependencies: real-require "^0.2.0" +through@^2.3.8, "through@>=2.2.7 <3", through@2: + version "2.3.8" + resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz" + integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== + through2-filter@^3.0.0: version "3.0.0" resolved "https://registry.npmjs.org/through2-filter/-/through2-filter-3.0.0.tgz" @@ -2635,11 +2777,6 @@ through2@^4.0.0: dependencies: readable-stream "3" -through@2, "through@>=2.2.7 <3", through@^2.3.8: - version "2.3.8" - resolved "https://registry.npmjs.org/through/-/through-2.3.8.tgz" - integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== - to-absolute-glob@^2.0.0, to-absolute-glob@^2.0.2: version "2.0.2" resolved "https://registry.npmjs.org/to-absolute-glob/-/to-absolute-glob-2.0.2.tgz" @@ -2825,7 +2962,7 @@ yargs-parser@^20.2.2, yargs-parser@^20.2.3, yargs-parser@^20.2.7: resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz" integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== -yargs@16.2.0, yargs@^16.0.0, yargs@^16.2.0: +yargs@^16.0.0, yargs@^16.2.0, yargs@16.2.0: version "16.2.0" resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz" integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==