Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement analysis of conflict keys #2

Merged
merged 30 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
f29ed68
add terminal animation during waiting for task's execution
vita-dounai Jun 2, 2021
398e98e
Merge pull request #1 from vita-dounai/dev
vita-dounai Jun 3, 2021
bcaceff
implement IFDS solver
vita-dounai Jul 19, 2021
714cd0d
impl andersen point-to analysis and define conflict fields problem
vita-dounai Jul 30, 2021
589878d
support field-sensitivity in problem of conflict fields
vita-dounai Aug 2, 2021
4b4fa52
write to ABI json file after analyzing
vita-dounai Aug 2, 2021
2f47fd4
display warnings in console and write conflict fields to abi json file
vita-dounai Aug 5, 2021
8b7827c
add rust-toolchain file
vita-dounai Aug 5, 2021
3bd7ad4
fix crash when pfg meets recursion
vita-dounai Aug 5, 2021
e151125
simplify analisys behavior
vita-dounai Aug 11, 2021
07d85a3
support solidity-style selector calculation
vita-dounai Sep 6, 2021
b72684e
support re-write selector in GM mode
vita-dounai Sep 7, 2021
b3ccdf6
make rule that if a method invokes any interface, then it cannot be p…
vita-dounai Sep 16, 2021
58373f0
remove enforce anlysis flag
vita-dounai Sep 18, 2021
e990141
treat Iter in Vec and IterableMapping as special type during type che…
vita-dounai Sep 23, 2021
6a63436
fix bug in uninitialized state variables detecting
vita-dounai Sep 24, 2021
78d48c2
fix bug in selector replacement
vita-dounai Oct 19, 2021
cb56477
report error when can't find selector for contract method
vita-dounai Oct 21, 2021
10292c2
fix enum value error in env_info_kind
vita-dounai Nov 9, 2021
2736e06
fix comment error
vita-dounai Nov 9, 2021
be8b88e
recongize constantant in mapping
vita-dounai Nov 10, 2021
1e89735
make quepingkong happy
vita-dounai Nov 11, 2021
4d0fbe9
treat emit as special method
vita-dounai Nov 15, 2021
a7d8b86
add conflict analysis test
kongqp Nov 12, 2021
8da851b
Merge pull request #4 from vita-dounai/workflow
vita-dounai Nov 15, 2021
9d43180
skip analysis phase when compiling collaboration (#5)
vita-dounai Nov 15, 2021
78aeb4e
adapt to collaboration (#7)
vita-dounai Nov 22, 2021
5af393d
add error prompts and comments for verify conflict (#6)
kongqp Nov 22, 2021
597b6e1
force LTO to false (#8)
vita-dounai Nov 23, 2021
6280ec0
add rename order (#3)
hnustyangjieyu Dec 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Cargo-liquid Github Actions
on:
push:
pull_request:
release:
types: [published, created, edited]

jobs:
win_test:
name: win_test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-2019]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 5
- name: install rust nightly
uses: actions-rs/toolchain@v1
with:
components: rustc-dev, rust-src
- name: install cargo-liquid
run: cargo install --path . --force
- name: compile test contract
run: cd .\tests\conflict_analysis_test\contract && cargo liquid build
- name: setup python
uses: actions/setup-python@v2
with:
python-version: '3.x'
architecture: 'x64'
- name: verify conflict analysis result
run: cd .\tests\conflict_analysis_test && python .\verify_conflict.py
26 changes: 23 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-liquid"
version = "1.0.0-rc1"
version = "1.0.0-rc2"
authors = ["vita-dounai <lichenxi.webank@gmail.com>"]
build = "build.rs"
edition = "2018"
Expand All @@ -20,9 +20,29 @@ parity-wasm = "0.41.0"
pwasm-utils = "0.14.0"
which = "4.0.2"
indicatif = { version = "0.15.0", features = ["rayon", "improved_unicode"] }
console = { version = "0.13.0" }
console = "0.13.0"
env_logger = "*"
log = "*"
log-derive = "*"
petgraph = "0.6"
either = "*"
serde = "*"
serde_json = "*"
itertools = "*"
leb128 = "*"
tiny-keccak = { version = "*", features = ["keccak"] }
libsm = "*"
wabt = "*"

[build-dependencies]
anyhow = "1.0.32"
zip = "0.5.6"
walkdir = "2.3.1"
walkdir = "2.3.1"

[[bin]]
name = "cargo-liquid"
path = "src/main/main.rs"

[[bin]]
name = "liquid-analy"
path = "src/analyzer/main.rs"
33 changes: 17 additions & 16 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use std::{
ffi::OsStr,
fs::File,
io::{Read, Write},
path::PathBuf,
path::{Path, PathBuf},
};
use walkdir::WalkDir;
use zip::{write::FileOptions, CompressionMethod, ZipWriter};
Expand Down Expand Up @@ -52,13 +52,13 @@ fn main() {
});
}

fn zip_dir(src_dir: &PathBuf, dst_file: &PathBuf) -> Result<()> {
fn zip_dir(src_dir: &Path, dst_file: &Path) -> Result<()> {
if !src_dir.exists() {
anyhow::bail!("src_dir '{}' does not exist", src_dir.display());
anyhow::bail!("src_dir `{}` does not exist", src_dir.display());
}

if !src_dir.is_dir() {
anyhow::bail!("src_dir '{}' is not a directory");
anyhow::bail!("src_dir `{}` is not a directory", src_dir.display());
}

let file = File::create(dst_file)?;
Expand All @@ -77,20 +77,21 @@ fn zip_dir(src_dir: &PathBuf, dst_file: &PathBuf) -> Result<()> {

// Cargo.toml files cause the folder to excluded from `cargo package` so need to be renamed
if name.file_name() == Some(OsStr::new("_Cargo.toml")) {
name.set_file_name("Cargo.toml")
name.set_file_name("Cargo.toml");
}

if path.is_file() {
#[allow(deprecated)]
zip.start_file_from_path(name.as_path(), options)?;
let mut f = File::open(path)?;

f.read_to_end(&mut buffer)?;
zip.write_all(&*buffer)?;
buffer.clear();
} else if name.as_os_str().len() != 0 {
#[allow(deprecated)]
zip.add_directory_from_path(name.as_path(), options)?;
if let Some(name) = name.to_str() {
if path.is_file() {
zip.start_file(name, options)?;
let mut f = File::open(path)?;
f.read_to_end(&mut buffer)?;
zip.write_all(&*buffer)?;
buffer.clear();
} else if !name.is_empty() {
zip.add_directory(name, options)?;
}
} else {
anyhow::bail!("the path contains invalid UTF-8 characters: `{:?}`", name);
}
}
zip.finish()?;
Expand Down
1 change: 1 addition & 0 deletions rust-toolchain
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nightly-2021-06-23
Loading