diff --git a/proposals/0133-syscall-get-epoch-stake.md b/proposals/0133-syscall-get-epoch-stake.md index ed1bc3b22..76fc6c683 100644 --- a/proposals/0133-syscall-get-epoch-stake.md +++ b/proposals/0133-syscall-get-epoch-stake.md @@ -57,28 +57,28 @@ The specification for the proposed syscall is as follows: * Retrieves the total active stake delegated to a vote account for the current * epoch. * - * @param var_addr VM memory address to copy the retrieved data to. - * @param vote_address A pointer to 32 bytes representing the vote address. - * @return A 64-bit unsigned integer error code: - * - 0 if the operation is successful. - * - Non-zero error code. - * - * If the operation is not successful, data will not be written to the - * provided VM memory address. + * @param vote_addr A pointer to 32 bytes representing the vote address. + * @return A 64-bit unsigned integer representing the total + * active stake delegated to the vote account at the + * provided address. */ -uint64_t sol_get_epoch_stake( - /* r1 */ uint8_t * var_addr, - /* r2 */ void const * vote_address, -); +uint64_t sol_get_epoch_stake(/* r1 */ void const * vote_addr); ``` -`var_addr` must be the starting address of 8 bytes of writable VM memory to -store the `u64` response. If not, the syscall will abort the VM with an access -violation. - If the provided vote address corresponds to an account that is not a vote account or does not exist, the syscall will write `0` for active stake. +### Control Flow + +The syscall aborts the virtual machine if not all bytes in VM memory range +`[vote_addr, vote_addr + 32)` are readable. + +Otherwise, the syscall returns a `u64` integer representing the total active +stake delegated to the vote account at the provided address. + +If the provided vote address corresponds to an account that is not a vote +account or does not exist, the syscall will return `0` for active stake. + ### Compute Unit Usage The syscall will always attempt to consume the same amount of CUs regardless of @@ -102,7 +102,3 @@ This new syscall introduces the same security considerations as the rest of the syscalls in the existing interface, which manipulate raw pointers to VM memory and must be implemented with care. -A potential pitfall in the implementation could come when comparing the act of -writing a `0` to the VM memory for active stake versus returning a `0` for -success. The two should not be conflated. -