dapphub / hevm Goto Github PK
View Code? Open in Web Editor NEW(OLD REPO) A debug-oriented Ethereum VM (EVM)
Home Page: https://dapp.tools
(OLD REPO) A debug-oriented Ethereum VM (EVM)
Home Page: https://dapp.tools
make it a good debugger!
Need slight refactoring of blocking I/O interacting with the event
handler stuff.
We would like to have at least a status showing while downloading is
in progress, maybe a modal popup.
It might even be worth it to make a Y/N dialog box query.
https://github.com/paritytech/parity/pull/5307/files
https://hackage.haskell.org/package/mcl
seems pretty tricky to me
An Org mode document with descriptions and thoughts about
architecture, implementation details, etc.
Implement RETURNDATASIZE
and RETURNDATACOPY
.
In order to do more easily do interesting things in the debugger, we
should have a console that pops up on Enter and lets you inspect and
manipulate the state of the VM and the environment.
Basic commands:
[ ] list known contract addresses
[ ] see contract details
[ ] get storage slot
can't just call into the runtime code yo
Right now the big steppers just take single steps when there's no source map.
Should be easy.
See sc-forks/solidity-coverage#41 (comment)
Some small modifications to hevm
should let us do precise coverage analysis of unit test suites.
Implementation thoughts...
Stepper
interpreter defined in UnitTest
, after each instruction we would save the current code position (e.g., code hash and program counter).Given that we don't have any blockhashes yet, I don't know if we need
to do anything.
Implement STATICCALL
.
In interactive mode, show a gas counter.
We're getting there!
We should be able to create repositories when they don't exist, and also to automatically reset --hard
the working tree if there are no conflicts with local changes.
The gitlib-cmdline
library can do these things, but maybe we should just shell out in a trivial way.
Turns out that gitlib
is both too complex for what we need, and too unsupported.
I made an external library https://github.com/lessrest/restless-git that could be adapted like this.
The name "context trace" isn't accurate and the current type is silly.
The current command syntax is a bit awkward...
Will need some crypto dependencies etc.
Running into an interesting issue when creating contracts with the .value()
function when using DSTest
.
I'd like to seed contracts with ether using the value
field of the transaction, so I can limit payments to just the constructor, but checking the contract balance post-creation still shows a zero balance. transfer()
of course works when I add a payable fallback, but I'd prefer to not have a payable fallback to avoid unintended ether transfers.
I made a test repo here https://github.com/ngmiller/dapp-value-test - with the relevant code here: https://github.com/ngmiller/dapp-value-test/blob/master/src/DappValueTest.t.sol#L11-L14
Results of dapp test
:
+ dapp clean
+ rm -rf out
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --abi --bin --bin-runtime = -o out/ src/DappValueTest.t.sol
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast = src/DappValueTest.t.sol
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --abi --bin --bin-runtime = -o out/ src/DappValueTest.sol
+ solc --overwrite ds-test/=lib/ds-test/src/ ds-test=lib/ds-test/src/index.sol --combined-json=abi,bin,bin-runtime,srcmap,srcmap-runtime,ast = src/DappValueTest.sol
Running 2 tests for src/DappValueTest.t.sol:DappValueTestTest
FAIL test_balance()
PASS test_value() (gas: 3390)
Failure: test_balance
"Error: Wrong `uint' value"
Expected: ~1.00000000e18
Actual: 0
src/DappValueTest.t.sol:DappValueTestTest
├╴constructor
├╴initialize test
│ └╴create DappValueTest (src/DappValueTest.t.sol:11)
└╴test_balance()
├╴log_bytes32("Error: Wrong `uint' value") (lib/ds-test/src/test.sol:112)
├╴log_named_uint(" Expected", 1000000000000000000) (lib/ds-test/src/test.sol:113)
└╴log_named_uint(" Actual", 0) (lib/ds-test/src/test.sol:114)
Linking with Solidity libraries requires loading code at particular addresses known in advance, which is right now possible through the Git state directory feature, but it should be thought through and then support should be implemented in dapp
.
Turns out that the VMTests
part of the Ethereum Foundation test
suite is made for the Homestead fork.
I don't know if the plan is to upgrade those tests to Metropolis, or
deprecate that whole suite... it's a bit confusing.
Now that we can load states, we could rather easily load that state over the network from an actual blockchain.
Some wreq
requests and aeson
fiddling should be enough for the fetching.
We should also be able to autofetch missing contracts and refresh. This would require turning the exec
function into a kind of coroutine that supports fetching. We could then have different fetching behaviors, e.g. in the debugger we show a dialog asking about the fetch, etc.
Implement the special logic for the null sender and also CREATE2
.
I guess the proper solution, since the tests run in parallel, is to
have a shared mutable cache. Using STM it should be pretty easy.
Needs to return data, similar to RETURN, but revert state changes.
We need a way to track which tests are failing.
I'm using hsevm to test my own manually written assembly and copy-pasting the bytecode manually into cli is cumbersome. -o
option to load the file directly instead of --code
would be useful.
This doesn't look helpful, but it's the only error message given.
FAIL test_transfer()
hevm: internal error: method type
CallStack (from HasCallStack):
error, called at src/EVM/Solidity.hs:214:22 in hevm-0.12.3-F2xYvHyywk1C4HRq6dL7d:EVM.Solidity
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.