310 Commits

Author SHA1 Message Date
Sam Kleinman
48147e1fb9 logging: implement lazy sprinting (#8898)
shout out to @joeabbey for the inspiration. This makes the lazy
functions internal by default to prevent potential misuse by external
callers.

Should backport cleanly into 0.36 and I'll handle a messy merge into 0.35
2022-07-27 19:16:51 +00:00
Sam Kleinman
37f9d59969 log: do not pre-process log results (#8895)
I was digging around in the zero log functions, and the following
functions using the `Fields()` method directly in zerolog, 

- https://github.com/rs/zerolog/blob/v1.27.0/event.go#L161
- e9344a8c50/fields.go (L15)

Have meaningfully equivalent semantics and our pre-processing of
values is getting us much (except forcing zerolog to always sort our
keys, and nooping in the case when you miss the last field.)

With this change also, we can pass maps (or, pratically a single map)
to the logger, which might be a less wacky seeming interface.
2022-06-28 14:40:16 +00:00
Sam Kleinman
013b46a6c3 libs/strings: move to internal (#8890)
I think we were leaving this library public because the SDK dependend
upon it, but the function the SDK was using was one that we'd removed
because *we* weren't using it any more, and I made a PR agasint the
SDK to clean that up.

ref: https://github.com/cosmos/cosmos-sdk/pull/12368
2022-06-27 21:44:50 +00:00
M. J. Fromberger
a988cefe5d Update generated mocks after #8607. (#8612) 2022-05-25 15:48:56 +00:00
M. J. Fromberger
20f8485080 Make encoding of HexBytes values more robust. (#8398)
The HexBytes wrapper type handles decoding byte strings from JSON.  In the RPC
API, hashes are encoded as hex digits rather than the standard base64.

Simplify the implementation of this wrapper using the TextMarshaler interface,
which the encoding/json package uses for values (like these) that are meant to
be wrapped in JSON strings.

In addition, allow HexBytes values to be decoded from either hex OR base64
input. This preserves all existing use, but will allow us to remove some
reflection special cases in the RPC decoder plumbing.

Update tests to correctly tolerate empty/nil.
2022-04-22 18:02:41 -07:00
Sam Kleinman
b5e6cf50d1 abci: Application should return errors errors and nilable response objects (#8396) 2022-04-22 20:40:42 -04:00
Sam Kleinman
8345dc4f7c abci: application type should take contexts (#8388) 2022-04-22 10:58:01 -04:00
Sam Kleinman
efd4f4a40b cleanup: unused parameters (#8372) 2022-04-18 16:45:21 -04:00
Sam Kleinman
c372390fea eventbus: publish without contexts (#8369) 2022-04-18 16:28:31 -04:00
Sam Kleinman
5d4d01b4e4 service: minor cleanup of comments (#8314) 2022-04-12 17:11:21 -04:00
Sam Kleinman
571d26fbb0 events: remove unused event code (#8313) 2022-04-12 14:58:14 -04:00
M. J. Fromberger
dfb322e68b Fix broken Markdown links (#8214)
- Remove pointless Makefile and package documentation.
- Fix broken links.
2022-03-29 12:07:12 -07:00
Sam Kleinman
0bded371c5 testing: logger cleanup (#8153)
This contains two major changes:

- Remove the legacy test logging method, and just explicitly call the
  noop logger. This is just to make the test logging behavior more
  coherent and clear. 
  
- Move the logging in the light package from the testing.T logger to
  the noop logger. It's really the case that we very rarely need/want
  to consider test logs unless we're doing reproductions and running a
  narrow set of tests.
  
In most cases, I (for one) prefer to run in verbose mode so I can
watch progress of tests, but I basically never need to consider
logs. If I do want to see logs, then I can edit in the testing.T
logger locally (which is what you have to do today, anyway.)
2022-03-18 17:39:38 +00:00
Sam Kleinman
5bb51aab03 events: remove service aspects of event switch (#8146) 2022-03-18 12:31:08 +00:00
Sam Kleinman
7a0b05f22d libs/events: remove unneccessary unsubscription code (#8135)
The events switch code is largely vestigal and is responsible for
wiring between the consensus state machine and the consensus
reactor. While there might have been a need, historicallly to managed
these subscriptions at runtime, it's nolonger used: subscriptions are
registered during startup, and then the switch shuts down at at the
end. 

Eventually the EventSwitch should be replaced by a much smaller
implementation of an eventloop in the consensus state machine, but
cutting down on the scope of the event switch will help clarify the
requirements from the consensus side.
2022-03-17 13:02:02 +00:00
Sam Kleinman
b08dd93d88 libs/log: remove Must constructor (#8120)
* libs/log: remove Must constructor

* Update test/e2e/node/main.go

Co-authored-by: M. J. Fromberger <michael.j.fromberger@gmail.com>

* use stdlog

Co-authored-by: M. J. Fromberger <michael.j.fromberger@gmail.com>
2022-03-15 13:02:31 +00:00
William Banfield
ddbc93d993 service: add NopService and use for PexReactor (#8100) 2022-03-09 14:33:57 -05:00
Sam Kleinman
912751cf93 math: remove panics in safe math ops (#7962)
* math: remove panics in safe math ops

* fix docs

* fix lint
2022-02-22 18:34:17 +00:00
JayT106
ce898a738c consensus: HasVoteMessage index boundary check (#7720)
Went through #2871, there are several issues, this PR tries to tackle the `HasVoteMessage` with an invalid validator index sent by a bad peer and it prevents the bad vote goes to the peerMsgQueue.

Future work, check other bad message cases and plumbing the reactor errors with the peer manager and then can disconnect the peer sending the bad messages.
2022-02-21 13:21:24 +00:00
Sam Kleinman
d65237ff87 logging: allow logging level override (#7873)
I think in the future we should migrate from having our own logging
interface and use our logger directly, which I think would help
obviate this particular problem, but in the mean time, this seems safe.
2022-02-20 16:18:05 +00:00
Sam Kleinman
28d34d635c service: change stop interface (#7816) 2022-02-17 11:23:32 -05:00
Sergio Mena
d3548eb706 Completed the existing FinalizeBlock PR and rebased to master (#7798)
* Rebased and git-squashed the commits in PR #6546

migrate abci to finalizeBlock

work on abci, proxy and mempool

abciresponse, blok events, indexer, some tests

fix some tests

fix errors

fix errors in abci

fix tests amd errors

* Fixes after rebasing PR#6546

* Restored height to RequestFinalizeBlock & other

* Fixed more UTs

* Fixed kvstore

* More UT fixes

* last TC fixed

* make format

* Update internal/consensus/mempool_test.go

Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>

* Addressed @williambanfield's comments

* Fixed UTs

* Addressed last comments from @williambanfield

* make format

Co-authored-by: marbar3778 <marbar3778@yahoo.com>
Co-authored-by: William Banfield <4561443+williambanfield@users.noreply.github.com>
2022-02-14 23:41:28 +01:00
M. J. Fromberger
7e09c2ef43 Clean up temp files more thoroughly after testing. (#7815)
Our test cases spew a lot of files and directories around $TMPDIR.  Make more
thorough use of the testing package's TempDir methods to ensure these are
cleaned up.

In a few cases, this required plumbing test contexts through existing helper
code. In a couple places an explicit path was required, to work around cases
where we do global setup during a TestMain function. Those cases probably
deserve more thorough cleansing (preferably with fire), but for now I have just
worked around it to keep focused on the cleanup.
2022-02-14 06:32:07 -08:00
Sam Kleinman
824960c565 libs/service: regularize Stop semantics and concurrency primitives (#7809) 2022-02-14 08:28:29 -05:00
Sam Kleinman
9e59fc6924 libs/cli: clean up package (#7806) 2022-02-11 11:30:16 -05:00
Sam Kleinman
662c0aac9e libs/strings: cleanup string helper function package (#7808) 2022-02-11 10:59:55 -05:00
Sam Kleinman
1fe1b6c032 libs/events: remove unused event cache (#7807) 2022-02-11 09:48:37 -05:00
Sam Kleinman
a4e2f05d7a cmd: avoid package state in cli constructors (#7719) 2022-01-31 09:52:30 -05:00
William Banfield
0aa3b0b6fc Proposer-Based Timestamps Merge (#7605)
This pull request merges in the changes for implementing Proposer-based timestamps into `master`. The power was primarily being done in the `wb/proposer-based-timestamps` branch, with changes being merged into that branch during development. This pull request represents an amalgamation of the changes made into that development branch. All of the changes that were placed into that branch have been cleanly rebased on top of the latest `master`. The changes compile and the tests pass insofar as our tests in general pass.

### Note To Reviewers
 These changes have been extensively reviewed during development. There is not much new here. In the interest of making effective use of time, I would recommend against trying to perform a complete audit of the changes presented and instead examine for mistakes that may have occurred during the process of rebasing the changes. I gave the complete change set a first pass for any issues, but additional eyes would be very appreciated. 

In sum, this change set does the following:
closes #6942 
merges in #6849
2022-01-26 16:00:23 +00:00
M. J. Fromberger
7878ca6a8a Delete the custom libs/json (tmjson) package. (#7673)
There are no further uses of this package anywhere in Tendermint.
All the uses in the Cosmos SDK are for types that now work correctly with the
standard encoding/json package.
2022-01-24 08:15:34 -08:00
Sam Kleinman
8ff367ad29 log: avoid use of legacy test logging (#7583) 2022-01-13 14:38:54 -05:00
Sam Kleinman
7a9a38d9d7 service: avoid debug logs before error (#7564) 2022-01-12 16:17:43 -05:00
Sam Kleinman
0f3f2aa4bc log: remove support for traces (#7542) 2022-01-10 13:56:42 -05:00
Sam Kleinman
569629486b tests: remove panics from test fixtures (#7522) 2022-01-06 17:34:32 -05:00
Sam Kleinman
0ae974e639 libs/os: remove trap signal (#7515) 2022-01-06 08:26:37 -05:00
Sam Kleinman
8564c5079f e2e: use more simple strings for generated transactions (#7513) 2022-01-05 12:17:23 -05:00
Sam Kleinman
f2cc496f09 testing: pass testing.T to assert and require always, assertion cleanup (#7508) 2022-01-05 09:25:08 -05:00
Sam Kleinman
5c0abb5367 testing: use scoped logger for all public packages (#7504) 2022-01-04 12:56:17 -05:00
Sam Kleinman
9a0dbdbf13 libs/rand: remove custom seed function (#7473) 2021-12-17 12:15:27 -05:00
M. J. Fromberger
82738eb016 Move the libs/pubsub package to internal scope (#7451)
No API changes, merely changes the import path.
2021-12-15 07:09:32 -08:00
M. J. Fromberger
ab7da86b06 Internalize libs/sync. (#7450)
Inline the one usage of this library, and remove the lib.
2021-12-14 15:14:30 -08:00
M. J. Fromberger
da697089d0 Move libs/async to internal/libs/async. (#7449) 2021-12-14 14:05:42 -08:00
Sam Kleinman
f56df58fe8 testing,log: add testing.T logger connector (#7447) 2021-12-14 16:30:06 -05:00
Sam Kleinman
2ff962a63a log: dissallow nil loggers (#7445) 2021-12-14 12:45:13 -05:00
Sam Kleinman
d0e03f01fc sync: remove special mutexes (#7438) 2021-12-13 13:35:32 -05:00
Sam Kleinman
bd6dc3ca88 p2p: refactor channel Send/out (#7414) 2021-12-09 14:03:41 -05:00
Sam Kleinman
a62ac27047 service: remove exported logger from base implemenation (#7381) 2021-12-06 10:16:42 -05:00
Sam Kleinman
8a991e288c service: plumb contexts to all (most) threads (#7363)
This continues the push of plumbing contexts through tendermint. I
attempted to find all goroutines in the production code (non-test) and
made sure that these threads would exit when their contexts were
canceled, and I believe this PR does that.
2021-12-02 21:38:38 +00:00
Sam Kleinman
a823d167bc service: cleanup base implementation and some caller implementations (#7301) 2021-12-01 09:28:06 -05:00
M. J. Fromberger
76dea94a01 Remove now-unused nolint:lll directives. (#7356) 2021-11-30 21:32:21 +00:00