Git Product home page Git Product logo

heimdall's Introduction

Heimdall

Go Report Card CircleCI GolangCI

Validator node for Matic Network. It uses peppermint, customized Tendermint.

Install from source

Make sure you have go1.11+ already installed

Install

$ make install

Init-heimdall

$ heimdalld init
$ heimdalld init --chain=mainnet        Will init with genesis.json for mainnet
$ heimdalld init --chain=mumbai         Will init with genesis.json for mumbai
$ heimdalld init --chain=amoy           Will init with genesis.json for amoy

Run-heimdall

$ heimdalld start

Usage

$ heimdalld start                       Will start for mainnet by default
$ heimdalld start --chain=mainnet       Will start for mainnet
$ heimdalld start --chain=mumbai        Will start for mumbai
$ heimdalld start --chain=amoy          Will start for amoy
$ heimdalld start --chain=local         Will start for local with NewSelectionAlgoHeight = 0

Run rest server

$ heimdalld rest-server 

Run bridge

$ heimdalld bridge 

Develop using Docker

You can build and run Heimdall using the included Dockerfile in the root directory:

docker build -t heimdall .
docker run heimdall

Documentation

Latest docs are here

heimdall's People

Contributors

0xkrishna avatar 0xsharma avatar anshalshukla avatar begmaroman avatar cffls avatar criadoperez avatar dependabot[bot] avatar djpolygon avatar engwarrior avatar ferranbt avatar igorcrevar avatar jdkanani avatar jekamas avatar manav2401 avatar mankenavenkatesh avatar marcello33 avatar mrostamii avatar ngotchac avatar pratikspatil024 avatar ptsayli avatar ramakrishna183 avatar raneet10 avatar rekibnikufesin avatar ssandeep avatar svenski123 avatar temaniarpit27 avatar tokamak-git avatar vaibhavchellani avatar vaibhavjindal3012 avatar vcastellm 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

heimdall's Issues

Using tx hash to maintain sync between contract state and heimdall

We could probably use txhash to validate message data while validating transactions in heimdall.

We could also fetch the block details and make sure we have enough confirmations before accepting transactions, for example we could include a TxHash field in ValidatorJoin and then we could pick data like signer , amountStaked etc from TxReceipt.

Pros :

  1. We can make sure we accept transactions only when difference between currentBlock and block in which tx was present on main chain is atleast 6(or more)
  2. We can change signer without having the previous signer or validator to sign the transaction on heimdall making it easy to change signer incase you lost your private keys or via a validator contract.
  3. We can make sure that validation of transactions is always deterministic so while syncing of new nodes we dont have to worry about current state of contract.

Possible cons could be slow syncing of new nodes as every transaction would need to query main chain for TxReceipt.

Implement slashing

We need to implement slashing of validators, where we would need to slash validators on multiple parameters.
Some of the parameters can be:

  1. no-ack received for a proposer.
  2. vote not submitted by validator.
  3. validator inactive

More parameters to be discussed in this issue.

Add version files

Add version files so that versions of heimdall and peppermint can be tracked.

Add signature in genesis.json

We need to add signature in genesis.json to make sure people don't add validators who aren't validators.
OR
Maybe we can validate genesis while initChain by querying stakeManager contract.

Have only one export command

Currently we have 2 export commands, one in heimdalld and one in heimdallcli. To avoid confusion we need to make sure there is only one.

Handle re-orgs

We need to wait for some confirmations on heimdall to make sure we pick up data from the longest ethereum chain always. Need to think more on how to do this.

Remove Current Start Block check

We need to remove current start block checks from handleMsg and while validating message and only have that when we need to send checkpoint .

Add state dump

It would be really useful to have a state-dump from where heimdall could start from , it will allow us to restart testnet from a specific state instead of deploying new contracts . State dump would generate a genesis file with the current state and heimdall can add the state to keeper and restart successfully.

This will also allow validators to move back a few blocks and sync in case of sync failures or consensus failure or panics.

Issue while using the config files created by testnets command

I[2020-01-10|09:29:08.955] starting ABCI with Tendermint module=main
panic: Unknown db_backend leveldb, expected either fsdb or goleveldb or memdb
goroutine 1 [running]:
github.com/tendermint/tm-db.NewDB(0x13fa77d, 0xa, 0xc000a16c80, 0x7, 0xc00094fe20, 0x1c, 0x203000, 0xc00113f158)
/home/ubuntu/go/pkg/mod/github.com/tendermint/[email protected]/db.go:67 +0x39c
github.com/tendermint/tendermint/node.DefaultDBProvider(0xc0008b5180, 0xc0008b5180, 0xc000aa24c8, 0x183, 0xc00113f280)
/home/ubuntu/go/pkg/mod/github.com/maticnetwork/[email protected]/node/node.go:66 +0xcb
github.com/tendermint/tendermint/node.initDBs(0xc0009457c0, 0x169cad8, 0xc00113f298, 0x408bba, 0x18db8a0, 0x12b4bc0, 0x12b4bc0)
/home/ubuntu/go/pkg/mod/github.com/maticnetwork/[email protected]/node/node.go:207 +0x6c
github.com/tendermint/tendermint/node.NewNode(0xc0009457c0, 0x18b3640, 0xc0008bb040, 0xc000ac1b30, 0x1893de0, 0xc0008b5120, 0xc000ac1c40, 0x169cad8, 0xc000ac1c50, 0x18ba840, ...)
/home/ubuntu/go/pkg/mod/github.com/maticnetwork/[email protected]/node/node.go:548 +0x50
github.com/cosmos/cosmos-sdk/server.startInProcess(0xc0008b46a0, 0x169d360, 0x1d, 0x0, 0x0)
/home/ubuntu/go/pkg/mod/github.com/cosmos/[email protected]/server/start.go:152 +0x4c1
github.com/cosmos/cosmos-sdk/server.StartCmd.func1(0xc000a45400, 0xc0009562e0, 0x0, 0x1, 0x0, 0x0)
/home/ubuntu/go/pkg/mod/github.com/cosmos/[email protected]/server/start.go:65 +0xb4
github.com/spf13/cobra.(*Command).execute(0xc000a45400, 0xc0009562c0, 0x1, 0x1, 0xc000a45400, 0xc0009562c0)
/home/ubuntu/go/pkg/mod/github.com/spf13/[email protected]/command.go:826 +0x460
github.com/spf13/cobra.(*Command).ExecuteC(0xc000a44500, 0x2, 0xc0008b48a0, 0x1422715)
/home/ubuntu/go/pkg/mod/github.com/spf13/[email protected]/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
/home/ubuntu/go/pkg/mod/github.com/spf13/[email protected]/command.go:864
github.com/tendermint/tendermint/libs/cli.Executor.Execute(0xc000a44500, 0x169d7a8, 0x2, 0xc000ba0b80)
/home/ubuntu/go/pkg/mod/github.com/maticnetwork/[email protected]/libs/cli/setup.go:89 +0x3c
main.main()
/home/ubuntu/go/src/github.com/maticnetwork/heimdall/cmd/heimdalld/main.go:95 +0x43a

Upgrade tendermint and cosmos-sdk version

Tendermint has gone through some breaking changes, which need to be merged with heimdall and peppermint as some bugs have been resolved regarding consensus mechanism.

Update the README file

The current readme file is outdated and needs to be updated, current docs are being maintained at docs.matic.network

Amino encoding error while sending txs from cli .

$:~/matic-logs$ heimdallcli tx bor propose-span --span-id=1 --start-block=256 --chain-id=heimdall-aTHGG9 --bor-chain-id=15001
ERROR: invalid character -- Amino:JSON int/int64/uint/uint64 expects quoted values for javascript numeric support, got: 256.

Update Validator Indexing to Signer Address

Right now the validators are indexed with ValidatorAddress as key . Signers are the true validators wrt to Peppermint and hence can be identified uniquely with SignerAddress only . Incase of signer update the ValidatorAddress would remain same but the signer address and signer pubkey would be changed . These changes cannot be tracked via current indexing .

All rest apis will use signer address to reference Validator not Validator Address , Validator Address is only the address who stakes on rootchain contract.

Check heimdall status before broadcasting tx

Currently, if there has been a consensus issue or some other fault at Heimdall the bridge still keeps sending transactions this creates a lot of load for all the nodes and would drain fees for any validator. Instead, we should check the health of the node before broadcasting.

Clean up modules

All the modules currently contain a lot of comments left over from the latest refactor, we need to remove those.

Heimdall sync without an already synced BOR

Currently heimdall fetches checkpoint data from bor and bor fetches span data from heimdall. While this solves a lot of problems it creates an issue when we are trying to sync nodes, because to evaluate the checkpoint data while syncing heimdall node needs a fully synched bor node.

We want to evaluate different ways to solve this using this issue.

Remove usage of time.Now()

Need to remove usage of time.Now() in transaction handlers and instead use the UTC time to ensure deterministic transaction evaluation

Remove vetic from heimdall

There are traces of vetic on heimdall which need to be cleaned up to avoid confusion, since fee tokens on heimdall are 1:1 pegged with matic let's call it matic

Header information not available

If heimdall fetches header information as soon as we send checkpoint on main chain we are unable to get proper information probably because it takes time for checkpoint transaction to propagate to all ethereum nodes and sometimes checkpoint is lost in a re-org. Ideally we should wait for some confirmation blocks and only then accept the ACK message.

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.