From b8011c09dd4a864972f3bdb59c14eeb401b0df2b Mon Sep 17 00:00:00 2001 From: Jeffery Walsh Date: Thu, 29 Jun 2023 19:08:06 -0700 Subject: [PATCH] dummy proof must be 32 bytes now as protocol relies on that --- prover/proof_producer/dummy_producer.go | 13 ++++++++++--- prover/prover.go | 5 +++++ testutils/suite.go | 4 +--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/prover/proof_producer/dummy_producer.go b/prover/proof_producer/dummy_producer.go index f6ca986df..5c2125a42 100644 --- a/prover/proof_producer/dummy_producer.go +++ b/prover/proof_producer/dummy_producer.go @@ -39,9 +39,16 @@ func (d *DummyProofProducer) RequestProof( BlockID: blockID, Meta: meta, Header: header, - ZkProof: []byte{0xff}, - Degree: CircuitsDegree10Txs, - Opts: opts, + // proof must be 32 bytes min since protocol uses bytes utils and reads 32 bytes, so even + // make proofs must be 32 bytes + ZkProof: []byte{0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, + }, + Degree: CircuitsDegree10Txs, + Opts: opts, } }) diff --git a/prover/prover.go b/prover/prover.go index 59ad80bc6..652ebd1c7 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -688,6 +688,9 @@ func (p *Prover) cancelProof(ctx context.Context, blockID uint64) { } } +// checkProofWindowsExpired iterates through the current blocks waiting for proof window to expire, +// which are blocks that have been proposed, but we were not selected as the prover. if the proof window +// has expired, we can start generating a proof for them. func (p *Prover) checkProofWindowsExpired(ctx context.Context) error { for i, blockId := range p.currentBlocksWaitingForProofWindow { if err := p.checkProofWindowExpired(ctx, i, blockId); err != nil { @@ -698,6 +701,8 @@ func (p *Prover) checkProofWindowsExpired(ctx context.Context) error { return nil } +// checkProofWindowExpired checks a single instance of a block to see if its proof winodw has expired +// and the proof is now able to be submitted by anyone, not just the blocks assigned prover. func (p *Prover) checkProofWindowExpired(ctx context.Context, i int, blockId uint64) error { p.currentBlocksWaitingForProofWindowMutex.Lock() defer p.currentBlocksWaitingForProofWindowMutex.Unlock() diff --git a/testutils/suite.go b/testutils/suite.go index f811aaa2b..91b65fdb1 100644 --- a/testutils/suite.go +++ b/testutils/suite.go @@ -100,8 +100,6 @@ func (s *ClientTestSuite) SetupTest() { amtTko := new(big.Int).Mul(amt, big.NewInt(8)) - log.Info("amtTko", "amt", amtTko.String()) - // proposer has tKO, need to transfer to prover _, err = s.RpcClient.TaikoTokenL1.Transfer(proposerOpts, crypto.PubkeyToAddress(l1ProverPrivKey.PublicKey), amtTko) s.Nil(err) @@ -114,7 +112,7 @@ func (s *ClientTestSuite) SetupTest() { uint16(rewardPerGas), uint16(capacity), ) - s.Nil(err, "2") + s.Nil(err) } s.Nil(rpcCli.L1RawRPC.CallContext(context.Background(), &s.testnetL1SnapshotID, "evm_snapshot"))