From aad88f060c18ff8607732ef3c43badbea964901b Mon Sep 17 00:00:00 2001 From: Ahmad Abbasi Date: Fri, 14 Mar 2025 07:18:01 -0500 Subject: [PATCH 1/4] initial proposal doc --- ...58-transaction-signatures-introspection.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 proposals/0258-transaction-signatures-introspection.md diff --git a/proposals/0258-transaction-signatures-introspection.md b/proposals/0258-transaction-signatures-introspection.md new file mode 100644 index 000000000..6040c9f51 --- /dev/null +++ b/proposals/0258-transaction-signatures-introspection.md @@ -0,0 +1,45 @@ +--- +simd: '0258' +title: Signatures sysvar for signatures introspection +authors: + - Ahmad Abbasi (Syndica) +category: Standard +type: Core +status: Review +created: 2025-03-14 + +--- + +## Summary + +Allow the ability to introspect a transaction's signatures within an instruction via a Signatures sysvar. + +## Motivation + +As we develop the [Sig validator](https://github.com/Syndica/sig), we've experimented with novel ways an on-chain protocol can be designed. Many of those designs require some source of sequencing. Along with the need for a sequencing mechanism, the ability to query previous sequence "entries" is also important. Today, the only viable way to accomplish retrieving previous sequence entries is to use `getSignaturesForAddress` RPC and then parse through transactions individually to find the ones which create the next/previous "entry." If you have access to a transaction's signature within an instruction, you're able to save that into an account which can be used down the line to retrieve past entries. + +## New Terminology + +- Signatures sysvar: A Solana runtime sysvar which provides the ability to read a transaction's signatures within an instruction. + +## Detailed Design + +In order to introspect transaction signatures within an instruction, a transaction MUST include the Signatures sysvar (`SysvarSignatures111111111111111111111111111`) in the accounts list. The runtime will recognize this special sysvar, pass the raw transaction signatures to the instruction so that the bpf program can extract them and use as needed. + +A helper function to extract the signatures can be used: + +```rust +fn load_signatures(signatures_sysvar_account_info: &AccountInfo) -> Result>; +``` + +## Alternatives Considered + +Currently, no alternative exists to introspect a transaction's signature from within an instruction. + +## Impact + +The impact pf this will allow for unique and bespoke protocols to emerge on Solana enabling a new subset of sequence-based and hybrid (on/off-chain) applications to exist. + +## Security Considerations + +Because Sysvar(s) are inherently read-only, no major security concerns would arise from this feature. We already allow instruction data introspection via `Sysvar1nstructions1111111111111111111111111` sysvar. From 0cd25c0581e8dc8ce405f6a28f1bcbe7143c785a Mon Sep 17 00:00:00 2001 From: Ahmad Abbasi Date: Fri, 14 Mar 2025 07:31:32 -0500 Subject: [PATCH 2/4] typo fix --- proposals/0258-transaction-signatures-introspection.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/0258-transaction-signatures-introspection.md b/proposals/0258-transaction-signatures-introspection.md index 6040c9f51..4f9d8e0da 100644 --- a/proposals/0258-transaction-signatures-introspection.md +++ b/proposals/0258-transaction-signatures-introspection.md @@ -38,7 +38,7 @@ Currently, no alternative exists to introspect a transaction's signature from wi ## Impact -The impact pf this will allow for unique and bespoke protocols to emerge on Solana enabling a new subset of sequence-based and hybrid (on/off-chain) applications to exist. +The impact of this will allow for unique and bespoke protocols to emerge on Solana enabling a new subset of sequence-based and hybrid (on/off-chain) applications to exist. ## Security Considerations From a495f78fd8882718578cd47ffed2745a2e2903fe Mon Sep 17 00:00:00 2001 From: Ahmad Abbasi Date: Fri, 14 Mar 2025 07:40:42 -0500 Subject: [PATCH 3/4] fix lint issues --- ...58-transaction-signatures-introspection.md | 40 ++++++++++++++----- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/proposals/0258-transaction-signatures-introspection.md b/proposals/0258-transaction-signatures-introspection.md index 4f9d8e0da..2fd578eb6 100644 --- a/proposals/0258-transaction-signatures-introspection.md +++ b/proposals/0258-transaction-signatures-introspection.md @@ -1,6 +1,6 @@ --- simd: '0258' -title: Signatures sysvar for signatures introspection +title: Signatures sysvar for signature introspection authors: - Ahmad Abbasi (Syndica) category: Standard @@ -12,34 +12,56 @@ created: 2025-03-14 ## Summary -Allow the ability to introspect a transaction's signatures within an instruction via a Signatures sysvar. +Allow the ability to introspect a transaction's signatures within an +instruction via a Signatures sysvar. ## Motivation -As we develop the [Sig validator](https://github.com/Syndica/sig), we've experimented with novel ways an on-chain protocol can be designed. Many of those designs require some source of sequencing. Along with the need for a sequencing mechanism, the ability to query previous sequence "entries" is also important. Today, the only viable way to accomplish retrieving previous sequence entries is to use `getSignaturesForAddress` RPC and then parse through transactions individually to find the ones which create the next/previous "entry." If you have access to a transaction's signature within an instruction, you're able to save that into an account which can be used down the line to retrieve past entries. +As we develop the [Sig validator](https://github.com/Syndica/sig), we've +experimented with novel ways an on-chain protocol can be designed. Many of +those designs require some source of sequencing. Along with the need for a +sequencing mechanism, the ability to query previous sequence "entries" is +also important. Today, the only viable way to accomplish retrieving previous +sequence entries is to use `getSignaturesForAddress` RPC and then parse through +transactions individually to find the ones which create the next/previous +"entry." If you have access to a transaction's signature within an +instruction, you're able to save that into an account which can be used down +the line to retrieve past entries. ## New Terminology -- Signatures sysvar: A Solana runtime sysvar which provides the ability to read a transaction's signatures within an instruction. +- Signatures sysvar: A Solana runtime sysvar which provides the ability to read +a transaction's signatures within an instruction. ## Detailed Design -In order to introspect transaction signatures within an instruction, a transaction MUST include the Signatures sysvar (`SysvarSignatures111111111111111111111111111`) in the accounts list. The runtime will recognize this special sysvar, pass the raw transaction signatures to the instruction so that the bpf program can extract them and use as needed. +In order to introspect transaction signatures within an instruction, a +transaction MUST include the Signatures sysvar +`SysvarSignatures111111111111111111111111111` in the accounts list. The runtime +will recognize this special sysvar, pass the raw transaction signatures to the +instruction so that the bpf program can extract them and use as needed. A helper function to extract the signatures can be used: ```rust -fn load_signatures(signatures_sysvar_account_info: &AccountInfo) -> Result>; +fn load_signatures( + signatures_sysvar_account_info: &AccountInfo + ) -> Result>; ``` ## Alternatives Considered -Currently, no alternative exists to introspect a transaction's signature from within an instruction. +Currently, no alternative exists to introspect a transaction's signature +from within an instruction. ## Impact -The impact of this will allow for unique and bespoke protocols to emerge on Solana enabling a new subset of sequence-based and hybrid (on/off-chain) applications to exist. +The impact of this will allow for unique and bespoke protocols to emerge on +Solana enabling a new subset of sequence-based and hybrid (on/off-chain) +applications to exist. ## Security Considerations -Because Sysvar(s) are inherently read-only, no major security concerns would arise from this feature. We already allow instruction data introspection via `Sysvar1nstructions1111111111111111111111111` sysvar. +Because Sysvar(s) are inherently read-only, no major security concerns would +arise from this feature. We already allow instruction data introspection via +`Sysvar1nstructions1111111111111111111111111` sysvar. From 19756d6200422d2b77048ffa9273aaa4a6a4e439 Mon Sep 17 00:00:00 2001 From: Ahmad Abbasi Date: Fri, 14 Mar 2025 07:58:02 -0500 Subject: [PATCH 4/4] return slice instead of vec --- proposals/0258-transaction-signatures-introspection.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proposals/0258-transaction-signatures-introspection.md b/proposals/0258-transaction-signatures-introspection.md index 2fd578eb6..9177b8e15 100644 --- a/proposals/0258-transaction-signatures-introspection.md +++ b/proposals/0258-transaction-signatures-introspection.md @@ -46,7 +46,7 @@ A helper function to extract the signatures can be used: ```rust fn load_signatures( signatures_sysvar_account_info: &AccountInfo - ) -> Result>; + ) -> Result<&[Signature]>; ``` ## Alternatives Considered