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

multi: Integrate mixpool and propagate p2p mixing messages #3208

Merged
merged 1 commit into from
May 15, 2024

Conversation

jrick
Copy link
Member

@jrick jrick commented Nov 7, 2023

This commit adds the mixing message pool to the server and listens for all
peer-to-peer mixing messages broadcast on the network. If these messages are
able to be accepted to the mixpool, they are relayed to other peers through
the inventory system, and notified to RPC clients.

This commit also also adds support for publishing and receiving mix messages
over JSON-RPC for non-SPV wallet clients.

Requires #3207.
Requires #3082.

@jrick jrick force-pushed the mixing_server branch 3 times, most recently from 14218d5 to a379d96 Compare November 8, 2023 17:36
@jrick jrick force-pushed the mixing_server branch 3 times, most recently from 02673d2 to fea21bd Compare March 20, 2024 13:56
@jrick jrick force-pushed the mixing_server branch from fea21bd to d3a763b Compare May 7, 2024 15:46
@jrick jrick changed the title peer,main: propagate p2p mixing messages multi: Integrate mixpool and propagate p2p mixing messages May 7, 2024
@jrick jrick force-pushed the mixing_server branch 13 times, most recently from 4fda613 to 1fe24e6 Compare May 15, 2024 15:57
@davecgh davecgh added this to the 2.0.0 milestone May 15, 2024
internal/netsync/manager.go Outdated Show resolved Hide resolved
internal/netsync/manager.go Show resolved Hide resolved
internal/netsync/manager.go Show resolved Hide resolved
internal/rpcserver/rpcwebsocket.go Outdated Show resolved Hide resolved
internal/rpcserver/rpcwebsocket.go Outdated Show resolved Hide resolved
wsc.blake256HaserMu.Unlock()
//hash := msg.Hash()

err = wsc.rpcServer.cfg.SyncMgr.SubmitMixMessage(msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be returning all of the accepted messages (because orphans can be added) and then relaying them all?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably.. but the ordering issues aren't so relevant to rpc clients who can/will send them in the proper order. I don't think I've ever seen dcrd reject a KE from a rpc-mode wallet because the PR was unknown. I intentionally also increased the time it takes to expire PRs out of dcrd's mixpool, so they would not be removed from underneath the wallet.

Copy link
Member

@davecgh davecgh May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving unresolved for now. It's not a big issue for now and we can add it later.


wsc.rpcServer.cfg.ConnMgr.RelayMixMessages([]mixing.Message{msg})

wsc.rpcServer.ntfnMgr.NotifyMixMessage(msg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, this should be notifying of all accepted mix messages in the order they were accepted (which is what is returned from mixpool.AcceptMessage).

Copy link
Member

@davecgh davecgh May 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving unresolved for now. It's not a big issue for now and we can add it later.

peer/peer.go Outdated Show resolved Hide resolved
rpc/jsonrpc/types/chainsvrcmds.go Outdated Show resolved Hide resolved
rpc/jsonrpc/types/chainsvrwscmds.go Outdated Show resolved Hide resolved
Copy link
Member

@davecgh davecgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to go. I did some light simnet testing of the RPC server after the updates:

$ ./ctl -l | grep -E 'sendrawmix|mixpair'
getmixpairrequests
sendrawmixmessage "command" "message"
$ ./ctl sendrawmixmessage
sendrawmixmessage command: wrong number of params (expected 2, received 1) (ErrNumParams)
Usage:
  sendrawmixmessage "command" "message"
$ ./ctl sendrawmixmessage foo 0a
-8: Unrecognized mixing message wire command string "foo"
$ ./ctl getmixpairrequests
[]

Feel free to squash it down and we can get it merged. 🎉

This commit adds the mixing message pool to the server and listens for all
peer-to-peer mixing messages broadcast on the network.  If these messages are
able to be accepted to the mixpool, they are relayed to other peers through
the inventory system, and notified to RPC clients.

This commit also also adds support for publishing and receiving mix messages
over JSON-RPC for non-SPV wallet clients.
@davecgh davecgh merged commit 7bd8f66 into decred:master May 15, 2024
2 checks passed
@jrick jrick deleted the mixing_server branch May 15, 2024 21:55
@davecgh davecgh added the rpc server api change Issues and/or pull requests that involve a new RPC server version or breaking to change to the API. label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rpc server api change Issues and/or pull requests that involve a new RPC server version or breaking to change to the API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants