5
votes
What is the use for `program_id` in program's entrypoint
I can think of two ways it's useful depending on whether the address where your program is currently running is somehow important:
The running address is important: receiving program_id allows you to ...
5
votes
Accepted
what does the sysvar PUBKEYs do?
A system account. Sysvars provide cluster state information such as current tick height, rewards points values, etc. Programs can access Sysvars via a Sysvar account (pubkey) or by querying via a ...
4
votes
Accepted
What is the behavior of the Instructions sysvar during CPI calls?
Yes, the instructions sysvar only includes instructions that are present in the toplevel transaction. This is due to the implementation: the instructions sysvar is filled before the transaction is ...
3
votes
what does the sysvar PUBKEYs do?
Solana exposes a variety of cluster state data to programs via sysvar accounts.
It's an address to an account on chain that contains the rental rate. These are static values.
Let's look at the account ...
3
votes
Accepted
What is the use for `program_id` in program's entrypoint
Using the actual program_id is more robust to errors.
If you declare the expected program_id, you have to keep track on it. (Like, for some reason you've chosen to deploy a new version to a new ...
3
votes
Accepted
Slot hash VS block hash?
As you've noticed, slot hash and block hash are not the same thing. They depend on each other for generation, but they have different purposes. To put it simply, the block hash belongs to a completed ...
2
votes
Accepted
Source of slot_hash and current timestamp on chain
All sysvars come directly from the Solana runtime, similar to how you can make a syscall in any other platform.
And the provided sysvars are the most current time and slot hash at time of execution.
...
2
votes
Accepted
Is the Epoch Rewards sysvar deprecated?
No, the EpochRewards sysvar is not deprecated. It is actually rather new, having been added within the last year.
It will become live on v0.17, which is not on all networks yet.
If you look at the ...
1
vote
Accepted
How do I get the recent blockhashses during program execution?
The slot_hashes sysvar is unfortunately too large to deserialize in an on-chain program.
You can partially deserialize it, however, to get a small number of the hashes. Here's an example, lifted from ...
1
vote
Compare start Time in account state from context and current time of SYSVAR clock
It is difficult to control two independent walltime sources like this. Instead of letting the user submit the start_time from the frontend, use a transaction to set it from the clock sysvar
1
vote
Mocking the Clock sysvar in solana_program_test
I think you're blocking the async executor with std::thread::sleep(). Try tokio::time:sleep() instead
Only top scored, non community-wiki answers of a minimum length are eligible