Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit b0d84fc

Browse files
authored
Account Compression: 0.1.2 release (#3672)
* ac: expose wrap_application_data_v1, hide wrap_event * ac: separate event deserialization methods, update IDL * ac: add test for deserializing application data event * ac: add crate READMEs, update top-level README * ac: bump version to 0.1.2
1 parent f61af23 commit b0d84fc

File tree

18 files changed

+270
-37
lines changed

18 files changed

+270
-37
lines changed

account-compression/Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

account-compression/README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,31 @@
1-
# Account Compression
1+
# Account Compression (Beta)
22

33
This on-chain program provides an interface for composing smart-contracts to create and use
44
SPL ConcurrentMerkleTrees. The primary application of using SPL ConcurrentMerkleTrees is
55
to make edits to off-chain data with on-chain verification.
66

7-
Using this program requires an indexer to parse transaction information and write relevant information to an off-chain database.
7+
This program is targeted towards supporting [Metaplex Compressed NFTs](https://github.com/metaplex-foundation/metaplex-program-library/tree/master/bubblegum) and may be subject to change.
88

9+
Note: Using this program requires an indexer to parse transaction information and write relevant information to an off-chain database.
910

10-
## SDK
11+
A _**rough draft**_ of the whitepaper for SPL ConcurrentMerkleTree's can be found [here](https://drive.google.com/file/d/1BOpa5OFmara50fTvL0VIVYjtg-qzHCVc/view).
1112

12-
The typescript SDK for this contract will be generated using Metaplex Foundation's [Solita](https://github.com/metaplex-foundation/solita/).
13+
## Rust Packages
1314

14-
## Testing
15+
* `spl-account-compression`: SDK for interacting with account compression program
16+
* `spl-noop`: SDK for interacting with no op program, primarily for circumventing log truncation
17+
* `spl-concurrent-merkle-tree`: SDK for creating SPL ConcurrentMerkleTrees
18+
19+
## Typescript SDK
20+
21+
`@solana/spl-account-compression` is generated using Metaplex Foundation's [Solita](https://github.com/metaplex-foundation/solita/).
22+
23+
## Testing and Development
1524

1625
Testing contracts locally requires the SDK to be built.
17-
See the SDK folder for instructions.
1826

1927
With a built local SDK, the test suite can be ran with:
2028

2129
1. `yarn link @solana/spl-account-compression`
2230
2. `yarn`
23-
3. `anchor test`
31+
3. `yarn test`

account-compression/programs/account-compression/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spl-account-compression"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "Solana Program Library Account Compression Program"
55
authors = ["Solana Maintainers <[email protected]>"]
66
repository = "https://github.com/solana-labs/solana-program-library"
@@ -21,7 +21,7 @@ default = []
2121
anchor-lang = "0.25.0"
2222
bytemuck = "1.8.0"
2323
spl-concurrent-merkle-tree = { version = "0.1.1", path="../../../libraries/concurrent-merkle-tree", features = [ "sol-log" ]}
24-
spl-noop = { version = "0.1.1", path="../noop", features = [ "no-entrypoint" ]}
24+
spl-noop = { version = "0.1.2", path="../noop", features = [ "no-entrypoint" ]}
2525

2626
[profile.release]
2727
overflow-checks = true
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<p align="center">
2+
<a href="https://solana.com">
3+
<img alt="Solana" src="https://i.imgur.com/IKyzQ6T.png" width="250" />
4+
</a>
5+
</p>
6+
7+
# SPL Account Compression Rust SDK (Beta)
8+
9+
More information about account compression can be found in [the solana-program-library repo](https://github.com/solana-labs/solana-program-library/tree/master/account-compression).
10+
11+
The [Solana Program Examples repo](https://github.com/solana-developers/program-examples) will eventually include examples of how to use this program.
12+
13+
`spl-account-compression` and this crate's implementation are targeted towards supporting [Metaplex Compressed NFTs](https://github.com/metaplex-foundation/metaplex-program-library/tree/master/bubblegum) and may be subject to change.

account-compression/programs/account-compression/src/data_wrapper/mod.rs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! vital to the functioning of compression. When compression logs are truncated, indexers can fallback to
88
//! deserializing the CPI instruction data.
99
10-
use crate::events::AccountCompressionEvent;
10+
use crate::events::{AccountCompressionEvent, ApplicationDataEvent, ApplicationDataEventV1};
1111
use anchor_lang::{prelude::*, solana_program::program::invoke};
1212

1313
#[derive(Clone)]
@@ -29,3 +29,17 @@ pub fn wrap_event<'info>(
2929
)?;
3030
Ok(())
3131
}
32+
33+
/// Wraps a custom event in the most recent version of application event data
34+
pub fn wrap_application_data_v1<'info>(
35+
custom_data: Vec<u8>,
36+
log_wrapper_program: &Program<'info, Wrapper>,
37+
) -> Result<()> {
38+
let versioned_data = ApplicationDataEventV1 {
39+
application_data: custom_data,
40+
};
41+
wrap_event(
42+
&AccountCompressionEvent::ApplicationData(ApplicationDataEvent::V1(versioned_data)),
43+
log_wrapper_program,
44+
)
45+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
use anchor_lang::prelude::*;
2+
3+
#[derive(AnchorDeserialize, AnchorSerialize)]
4+
#[repr(C)]
5+
pub enum ApplicationDataEvent {
6+
V1(ApplicationDataEventV1),
7+
}
8+
9+
#[derive(AnchorDeserialize, AnchorSerialize)]
10+
pub struct ApplicationDataEventV1 {
11+
pub application_data: Vec<u8>,
12+
}

account-compression/programs/account-compression/src/events/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@
33
44
use anchor_lang::prelude::*;
55

6+
mod application_data;
67
mod changelog_event;
78

9+
pub use application_data::{ApplicationDataEvent, ApplicationDataEventV1};
810
pub use changelog_event::ChangeLogEvent;
911

1012
#[derive(AnchorDeserialize, AnchorSerialize)]
1113
#[repr(C)]
1214
pub enum AccountCompressionEvent {
1315
ChangeLog(ChangeLogEvent),
16+
ApplicationData(ApplicationDataEvent),
1417
}

account-compression/programs/account-compression/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ use borsh::{BorshDeserialize, BorshSerialize};
3030
use std::mem::size_of;
3131

3232
pub mod canopy;
33-
pub mod data_wrapper;
33+
mod data_wrapper;
3434
pub mod error;
3535
pub mod events;
3636
pub mod state;
3737
pub mod zero_copy;
3838

39+
pub use crate::data_wrapper::{wrap_application_data_v1, Wrapper};
40+
3941
use crate::canopy::{fill_in_proof_from_canopy, update_canopy};
40-
use crate::data_wrapper::{wrap_event, Wrapper};
42+
use crate::data_wrapper::wrap_event;
4143
use crate::error::AccountCompressionError;
4244
use crate::events::{AccountCompressionEvent, ChangeLogEvent};
4345
use crate::state::{ConcurrentMerkleTreeHeader, CONCURRENT_MERKLE_TREE_HEADER_SIZE_V1};

account-compression/programs/noop/Cargo.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "spl-noop"
3-
version = "0.1.1"
3+
version = "0.1.2"
44
description = "Solana Program Library No-op Program"
55
authors = ["Solana Maintainers <[email protected]>"]
66
repository = "https://github.com/solana-labs/solana-program-library"
@@ -12,8 +12,6 @@ crate-type = ["cdylib", "lib"]
1212

1313
[features]
1414
no-entrypoint = []
15-
no-idl = []
16-
no-log-ix-name = []
1715
cpi = ["no-entrypoint"]
1816
default = []
1917

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<p align="center">
2+
<a href="https://solana.com">
3+
<img alt="Solana" src="https://i.imgur.com/IKyzQ6T.png" width="250" />
4+
</a>
5+
</p>
6+
7+
# SPL Noop Rust SDK
8+
9+
This is crate provides a wrapper for invoking `spl-noop`, which does nothing.
10+
It's primary use is circumventing log truncation when emitting application data by `invoke`-ing `spl-noop` with event data.
11+
12+
<p align="center">
13+
<a href="https://solana.com">
14+
<img alt="Solana" src="https://i.imgur.com/IKyzQ6T.png" width="250" />
15+
</a>
16+
</p>
17+
18+
# SPL Account Compression Rust SDK (Beta)
19+
20+
More information about account compression can be found in [the solana-program-library repo](https://github.com/solana-labs/solana-program-library/tree/master/account-compression).
21+
22+
The [Solana Program Examples repo](https://github.com/solana-developers/program-examples) will eventually include examples of how to use this program.
23+
24+
`spl-noop` and this crate's implementation are targeted towards supporting [account-compression](https://github.com/solana-labs/solana-program-library/tree/master/account-compression) and may be subject to change.

0 commit comments

Comments
 (0)