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

Add support for Remix debugging of EVM call #1496

Closed
wants to merge 54 commits into from
Closed

Add support for Remix debugging of EVM call #1496

wants to merge 54 commits into from

Conversation

Sriep
Copy link
Contributor

@Sriep Sriep commented Sep 23, 2019

  • I added unit tests for any code that added
  • I updated the CHANGELOG.md
  • All IP is original and not copied from another source
  • I assign all copyright to Loom Network for the code in the pull request

To use this PR you need three other PRs.
loomchian PR1492 Refactor the State object from loomchain into a separate package.
transfer gateway PR95 Move config to separate package to reduce cyclic dependencies
Change to go-ethereum to access some internal objects loomnetwork/go-ethereum#8

Note that the optimal second parameter is not supported. So include {} instead of leaving it out. This is because it is using existing QuerySever endpoint mapping code that does not support optional parameters. This feature can be added when added to a separate private interface.

issue #1482
Includes refactoring of middleware object to separate package
Implements debug_traceTransaction as outlined in Management APIs
Based off #1491 .

@Sriep
Copy link
Contributor Author

Sriep commented Sep 30, 2019

There is a lot of refactoring needed to allow transactions to be run off-chain in separate threads.

Refactoring I

These changes do not change code except to move code into different or new packages. The aim is to prevent cyclic imports by reducing imports of loomchian root directory. And isolating code called, directly or indirectly, from loomchain root.

  1. Uses loomchain: PR91 to move the state into a separate package loomchian\state.
  2. loomchain/config move config structs into the config package. transfer-gatway:PR95 moves gateway/config.go into separate package gatway/config/config.go to prevent import cycles including loomchain root.
  3. Move loomchain/sequence.go into the auth package, loomchian/auth/sequence/sequence.go.
  4. In /loomchain/auth package, created new lomchian/auth/keys package for code exported to loomchiain root package.
  5. Created new txhandler package for the middleware code. The loomchain/txhandler root holding the interface and other exported objects. loomchian/txhandler/middleware contains the middleware implementation.
  6. Moved loomchian\tx_handler package into loomchian\txhandler and renamed migration.

Refactoring II

Created a new TxHandlerFacotry in /loomchian/txhandler/factory. This object contains and replaces the TxHandler creation code from loomchian\cmd\loom\loom.go. It allows the creation of custom tx handles on demand.

New Objects

  1. loomchian\store new iAVLVersionReader. This is a KVReader that takes an IAVLStore and an existing version in that IAVLStore and allows you to view the data as it was in the IAVLStore when that version was saved.
  2. splitStore An VersionedKVStore built from a KVReader and an empty store, using the KVReader to retrieve data and the empty store for any changes.
  3. A new object for replaying and running transactions independent of tendermint.
type InMemoryApp interface {
	ProcessTx(txBytes []byte) (txhandler.TxHandlerResult, error)
	TraceProcessTx(txBytes []byte, traceCfg eth.TraceConfig) (txhandler.TxHandlerResult, vm.Tracer, error)
	RunUpTo(height, index int64) error
	NextBlock()
	Height() int64
}
  1. New InMemoryApp method added to the StateProvider interface. Implimentation added to app.go to return an InMemoryApp object.
  2. New \loomchain\rpc\debug package for Management APIs. TraceTransaction impliments debug_traceTransaction.

@Sriep Sriep changed the base branch from master to appstate September 30, 2019 11:12
@Sriep Sriep requested a review from enlight September 30, 2019 11:14
@Sriep Sriep changed the title WIP Add support for Remix debugging of EVM call Add support for Remix debugging of EVM call Sep 30, 2019
# Conflicts:
#	auth/auth.go
#	auth/auth_test.go
#	cmd/loom/loom.go
#	eth/polls/polls_test.go
#	eth/query/query_test.go
rpc/debug/trace.go Outdated Show resolved Hide resolved
rpc/debug/trace.go Outdated Show resolved Hide resolved
store/multi_writer_app_store.go Outdated Show resolved Hide resolved
app.go Outdated Show resolved Hide resolved
Sriep added 7 commits October 18, 2019 16:39
# Conflicts:
#	auth/multi_chain_sigtx_middleware.go
#	auth/multi_chain_sigtx_middleware_test.go
#	cmd/loom/loom.go
#	eth/polls/polls_test.go
#	rpc/query_server.go
#	rpc/query_service.go
#	throttle/contract_tx_limiter_middleware.go
#	throttle/karma-middleware.go
#	throttle/legacy_deployer_middleware.go
#	throttle/middleware_test_helper.go
#	throttle/throttle.go
#	throttle/throttle_test.go
#	txhandler/middleware/deployer-middleware.go
#	txhandler/middleware/deployer-middleware_test.go
store/multi_writer_app_store.go Outdated Show resolved Hide resolved
store/iavlstore.go Outdated Show resolved Hide resolved
store/multi_writer_app_store.go Show resolved Hide resolved
rpc/debug/trace.go Outdated Show resolved Hide resolved
replay/replayapp.go Outdated Show resolved Hide resolved
app.go Show resolved Hide resolved
rpc/debug/trace.go Show resolved Hide resolved
rpc/debug/trace.go Show resolved Hide resolved
rpc/debug/trace.go Show resolved Hide resolved
app.go Show resolved Hide resolved
@Sriep Sriep closed this Nov 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants