diff --git a/staking/programs/staking/src/wasm.rs b/staking/programs/staking/src/wasm.rs index 1f23e0a8..797aabd4 100644 --- a/staking/programs/staking/src/wasm.rs +++ b/staking/programs/staking/src/wasm.rs @@ -8,7 +8,6 @@ use { PositionData, PositionState, MAX_POSITIONS, - POSITIONS_ACCOUNT_SIZE, }, target::TargetMetadata, vesting::VestingEvent, @@ -46,7 +45,7 @@ impl WasmPositionData { #[wasm_bindgen(constructor)] pub fn from_buffer(buffer: &[u8]) -> Result { convert_error(WasmPositionData::from_buffer_impl( - &buffer[..POSITIONS_ACCOUNT_SIZE], + &buffer[..PositionData::LEN], )) } fn from_buffer_impl(buffer: &[u8]) -> Result { @@ -308,7 +307,7 @@ impl Constants { } #[wasm_bindgen] pub fn POSITIONS_ACCOUNT_SIZE() -> usize { - POSITIONS_ACCOUNT_SIZE + PositionData::LEN } #[wasm_bindgen] pub fn MAX_VOTER_WEIGHT() -> u64 { diff --git a/staking/target/idl/staking.json b/staking/target/idl/staking.json index 74bca674..a152aaa6 100644 --- a/staking/target/idl/staking.json +++ b/staking/target/idl/staking.json @@ -931,7 +931,7 @@ 200 ] }, - 100 + 10 ] } } @@ -940,6 +940,11 @@ }, { "name": "StakeAccountMetadataV2", + "docs": [ + "This is the metadata account for each staker", + "It is derived from the positions account with seeds \"stake_metadata\" and the positions account", + "pubkey It stores some PDA bumps, the owner of the account and the vesting schedule" + ], "type": { "kind": "struct", "fields": [ diff --git a/staking/target/types/staking.ts b/staking/target/types/staking.ts index de399e6f..e398ab9d 100644 --- a/staking/target/types/staking.ts +++ b/staking/target/types/staking.ts @@ -931,7 +931,7 @@ export type Staking = { 200 ] }, - 100 + 10 ] } } @@ -940,6 +940,11 @@ export type Staking = { }, { "name": "stakeAccountMetadataV2", + "docs": [ + "This is the metadata account for each staker", + "It is derived from the positions account with seeds \"stake_metadata\" and the positions account", + "pubkey It stores some PDA bumps, the owner of the account and the vesting schedule" + ], "type": { "kind": "struct", "fields": [ @@ -2405,7 +2410,7 @@ export const IDL: Staking = { 200 ] }, - 100 + 10 ] } } @@ -2414,6 +2419,11 @@ export const IDL: Staking = { }, { "name": "stakeAccountMetadataV2", + "docs": [ + "This is the metadata account for each staker", + "It is derived from the positions account with seeds \"stake_metadata\" and the positions account", + "pubkey It stores some PDA bumps, the owner of the account and the vesting schedule" + ], "type": { "kind": "struct", "fields": [ diff --git a/staking/tests/max_pos.ts b/staking/tests/max_pos.ts index 47d9f4f5..db0c420e 100644 --- a/staking/tests/max_pos.ts +++ b/staking/tests/max_pos.ts @@ -19,6 +19,7 @@ import { makeDefaultConfig, CustomAbortController, } from "./utils/before"; +import { Constants } from "pyth-staking-wasm"; // When DEBUG is turned on, we turn preflight transaction checking off // That way failed transactions show up in the explorer, which makes them @@ -109,7 +110,11 @@ describe("fills a stake account with positions", async () => { let deltaCost = costs[1] - costs[0]; // adding more positions increases the cost let transaction = new Transaction(); - for (let numPositions = 0; numPositions < 100; numPositions++) { + for ( + let numPositions = 0; + numPositions < Constants.MAX_POSITIONS(); + numPositions++ + ) { if ( budgetRemaining < ixCost || transaction.instructions.length == maxInstructions