Skip to content

Commit

Permalink
add diffs
Browse files Browse the repository at this point in the history
  • Loading branch information
m-yahya committed Oct 30, 2023
1 parent b1bd9aa commit 8df7c12
Show file tree
Hide file tree
Showing 8 changed files with 268 additions and 70 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ jobs:
echo "PROJECT=${{ matrix.flavor_id }}-${{ matrix.demo_name }}" >> $GITHUB_ENV
echo "VERSION=dev.$version" >> $GITHUB_ENV
echo "WORKER_IMAGE_TAG=integritee-worker:dev.$version" >> $GITHUB_ENV
echo "INTEGRITEE_NODE=integritee-node:1.1.3.$version" >> $GITHUB_ENV
echo "INTEGRITEE_NODE=integritee-node-dev:1.1.0.$version" >> $GITHUB_ENV
echo "CLIENT_IMAGE_TAG=integritee-cli:dev.$version" >> $GITHUB_ENV
if [[ ${{ matrix.sgx_mode }} == 'HW' ]]; then
echo "SGX_PROVISION=/dev/sgx/provision" >> $GITHUB_ENV
Expand Down Expand Up @@ -227,8 +227,8 @@ jobs:
fi
docker tag integritee-worker-${{ matrix.flavor_id }}-${{ github.sha }} ${{ env.WORKER_IMAGE_TAG }}
docker tag integritee-cli-client-${{ matrix.flavor_id }}-${{ github.sha }} ${{ env.CLIENT_IMAGE_TAG }}
docker pull integritee/integritee-node:1.1.3
docker tag integritee/integritee-node:1.1.3 ${{ env.INTEGRITEE_NODE }}
docker pull integritee/integritee-node-dev:1.1.0
docker tag integritee/integritee-node-dev:1.1.0 ${{ env.INTEGRITEE_NODE }}
docker images --all
##
Expand Down Expand Up @@ -304,10 +304,6 @@ jobs:
mode: teeracle
sgx_mode: HW
additional_features: dcap
- flavor_id: sidechain
mode: sidechain
sgx_mode: HW
additional_features: dcap

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -401,15 +397,15 @@ jobs:
name: integritee-worker-teeracle-${{ github.ref_name }}.tar.gz
path: .

- name: Download Worker Image
uses: actions/download-artifact@v3
with:
name: integritee-worker-sidechain-${{ github.ref_name }}.tar.gz
path: .

#
# Temporary comment out until we decide what to release
#
# - name: Download Integritee Service
# uses: actions/download-artifact@v3
# with:
# name: integritee-worker-sidechain-${{ github.sha }}
# path: integritee-worker-tmp

# - name: Download Integritee Client
# uses: actions/download-artifact@v3
# with:
Expand Down Expand Up @@ -451,7 +447,6 @@ jobs:
name: Docker ${{ github.ref_name }}
files: |
integritee-worker-teeracle-${{ github.ref_name }}.tar.gz
integritee-worker-sidechain-${{ github.ref_name }}.tar.gz
integritee-client
integritee-demo-validateer
enclave.signed.so
43 changes: 0 additions & 43 deletions .github/workflows/publish-docker-sidechain.yml

This file was deleted.

22 changes: 14 additions & 8 deletions app-libs/stf/src/trusted_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,14 +286,20 @@ where
})?;
}

let orders: Vec<Order> = serde_json::from_str(&orders_string).map_err(|err| {
StfError::Dispatch(format!("Error serializing to JSON: {}", err))
})?;
let parsed_orders: Vec<Order> =
serde_json::from_str(&orders_string).map_err(|err| {
StfError::Dispatch(format!("Error serializing to JSON: {}", err))
})?;

let first_order = parsed_orders
.get(0)
.ok_or_else(|| StfError::Dispatch(format!("No [valid]orders supplied.")))?;

let market_input = MarketInput { orders: orders.clone() };
let orders_encoded: Vec<Vec<u8>> = orders.iter().map(|o| o.encode()).collect();
let timestamp = &first_order.time_slot;

let timestamp = &orders[0].time_slot;
let market_input = MarketInput { orders: parsed_orders.clone() };
let orders_encoded: Vec<Vec<u8>> =
parsed_orders.iter().map(|o| o.encode()).collect();

let orders_path = format!("{}/{}.json", ORDERS_DIR, timestamp);

Expand All @@ -305,7 +311,7 @@ where
let order_merkle_root = merkle_root::<Keccak256, _>(orders_encoded);
let pay_as_bid: MarketOutput = pay_as_bid_matching(&market_input);

write_orders(timestamp, &orders)?;
write_orders(timestamp, &parsed_orders)?;

write_results(timestamp, pay_as_bid)?;

Expand All @@ -314,7 +320,7 @@ where
// sp::io::set(storage_map_key());

sp_io::storage::set(
&merkle_roots_map_key(orders[0].time_slot.clone()),
&merkle_roots_map_key(timestamp.to_string()),
&order_merkle_root.encode(),
);

Expand Down
7 changes: 5 additions & 2 deletions cli/src/trusted_base_cli/commands/pay_as_bid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl PayAsBidCommand {
Ok(res) => Ok(CliResultOk::PayAsBidOutput(res)),
Err(e) => {
log::error!("Error: {}", e);
Err(CliError::TrustedOp { msg: "Error savings Orders".into() })
Err(CliError::TrustedOp { msg: format!("Error in saving Orders: {:?}", e) })
},
}
}
Expand All @@ -68,7 +68,10 @@ pub(crate) fn pay_as_bid(
match res {
Ok(opt) => match opt {
Some(_results) => Ok(Some(_results)),
None => Ok(None),
None => {
println!("CLI None pay_as_bid None block");
Ok(None)
},
},
Err(err) => {
log::error!("Error in saving Orders: {}", err);
Expand Down
2 changes: 2 additions & 0 deletions core/parentchain/block-importer/src/block_importer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ impl<
for (signed_block, raw_events) in
blocks_to_import.into_iter().zip(events_to_import.into_iter())
{
// Check if there are any extrinsics in the to-be-imported block that we sent and cached in the light-client before.
// If so, remove them now from the cache.
if let Err(e) = self
.validator_accessor
.execute_mut_on_validator(|v| v.submit_block(&signed_block))
Expand Down
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

* Make sure you have installed Docker (version >= `2.0.0`) with [Docker Compose](https://docs.docker.com/compose/install/). On Windows, this can be Docker Desktop with WSL 2 integration.
* In case you also build the worker directly, without docker (e.g. on a dev machine, running `make`), you should run `make clean` before running the docker build. Otherwise, it can occasionally lead to build errors.
* The node image version that is loaded in the `docker-compose.yml`, (e.g. `image: "integritee/integritee-node:1.1.3"`) needs to be compatible with the worker you're trying to build.
* The node image version that is loaded in the `docker-compose.yml`, (e.g. `image: "integritee/integritee-node-dev:1.0.32"`) needs to be compatible with the worker you're trying to build.
* Set export VERSION=dev
* `envsubst` should be installed, it is needed to replace the $VERSION in yaml files as docker compose doesn't support variables on service names.

Expand Down
4 changes: 2 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
"integritee-node-${VERSION}":
image: "${INTEGRITEE_NODE:-integritee/integritee-node:1.1.3}"
image: "${INTEGRITEE_NODE:-integritee/integritee-node-dev:1.1.0}"
hostname: integritee-node
devices:
- "${SGX_PROVISION:-/dev/null}:/dev/sgx/provision"
Expand All @@ -15,7 +15,7 @@ services:
interval: 10s
timeout: 10s
retries: 6
command: -lruntime=info -lteerex=debug --dev --rpc-methods unsafe --ws-external --rpc-external --ws-port 9912
command: --dev --rpc-methods unsafe --ws-external --rpc-external --ws-port 9912
#logging:
#driver: local
"integritee-worker-1-${VERSION}":
Expand Down
Loading

0 comments on commit 8df7c12

Please sign in to comment.