-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
P-872 basic tests for contracts (#2845)
* Flattening contracts * fix omports * init tests * add compile.json * fix params * fix assertionId * try encryptWithTeeShieldingKey * fix encryptedSecrets * add ci shell * fmt * add lit-tee-vc-contracts-test * rename * chmod +x * source /root/.bashrc * install git * remove sudo * fix shell scripts * ls * ls one more * ls one more * add volumes * cp contracts&&compile * remove hardcode json * fix entrypoint * fix compilation * try to fix assertionId * testing:cli encrypt * fmt * testing:cli response * testing:create assertionId with secretsEncryptedByCli * check:Is cli encrypt the same as ts encrypt * add sleep * update README * merge assertion tests shell * fix docker yml * identity-linking via cli * remove unused code * add developerCommittee * rename scripts name * add alice to developerCommittee * fix copy-contracts * identity-linking using di call
- Loading branch information
Showing
17 changed files
with
703 additions
and
11 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
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,26 @@ | ||
services: | ||
lit-assertion-contracts-test: | ||
image: litentry/identity-cli:latest | ||
container_name: lit-assertion-contracts-test | ||
volumes: | ||
- ../ts-tests:/ts-tests | ||
- ../client-api:/client-api | ||
- ../cli:/usr/local/worker-cli | ||
- ../litentry/core/assertion-build/src/dynamic/contracts:/assertion-contracts | ||
|
||
build: | ||
context: .. | ||
dockerfile: build.Dockerfile | ||
target: deployed-client | ||
depends_on: | ||
litentry-node: | ||
condition: service_healthy | ||
litentry-worker-1: | ||
condition: service_healthy | ||
networks: | ||
- litentry-test-network | ||
entrypoint: "bash -c '/usr/local/worker-cli/lit_ts_integration_test.sh assertion_contracts.test.ts 2>&1' " | ||
restart: "no" | ||
networks: | ||
litentry-test-network: | ||
driver: bridge |
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
85 changes: 85 additions & 0 deletions
85
tee-worker/litentry/core/assertion-build/src/dynamic/contracts/openzeppelin/Strings.sol
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,85 @@ | ||
// SPDX-License-Identifier: MIT | ||
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) | ||
|
||
pragma solidity ^0.8.0; | ||
|
||
import "./math/Math.sol"; | ||
import "./math/SignedMath.sol"; | ||
|
||
/** | ||
* @dev String operations. | ||
*/ | ||
library Strings { | ||
bytes16 private constant _SYMBOLS = "0123456789abcdef"; | ||
uint8 private constant _ADDRESS_LENGTH = 20; | ||
|
||
/** | ||
* @dev Converts a `uint256` to its ASCII `string` decimal representation. | ||
*/ | ||
function toString(uint256 value) internal pure returns (string memory) { | ||
unchecked { | ||
uint256 length = Math.log10(value) + 1; | ||
string memory buffer = new string(length); | ||
uint256 ptr; | ||
/// @solidity memory-safe-assembly | ||
assembly { | ||
ptr := add(buffer, add(32, length)) | ||
} | ||
while (true) { | ||
ptr--; | ||
/// @solidity memory-safe-assembly | ||
assembly { | ||
mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) | ||
} | ||
value /= 10; | ||
if (value == 0) break; | ||
} | ||
return buffer; | ||
} | ||
} | ||
|
||
/** | ||
* @dev Converts a `int256` to its ASCII `string` decimal representation. | ||
*/ | ||
function toString(int256 value) internal pure returns (string memory) { | ||
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); | ||
} | ||
|
||
/** | ||
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. | ||
*/ | ||
function toHexString(uint256 value) internal pure returns (string memory) { | ||
unchecked { | ||
return toHexString(value, Math.log256(value) + 1); | ||
} | ||
} | ||
|
||
/** | ||
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. | ||
*/ | ||
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { | ||
bytes memory buffer = new bytes(2 * length + 2); | ||
buffer[0] = "0"; | ||
buffer[1] = "x"; | ||
for (uint256 i = 2 * length + 1; i > 1; --i) { | ||
buffer[i] = _SYMBOLS[value & 0xf]; | ||
value >>= 4; | ||
} | ||
require(value == 0, "Strings: hex length insufficient"); | ||
return string(buffer); | ||
} | ||
|
||
/** | ||
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. | ||
*/ | ||
function toHexString(address addr) internal pure returns (string memory) { | ||
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); | ||
} | ||
|
||
/** | ||
* @dev Returns true if the two strings are equal. | ||
*/ | ||
function equal(string memory a, string memory b) internal pure returns (bool) { | ||
return keccak256(bytes(a)) == keccak256(bytes(b)); | ||
} | ||
} |
Oops, something went wrong.