Giter Club home page Giter Club logo

mana's People

Contributors

andogro avatar atoulme avatar ayrat555 avatar bigdevwhale avatar cernivec avatar cleishm avatar danieldent avatar dkataskin avatar fmcgeough avatar gballet avatar germsvel avatar hayesgm avatar igorbarinov avatar knewter avatar masonforest avatar mattmsumner avatar mosic avatar oscarftoro avatar paulperegud avatar skovsgaard avatar tsutsu avatar vyorkin avatar willmeister avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mana's Issues

Dialyzer warnings

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()
  • All these three warnings come formgen_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()

Block header improvements

  • Refactor validation (maybe extract Validator's for each eq. that implement validate(header)) - done as part of #178
  • Add POW check to the block header validation

by PoW check I mean
image

Maybe:

  • Add tests for setting homestead_block
  • Add tests for setting initial_difficulty
  • Add tests for setting minimum_difficulty
  • Add tests for setting difficulty_bound_divisor
  • Add tests for setting gas_limit_bound_divisor
  • Add tests for setting min_gas_limit

Delete account storage after suicide

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.

Remove exleveldb from umbrella

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.

store node reputation

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

Project structure

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.

Implement nonces for EOA & CA

Nonces are not implemented yet.

  • EOA – externally owned account
  • CA – contact account

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

Add ommer rewards

  • see 11.1 and 11.3 in YP (Reward Application).
  • see the add_rewards_to_block function in the blockchain app

for each ommer, we raise the block’s beneficiary
by an additional 1/32 of the block reward

ommers

Comments reference equation numbers but not version of 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.

Integrate RoutingTable with Network

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

Refactor TCP (Devp2p Wire Protocol implementation)

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.

Fix `libsecp256k1` error when installing project

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.

Haven't gotten supernatural powers yet

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.

Wrong block static reward?

Its 5.0 ETH here:

  # R_b in Eq.(150)
  @reward_wei 5.0e18 |> round

But according to WP & YP the static reward should be eq to 3.0 ETH.
I know that eventually, we're going to use Proof of Authority, so this may be not important at all. But maybe we should change it to be 3.0 for now?

image

Refactor Destroyer and Builder in MMPT

  • Destroyer is pretty complex & non-obvious
  • Builder has duplicated code (trie_put_key)
  • Move several common fn's from Blockchain.BitHelper to the MMPT app
  • Extract common guards & put into separate module
  • Use tail recursion overlap

Determine which peers to communicate with

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.

add String10MbData

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).

Process queued blocks when Syncing to another node

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.