Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions include/hostio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed on slack, let's rename these.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


/**
* 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.
Expand Down
2 changes: 1 addition & 1 deletion include/storage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down