Skip to content

Commit

Permalink
T
Browse files Browse the repository at this point in the history
  • Loading branch information
Vectorized committed Nov 28, 2024
1 parent 30814ed commit 2f8179f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/accounts/LibERC7579.sol
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ library LibERC7579 {
}

/// @dev Reencodes `executionData` such that it has `opData` added to it.
/// Useful for forwarding `executionData` from an entry point to a smart account.
/// Like `abi.encode(abi.decode(executionData, (Call[])), opData)`.
/// Useful for forwarding `executionData` with extra `opData`.
/// This function does not perform any check on the validity of `executionData`.
function reencodeBatch(bytes calldata executionData, bytes memory opData)
internal
Expand Down
14 changes: 11 additions & 3 deletions test/LibERC7579.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,20 @@ contract LibERC7579Test is SoladyTest {

function reencodeBatchAndDecodeBatch(bytes calldata executionData, bytes memory opData)
public
view
returns (Call[] memory, bytes memory)
{
bytes memory reencoded = LibERC7579.reencodeBatch(executionData, opData);
bytes memory reencoded;
if (_randomChance(2)) {
reencoded = LibERC7579.reencodeBatch(executionData, opData);
} else {
reencoded = abi.encode(abi.decode(executionData, (Call[])), opData);
}
_checkMemory(reencoded);
return this.decodeBatchAndOpData(reencoded);
if (_randomChance(2)) {
return this.decodeBatchAndOpData(reencoded);
} else {
return abi.decode(reencoded, (Call[], bytes));
}
}

function decodeBatch(bytes calldata executionData) public pure returns (Call[] memory) {
Expand Down

0 comments on commit 2f8179f

Please sign in to comment.