-
Notifications
You must be signed in to change notification settings - Fork 6
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
Pure no-std eth-connector implementation #10
Merged
Merged
Changes from 50 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
86afcb5
Added Pure eth-conenctor space and implemented log-entry rlp logic
mrLSD 63b617e
Adde no-std basic flow
mrLSD 73a6216
Added ethabi no-std implementation
mrLSD 7099e52
Clear ethabi
mrLSD 6001860
Added no-std sdk
mrLSD ef85dab
Added types
mrLSD 3e11252
Added basic fungible token no-std flow
mrLSD 7cba867
Init contract
mrLSD 714981e
Connector deposit logic
mrLSD 4a940c2
Modified Deposit and extended sdk
mrLSD 5631bbc
Added finish deposit & extended sdk
mrLSD 0588f1e
Mint invoke
mrLSD 954fd39
Record proof & extend sdk
mrLSD 48cb555
Fungible token inner functions
mrLSD 88f7486
Fungible token - extend core internal funcs
mrLSD 9cce426
Added tests
mrLSD c14b5df
Function args serde serialization issue fix
mrLSD 00075fb
Deposit prover data testing
mrLSD a46db00
Eth Event Prover fix issue
mrLSD 57764a1
Fix Promise issue & remove ethabi custom implementation
mrLSD 66113ea
Fix hex dependecy
mrLSD 9ae3f8b
Changed verify_log
mrLSD 567390e
Restructure sdk and code
mrLSD 7aa6665
Exnted dependencies and Connector, reduce wasm size
mrLSD f138044
Fungible tokens extend
mrLSD 14275a2
Transfer FT modifications
mrLSD 2c8ac26
Added EthContract separeted privat implementation
mrLSD d27bc45
Withdraw & burn
mrLSD 391cc1e
Extend Fungible tokens
mrLSD fc1a26c
Modified FT: ft_transfer_call
mrLSD f07749d
Added basic FT Storage functionality & modified SDK
mrLSD 97b66f0
FT Storage Deposit
mrLSD 8c5cae2
Added FT resolve transfer functionality
mrLSD c9f652a
Added sdk sha256 func and changed for Prover
mrLSD dbb77d7
fix free standing lib issues
joshuajbouw fc7e710
PR impovments, changed Cargo.toml dependencies
mrLSD b897b26
fix on_alloc_error
joshuajbouw 8826d58
Merge branch 'pure-evm-connector' of github.com:joshuajbouw/eth-conne…
mrLSD 2934d52
Clippy issues fix
mrLSD 88df87a
PR review changes
mrLSD e9171d8
Simple json parser
mrLSD 863c161
Fungible tokens: modife storage logic
mrLSD 39fd66e
Modified storage flow
mrLSD d211de6
Changed key flow for storage
mrLSD 15d824e
Clippy fixes for String
mrLSD d8c657e
Fix account types
mrLSD 98686df
Modified init_contract - removed serde and added initialization check
mrLSD 656e24b
Removed serde from Proof and added deserialization
mrLSD f2167e9
init contract - remove serde & fix json parser
mrLSD 97723f5
Fix deposit serialization & record proof
mrLSD 4f65be5
json parser improvements
mrLSD fd0aa1d
Fix proof json parser
mrLSD 8204ad9
Removed Withdraw serde and modified serializations
mrLSD 8e018b1
Extended remove serde json
mrLSD 80e0e00
Removed serde for storage_deposit
mrLSD ed67870
Removed serde for ft_transfer_call
mrLSD ca3287e
Removed serde for ft_transfer
mrLSD ce69fac
Fix ft_resolve func & serde dependency. Remove format from panic
mrLSD 5c13f98
Changed build contract logic. Fixed deploy issue for json parse
mrLSD 9977754
Added Gas constants for Deposit function
mrLSD de7125c
Extend debug info. deposit small fix. Withdraw check
mrLSD a2e2843
Pure no-std smart contract integration tests basic implementation
mrLSD 4ae78d5
Integration tests for Deposit
mrLSD f48c344
Integration tests for Withdraw
mrLSD 2f11e22
Fix anyhow lib issue - updated toolchain
mrLSD 389df3b
Extend EthConnector methods for tests
mrLSD 1159819
Added test_ft_total_supply
mrLSD 3788363
Added test_ft_transfer
mrLSD b38caa9
Incresed GAS_FOR_VERIFY_LOG_ENTRY to 9T/gas
mrLSD 505b047
Changed tests for on_transfer
mrLSD 72bcbb4
Fix resolve_transfer & changed integration test for trasfer_call
mrLSD 3661b46
Changed Gas constants
mrLSD File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Cargo.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
[package] | ||
name = "pure-eth-connector" | ||
version = "0.1.0" | ||
authors = ["Near Inc <hello@near.org>"] | ||
edition = "2018" | ||
license = "Apache2" | ||
publish = false | ||
resolver = "2" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Its missing a |
||
[profile.dev] | ||
panic = "abort" | ||
|
||
[profile.release] | ||
codegen-units = 1 | ||
# Tell `rustc` to optimize for small code size. | ||
opt-level = "z" | ||
lto = true | ||
debug = false | ||
panic = "abort" | ||
debug-assertions = false | ||
|
||
[dependencies] | ||
wee_alloc = { version = "0.4.5", default-features = false } | ||
rlp = { version = "0.5", default-features = false } | ||
borsh = { version = "0.8", default-features = false } | ||
primitive-types = { version = "0.8.0", default-features = false, features = ["rlp"] } | ||
hex = { version = "0.4", default-features = false, features = ["alloc"] } | ||
sha3 = { version = "0.8", default-features = false } | ||
serde = { version = "1.0", default-features = false, features=["derive", "alloc"] } | ||
serde_json = { version = "1.0", default-features = false, features=["alloc"] } | ||
ethabi = { git = "https://github.com/darwinia-network/ethabi", branch = "xavier-no-std", default-features = false } | ||
rjson = "0.3.1" | ||
|
||
[dev-dependencies] | ||
near-sdk = { git = "https://github.com/near/near-sdk-rs", tag = "3.0.0" } | ||
near-sdk-sim = { git = "https://github.com/near/near-sdk-rs", tag = "3.0.0" } | ||
funty = "=1.1.0" # temp pin of funty as 1.2.0 is API breaking | ||
|
||
[features] | ||
default = ["log"] | ||
log = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
NEAR_ACC=nostd01.eth-connector.testnet | ||
#NEAR_ACC=dev-1616437086828-5300267 | ||
|
||
build: | ||
@./build.sh | ||
@cp ~/dev/rs/near/eth-connector/pure-eth-connector/Makefile ~/dev/vagrant/near/ || true | ||
|
||
clippy: | ||
@cargo clippy | ||
|
||
check: | ||
@cargo check | ||
|
||
fmt: | ||
@cargo fmt | ||
|
||
test: | ||
@cargo test -- --nocapture | ||
|
||
dev-deploy: | ||
@near dev-deploy -f pure_eth_connector.wasm | ||
|
||
pure-deploy: | ||
@near deploy ${NEAR_ACC} pure_eth_connector.wasm | ||
|
||
balance-of: | ||
@near view ${NEAR_ACC} ft_balance_of --args '{"account_id":"testlocal.testnet"}' --account-id ${NEAR_ACC} | ||
|
||
init-contract: | ||
@near call ${NEAR_ACC} new '{"prover_account": "nostd01.eth-connector.testnet", "eth_custodian_address": "A0DA4462a8e18299b43BAb74F3D9D4dd73B832f3"}' --account-id ${NEAR_ACC} | ||
|
||
deposit: | ||
@near call ${NEAR_ACC} deposit '{"log_index":0,"log_entry_data":[248,251,148,160,218,68,98,168,225,130,153,180,59,171,116,243,217,212,221,115,184,50,243,248,66,160,91,253,175,236,57,174,146,96,226,220,66,250,35,21,1,244,101,251,175,87,166,187,188,197,23,157,14,86,105,51,218,174,160,0,0,0,0,0,0,0,0,0,0,0,0,137,27,39,73,35,139,39,255,88,233,81,8,142,85,176,77,231,29,195,116,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,188,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,116,101,115,116,108,111,99,97,108,46,116,101,115,116,110,101,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"receipt_index":0,"receipt_data":[249,2,6,1,130,98,212,185,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,16,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,32,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,160,218,68,98,168,225,130,153,180,59,171,116,243,217,212,221,115,184,50,243,248,66,160,91,253,175,236,57,174,146,96,226,220,66,250,35,21,1,244,101,251,175,87,166,187,188,197,23,157,14,86,105,51,218,174,160,0,0,0,0,0,0,0,0,0,0,0,0,137,27,39,73,35,139,39,255,88,233,81,8,142,85,176,77,231,29,195,116,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,188,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,116,101,115,116,108,111,99,97,108,46,116,101,115,116,110,101,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"header_data":[249,2,10,160,52,175,28,35,212,43,219,118,100,50,155,243,67,151,135,25,107,63,152,47,27,12,152,84,217,12,55,46,152,0,27,209,160,236,241,119,41,165,201,28,176,193,50,105,138,144,20,102,185,249,31,127,18,132,218,106,114,131,158,60,163,247,161,58,74,148,195,209,112,108,44,194,22,138,43,214,152,220,160,114,168,112,46,237,105,13,160,136,150,190,124,203,215,26,177,22,122,114,88,32,157,249,176,74,228,176,62,200,3,164,220,187,78,66,232,223,55,69,150,160,118,196,96,197,96,10,249,177,143,193,228,135,86,120,113,174,85,212,247,104,218,99,25,111,31,205,135,41,156,57,124,190,160,11,137,69,203,17,143,230,78,116,142,231,228,166,250,243,175,251,128,92,231,109,252,212,60,130,203,250,201,72,54,102,41,185,1,0,0,0,0,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,64,0,0,0,16,16,0,128,0,128,0,192,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,32,0,64,0,0,0,0,0,128,0,1,0,0,0,0,0,0,0,0,8,0,0,0,0,1,0,0,0,0,0,0,0,0,0,2,0,0,0,0,2,0,0,0,0,0,0,2,0,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,48,0,0,1,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,4,0,0,4,0,0,64,0,0,0,0,0,32,0,0,2,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,2,0,0,0,0,5,64,0,0,0,0,17,0,0,32,0,64,0,0,0,1,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,8,0,64,0,8,2,0,0,0,0,0,0,0,0,0,0,0,132,23,190,160,119,131,150,74,168,131,122,18,0,131,100,11,213,132,96,80,190,238,140,115,112,105,100,101,114,49,48,1,0,92,232,160,108,84,192,236,215,221,108,3,203,227,241,55,170,71,149,12,225,89,118,4,252,87,168,230,200,179,177,65,40,61,23,65,136,191,224,164,14,79,193,69,164],"proof":[[248,113,160,191,130,100,43,198,25,70,230,107,127,147,206,10,34,24,53,38,15,190,133,85,218,172,121,58,216,57,211,81,181,104,226,160,44,196,36,108,23,215,156,136,179,114,2,36,249,248,242,60,163,116,55,75,27,155,203,12,210,211,28,47,38,78,132,123,128,128,128,128,128,128,160,148,123,179,172,166,113,217,60,161,148,169,218,181,106,200,124,214,60,70,50,1,244,213,68,180,214,73,135,185,174,53,244,128,128,128,128,128,128,128,128],[249,2,13,48,185,2,9,249,2,6,1,130,98,212,185,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,16,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,32,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,248,253,248,251,148,160,218,68,98,168,225,130,153,180,59,171,116,243,217,212,221,115,184,50,243,248,66,160,91,253,175,236,57,174,146,96,226,220,66,250,35,21,1,244,101,251,175,87,166,187,188,197,23,157,14,86,105,51,218,174,160,0,0,0,0,0,0,0,0,0,0,0,0,137,27,39,73,35,139,39,255,88,233,81,8,142,85,176,77,231,29,195,116,184,160,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,116,188,146,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,17,116,101,115,116,108,111,99,97,108,46,116,101,115,116,110,101,116,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],"skip_bridge_call":false}' --account-id ${NEAR_ACC} --gas 300000000000000 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# RUSTFLAGS='-C link-arg=-s' cargo build --lib --target wasm32-unknown-unknown --no-default-features --release -Z avoid-dev-deps | ||
RUSTFLAGS='-C link-arg=-s' cargo build --lib --target wasm32-unknown-unknown --release -Z avoid-dev-deps | ||
mkdir -p res | ||
cp target/wasm32-unknown-unknown/release/pure_eth_connector.wasm ./res/ | ||
|
||
# wasm-opt -Oz --output ./res/near_evm.wasm ./res/near_evm.wasm | ||
ls -lh res/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nightly-2021-01-30 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of scope for this PR