diff --git a/include/hostio.h b/include/hostio.h index 9718321..deb5375 100644 --- a/include/hostio.h +++ b/include/hostio.h @@ -51,6 +51,26 @@ VM_HOOK(storage_load_bytes32) void storage_load_bytes32(const uint8_t * key, uin */ VM_HOOK(storage_store_bytes32) void storage_store_bytes32(const uint8_t * key, const uint8_t * value); +/** + * Reads a 32-byte value from transient storage. Stylus's storage format is identical to + * that of the EVM. This means that, under the hood, this hostio is accessing the 32-byte + * value stored in the EVM transient storage at offset `key`, which will be `0` when not previously + * set. The semantics, then, are equivalent to that of the EVM's [`TLOAD`] opcode. + * + * [`TLOAD`]: https://eips.ethereum.org/EIPS/eip-1153 + */ +VM_HOOK(transient_load_bytes32) void transient_load_bytes32(const uint8_t * key, uint8_t * dest); + +/** + * Stores a 32-byte value to permanent storage. Stylus's storage format is identical to that + * of the EVM. This means that, under the hood, this hostio is storing a 32-byte value into + * the EVM transient storage at offset `key`. Furthermore, refunds are tabulated exactly as in the + * EVM. The semantics, then, are equivalent to that of the EVM's [`TSTORE`] opcode. + * + * [`TSTORE`]: https://eips.ethereum.org/EIPS/eip-1153 + */ +VM_HOOK(transient_store_bytes32) void transient_store_bytes32(const uint8_t * key, const uint8_t * value); + /** * Gets the basefee of the current block. The semantics are equivalent to that of the EVM's * [`BASEFEE`] opcode. diff --git a/include/storage.h b/include/storage.h index 3ab07a3..ce9fe84 100644 --- a/include/storage.h +++ b/include/storage.h @@ -23,7 +23,7 @@ extern "C" { /** * storage_load / store load or store a value from storage accordingly. - * + * * The value of the first "storage" pointer is not used. * generated headers provide: * a const storage pointer when working for a view-only function