Commit Graph

2155 Commits

Author SHA1 Message Date
Yuriy Glukhov 04bacca35c
Merge pull request #81 from status-im/ClampMemoryGasCostToNonnegative
accessing memory can't cost less than nothing
2018-07-25 13:48:21 +03:00
Yuriy Glukhov 8713939bfe
Merge pull request #82 from status-im/ImplementSelfDestructOp
Implemented selfDestruct op
2018-07-25 13:41:14 +03:00
coffeepots 47e5081f86 TODO comment for other forks on the selfdestruct op 2018-07-25 10:40:08 +01:00
Dustin Brody 85e1c39a83 accessing memory can't cost less than nothing 2018-07-24 18:37:56 -07:00
Yuriy Glukhov 9f01223dd2
Merge pull request #80 from status-im/FixEndiannessMStore8
mstore8 wants LSB of BE representation, i.e. last byte
2018-07-24 23:05:36 +03:00
Dustin Brody c2ed3bf11e mstore8 wants LSB of BE representation, i.e. last byte 2018-07-24 12:25:21 -07:00
coffeepots 52daaf49c0 Implemented selfDestruct op 2018-07-24 17:21:29 +01:00
Yuriy Glukhov 473140f586
Merge pull request #79 from status-im/FixExtCodeCopyCost
ExtCodeCopy is a memory expansion operation for gas computation purposes
2018-07-24 12:19:04 +03:00
Yuriy Glukhov e8453e3876
Merge pull request #78 from status-im/FixZeroSizeSha3
add subcase of yellow paper equation (297) for zero-length memory ranges
2018-07-24 12:15:41 +03:00
Dustin Brody df23f802c6 ExtCodeCopy is a memory expansion operation for gas computation purposes 2018-07-23 17:00:06 -07:00
cheatfate 9dc9a18c42 Attempt to fix appveyor tests. 2018-07-24 01:53:41 +03:00
Zahary Karadjov 870eb175c0 update to the latest eth_p2p 2018-07-24 00:44:04 +03:00
Dustin Brody 00cd33febd add subcase of yellow paper equation (297) for zero-length memory ranges 2018-07-23 14:00:49 -07:00
Zahary Karadjov 7f4d97dca0 add the ETH and LES protocol implementations to the nimbus build 2018-07-23 00:34:43 +03:00
mratsim a226bab661 Add test_vm_json instructions 2018-07-20 22:02:52 +02:00
Zahary Karadjov 1602c8ca03 restore the compilation of the main nimbus executable 2018-07-20 20:02:19 +03:00
Yuriy Glukhov 01a920b3b6
Merge pull request #76 from status-im/FixFailOnEmptyChildComputation
Only write to child computation if data present
2018-07-20 11:15:12 +03:00
Yuriy Glukhov 31c9365e48
Merge pull request #75 from status-im/RemoveValidateCanonicalAddress
Remove validateCanonicalAddress
2018-07-20 11:15:00 +03:00
Yuriy Glukhov 3e201aab03
Merge pull request #77 from status-im/FixRpcImports
Change import from eth-rpc to json_rpc
2018-07-20 11:14:47 +03:00
coffeepots 6e10e306a6 Change import from eth-rpc to json_rpc 2018-07-20 08:57:51 +01:00
coffeepots 868f2b1959 Remove if statement for actualOutputSize - 1 2018-07-20 08:53:56 +01:00
coffeepots 6ce46c0163 Only write to child computation if data present 2018-07-19 19:14:17 +01:00
coffeepots e33bc85bfa Remove validateCanonicalAddress 2018-07-19 19:04:01 +01:00
Yuriy Glukhov feaff16e9d Corrected jump boundary check. Nonexistent sload pushes 0. (#74) 2018-07-19 15:11:52 +02:00
Yuriy Glukhov b2acf3a5e3 GasMeter is an object now (#73) 2018-07-18 14:18:17 +02:00
Yuriy Glukhov 6c67115ef5 Fixed sstore gas computation, empty sha3, smod, sdiv (#71)
* Fixed sstore gas computation, fixed empty sha3

* Fixed smod and sdiv

* Comments addressed
2018-07-18 11:14:28 +02:00
mratsim ca5eba20f8 update example 2018-07-17 19:18:59 +02:00
Yuriy Glukhov 601db4d9f3 Fixed a few more tests (#70)
* Fixed getting reading balance from the test fixtures

* Fixed sha3 opcode
2018-07-17 10:57:13 +02:00
Yuriy Glukhov c8be4be5f1
Merge pull request #69 from status-im/add-log-memory-validation
Refactored log opcodes, added validation, fixed a couple of tests
2018-07-16 12:34:37 +03:00
Yuriy Glukhov 46a8b5dc49 Refactored log opcodes, added validation, fixed a couple of tests 2018-07-16 11:14:52 +02:00
Zahary Karadjov 9c88710ed6 Apply the P2PServer -> EthereumNode rename 2018-07-12 14:14:04 +03:00
Mamy Ratsimbazafy 4dd75aee84
Delete utilities: address, padding, bytes (#68)
* Delete utilities: address, padding, bytes

* Remove bigEndianToInt

* Fix C compiler error: member reference base type 'char' is not a structure or union

* fix todo comment
2018-07-06 17:08:31 +02:00
Mamy Ratsimbazafy 4b5eada322
Refactor interpreter dispatch (#65)
* move forks constants, rename errors

* Move vm/utils to vm/interpreter/utils

* initial opcodes refactoring

* Add refactored Comparison & Bitwise Logic Operations

* Add sha3 and address, simplify macro, support pop 0

* balance, origin, caller, callValue

* fix gas copy opcodes gas costs, add callDataLoad/Size/Copy, CodeSize/Copy and gas price opcode

* Update with 30s, 40s, 50s opcodes + impl of balance + stack improvement

* add push, dup, swap, log, create and call operations

* finish opcode implementation

* Add the new dispatching logic

* Pass the opcode test

* Make test_vm_json compile

* halt execution without exceptions for Return, Revert, selfdestruct (fix #62)

* Properly catch and recover from EVM exceptions (stack underflow ...)

* Fix byte op

* Fix jump regressions

* Update for latest devel, don't import old dispatch code as quasiBoolean macro is broken by latest devel

* Fix sha3 regression on empty memory slice and until end of range slice

* Fix padding / range error on expXY_success (gas computation left)

* update logging procs

* Add tracing - expXY_success is not a regression, sload stub was accidentally passing the test

* Reuse the same stub as OO implementation

* Delete previous opcode implementation

* Delete object oriented fork code

* Delete exceptions that were used as control flows

* delete base.nim 🔥, yet another OO remnants

* Delete opcode table

* Enable omputed gotos and compile-time gas fees

* Revert const gasCosts -> generates SIGSEGV

* inline push, swap and dup opcodes

* loggers are now template again, why does this pass new tests?

* Trigger CI rebuild after rocksdb fix https://github.com/status-im/nim-rocksdb/pull/5

* Address review comment on "push" + VMTests in debug mode (not release)

* Address review comment: don't tag fork by default, make opcode impl grepable

* Static compilation fixes after rebasing

* fix the initialization of the VM database

* add a missing import

* Deactivate balance and sload test following #59

* Reactivate stack check (deactivated in #59, necessary to pass tests)

* Merge remaining opcodes implementation from #59

* Merge callDataLoad and codeCopy fixes, todo simplify see #67
2018-07-06 09:52:31 +02:00
zah 18b7bbb3b0 Implemented most of the stubbed-out state handling instructions (#59)
Merge note: currently cannot compile due to `quasiBoolean` (#63). This will be solved by https://github.com/status-im/nimbus/pull/65
----

* Implemented most of the stubbed out state handling instructions

The code compiles, but still fails at the moment due to incorrect

initialization of the VM. Don't merge yet. More commits will be
pushed in the coming days.

* Fixed crash

* trie put and del are void now

* getBlockTransactionData and getReceipts

* Working code for extcodesize0.json

* fix origin.json

* fix calldatasize1

* fix calldataloadSizeTooHighPartial

* fix calldataloadSizeTooHigh

* more efficient PushX implementation

* fix and, or, xor
2018-07-05 14:41:01 +02:00
zah 6f28d11866 Few steps towards having 64-bit block numbers (#57)
Some of the other clients don't bother to store block numbers as
256-bit integers (64 bits or even 32 bit are enough).

The changes here are based on helpers introduced in eth_common
that try to abstract away all conversion steps in the code between
VM words and block numbers in variables in fields. Unfortunately,
this turn out to be more work than anticipated and I've postponed
finishing the refactoring for now (Block numbers are still 256 bit).
2018-06-26 16:09:50 +02:00
Zahary Karadjov 3060452d96 review changes
* `usedBytes` was not named appropriately. it indicates the last
  populated position in the data (the last valid index) for slicing
  purposes (i.e. the position is passed to `toOpenArray`)

* Fixed the `==` operator for DBKeys

* Use one-byte key for the 'canonical head hash'
2018-06-26 13:46:54 +03:00
Zahary Karadjov 583c72fa54 Implement storage backends using RocksDB and SQLite 2018-06-26 13:46:54 +03:00
Yuriy Glukhov 1c79d1ab3d Persist* functions 2018-06-24 18:37:02 +03:00
Zahary Karadjov 14a1b51981 Updated Nix build environment for working with Nimbus
Other changes:

* For the macOS builds in Travis, attempt to install rocksdb through brew
2018-06-24 17:46:43 +03:00
cheatfate 822c6e0a7d Fix asyncdispatch2 dependency. 2018-06-20 20:36:03 +03:00
cheatfate 533bd6caf4 Integrated P2P & RPC servers. 2018-06-20 20:27:32 +03:00
Yuriy Glukhov 361e41f688
Merge pull request #55 from markspanbroek/add-build-instructions
Add rudimentary build & test instructions to Readme
2018-06-20 15:09:28 +03:00
Mark Spanbroek 77127db44b Add rudimentary build & test instructions to Readme
Fixes #43
2018-06-20 13:56:43 +02:00
Zahary Karadjov 48fdf6a644 build nimbus with nimble build 2018-06-20 14:12:29 +03:00
Yuriy Glukhov 5bd35e5c82
Merge pull request #54 from markspanbroek/fix-nimble-warning
Fix nimble warning
2018-06-20 11:07:48 +03:00
Yuriy Glukhov 5040ad0d1c
Merge pull request #53 from markspanbroek/fix-example
Fix import in example
2018-06-20 11:07:24 +03:00
Mark Spanbroek d1d7e2342e Fix nimble warning
Nimble warns about .nim files that are outside of the 'nimbus' directory
when they are not mentioned in the skipDirs.
2018-06-19 21:17:20 +02:00
Mark Spanbroek cb36a0c18d Fix import in example 2018-06-19 21:15:43 +02:00
Zahary Karadjov eacf13ed97 ethp2p was renamed to eth_p2p 2018-06-16 22:14:31 +03:00
mratsim 05703fc86f logging: non-debug costless, avoid allocating constant string messages 2018-06-15 14:20:42 +02:00