Add tick height syscall (#4497)

* Remove tick_height from entrypoint signature

* Impl tick_height syscall and use in storage program

* Properly remove tick height from bpf handling
This commit is contained in:
Tyera Eulberg
2019-05-31 16:29:21 -06:00
committed by GitHub
parent ce04d2bfc2
commit 64e8a21d73
22 changed files with 153 additions and 107 deletions

View File

@ -199,7 +199,6 @@ typedef struct {
uint64_t ka_num; /** Number of SolKeyedAccount entries in `ka` */
const uint8_t *data; /** pointer to the instruction data */
uint64_t data_len; /** Length in bytes of the instruction data */
uint64_t tick_height; /** Current ledger tick */
const SolPubkey *program_id; /** program_id of the currently executing program */
} SolParameters;
@ -258,8 +257,6 @@ SOL_FN_PREFIX bool sol_deserialize(
params->data = input;
input += params->data_len;
params->tick_height = *(uint64_t *) input;
input += sizeof(uint64_t);
params->program_id = (SolPubkey *) input;
input += sizeof(SolPubkey);
@ -299,8 +296,6 @@ SOL_FN_PREFIX void sol_log_array(const uint8_t *array, int len) {
* @param params Pointer to a SolParameters structure
*/
SOL_FN_PREFIX void sol_log_params(const SolParameters *params) {
sol_log("- Tick height:");
sol_log_64(params->tick_height, 0, 0, 0, 0);
sol_log("- Program identifier:");
sol_log_key(params->program_id);

View File

@ -32,8 +32,6 @@ pub struct SolKeyedAccount<'a> {
/// Information about the state of the cluster immediately before the program
/// started executing the current instruction
pub struct SolClusterInfo<'a> {
/// Current ledger tick
pub tick_height: u64,
///program_id of the currently executing program
pub program_id: SolPubkey<'a>,
}
@ -142,12 +140,6 @@ pub unsafe fn deserialize<'a>(
let data = { from_raw_parts(input.add(offset), data_length) };
offset += data_length;
// Tick height
#[allow(clippy::cast_ptr_alignment)]
let tick_height = *(input.add(offset) as *const u64);
offset += size_of::<u64>();
// Id
let program_id = {
@ -157,7 +149,6 @@ pub unsafe fn deserialize<'a>(
};
let info = SolClusterInfo {
tick_height,
program_id,
};