Skip to content

Commit 2ec293b

Browse files
chore: refactor & improvements (#17)
* chore: space * chore: add dry run * chore: refactor & improvements * fix: use workspace dependencies with version to allow publishing * doc: add release process info
1 parent d54aa11 commit 2ec293b

File tree

8 files changed

+46
-17
lines changed

8 files changed

+46
-17
lines changed

.github/workflows/publish-crates-and-sdk.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ jobs:
5656
run: |
5757
cargo build
5858
59+
- name: Set DRY_RUN based on trigger
60+
run: echo "DRY_RUN=true" >> $GITHUB_ENV
61+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/v')
62+
5963
- name: cargo publish
6064
working-directory: rust/
6165
run: |

RELEASE_PROCESS.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### Release Process
2+
3+
1. **Create a Release Branch**
4+
Create a new branch named `release/v*.*.*`.
5+
6+
2. **Update Version in `Cargo.toml`**
7+
Increment the version number in the `Cargo.toml` file according to the release type (major, minor, or patch).
8+
9+
3. **Align Versions**
10+
Run the `./scripts/version-align.sh` script. This will:
11+
- Update the version of all internal crates and npm packages.
12+
- Generate the updated crates.
13+
14+
4. **Continuous Integration (CI) Testing**
15+
- The CI pipeline will test the packages and crate deployment in a dry-run mode.
16+
- Ensure all tests pass successfully.
17+
18+
5. **Merge and Deploy**
19+
- Merge the release branch into `main` after verifying all tests pass.
20+
- Create a new Release on GitHub. This will trigger the actual deployment process for the crates and packages.
21+
22+
6. **Post-Deployment**
23+
Verify that the deployment is complete and the crates and packages are available as expected.

rust/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ readme = "../README.md"
2121
keywords = ["solana", "crypto", "delegation", "ephemeral-rollups", "magicblock"]
2222

2323
[workspace.dependencies]
24+
ephemeral-rollups-sdk = { path = "sdk", version = "0.2.0" }
2425
ephemeral-rollups-sdk-attribute-ephemeral = { path = "ephemeral", version = "=0.2.0" }
2526
ephemeral-rollups-sdk-attribute-delegate = { path = "delegate", version = "=0.2.0" }
2627
ephemeral-rollups-sdk-attribute-commit = { path = "commit-attribute", version = "=0.2.0" }

rust/commit-attribute/src/lib.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn commit(_attr: TokenStream, item: TokenStream) -> TokenStream {
3030
new_fields.push(
3131
Field::parse_named
3232
.parse2(quote! {
33-
pub magic_program: Program<'info, ::ephemeral_rollups_sdk_v2::anchor::MagicProgram>
33+
pub magic_program: Program<'info, ::ephemeral_rollups_sdk::anchor::MagicProgram>
3434
})
3535
.unwrap(),
3636
);
@@ -40,7 +40,7 @@ pub fn commit(_attr: TokenStream, item: TokenStream) -> TokenStream {
4040
new_fields.push(
4141
Field::parse_named
4242
.parse2(quote! {
43-
#[account(mut, address = ::ephemeral_rollups_sdk_v2::consts::MAGIC_CONTEXT_ID)]
43+
#[account(mut, address = ::ephemeral_rollups_sdk::consts::MAGIC_CONTEXT_ID)]
4444
/// CHECK:`
4545
pub magic_context: AccountInfo<'info>
4646
})
@@ -49,6 +49,7 @@ pub fn commit(_attr: TokenStream, item: TokenStream) -> TokenStream {
4949
}
5050

5151
quote! {
52+
use ::ephemeral_rollups_sdk::anchor::MagicProgram;
5253
#(#attrs)*
5354
pub struct #name<'info> {
5455
#new_fields

rust/delegate/src/lib.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ pub fn delegate(_attr: TokenStream, item: TokenStream) -> TokenStream {
6464
new_fields.push(quote! {
6565
/// CHECK: The buffer account
6666
#[account(
67-
mut, seeds = [ephemeral_rollups_sdk_v2::consts::BUFFER, #field_name.key().as_ref()],
67+
mut, seeds = [ephemeral_rollups_sdk::consts::BUFFER, #field_name.key().as_ref()],
6868
bump, seeds::program = crate::id()
6969
)]
7070
pub #buffer_field: AccountInfo<'info>,
@@ -73,7 +73,7 @@ pub fn delegate(_attr: TokenStream, item: TokenStream) -> TokenStream {
7373
new_fields.push(quote! {
7474
/// CHECK: The delegation record account
7575
#[account(
76-
mut, seeds = [ephemeral_rollups_sdk_v2::consts::DELEGATION_RECORD, #field_name.key().as_ref()],
76+
mut, seeds = [ephemeral_rollups_sdk::consts::DELEGATION_RECORD, #field_name.key().as_ref()],
7777
bump, seeds::program = delegation_program.key()
7878
)]
7979
pub #delegation_record_field: AccountInfo<'info>,
@@ -82,7 +82,7 @@ pub fn delegate(_attr: TokenStream, item: TokenStream) -> TokenStream {
8282
new_fields.push(quote! {
8383
/// CHECK: The delegation metadata account
8484
#[account(
85-
mut, seeds = [ephemeral_rollups_sdk_v2::consts::DELEGATION_METADATA, #field_name.key().as_ref()],
85+
mut, seeds = [ephemeral_rollups_sdk::consts::DELEGATION_METADATA, #field_name.key().as_ref()],
8686
bump, seeds::program = delegation_program.key()
8787
)]
8888
pub #delegation_metadata_field: AccountInfo<'info>,
@@ -96,9 +96,9 @@ pub fn delegate(_attr: TokenStream, item: TokenStream) -> TokenStream {
9696
&'a self,
9797
payer: &'a Signer<'info>,
9898
seeds: &[&[u8]],
99-
config: ::ephemeral_rollups_sdk_v2::cpi::DelegateConfig,
99+
config: ::ephemeral_rollups_sdk::cpi::DelegateConfig,
100100
) -> anchor_lang::solana_program::entrypoint::ProgramResult {
101-
let del_accounts = ::ephemeral_rollups_sdk_v2::cpi::DelegateAccounts {
101+
let del_accounts = ::ephemeral_rollups_sdk::cpi::DelegateAccounts {
102102
payer,
103103
pda: &self.#field_name.to_account_info(),
104104
owner_program: &self.owner_program,
@@ -108,7 +108,7 @@ pub fn delegate(_attr: TokenStream, item: TokenStream) -> TokenStream {
108108
delegation_program: &self.delegation_program,
109109
system_program: &self.system_program,
110110
};
111-
::ephemeral_rollups_sdk_v2::cpi::delegate_account(del_accounts, seeds, config)
111+
::ephemeral_rollups_sdk::cpi::delegate_account(del_accounts, seeds, config)
112112
}
113113
});
114114
}
@@ -143,7 +143,7 @@ pub fn delegate(_attr: TokenStream, item: TokenStream) -> TokenStream {
143143
if !has_delegation_program {
144144
new_fields.push(quote! {
145145
/// CHECK: The delegation program
146-
#[account(address = ::ephemeral_rollups_sdk_v2::id())]
146+
#[account(address = ::ephemeral_rollups_sdk::id())]
147147
pub delegation_program: AccountInfo<'info>,
148148
});
149149
}

rust/ephemeral/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ fn modify_component_module(mut module: ItemMod) -> ItemMod {
9696
fn generate_undelegate() -> (TokenStream2, TokenStream2, TokenStream2) {
9797
(
9898
quote! {
99-
use ephemeral_rollups_sdk_v2::cpi::undelegate_account;
99+
use ephemeral_rollups_sdk::cpi::undelegate_account;
100100
},
101101
quote! {
102102
#[automatically_derived]

rust/resolver/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ license = { workspace = true }
1212
edition = { workspace = true }
1313

1414
[dependencies]
15+
ephemeral-rollups-sdk = { workspace = true }
16+
17+
## External crates
18+
1519
# runtime
1620
tokio = { version = "1.0", features = [ "rt", "sync", "macros" ] }
1721
futures = "0.3"
@@ -26,10 +30,6 @@ sdk = { package = "solana-sdk", version = "1.18.26" }
2630
rpc = { package = "solana-rpc-client", version = "1.18.26" }
2731
rpc-api = { package = "solana-rpc-client-api", version = "1.18.26" }
2832

29-
# ephemeral rollups
30-
ephemeral-rollups-sdk = { path = "../sdk" }
31-
32-
3333
# parsing
3434
serde = { version = "1.0", features = [ "derive" ] }
3535
json = { package = "sonic-rs", version = "0.3" }

rust/sdk/src/anchor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#[cfg(feature = "anchor")]
2-
pub use ephemeral_rollups_sdk_attribute_ephemeral_v2::ephemeral;
2+
pub use ephemeral_rollups_sdk_attribute_ephemeral::ephemeral;
33

44
#[cfg(feature = "anchor")]
5-
pub use ephemeral_rollups_sdk_attribute_commit_v2::commit;
5+
pub use ephemeral_rollups_sdk_attribute_commit::commit;
66

77
#[cfg(feature = "anchor")]
8-
pub use ephemeral_rollups_sdk_attribute_delegate_v2::delegate;
8+
pub use ephemeral_rollups_sdk_attribute_delegate::delegate;
99

1010
#[cfg(feature = "anchor")]
1111
use solana_program::pubkey::Pubkey;

0 commit comments

Comments
 (0)