Skip to content

Commit

Permalink
feat: check bytecode in creation
Browse files Browse the repository at this point in the history
  • Loading branch information
ashitakah committed Jul 13, 2024
1 parent 505e919 commit a578b07
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions solidity/test/unit/Oracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ contract BaseTest is Test, Helpers {
// Mock IPFS hash
bytes32 internal _ipfsHash = bytes32('QmR4uiJH654k3Ta2uLLQ8r');

// Mock target call contract
address public target = _mockContract('target');

// Events
event RequestCreated(bytes32 indexed _requestId, IOracle.Request _request, bytes32 _ipfsHash, uint256 _blockNumber);
event ResponseProposed(
Expand Down Expand Up @@ -131,12 +134,11 @@ contract Oracle_Unit_CreateRequest is BaseTest {
bytes calldata _requestData,
bytes calldata _responseData,
bytes calldata _disputeData,
bytes calldata _resolutionData,
bytes calldata _finalityData
bytes calldata _resolutionData
) public setResolutionAndFinality(_useResolutionAndFinality) {
uint256 _initialNonce = oracle.totalRequestCount();

bytes memory _finalityDataEncoded = abi.encode(finalityModule, _finalityData);
bytes memory _finalityDataEncoded = abi.encode(target, mockRequest.finalityModuleData);

// Create the request
mockRequest.requestModuleData = _requestData;
Expand Down Expand Up @@ -226,8 +228,7 @@ contract Oracle_Unit_CreateRequests is BaseTest {
function test_createRequests(
bytes calldata _requestData,
bytes calldata _responseData,
bytes calldata _disputeData,
bytes calldata _finalityData
bytes calldata _disputeData
) public {
uint256 _initialNonce = oracle.totalRequestCount();
uint256 _requestsAmount = 5;
Expand All @@ -236,7 +237,7 @@ contract Oracle_Unit_CreateRequests is BaseTest {
bool _useResolutionAndFinality = _requestData.length % 2 == 0;
bytes32[] memory _ipfsHashes = new bytes32[](_requestsAmount);

bytes memory _finalityDataEncoded = abi.encode(finalityModule, _finalityData);
bytes memory _finalityDataEncoded = abi.encode(target, mockRequest.finalityModuleData);

// Generate requests batch
for (uint256 _i = 0; _i < _requestsAmount; _i++) {
Expand Down Expand Up @@ -293,16 +294,15 @@ contract Oracle_Unit_CreateRequests is BaseTest {
function test_createRequestsWithNonceZero(
bytes calldata _requestData,
bytes calldata _responseData,
bytes calldata _disputeData,
bytes calldata _finalityData
bytes calldata _disputeData
) public {
uint256 _initialNonce = oracle.totalRequestCount();
uint256 _requestsAmount = 5;
IOracle.Request[] memory _requests = new IOracle.Request[](_requestsAmount);
bytes32[] memory _precalculatedIds = new bytes32[](_requestsAmount);
bytes32[] memory _ipfsHashes = new bytes32[](_requestsAmount);

bytes memory _finalityDataEncoded = abi.encode(finalityModule, _finalityData);
bytes memory _finalityDataEncoded = abi.encode(target, mockRequest.finalityModuleData);

mockRequest.requestModuleData = _requestData;
mockRequest.responseModuleData = _responseData;
Expand Down

0 comments on commit a578b07

Please sign in to comment.