Skip to content

Commit

Permalink
add shared-memory program (solana-labs#611)
Browse files Browse the repository at this point in the history
* add shared-memory program

* add offset and reduce shared object size
  • Loading branch information
jackcmay committed Oct 14, 2020
1 parent a3f4071 commit 08d9999
Show file tree
Hide file tree
Showing 16 changed files with 8,846 additions and 28 deletions.
60 changes: 34 additions & 26 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ members = [
"utils/cgen",
"utils/test-client",
"memo/program",
"shared-memory/program",
"themis/program_bn",
"themis/program_ristretto",
"token-lending/program",
Expand All @@ -12,6 +13,7 @@ members = [
"token/program-v3",
]
exclude = [
"shared-memory/client",
"themis/client_bn",
"themis/client_ristretto",
"token/perf-monitor",
Expand Down
3 changes: 2 additions & 1 deletion ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ for Xargo_toml in $(git ls-files -- '*/Xargo.toml'); do
_ ./do.sh dump "$program_dir"
done

# Run SPL Token's performance monitor
# Run client tests
_ cargo test --manifest-path=shared-memory/client/Cargo.toml -- --nocapture
_ cargo test --manifest-path=token/perf-monitor/Cargo.toml -- --nocapture
_ cargo test --manifest-path=themis/client_bn/Cargo.toml -- --nocapture
_ cargo test --manifest-path=themis/client_ristretto/Cargo.toml -- --nocapture
Expand Down
1 change: 1 addition & 0 deletions docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module.exports = {
"token",
"token-swap",
"memo",
"shared-memory",
],
},
};
32 changes: 32 additions & 0 deletions docs/src/shared-memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: Shared memory Program
---

A simple program and highly optimized program that writes instruction data into
the provided account's data

## Background

Solana's programming model and the definitions of the Solana terms used in this
document are available at:

- https://docs.solana.com/apps
- https://docs.solana.com/terminology

## Source

The Shared memory Program's source is available on
[github](https://github.com/solana-labs/solana-program-library)

## Interface

The Shared memory program expects one account and writes instruction data into
the account's data. The first 8 bytes of the instruction data contain the
little-endian offset into the account data. The rest of the instruction data is
written into the account data starting at that offset.

## Operational overview

This program is useful for returning data from cross-program invoked programs to
the invoker. Because the account does not need to be signed it is not reliable
to use this program to pass data between programs from different transactions.
6 changes: 6 additions & 0 deletions shared-memory/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Shared memory program

A shared-memory program on the Solana blockchain, usable for for sharing data
between programs or within cross-program invocations.

Full documentation is available at https://spl.solana.com
Loading

0 comments on commit 08d9999

Please sign in to comment.