Skip to content

Commit

Permalink
tests passing mostly hardhat
Browse files Browse the repository at this point in the history
  • Loading branch information
mm-zk committed Sep 22, 2023
1 parent 7782509 commit ab3c839
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 103 deletions.
9 changes: 7 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
"kind": "bin"
}
},
"args": ["run"],
"args": [
"run"
],
"cwd": "${workspaceFolder}"
},
{
Expand All @@ -41,7 +43,10 @@
"RUST_LOG": "vm=trace",
"ZKSYNC_HOME": "${workspaceFolder}"
},
"args": ["--dev-use-local-contracts", "run"],
"args": [
"--dev-use-local-contracts",
"run"
],
"preLaunchTask": "rebuild-contracts",
"cwd": "${workspaceFolder}"
},
Expand Down
58 changes: 29 additions & 29 deletions Cargo.lock

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

18 changes: 9 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ categories = ["cryptography"]
publish = false # We don't want to publish our binaries.

[dependencies]
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
zksync_core = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
vm = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
vlog = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", rev = "a43bc402a204ac92fb74ad348b68f61e24d7a84a" }
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
zksync_core = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
vm = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
vlog = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
zksync_contracts = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
zksync_types = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
zksync_utils = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
zksync_state = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }
zksync_web3_decl = { git = "https://github.com/matter-labs/zksync-era.git", tag = "v7.0.0-rc0" }



Expand Down
5 changes: 4 additions & 1 deletion src/hardhat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ mod tests {
use std::str::FromStr;
use zksync_basic_types::{Nonce, H256};
use zksync_core::api_server::web3::backend_jsonrpc::namespaces::eth::EthNamespaceT;
use zksync_types::{api::BlockNumber, fee::Fee, l2::L2Tx};
use zksync_types::{api::BlockNumber, fee::Fee, l2::L2Tx, PackedEthSignature};

#[tokio::test]
async fn test_set_balance() {
Expand Down Expand Up @@ -401,6 +401,9 @@ mod tests {
Default::default(),
);
tx.set_input(vec![], H256::random());
if tx.common_data.signature.is_empty() {
tx.common_data.signature = PackedEthSignature::default().serialize_packed().into();
}

// try to execute the tx- should fail without signature
assert!(node.apply_txs(vec![tx.clone()]).is_err());
Expand Down
7 changes: 7 additions & 0 deletions src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,13 @@ impl<S: ForkSource + std::fmt::Debug> InMemoryNode<S> {

let (keys, result, block, bytecodes) =
self.run_l2_tx_inner(l2_tx.clone(), execution_mode)?;

if let ExecutionResult::Halt { reason } = result.result {
// Halt means that something went really bad with the transaction execution (in most cases invalid signature,
// but it could also be bootloader panic etc).
// In such case, we should not persist the VM data, and we should pretend that transaction never existed.
return Err(format!("Transaction HALT: {}", reason.to_string()));
}
// Write all the mutated keys (storage slots).
let mut inner = self
.inner
Expand Down
Loading

0 comments on commit ab3c839

Please sign in to comment.