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

Release 1.3.0 #143

Merged
merged 21 commits into from
Jun 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 16 additions & 1 deletion .github/workflows/lints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,23 @@ jobs:
toolchain: nightly-2021-03-25
override: true
components: clippy
- name: Run cargo clippy
- run: make etc/eth-contracts/res/EvmErc20.bin
- name: Run Contract cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --no-default-features --features=contract -- -D warnings
- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy

contracts:
name: eth-contracts
runs-on: ubuntu-latest
steps:
- name: Clone the repository
uses: actions/checkout@v2
- name: Run yarn lint
working-directory: etc/eth-contracts
run: yarn && yarn lint
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,16 @@
# Rust artifacts
/*.wasm
/target/

# Solidity artifacts
artifacts/
cache/
node_modules/
res/

# Other
etc/state-migration-test/target/

node_modules/*
artifacts/
cache
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### [1.3.0] - 2021-06-17

### [1.2.0] - 2021-06-05

### [1.1.0] - 2021-05-28

### [1.0.0] - 2021-05-12

[1.3.0]: https://github.com/aurora-is-near/aurora-engine/compare/1.2.0...1.3.0
[1.2.0]: https://github.com/aurora-is-near/aurora-engine/compare/1.1.0...1.2.0
[1.1.0]: https://github.com/aurora-is-near/aurora-engine/compare/1.0.0...1.1.0
[1.0.0]: https://github.com/aurora-is-near/aurora-engine/tree/1.0.0
20 changes: 12 additions & 8 deletions Cargo.lock

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

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ rpath = false
blake2 = { git = "https://github.com/near/near-blake2.git", version = "0.9.1", default-features = false }
borsh = { version = "0.8.2", default-features = false }
bn = { package = "aurora-bn", git = "https://github.com/aurora-is-near/aurora-bn.git", default-features = false }
evm = { version = "0.27.0", default-features = false }
evm-core = { version = "0.27.1", default-features = false }
evm = { version = "0.28.0", default-features = false }
evm-core = { version = "0.28.0", default-features = false }
libsecp256k1 = { version = "0.3.5", default-features = false }
num = { version = "0.4.0", default-features = false, features = ["alloc"] }
primitive-types = { version = "0.9.0", default-features = false, features = ["rlp"] }
Expand All @@ -59,6 +59,8 @@ rjson = { version = "0.3.1", default-features = false }

[dev-dependencies]
bstr = "0.2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
hex = { version = "0.4.3", default-features = false }
near-sdk = { git = "https://github.com/near/near-sdk-rs", rev = "9d99077c6acfde68c06845f2a1eb2b5ed7983401" }
near-sdk-sim = { git = "https://github.com/near/near-sdk-rs", rev = "9d99077c6acfde68c06845f2a1eb2b5ed7983401" }
Expand All @@ -70,6 +72,8 @@ libsecp256k1 = "0.3.5"
rand = "0.7.3"
criterion = "0.3.4"
git2 = "0.13"
lazy-static-include = "3.1.1"
base64 = "0.13.0"

[features]
default = ["sha2", "std"]
Expand Down
22 changes: 14 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CARGO = cargo
NEAR = near
FEATURES = contract,log
FEATURES = contract,log,exit-precompiles

ifeq ($(evm-bully),yes)
FEATURES := $(FEATURES),evm_bully
Expand All @@ -13,9 +13,15 @@ release: release.wasm
release.wasm: target/wasm32-unknown-unknown/release/aurora_engine.wasm
ln -sf $< $@

target/wasm32-unknown-unknown/release/aurora_engine.wasm: Cargo.toml Cargo.lock $(wildcard src/*.rs)
target/wasm32-unknown-unknown/release/aurora_engine.wasm: Cargo.toml Cargo.lock $(shell find src -name "*.rs") etc/eth-contracts/res/EvmErc20.bin
RUSTFLAGS='-C link-arg=-s' $(CARGO) build --target wasm32-unknown-unknown --release --no-default-features --features=$(FEATURES) -Z avoid-dev-deps
ls -l target/wasm32-unknown-unknown/release/aurora_engine.wasm
ls -l target/wasm32-unknown-unknown/release/aurora_engine.wasm

etc/eth-contracts/res/EvmErc20.bin: $(shell find etc/eth-contracts/contracts -name "*.sol") etc/eth-contracts/package.json
cd etc/eth-contracts && yarn && yarn build

etc/eth-contracts/artifacts/contracts/test/StateTest.sol/StateTest.json: $(shell find etc/eth-contracts/contracts -name "*.sol") etc/eth-contracts/package.json
cd etc/eth-contracts && yarn && yarn build

debug: debug.wasm

Expand All @@ -25,12 +31,12 @@ debug.wasm: target/wasm32-unknown-unknown/debug/aurora_engine.wasm
target/wasm32-unknown-unknown/debug/aurora_engine.wasm: Cargo.toml Cargo.lock $(wildcard src/*.rs)
$(CARGO) build --target wasm32-unknown-unknown --no-default-features --features=$(FEATURES) -Z avoid-dev-deps

test-build:
RUSTFLAGS='-C link-arg=-s' $(CARGO) build --target wasm32-unknown-unknown --release --no-default-features --features=contract,integration-test -Z avoid-dev-deps
ln -sf target/wasm32-unknown-unknown/release/aurora_engine.wasm release.wasm
ls -l target/wasm32-unknown-unknown/release/aurora_engine.wasm
test-build: etc/eth-contracts/artifacts/contracts/test/StateTest.sol/StateTest.json etc/eth-contracts/res/EvmErc20.bin
RUSTFLAGS='-C link-arg=-s' $(CARGO) build --target wasm32-unknown-unknown --release --no-default-features --features=contract,integration-test,exit-precompiles -Z avoid-dev-deps
ln -sf target/wasm32-unknown-unknown/release/aurora_engine.wasm release.wasm
ls -l target/wasm32-unknown-unknown/release/aurora_engine.wasm

.PHONY: all release debug
.PHONY: all release debug eth-contracts

deploy: release.wasm
$(NEAR) deploy --account-id=$(or $(NEAR_EVM_ACCOUNT),aurora.test.near) --wasm-file=$<
Expand Down
8 changes: 4 additions & 4 deletions doc/eth-connector.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ $ near call <NEAR_ACC> new_eth_connector '{"prover_account": "<PROVER_NEAR_ACCOU

## ETH connector specific methods
* new_eth_connector (call once)
* deposit (mutable)
* deposit (mutable)
* withdraw (mutable, payable)
* finish_deposit_near (private, mutable)
* finish_deposit (private, mutable)
* ft_total_supply (view)
* ft_total_supply_near (view)
* ft_total_supply_eth (view)
* ft_total_eth_supply_on_near (view)
* ft_total_eth_supply_on_aurora (view)
* ft_balance_of (view)
* ft_balance_of_eth (view)
* ft_transfer (mutable, payable)
Expand Down
1 change: 1 addition & 0 deletions etc/eth-contracts/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
52 changes: 52 additions & 0 deletions etc/eth-contracts/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"extends" : [
"standard",
"plugin:promise/recommended"
],
"plugins": [
"promise"
],
"env": {
"browser" : true,
"node": true,
"mocha": true,
"jest": true
},
"globals" : {
"artifacts": false,
"contract": false,
"assert": false,
"web3": false
},
"rules": {

// Strict mode
"strict": [2, "global"],

// Code style
"indent": [2, 4],
"quotes": [2, "single"],
"semi": ["error", "always"],
"space-before-function-paren": ["error", "always"],
"no-use-before-define": 0,
"no-unused-expressions": "off",
"eqeqeq": [2, "smart"],
"dot-notation": [2, {"allowKeywords": true, "allowPattern": ""}],
"no-redeclare": [2, {"builtinGlobals": true}],
"no-trailing-spaces": [2, { "skipBlankLines": true }],
"eol-last": 1,
"comma-spacing": [2, {"before": false, "after": true}],
"camelcase": [2, {"properties": "always"}],
"no-mixed-spaces-and-tabs": [2, "smart-tabs"],
"comma-dangle": [1, "always-multiline"],
"no-dupe-args": 2,
"no-dupe-keys": 2,
"no-debugger": 0,
"no-undef": 2,
"object-curly-spacing": [2, "always"],
"max-len": [2, 200, 2],
"generator-star-spacing": ["error", "before"],
"promise/avoid-new": 0,
"promise/always-return": 0
}
}
9 changes: 9 additions & 0 deletions etc/eth-contracts/.soliumignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules

# solium fails to run linter in Tester.sol
# see issue for more details: https://github.com/duaraghav8/Ethlint/issues/293
contracts/test/Tester.sol

# solium fails to run linter in Tester.sol
# see issue for more details: https://github.com/duaraghav8/Ethlint/issues/294
contracts/test/StateTest.sol
23 changes: 23 additions & 0 deletions etc/eth-contracts/.soliumrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"extends": "solium:all",
"plugins": ["security"],
"rules": {
"mixedcase": "off",
"error-reason": "off",
"indentation": ["error", 4],
"lbrace": "off",
"linebreak-style": ["error", "unix"],
"max-len": ["error", 139],
"no-constant": ["error"],
"no-empty-blocks": "off",
"quotes": ["error", "double"],
"uppercase": "off",
"visibility-first": "error",
"arg-overflow": ["error", 5],
"function-order": "off",

"security/enforce-explicit-visibility": ["error"],
"security/no-block-members": ["off"],
"security/no-inline-assembly": ["warning"]
}
}
47 changes: 47 additions & 0 deletions etc/eth-contracts/contracts/AdminControlled.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.0;


contract AdminControlled {
address public admin;
uint public paused;

constructor(address _admin, uint flags) {
admin = _admin;

// Add the possibility to set pause flags on the initialization
paused = flags;
}

modifier onlyAdmin {
require(msg.sender == admin);
_;
}

modifier pausable(uint flag) {
require((paused & flag) == 0 || msg.sender == admin);
_;
}

function adminPause(uint flags) public onlyAdmin {
paused = flags;
}

function adminSstore(uint key, uint value) public onlyAdmin {
assembly {
sstore(key, value)
}
}

function adminSendEth(address payable destination, uint amount) public onlyAdmin {
destination.transfer(amount);
}

function adminReceiveEth() public payable onlyAdmin {}

function adminDelegatecall(address target, bytes memory data) public payable onlyAdmin returns (bytes memory) {
(bool success, bytes memory rdata) = target.delegatecall(data);
require(success);
return rdata;
}
}
Loading