Skip to content

Commit

Permalink
Fix solidity tests and ensure tests are run and that we can merge in …
Browse files Browse the repository at this point in the history
…main (#67)

This merges main into ciphernode_poc and fixes tests
  • Loading branch information
ryardley authored Sep 14, 2024
1 parent f8d0e23 commit f5e52ad
Show file tree
Hide file tree
Showing 47 changed files with 4,028 additions and 773 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ node_modules


# ciphernode
target
target

*.DS_Store
81 changes: 39 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,49 +17,46 @@ Enclave employs a modular architecture involving numerous actors and participant

```mermaid
sequenceDiagram
actor Requester
actor Data Providers
participant Users
participant Enclave
participant Ciphernode Registry
participant Ciphernodes
participant Computation Module
participant Execution Module
loop Each computation request
Requester ->> Enclave: Request computation
activate Enclave
Enclave ->> Ciphernode Registry: Select Committee
activate Ciphernode Registry
Ciphernode Registry -->> Ciphernodes: Key Setup
activate Ciphernodes
Ciphernodes -->> Ciphernode Registry: Publish shared keys
deactivate Ciphernodes
Ciphernode Registry -->> Enclave: Publish Committee
deactivate Ciphernode Registry
loop Each input
Data Providers ->> Enclave: Publish inputs
Enclave ->> Computation Module: Validate inputs
activate Computation Module
Computation Module -->> Enclave: 👌
deactivate Computation Module
end
Enclave ->> Execution Module: Request execution
activate Execution Module
Execution Module -->> Enclave: Publish ciphertext output
deactivate Execution Module
Enclave -->> Ciphernodes: Request plaintext output
activate Ciphernodes
Ciphernodes ->> Enclave: Publish plaintext output
deactivate Ciphernodes
Requester -->> Enclave: Get plaintext
Enclave -->> Requester: Returns plaintext
deactivate Enclave
end
participant CiphernodeRegistry
participant E3Program
participant ComputeProvider
participant InputValidator
participant DecryptionVerifier
Users->>Enclave: request(parameters)
Enclave->>E3Program: validate(e3ProgramParams)
E3Program-->>Enclave: inputValidator
Enclave->>ComputeProvider: validate(computeProviderParams)
ComputeProvider-->>Enclave: decryptionVerifier
Enclave->>CiphernodeRegistry: requestCommittee(e3Id, filter, threshold)
CiphernodeRegistry-->>Enclave: success
Enclave-->>Users: e3Id, E3 struct
Users->>Enclave: activate(e3Id)
Enclave->>CiphernodeRegistry: committeePublicKey(e3Id)
CiphernodeRegistry-->>Enclave: publicKey
Enclave->>Enclave: Set expiration and committeePublicKey
Enclave-->>Users: success
Users->>Enclave: publishInput(e3Id, data)
Enclave->>InputValidator: validate(msg.sender, data)
InputValidator-->>Enclave: input, success
Enclave->>Enclave: Store input
Enclave-->>Users: success
Users->>Enclave: publishCiphertextOutput(e3Id, data)
Enclave->>DecryptionVerifier: verify(e3Id, data)
DecryptionVerifier-->>Enclave: output, success
Enclave->>Enclave: Store ciphertextOutput
Enclave-->>Users: success
Users->>Enclave: publishPlaintextOutput(e3Id, data)
Enclave->>E3Program: verify(e3Id, data)
E3Program-->>Enclave: output, success
Enclave->>Enclave: Store plaintextOutput
Enclave-->>Users: success
```

## Security and Liability
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@
},
"scripts": {
"clean": "cd packages/evm && yarn clean",
"compile": "yarn evm:compile",
"compile": "yarn evm:compile && yarn ciphernode:build",
"lint": "yarn evm:lint",
"typechain": "yarn evm:typechain",
"test": "yarn evm:test",
"test": "yarn evm:test && yarn ciphernode:test",
"coverage": "yarn evm:coverage",
"ciphernode:test": "cd packages/ciphernode && cargo test",
"ciphernode:build": "cd packages/ciphernode && cargo build --release",
"evm:install": "cd packages/evm && yarn install",
"evm:compile": "cd packages/evm && yarn compile",
"evm:lint": "cd packages/evm && yarn lint",
Expand Down
4 changes: 4 additions & 0 deletions packages/evm/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MNEMONIC=
INFURA_KEY=

ETHERSCAN_API_KEY=
1 change: 0 additions & 1 deletion packages/evm/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ coverage
dist
node_modules
types
deployments

# files
*.env
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/.prettierrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trailingComma: "all"
overrides:
- files: "*.sol"
options:
compiler: "0.8.26"
compiler: "0.8.27"
parser: "solidity-parse"
tabWidth: 4
- files: "*.ts"
Expand Down
2 changes: 1 addition & 1 deletion packages/evm/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"plugins": ["prettier"],
"rules": {
"code-complexity": ["error", 8],
"compiler-version": ["error", ">=0.8.26"],
"compiler-version": ["error", ">=0.8.27"],
"func-visibility": ["error", { "ignoreConstructors": true }],
"max-line-length": ["error", 120],
"named-parameters-mapping": "warn",
Expand Down
12 changes: 12 additions & 0 deletions packages/evm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Enclave EVM

## To deploy

```
yarn deploy --network [network]
```

This will add the deployment information to the `./deployments` directory.

Be sure to configure your desired network in `hardhat.config.ts` before
deploying.
Loading

0 comments on commit f5e52ad

Please sign in to comment.