This repository has been archived by the owner on May 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 334
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eb28b05
commit 422728d
Showing
14 changed files
with
272 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package producer | ||
|
||
import ( | ||
"bytes" | ||
"context" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/taikoxyz/taiko-client/bindings" | ||
) | ||
|
||
// OptimisticProofProducer always returns a dummy proof. | ||
type DummyProofProducer struct{} | ||
|
||
// RequestProof returns a dummy proof to the result channel. | ||
func (o *DummyProofProducer) RequestProof( | ||
ctx context.Context, | ||
opts *ProofRequestOptions, | ||
blockID *big.Int, | ||
meta *bindings.TaikoDataBlockMetadata, | ||
header *types.Header, | ||
tier uint16, | ||
resultCh chan *ProofWithHeader, | ||
) error { | ||
resultCh <- &ProofWithHeader{ | ||
BlockID: blockID, | ||
Meta: meta, | ||
Header: header, | ||
Proof: bytes.Repeat([]byte{0xff}, 100), | ||
Degree: CircuitsIdx, | ||
Opts: opts, | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package producer | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/taikoxyz/taiko-client/bindings" | ||
"github.com/taikoxyz/taiko-client/bindings/encoding" | ||
) | ||
|
||
// GuardianProofProducer always returns an optimistic (dummy) proof. | ||
type GuardianProofProducer struct{ *DummyProofProducer } | ||
|
||
// RequestProof implements the ProofProducer interface. | ||
func (g *GuardianProofProducer) RequestProof( | ||
ctx context.Context, | ||
opts *ProofRequestOptions, | ||
blockID *big.Int, | ||
meta *bindings.TaikoDataBlockMetadata, | ||
header *types.Header, | ||
resultCh chan *ProofWithHeader, | ||
) error { | ||
log.Info( | ||
"Request guardian proof", | ||
"blockID", blockID, | ||
"coinbase", meta.Coinbase, | ||
"height", header.Number, | ||
"hash", header.Hash(), | ||
) | ||
|
||
return g.DummyProofProducer.RequestProof(ctx, opts, blockID, meta, header, g.Tier(), resultCh) | ||
} | ||
|
||
// Tier implements the ProofProducer interface. | ||
func (g *GuardianProofProducer) Tier() uint16 { | ||
return encoding.TierGuardianID | ||
} | ||
|
||
// Cancel cancels an existing proof generation. | ||
func (g *GuardianProofProducer) Cancel(ctx context.Context, blockID *big.Int) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package producer | ||
|
||
import ( | ||
"context" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/core/types" | ||
"github.com/ethereum/go-ethereum/log" | ||
"github.com/taikoxyz/taiko-client/bindings" | ||
"github.com/taikoxyz/taiko-client/bindings/encoding" | ||
) | ||
|
||
// SGXProofProducer generates a SGX proof for the given block. | ||
type SGXProofProducer struct{ *DummyProofProducer } | ||
|
||
// RequestProof implements the ProofProducer interface. | ||
func (s *SGXProofProducer) RequestProof( | ||
ctx context.Context, | ||
opts *ProofRequestOptions, | ||
blockID *big.Int, | ||
meta *bindings.TaikoDataBlockMetadata, | ||
header *types.Header, | ||
resultCh chan *ProofWithHeader, | ||
) error { | ||
log.Warn( | ||
"SGX proof producer is unimplemented, will return a dummy proof instead", | ||
"blockID", blockID, | ||
"coinbase", meta.Coinbase, | ||
"height", header.Number, | ||
"hash", header.Hash(), | ||
) | ||
|
||
return s.DummyProofProducer.RequestProof(ctx, opts, blockID, meta, header, s.Tier(), resultCh) | ||
} | ||
|
||
// Tier implements the ProofProducer interface. | ||
func (s *SGXProofProducer) Tier() uint16 { | ||
return encoding.TierSgxID | ||
} | ||
|
||
// Cancel cancels an existing proof generation. | ||
func (s *SGXProofProducer) Cancel(ctx context.Context, blockID *big.Int) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.