Skip to content

Commit

Permalink
vendor wasmer into nearcore
Browse files Browse the repository at this point in the history
  • Loading branch information
Ekleog-NEAR committed Feb 10, 2023
1 parent 4ca05b7 commit a459587
Show file tree
Hide file tree
Showing 526 changed files with 257,893 additions and 9 deletions.
3 changes: 0 additions & 3 deletions core/account-id/fuzz/fuzz_targets/borsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ use libfuzzer_sys::fuzz_target;
use near_account_id::AccountId;

fuzz_target!(|bytes: &[u8]| {
if bytes.len() >= 4 && bytes[0] == 0x12 && bytes[1] == 0x34 && bytes[2] == 0x56 && bytes[3] == 0x78 {
panic!("crash time for clusterfuzz test");
}
if let Ok(account_id) = AccountId::try_from_slice(bytes) {
assert_eq!(
account_id,
Expand Down
12 changes: 6 additions & 6 deletions runtime/near-vm-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ wasmer-vm = { package = "wasmer-vm-near", version = "=2.4.0", optional = true }

finite-wasm = "0.3.0"
prefix-sum-vec = "0.1.2"
near-vm-compiler = { package = "wasmer-compiler-near", path = "../../../wasmer/lib/compiler", optional = true }
near-vm-compiler-singlepass = { package = "wasmer-compiler-singlepass-near", path = "../../../wasmer/lib/compiler-singlepass", optional = true, default-features = false, features = ["std"] } # Available features: std, rayon
near-vm-engine = { package = "wasmer-engine-near", path = "../../../wasmer/lib/engine", optional = true }
near-vm-engine-universal = { package = "wasmer-engine-universal-near", path = "../../../wasmer/lib/engine-universal", features = ["compiler"], optional = true }
near-vm-types = { package = "wasmer-types-near", path = "../../../wasmer/lib/types", optional = true }
near-vm-vm = { package = "wasmer-vm-near", path = "../../../wasmer/lib/vm", optional = true }
near-vm-compiler = { package = "wasmer-compiler-near", path = "../near-vm/lib/compiler", optional = true }
near-vm-compiler-singlepass = { package = "wasmer-compiler-singlepass-near", path = "../near-vm/lib/compiler-singlepass", optional = true }
near-vm-engine = { package = "wasmer-engine-near", path = "../near-vm/lib/engine", optional = true }
near-vm-engine-universal = { package = "wasmer-engine-universal-near", path = "../near-vm/lib/engine-universal", features = ["compiler"], optional = true }
near-vm-types = { package = "wasmer-types-near", path = "../near-vm/lib/types", optional = true }
near-vm-vm = { package = "wasmer-vm-near", path = "../near-vm/lib/vm", optional = true }

[dev-dependencies]
arbitrary.workspace = true
Expand Down
5 changes: 5 additions & 0 deletions runtime/near-vm/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.'cfg(all(target_os = "linux", target_env = "gnu"))']
rustflags = [
# Put the VM functions in the dynamic symbol table.
"-C", "link-arg=-Wl,-E",
]
4 changes: 4 additions & 0 deletions runtime/near-vm/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
CHANGELOG.md merge=union
*.wast linguist-vendored
*.wat linguist-vendored
scene*.txt -text
23 changes: 23 additions & 0 deletions runtime/near-vm/.github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
benches @syrusakbary
examples
fuzz @syrusakbary
lib/api @syrusakbary
lib/c-api
lib/cache @syrusakbary
lib/cli @syrusakbary
lib/compiler @syrusakbary
lib/compiler-cranelift @syrusakbary
lib/compiler-llvm
lib/compiler-singlepass @syrusakbary
lib/deprecated
lib/emscripten
lib/engine @syrusakbary
lib/engine-jit @syrusakbary
lib/engine-native @syrusakbary
lib/engine-object-file @syrusakbary
lib/object @syrusakbary
lib/vm @syrusakbary
lib/wasi
lib/wasmer-types @syrusakbary
scripts @syrusakbary
tests
50 changes: 50 additions & 0 deletions runtime/near-vm/.github/ISSUE_TEMPLATE/---bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
name: "\U0001F41E Bug report"
about: Create a report to help us improve
title: ''
labels: "\U0001F41E bug"
assignees: ''

---

<!-- Thanks for the bug report! -->

### Describe the bug

<!--
A clear and concise description of what the bug is.
Copy and paste the result of executing the following in your shell, so we can know the version of wasmer, Rust (if available) and architecture of your environment.
-->

```sh
echo "`wasmer -V` | `rustc -V` | `uname -m`"
```


### Steps to reproduce
<!--
Include steps that will help us recreate the issue.
For example,
1. Go to '…'
2. Compile with '…'
3. Run '…'
4. See error
If applicable, add a link to a test case (as a zip file or link to a repository we can clone).
-->

### Expected behavior
<!-- A clear and concise description of what you expected to happen. -->

### Actual behavior

<!--
A clear and concise description of what actually happened.
If applicable, add screenshots to help explain your problem.
-->

### Additional context
<!-- Add any other context about the problem here. -->
26 changes: 26 additions & 0 deletions runtime/near-vm/.github/ISSUE_TEMPLATE/---feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: "\U0001F389 Feature request"
about: Suggest an idea for this project
title: ''
labels: "\U0001F389 enhancement"
assignees: ''

---

Thanks for proposing a new feature!

### Motivation

A clear and concise description of what the motivation for the new feature is, and what problem it is solving.

### Proposed solution

A clear and concise description of the feature you would like to add, and how it solves the motivating problem.

### Alternatives

A clear and concise description of any alternative solutions or features you've considered, and why you're proposed solution is better.

### Additional context

Add any other context or screenshots about the feature request here.
16 changes: 16 additions & 0 deletions runtime/near-vm/.github/ISSUE_TEMPLATE/--question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: "❓ Question"
about: Ask a question about this project
title: ''
labels: "❓ question"
assignees: ''

---

### Summary

A clear and concise summary of your question.

### Additional details

Provide any additional details here.
11 changes: 11 additions & 0 deletions runtime/near-vm/.github/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
coverage:
status:
project:
default:
target: auto
threshold: 1%
patch:
default:
target: auto
threshold: 5%
base: auto
15 changes: 15 additions & 0 deletions runtime/near-vm/.github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
Prior to submitting a PR, review the CONTRIBUTING.md document for recommendations on how to test:
https://github.com/wasmerio/wasmer/blob/master/CONTRIBUTING.md#pull-requests
-->

# Description
<!--
Provide details regarding the change including motivation,
links to related issues, and the context of the PR.
-->

# Review

- [ ] Add a short description of the change to the CHANGELOG.md file
17 changes: 17 additions & 0 deletions runtime/near-vm/.github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 365
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 30
# Issues with these labels will never be considered stale
exemptLabels:
- "🐞 bug"
# Label to use when marking an issue as stale
staleLabel: "🏚 stale"
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
Feel free to reopen the issue if it has been closed by mistake.
14 changes: 14 additions & 0 deletions runtime/near-vm/.github/workflows/cargo-deny.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
push:
branches:
- master

name: cargo-deny

jobs:
deny-check:
name: cargo-deny
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: EmbarkStudios/cargo-deny-action@v1
100 changes: 100 additions & 0 deletions runtime/near-vm/.github/workflows/test-sys.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
name: Runtime tests

env:
RUST_BACKTRACE: 1
ENABLE_SINGLEPASS: 1
ENABLE_LLVM: 0
ENABLE_CRANELIFT: 0

on:
push:
branches:
- 'near-main'
- 'staging'
- 'trying'
pull_request:
branches: [ 'near-main' ]

jobs:
test:
name: Test on ${{ matrix.build }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- build: linux-x64
os: ubuntu-latest
- build: macos-x64
os: macos-latest
run_ios_tests: true
# Singlepass does not support windows...
# - build: windows-x64
# os: windows-latest
# Tests SIGSEGV due to probably signal wonkyness...
# - build: linux-musl-x64
# os: ubuntu-latest
# container: alpine:latest
container: ${{ matrix.container }}
steps:
- uses: actions/checkout@v2
- name: Set up base deps on musl
if: matrix.build == 'linux-musl-x64'
run: apk add build-base musl-dev wget curl make libtool libffi-dev gcc automake autoconf git openssl-dev g++
- name: Set up dependencies for Mac OS
if: matrix.os == 'macos-latest'
run: |
brew install automake
# using gnu-tar is a workaround for https://github.com/actions/cache/issues/403
brew install gnu-tar
echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
default: true
- name: Test
run: make test
env:
RUSTFLAGS: -Cdebuginfo=0

audit:
name: Audit
env:
CARGO_AUDIT_VERSION: 0.16.0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/cache@master
with:
path: ${{ runner.tool_cache }}/cargo-audit
key: cargo-audit-bin-${{ env.CARGO_AUDIT_VERSION }}
- run: |
echo "'${{ runner.tool_cache }}/cargo-audit/bin'" >> $GITHUB_PATH
- run: |
cargo install cargo-audit --version ${{ env.CARGO_AUDIT_VERSION }} --root '${{ runner.tool_cache }}/cargo-audit'
# No fixed dependencies available for the first two and the emscripten is not fixed for
# the last one...
cargo audit --ignore RUSTSEC-2021-0119 --ignore RUSTSEC-2020-0095 --ignore RUSTSEC-2020-0071
lint:
name: Code lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true
components: rustfmt, clippy
- run: cargo fmt --all -- --check
- run: cargo fmt --manifest-path fuzz/Cargo.toml -- --check
- run: make lint
env:
RUSTFLAGS: -Cdebuginfo=0

- name: Assert no files have changed
run: |
git status
! [[ $(git status -s) ]]
17 changes: 17 additions & 0 deletions runtime/near-vm/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
**/target
**/*.rs.bk
.DS_Store
.idea
.gdb_history
**/.vscode
api-docs-repo/
/.cargo_home/
/package/
/dist/
/wapm-cli/
/src/windows-installer/WasmerInstaller.exe
/lib/c-api/wasmer.h

# Generated by tests on Android
/avd
/core
17 changes: 17 additions & 0 deletions runtime/near-vm/.tarpaulin.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[cranelift_coverage]
features = "cranelift,singlepass,llvm,coverage,test-cranelift,test-jit"
examples = ["early-exit", "engine-jit", "engine-native", "engine-headless", "cross-compilation", "compiler-cranelift", "exported-function", "wasi"]
release = true

[llvm_coverage]
features = "cranelift,singlepass,llvm,coverage,test-llvm,test-jit"
examples = ["compiler-llvm"]
release = true

[singlepass_coverage]
features = "cranelift,singlepass,llvm,coverage,test-singlepass,test-jit"
examples = ["compiler-singlepass"]
release = true

[report]
out = ["Xml"]
Loading

0 comments on commit a459587

Please sign in to comment.