From 90821913c1c1f2e3903868b634bdee065157bbab Mon Sep 17 00:00:00 2001 From: Iaroslav Mazur Date: Thu, 12 Sep 2024 18:13:56 +0300 Subject: [PATCH 1/5] docs: programs.md Enhance the documentation of the Native Programs Problem Poor documentation and wrong grammar (sometimes) --- docs/src/runtime/programs.md | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/src/runtime/programs.md b/docs/src/runtime/programs.md index 018169ee1c68f9..90ac9cdea4b213 100644 --- a/docs/src/runtime/programs.md +++ b/docs/src/runtime/programs.md @@ -5,7 +5,7 @@ sidebar_label: Native Programs --- Solana contains a small handful of native programs, which are required to run -validator nodes. Unlike third-party programs, the native programs are part of +validator nodes. Unlike the third-party programs, the native programs are part of the validator implementation and can be upgraded as part of cluster upgrades. Upgrades may occur to add features, fix bugs, or improve performance. Interface changes to individual instructions should rarely, if ever, occur. Instead, when @@ -13,9 +13,9 @@ change is needed, new instructions are added and previous ones are marked deprecated. Apps can upgrade on their own timeline without concern of breakages across upgrades. -For each native program the program id and description each supported -instruction is provided. A transaction can mix and match instructions from different -programs, as well include instructions from on-chain programs. +For each native program, the program id and the description of each supported +instruction are provided. A transaction can mix and match instructions from different +programs, as well as include instructions from on-chain programs. ## System Program @@ -27,15 +27,15 @@ transfer lamports from System Program owned accounts and pay transaction fees. ## Config Program -Add configuration data to the chain and the list of public keys that are permitted to modify it +Add configuration data to the chain, alongside the list of public keys that are allowed to modify it - Program id: `Config1111111111111111111111111111111111111` - Instructions: [config_instruction](https://docs.rs/solana-config-program/VERSION_FOR_DOCS_RS/solana_config_program/config_instruction/index.html) Unlike the other programs, the Config program does not define any individual -instructions. It has just one implicit instruction, a "store" instruction. Its -instruction data is a set of keys that gate access to the account, and the -data to store in it. +instructions. It has just one implicit instruction: "store". Its +instruction data is a set of keys that gate access to the account and the +data stored inside it. ## Stake Program @@ -64,21 +64,21 @@ Deploys, upgrades, and executes programs on the chain. - Program id: `BPFLoaderUpgradeab1e11111111111111111111111` - Instructions: [LoaderInstruction](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/loader_upgradeable_instruction/enum.UpgradeableLoaderInstruction.html) -The BPF Upgradeable Loader marks itself as "owner" of the executable and +The BPF Upgradeable Loader marks itself as the "owner" of the executable and program-data accounts it creates to store your program. When a user invokes an -instruction via a program id, the Solana runtime will load both your the program +instruction via a program id, the Solana runtime loads both your program and its owner, the BPF Upgradeable Loader. The runtime then passes your program -to the BPF Upgradeable Loader to process the instruction. +to the BPF Upgradeable Loader for it to process the instruction. [More information about deployment](../cli/examples/deploy-a-program.md) ## Ed25519 Program -Verify ed25519 signature program. This program takes an ed25519 signature, public key, and message. +The program for verifying ed25519 signatures. It takes an ed25519 signature, a public key, and a message. Multiple signatures can be verified. If any of the signatures fail to verify, an error is returned. - Program id: `Ed25519SigVerify111111111111111111111111111` -- Instructions: [new_ed25519_instruction](https://github.com/solana-labs/solana/blob/master/sdk/src/ed25519_instruction.rs#L45) +- Instructions: [ed25519_instruction](https://docs.rs/solana-sdk/1.18.18/solana_sdk/ed25519_instruction/index.html) The ed25519 program processes an instruction. The first `u8` is a count of the number of signatures to check, which is followed by a single byte padding. After that, the @@ -96,7 +96,7 @@ struct Ed25519SignatureOffsets { } ``` -Pseudo code of the operation: +The pseudo code of the signature verification: ``` process_instruction() { @@ -139,7 +139,7 @@ struct Secp256k1SignatureOffsets { } ``` -Pseudo code of the operation: +The pseudo code of the verification: ``` process_instruction() { @@ -169,7 +169,7 @@ by the signature cost verify multiplier. ### Optimization notes -The operation will have to take place after (at least partial) deserialization, -but all inputs come from the transaction data itself, this allows it to be -relatively easy to execute in parallel to transaction processing and PoH +The operation will have to take place after (at least, partial) deserialization, +but all inputs come from the transaction data itself, which allows it to be +relatively easy to execute in parallel to the transaction processing and the PoH verification. From 23f11e3d31bc71588d031669f23888fe12e6095e Mon Sep 17 00:00:00 2001 From: Iaroslav Mazur Date: Fri, 13 Sep 2024 15:52:29 +0300 Subject: [PATCH 2/5] chore: pr review --- docs/src/runtime/programs.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/src/runtime/programs.md b/docs/src/runtime/programs.md index 90ac9cdea4b213..ddb9ecf167b1ee 100644 --- a/docs/src/runtime/programs.md +++ b/docs/src/runtime/programs.md @@ -5,7 +5,7 @@ sidebar_label: Native Programs --- Solana contains a small handful of native programs, which are required to run -validator nodes. Unlike the third-party programs, the native programs are part of +validator nodes. Unlike third-party programs, the native programs are part of the validator implementation and can be upgraded as part of cluster upgrades. Upgrades may occur to add features, fix bugs, or improve performance. Interface changes to individual instructions should rarely, if ever, occur. Instead, when @@ -27,7 +27,8 @@ transfer lamports from System Program owned accounts and pay transaction fees. ## Config Program -Add configuration data to the chain, alongside the list of public keys that are allowed to modify it +Add configuration data to the chain, followed by the list of public keys that +are allowed to modify it - Program id: `Config1111111111111111111111111111111111111` - Instructions: [config_instruction](https://docs.rs/solana-config-program/VERSION_FOR_DOCS_RS/solana_config_program/config_instruction/index.html) @@ -35,7 +36,7 @@ Add configuration data to the chain, alongside the list of public keys that are Unlike the other programs, the Config program does not define any individual instructions. It has just one implicit instruction: "store". Its instruction data is a set of keys that gate access to the account and the -data stored inside it. +data to stored inside of it. ## Stake Program @@ -78,7 +79,7 @@ The program for verifying ed25519 signatures. It takes an ed25519 signature, a p Multiple signatures can be verified. If any of the signatures fail to verify, an error is returned. - Program id: `Ed25519SigVerify111111111111111111111111111` -- Instructions: [ed25519_instruction](https://docs.rs/solana-sdk/1.18.18/solana_sdk/ed25519_instruction/index.html) +- Instructions: [ed25519_instruction](https://docs.rs/solana-sdk/VERSION_FOR_DOCS_RS/solana_sdk/ed25519_instruction/index.html) The ed25519 program processes an instruction. The first `u8` is a count of the number of signatures to check, which is followed by a single byte padding. After that, the @@ -139,7 +140,7 @@ struct Secp256k1SignatureOffsets { } ``` -The pseudo code of the verification: +The pseudo code of the recovery verification: ``` process_instruction() { @@ -169,7 +170,7 @@ by the signature cost verify multiplier. ### Optimization notes -The operation will have to take place after (at least, partial) deserialization, +The operation will have to take place after (at least partial) deserialization, but all inputs come from the transaction data itself, which allows it to be relatively easy to execute in parallel to the transaction processing and the PoH verification. From 8dd8bb210c7904a8f8739db38cb7885c2c568bd1 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 13 Sep 2024 18:34:50 +0200 Subject: [PATCH 3/5] Update docs/src/runtime/programs.md --- docs/src/runtime/programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/runtime/programs.md b/docs/src/runtime/programs.md index ddb9ecf167b1ee..bcc9078d8f1b13 100644 --- a/docs/src/runtime/programs.md +++ b/docs/src/runtime/programs.md @@ -36,7 +36,7 @@ are allowed to modify it Unlike the other programs, the Config program does not define any individual instructions. It has just one implicit instruction: "store". Its instruction data is a set of keys that gate access to the account and the -data to stored inside of it. +data to store inside of it. ## Stake Program From d7f7c79244d2909fef5f93ff6ebe3d2ef9080adc Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 13 Sep 2024 18:34:55 +0200 Subject: [PATCH 4/5] Update docs/src/runtime/programs.md --- docs/src/runtime/programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/runtime/programs.md b/docs/src/runtime/programs.md index bcc9078d8f1b13..d49b942291b042 100644 --- a/docs/src/runtime/programs.md +++ b/docs/src/runtime/programs.md @@ -172,5 +172,5 @@ by the signature cost verify multiplier. The operation will have to take place after (at least partial) deserialization, but all inputs come from the transaction data itself, which allows it to be -relatively easy to execute in parallel to the transaction processing and the PoH +relatively easy to execute in parallel to transaction processing and PoH verification. From 09bea8f9dc145ab6726a15d0231df14efc36a799 Mon Sep 17 00:00:00 2001 From: Jon C Date: Fri, 13 Sep 2024 18:36:37 +0200 Subject: [PATCH 5/5] Update docs/src/runtime/programs.md --- docs/src/runtime/programs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/runtime/programs.md b/docs/src/runtime/programs.md index d49b942291b042..bcb43b1ad51070 100644 --- a/docs/src/runtime/programs.md +++ b/docs/src/runtime/programs.md @@ -27,7 +27,7 @@ transfer lamports from System Program owned accounts and pay transaction fees. ## Config Program -Add configuration data to the chain, followed by the list of public keys that +Add configuration data to the chain, followed by the list of public keys that are allowed to modify it - Program id: `Config1111111111111111111111111111111111111`