This commit is contained in:
Hardhat Chad
2025-09-20 12:07:14 -07:00
parent 37f1a9d55b
commit b5665a2e6f
2 changed files with 11 additions and 5 deletions

View File

@@ -34,12 +34,12 @@ pub fn process_deploy(accounts: &[AccountInfo<'_>], data: &[u8]) -> ProgramResul
// Check whitelist
if !AUTHORIZED_ACCOUNTS.contains(&signer_info.key) {
return Err(OreError::NotAuthorized.into());
return Err(trace("Not authorized", OreError::NotAuthorized.into()));
}
// Check minimum amount.
if amount < config.min_deploy_amount {
return Err(OreError::AmountTooSmall.into());
return Err(trace("Amount too small", OreError::AmountTooSmall.into()));
}
// Create miner.

View File

@@ -104,7 +104,10 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
// Check if miner was provided in correct order.
if miner.authority != square.miners[winning_square][i] {
return Err(ProgramError::InvalidAccountData);
return Err(trace(
"Incorrect miner order",
ProgramError::InvalidAccountData,
));
}
// Find the top winner.
@@ -117,7 +120,7 @@ pub fn process_reset(accounts: &[AccountInfo<'_>], _data: &[u8]) -> ProgramResul
// Verify checksum.
if checksum != square_prospects {
// This can only happen if the caller didn't provide full set of winning miners.
return Err(ProgramError::InvalidAccountData);
return Err(trace("Invalid checksum", ProgramError::InvalidAccountData));
}
// Payout reward to top miner.
@@ -199,7 +202,10 @@ pub fn get_slot_hash(
let Some(slot_hash) = slot_hashes.get(&slot) else {
// If reset is not called within ~2.5 minutes of the block ending,
// then the slot hash will be unavailable and secure hashes cannot be generated.
return Err(ProgramError::InvalidAccountData);
return Err(trace(
"Slot hash unavailable",
ProgramError::InvalidAccountData,
));
};
let slot_hash = slot_hash.to_bytes();
Ok(slot_hash)