Skip to content
This repository has been archived by the owner on Nov 30, 2021. It is now read-only.

Emint tx type for eth_call and logs setup #118

Merged
merged 3 commits into from
Oct 3, 2019
Merged

Conversation

austinabell
Copy link

@austinabell austinabell commented Oct 2, 2019

  • Implements new transaction message (EmintMsg) which contains similar data to Ethereum transaction, except V,R,S replaced with a from address since msg will be wrapped in a signed Cosmos stdtx
  • Abstracted state transition logic for consistency between msg types
  • Prepared db pre state transition with available data for logs
    • EmintMsg does not (and cannot) have access to tx hash so that will be blank for now
  • Indexing tx per block for logs Implement eth_getLogs #55 (don't think a mutex is required since msgs are handled sequentially and couldn't replicate a race condition with many txs)

Edit: Alternative count type to simplify logic I did on seperate branch but let me know if you want me to bring this into this PR for readability: ChainSafe@6396abb

x/evm/handler.go Outdated
remaining := new(big.Int).Mul(new(big.Int).SetUint64(*gasRemaining), gasPrice)
st.AddBalance(from, remaining)
// Prepare db for logs
keeper.csdb.Prepare(common.Hash{}, common.Hash{}, *keeper.txCount) // Cannot provide tx hash

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think rather than a counter:

i := uint(keeper.csdb.TxIndex())

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually the get method that uses the data set in Prepare. I could add two methods to the csdb interface to allow only tx index to be reset and incremented, but would just change the interface/structure of the csdb from mimmicing geth and is only needed within the Keeper/Cosmos.

Let me know if you want me to bring in 6396abb to make the counter more readable/usable or to add those methods to the csdb type

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Yeah I would suggest bringing the alternative branch to make it more usable and easier to maintain.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome! just wanted to check before I did because that commit was a bit subjective

@austinabell austinabell merged commit 8bb8b40 into development Oct 3, 2019
@austinabell austinabell deleted the austin/eminttx branch October 3, 2019 16:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants