traces and docs
This commit is contained in:
parent
21ea84a747
commit
fc20534577
93
rewrite/Cargo.lock
generated
93
rewrite/Cargo.lock
generated
@ -307,6 +307,55 @@ dependencies = [
|
|||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstream"
|
||||||
|
version = "0.6.15"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"anstyle-parse",
|
||||||
|
"anstyle-query",
|
||||||
|
"anstyle-wincon",
|
||||||
|
"colorchoice",
|
||||||
|
"is_terminal_polyfill",
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle"
|
||||||
|
version = "1.0.8"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-parse"
|
||||||
|
version = "0.2.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb"
|
||||||
|
dependencies = [
|
||||||
|
"utf8parse",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-query"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a"
|
||||||
|
dependencies = [
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anstyle-wincon"
|
||||||
|
version = "3.0.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8"
|
||||||
|
dependencies = [
|
||||||
|
"anstyle",
|
||||||
|
"windows-sys 0.52.0",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anyhow"
|
name = "anyhow"
|
||||||
version = "1.0.89"
|
version = "1.0.89"
|
||||||
@ -1123,6 +1172,12 @@ dependencies = [
|
|||||||
"cc",
|
"cc",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorchoice"
|
||||||
|
version = "1.0.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "combine"
|
name = "combine"
|
||||||
version = "3.8.1"
|
version = "3.8.1"
|
||||||
@ -1607,6 +1662,16 @@ dependencies = [
|
|||||||
"syn 2.0.79",
|
"syn 2.0.79",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "env_filter"
|
||||||
|
version = "0.1.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "4f2c92ceda6ceec50f43169f9ee8424fe2db276791afde7b2cd8bc084cb376ab"
|
||||||
|
dependencies = [
|
||||||
|
"log",
|
||||||
|
"regex",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "env_logger"
|
name = "env_logger"
|
||||||
version = "0.9.3"
|
version = "0.9.3"
|
||||||
@ -1620,6 +1685,19 @@ dependencies = [
|
|||||||
"termcolor",
|
"termcolor",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "env_logger"
|
||||||
|
version = "0.11.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e13fa619b91fb2381732789fc5de83b45675e882f66623b7d8cb4f643017018d"
|
||||||
|
dependencies = [
|
||||||
|
"anstream",
|
||||||
|
"anstyle",
|
||||||
|
"env_filter",
|
||||||
|
"humantime",
|
||||||
|
"log",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "equivalent"
|
name = "equivalent"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
@ -1897,6 +1975,7 @@ dependencies = [
|
|||||||
"base64 0.22.1",
|
"base64 0.22.1",
|
||||||
"chrono",
|
"chrono",
|
||||||
"dashmap 6.1.0",
|
"dashmap 6.1.0",
|
||||||
|
"env_logger 0.11.5",
|
||||||
"hex",
|
"hex",
|
||||||
"hyper 1.4.1",
|
"hyper 1.4.1",
|
||||||
"hyper-rustls 0.27.3",
|
"hyper-rustls 0.27.3",
|
||||||
@ -2347,6 +2426,12 @@ dependencies = [
|
|||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "is_terminal_polyfill"
|
||||||
|
version = "1.70.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itertools"
|
name = "itertools"
|
||||||
version = "0.10.5"
|
version = "0.10.5"
|
||||||
@ -4051,7 +4136,7 @@ version = "2.0.13"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c6b996befdb2bdbd816524fc7afe0e158fced33ff61c36ab29ae803c0462455d"
|
checksum = "c6b996befdb2bdbd816524fc7afe0e158fced33ff61c36ab29ae803c0462455d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"env_logger",
|
"env_logger 0.9.3",
|
||||||
"lazy_static",
|
"lazy_static",
|
||||||
"log",
|
"log",
|
||||||
]
|
]
|
||||||
@ -5737,6 +5822,12 @@ version = "0.7.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "utf8parse"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "1.10.0"
|
version = "1.10.0"
|
||||||
|
@ -38,6 +38,7 @@ base64 = "0.22"
|
|||||||
lazy_static = "1.5"
|
lazy_static = "1.5"
|
||||||
# TODO: create a feature for testing, make occlum feature optional and added only if not compiling for testing
|
# TODO: create a feature for testing, make occlum feature optional and added only if not compiling for testing
|
||||||
occlum-ratls = { git = "ssh://git@gitea.detee.cloud/vfaychuk/occlum-ratls", features = ["tonic", "occlum"] }
|
occlum-ratls = { git = "ssh://git@gitea.detee.cloud/vfaychuk/occlum-ratls", features = ["tonic", "occlum"] }
|
||||||
|
env_logger = "0.11"
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
tonic-build = "0.12"
|
tonic-build = "0.12"
|
||||||
|
@ -7,27 +7,11 @@ To build and package the challenge you will need the docker environment.
|
|||||||
Do the following steps to build the challenge:
|
Do the following steps to build the challenge:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Notice that there is no SGX device mounted
|
# Notice that there is no SGX device mounted, run inside rewrite directory
|
||||||
docker run --rm --name packager -it -v /path/to/rewrite:/root/rewrite occlum/occlum:latest-ubuntu20.04
|
docker run --rm --name packager -it -v .:/root/rewrite occlum/occlum:latest-ubuntu20.04
|
||||||
# Inside the docker container do env preparation to build the image
|
# Inside the docker container run package.sh and follow its instructions
|
||||||
rustup install stable-x86_64-unknown-linux-gnu
|
cd /root/rewrite && ./scripts/package.sh --prep
|
||||||
rustup default stable
|
exit # Feel free to exit the container
|
||||||
rustup target add x86_64-unknown-linux-musl
|
|
||||||
|
|
||||||
mkdir -p /root/.ssh
|
|
||||||
|
|
||||||
# Outside the container copy the ssh keys to the container to download occlum-ratls dependency
|
|
||||||
docker cp ~/.ssh/config packager:/root/.ssh/config
|
|
||||||
docker cp ~/.ssh/gitea_ed25519 packager:/root/.ssh/gitea_ed25519
|
|
||||||
|
|
||||||
apt update && apt install openssh-client
|
|
||||||
ssh-keyscan -H gitea.detee.cloud >> ~/.ssh/known_hosts
|
|
||||||
chown -R root:root /root/.ssh
|
|
||||||
chmod 600 /root/.ssh/gitea_ed25519
|
|
||||||
|
|
||||||
cd /root/rewrite && ./scripts/package.sh
|
|
||||||
# Feel free to exit the container once the challenge was packaged
|
|
||||||
exit
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing the challenge
|
## Testing the challenge
|
||||||
|
@ -8,7 +8,7 @@ prerequisites=$1
|
|||||||
|
|
||||||
if [ "$prerequisites" == "--prep" ]; then
|
if [ "$prerequisites" == "--prep" ]; then
|
||||||
echo "Preparing the packager environment"
|
echo "Preparing the packager environment"
|
||||||
apt update && apt install openssh-client
|
apt update && apt install -y openssh-client
|
||||||
rustup install stable-x86_64-unknown-linux-gnu
|
rustup install stable-x86_64-unknown-linux-gnu
|
||||||
rustup default stable
|
rustup default stable
|
||||||
rustup target add x86_64-unknown-linux-musl
|
rustup target add x86_64-unknown-linux-musl
|
||||||
@ -20,8 +20,7 @@ if [ "$prerequisites" == "--prep" ]; then
|
|||||||
while true; do
|
while true; do
|
||||||
echo -n "." && sleep 1
|
echo -n "." && sleep 1
|
||||||
if [ -e ~/.ssh/config ] && [ -e ~/.ssh/gitea_ed25519 ]; then
|
if [ -e ~/.ssh/config ] && [ -e ~/.ssh/gitea_ed25519 ]; then
|
||||||
echo -n "done"
|
echo && break
|
||||||
break
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -64,7 +64,7 @@ docker run --device /dev/sgx/enclave \
|
|||||||
-d hacker-challenge:latest
|
-d hacker-challenge:latest
|
||||||
while true; do
|
while true; do
|
||||||
echo -n "." && sleep 1
|
echo -n "." && sleep 1
|
||||||
docker logs hacker-challenge | grep "SOL" && break
|
docker logs hacker-challenge | grep "SOL" && echo && break
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Sending SOL to the root and waiting for the mint"
|
echo "Sending SOL to the root and waiting for the mint"
|
||||||
@ -72,19 +72,17 @@ address=$(docker logs hacker-challenge | grep 'SOL' | awk '{ print $NF }')
|
|||||||
"${script_dir}"/mint_sol "${address}"
|
"${script_dir}"/mint_sol "${address}"
|
||||||
while true; do
|
while true; do
|
||||||
echo -n "." && sleep 1
|
echo -n "." && sleep 1
|
||||||
docker logs hacker-challenge | grep "Mint created" && break
|
docker logs hacker-challenge | grep "Mint created" && echo && break
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "Creating the cluster"
|
echo "Creating the cluster"
|
||||||
for p in {31311..31320}; do
|
for p in {31311..31320}; do
|
||||||
echo -n "."
|
|
||||||
docker run --device /dev/sgx/enclave \
|
docker run --device /dev/sgx/enclave \
|
||||||
--device /dev/sgx/provision \
|
--device /dev/sgx/provision \
|
||||||
--env INIT_NODES="172.17.0.2 172.17.0.3 172.17.0.4" \
|
--env INIT_NODES="172.17.0.2 172.17.0.3 172.17.0.4" \
|
||||||
--name "hacker-challenge${p}" -p "${p}:31372" \
|
--name "hacker-challenge${p}" -p "${p}:31372" \
|
||||||
-d hacker-challenge:latest
|
-d hacker-challenge:latest
|
||||||
done
|
done
|
||||||
|
|
||||||
sleep 5 # Wait for the cluster to start
|
sleep 5 # Wait for the cluster to start
|
||||||
|
|
||||||
echo "Running the test mint"
|
echo "Running the test mint"
|
||||||
|
@ -75,6 +75,8 @@ async fn get_sol_client() -> SolClient {
|
|||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
|
env_logger::init_from_env(env_logger::Env::default().default_filter_or("trace"));
|
||||||
|
|
||||||
let sol_client = get_sol_client().await;
|
let sol_client = get_sol_client().await;
|
||||||
let ds = Arc::new(Store::init(sol_client));
|
let ds = Arc::new(Store::init(sol_client));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user