Skip to content

Commit

Permalink
upgrade v8
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Aug 9, 2021
1 parent 80cf617 commit cfaceae
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion contracts/contracts/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ contract Config {
/// @dev Expiration delta for priority request to be satisfied (in seconds)
/// @dev NOTE: Priority expiration should be > (EXPECT_VERIFICATION_IN * BLOCK_PERIOD)
/// @dev otherwise incorrect block with priority op could not be reverted.
uint256 internal constant PRIORITY_EXPIRATION_PERIOD = 3 days;
uint256 internal constant PRIORITY_EXPIRATION_PERIOD = 7 days;

/// @dev Expiration delta for priority request to be satisfied (in ETH blocks)
uint256 internal constant PRIORITY_EXPIRATION =
Expand Down
2 changes: 1 addition & 1 deletion core/bin/key_generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn main() {
Command::Keys => {
make_plonk_exodus_verify_key();
make_plonk_blocks_verify_keys(config.clone());
make_recursive_verification_keys(config.clone());
//make_recursive_verification_keys(config.clone());
make_sample_proofs(config).expect("Failed to generate sample proofs");
}
Command::Contract => {
Expand Down
12 changes: 7 additions & 5 deletions core/lib/circuit/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1834,11 +1834,13 @@ impl<'a, E: RescueEngine + JubjubEngine> ZkSyncCircuit<'a, E> {

//keys are same or account is empty

let is_pubkey_correct = Boolean::xor(
cs.namespace(|| "keys are same xor account is empty"),
&is_pub_equal_to_previous,
&is_account_empty,
)?;
// or instead of xor
let is_pubkey_correct = Boolean::and(
cs.namespace(|| "keys are same or account is empty"),
&is_pub_equal_to_previous.not(),
&is_account_empty.not(),
)?
.not();

is_valid_flags.push(is_pubkey_correct);

Expand Down
34 changes: 34 additions & 0 deletions core/lib/circuit/src/witness/tests/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,40 @@ fn test_deposit_in_empty_leaf() {
);
}

/// Checks that deposit can be applied to a new account if deposit address is zero.
/// Here we generate an empty ZkSyncState (with no accounts), and make a deposit to a new account.
#[test]
#[ignore]
fn test_deposit_zero_address() {
// Input data.
let mut account = WitnessTestAccount::new(AccountId(1), 1); // Will not be included into ZkSyncState
account.set_empty_address();
account.set_empty_pubkey_hash();

let accounts = vec![account];

let deposit_op = DepositOp {
priority_op: Deposit {
from: accounts[0].account.address,
token: TokenId(0),
amount: BigUint::from(1u32),
to: accounts[0].account.address,
},
account_id: accounts[0].id,
};

generic_test_scenario::<DepositWitness<Bn256>, _>(
&accounts,
deposit_op,
(),
|plasma_state, op| {
<ZkSyncState as TxHandler<Deposit>>::apply_op(plasma_state, op)
.expect("Deposit failed");
vec![]
},
);
}

/// Checks that deposit can be applied to an existing account.
/// Here we generate a ZkSyncState with one account, and make a deposit to this account.
#[test]
Expand Down
5 changes: 5 additions & 0 deletions core/lib/circuit/src/witness/tests/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ impl WitnessTestAccount {
self.account.pub_key_hash = Default::default();
}

pub fn set_empty_address(&mut self) {
self.zksync_account.address = Default::default();
self.account.address = Default::default();
}

pub fn new_empty(id: AccountId) -> Self {
Self::new(id, 0)
}
Expand Down
Binary file not shown.

0 comments on commit cfaceae

Please sign in to comment.