From aaa7968da52023a2f9fd1565f3d22e03655ac48b Mon Sep 17 00:00:00 2001 From: Zehui Zheng Date: Wed, 22 Nov 2023 01:21:36 +0800 Subject: [PATCH] feat!: remove `LibInput` --- .../rollups/.changeset/late-masks-raise.md | 5 ++ .../rollups/contracts/library/LibInput.sol | 47 ------------------- 2 files changed, 5 insertions(+), 47 deletions(-) create mode 100644 onchain/rollups/.changeset/late-masks-raise.md delete mode 100644 onchain/rollups/contracts/library/LibInput.sol diff --git a/onchain/rollups/.changeset/late-masks-raise.md b/onchain/rollups/.changeset/late-masks-raise.md new file mode 100644 index 00000000..766aa4e4 --- /dev/null +++ b/onchain/rollups/.changeset/late-masks-raise.md @@ -0,0 +1,5 @@ +--- +"@cartesi/rollups": major +--- + +Library `LibInput` is removed. diff --git a/onchain/rollups/contracts/library/LibInput.sol b/onchain/rollups/contracts/library/LibInput.sol deleted file mode 100644 index 1cae79cb..00000000 --- a/onchain/rollups/contracts/library/LibInput.sol +++ /dev/null @@ -1,47 +0,0 @@ -// (c) Cartesi and individual authors (see AUTHORS) -// SPDX-License-Identifier: Apache-2.0 (see LICENSE) - -pragma solidity ^0.8.8; - -import {CanonicalMachine} from "../common/CanonicalMachine.sol"; - -/// @title Input Library -library LibInput { - using CanonicalMachine for CanonicalMachine.Log2Size; - - /// @notice Raised when input is larger than the machine limit. - error InputSizeExceedsLimit(); - - /// @notice Summarize input data in a single hash. - /// @param sender `msg.sender` - /// @param blockNumber `block.number` - /// @param blockTimestamp `block.timestamp` - /// @param input The input blob - /// @param inputIndex The index of the input in the input box - /// @return The input hash - function computeInputHash( - address sender, - uint256 blockNumber, - uint256 blockTimestamp, - bytes calldata input, - uint256 inputIndex - ) internal pure returns (bytes32) { - if (input.length > CanonicalMachine.INPUT_MAX_SIZE) { - revert InputSizeExceedsLimit(); - } - - bytes32 keccakMetadata = keccak256( - abi.encode( - sender, - blockNumber, - blockTimestamp, - 0, //TODO decide how to deal with epoch index - inputIndex // input index in the input box - ) - ); - - bytes32 keccakInput = keccak256(input); - - return keccak256(abi.encode(keccakMetadata, keccakInput)); - } -}