Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Fix some issues, update integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Z committed Feb 8, 2021
1 parent 8b8ec0d commit 2a49b8d
Show file tree
Hide file tree
Showing 32 changed files with 83 additions and 67 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# The Zinc changelog

## Version 0.2.3 (2021-02-08)

#### Compiler

- fixed the dependency contract constructors which were spilled to `input.json`

#### Zargo

- fixed the toolset version check during project downloading

## Version 0.2.2 (2021-01-26)

#### Compiler
Expand Down
24 changes: 12 additions & 12 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ RUN apt-get install --yes \
RUN dos2unix 'docker/build.sh'

# Main build script, expects the Zinc version
RUN /bin/bash 'docker/build.sh' '0.2.2'
RUN /bin/bash 'docker/build.sh' '0.2.3'
2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "zinc-syntax-highlighting",
"displayName": "Zinc Syntax Highlighting",
"description": "Zinc Syntax Highlighting",
"version": "0.2.2",
"version": "0.2.3",
"publisher": "hedgar2017",
"engines": {
"vscode": "^1.38.0"
Expand Down
2 changes: 1 addition & 1 deletion zandbox/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zandbox"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
]
Expand Down
4 changes: 2 additions & 2 deletions zandbox/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
#
# From the root directory:
# DOCKER_BUILDKIT=1 docker build -t matterlabs/zandbox -f zandbox/docker/Dockerfile .
# docker push matterlabs/zandbox:0.2.2
# docker push matterlabs/zandbox:0.2.3

FROM rust:1.48 as builder
FROM rust:1.49 as builder

RUN --mount=type=cache,target=/usr/local/cargo/registry \
cargo install sccache
Expand Down
2 changes: 1 addition & 1 deletion zandbox/src/controller/contract/fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub async fn handle(
.provider
.get_tx_fee(
zksync_types::TxFeeTypes::ChangePubKey {
onchain_pubkey_auth: true,
onchain_pubkey_auth: false,
},
initializer.eth_address,
token.id,
Expand Down
2 changes: 1 addition & 1 deletion zandbox/src/shared_data/locked_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ impl LockedContract {
.provider
.get_tx_fee(
zksync_types::TxFeeTypes::ChangePubKey {
onchain_pubkey_auth: true,
onchain_pubkey_auth: false,
},
eth_address,
change_pubkey_fee_token.id,
Expand Down
2 changes: 1 addition & 1 deletion zargo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zargo"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
]
Expand Down
20 changes: 9 additions & 11 deletions zargo/src/http/downloader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,6 @@ impl<'a> Downloader<'a> {
))
.await?;

if response.zinc_version != env!("CARGO_PKG_VERSION") {
anyhow::bail!(Error::CompilerVersionMismatch(
format!("{}-{}", name, version),
env!("CARGO_PKG_VERSION").to_string(),
response.zinc_version,
));
}

fs::create_dir_all(&project_path)?;
response.project.manifest.write_to(&project_path)?;
response.project.source.write_to(&project_path)?;
Expand Down Expand Up @@ -131,11 +123,17 @@ impl<'a> Downloader<'a> {
))
.await?;

if response.zinc_version != env!("CARGO_PKG_VERSION") {
let current_version = semver::Version::parse(env!("CARGO_PKG_VERSION"))
.expect(zinc_const::panic::DATA_CONVERSION);
let project_version = semver::Version::parse(response.zinc_version.as_str())
.expect(zinc_const::panic::DATA_CONVERSION);
if project_version.major != current_version.major
|| project_version.minor != current_version.minor
{
anyhow::bail!(Error::CompilerVersionMismatch(
dependency_name,
env!("CARGO_PKG_VERSION").to_string(),
response.zinc_version,
current_version.to_string(),
project_version.to_string(),
));
}

Expand Down
2 changes: 1 addition & 1 deletion zinc-book/book.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[book]
title = "Zinc v0.2.2"
title = "Zinc v0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
"Alex Gluchowski <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion zinc-compiler/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-compiler"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
"Alexander Movchan <[email protected]>",
Expand Down
9 changes: 7 additions & 2 deletions zinc-compiler/src/generator/statement/fn/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,12 @@ impl IBytecodeWritable for Statement {
let output_size = self.output_type.size();

match self.role {
Role::CircuitEntry | Role::ContractMethodEntry | Role::ContractConstuctor { .. } => {
Role::CircuitEntry
| Role::ContractMethodEntry
| Role::ContractConstuctor {
is_dependency: false,
..
} => {
state.borrow_mut().start_entry_function(
self.location,
self.type_id,
Expand Down Expand Up @@ -127,7 +132,7 @@ impl IBytecodeWritable for Statement {
self.body.write_to_zinc_vm(state.clone());

match self.role {
Role::ContractConstuctor { project } => {
Role::ContractConstuctor { project, .. } => {
let field_types: Vec<zinc_types::ContractFieldType> = match self.output_type {
Type::Contract { fields } => {
fields.into_iter().map(|field| field.into()).collect()
Expand Down
2 changes: 2 additions & 0 deletions zinc-compiler/src/generator/statement/fn/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ pub enum Role {
ContractConstuctor {
/// The `project` section of the contract project manifest.
project: zinc_project::ManifestProject,
/// Whether the contract constructor is located in a dependency project.
is_dependency: bool,
},
/// A contract method entry.
ContractMethodEntry,
Expand Down
1 change: 1 addition & 0 deletions zinc-compiler/src/semantic/analyzer/statement/fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ impl Analyzer {
ScopeType::Contract if statement.is_public => match expected_type {
Type::Contract(ref contract) => GeneratorFunctionRole::ContractConstuctor {
project: contract.project.to_owned(),
is_dependency: is_in_dependency,
},
_ => GeneratorFunctionRole::Ordinar,
},
Expand Down
2 changes: 1 addition & 1 deletion zinc-const/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-const"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
]
Expand Down
2 changes: 1 addition & 1 deletion zinc-lexical/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-lexical"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
]
Expand Down
2 changes: 1 addition & 1 deletion zinc-logger/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-logger"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
"Alexander Movchan <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion zinc-math/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-math"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
"Alexander Movchan <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion zinc-project/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-project"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
]
Expand Down
2 changes: 1 addition & 1 deletion zinc-syntax/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-syntax"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
]
Expand Down
2 changes: 1 addition & 1 deletion zinc-tester/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zinc-tester"
version = "0.2.2"
version = "0.2.3"
authors = [
"Alex Zarudnyy <[email protected]>",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"msg": {
"sender": "0x36615Cf349d7F6344891B1e7CA7C72883F5dc049",
"recipient": "0x0000000000000000000000000000000000000000",
"token_address": "0x8C1f0b5C3D91534848A8DB08C89Aa4f641Debe25",
"token_address": "0xe015cbd9a6f74495d9b568f93a741c1eb602b78b",
"amount": "1.0_E18"
},
"arguments": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"arguments": {
"exchange": {
"withdraw_token": "0x8C1f0b5C3D91534848A8DB08C89Aa4f641Debe25"
"withdraw_token": "0xe015cbd9a6f74495d9b568f93a741c1eb602b78b"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"value": "1100000000000000000"
},
{
"key": "0x8C1f0b5C3D91534848A8DB08C89Aa4f641Debe25",
"key": "0xe015cbd9a6f74495d9b568f93a741c1eb602b78b",
"value": "900000000000000000"
}
],
Expand Down
16 changes: 8 additions & 8 deletions zinc-tester/ordinar/ok_constant_price/src/main.zn
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ type Balance = u248;

enum TokenAddress {
ETH = 0x0000000000000000000000000000000000000000,
DAI = 0x318093a9b569e332d0224b0e1aec5fa92cc097d3,
wBTC = 0x21c51d49d7fc8bbc8a0ac008f3865d20222e35df,
BAT = 0x76c62afd65d87ba9558d4080d63a3058bec4f8e1,
MLTT = 0x1fc9d6daa223b6e58a62fa72e8f1e41e3ab24dfe,
DAI = 0xe015cbd9a6f74495d9b568f93a741c1eb602b78b,
wBTC = 0x9934eb5a9a83b4ba468cf5739afcd0eb31df825a,
BAT = 0x417155b70868b2c0f7e65be0e764ee9384d0a453,
MLTT = 0x7ebab6cbe1aafc22c1877feaa1d552b80ca91a09,
}

impl TokenAddress {
pub fn is_known(address: Address) -> bool {
match address {
0x0000000000000000000000000000000000000000 => true,
0x318093a9b569e332d0224b0e1aec5fa92cc097d3 => true,
0x21c51d49d7fc8bbc8a0ac008f3865d20222e35df => true,
0x76c62afd65d87ba9558d4080d63a3058bec4f8e1 => true,
0x1fc9d6daa223b6e58a62fa72e8f1e41e3ab24dfe => true,
0xe015cbd9a6f74495d9b568f93a741c1eb602b78b => true,
0x9934eb5a9a83b4ba468cf5739afcd0eb31df825a => true,
0x417155b70868b2c0f7e65be0e764ee9384d0a453 => true,
0x7ebab6cbe1aafc22c1877feaa1d552b80ca91a09 => true,
_ => false,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"msg": {
"sender": "0xa61464658AfeAf65CccaaFD3a512b69A83B77618",
"recipient": "0x0000000000000000000000000000000000000000",
"token_address": "0x8C1f0b5C3D91534848A8DB08C89Aa4f641Debe25",
"token_address": "0xe015cbd9a6f74495d9b568f93a741c1eb602b78b",
"amount": "1.0_E18"
},
"arguments": {
Expand Down
Loading

0 comments on commit 2a49b8d

Please sign in to comment.