Skip to content

Fraud Proofs - one PR to rule them all#538

Closed
tzdybal wants to merge 42 commits intomainfrom
manav/verify_fraud_proof
Closed

Fraud Proofs - one PR to rule them all#538
tzdybal wants to merge 42 commits intomainfrom
manav/verify_fraud_proof

Conversation

@tzdybal
Copy link
Copy Markdown
Contributor

@tzdybal tzdybal commented Sep 26, 2022

This PR wraps up entire Fraud Proof related work into single PR. It might be easier to review / apply comments this way.

Replaces: #375, #498, #500.

@mergify
Copy link
Copy Markdown

mergify Bot commented Sep 26, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

Comment thread node/integration_test.go Outdated
Comment thread proto/tendermint/abci/types.proto
Comment thread proto/tendermint/abci/types.proto Outdated
// State witness with a list of all witness data
message StateWitness {
// store level proof
tendermint.crypto.ProofOp proof_op = 1;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Consider renaming to just proof (as in WitnessData).

Copy link
Copy Markdown
Contributor Author

@tzdybal tzdybal Oct 13, 2022

Choose a reason for hiding this comment

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

This has to be updated in https://github.com/celestiaorg/tendermint, and then pulled to rollmint with get_deps.sh.

Comment thread proto/tendermint/abci/types.proto
Comment thread proto/tendermint/version/types.proto Outdated
@@ -0,0 +1,24 @@
syntax = "proto3";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is this file needed? Or it's just side-effect of running ./proto/get_deps.sh?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

it's just side-effect of running ./proto/get_deps.sh

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But can we remove this file safely?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Removed it

Comment thread state/executor.go Outdated
}
// TODO: gossip fraudProof to P2P network
// fraudTx: current DeliverTx
_ = fraudProof
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Gossiping code is ready - are there any blockers to execute it here?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Issue here: #552

Comment thread state/executor.go Outdated
Comment thread state/executor.go Outdated
Comment on lines +361 to +378
if fraudProofsEnabled {
isr, err := e.getAppHash()
if err != nil {
return nil, err
}
ISRs = append(ISRs, isr)
isFraud := e.checkFraudProofTrigger(isr, currentIsrs, currentIsrIndex)
if isFraud {
fraudProof, err := e.generateFraudProof(&beginBlockRequest, deliverTxRequests, nil)
if err != nil {
return nil, err
}
// TODO: gossip fraudProof to P2P network
// fraudTx: current DeliverTx
_ = fraudProof
}
currentIsrIndex++
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This (more or less) should be extracted as function as it's repeated 3 times.

Comment thread state/executor.go Outdated
Comment thread types/block.go Outdated
Comment on lines +95 to +126

// Represents a single-round fraudProof
type FraudProof struct {
// The block height to load state of
blockHeight int64

appHash []byte
// A map from module name to state witness
stateWitness map[string]StateWitness

// Fraudulent state transition has to be one of these
// Only one have of these three can be non-nil
fraudulentBeginBlock *abci.RequestBeginBlock
fraudulentDeliverTx *abci.RequestDeliverTx
fraudulentEndBlock *abci.RequestEndBlock
}

// State witness with a list of all witness data
type StateWitness struct {
// store level proof
Proof tmcrypto.ProofOp
RootHash []byte
// List of witness data
WitnessData []WitnessData
}

// Witness data containing a key/value pair and a SMT proof for said key/value pair
type WitnessData struct {
Key []byte
Value []byte
Proof tmcrypto.ProofOp
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This could be moved to separate file (fraud_proofs.go or similar).

@tzdybal tzdybal marked this pull request as ready for review September 26, 2022 08:51
@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 1, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

Co-authored-by: Tomasz Zdybał <tomek@zdybal.lap.pl>
@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 1, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 13, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

Currently we need to use Manav's branch from celestiaorg/tendermint
fork.
@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 13, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 13, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

Co-authored-by: Tomasz Zdybał <tomek@zdybal.lap.pl>
@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 13, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 13, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 13, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 17, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 18, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

Comment thread go.mod Outdated
github.com/spf13/viper v1.13.0
github.com/stretchr/testify v1.8.0
github.com/tendermint/tendermint v0.34.21
github.com/tendermint/tendermint v0.34.14
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We shouldn't downgrade tendermint.

Comment thread go.mod Outdated

replace (
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.2-alpha.regen.4
github.com/tendermint/tendermint => github.com/celestiaorg/tendermint v0.34.18-0.20220826223854-50069357d918
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We need our tendermint version rebased on top of v0.34.21.

Comment thread node/integration_test.go
require.NoError(err)
nodeBlock, err := nodes[i].Store.LoadBlock(h)
require.NoError(err)
// Only Intermediate state roots set by block aggregator are relevant, removed for sake of comparison
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Why we need to remove this? Is there any discrepancy between ISRs between aggregator and full nodes?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Test fails without explicit clearing of RawRootsList, which is strange. It's a part of a block data, so it has to be the same in all blocks. We need to figure out why it differs.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Issue here: #566

Comment thread proto/get_deps.sh Outdated
Comment thread node/integration_test.go Outdated
assert.GreaterOrEqual(endCnt, adjustedHeight)
assert.GreaterOrEqual(commitCnt, adjustedHeight)

assert.Equal(generateFraudProofCnt, beginCnt+endCnt+clientNodes)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

  1. First argument is "expected", second is "actual", so you should swap arguments to Equal.
  2. It's not obvious why beginCnt+endCnt+clientNodes - please add comment with explanation.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Updated and added comment with explanation.

Comment thread proto/tendermint/version/types.proto Outdated
@@ -0,0 +1,24 @@
syntax = "proto3";
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

But can we remove this file safely?

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 20, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 20, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

Co-authored-by: Tomasz Zdybał <tomek@zdybal.lap.pl>
@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 20, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@mergify
Copy link
Copy Markdown

mergify Bot commented Oct 24, 2022

⚠️ The sha of the head commit of this PR conflicts with #500. Mergify cannot evaluate rules on this PR. ⚠️

@tzdybal
Copy link
Copy Markdown
Contributor Author

tzdybal commented Oct 25, 2022

All comments on this PR was resolved, but we need to close it, as I created it, instead of @Manav-Aggarwal, so I can't accept it.

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.

3 participants