ewasm / evm2wasm Goto Github PK
View Code? Open in Web Editor NEW[ORPHANED] Transcompiles EVM code to eWASM
License: Mozilla Public License 2.0
[ORPHANED] Transcompiles EVM code to eWASM
License: Mozilla Public License 2.0
Branch | Build failing π¨ |
---|---|
Dependency | standard |
Current Version | 10.0.2 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As standard is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 99 commits.
91e80a1
10.0.3
82a0d5c
changelog
d22676e
Merge pull request #963 from daper/patch-1
cfb84fe
Remove tilde to lock down eslint-config-standard-jsx version
4a6e0d0
Update dependecy of eslint-config-standard-jsx
ac9e09e
Merge pull request #961 from igorsantos07/patch-1
873bc9b
Adding valid example for no-unsafe-negation
f00b169
more feross/standard -> standard/standard
9770303
Merge pull request #954 from standard/security
8cc2285
Add a security policy
2fa8b0f
change more feross/standard -> standard/standard
e79a692
Merge branch 'devjin0617-translation-kr'
34490f7
Merge branch 'translation-kr' of https://github.com/devjin0617/standard into devjin0617-translation-kr
6d59566
Merge pull request #953 from standard/translations
3895bc6
move english readme/rules to docs/ folder
There are 99 commits in total.
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
The standard deploy (copycode) and Solidity's dispatcher is the bare minimum code included in every Solidity compiled code.
Example:
contract WASMTest {
function() {
throw;
}
}
Compiles to: 606060405260188060106000396000f360606040523615600d57600d565b60165b6002565b565b00
This requires the following opcodes:
It is probably a good idea supporting these first.
This should be good enough to determine that all code paths of the transcompiler are used.
Goal would be to replace constant arithmetic patterns, such as:
PUSH X, PUSH Y, EXP
-> PUSH X**Y
, PUSH X, PUSH Y, ADD
-> PUSH X+Y
, etc.PUSH X, POP
-> removePUSH X, PUSH 0, EQ
-> PUSH X, ISZERO
It is true that Solidity will do these optimisations, but:
In order to support MSTORE/MLOAD we need to properly manage memory.
A simplistic approach is to allocate the first 32768 bytes of memory for the stack (stack limit is 1024 items, 256 bits each). The memory for MSTORE/MLOAD then starts from offset 32768.
Alternatively the opcodes themselves could have a parameter for memory offset. This should be calculated by the transcompiler.
Branch | Build failing π¨ |
---|---|
Dependency | ethereumjs-vm |
Current Version | 2.1.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As ethereumjs-vm is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 79 commits.
7041680
2.2.0
a25c4ed
Merge pull request #154 from holgerd77/master
4760718
Merge pull request #152 from gasolin/fix
46eea0a
Merge branch 'master' into fix
6a60906
Merge pull request #157 from cdetrio/fix-cache-del
09e1365
Update cache.js
8a554b5
null address check before deleting account from trie
b487c8d
Merge remote-tracking branch 'upstream/master'
5e9fa06
fix run-transactions-simple example and update README, fix #149
9fc6e38
fix Block and Account links in README.md (#155)
7f12684
EIP-6: Rename SUICIDE opcode (#153)
51a6a0c
Merge pull request #147 from jwasinger/wip/spurious-dragon
853ec10
cleaner empty account conditional
4a8d939
bump common package
29004b6
Draft for release notes for upcoming EIP150/Spurious Dragon release(s)
There are 79 commits in total.
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
It would be really nice to have some unit tests for these to improve our test coverage. a basic test case for each option would suffice.
The biggest one could be introducing pseudo-EVM opcodes for shifting (or maybe with time they won't be psuedo, see ethereum/EIPs#145) and replace MUL
/ DIV
/ SDIV
with two's exponent with appropriate shifts.
Use it to store/retrieve test env values.
Needed for support opcodes which call out to the environment, such as CALLDATASIZE
, CALL
, RETURN
, etc.
evm2wasm
support a version of stack tracing using the evmStackTrace
method (https://github.com/ewasm/ewasm-kernel/blob/master/debugInterface.js#L30-L40).
This will now be extended to support the "official tracing format": ewasm/hera#114
It can be turned on by the opts.stacktrace
flag in evm2wasm - this should be documented.
Needed for opcodes like CALL
/RETURN
/etc.
Operations should ensure that the stack limit (1024 entries) is not exceeded.
This one test is failing in the current master
branch (e050d24):
evm2wasm/ master> npm run vmTests
> [email protected] vmTests /Users/lanerettig/wip/eth/evm2wasm
> node --expose-wasm --harmony ./tests/runVmTests.js
TAP version 13
# VMTESTS
...
# manyFunctions100 manyFunctions100
not ok 1425 Error: Command failed: /Users/lanerettig/wip/eth/evm2wasm/tools/wabt/bin/wat2wasm /Users/lanerettig/wip/eth/evm2wasm/tmp/manyFunctions100.wast -o /Users/lanerettig/wip/eth/evm2wasm/tmp/manyFunctions100.wasm
---
operator: fail
at: runner.catch.err (/Users/lanerettig/wip/eth/evm2wasm/tests/runVmTests.js:171:9)
stack: |-
Error: Error: Command failed: /Users/lanerettig/wip/eth/evm2wasm/tools/wabt/bin/wat2wasm /Users/lanerettig/wip/eth/evm2wasm/tmp/manyFunctions100.wast -o /Users/lanerettig/wip/eth/evm2wasm/tmp/manyFunctions100.wasm
at Test.assert [as _assert] (/Users/lanerettig/wip/eth/evm2wasm/node_modules/tape/lib/test.js:225:54)
at Test.bound [as _assert] (/Users/lanerettig/wip/eth/evm2wasm/node_modules/tape/lib/test.js:77:32)
at Test.fail (/Users/lanerettig/wip/eth/evm2wasm/node_modules/tape/lib/test.js:318:10)
at Test.bound [as fail] (/Users/lanerettig/wip/eth/evm2wasm/node_modules/tape/lib/test.js:77:32)
at runner.catch.err (/Users/lanerettig/wip/eth/evm2wasm/tests/runVmTests.js:171:9)
at <anonymous>
...
Attempting to run this command manually produces:
~/wip/eth/evm2wasm master> /Users/lanerettig/wip/eth/evm2wasm/tools/wabt/bin/wat2wasm /Users/lanerettig/wip/eth/evm2wasm/tmp/manyFunctions100.wast -o /Users/lanerettig/wip/eth/evm2wasm/tmp/manyFunctions100.wasm
[1] 48249 segmentation fault /Users/lanerettig/wip/eth/evm2wasm/tools/wabt/bin/wat2wasm -o
The identity contract is used for a cheap way of memory copy (gas cost 15 + length/32*3
). We could detect a call to it during transcompilation and use a wasm based memcpy.
Drawback is it introduces the need for static analysis to find the parameters on the stack first.
Branch | Build failing π¨ |
---|---|
Dependency | ethereumjs-util |
Current Version | 5.1.2 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
ethereumjs-util is a direct dependency of this project, and it is very likely causing it to break. If other packages depend on yours, this update is probably also breaking those in turn.
ES6
syntax updates5
supportenv
presetsafe-buffer
instead of Node Buffer
0X
as valid address in isValidAddress()
zeroAddress()
and isZeroAddress()
The new version differs by 40 commits.
3e72947
Release commit for v5.1.3
279ac78
Updated deprecated babel es2015 to env preset
3d05254
chore(package): update babelify to version 8.0.0
aed81b9
Merge pull request #106 from ethereumjs/greenkeeper/karma-2.0.0
acc9130
chore(package): update karma to version 2.0.0
a65787d
Merge pull request #102 from ethereumjs/greenkeeper/karma-detect-browsers-2.2.6
deb4019
chore(package): update karma-detect-browsers to version 2.2.6
193a119
Merge pull request #98 from ethereumjs/greenkeeper/mocha-4.0.0
f0aafb0
Update travis to build with Node 8 (from Node 7)
5d59ad6
Merge branch 'master' into greenkeeper/mocha-4.0.0
9e6cda9
Merge pull request #96 from ethereumjs/greenkeeper/coveralls-3.0.0
7f31795
Merge branch 'master' into greenkeeper/coveralls-3.0.0
15d4085
Merge pull request #91 from ethereumjs/greenkeeper/documentation-5.2.0
0c0f23f
Rebuild docs with new documentation version
d75a4b2
Updated build:docs command to reflect syntax changes from updated documentation version
There are 40 commits in total.
See the full diff
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Requiring every Ethereum node implementation to rewrite this Javascript project in their language of choice seems unrealistic.
Perhaps making this project available as a WASM piece of code makes sense, given WASM must be supported by nodes.
Ultimately for reducing/removing issues regarding consensus, this project should be deployed as a smart contract and invoked as such.
Logging this to track the conversation yesterday in gitter:
@axic Mar 21 18:38 very likely evm2was has endianess issues
@hugo-dc Mar 21 18:52 iβve just confirmed storage is the problem, fill the tests expecting "0x" : β0x0200000000000000000000000000000000000000000000000000000000000000β in storage, and the test case pass
@jwasinger Mar 21 19:19 I have the fix. the endianness is being flipped by bswap_m256 : ;; generated by ./wasm/generateInterface.js\n(func $SSTORE (call $storageStore(call $bswap_m256 (get_global $sp))(call $bswap_m256 (i32.add (get_global $sp) (i32.const -32)))))
Tests should be run for every opcode
EXP uses floating point for gas calculation: https://github.com/ewasm/evm2wasm/blob/master/wasm/EXP.wast#L81-L82
This should be removed as the spec currently just disables floating point (the code in question should still be deterministic, but it is quite easy to replace it with non-floating point).
Ensure consistent, readable style
1 that is unreachable
for mem checks
2 2^31-1 for things calldata/code interface imports
Gas costs are still set at Homestead. Need to apply Spurious Dragon and Tangerine Whistle changes.
Branch | Build failing π¨ |
---|---|
Dependency | tape |
Current Version | 4.7.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As tape is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 4 commits.
342c89a
v4.8.0
c82c593
[Dev Deps] update js-yaml
b50084c
[Deps] update resolve
, object-inspect
bd6db7b
updates README.md and adds tap-html
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
Would be a nice demonstration to use Mango. It requires the following opcodes:
Here is a full trace of the test case callcall_00
:
jwasinger@certification-hive-test03:~/projects/cpp-ethereum/build$ ETHEREUM_TEST_PATH="../../tests" test/testeth -t GeneralStateTests/stCallCodes -- --vm hera --singlenet "Byzantium" --singletest 'callcall_00' --evmc evm2wasm.js=true --evmc fallback=false
Running 1 test case...
Test Case "stCallCodes":
100%
Executing...
importGlobals
evmTrace
{"depth":0,"gas":2979000,"gasCost":0,"op":96,"pc":0,"stack":[]}
useGas 3
evmTrace
{"depth":0,"gas":2978997,"gasCost":3,"op":96,"pc":2,"stack":["0x0000000000000000000000000000000000000000000000000000000000000040"]}
useGas 3
evmTrace
{"depth":0,"gas":2978994,"gasCost":6,"op":96,"pc":4,"stack":["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040"]}
useGas 3
evmTrace
{"depth":0,"gas":2978991,"gasCost":9,"op":96,"pc":6,"stack":["0x0000000000000000000000000000000000000000000000000000000000000040","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040"]}
useGas 3
evmTrace
{"depth":0,"gas":2978988,"gasCost":12,"op":96,"pc":8,"stack":["0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040"]}
useGas 3
evmTrace
{"depth":0,"gas":2978985,"gasCost":15,"op":115,"pc":10,"stack":["0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040"]}
useGas 3
evmTrace
{"depth":0,"gas":2978982,"gasCost":18,"op":98,"pc":31,"stack":["0x0000000000000000000000001000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040"]}
useGas 3
evmTrace
{"depth":0,"gas":2978979,"gasCost":21,"op":241,"pc":35,"stack":["0x0000000000000000000000000000000000000000000000000000000000055730","0x0000000000000000000000001000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000001","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040","0x0000000000000000000000000000000000000000000000000000000000000000","0x0000000000000000000000000000000000000000000000000000000000000040"]}
useGas 0
useGas 6
InternalError: Value exceeds 64 bits.
testeth: /home/jwasinger/projects/cpp-ethereum/libevm/EVMC.cpp:77: virtual dev::eth::owning_bytes_ref dev::eth::EVMC::exec(dev::u256&, dev::eth::ExtVMFace&, const OnOpFunc&): Assertion `r.status() >= 0' failed.
unknown location(0): fatal error: in "GeneralStateTests/stCallCodes": signal: SIGABRT (application abort requested)
The execution is compatible with Geth until after the CALLCODE
op is executed.
It would be nice to have consistent local names across the wasm files
Branch | Build failing π¨ |
---|---|
Dependency | async |
Current Version | 2.5.0 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
async is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those donβt help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot π΄
Depends on ewasm/wast2wasm#9
In many cases it should be possible to write the return values directly to the stack.
Per @cdetrio:
stack pointer starting at -32 https://github.com/ewasm/evm2wasm/blob/master/index.js#L509
this whole thing needs to be moved up, because the trace should print before the instruction executes (standardized trace). where it is now, it prints after the first instruction https://github.com/ewasm/evm2wasm/blob/master/index.js#L319-L322
Cf. ewasm/hera#164
Needed for opcodes like PUSH
/DUP
/SWAP
returndatacopy
Some values need to be tested on the output (return value, gas left, etc.)
Currently environment
is hard coded as input and the return value has its own wrapper and field (return
- see https://github.com/ewasm/evm2wasm/blob/master/tests/opcodeRunner.js#L83).
Branch | Build failing π¨ |
---|---|
Dependency | bn.js |
Current Version | 4.11.7 |
Type | devDependency |
This version is covered by your current version range and after updating it in your project the build failed.
As bn.js is βonlyβ a devDependency of this project it might not break production or downstream projects, but βonlyβ your build or test tools β preventing new deploys or publishes.
I recommend you give this issue a high priority. Iβm sure you can resolve this πͺ
The new version differs by 3 commits.
c69b4ae
4.11.8
f49058f
lib: remove obfuscation
7e6f9d2
lib: properly exclude "buffer" from Webpack builds
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot π΄
See ethereum/EIPs#150.
It should match the costs of Byzantium exactly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.