From ddee2c7be45329913c93af0dd2d73c06faa6808e Mon Sep 17 00:00:00 2001 From: Mikers Date: Fri, 22 Nov 2024 15:56:58 -0700 Subject: [PATCH 01/16] Add FIP draft: Support for EIP-1153 Transient Storage in FEVM - Introduces support for EIP-1153: Transient Storage in the FEVM - Details lifecycle validation and implementation using `TLOAD` and `TSTORE` - Ensures compatibility with Ethereum contracts and tooling - Includes specifications, rationale, and considerations for adoption --- FIPS/fip-draft_transient_storage.md | 102 ++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 FIPS/fip-draft_transient_storage.md diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md new file mode 100644 index 000000000..969a6291b --- /dev/null +++ b/FIPS/fip-draft_transient_storage.md @@ -0,0 +1,102 @@ +--- +fip: "" +title: Add Support for EIP-1153 (Transient Storage) in the FEVM +author: Michael Seiler (@snissn), Steven Allen (@stebalien) +discussions-to: +status: Draft +type: Technical +category: Core +created: 2024-11-19 +--- + +# FIP-XXXX: Add Support for EIP-1153 (Transient Storage) in the FEVM + +## Simple Summary +This proposal introduces support for **[EIP-1153: Transient Storage](https://eips.ethereum.org/EIPS/eip-1153)** in the Filecoin Ethereum Virtual Machine (FEVM). Transient storage provides ephemeral data storage during transaction execution. To maintain compatibility with Ethereum contracts utilizing this feature, the FEVM will implement transient storage with lifecycle validation. + +## Abstract +EIP-1153 defines transient storage as temporary data accessible only during the originating transaction, cleared automatically at the end of the transaction. This FIP adapts transient storage to the FEVM using `TLOAD` and `TSTORE` opcodes, ensuring compatibility with Ethereum contracts and libraries that rely on this feature. Lifecycle validation mechanisms enforce the transaction-scoped behavior of transient storage, achieving functional equivalence with Ethereum’s implementation and seamless integration with Filecoin’s architecture. + + +## Change Motivation +Transient storage offers developers temporary, transaction-scoped storage for managing intermediate states. One key benefit of this feature is its ability to improve the implementation of reentrancy locks, enhancing security by mitigating risks associated with multiple calls to a function within sub-transactions. By introducing transient storage, the FEVM aligns with Ethereum’s tooling and Solidity’s modern features, providing a seamless developer experience while supporting advanced contract use cases and secure computing. + +While the FEVM implementation utilizes permanent storage for practical reasons, its lifecycle validation ensures it functionally replicates Ethereum’s ephemeral transient storage. This enables compatibility with contracts and libraries that rely on `TLOAD` and `TSTORE` while supporting transaction-scoped data handling. + +## Specification + +### Opcode Descriptions + +#### `TLOAD` +- **Opcode Hex:** `0x5C` +- **Stack Input:** + - `key`: Location of the transient storage value to load +- **Stack Output:** + - `value`: Stored value or zero if no value exists +- **Description:** Retrieves the value associated with `key` in the transient storage for the current transaction. + +#### `TSTORE` +- **Opcode Hex:** `0x5D` +- **Stack Input:** + - `key`: Location to store the value + - `value`: Value to store +- **Output:** None +- **Description:** Stores `value` at the specified `key` in the transient storage for the current transaction. + +### Lifecycle Management +Transient storage is valid only within the context of a single transaction. A lifecycle mechanism tracks transaction metadata (`origin` and `nonce`) to enforce lifecycle validation. + +### Implementation Details +The FEVM implements transient storage using a lifecycle validation mechanism to ensure data remains accessible only during the originating transaction. This validation enforces the same behavior as Ethereum’s ephemeral transient storage. Internally, transient storage relies on permanent storage to manage lifecycle data and state while ensuring functional adherence to Ethereum’s behavior. + +--- + +## Design Rationale + +The design adheres to the intent of EIP-1153 while adapting to Filecoin's architecture. The use of lifecycle validation ensures transient storage behaves as expected within the scope of a single transaction. This approach balances compatibility with Ethereum contracts and simplifies implementation within the existing FEVM architecture. + +Alternative designs, such as purely in-memory storage, were considered but deemed impractical due to technical implementation difficulties. + +## Backwards Compatibility +The addition of transient storage is fully backward-compatible. Existing contracts remain unaffected unless they utilize `TLOAD` and `TSTORE`. Contracts compiled with older Solidity versions will continue to execute without changes. + +## Test Cases + +### Essential Tests +1. **Basic Functionality:** + - Verify `TLOAD` retrieves the correct value. + - Verify `TSTORE` writes data to the transient storage correctly. + +2. **Lifecycle Validation:** + - Verify that transient storage is automatically cleared and becomes inaccessible after the transaction ends. + - Verify that transient storage is properly cleared at the end of each transaction and any out-of-lifecycle data does not interfere with subsequent transaction operations. + +--- + +## Security Considerations +Transient storage introduces minimal additional risk compared to existing state storage. Lifecycle validation ensures storage is inaccessible outside the originating transaction. Security measures include: +- Preventing out-of-bounds memory access. +- Ensuring transient storage clears properly after a transaction ends. + +--- + +## Incentive Considerations +Transient storage supports the management of temporary, transaction-scoped data and enables features outlined in **EIP-1153**, such as reentrancy locks, temporary approvals, on-chain address computation, and enhanced proxy call metadata handling. These capabilities align with Filecoin’s goal of enabling scalable and reliable decentralized applications. + +By implementing transient storage, the FEVM ensures compatibility with Ethereum’s tooling and supports developers accustomed to this feature. It also facilitates seamless integration of existing projects utilizing EIP-1153, enriching the Filecoin ecosystem and expanding its appeal to the broader Ethereum developer community. + + +--- + +## Product Considerations +Adding transient storage ensures compatibility with modern Ethereum tooling, attracting developers to Filecoin’s ecosystem. This feature supports the development of advanced smart contracts and storage-related services. This addition further solidifies Filecoin’s position as a robust EVM-compatible chain, enhancing its attractiveness to Ethereum developers and expanding its ecosystem of decentralized applications. + +--- + +## Implementation +The reference implementation, including `TLOAD` and `TSTORE`, is available in the following pull request: [filecoin-project/builtin-actors#1588](https://github.com/filecoin-project/builtin-actors/pull/1588). The implementation includes lifecycle validation and persistent backing for ease of use. + +--- + +## Copyright +Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From 264c81ba74b7fdbe5a78746c5d63f94085d80453 Mon Sep 17 00:00:00 2001 From: Mikers Date: Fri, 22 Nov 2024 16:01:04 -0700 Subject: [PATCH 02/16] Readme for Add Support for EIP-1153 (Transient Storage) in the FEVM --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index ca7dba33d..e3fe1d052 100644 --- a/README.md +++ b/README.md @@ -131,3 +131,4 @@ This improvement protocol helps achieve that objective for all members of the Fi | [0092](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0092.md) | Non-Interactive PoRep | FIP | luca (@lucaniz), kuba (@Kubuxu), nicola (@nicola), nemo (@cryptonemo), volker (@vmx), irene (@irenegia), Alex North (@anorth), orjan (@Phi-rjan) | Final | | [0094](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0094.md) | Add Support for EIP-5656 (MCOPY Opcode) in the FEVM | FIP | Michael Seiler (@snissn), Raúl Kripalani (@raulk), Steven Allen (@stebalien) | Accepted | | [0095](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0095.md) | Add FEVM precompile to fetch beacon digest from chain history | FIP | @ZenGround0, Alex North (@anorth) | Accepted | +| [XXXX](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-XXXX.md) | Add Support for EIP-1153 (Transient Storage) in the FEVM | FIP | Michael Seiler (@snissn), Steven Allen (@stebalien) | Draft | From 606c1c1ccc156c142db38507b4385759ad8ca16b Mon Sep 17 00:00:00 2001 From: Mikers Date: Fri, 22 Nov 2024 16:02:59 -0700 Subject: [PATCH 03/16] add discussions link relevant to transient storage fip --- FIPS/fip-draft_transient_storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md index 969a6291b..b5c2a3f61 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-draft_transient_storage.md @@ -2,7 +2,7 @@ fip: "" title: Add Support for EIP-1153 (Transient Storage) in the FEVM author: Michael Seiler (@snissn), Steven Allen (@stebalien) -discussions-to: +discussions-to: https://github.com/filecoin-project/FIPs/discussions/855 status: Draft type: Technical category: Core From 6a35a62c3de98493bc5f2e192c369f6cd1f4707a Mon Sep 17 00:00:00 2001 From: Mikers Date: Mon, 25 Nov 2024 04:47:48 -1000 Subject: [PATCH 04/16] Update FIPS/fip-draft_transient_storage.md Co-authored-by: Rod Vagg --- FIPS/fip-draft_transient_storage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md index b5c2a3f61..bec9bc1e8 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-draft_transient_storage.md @@ -66,6 +66,7 @@ The addition of transient storage is fully backward-compatible. Existing contrac 1. **Basic Functionality:** - Verify `TLOAD` retrieves the correct value. - Verify `TSTORE` writes data to the transient storage correctly. + - Verify `TLOAD` from an unitialized location returns the zero value. 2. **Lifecycle Validation:** - Verify that transient storage is automatically cleared and becomes inaccessible after the transaction ends. From e0f94d2fa045e5b7eaf04bdb3486744949581311 Mon Sep 17 00:00:00 2001 From: Mikers Date: Mon, 25 Nov 2024 10:07:24 -0500 Subject: [PATCH 05/16] clarify scope of nested contract calls --- FIPS/fip-draft_transient_storage.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md index b5c2a3f61..05eb86fb7 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-draft_transient_storage.md @@ -12,11 +12,10 @@ created: 2024-11-19 # FIP-XXXX: Add Support for EIP-1153 (Transient Storage) in the FEVM ## Simple Summary -This proposal introduces support for **[EIP-1153: Transient Storage](https://eips.ethereum.org/EIPS/eip-1153)** in the Filecoin Ethereum Virtual Machine (FEVM). Transient storage provides ephemeral data storage during transaction execution. To maintain compatibility with Ethereum contracts utilizing this feature, the FEVM will implement transient storage with lifecycle validation. +This proposal introduces support for **[EIP-1153: Transient Storage](https://eips.ethereum.org/EIPS/eip-1153)** in the Filecoin Ethereum Virtual Machine (FEVM). Transient storage provides ephemeral data storage during transaction execution, scoped strictly to the transaction and the contract utilizing it. To maintain compatibility with Ethereum contracts utilizing this feature, the FEVM will implement transient storage with lifecycle validation and isolation. ## Abstract -EIP-1153 defines transient storage as temporary data accessible only during the originating transaction, cleared automatically at the end of the transaction. This FIP adapts transient storage to the FEVM using `TLOAD` and `TSTORE` opcodes, ensuring compatibility with Ethereum contracts and libraries that rely on this feature. Lifecycle validation mechanisms enforce the transaction-scoped behavior of transient storage, achieving functional equivalence with Ethereum’s implementation and seamless integration with Filecoin’s architecture. - +EIP-1153 defines transient storage as temporary data accessible only during the originating transaction, cleared automatically at the end of the transaction. This FIP adapts transient storage to the FEVM using `TLOAD` and `TSTORE` opcodes, ensuring compatibility with Ethereum contracts and libraries that rely on this feature. Transient storage is scoped to the specific contract and transaction, ensuring that each contract’s transient storage is isolated. Nested contract calls cannot access the transient storage of other contracts, but reentrant calls to the same contract within a transaction will access the same transient storage space. Lifecycle validation mechanisms enforce this behavior, achieving functional equivalence with Ethereum’s implementation while maintaining seamless integration with Filecoin’s architecture. ## Change Motivation Transient storage offers developers temporary, transaction-scoped storage for managing intermediate states. One key benefit of this feature is its ability to improve the implementation of reentrancy locks, enhancing security by mitigating risks associated with multiple calls to a function within sub-transactions. By introducing transient storage, the FEVM aligns with Ethereum’s tooling and Solidity’s modern features, providing a seamless developer experience while supporting advanced contract use cases and secure computing. From c7d03e33a19af97642cc2993d224ea251802fe17 Mon Sep 17 00:00:00 2001 From: Mikers Date: Mon, 25 Nov 2024 10:14:57 -0500 Subject: [PATCH 06/16] add reference to ethereum cancun upgrade adopting EIP1153 --- FIPS/fip-draft_transient_storage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md index 1afef0cf9..7c39aac59 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-draft_transient_storage.md @@ -18,7 +18,7 @@ This proposal introduces support for **[EIP-1153: Transient Storage](https://eip EIP-1153 defines transient storage as temporary data accessible only during the originating transaction, cleared automatically at the end of the transaction. This FIP adapts transient storage to the FEVM using `TLOAD` and `TSTORE` opcodes, ensuring compatibility with Ethereum contracts and libraries that rely on this feature. Transient storage is scoped to the specific contract and transaction, ensuring that each contract’s transient storage is isolated. Nested contract calls cannot access the transient storage of other contracts, but reentrant calls to the same contract within a transaction will access the same transient storage space. Lifecycle validation mechanisms enforce this behavior, achieving functional equivalence with Ethereum’s implementation while maintaining seamless integration with Filecoin’s architecture. ## Change Motivation -Transient storage offers developers temporary, transaction-scoped storage for managing intermediate states. One key benefit of this feature is its ability to improve the implementation of reentrancy locks, enhancing security by mitigating risks associated with multiple calls to a function within sub-transactions. By introducing transient storage, the FEVM aligns with Ethereum’s tooling and Solidity’s modern features, providing a seamless developer experience while supporting advanced contract use cases and secure computing. +Transient storage offers developers temporary, transaction-scoped storage for managing intermediate states. One key benefit of this feature is its ability to improve the implementation of reentrancy locks, enhancing security by mitigating risks associated with multiple calls to a function within sub-transactions. This feature was introduced on Ethereum mainnet in March 2024 as part of the Cancun (Decun) upgrade, making adopting this FIP important to align the FEVM with Ethereum’s evolving tooling and Solidity’s modern features. By implementing transient storage, the FEVM ensures a seamless developer experience while supporting advanced contract use cases and secure computing. While the FEVM implementation utilizes permanent storage for practical reasons, its lifecycle validation ensures it functionally replicates Ethereum’s ephemeral transient storage. This enables compatibility with contracts and libraries that rely on `TLOAD` and `TSTORE` while supporting transaction-scoped data handling. From 12556d925305c9301beafbf5914c9087719e72c9 Mon Sep 17 00:00:00 2001 From: Mikers Date: Mon, 25 Nov 2024 10:36:52 -0500 Subject: [PATCH 07/16] ensure reentrancy tests are valid --- FIPS/fip-draft_transient_storage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md index 7c39aac59..c387a3cd2 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-draft_transient_storage.md @@ -70,6 +70,7 @@ The addition of transient storage is fully backward-compatible. Existing contrac 2. **Lifecycle Validation:** - Verify that transient storage is automatically cleared and becomes inaccessible after the transaction ends. - Verify that transient storage is properly cleared at the end of each transaction and any out-of-lifecycle data does not interfere with subsequent transaction operations. + - Verify that memory remains accessible and stable after contract reentry. --- From f576eabfeaa1c6db8fd69e26601bf30d23ff3a7a Mon Sep 17 00:00:00 2001 From: Mikers Date: Mon, 25 Nov 2024 10:38:35 -0500 Subject: [PATCH 08/16] requirement for independent storage spaces --- FIPS/fip-draft_transient_storage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md index c387a3cd2..fd727bc9e 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-draft_transient_storage.md @@ -70,6 +70,7 @@ The addition of transient storage is fully backward-compatible. Existing contrac 2. **Lifecycle Validation:** - Verify that transient storage is automatically cleared and becomes inaccessible after the transaction ends. - Verify that transient storage is properly cleared at the end of each transaction and any out-of-lifecycle data does not interfere with subsequent transaction operations. + - Verify that nested contracts have independent transient storage spaces can read and write independently. - Verify that memory remains accessible and stable after contract reentry. --- From caa886a864b5509d18ef2c0700d4f7f23b027c8f Mon Sep 17 00:00:00 2001 From: Mikers Date: Mon, 25 Nov 2024 05:40:35 -1000 Subject: [PATCH 09/16] Update FIPS/fip-draft_transient_storage.md Co-authored-by: Rod Vagg --- FIPS/fip-draft_transient_storage.md | 1 + 1 file changed, 1 insertion(+) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-draft_transient_storage.md index fd727bc9e..22048d4e3 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-draft_transient_storage.md @@ -79,6 +79,7 @@ The addition of transient storage is fully backward-compatible. Existing contrac Transient storage introduces minimal additional risk compared to existing state storage. Lifecycle validation ensures storage is inaccessible outside the originating transaction. Security measures include: - Preventing out-of-bounds memory access. - Ensuring transient storage clears properly after a transaction ends. +- Ensuring nested contracts do not have access to eachother's memory spaces. --- From 66bab77b100c900e6e5a67ee3ac49e36e9ddc821 Mon Sep 17 00:00:00 2001 From: Mikers Date: Thu, 5 Dec 2024 00:04:42 -1000 Subject: [PATCH 10/16] update fip number --- FIPS/{fip-draft_transient_storage.md => fip-0097.md} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename FIPS/{fip-draft_transient_storage.md => fip-0097.md} (98%) diff --git a/FIPS/fip-draft_transient_storage.md b/FIPS/fip-0097.md similarity index 98% rename from FIPS/fip-draft_transient_storage.md rename to FIPS/fip-0097.md index fd727bc9e..8c05ba9f1 100644 --- a/FIPS/fip-draft_transient_storage.md +++ b/FIPS/fip-0097.md @@ -1,5 +1,5 @@ --- -fip: "" +fip: "0097" title: Add Support for EIP-1153 (Transient Storage) in the FEVM author: Michael Seiler (@snissn), Steven Allen (@stebalien) discussions-to: https://github.com/filecoin-project/FIPs/discussions/855 @@ -9,7 +9,7 @@ category: Core created: 2024-11-19 --- -# FIP-XXXX: Add Support for EIP-1153 (Transient Storage) in the FEVM +# FIP-0097: Add Support for EIP-1153 (Transient Storage) in the FEVM ## Simple Summary This proposal introduces support for **[EIP-1153: Transient Storage](https://eips.ethereum.org/EIPS/eip-1153)** in the Filecoin Ethereum Virtual Machine (FEVM). Transient storage provides ephemeral data storage during transaction execution, scoped strictly to the transaction and the contract utilizing it. To maintain compatibility with Ethereum contracts utilizing this feature, the FEVM will implement transient storage with lifecycle validation and isolation. From 206557be722cdebe4e8236aaadc22d8493d91280 Mon Sep 17 00:00:00 2001 From: Mikers Date: Thu, 5 Dec 2024 00:07:13 -1000 Subject: [PATCH 11/16] assign 0097 fip number --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 03e2b59bc..412192d58 100644 --- a/README.md +++ b/README.md @@ -131,4 +131,4 @@ This improvement protocol helps achieve that objective for all members of the Fi | [0092](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0092.md) | Non-Interactive PoRep | FIP | luca (@lucaniz), kuba (@Kubuxu), nicola (@nicola), nemo (@cryptonemo), volker (@vmx), irene (@irenegia), Alex North (@anorth), orjan (@Phi-rjan) | Final | | [0094](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0094.md) | Add Support for EIP-5656 (MCOPY Opcode) in the FEVM | FIP | Michael Seiler (@snissn), Raúl Kripalani (@raulk), Steven Allen (@stebalien) | Final | | [0095](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0095.md) | Add FEVM precompile to fetch beacon digest from chain history | FIP | @ZenGround0, Alex North (@anorth) | Final | -| [XXXX](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-XXXX.md) | Add Support for EIP-1153 (Transient Storage) in the FEVM | FIP | Michael Seiler (@snissn), Steven Allen (@stebalien) | Draft | +| [0097](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0097.md) | Add Support for EIP-1153 (Transient Storage) in the FEVM | FIP | Michael Seiler (@snissn), Steven Allen (@stebalien) | Draft | From 79d0086a06fdecb00957cb091b1b6267168329e2 Mon Sep 17 00:00:00 2001 From: Mikers Date: Thu, 5 Dec 2024 00:08:35 -1000 Subject: [PATCH 12/16] fix spelling issue / remove archaic usage --- FIPS/fip-0097.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FIPS/fip-0097.md b/FIPS/fip-0097.md index 20faa2a37..aeab59cd7 100644 --- a/FIPS/fip-0097.md +++ b/FIPS/fip-0097.md @@ -79,7 +79,7 @@ The addition of transient storage is fully backward-compatible. Existing contrac Transient storage introduces minimal additional risk compared to existing state storage. Lifecycle validation ensures storage is inaccessible outside the originating transaction. Security measures include: - Preventing out-of-bounds memory access. - Ensuring transient storage clears properly after a transaction ends. -- Ensuring nested contracts do not have access to eachother's memory spaces. +- Ensuring nested contracts do not have access to each other's memory spaces. --- From 06ced1d4c3de9ed18deeb3865771352c9a602c4b Mon Sep 17 00:00:00 2001 From: Mikers Date: Thu, 5 Dec 2024 00:11:36 -1000 Subject: [PATCH 13/16] fix Dencun typo --- FIPS/fip-0097.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/FIPS/fip-0097.md b/FIPS/fip-0097.md index aeab59cd7..a48c28d51 100644 --- a/FIPS/fip-0097.md +++ b/FIPS/fip-0097.md @@ -18,7 +18,7 @@ This proposal introduces support for **[EIP-1153: Transient Storage](https://eip EIP-1153 defines transient storage as temporary data accessible only during the originating transaction, cleared automatically at the end of the transaction. This FIP adapts transient storage to the FEVM using `TLOAD` and `TSTORE` opcodes, ensuring compatibility with Ethereum contracts and libraries that rely on this feature. Transient storage is scoped to the specific contract and transaction, ensuring that each contract’s transient storage is isolated. Nested contract calls cannot access the transient storage of other contracts, but reentrant calls to the same contract within a transaction will access the same transient storage space. Lifecycle validation mechanisms enforce this behavior, achieving functional equivalence with Ethereum’s implementation while maintaining seamless integration with Filecoin’s architecture. ## Change Motivation -Transient storage offers developers temporary, transaction-scoped storage for managing intermediate states. One key benefit of this feature is its ability to improve the implementation of reentrancy locks, enhancing security by mitigating risks associated with multiple calls to a function within sub-transactions. This feature was introduced on Ethereum mainnet in March 2024 as part of the Cancun (Decun) upgrade, making adopting this FIP important to align the FEVM with Ethereum’s evolving tooling and Solidity’s modern features. By implementing transient storage, the FEVM ensures a seamless developer experience while supporting advanced contract use cases and secure computing. +Transient storage offers developers temporary, transaction-scoped storage for managing intermediate states. One key benefit of this feature is its ability to improve the implementation of reentrancy locks, enhancing security by mitigating risks associated with multiple calls to a function within sub-transactions. This feature was introduced on Ethereum mainnet in March 2024 as part of the Cancun (Dencun) upgrade, making adopting this FIP important to align the FEVM with Ethereum’s evolving tooling and Solidity’s modern features. By implementing transient storage, the FEVM ensures a seamless developer experience while supporting advanced contract use cases and secure computing. While the FEVM implementation utilizes permanent storage for practical reasons, its lifecycle validation ensures it functionally replicates Ethereum’s ephemeral transient storage. This enables compatibility with contracts and libraries that rely on `TLOAD` and `TSTORE` while supporting transaction-scoped data handling. From b69533d4d103bc47bbbad4c18feae7642805633e Mon Sep 17 00:00:00 2001 From: Mikers Date: Thu, 5 Dec 2024 00:18:14 -1000 Subject: [PATCH 14/16] delete word ephemeral which creates confusion --- FIPS/fip-0097.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/FIPS/fip-0097.md b/FIPS/fip-0097.md index a48c28d51..323779a25 100644 --- a/FIPS/fip-0097.md +++ b/FIPS/fip-0097.md @@ -12,7 +12,7 @@ created: 2024-11-19 # FIP-0097: Add Support for EIP-1153 (Transient Storage) in the FEVM ## Simple Summary -This proposal introduces support for **[EIP-1153: Transient Storage](https://eips.ethereum.org/EIPS/eip-1153)** in the Filecoin Ethereum Virtual Machine (FEVM). Transient storage provides ephemeral data storage during transaction execution, scoped strictly to the transaction and the contract utilizing it. To maintain compatibility with Ethereum contracts utilizing this feature, the FEVM will implement transient storage with lifecycle validation and isolation. +This proposal introduces support for **[EIP-1153: Transient Storage](https://eips.ethereum.org/EIPS/eip-1153)** in the Filecoin Ethereum Virtual Machine (FEVM). Transient storage provides data storage during transaction execution, scoped strictly to the transaction and the contract utilizing it. To maintain compatibility with Ethereum contracts utilizing this feature, the FEVM will implement transient storage with lifecycle validation and isolation. ## Abstract EIP-1153 defines transient storage as temporary data accessible only during the originating transaction, cleared automatically at the end of the transaction. This FIP adapts transient storage to the FEVM using `TLOAD` and `TSTORE` opcodes, ensuring compatibility with Ethereum contracts and libraries that rely on this feature. Transient storage is scoped to the specific contract and transaction, ensuring that each contract’s transient storage is isolated. Nested contract calls cannot access the transient storage of other contracts, but reentrant calls to the same contract within a transaction will access the same transient storage space. Lifecycle validation mechanisms enforce this behavior, achieving functional equivalence with Ethereum’s implementation while maintaining seamless integration with Filecoin’s architecture. @@ -20,7 +20,7 @@ EIP-1153 defines transient storage as temporary data accessible only during the ## Change Motivation Transient storage offers developers temporary, transaction-scoped storage for managing intermediate states. One key benefit of this feature is its ability to improve the implementation of reentrancy locks, enhancing security by mitigating risks associated with multiple calls to a function within sub-transactions. This feature was introduced on Ethereum mainnet in March 2024 as part of the Cancun (Dencun) upgrade, making adopting this FIP important to align the FEVM with Ethereum’s evolving tooling and Solidity’s modern features. By implementing transient storage, the FEVM ensures a seamless developer experience while supporting advanced contract use cases and secure computing. -While the FEVM implementation utilizes permanent storage for practical reasons, its lifecycle validation ensures it functionally replicates Ethereum’s ephemeral transient storage. This enables compatibility with contracts and libraries that rely on `TLOAD` and `TSTORE` while supporting transaction-scoped data handling. +While the FEVM implementation utilizes permanent storage for practical reasons, its lifecycle validation ensures it functionally replicates Ethereum’s transient storage. This enables compatibility with contracts and libraries that rely on `TLOAD` and `TSTORE` while supporting transaction-scoped data handling. ## Specification @@ -46,7 +46,7 @@ While the FEVM implementation utilizes permanent storage for practical reasons, Transient storage is valid only within the context of a single transaction. A lifecycle mechanism tracks transaction metadata (`origin` and `nonce`) to enforce lifecycle validation. ### Implementation Details -The FEVM implements transient storage using a lifecycle validation mechanism to ensure data remains accessible only during the originating transaction. This validation enforces the same behavior as Ethereum’s ephemeral transient storage. Internally, transient storage relies on permanent storage to manage lifecycle data and state while ensuring functional adherence to Ethereum’s behavior. +The FEVM implements transient storage using a lifecycle validation mechanism to ensure data remains accessible only during the originating transaction. This validation enforces the same behavior as Ethereum’s transient storage. Internally, transient storage relies on permanent storage to manage lifecycle data and state while ensuring functional adherence to Ethereum’s behavior. --- From 58d7f88605147c656e242f17c1f15cf3b907fc40 Mon Sep 17 00:00:00 2001 From: Mikers Date: Tue, 10 Dec 2024 11:04:22 -1000 Subject: [PATCH 15/16] Update FIPS/fip-0097.md Co-authored-by: Rod Vagg --- FIPS/fip-0097.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/FIPS/fip-0097.md b/FIPS/fip-0097.md index 323779a25..45c57d644 100644 --- a/FIPS/fip-0097.md +++ b/FIPS/fip-0097.md @@ -59,6 +59,8 @@ Alternative designs, such as purely in-memory storage, were considered but deeme ## Backwards Compatibility The addition of transient storage is fully backward-compatible. Existing contracts remain unaffected unless they utilize `TLOAD` and `TSTORE`. Contracts compiled with older Solidity versions will continue to execute without changes. +At the time of writing, support for `TLOAD` and `TSTORE` in current versions of Solidity is only available using inline-assembly. Thus, it is an explicitly opt-in feature, rather than a feature that contract authors may unknowngly be enabling when bumping compiler version and EVM target. + ## Test Cases ### Essential Tests From ddf950107e9c7c6e18f05ac69b8f989ebe7694ec Mon Sep 17 00:00:00 2001 From: Mikers Date: Tue, 10 Dec 2024 11:21:21 -1000 Subject: [PATCH 16/16] clarify incentive considerations --- FIPS/fip-0097.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/FIPS/fip-0097.md b/FIPS/fip-0097.md index 45c57d644..74912412c 100644 --- a/FIPS/fip-0097.md +++ b/FIPS/fip-0097.md @@ -86,10 +86,7 @@ Transient storage introduces minimal additional risk compared to existing state --- ## Incentive Considerations -Transient storage supports the management of temporary, transaction-scoped data and enables features outlined in **EIP-1153**, such as reentrancy locks, temporary approvals, on-chain address computation, and enhanced proxy call metadata handling. These capabilities align with Filecoin’s goal of enabling scalable and reliable decentralized applications. - -By implementing transient storage, the FEVM ensures compatibility with Ethereum’s tooling and supports developers accustomed to this feature. It also facilitates seamless integration of existing projects utilizing EIP-1153, enriching the Filecoin ecosystem and expanding its appeal to the broader Ethereum developer community. - +By adding support for transient storage, this FIP improves the FEVM's compatibility with Ethereum and provides developers with useful functionality for transaction-scoped data handling. This feature enables capabilities outlined in EIP-1153, such as reentrancy locks, temporary approvals, on-chain address computation, and enhanced proxy call metadata handling. These improvements align with Filecoin's goal of enabling scalable and reliable decentralized applications. However, transient storage does not introduce or impact economic incentives within the network. ---