-
Notifications
You must be signed in to change notification settings - Fork 24
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
ZMQ PUB/SUB JSON Types #330
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
03e1939
ZMQ types crate added
dimalinux 57fbb6b
added TxPoolAdd message type
dimalinux e5875ed
test for Display trait of Bytes<N>
dimalinux 89b964d
added TxPoolAddMin
dimalinux 40a26bc
added FullChainMain
dimalinux 9817bbd
added FullMinerData
dimalinux 811c921
added ChainMainMin
dimalinux 7292bba
fixes for tx extra, switched to existing HexBytes
dimalinux d4a6998
documentation updates
dimalinux f76c84d
MinerRingCt made private
dimalinux d301deb
more documentation, difficulty is u64
dimalinux d120285
documented more fields
dimalinux d06d4b8
more documentation
dimalinux bf48d4d
all fields/types documented
dimalinux 0086962
Merge remote-tracking branch 'origin/main' into dimalinux/zmq-types
dimalinux 863a77d
workspace dependencies for cuprate crates
dimalinux ce822f9
better declarations for empty JSON arrays
dimalinux ef74d21
added ZMQ section to crates doc
dimalinux dbaad27
authors update
dimalinux 2f3d176
Merge remote-tracking branch 'origin/main' into dimalinux/zmq-types
dimalinux a719f7a
converted 1-item-only vectors into arrays
dimalinux File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
[package] | ||
name = "cuprate-zmq-types" | ||
version = "0.1.0" | ||
edition = "2021" | ||
description = "Types for the ZMQ Pub/Sub API" | ||
license = "MIT" | ||
authors = ["dimalinux"] | ||
repository = "https://github.com/Cuprate/cuprate/tree/main/zmq/types" | ||
|
||
[dependencies] | ||
serde = { workspace = true, features = ["derive"] } | ||
hex = { workspace = true, features = ["std", "serde"] } | ||
cuprate-types = { workspace = true, features = ["hex"] } | ||
|
||
[dev-dependencies] | ||
serde_json = { workspace = true, features = ["std"] } | ||
assert-json-diff = "2.0.2" | ||
|
||
[lints] | ||
workspace = true |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO I would rather have worse error messages on tests than pull an extra dep in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pulled it in as a dev-only dependency, because testing JSON equality is a very non-trivial thing to do. Client readers are not supposed to care about whitespace or the order of fields within an object. If the input object is a map, its field output emit order can even vary between test runs.
In Golang, the feature to test JSON equality is built right into the most popular testing library (
testify
).assert-json-diff
appeared to be the most widely used option for testing JSON-backwards-compatibility in Rust.I did verify that the library differentiates between empty lists and nil lists, and the other types of backwards compatibility that we care about.
If, after reading this, we still don't want to use the
assert-json-diff
crate, let me know and I'll find a way to make the tests work without it. We are not using any maps, so it should be possible. The expected values will probably have to be on single, super-long lines, so they won't be human readable. Or I can get the test samples formatted in the same way as serde's pretty print and use multi-line raw strings.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seen as it is only a dev dep we can keep it for now, although it might get removed to reduce the number of deps in the future