-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forge cheatcodes to set confidential inputs (#31)
* Forge cheatcodes to set confidential inputs * Update README
- Loading branch information
Showing
6 changed files
with
144 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.8; | ||
|
||
contract ConfidentialInputsWrapper { | ||
bytes confidentialInputs; | ||
|
||
function setConfidentialInputs(bytes memory _confidentialInputs) public { | ||
confidentialInputs = _confidentialInputs; | ||
} | ||
|
||
function resetConfidentialInputs() public { | ||
confidentialInputs = ""; | ||
} | ||
|
||
fallback() external { | ||
// copy bytes from storage to memory | ||
bytes memory msgdata = new bytes(confidentialInputs.length); | ||
for (uint256 i = 0; i < confidentialInputs.length; i++) { | ||
msgdata[i] = confidentialInputs[i]; | ||
} | ||
|
||
assembly { | ||
let location := msgdata | ||
let length := mload(msgdata) | ||
return(add(location, 0x20), length) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters