Skip to content

Commit

Permalink
Update to latest version and check-in e2e test that displays console …
Browse files Browse the repository at this point in the history
…errors
  • Loading branch information
MexicanAce committed Sep 26, 2024
1 parent 9f9bc26 commit 90cd4b4
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 12 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "era_test_node"
version = "0.1.0-alpha.27"
version = "0.1.0-alpha.28"
edition = "2018"
authors = ["The Matter Labs Team <hello@matterlabs.dev>"]
homepage = "https://zksync.io/"
Expand All @@ -11,7 +11,6 @@ categories = ["cryptography"]
publish = false # We don't want to publish our binaries.

[dependencies]
zk_evm = { git = "https://github.com/matter-labs/era-zk_evm.git", branch = "v1.5.0" }
zkevm_opcode_defs = { git = "https://github.com/matter-labs/era-zkevm_opcode_defs.git", branch = "v1.5.0" }
zksync_basic_types = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e214dd094457f196712722e084010a7ef94ee475" }
zksync_node_fee_model = { git = "https://github.com/matter-labs/zksync-era.git", rev = "e214dd094457f196712722e084010a7ef94ee475" }
Expand Down
9 changes: 9 additions & 0 deletions e2e-tests/contracts/Fib.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// SPDX-License-Identifier: UNLICENSED

pragma solidity ^0.8.0;

contract Fib {
function fib(uint256 n) public pure returns (uint256) {
return n <= 1 ? 1 : fib(n - 1) + fib(n - 2);
}
}
25 changes: 25 additions & 0 deletions e2e-tests/test/fib.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { ethers } from "ethers";

Check failure on line 1 in e2e-tests/test/fib.test.ts

View workflow job for this annotation

GitHub Actions / lint

'ethers' is defined but never used
import { Wallet } from "zksync-web3";
import * as hre from "hardhat";
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
import { RichAccounts } from "../helpers/constants";
import { deployContract, expectThrowsAsync, getTestProvider } from "../helpers/utils";

const provider = getTestProvider();

describe("Test Fib error flags", function () {
it("Should print to the console NOT ENOUGH ERGS", async function () {
const action = async () => {
const wallet = new Wallet(RichAccounts[0].PrivateKey, provider);

const deployer = new Deployer(hre, wallet);
const fib = await deployContract(deployer, "Fib");
const n = await fib.fib(100);

Check failure on line 17 in e2e-tests/test/fib.test.ts

View workflow job for this annotation

GitHub Actions / lint

'n' is assigned a value but never used
};

// This is expected to throw and the console is expected to show:
// XX:YY:ZZ ERROR !! Got error flags:
// XX:YY:ZZ ERROR NOT ENOUGH ERGS
await expectThrowsAsync(action, "call revert exception");
});
});
12 changes: 4 additions & 8 deletions src/node/call_error_tracer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use multivm::{
interface::dyn_tracers::vm_1_5_0::DynTracer,
vm_latest::{HistoryMode, SimpleMemory, VmTracer},
use zksync_multivm::{
tracers::dynamic::vm_1_5_0::DynTracer,
vm_latest::{HistoryMode, SimpleMemory, VmTracer}, zk_evm_latest::{tracing::{AfterDecodingData, VmLocalStateData}, vm_state::ErrorFlags},
};
use zk_evm::{
tracing::{AfterDecodingData, VmLocalStateData},
vm_state::ErrorFlags,
};
use zksync_state::WriteStorage;
use zksync_state::interface::WriteStorage;

pub struct CallErrorTracer {}

Expand Down

0 comments on commit 90cd4b4

Please sign in to comment.