Skip to content

Ipfs verification bounty #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

whalelephant
Copy link
Contributor

WIP

}
}

pub fn verify(&mut self) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unsure, if we should use the self.verified field. Would it be an option to return here Resut<(),IPFS_ERROR> with the error being IPFS::ERROR::VERIFICATION? I believe this would be more idiomatic.

This is not a strong opinion though, rather just an input from my side. And if you think differently that is totally fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it depends on how the verification result is used / shared, if verification process will only be a one-off per content then I agree with you.

Copy link
Contributor

@clangenb clangenb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my perspective this looks really good.
I only made a little comment.

I haven't taken a look at your no_std forks though, although if they compile to no_std, they are good enough from my point of view.

@whalelephant whalelephant changed the title WIP: Ipfs verification bounty Ipfs verification bounty Aug 24, 2020
@brenzi
Copy link
Collaborator

brenzi commented Aug 25, 2020

the CI error currently is

Building the enclave

make -C ./enclave/

make[1]: Entering directory '/opt/jenkins/workspace/straTEE_substraTEE-worker_PR-166/enclave'

cargo build --release

    Updating git submodule `https://github.com/WebAssembly/testsuite`

    Updating git repository `https://github.com/mesalock-linux/rust-base58-sgx`

    Updating git repository `https://github.com/mesalock-linux/rust-base64-sgx`

    Updating git repository `https://github.com/mesalock-linux/chrono-sgx`

    Updating git repository `https://github.com/whalelephant/rust-cid`

    Updating git repository `https://github.com/whalelephant/rust-ipfs`

    Updating git repository `https://github.com/whalelephant/rust-multibase`

    Updating git repository `https://github.com/mesalock-linux/num-bigint-sgx`

    Updating git repository `https://github.com/mesalock-linux/rustls`

    Updating git repository `https://github.com/mesalock-linux/serde-sgx`

    Updating git repository `https://github.com/mesalock-linux/serde-json-sgx`

    Updating git repository `https://github.com/mesalock-linux/webpki`

error: failed to get `webpki` as a dependency of package `substratee-worker-enclave v0.6.5-sub2.0.0-alpha.7 (/opt/jenkins/workspace/straTEE_substraTEE-worker_PR-166/enclave)`


Caused by:

  failed to load source for dependency `webpki`


Caused by:

  Unable to update https://github.com/mesalock-linux/webpki?branch=mesalock_sgx#ab35cad4


Caused by:

  failed to clone into: /root/.cargo/git/db/webpki-bb08b032f0d22abc


Caused by:

  SSL error: unknown error; class=Ssl (16)

Makefile:50: recipe for target 'libenclave.a' failed

make[1]: *** [libenclave.a] Error 101

make[1]: Leaving directory '/opt/jenkins/workspace/straTEE_substraTEE-worker_PR-166/enclave'

Makefile:200: recipe for target 'enclave' failed

make: *** [enclave] Error 2

script returned exit code 2

I'll try to build your branch manually. later.

@whalelephant
Copy link
Contributor Author

whalelephant commented Sep 1, 2020

Hi, @brenzi were you able to build this?

@brenzi
Copy link
Collaborator

brenzi commented Sep 1, 2020

@whalelephant I'm able to build this without problems. We'll have to check our CI setup on our side. Sorry for the inconvenience.

I scanned the code quickly and I think it looks very clean and at first sight aims in the right direction.

A unit test seems to crash:

# start ipfs daemon
# start substraTEE-node --dev
./substratee-worker test --unit
*** Starting Test enclave
Running unit Tests

start running tests
testing state::test_encrypted_state_io_works ... ok!
testing ipfs::test_creates_ipfs_content_struct_works ... ok!
Illegal instruction (core dumped)

This doesn't happen on master, so I guess it happens somewhere in your unit test?

@whalelephant
Copy link
Contributor Author

Hi, thanks for the message, I am not sure because I can't reproduce the error when running the unit tests. Perhaps we have different env / builds, I will try to detail what I have on my side below and hopefully we can isolate the problem.

docker:

image: scssubstratee/substratee*dev:18.04-2.9.1-1.1.2
docker volume mapped to repo with both substratee-node ref: b2bf28b5a4581b9efa5b8ce2ef5984ef89634d5e and substratee-worker (current branch)

worker + enclave builds

cd work/substratee-worker
make SGX_MODE=SW SGX_DEBUG=1
cd bin
./substratee-worker test --unit

# from logs
# root@ce299945027a:~/work/substratee-worker/bin# ./substratee-worker test --unit
# *** Starting Test enclave
# Running unit Tests

# start running tests
# testing state::test_encrypted_state_io_works ... ok!
# testing ipfs::test_creates_ipfs_content_struct_works ... ok!
# testing ipfs::test_verification_ok_for_correct_content ... ok!
# testing ipfs::test_verification_fails_for_incorrect_content ... ok!
# testing test_ocall_read_write_ipfs ... ok!
# testing test_ocall_worker_request ... ok!

# test result ok. 6 tested, 6 passed, 0 failed
# [+] unit_test ended!
# [+] All tests ended!

node

cd work/substratee-node
./target/release/substratee-node --dev

ipfs

ipfs init
ipfs daemon

All the above are executed inside the docker image

@brenzi
Copy link
Collaborator

brenzi commented Sep 1, 2020

thanks for these details. I'll reproduce.

Is this PR ready for acceptance test vs. issue #70 from your perspective?

@electronix
Copy link
Contributor

@whalelephant I just re-started the build of this PR. Building is fine, but clippy is complaining with one warning:

ipfs.rs:46 - Matching on Somewithok() is redundant.

If you can fix this last issue, CI will be happy.

@whalelephant
Copy link
Contributor Author

thanks for these details. I'll reproduce.

Is this PR ready for acceptance test vs. issue #70 from your perspective?

Hi @brenzi , yes I think it should be ready for review. thanks!

@brenzi brenzi merged commit ee2eb13 into integritee-network:master Sep 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants