mana-ethereum / mana Goto Github PK
View Code? Open in Web Editor NEWEthereum full node implementation written in Elixir.
License: Other
Ethereum full node implementation written in Elixir.
License: Other
Move functions like calculate_total_refund
to it (intrinsic cost calc, refund calc, etc)
Working though dialyzer warnings, here is the list of the ones I need more context to fix.
(This is updated as I go though the warnings)
Blockchain app
EVM.Debugger:break_on
expects an integer but gets binary.apps/blockchain/lib/blockchain/application.ex:16: The call 'Elixir.EVM.Debugger':break_on([{'address',binary()},...]) will never return since the success typing is
(['address']) -> integer()
and the contract is (elixir:keyword('Elixir.EVM.Debugger.Breakpoint':conditions())) -> 'Elixir.EVM.Debugger.Breakpoint':id()
gen_child_block()
function. I can't see why set_block_number()
is breaking the contract.apps/blockchain/lib/blockchain/block.ex:558: Function gen_child_block/2 has no local return
apps/blockchain/lib/blockchain/block.ex:558: Function gen_child_block/3 has no local return
apps/blockchain/lib/blockchain/block.ex:566: The call 'Elixir.Blockchain.Block':set_block_number(#{'__struct__':='Elixir.Blockchain.Block', 'block_hash':='nil', 'header':=#{'__struct__':='Elixir.Block.Header', 'beneficiary':=_, 'difficulty':='nil', 'extra_data':=_, 'gas_limit':=0, 'gas_used':=0, 'logs_bloom':=<<_:2048>>, 'mix_hash':='nil', 'nonce':='nil', 'number':='nil', 'ommers_hash':=<<_:256>>, 'parent_hash':='nil', 'receipts_root':=<<_:256>>, 'state_root':=_, 'timestamp':=_, 'transactions_root':=<<_:256>>}, 'ommers':=[], 'transactions':=[]},#{'__struct__':='Elixir.Blockchain.Block', 'block_hash':='nil', 'header':=#{'__struct__':='Elixir.Block.Header', 'beneficiary':='nil', 'difficulty':='nil', 'extra_data':=<<>>, 'gas_limit':=0, 'gas_used':=0, 'logs_bloom':=<<_:2048>>, 'mix_hash':='nil', 'nonce':='nil', 'number':=123, 'ommers_hash':=<<_:256>>, 'parent_hash':='nil', 'receipts_root':=<<_:256>>, 'state_root':=<<_:256>>, 'timestamp':='nil', 'transactions_root':=<<_:256>>}, 'ommers':=[], 'transactions':=[]}) breaks the contract (t(),t()) -> t()
According to YP:
but we have it set to 125000
for some reason:
https://github.com/poanetwork/mana/blob/master/apps/evm/lib/block/header.ex#L77
Does anybody know why?
#63
why I think its wrong
ethereum/yellowpaper#317 (comment)
https://github.com/paritytech/parity/blob/master/ethcore/res/ethereum/foundation.json#L147
https://github.com/ethereum/go-ethereum/blob/master/params/protocol_params.go#L68
Validator
's for each eq. that implement validate(header)
) - done as part of #178Maybe:
When an account is deleted, the corresponding storage_trie_root
is deleted also.
The problem is that the underlying DB may still keep all stored items.
We need to remove the storage_trie_root
from the DB.
exleveldb
should not be in the mana
umbrella. There is a commit in exthereum/exleveldb
fork that we want to include, so perhaps we use that as a dependency first and once that is merged upstream, we can then just use exleveldb
from hex.
https://github.com/ethereum/wiki/wiki/%C3%90%CE%9EVp2p-Wire-Protocol
Nodes are free to store ratings for given IDs (how useful the node has been in the past) and give preference accordingly. Nodes may also track node IDs (and their provenance) in order to help determine potential man-in-the-middle attacks. Clients are free to mark down new nodes and use the node ID as a means of determining a node's reputation.
this issue should be fixed after #68
An example of connecting to a remote node is tested here:
https://github.com/exthereum/ex_wire/blob/master/test/integration/remote_connection_test.exs
This will allow us to test all sub-projects in the umbrella app against the same repo.
Like in elixir-lang repo, see:
I think hex_prefix can be part of Merkle Patricia Tree, because it is used only in this project. And ExRLP can be in its own repo.
Also exleveldb is not part of the project.
Check & fix:
function get_account_nonce/2 required by protocol EVM.Interface.AccountInterface is not implemented
Nonces are not implemented yet.
for externally owned accounts nonce should be eq to the total num of tx’s sent from this address
for contract accounts nonce should be eq. to the number of contract creations
see YP for details
In Eq. (194) we should "interpret" ()
as to be equivalent to <<>>
, but not nil
nil
values aren't RLP-serializable.
The relevant place: https://github.com/poanetwork/mana/blob/master/apps/merkle_patricia_tree/lib/trie/destroyer.ex#L76
Proposed fix: decode <<>>
values as nil
's, but store as <<>>
.
MMPT = Modified Merkle-Patricia Tree.
Would be great to walk through all the TODOs there too.
We should consider R_selfdestruct
for A_s
according to YP, see Eq. (64) and Eq. (65)
It should be accumulated in the sub_state
(A
in YP).
https://github.com/poanetwork/mana/blob/master/apps/evm/lib/evm/sub_state.ex#L11
As I can see it doesn't:
https://github.com/poanetwork/mana/blob/master/apps/blockchain/lib/blockchain/transaction.ex#L355
This will be the first step toward pulling together all of the pieces into a functioning client. This can be done in parallel with #3 and merged into the CLI once both are complete.
Currently the only way to actually run Exthereum is through ‘iex -S mix’ in tests. To start we should create a CLI application that runs the following code:
https://github.com/exthereum/blockchain/blob/master/test/ropsten_test.exs#L14-L35
currently node does not save other nodes to k-buckets
https://pdos.csail.mit.edu/~petar/papers/maymounkov-kademlia-lncs.pdf
Should be faster, maybe.
see:
https://github.com/urbint/rox
Currently we have tests passing for each of the apps under the umbrella, but we'd like to get the whole test suite passing in CI.
It is always empty.
See Eq.(26) in the Yellow Paper.
There are several comments in the code base that reference an equation in the yellow paper. For example, apps/blockchain/lib/blochain/block.ex
has a comment,
# The following checks Holistic Validity, as defined in Eq. (29)
Those comments are very helpful, but they don't mention which version of the yellow paper they reference. For example, the EIP-150 REVISION
found in yellowpaper.io has the holistic validity equation defined as equation 29. But the BYZANTIUM VERSION f72032b - 2018-05-04
found in https://ethereum.github.io/yellowpaper/paper.pdf has that equation as equation 31.
Ethereum's Node discovery baseв on Kademlia algorithm. Basic components of Kademlia are implemented. They should be integrated with Network module to send and receive messages from other nodes
Currently, we have part of the Devp2p Wire Protocol implemented in lib/ex_wire/adapter/tcp.ex
in the ExWire
app.
This GenServer is managing the TCP connection, the aggregation of TCP data into wire protocol "packets" (e.g. GetBlockHeaders packet), as well as initializing the session of the Devp2p Wire Protocol (which includes crypto and protocol handshakes, and the sending and receiving an initial Hello message).
It would be nice if we could separate those concerns into modules that handle the required logic. Whether or not they have to live in the same GenServer, I'm not sure.
We should also consider what to do when a peer disconnects from our TCP
process. Currently, we set the session state to "active: false", but we keep the elixir process alive. We should try to either (a) reconnect, or (b) kill the elixir process so that it isn't just wasting resources when it will never reconnect.
Extract & give names to long anonymous functions
Belongs to the Block
which itself in the blockchain
app.
When initially compiling the mana project, libsecp256k1
fails to compile.
The current workaround is to compile it manually (as is done in exthereum's blockchain),
export "CFLAGS=-I/usr/local/include -L/usr/local/lib"
cd deps/libsecp256k1 && rebar compile
mix compile
but we should find a more permanent solution.
One possible solution suggested by @ayrat555 is to set the manager in the dependency,
{:libsecp256k1, [github: "exthereum/libsecp256k1", manager: :rebar]}
But I know this has the potential problems as well, if any of the other dependencies are using libsecp256k1
and it is getting it in a different way.
So we could increase the RAM up to 8 GB
hex_prefix should be a part of the merkle_patricia_tree project.
When an account is deleted, the corresponding storage_trie_root
is deleted also.
The problem is that the underlying DB may still keep all stored items.
We need to remove the storage_trie_root
from the DB.
related in Parity: https://github.com/paritytech/parity/blob/master/ethcore/src/executive.rs#L644
See https://github.com/poanetwork/mana/blob/master/apps/blockchain/lib/blockchain/interface/account_interface.ex#L238
and del_account
fn in Account
module
I don't know if I have all the dependencies. Performed a ./configure | make | make -install
No warnings, no errors ... still:
I don't know what the flags are or even how to actually get the supernatural powers. Looking specifically for Precognition and Empathy - should be totally doable, I'm not asking for something 'bigger' that would require a crossroads demon deal for example.
Since we already use CircleCI
trie_put_key
)Blockchain.BitHelper
to the MMPT appoverlap
We currently have part of the ethereum wire protocol (sub-protocol) v62 implemented in lib/ex_wire/sync.ex
. Thus far, that module can send GetBlockHeaders
, GetBlockBodies
, and receives BlockHeaders
and BlockBodies
. But when we need to send out a message, we ask the supervisor of all the peers (ExWire.PeerSupervisor
) to send the message to all peers.
I do know if that is the best way to handle requesting things like GetBlockHeaders
, or if we should be targeting a particular peer (if we have received a message from it), or if we should be doing it round robin or something like that.
The problem is that String10MbData test eats memory heap so it takes more than allowed 4GB on CircleCI. To prevent this I've set max_heap_size to 4095 mb (see circle ci config for details).
Currently, we are syncing information to other blocks (satisfying some of the eth wire protocol) in lib/ex_wire/sync.ex
.
That GenServer currently requests BlockHeaders
and BlockBodies
but it only stores them in a BlockQueue
because we want to ensure the blocks are confirmed by several peers (just how many peers need to confirm that is available for configuration in ex_wire
app's config).
What we need to do now is process all of the blocks in the BlockQueue
that have been confirmed by multiple peers. We need to validate them and add them to our chain.
Consider returning a set of tx validation failure reasons (errors), instead of a singular reason.
Now it returns just the first one aka "bail" behavior.
The Yellowpaper link in Blockchain readme is currently pointing to: http://yellowpaper.io/
Point to https://ethereum.github.io/yellowpaper/paper.pdf with the latest version.
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.