Update 'Developing with Rust' GitHub links (#20860)
* Update old GitHub links in 'Developing with Rust' docs * exclude_entrypoint -> no-entrypoint in 'Developing with Rust'
This commit is contained in:
		| @@ -33,19 +33,19 @@ Solana Rust programs may depend directly on each other in order to gain access | |||||||
| to instruction helpers when making [cross-program invocations](developing/programming-model/calling-between-programs.md#cross-program-invocations). | to instruction helpers when making [cross-program invocations](developing/programming-model/calling-between-programs.md#cross-program-invocations). | ||||||
| When doing so it's important to not pull in the dependent program's entrypoint | When doing so it's important to not pull in the dependent program's entrypoint | ||||||
| symbols because they may conflict with the program's own. To avoid this, | symbols because they may conflict with the program's own. To avoid this, | ||||||
| programs should define an `exclude_entrypoint` feature in `Cargo.toml` and use | programs should define an `no-entrypoint` feature in `Cargo.toml` and use | ||||||
| to exclude the entrypoint. | to exclude the entrypoint. | ||||||
|  |  | ||||||
| - [Define the | - [Define the | ||||||
|   feature](https://github.com/solana-labs/solana-program-library/blob/a5babd6cbea0d3f29d8c57d2ecbbd2a2bd59c8a9/token/program/Cargo.toml#L12) |   feature](https://github.com/solana-labs/solana-program-library/blob/fca9836a2c8e18fc7e3595287484e9acd60a8f64/token/program/Cargo.toml#L12) | ||||||
| - [Exclude the | - [Exclude the | ||||||
|   entrypoint](https://github.com/solana-labs/solana-program-library/blob/a5babd6cbea0d3f29d8c57d2ecbbd2a2bd59c8a9/token/program/src/lib.rs#L12) |   entrypoint](https://github.com/solana-labs/solana-program-library/blob/fca9836a2c8e18fc7e3595287484e9acd60a8f64/token/program/src/lib.rs#L12) | ||||||
|  |  | ||||||
| Then when other programs include this program as a dependency, they should do so | Then when other programs include this program as a dependency, they should do so | ||||||
| using the `exclude_entrypoint` feature. | using the `no-entrypoint` feature. | ||||||
|  |  | ||||||
| - [Include without | - [Include without | ||||||
|   entrypoint](https://github.com/solana-labs/solana-program-library/blob/a5babd6cbea0d3f29d8c57d2ecbbd2a2bd59c8a9/token-swap/program/Cargo.toml#L19) |   entrypoint](https://github.com/solana-labs/solana-program-library/blob/fca9836a2c8e18fc7e3595287484e9acd60a8f64/token-swap/program/Cargo.toml#L22) | ||||||
|  |  | ||||||
| ## Project Dependencies | ## Project Dependencies | ||||||
|  |  | ||||||
| @@ -115,9 +115,9 @@ Programs must be written for and deployed to the same loader. For more details | |||||||
| see the [overview](overview#loaders). | see the [overview](overview#loaders). | ||||||
|  |  | ||||||
| Currently there are two supported loaders [BPF | Currently there are two supported loaders [BPF | ||||||
| Loader](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/bpf_loader.rs#L17) | Loader](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/bpf_loader.rs#L17) | ||||||
| and [BPF loader | and [BPF loader | ||||||
| deprecated](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/bpf_loader_deprecated.rs#L14) | deprecated](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/bpf_loader_deprecated.rs#L14) | ||||||
|  |  | ||||||
| They both have the same raw entrypoint definition, the following is the raw | They both have the same raw entrypoint definition, the following is the raw | ||||||
| symbol that the runtime looks up and calls: | symbol that the runtime looks up and calls: | ||||||
| @@ -136,9 +136,9 @@ processing function, and returns the results. | |||||||
| You can find the entrypoint macros here: | You can find the entrypoint macros here: | ||||||
|  |  | ||||||
| - [BPF Loader's entrypoint | - [BPF Loader's entrypoint | ||||||
|   macro](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/entrypoint.rs#L46) |   macro](https://github.com/solana-labs/solana/blob/9b1199cdb1b391b00d510ed7fc4866bdf6ee4eb3/sdk/program/src/entrypoint.rs#L42) | ||||||
| - [BPF Loader deprecated's entrypoint | - [BPF Loader deprecated's entrypoint | ||||||
|   macro](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/entrypoint_deprecated.rs#L37) |   macro](https://github.com/solana-labs/solana/blob/9b1199cdb1b391b00d510ed7fc4866bdf6ee4eb3/sdk/program/src/entrypoint_deprecated.rs#L38) | ||||||
|  |  | ||||||
| The program defined instruction processing function that the entrypoint macros | The program defined instruction processing function that the entrypoint macros | ||||||
| call must be of this form: | call must be of this form: | ||||||
| @@ -149,7 +149,7 @@ pub type ProcessInstruction = | |||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Refer to [helloworld's use of the | Refer to [helloworld's use of the | ||||||
| entrypoint](https://github.com/solana-labs/example-helloworld/blob/c1a7247d87cd045f574ed49aec5d160aefc45cf2/src/program-rust/src/lib.rs#L15) | entrypoint](https://github.com/solana-labs/example-helloworld/blob/1e049076e10be8712b1a725d2d886ce0cd036b2e/src/program-rust/src/lib.rs#L19) | ||||||
| as an example of how things fit together. | as an example of how things fit together. | ||||||
|  |  | ||||||
| ### Parameter Deserialization | ### Parameter Deserialization | ||||||
| @@ -159,9 +159,9 @@ parameters into Rust types. The entrypoint macros automatically calls the | |||||||
| deserialization helper: | deserialization helper: | ||||||
|  |  | ||||||
| - [BPF Loader | - [BPF Loader | ||||||
|   deserialization](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/entrypoint.rs#L104) |   deserialization](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/entrypoint.rs#L146) | ||||||
| - [BPF Loader deprecated | - [BPF Loader deprecated | ||||||
|   deserialization](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/entrypoint_deprecated.rs#L56) |   deserialization](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/entrypoint_deprecated.rs#L57) | ||||||
|  |  | ||||||
| Some programs may want to perform deserialization themselves and they can by | Some programs may want to perform deserialization themselves and they can by | ||||||
| providing their own implementation of the [raw entrypoint](#program-entrypoint). | providing their own implementation of the [raw entrypoint](#program-entrypoint). | ||||||
| @@ -190,7 +190,7 @@ The program id is the public key of the currently executing program. | |||||||
|  |  | ||||||
| The accounts is an ordered slice of the accounts referenced by the instruction | The accounts is an ordered slice of the accounts referenced by the instruction | ||||||
| and represented as an | and represented as an | ||||||
| [AccountInfo](https://github.com/solana-labs/solana/blob/7ddf10e602d2ed87a9e3737aa8c32f1db9f909d8/sdk/program/src/account_info.rs#L10) | [AccountInfo](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/account_info.rs#L12) | ||||||
| structures. An account's place in the array signifies its meaning, for example, | structures. An account's place in the array signifies its meaning, for example, | ||||||
| when transferring lamports an instruction may define the first account as the | when transferring lamports an instruction may define the first account as the | ||||||
| source and the second as the destination. | source and the second as the destination. | ||||||
| @@ -214,7 +214,7 @@ being processed. | |||||||
| ## Heap | ## Heap | ||||||
|  |  | ||||||
| Rust programs implement the heap directly by defining a custom | Rust programs implement the heap directly by defining a custom | ||||||
| [`global_allocator`](https://github.com/solana-labs/solana/blob/8330123861a719cd7a79af0544617896e7f00ce3/sdk/program/src/entrypoint.rs#L50) | [`global_allocator`](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/entrypoint.rs#L72) | ||||||
|  |  | ||||||
| Programs may implement their own `global_allocator` based on its specific needs. | Programs may implement their own `global_allocator` based on its specific needs. | ||||||
| Refer to the [custom heap example](#examples) for more information. | Refer to the [custom heap example](#examples) for more information. | ||||||
| @@ -288,7 +288,7 @@ getrandom = { version = "0.2.2", features = ["custom"] } | |||||||
|  |  | ||||||
| Rust's `println!` macro is computationally expensive and not supported. Instead | Rust's `println!` macro is computationally expensive and not supported. Instead | ||||||
| the helper macro | the helper macro | ||||||
| [`msg!`](https://github.com/solana-labs/solana/blob/6705b5a98c076ac08f3991bb8a6f9fcb280bf51e/sdk/program/src/log.rs#L33) | [`msg!`](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/log.rs#L33) | ||||||
| is provided. | is provided. | ||||||
|  |  | ||||||
| `msg!` has two forms: | `msg!` has two forms: | ||||||
| @@ -375,7 +375,7 @@ fn custom_panic(info: &core::panic::PanicInfo<'_>) { | |||||||
| ## Compute Budget | ## Compute Budget | ||||||
|  |  | ||||||
| Use the system call | Use the system call | ||||||
| [`sol_log_compute_units()`](https://github.com/solana-labs/solana/blob/d3a3a7548c857f26ec2cb10e270da72d373020ec/sdk/program/src/log.rs#L102) | [`sol_log_compute_units()`](https://github.com/solana-labs/solana/blob/d9b0fc0e3eec67dfe4a97d9298b15969b2804fab/sdk/program/src/log.rs#L141) | ||||||
| to log a message containing the remaining number of compute units the program | to log a message containing the remaining number of compute units the program | ||||||
| may consume before execution is halted | may consume before execution is halted | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user