Skip to content

Commit 4db70da

Browse files
committed
♻️ Enforcing authority signature check on systems
1 parent 098dcd9 commit 4db70da

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

crates/bolt-lang/attribute/src/common/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ pub fn inject_program(module: &mut syn::ItemMod) {
2222
syn::Item::Struct(syn::parse_quote! {
2323
#[derive(Accounts)]
2424
pub struct VariadicBoltComponents<'info> {
25-
#[account()]
26-
pub authority: AccountInfo<'info>,
25+
pub authority: Signer<'info>,
2726
}
2827
}),
2928
);

crates/bolt-lang/attribute/src/system/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ pub fn process(_attr: TokenStream, item: TokenStream) -> TokenStream {
5050
let variadic_struct: Item = parse_quote! {
5151
#[derive(Accounts)]
5252
pub struct VariadicBoltComponents<'info> {
53-
#[account()]
54-
pub authority: AccountInfo<'info>,
53+
pub authority: Signer<'info>,
5554
}
5655
};
5756
items.insert(1, variadic_struct);

crates/bolt-lang/attribute/system-input/src/lib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ pub fn system_input(_attr: TokenStream, item: TokenStream) -> TokenStream {
7676
#[derive(Accounts)]
7777
pub struct #name<'info> {
7878
#(#transformed_fields)*
79-
/// CHECK: Authority check
80-
#[account()]
81-
pub authority: AccountInfo<'info>,
79+
pub authority: Signer<'info>,
8280
}
8381
};
8482

crates/programs/world/src/lib.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,13 @@ fn system_execute<'info>(
558558
use anchor_lang::solana_program::instruction::{AccountMeta, Instruction};
559559
use anchor_lang::solana_program::program::invoke;
560560

561-
let mut accounts = vec![AccountMeta::new_readonly(authority.key(), false)];
561+
let mut accounts = vec![
562+
AccountMeta {
563+
pubkey: authority.key(),
564+
is_signer: authority.is_signer,
565+
is_writable: authority.is_writable,
566+
}
567+
];
562568
accounts.extend(remaining_accounts.iter().map(|account| {
563569
AccountMeta {
564570
pubkey: account.key(),

docs/REPORT.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ xychart
44
title "Bolt Apply System Cost"
55
x-axis ["1C-CPIs:2","2C-CPIs:3","3C-CPIs:4","4C-CPIs:5","5C-CPIs:6","6C-CPIs:7","7C-CPIs:8","8C-CPIs:9","9C-CPIs:10","10C-CPIs:11"]
66
y-axis "CU" 5000 --> 200000
7-
bar [14633,23134,31660,40212,48956,57569,66228,75107,83986,92730]
8-
bar [6065,11042,16014,20986,25958,30934,35929,41116,46111,51107]
7+
bar [14428,22876,31384,39897,48603,57176,65796,74635,83475,92178]
8+
bar [5940,10903,15896,20868,25841,30816,35811,40997,45992,50986]
99
```

0 commit comments

Comments
 (0)