Skip to content

Commit

Permalink
fix gas counter tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Mar 17, 2021
1 parent e151566 commit 4c8005c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions core/lib/types/src/gas_counter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ mod tests {
let test_vector_commit = vec![
(
ZkSyncOp::from(change_pubkey_op.clone()),
CommitCost::CHANGE_PUBKEY_COST_ONCHAIN,
CommitCost::OLD_CHANGE_PUBKEY_COST_OFFCHAIN, // restore after [ZKS-554]
),
(ZkSyncOp::from(deposit_op.clone()), CommitCost::DEPOSIT_COST),
(
Expand Down Expand Up @@ -411,7 +411,7 @@ mod tests {
// Verify cost is 0, thus amount of operations is determined by the commit cost.
let amount_ops_in_block = (U256::from(TX_GAS_LIMIT)
- GasCounter::scale_up(gas_counter.commit_cost))
/ GasCounter::scale_up(U256::from(CommitCost::CHANGE_PUBKEY_COST_ONCHAIN));
/ GasCounter::scale_up(U256::from(CommitCost::OLD_CHANGE_PUBKEY_COST_OFFCHAIN)); // restore after [ZKS-554]

for _ in 0..amount_ops_in_block.as_u64() {
gas_counter
Expand All @@ -421,7 +421,7 @@ mod tests {

// Expected gas limit is (base_cost + n_ops * op_cost) * 1.3
let expected_commit_limit = (U256::from(CommitCost::BASE_COST)
+ amount_ops_in_block * U256::from(CommitCost::CHANGE_PUBKEY_COST_ONCHAIN))
+ amount_ops_in_block * U256::from(CommitCost::OLD_CHANGE_PUBKEY_COST_OFFCHAIN)) // restore after [ZKS-554]
* U256::from(130)
/ U256::from(100);
let expected_verify_limit = (U256::from(VerifyCost::BASE_COST)
Expand Down
2 changes: 1 addition & 1 deletion core/lib/types/src/tx/primitives/packed_eth_signature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl PackedEthSignature {
}

/// Signs message using ethereum private key, results are identical to signature created
/// using `geth`, `ethers.js`, etc. No hashing and prefixes required.
/// using `geth`, `ethecore/lib/types/src/gas_counter.rsrs.js`, etc. No hashing and prefixes required.
pub fn sign(private_key: &H256, msg: &[u8]) -> Result<PackedEthSignature, anyhow::Error> {
let secret_key = (*private_key).into();
let signed_bytes = Self::message_to_signed_bytes(msg);
Expand Down

0 comments on commit 4c8005c

Please sign in to comment.