Skip to content

Commit e2b8322

Browse files
committed
chore: update readonly
1 parent ee33156 commit e2b8322

5 files changed

Lines changed: 14 additions & 22 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ full compressed account lifecycle (create, increment, decrement, reset, close):
2828

2929
- **[account-comparison](./account-comparison/)** - Compare compressed vs regular Solana accounts.
3030

31-
31+
3232
## Light Protocol dependencies
3333

3434
### Rust Crates
@@ -49,7 +49,7 @@ full compressed account lifecycle (create, increment, decrement, reset, close):
4949
Required versions:
5050

5151
- **Rust**: 1.86.0 or later
52-
- **Solana CLI**: 2.2.15
52+
- **Solana CLI**: 2.3.10
5353
- **Anchor CLI**: 0.31.1
5454
- **Zk compression CLI**: 0.27.0 or later
5555
- **Node.js**: 23.5.0 or later

read-only/Cargo.lock

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

read-only/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ test-sbf = []
1515
anchor-lang = "0.31.1"
1616
borsh = "0.10.4"
1717
light-sdk = { path = "/Users/ananas/dev/light-protocol2/sdk-libs/sdk", features = ["anchor", "v2"] }
18-
light-hasher = { path = "/Users/ananas/dev/light-protocol2/program-libs/hasher", features = ["solana"] }
1918
light-sdk-types = { path = "/Users/ananas/dev/light-protocol2/sdk-libs/sdk-types" }
2019
light-compressed-account = { path = "/Users/ananas/dev/light-protocol2/program-libs/compressed-account" }
2120

read-only/src/lib.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,14 @@
44

55
use anchor_lang::{prelude::*, AnchorDeserialize, AnchorSerialize};
66
use borsh::{BorshDeserialize, BorshSerialize};
7-
use light_sdk::cpi::{
8-
v1, v2::LightSystemProgramCpi, InvokeLightSystemProgram, LightCpiInstruction,
9-
};
7+
use light_sdk::cpi::{v2::LightSystemProgramCpi, InvokeLightSystemProgram, LightCpiInstruction};
108
use light_sdk::{
119
account::LightAccount,
12-
address::v1::derive_address,
13-
cpi::{v1::CpiAccounts, CpiSigner},
10+
address::v2::derive_address,
11+
cpi::{v2::CpiAccounts, CpiSigner},
1412
derive_light_cpi_signer,
1513
instruction::{account_meta::CompressedAccountMetaBurn, PackedAddressTreeInfo, ValidityProof},
16-
LightDiscriminator, LightHasher,
14+
LightDiscriminator,
1715
};
1816

1917
declare_id!("HNqStLMpNuNJqhBF1FbGTKHEFbBLJmq8RdJJmZKWz6jH");
@@ -63,9 +61,10 @@ pub mod read_only {
6361
data_account.message
6462
);
6563

66-
let new_address_params = address_tree_info.into_new_address_params_packed(address_seed);
64+
let new_address_params =
65+
address_tree_info.into_new_address_params_assigned_packed(address_seed, Some(0));
6766

68-
v1::LightSystemProgramCpi::new_cpi(crate::LIGHT_CPI_SIGNER, proof)
67+
LightSystemProgramCpi::new_cpi(crate::LIGHT_CPI_SIGNER, proof)
6968
.with_light_account(data_account)?
7069
.with_new_addresses(&[new_address_params])
7170
.invoke(light_cpi_accounts)?;
@@ -97,7 +96,6 @@ pub mod read_only {
9796
)?;
9897

9998
LightSystemProgramCpi::new_cpi(crate::LIGHT_CPI_SIGNER, proof)
100-
.mode_v1()
10199
.with_light_account(read_only_account)?
102100
.invoke(light_cpi_accounts)?;
103101

@@ -111,13 +109,9 @@ pub struct GenericAnchorAccounts<'info> {
111109
pub signer: Signer<'info>,
112110
}
113111

114-
#[derive(
115-
Clone, Debug, Default, BorshSerialize, BorshDeserialize, LightDiscriminator, LightHasher,
116-
)]
112+
#[derive(Clone, Debug, Default, BorshSerialize, BorshDeserialize, LightDiscriminator)]
117113
pub struct DataAccount {
118-
#[hash]
119114
pub owner: Pubkey,
120-
#[hash]
121115
pub message: String,
122116
}
123117

read-only/tests/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use light_program_test::{
66
program_test::LightProgramTest, AddressWithTree, Indexer, ProgramTestConfig, Rpc, RpcError,
77
};
88
use light_sdk::{
9-
address::v1::derive_address,
9+
address::v2::derive_address,
1010
instruction::{
1111
account_meta::CompressedAccountMetaBurn, PackedAccounts, SystemAccountMetaConfig,
1212
},
@@ -25,7 +25,7 @@ async fn test_read_compressed_account() {
2525
let mut rpc = LightProgramTest::new(config).await.unwrap();
2626
let payer = rpc.get_payer().insecure_clone();
2727

28-
let address_tree_info = rpc.get_address_tree_v1();
28+
let address_tree_info = rpc.get_address_tree_v2();
2929

3030
let (address, _) = derive_address(
3131
&[FIRST_SEED, payer.pubkey().as_ref()],
@@ -81,7 +81,7 @@ where
8181
{
8282
let mut remaining_accounts = PackedAccounts::default();
8383
let config = SystemAccountMetaConfig::new(read_only::ID);
84-
remaining_accounts.add_system_accounts(config)?;
84+
remaining_accounts.add_system_accounts_v2(config)?;
8585

8686
let rpc_result = rpc
8787
.get_validity_proof(
@@ -134,7 +134,7 @@ where
134134
{
135135
let mut remaining_accounts = PackedAccounts::default();
136136
let config = SystemAccountMetaConfig::new(read_only::ID);
137-
remaining_accounts.add_system_accounts(config)?;
137+
remaining_accounts.add_system_accounts_v2(config)?;
138138

139139
let hash = compressed_account.hash;
140140
println!("hash {:?}", hash);

0 commit comments

Comments
 (0)