Skip to content

Commit

Permalink
Merge branch 'dev' into popzxc-920-refine-project-structure
Browse files Browse the repository at this point in the history
  • Loading branch information
popzxc committed Sep 18, 2020
2 parents a2e2b8a + 379189f commit 419d049
Show file tree
Hide file tree
Showing 51 changed files with 4,108 additions and 193 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
- name: init
run: zksync init

- name: zcli-tests
run: ci-zcli.sh

- name: integration-simple-full-exit
run: ci-integration-simple-fullexit.sh

Expand Down
70 changes: 35 additions & 35 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ yarn:
@cd infrastructure/explorer && yarn
@cd contracts && yarn
@cd core/tests/ts-tests && yarn
@cd infrastructure/zcli && yarn


# Helpers
Expand Down
40 changes: 40 additions & 0 deletions bin/ci-zcli.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

set -e
trap cat_logs EXIT
TIMEOUT_PID=""
SERVER_PID=""

function timeout() {
sleep 300
echo Timeout is reached
kill -s TERM "$1"
}

function cat_logs() {
exitcode=$?
echo Termination started

# Wait for server to finish any ongoing jobs
sleep 30

set +e
pkill -P $TIMEOUT_PID,$SERVER_PID
echo Server logs:
cat zcli-test-server.log

# Wait for server to be surely killed
sleep 10

exit $exitcode
}

timeout "$$" &
TIMEOUT_PID=$!

zksync server &> zcli-test-server.log &
SERVER_PID=$!

sleep 10
echo Performing zcli tests...
yarn --cwd infrastructure/zcli test
1 change: 1 addition & 0 deletions core/bin/data_restore/src/tree_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ impl TreeState {
fail_reason: None,
block_index: Some(block_index),
created_at: chrono::Utc::now(),
batch_id: None, // Currently `data_restore` is unable to restore `transaction <--> batch` relation
};
ops.push(ExecutedOperations::Tx(Box::new(exec_result)));
current_op_block_index + 1
Expand Down
8 changes: 4 additions & 4 deletions core/bin/server/src/api_server/event_notify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl OperationNotifier {
async fn check_op_executed_current_block(
&self,
op_id: ExecutedOpId,
) -> Result<Option<(BlockNumber, bool)>, failure::Error> {
) -> Result<Option<(BlockNumber, bool, Option<String>)>, failure::Error> {
let response = oneshot::channel();
self.state_keeper_requests
.clone()
Expand Down Expand Up @@ -263,7 +263,7 @@ impl OperationNotifier {

// Maybe it was executed already
if action == ActionType::COMMIT {
if let Some((block_number, _)) = self
if let Some((block_number, _, _)) = self
.check_op_executed_current_block(ExecutedOpId::PriorityOp(serial_id))
.await?
{
Expand Down Expand Up @@ -382,7 +382,7 @@ impl OperationNotifier {

// Maybe tx was executed already.
if action == ActionType::COMMIT {
if let Some((block_number, success)) = self
if let Some((block_number, success, fail_reason)) = self
.check_op_executed_current_block(ExecutedOpId::Transaction(hash.clone()))
.await?
{
Expand All @@ -392,7 +392,7 @@ impl OperationNotifier {
TransactionInfoResp {
executed: true,
success: Some(success),
fail_reason: None,
fail_reason,
block: Some(BlockInfo {
block_number: i64::from(block_number),
committed: true,
Expand Down
Loading

0 comments on commit 419d049

Please sign in to comment.