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

do not mark self malicious #4981

Closed

Conversation

countvonzero
Copy link
Contributor

Motivation

to ease adoption of testnet

Changes

  • statically set miner's own node id
  • whenever malfeasance proof is generated, check that it's not self

@codecov
Copy link

codecov bot commented Sep 7, 2023

Codecov Report

Merging #4981 (c89fa6d) into develop (b694924) will decrease coverage by 0.1%.
Report is 1 commits behind head on develop.
The diff coverage is 31.2%.

❗ Current head c89fa6d differs from pull request most recent head 5c90fa8. Consider uploading reports for the commit 5c90fa8 to get more accurate results

@@            Coverage Diff            @@
##           develop   #4981     +/-   ##
=========================================
- Coverage     77.1%   77.1%   -0.1%     
=========================================
  Files          254     254             
  Lines        30141   30173     +32     
=========================================
+ Hits         23253   23266     +13     
- Misses        5384    5400     +16     
- Partials      1504    1507      +3     
Files Changed Coverage Δ
hare/hare.go 65.9% <0.0%> (-0.3%) ⬇️
malfeasance/handler.go 68.6% <0.0%> (-1.1%) ⬇️
node/node.go 62.9% <0.0%> (-0.2%) ⬇️
common/types/nodeid.go 86.6% <33.3%> (-13.4%) ⬇️
activation/handler.go 76.6% <100.0%> (ø)
hare3/hare.go 84.5% <100.0%> (ø)
mesh/mesh.go 68.4% <100.0%> (ø)

... and 4 files with indirect coverage changes

📢 Have feedback on the report? Share it here.

@countvonzero countvonzero force-pushed the dont-mark-self-malicious branch from 93b9179 to 5c90fa8 Compare September 8, 2023 01:56
@@ -699,6 +699,61 @@ func TestHandler(t *testing.T) {
})
}

func TestHandlerOwnEquivocation(t *testing.T) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry. i couldn't find a way to add it in TestHandler.
i didn't know how to advance to a round that the node is eligible again

Copy link
Contributor

Choose a reason for hiding this comment

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

i think the way to go to introduce such test is to make initialization reusable, instead of copying it

@@ -9,6 +9,18 @@ import (
"github.com/spacemeshos/go-spacemesh/log"
)

var ownNodeID NodeID
Copy link
Contributor

@dshulyak dshulyak Sep 8, 2023

Choose a reason for hiding this comment

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

i don't think that adding global public key is acceptable even as a mitigation.

beside that this code already can be removed next week

@@ -286,7 +286,7 @@ func (h *Hare) Handler(ctx context.Context, peer p2p.Peer, buf []byte) error {
gossip, equivocation := session.OnInput(input)
h.log.Debug("after on message", log.ZShortStringer("hash", input.msgHash), zap.Bool("gossip", gossip))
submitLatency.Observe(time.Since(start).Seconds())
if equivocation != nil && !malicious {
if equivocation != nil && !malicious && msg.Sender != types.MinerNodeID() {
Copy link
Contributor

Choose a reason for hiding this comment

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

*Hare has reference to signer

@dshulyak
Copy link
Contributor

dshulyak commented Sep 8, 2023

i don't understand what it fixes? if node sent an equivocating message thats enough, it doesn't have to generate a proof for itself. the latter is certainly should not be done, but by itself it doesn't fix much. this code also doesn't exit with fatal.

the solution in #4857 prevents some configuration mistakes, but not all

msg2.Sender = n.signer.NodeID()
msg2.Signature = n.signer.Sign(signing.HARE, msg2.ToMetadata().ToBytes())

types.SetMinerNodeID(n.hare.signer.NodeID())
Copy link
Contributor

Choose a reason for hiding this comment

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

this global state can't work with t.Parallel, but hare already has access to signer

@dshulyak
Copy link
Contributor

dshulyak commented Sep 8, 2023

but anyway, i think this is not the approach. it doesn't solve any actual problems, introduces global state and code that needs to be removed "tomorrow".

the solutions that addresses some problems are:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants