go-spacemesh icon indicating copy to clipboard operation
go-spacemesh copied to clipboard

Initial PoST proof challenge should include nodeID

Open lrettig opened this issue 3 years ago • 1 comments

Shouldn't it? The setup provider does check that the metadata matches, but the nodeID is not included in the initial challenge. Doesn't this mean that the initial PoST proof is identical for all nodes?

CC @noamnelke, @dshulyak, @tal-m

https://github.com/spacemeshos/go-spacemesh/blob/59eec02d22e20437c2a1fd033e4a0cd1721ca181/activation/activation.go#L306

lrettig avatar Jul 04 '22 19:07 lrettig

node id is passed to the https://github.com/spacemeshos/post/blob/develop/initialization/initialization.go#L53 and used later. but i don't know this component details .

it is also used for verification https://github.com/spacemeshos/post/blob/develop/verifying/verifying.go#L51-L52

@moshababo should know with certainty

dshulyak avatar Aug 08 '22 07:08 dshulyak

The ID is committed to the proof as part of the input to the hash function (in labels creation). The challenge is for the PoET -- therefore in consecutive proofs: https://github.com/spacemeshos/go-spacemesh/blob/59eec02d22e20437c2a1fd033e4a0cd1721ca181/activation/nipost.go#L190 And so when the chain of proofs (per ID) is starting, there's no prior PoET to use as a challenge, hence the zero value.

moshababo avatar Aug 15 '22 14:08 moshababo

Here's a trace of the calls to initialize PoST, and how the nodeID gets passed down to the gpu-lib code and hashed into the proof:

node.go :: startServices -> activation/activation.go :: StartSmeshing -> activation/post.go :: StartSession -> post library initialization/initialization.go :: NewInitializer (receives and stores id), post library initialization/initialization.go :: Initialize -> post library initialization/initialization.go :: initFile -> post library oracle/oracle.go :: WorkOracle -> post library gpu/api.go :: ScryptPositions -> post library gpu/bridge.go :: sCryptPositions passes id into gpu-lib library

The nodeID is committed to in the initial PoST generation, per this trace. The subsequent proof generation process uses this PoST data, so it's not necessary that the nodeID be included in the challenge (rather, the previous PoET proof is used as the challenge). In other words, the nodeID is included in all proofs implicitly (since they all read the PoST data), rather than explicitly. Makes sense. I don't see anything here that needs to change.

lrettig avatar Aug 15 '22 19:08 lrettig

@lrettig i think we need to add genesis to the id passed to the initializer and verifier. do you track it somewhere else?

dshulyak avatar Aug 16 '22 09:08 dshulyak

@lrettig i think we need to add genesis to the id passed to the initializer and verifier. do you track it somewhere else?

those are subtasks of https://github.com/spacemeshos/pm/issues/135 right?

lrettig avatar Aug 16 '22 21:08 lrettig

i didn't see subtask to include genesis id for post initialization

dshulyak avatar Aug 17 '22 04:08 dshulyak

@dshulyak it's there:

Smesher ID: this is based on nodeID and must also include GENESISID. For this we need POPS-VRF (https://github.com/spacemeshos/pm/issues/168), but that task is distinct and for the purposes of this task we may assume it's already in place.

which is to say that it's part of https://github.com/spacemeshos/pm/issues/168

lrettig avatar Aug 17 '22 18:08 lrettig