File tree Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Expand file tree Collapse file tree 2 files changed +6
-7
lines changed Original file line number Diff line number Diff line change @@ -14,3 +14,7 @@ pub const POOL_ID: u64 = 0;
1414/// The number of lamports to reimburse the worker with after they've submitted a transaction's worth of exec instructions.
1515#[ constant]
1616pub const TRANSACTION_BASE_FEE_REIMBURSEMENT : u64 = 5_000 ;
17+
18+ /// Static space for next_instruction field.
19+ #[ constant]
20+ pub const NEXT_INSTRUCTION_SIZE : usize = 1232 ;
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ use sablier_utils::{
55 MinSpace , Space ,
66} ;
77
8- use crate :: constants:: SEED_THREAD ;
8+ use crate :: constants:: { NEXT_INSTRUCTION_SIZE , SEED_THREAD } ;
99
1010/// Tracks the current state of a transaction thread on Solana.
1111#[ account]
@@ -72,11 +72,6 @@ pub trait ThreadAccount {
7272impl Thread {
7373 pub fn min_space ( instructions : & [ SerializableInstruction ] ) -> Result < usize > {
7474 let ins_space = instructions. try_to_vec ( ) ?. len ( ) ;
75- let max_ins_size = instructions
76- . iter ( )
77- . map ( |ins| ins. try_to_vec ( ) . map ( |v| v. len ( ) ) . unwrap_or ( 0 ) )
78- . max ( )
79- . unwrap_or ( 0 ) ;
8075
8176 Ok (
8277 8
@@ -88,7 +83,7 @@ impl Thread {
8883 + u64:: MIN_SPACE // fee
8984 + ( 4 + 32 ) // id
9085 + ( 4 + ins_space) // instructions
91- + ( 1 + max_ins_size ) // next_instruction
86+ + ( 1 + NEXT_INSTRUCTION_SIZE ) // next_instruction
9287 + bool:: MIN_SPACE // paused
9388 + u64:: MIN_SPACE // rate_limit
9489 + Trigger :: MIN_SPACE , // trigger
You can’t perform that action at this time.
0 commit comments