Skip to content

Transient storage for claims gate - #333

Open
naddison36 wants to merge 2 commits into
mainfrom
nicka/transient-claims
Open

Transient storage for claims gate#333
naddison36 wants to merge 2 commits into
mainfrom
nicka/transient-claims

Conversation

@naddison36

@naddison36 naddison36 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Upgrade Solidity from 0.8.23 to 0.8.36.
  • Target the Cancun EVM version.
  • Use transient storage for the claimingEtherFi guard in:
    • EtherFiAssetAdapter
    • WeETHAssetAdapter

The guard is declared as:

bool internal transient claimingEtherFi;

It is only needed while redeem calls Ether.fi's batchClaimWithdraw:

claimingEtherFi = true;
etherfiWithdrawalNFT.batchClaimWithdraw(requestIds);
claimingEtherFi = false;

The adapters’ receive functions use it to reject ETH sent outside an adapter-initiated claim:

receive() external payable {
    if (!claimingEtherFi) {
        revert UnauthorizedEtherFiClaim();
    }
}

Using transient storage avoids writing and clearing a persistent storage slot while preserving the existing authorization behavior.

Gas savings

Gas was measured with Solidity 0.8.36, targeting Cancun, using gasleft() immediately before and after the redeem call. Request setup was excluded from the measurement.

Adapter Requests claimed Persistent storage Transient storage Gas saved
EtherFi 1 140,456 118,560 21,896
EtherFi 2 150,306 128,409 21,897
EtherFi 5 179,865 157,965 21,900
weETH 1 140,857 118,964 21,893
weETH 2 151,111 129,217 21,894
weETH 5 181,882 159,985 21,897

This saves approximately 21,900 gas per Ether.fi redemption transaction, independent of the number of requests claimed in the batch.

Testing

  • Full Foundry build with Solidity 0.8.36
  • EtherFiAssetAdapter unit tests
  • WeETHAssetAdapter unit tests
  • Hardhat compilation targeting Cancun

@sparrowDom sparrowDom left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants