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

Milestone: mempool and block producer #58

Open
9 of 14 tasks
andelf opened this issue Feb 18, 2021 · 8 comments
Open
9 of 14 tasks

Milestone: mempool and block producer #58

andelf opened this issue Feb 18, 2021 · 8 comments

Comments

@andelf
Copy link
Owner

andelf commented Feb 18, 2021

This issue will be used to trace the dev process of mempool & block producer.

The goal is to run the very first testnet of opentron.🚀

Update 2021/03/01

Since the producer is the most complex part, the milestone is divided into:

  • executor for all type of transactions
  • a state-db implementation: use cargo run -- dev to test against it
  • refactor channel protocol to handle transaction broadcast
  • impl Manager::produceBlock (in manager crate)
  • impl consensus base(code in base/*.java)
    • most of the code logic is implemented by manager crate
  • impl DPoS mining (logic in dpos/*.java files)
    • DposSlot - merge logic into Manager
    • IncentiveManager
    • MaintenanceManager
    • StateManager
    • DposService
    • DposTask - rewrite using producer_service crate

Update 2021/03/15

  • refactor channel protocol to handle incoming and outgoing broadcasts
  • add a PeerContext to manage connected peers
@andelf
Copy link
Owner Author

andelf commented Feb 18, 2021

To clarify:

The top-level logic of a FullNode is: https://github.com/opentron/opentron/blob/master/docs/txpool.md

  • RpcApiService(including HTTP/gRPC) is responsible for accepting and validating new transactions(broadcast)
  • TronNetService is the gossip layer to broadcast a transaction to the whole network
  • ConsensusService is responsible for producing blocks

Use dposService.getBlockHandle().produce(miner, pTime, timeout) to produce a block.

@oikos1
Copy link
Contributor

oikos1 commented Feb 23, 2021

Thanks @andelf. Merged #59.

@andelf
Copy link
Owner Author

andelf commented Mar 2, 2021

Update 2021/03/03

To test the slot timing, now the node generates empty blocks.

image

NOTE: The java-tron's block producer is not optimized. It sleeps and waits for the timing slot. Default.

This might be changed in opentron(a compatible change):

  • The opentron might pack transactions incrementally, never sleep and waste time.

@andelf
Copy link
Owner Author

andelf commented Mar 5, 2021

Update 2021/03/05

Broadcast channels

  • Outgoing block broadcast(from block producer)
  • Outgoing transaction broadcast(from API)
  • Incoming transaction(from gossip, to mempool)
  • Incoming block(to consensus handler, handle forks and states)

@andelf
Copy link
Owner Author

andelf commented Mar 7, 2021

Update 2021/03/08

  • massive refactor
  • impl basic broadcastTransaction graphql API

image

+TODO

  • some command-line tool to generate raw transaction

@andelf
Copy link
Owner Author

andelf commented Mar 10, 2021

Update 2021/03/11

Now it packs transactions.

image

And can run multiple SRs in a single node(for local-test).

image

@andelf
Copy link
Owner Author

andelf commented Mar 13, 2021

Update 2021/03/14

image

Testing against transactions and block producer.

Add a new cli to send transfers.

@andelf
Copy link
Owner Author

andelf commented Mar 14, 2021

Update 2021/03/15

Use cli to create witness, vote...

TODO: all commands

wallet-cli 0.1.0
OpenTron Developers <info@opentron.org>
Opentron command line util

USAGE:
    cli [FLAGS] [OPTIONS] <SUBCOMMAND>

FLAGS:
    -d, --dont-broadcast    Don't broadcast transaction to the network (just print to stdout)
    -h, --help              Prints help information
    -s, --skip-sign         Skip actual sign process
    -V, --version           Prints version information

OPTIONS:
    -k, --account <account>                 The account address used for signing
    -x, --expiration <expiration>           Set the time in seconds before a transaction expires
        --fee-limit <fee-limit>             Maximum value of TRX allowed consumed
        --memo <memo>                       The memo for the transaction
    -K, --private-key <private-key>         The private key used for signing [env:
                                            OPENTRON_CLI_PRIVATE_KEY=]
        --rpc-url <http://[HOST]:[PORT]>    Raw RPC address to connect [env: OPENTRON_CLI_RPC_URL=]  [default:
                                            http://127.0.0.1:3000]

SUBCOMMANDS:
    account     Account management
    asset       TRC10 asset management
    contract    Smart Contract
    exchange    On-chain DEX
    market      New On-chain Echange
    proposal    Proposal management for active witnesses
    system      Chain governance and resource management
    transfer    Transfer TRX tokens
    witness     Witness management

@andelf andelf pinned this issue Mar 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants