You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
2.4 KiB

new pubsub package comment out failing consensus tests for now rewrite rpc httpclient to use new pubsub package import pubsub as tmpubsub, query as tmquery make event IDs constants EventKey -> EventTypeKey rename EventsPubsub to PubSub mempool does not use pubsub rename eventsSub to pubsub new subscribe API fix channel size issues and consensus tests bugs refactor rpc client add missing discardFromChan method add mutex rename pubsub to eventBus remove IsRunning from WSRPCConnection interface (not needed) add a comment in broadcastNewRoundStepsAndVotes rename registerEventCallbacks to broadcastNewRoundStepsAndVotes See https://dave.cheney.net/2014/03/19/channel-axioms stop eventBuses after reactor tests remove unnecessary Unsubscribe return subscribe helper function move discardFromChan to where it is used subscribe now returns an err this gives us ability to refuse to subscribe if pubsub is at its max capacity. use context for control overflow cache queries handle err when subscribing in replay_test rename testClientID to testSubscriber extract var set channel buffer capacity to 1 in replay_file fix byzantine_test unsubscribe from single event, not all events refactor httpclient to return events to appropriate channels return failing testReplayCrashBeforeWriteVote test fix TestValidatorSetChanges refactor code a bit fix testReplayCrashBeforeWriteVote add comment fix TestValidatorSetChanges fixes from Bucky's review update comment [ci skip] test TxEventBuffer update changelog fix TestValidatorSetChanges (2nd attempt) only do wg.Done when no errors benchmark event bus create pubsub server inside NewEventBus only expose config params (later if needed) set buffer capacity to 0 so we are not testing cache new tx event format: key = "Tx" plus a tag {"tx.hash": XYZ} This should allow to subscribe to all transactions! or a specific one using a query: "tm.events.type = Tx and tx.hash = '013ABF99434...'" use TimeoutCommit instead of afterPublishEventNewBlockTimeout TimeoutCommit is the time a node waits after committing a block, before it goes into the next height. So it will finish everything from the last block, but then wait a bit. The idea is this gives it time to hear more votes from other validators, to strengthen the commit it includes in the next block. But it also gives it time to hear about new transactions. waitForBlockWithUpdatedVals rewrite WAL crash tests Task: test that we can recover from any WAL crash. Solution: the old tests were relying on event hub being run in the same thread (we were injecting the private validator's last signature). when considering a rewrite, we considered two possible solutions: write a "fuzzy" testing system where WAL is crashing upon receiving a new message, or inject failures and trigger them in tests using something like https://github.com/coreos/gofail. remove sleep no cs.Lock around wal.Save test different cases (empty block, non-empty block, ...) comments add comments test 4 cases: empty block, non-empty block, non-empty block with smaller part size, many blocks fixes as per Bucky's last review reset subscriptions on UnsubscribeAll use a simple counter to track message for which we panicked also, set a smaller part size for all test cases
7 years ago
  1. package core
  2. import (
  3. rpc "github.com/tendermint/tendermint/rpc/lib/server"
  4. )
  5. // TODO: better system than "unsafe" prefix
  6. // NOTE: Amino is registered in rpc/core/types/codec.go.
  7. var Routes = map[string]*rpc.RPCFunc{
  8. // subscribe/unsubscribe are reserved for websocket events.
  9. "subscribe": rpc.NewWSRPCFunc(Subscribe, "query"),
  10. "unsubscribe": rpc.NewWSRPCFunc(Unsubscribe, "query"),
  11. "unsubscribe_all": rpc.NewWSRPCFunc(UnsubscribeAll, ""),
  12. // info API
  13. "health": rpc.NewRPCFunc(Health, ""),
  14. "status": rpc.NewRPCFunc(Status, ""),
  15. "net_info": rpc.NewRPCFunc(NetInfo, ""),
  16. "blockchain": rpc.NewRPCFunc(BlockchainInfo, "minHeight,maxHeight"),
  17. "genesis": rpc.NewRPCFunc(Genesis, ""),
  18. "block": rpc.NewRPCFunc(Block, "height"),
  19. "block_results": rpc.NewRPCFunc(BlockResults, "height"),
  20. "commit": rpc.NewRPCFunc(Commit, "height"),
  21. "tx": rpc.NewRPCFunc(Tx, "hash,prove"),
  22. "tx_search": rpc.NewRPCFunc(TxSearch, "query,prove,page,per_page"),
  23. "validators": rpc.NewRPCFunc(Validators, "height"),
  24. "dump_consensus_state": rpc.NewRPCFunc(DumpConsensusState, ""),
  25. "consensus_state": rpc.NewRPCFunc(ConsensusState, ""),
  26. "consensus_params": rpc.NewRPCFunc(ConsensusParams, "height"),
  27. "unconfirmed_txs": rpc.NewRPCFunc(UnconfirmedTxs, "limit"),
  28. "num_unconfirmed_txs": rpc.NewRPCFunc(NumUnconfirmedTxs, ""),
  29. // tx broadcast API
  30. "broadcast_tx_commit": rpc.NewRPCFunc(BroadcastTxCommit, "tx"),
  31. "broadcast_tx_sync": rpc.NewRPCFunc(BroadcastTxSync, "tx"),
  32. "broadcast_tx_async": rpc.NewRPCFunc(BroadcastTxAsync, "tx"),
  33. // abci API
  34. "abci_query": rpc.NewRPCFunc(ABCIQuery, "path,data,height,prove"),
  35. "abci_info": rpc.NewRPCFunc(ABCIInfo, ""),
  36. // evidence API
  37. "broadcast_evidence": rpc.NewRPCFunc(BroadcastEvidence, "evidence"),
  38. }
  39. func AddUnsafeRoutes() {
  40. // control API
  41. Routes["dial_seeds"] = rpc.NewRPCFunc(UnsafeDialSeeds, "seeds")
  42. Routes["dial_peers"] = rpc.NewRPCFunc(UnsafeDialPeers, "peers,persistent")
  43. Routes["unsafe_flush_mempool"] = rpc.NewRPCFunc(UnsafeFlushMempool, "")
  44. // profiler API
  45. Routes["unsafe_start_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStartCPUProfiler, "filename")
  46. Routes["unsafe_stop_cpu_profiler"] = rpc.NewRPCFunc(UnsafeStopCPUProfiler, "")
  47. Routes["unsafe_write_heap_profile"] = rpc.NewRPCFunc(UnsafeWriteHeapProfile, "filename")
  48. }