diff --git a/bindings/encoding/input.go b/bindings/encoding/input.go index 6f05c5498..e347fbf32 100644 --- a/bindings/encoding/input.go +++ b/bindings/encoding/input.go @@ -206,27 +206,11 @@ var ( Type: "uint256", }, } - zkEvmProofComponents = []abi.ArgumentMarshaling{ - { - Name: "verifierId", - Type: "uint16", - }, - { - Name: "zkp", - Type: "bytes", - }, - { - Name: "pointProof", - Type: "bytes", - }, - } ) var ( assignmentHookInputType, _ = abi.NewType("tuple", "AssignmentHook.Input", assignmentHookInputComponents) assignmentHookInputArgs = abi.Arguments{{Name: "AssignmentHook.Input", Type: assignmentHookInputType}} - zkEvmProofType, _ = abi.NewType("tuple", "ZkEvmProof", zkEvmProofComponents) - zkEvmProofArgs = abi.Arguments{{Name: "ZkEvmProof", Type: zkEvmProofType}} blockParamsComponentsType, _ = abi.NewType("tuple", "TaikoData.BlockParams", blockParamsComponents) blockParamsComponentsArgs = abi.Arguments{{Name: "TaikoData.BlockParams", Type: blockParamsComponentsType}} // ProverAssignmentPayload @@ -348,19 +332,6 @@ func EncodeBlockParams(params *BlockParams) ([]byte, error) { return b, nil } -// EncodeBlockParams performs the solidity `abi.encode` for the given blockParams. -func EncodeZKEvmProof(proof []byte) ([]byte, error) { - b, err := zkEvmProofArgs.Pack(&ZKEvmProof{ - VerifierId: 0, - Zkp: proof, - PointProof: []byte{}, - }) - if err != nil { - return nil, fmt.Errorf("failed to abi.encode ZkEvmProof, %w", err) - } - return b, nil -} - // EncodeAssignmentHookInput performs the solidity `abi.encode` for the given input func EncodeAssignmentHookInput(input *AssignmentHookInput) ([]byte, error) { b, err := assignmentHookInputArgs.Pack(input) diff --git a/bindings/encoding/struct.go b/bindings/encoding/struct.go index 677b356e1..8c0d3d258 100644 --- a/bindings/encoding/struct.go +++ b/bindings/encoding/struct.go @@ -10,13 +10,12 @@ import ( // Tier IDs defined in protocol. var ( - TierOptimisticID uint16 = 100 - TierSgxID uint16 = 200 - TierPseZkevmID uint16 = 300 - TierSgxAndPseZkevmID uint16 = 400 - TierGuardianID uint16 = 1000 - ProtocolTiers = []uint16{TierOptimisticID, TierSgxID, TierSgxAndPseZkevmID, TierGuardianID} - GoldenTouchPrivKey = "92954368afd3caa1f3ce3ead0069c1af414054aefe1ef9aeacc1bf426222ce38" + TierOptimisticID uint16 = 100 + TierSgxID uint16 = 200 + TierSgxAndZkVMID uint16 = 300 + TierGuardianID uint16 = 1000 + ProtocolTiers = []uint16{TierOptimisticID, TierSgxID, TierSgxAndZkVMID, TierGuardianID} + GoldenTouchPrivKey = "92954368afd3caa1f3ce3ead0069c1af414054aefe1ef9aeacc1bf426222ce38" ) // HookCall should be same with TaikoData.HookCall @@ -62,13 +61,6 @@ type AssignmentHookInput struct { Tip *big.Int } -// ZKEvmProof should be same as PseZkVerifier.ZkEvmProof -type ZKEvmProof struct { - VerifierId uint16 // nolint: revive, stylecheck - Zkp []byte - PointProof []byte -} - // ToExecutableData converts a GETH *types.Header to *engine.ExecutableData. func ToExecutableData(header *types.Header) *engine.ExecutableData { executableData := &engine.ExecutableData{ diff --git a/cmd/flags/proposer.go b/cmd/flags/proposer.go index c6863761a..ffe715226 100644 --- a/cmd/flags/proposer.go +++ b/cmd/flags/proposer.go @@ -47,16 +47,6 @@ var ( Usage: "Initial tier fee (in wei) paid to prover to generate a SGX proofs", Category: proposerCategory, } - PseZkevmTierFee = &cli.Uint64Flag{ - Name: "tierFee.pseZKEvm", - Usage: "Initial tier fee (in wei) paid to prover to generate a PSE zkEVM proofs", - Category: proposerCategory, - } - SgxAndPseZkevmTierFee = &cli.Uint64Flag{ - Name: "tierFee.sgxAndPseZKEvm", - Usage: "Initial tier fee (in wei) paid to prover to generate a SGX + PSE zkEVM proofs", - Category: proposerCategory, - } TierFeePriceBump = &cli.Uint64Flag{ Name: "tierFee.pricebump", Usage: "Price bump percentage when no prover wants to accept the block at initial fee", @@ -159,8 +149,6 @@ var ProposerFlags = MergeFlags(CommonFlags, []cli.Flag{ ProverEndpoints, OptimisticTierFee, SgxTierFee, - PseZkevmTierFee, - SgxAndPseZkevmTierFee, TierFeePriceBump, MaxTierFeePriceBumps, ProposeBlockIncludeParentMetaHash, diff --git a/cmd/flags/prover.go b/cmd/flags/prover.go index 9395fa391..f1473f54b 100644 --- a/cmd/flags/prover.go +++ b/cmd/flags/prover.go @@ -30,16 +30,6 @@ var ( // Optional flags used by prover. var ( - ZkEvmRpcdEndpoint = &cli.StringFlag{ - Name: "zkevm.rpcdEndpoint", - Usage: "RPC endpoint of a ZKEVM RPCD service", - Category: proverCategory, - } - ZkEvmRpcdParamsPath = &cli.StringFlag{ - Name: "zkevm.rpcdParamsPath", - Usage: "Path of ZKEVM parameters file to use", - Category: proverCategory, - } RaikoHostEndpoint = &cli.StringFlag{ Name: "raiko.hostEndpoint", Usage: "RPC endpoint of a Raiko host service", @@ -74,16 +64,6 @@ var ( Usage: "Minimum accepted fee for generating a SGX proof", Category: proverCategory, } - MinPseZkevmTierFee = &cli.Uint64Flag{ - Name: "minTierFee.pseZKEvm", - Usage: "Minimum accepted fee for generating a PSE zkEVM proof", - Category: proverCategory, - } - MinSgxAndPseZkevmTierFee = &cli.Uint64Flag{ - Name: "minTierFee.sgxAndPseZKEvm", - Usage: "Minimum accepted fee for generating a SGX + PSE zkEVM proof", - Category: proverCategory, - } // Guardian prover related. GuardianProver = &cli.StringFlag{ Name: "guardianProver", @@ -208,14 +188,10 @@ var ProverFlags = MergeFlags(CommonFlags, []cli.Flag{ L1BeaconEndpoint, L2WSEndpoint, L2HTTPEndpoint, - ZkEvmRpcdEndpoint, - ZkEvmRpcdParamsPath, RaikoHostEndpoint, L1ProverPrivKey, MinOptimisticTierFee, MinSgxTierFee, - MinPseZkevmTierFee, - MinSgxAndPseZkevmTierFee, StartingBlockID, Dummy, GuardianProver, diff --git a/docs/docs.go b/docs/docs.go index 66111b0c5..ed8dacf6b 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -148,9 +148,6 @@ const docTemplate = `{ "minOptimisticTierFee": { "type": "integer" }, - "minPseZkevmTierFee": { - "type": "integer" - }, "minSgxTierFee": { "type": "integer" }, diff --git a/docs/swagger.json b/docs/swagger.json index ab29fdaa7..a79b9443a 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -139,9 +139,6 @@ "minOptimisticTierFee": { "type": "integer" }, - "minPseZkevmTierFee": { - "type": "integer" - }, "minSgxTierFee": { "type": "integer" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 0410d75f8..1a220dbe5 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -42,8 +42,6 @@ definitions: type: integer minOptimisticTierFee: type: integer - minPseZkevmTierFee: - type: integer minSgxTierFee: type: integer prover: diff --git a/driver/chain_syncer/calldata/syncer_test.go b/driver/chain_syncer/calldata/syncer_test.go index 0f111c8ce..9c8157d1b 100644 --- a/driver/chain_syncer/calldata/syncer_test.go +++ b/driver/chain_syncer/calldata/syncer_test.go @@ -64,8 +64,6 @@ func (s *CalldataSyncerTestSuite) SetupTest() { ProverEndpoints: s.ProverEndpoints, OptimisticTierFee: common.Big256, SgxTierFee: common.Big256, - PseZkevmTierFee: common.Big256, - SgxAndPseZkevmTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, L1BlockBuilderTip: common.Big0, diff --git a/driver/chain_syncer/chain_syncer_test.go b/driver/chain_syncer/chain_syncer_test.go index 5797936a8..39617564c 100644 --- a/driver/chain_syncer/chain_syncer_test.go +++ b/driver/chain_syncer/chain_syncer_test.go @@ -65,8 +65,6 @@ func (s *ChainSyncerTestSuite) SetupTest() { ProverEndpoints: s.ProverEndpoints, OptimisticTierFee: common.Big256, SgxTierFee: common.Big256, - PseZkevmTierFee: common.Big256, - SgxAndPseZkevmTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, ExtraData: "test", diff --git a/driver/driver_test.go b/driver/driver_test.go index 08a0f8cdc..c4fc572a1 100644 --- a/driver/driver_test.go +++ b/driver/driver_test.go @@ -72,8 +72,6 @@ func (s *DriverTestSuite) SetupTest() { ProverEndpoints: s.ProverEndpoints, OptimisticTierFee: common.Big256, SgxTierFee: common.Big256, - PseZkevmTierFee: common.Big256, - SgxAndPseZkevmTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, L1BlockBuilderTip: common.Big0, diff --git a/internal/testutils/helper.go b/internal/testutils/helper.go index e17d06b9a..63bd9657e 100644 --- a/internal/testutils/helper.go +++ b/internal/testutils/helper.go @@ -162,19 +162,17 @@ func (s *ClientTestSuite) NewTestProverServer( s.Nil(err) srv, err := server.New(&server.NewProverServerOpts{ - ProverPrivateKey: proverPrivKey, - MinOptimisticTierFee: common.Big1, - MinSgxTierFee: common.Big1, - MinPseZkevmTierFee: common.Big1, - MinSgxAndPseZkevmTierFee: common.Big1, - MaxExpiry: 24 * time.Hour, - TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), - AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), - ProposeConcurrencyGuard: make(chan struct{}, 1024), - RPC: s.RPCClient, - ProtocolConfigs: &protocolConfig, - LivenessBond: protocolConfig.LivenessBond, - IsGuardian: true, + ProverPrivateKey: proverPrivKey, + MinOptimisticTierFee: common.Big1, + MinSgxTierFee: common.Big1, + MaxExpiry: 24 * time.Hour, + TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), + AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), + ProposeConcurrencyGuard: make(chan struct{}, 1024), + RPC: s.RPCClient, + ProtocolConfigs: &protocolConfig, + LivenessBond: protocolConfig.LivenessBond, + IsGuardian: true, }) s.Nil(err) diff --git a/proposer/config.go b/proposer/config.go index 9b3608228..61d8fe351 100644 --- a/proposer/config.go +++ b/proposer/config.go @@ -35,8 +35,6 @@ type Config struct { ProverEndpoints []*url.URL OptimisticTierFee *big.Int SgxTierFee *big.Int - PseZkevmTierFee *big.Int - SgxAndPseZkevmTierFee *big.Int TierFeePriceBump *big.Int MaxTierFeePriceBumps uint64 IncludeParentMetaHash bool @@ -130,8 +128,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { ProverEndpoints: proverEndpoints, OptimisticTierFee: new(big.Int).SetUint64(c.Uint64(flags.OptimisticTierFee.Name)), SgxTierFee: new(big.Int).SetUint64(c.Uint64(flags.SgxTierFee.Name)), - PseZkevmTierFee: new(big.Int).SetUint64(c.Uint64(flags.PseZkevmTierFee.Name)), - SgxAndPseZkevmTierFee: new(big.Int).SetUint64(c.Uint64(flags.SgxAndPseZkevmTierFee.Name)), TierFeePriceBump: new(big.Int).SetUint64(c.Uint64(flags.TierFeePriceBump.Name)), MaxTierFeePriceBumps: c.Uint64(flags.MaxTierFeePriceBumps.Name), IncludeParentMetaHash: c.Bool(flags.ProposeBlockIncludeParentMetaHash.Name), diff --git a/proposer/config_test.go b/proposer/config_test.go index 034c2e032..d55cf5afc 100644 --- a/proposer/config_test.go +++ b/proposer/config_test.go @@ -51,8 +51,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContext() { s.Equal(10*time.Second, c.WaitReceiptTimeout) s.Equal(uint64(tierFee), c.OptimisticTierFee.Uint64()) s.Equal(uint64(tierFee), c.SgxTierFee.Uint64()) - s.Equal(uint64(tierFee), c.PseZkevmTierFee.Uint64()) - s.Equal(uint64(tierFee), c.SgxAndPseZkevmTierFee.Uint64()) s.Equal(uint64(15), c.TierFeePriceBump.Uint64()) s.Equal(uint64(5), c.MaxTierFeePriceBumps) s.Equal(true, c.IncludeParentMetaHash) @@ -84,8 +82,6 @@ func (s *ProposerTestSuite) TestNewConfigFromCliContext() { "--" + flags.ProverEndpoints.Name, proverEndpoints, "--" + flags.OptimisticTierFee.Name, fmt.Sprint(tierFee), "--" + flags.SgxTierFee.Name, fmt.Sprint(tierFee), - "--" + flags.PseZkevmTierFee.Name, fmt.Sprint(tierFee), - "--" + flags.SgxAndPseZkevmTierFee.Name, fmt.Sprint(tierFee), "--" + flags.TierFeePriceBump.Name, "15", "--" + flags.MaxTierFeePriceBumps.Name, "5", "--" + flags.ProposeBlockIncludeParentMetaHash.Name, "true", @@ -162,8 +158,6 @@ func (s *ProposerTestSuite) SetupApp() *cli.App { &cli.StringFlag{Name: flags.ProverEndpoints.Name}, &cli.Uint64Flag{Name: flags.OptimisticTierFee.Name}, &cli.Uint64Flag{Name: flags.SgxTierFee.Name}, - &cli.Uint64Flag{Name: flags.PseZkevmTierFee.Name}, - &cli.Uint64Flag{Name: flags.SgxAndPseZkevmTierFee.Name}, &cli.Uint64Flag{Name: flags.ProposeBlockTxReplacementMultiplier.Name}, &cli.DurationFlag{Name: flags.RPCTimeout.Name}, &cli.DurationFlag{Name: flags.WaitReceiptTimeout.Name}, diff --git a/proposer/proposer.go b/proposer/proposer.go index 0bd52cb4d..976e85943 100644 --- a/proposer/proposer.go +++ b/proposer/proposer.go @@ -557,10 +557,6 @@ func (p *Proposer) initTierFees() error { p.tierFees = append(p.tierFees, encoding.TierFee{Tier: tier.ID, Fee: p.OptimisticTierFee}) case encoding.TierSgxID: p.tierFees = append(p.tierFees, encoding.TierFee{Tier: tier.ID, Fee: p.SgxTierFee}) - case encoding.TierPseZkevmID: - p.tierFees = append(p.tierFees, encoding.TierFee{Tier: tier.ID, Fee: p.PseZkevmTierFee}) - case encoding.TierSgxAndPseZkevmID: - p.tierFees = append(p.tierFees, encoding.TierFee{Tier: tier.ID, Fee: p.SgxAndPseZkevmTierFee}) case encoding.TierGuardianID: // Guardian prover should not charge any fee. p.tierFees = append(p.tierFees, encoding.TierFee{Tier: tier.ID, Fee: common.Big0}) diff --git a/proposer/proposer_test.go b/proposer/proposer_test.go index e5a1e23b1..8c465aa3a 100644 --- a/proposer/proposer_test.go +++ b/proposer/proposer_test.go @@ -53,8 +53,6 @@ func (s *ProposerTestSuite) SetupTest() { ProverEndpoints: s.ProverEndpoints, OptimisticTierFee: common.Big256, SgxTierFee: common.Big256, - PseZkevmTierFee: common.Big256, - SgxAndPseZkevmTierFee: common.Big256, TierFeePriceBump: common.Big2, MaxTierFeePriceBumps: 3, ExtraData: "test", diff --git a/proposer/prover_selector/eth_fee_eoa_selector_test.go b/proposer/prover_selector/eth_fee_eoa_selector_test.go index 05f291aa6..cb7bbf62e 100644 --- a/proposer/prover_selector/eth_fee_eoa_selector_test.go +++ b/proposer/prover_selector/eth_fee_eoa_selector_test.go @@ -54,8 +54,6 @@ func (s *ProverSelectorTestSuite) TestProverAssignProver() { sig, _, fee, err := s.s.AssignProver(context.Background(), []encoding.TierFee{ {Tier: encoding.TierOptimisticID, Fee: common.Big256}, {Tier: encoding.TierSgxID, Fee: common.Big256}, - {Tier: encoding.TierPseZkevmID, Fee: common.Big256}, - {Tier: encoding.TierSgxAndPseZkevmID, Fee: common.Big256}, }, testutils.RandomHash()) s.NotEmpty(sig) s.True(fee.Cmp(common.Big0) > 0) diff --git a/prover/config.go b/prover/config.go index 54e7fdad1..5df5f63b1 100644 --- a/prover/config.go +++ b/prover/config.go @@ -27,8 +27,6 @@ type Config struct { TaikoTokenAddress common.Address AssignmentHookAddress common.Address L1ProverPrivKey *ecdsa.PrivateKey - ZKEvmRpcdEndpoint string - ZkEvmRpcdParamsPath string StartingBlockID *big.Int Dummy bool GuardianProverAddress common.Address @@ -49,8 +47,6 @@ type Config struct { Capacity uint64 MinOptimisticTierFee *big.Int MinSgxTierFee *big.Int - MinPseZkevmTierFee *big.Int - MinSgxAndPseZkevmTierFee *big.Int MaxExpiry time.Duration MaxProposedIn uint64 MaxBlockSlippage uint64 @@ -152,8 +148,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { TaikoTokenAddress: common.HexToAddress(c.String(flags.TaikoTokenAddress.Name)), AssignmentHookAddress: common.HexToAddress(c.String(flags.ProverAssignmentHookAddress.Name)), L1ProverPrivKey: l1ProverPrivKey, - ZKEvmRpcdEndpoint: c.String(flags.ZkEvmRpcdEndpoint.Name), - ZkEvmRpcdParamsPath: c.String(flags.ZkEvmRpcdParamsPath.Name), RaikoHostEndpoint: c.String(flags.RaikoHostEndpoint.Name), StartingBlockID: startingBlockID, Dummy: c.Bool(flags.Dummy.Name), @@ -176,8 +170,6 @@ func NewConfigFromCliContext(c *cli.Context) (*Config, error) { HTTPServerPort: c.Uint64(flags.ProverHTTPServerPort.Name), MinOptimisticTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinOptimisticTierFee.Name)), MinSgxTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinSgxTierFee.Name)), - MinPseZkevmTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinPseZkevmTierFee.Name)), - MinSgxAndPseZkevmTierFee: new(big.Int).SetUint64(c.Uint64(flags.MinSgxAndPseZkevmTierFee.Name)), MaxExpiry: c.Duration(flags.MaxExpiry.Name), MaxBlockSlippage: c.Uint64(flags.MaxAcceptableBlockSlippage.Name), MaxProposedIn: c.Uint64(flags.MaxProposedIn.Name), diff --git a/prover/config_test.go b/prover/config_test.go index 7e6a792f4..3eae18380 100644 --- a/prover/config_test.go +++ b/prover/config_test.go @@ -51,7 +51,6 @@ func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() { s.Equal(uint64(8), c.Capacity) s.Equal(uint64(minTierFee), c.MinOptimisticTierFee.Uint64()) s.Equal(uint64(minTierFee), c.MinSgxTierFee.Uint64()) - s.Equal(uint64(minTierFee), c.MinPseZkevmTierFee.Uint64()) s.Equal(uint64(3), c.ProveBlockTxReplacementMultiplier) s.Equal(uint64(256), c.ProveBlockMaxTxGasTipCap.Uint64()) s.Equal(c.L1NodeVersion, l1NodeVersion) @@ -83,7 +82,6 @@ func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() { "--" + flags.Dummy.Name, "--" + flags.MinOptimisticTierFee.Name, fmt.Sprint(minTierFee), "--" + flags.MinSgxTierFee.Name, fmt.Sprint(minTierFee), - "--" + flags.MinPseZkevmTierFee.Name, fmt.Sprint(minTierFee), "--" + flags.ProverCapacity.Name, "8", "--" + flags.GuardianProver.Name, os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS"), "--" + flags.ProverAssignmentHookAddress.Name, os.Getenv("ASSIGNMENT_HOOK_ADDRESS"), @@ -131,7 +129,6 @@ func (s *ProverTestSuite) SetupApp() *cli.App { &cli.Uint64Flag{Name: flags.ProverCapacity.Name}, &cli.Uint64Flag{Name: flags.MinOptimisticTierFee.Name}, &cli.Uint64Flag{Name: flags.MinSgxTierFee.Name}, - &cli.Uint64Flag{Name: flags.MinPseZkevmTierFee.Name}, &cli.Uint64Flag{Name: flags.ProveBlockTxGasLimit.Name}, &cli.StringFlag{Name: flags.DatabasePath.Name}, &cli.Uint64Flag{Name: flags.DatabaseCacheSize.Name}, diff --git a/prover/proof_producer/dummy_producer.go b/prover/proof_producer/dummy_producer.go index faa19d912..1dff6348f 100644 --- a/prover/proof_producer/dummy_producer.go +++ b/prover/proof_producer/dummy_producer.go @@ -27,7 +27,6 @@ func (o *DummyProofProducer) RequestProof( Meta: meta, Header: header, Proof: bytes.Repeat([]byte{0xff}, 100), - Degree: CircuitsIdx, Opts: opts, Tier: tier, }, nil diff --git a/prover/proof_producer/guardian_producer.go b/prover/proof_producer/guardian_producer.go index 3beb87ec9..4851fe034 100644 --- a/prover/proof_producer/guardian_producer.go +++ b/prover/proof_producer/guardian_producer.go @@ -52,7 +52,6 @@ func (g *GuardianProofProducer) RequestProof( Meta: meta, Header: header, Proof: crypto.Keccak256([]byte("RETURN_LIVENESS_BOND")), - Degree: CircuitsIdx, Opts: opts, Tier: g.Tier(), }, nil diff --git a/prover/proof_producer/proof_producer.go b/prover/proof_producer/proof_producer.go index 960d48b99..391ae2316 100644 --- a/prover/proof_producer/proof_producer.go +++ b/prover/proof_producer/proof_producer.go @@ -2,7 +2,9 @@ package producer import ( "context" + "errors" "math/big" + "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" @@ -10,11 +12,12 @@ import ( "github.com/taikoxyz/taiko-client/bindings" ) -const ( - CircuitsIdx = 0 // Currently we only have one verification contract in protocol. +var ( + proofPollingInterval = 10 * time.Second + errProofGenerating = errors.New("proof is generating") ) -// ProofRequestOptions contains all options that need to be passed to zkEVM rpcd service. +// ProofRequestOptions contains all options that need to be passed to a backend proof producer service. type ProofRequestOptions struct { BlockID *big.Int ProverAddress common.Address @@ -35,7 +38,6 @@ type ProofWithHeader struct { Meta *bindings.TaikoDataBlockMetadata Header *types.Header Proof []byte - Degree uint64 Opts *ProofRequestOptions Tier uint16 } @@ -52,7 +54,3 @@ type ProofProducer interface { Cancel(ctx context.Context, blockID *big.Int) error Tier() uint16 } - -func DegreeToCircuitsIdx(degree uint64) (uint16, error) { - return CircuitsIdx, nil -} diff --git a/prover/proof_producer/sgx_and_zkevm_rpcd_producer.go b/prover/proof_producer/sgx_and_zkevm_rpcd_producer.go deleted file mode 100644 index 453c73fff..000000000 --- a/prover/proof_producer/sgx_and_zkevm_rpcd_producer.go +++ /dev/null @@ -1,80 +0,0 @@ -package producer - -import ( - "context" - "math/big" - - "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/log" - "golang.org/x/sync/errgroup" - - "github.com/taikoxyz/taiko-client/bindings" - "github.com/taikoxyz/taiko-client/bindings/encoding" -) - -// SGXAndZkevmRpcdProducer generates a SGX + PSE ZKEVM proof for the given block. -type SGXAndZkevmRpcdProducer struct { - *SGXProofProducer - *ZkevmRpcdProducer -} - -// RequestProof implements the ProofProducer interface. -func (o *SGXAndZkevmRpcdProducer) RequestProof( - ctx context.Context, - opts *ProofRequestOptions, - blockID *big.Int, - meta *bindings.TaikoDataBlockMetadata, - header *types.Header, -) (*ProofWithHeader, error) { - log.Info( - "Request SGX+PSE proof", - "blockID", blockID, - "coinbase", meta.Coinbase, - "height", header.Number, - "hash", header.Hash(), - ) - - proofs := make([][]byte, 2) - g, ctx := errgroup.WithContext(ctx) - g.Go(func() error { - res, err := o.SGXProofProducer.RequestProof(ctx, opts, blockID, meta, header) - if err == nil { - proofs[0] = res.Proof - } - return err - }) - g.Go(func() error { - res, err := o.ZkevmRpcdProducer.RequestProof(ctx, opts, blockID, meta, header) - if err == nil { - proofs[1] = res.Proof - } - return err - }) - if err := g.Wait(); err != nil { - return nil, err - } - - return &ProofWithHeader{ - BlockID: blockID, - Meta: meta, - Header: header, - Proof: append(proofs[0], proofs[1]...), - Opts: opts, - Tier: o.Tier(), - }, nil -} - -// Tier implements the ProofProducer interface. -func (o *SGXAndZkevmRpcdProducer) Tier() uint16 { - return encoding.TierSgxAndPseZkevmID -} - -// Cancellable implements the ProofProducer interface. -func (o *SGXAndZkevmRpcdProducer) Cancellable() bool { - return false -} - -// Cancel cancels an existing proof generation. -func (o *SGXAndZkevmRpcdProducer) Cancel(ctx context.Context, blockID *big.Int) error { - return nil -} diff --git a/prover/proof_producer/sgx_producer.go b/prover/proof_producer/sgx_producer.go index 511a33ab1..635ee3c0f 100644 --- a/prover/proof_producer/sgx_producer.go +++ b/prover/proof_producer/sgx_producer.go @@ -113,7 +113,6 @@ func (s *SGXProofProducer) RequestProof( Header: header, Meta: meta, Proof: proof, - Degree: 0, Opts: opts, Tier: s.Tier(), }, nil diff --git a/prover/proof_producer/zkevm_rpcd_producer.go b/prover/proof_producer/zkevm_rpcd_producer.go deleted file mode 100644 index cafa46638..000000000 --- a/prover/proof_producer/zkevm_rpcd_producer.go +++ /dev/null @@ -1,355 +0,0 @@ -package producer - -import ( - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "math/big" - "net/http" - "time" - - "github.com/cenkalti/backoff/v4" - "github.com/ethereum/go-ethereum/common" - "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" - anchorTxConstructor "github.com/taikoxyz/taiko-client/driver/anchor_tx_constructor" - "github.com/taikoxyz/taiko-client/internal/metrics" -) - -var ( - errProofGenerating = errors.New("proof is generating") - proofPollingInterval = 10 * time.Second -) - -// ZkevmRpcdProducer is responsible for requesting zk proofs from the given proverd endpoint. -type ZkevmRpcdProducer struct { - RpcdEndpoint string // a proverd RPC endpoint - Param string // parameter file to use - L1Endpoint string // a L1 node RPC endpoint - L2Endpoint string // a L2 execution engine's RPC endpoint - Retry bool // retry proof computation if error - ProofTimeTarget uint64 // used for calculating proof delay - ProtocolConfig *bindings.TaikoDataConfig // protocol configurations - CustomProofHook func() ([]byte, uint64, error) // only for testing purposes - *DummyProofProducer // only for testing purposes -} - -// RequestProofBody represents the JSON body for requesting the proof. -type RequestProofBody struct { - JsonRPC string `json:"jsonrpc"` //nolint:revive,stylecheck - ID *big.Int `json:"id"` - Method string `json:"method"` - Params []*RequestProofBodyParam `json:"params"` -} - -// RequestProofBodyParam represents the JSON body of RequestProofBody's `param` field. -type RequestProofBodyParam struct { - Circuit string `json:"circuit"` - Block *big.Int `json:"block"` - L2RPC string `json:"rpc"` - Retry bool `json:"retry"` - Param string `json:"param"` - VerifyProof bool `json:"verify_proof"` - Mock bool `json:"mock"` - MockFeedback bool `json:"mock_feedback"` - Aggregate bool `json:"aggregate"` - ProtocolInstance *ProtocolInstance `json:"protocol_instance"` -} - -type RequestMetaData struct { - L1Hash string `json:"l1_hash"` - Difficulty string `json:"difficulty"` - BlobHash string `json:"blob_hash"` - ExtraData string `json:"extra_data"` - DepositsHash string `json:"deposits_hash"` - Coinbase string `json:"coinbase"` - ID uint64 `json:"id"` - GasLimit uint32 `json:"gas_limit"` - Timestamp uint64 `json:"timestamp"` - L1Height uint64 `json:"l1_height"` - TxListByteOffset *big.Int `json:"tx_list_byte_offset"` - TxListByteSize *big.Int `json:"tx_list_byte_size"` - MinTier uint16 `json:"min_tier"` - BlobUsed bool `json:"blob_used"` - ParentMetaHash string `json:"parent_metahash"` -} - -// ProtocolInstance represents the JSON body of RequestProofBody.Param's `protocol_instance` field. -type ProtocolInstance struct { - TaikoL2 string `json:"l2_contract"` - MetaHash string `json:"meta_hash"` - BlockHash string `json:"block_hash"` - ParentHash string `json:"parent_hash"` - SignalRoot string `json:"signal_root"` - Graffiti string `json:"graffiti"` - Prover string `json:"prover"` - Treasury string `json:"treasury"` - GasUsed uint64 `json:"gas_used"` - ParentGasUsed uint64 `json:"parent_gas_used"` - BlockMaxGasLimit uint64 `json:"block_max_gas_limit"` - MaxTransactionsPerBlock uint64 `json:"max_transactions_per_block"` - MaxBytesPerTxList uint64 `json:"max_bytes_per_tx_list"` - AnchorGasLimit uint64 `json:"anchor_gas_limit"` - RequestMetaData *RequestMetaData `json:"request_meta_data"` -} - -// RequestProofBodyResponse represents the JSON body of the response of the proof requests. -type RequestProofBodyResponse struct { - JsonRPC string `json:"jsonrpc"` //nolint:revive,stylecheck - ID *big.Int `json:"id"` - Result *RpcdOutput `json:"result"` - Error *struct { - Code *big.Int `json:"code"` - Message string `json:"message"` - } `json:"error,omitempty"` -} - -// RpcdOutput represents the JSON body of RequestProofBodyResponse's `result` field. -type RpcdOutput struct { - Circuit struct { - Instances []string `json:"instance"` - Proof string `json:"proof"` - Degree uint64 `json:"k"` - } `json:"circuit"` - Aggregation struct { - Instances []string `json:"instance"` - Proof string `json:"proof"` - Degree uint64 `json:"k"` - } `json:"aggregation"` -} - -// NewZkevmRpcdProducer creates a new `ZkevmRpcdProducer` instance. -func NewZkevmRpcdProducer( - rpcdEndpoint string, - param string, - l1Endpoint string, - l2Endpoint string, - retry bool, - protocolConfig *bindings.TaikoDataConfig, -) (*ZkevmRpcdProducer, error) { - return &ZkevmRpcdProducer{ - RpcdEndpoint: rpcdEndpoint, - Param: param, - L1Endpoint: l1Endpoint, - L2Endpoint: l2Endpoint, - Retry: retry, - ProtocolConfig: protocolConfig, - }, nil -} - -// RequestProof implements the ProofProducer interface. -func (p *ZkevmRpcdProducer) RequestProof( - ctx context.Context, - opts *ProofRequestOptions, - blockID *big.Int, - meta *bindings.TaikoDataBlockMetadata, - header *types.Header, -) (*ProofWithHeader, error) { - log.Info( - "Request proof from zkevm-chain proverd service", - "blockID", blockID, - "coinbase", meta.Coinbase, - "height", header.Number, - "hash", header.Hash(), - ) - - if p.DummyProofProducer != nil { - return p.DummyProofProducer.RequestProof(ctx, opts, blockID, meta, header, p.Tier()) - } - - var ( - proof []byte - degree uint64 - err error - ) - if p.CustomProofHook != nil { - proof, degree, err = p.CustomProofHook() - } else { - proof, degree, err = p.callProverDaemon(ctx, opts, meta) - } - if err != nil { - return nil, err - } - - if proof, err = encoding.EncodeZKEvmProof(proof); err != nil { - return nil, err - } - - metrics.ProverPseProofGeneratedCounter.Inc(1) - - return &ProofWithHeader{ - BlockID: blockID, - Header: header, - Meta: meta, - Proof: proof, - Degree: degree, - Opts: opts, - Tier: p.Tier(), - }, nil -} - -// callProverDaemon keeps polling the proverd service to get the requested proof. -func (p *ZkevmRpcdProducer) callProverDaemon( - ctx context.Context, - opts *ProofRequestOptions, - meta *bindings.TaikoDataBlockMetadata, -) ([]byte, uint64, error) { - var ( - proof []byte - degree uint64 - start = time.Now() - ) - if err := backoff.Retry(func() error { - if ctx.Err() != nil { - return nil - } - output, err := p.requestProof(opts, meta) - if err != nil { - log.Error("Failed to request proof", "height", opts.BlockID, "err", err, "endpoint", p.RpcdEndpoint) - return err - } - - if output == nil { - log.Info( - "Proof generating", - "height", opts.BlockID, - "time", time.Since(start), - "producer", "ZkevmRpcdProducer", - ) - return errProofGenerating - } - - log.Debug("Proof generation output", "output", output) - - var proofOutput string - for _, instance := range output.Aggregation.Instances { - proofOutput += instance[2:] - } - proofOutput += output.Aggregation.Proof[2:] - - proof = common.Hex2Bytes(proofOutput) - degree = output.Aggregation.Degree - log.Info( - "Proof generated", - "height", opts.BlockID, - "degree", degree, - "time", time.Since(start), - "producer", "ZkevmRpcdProducer", - ) - return nil - }, backoff.NewConstantBackOff(proofPollingInterval)); err != nil { - return nil, 0, err - } - - return proof, degree, nil -} - -// requestProof sends a RPC request to proverd to try to get the requested proof. -func (p *ZkevmRpcdProducer) requestProof( - opts *ProofRequestOptions, - meta *bindings.TaikoDataBlockMetadata, -) (*RpcdOutput, error) { - reqBody := RequestProofBody{ - JsonRPC: "2.0", - ID: common.Big1, - Method: "proof", - Params: []*RequestProofBodyParam{{ - Circuit: "super", - Block: opts.BlockID, - L2RPC: p.L2Endpoint, - Retry: true, - Param: p.Param, - VerifyProof: true, - Mock: false, - MockFeedback: false, - Aggregate: true, - ProtocolInstance: &ProtocolInstance{ - Prover: opts.ProverAddress.Hex()[2:], - Treasury: opts.TaikoL2.Hex()[2:], - TaikoL2: opts.TaikoL2.Hex()[2:], - MetaHash: opts.MetaHash.Hex()[2:], - BlockHash: opts.BlockHash.Hex()[2:], - ParentHash: opts.ParentHash.Hex()[2:], - SignalRoot: opts.StateRoot.Hex()[2:], - Graffiti: opts.Graffiti, - GasUsed: opts.GasUsed, - ParentGasUsed: opts.ParentGasUsed, - BlockMaxGasLimit: uint64(p.ProtocolConfig.BlockMaxGasLimit), - MaxBytesPerTxList: p.ProtocolConfig.BlockMaxTxListBytes.Uint64(), - AnchorGasLimit: anchorTxConstructor.AnchorGasLimit, - RequestMetaData: &RequestMetaData{ - L1Hash: common.BytesToHash(meta.L1Hash[:]).Hex()[2:], - Difficulty: common.BytesToHash(meta.Difficulty[:]).Hex()[2:], - BlobHash: common.BytesToHash(meta.BlobHash[:]).Hex()[2:], - ExtraData: common.BytesToHash(meta.ExtraData[:]).Hex()[2:], - DepositsHash: common.BytesToHash(meta.DepositsHash[:]).Hex()[2:], - Coinbase: meta.Coinbase.Hex()[2:], - ID: meta.Id, - GasLimit: meta.GasLimit, - Timestamp: meta.Timestamp, - L1Height: meta.L1Height, - TxListByteOffset: meta.TxListByteOffset, - TxListByteSize: meta.TxListByteSize, - MinTier: meta.MinTier, - BlobUsed: meta.BlobUsed, - ParentMetaHash: common.BytesToHash(meta.ParentMetaHash[:]).Hex()[2:], - }, - }, - }}, - } - - jsonValue, err := json.Marshal(reqBody) - if err != nil { - return nil, err - } - - res, err := http.Post(p.RpcdEndpoint, "application/json", bytes.NewBuffer(jsonValue)) - if err != nil { - return nil, err - } - - defer res.Body.Close() - if res.StatusCode != http.StatusOK { - return nil, fmt.Errorf("failed to request proof, id: %d, statusCode: %d", opts.BlockID, res.StatusCode) - } - - resBytes, err := io.ReadAll(res.Body) - if err != nil { - return nil, err - } - - var output RequestProofBodyResponse - if err := json.Unmarshal(resBytes, &output); err != nil { - return nil, err - } - - if output.Error != nil { - return nil, errors.New(output.Error.Message) - } - - return output.Result, nil -} - -// Tier implements the ProofProducer interface. -func (p *ZkevmRpcdProducer) Tier() uint16 { - return encoding.TierSgxAndPseZkevmID -} - -// Cancellable implements the ProofProducer interface. -func (p *ZkevmRpcdProducer) Cancellable() bool { - return false -} - -// Cancel cancels an existing proof generation. -// Right now, it is just a stub that does nothing, because it is not possible to cancel the proof -// with the current zkevm software. -func (p *ZkevmRpcdProducer) Cancel(ctx context.Context, blockID *big.Int) error { - log.Info("Cancel proof generation for block", "blockId", blockID) - return nil -} diff --git a/prover/proof_producer/zkevm_rpcd_producer_test.go b/prover/proof_producer/zkevm_rpcd_producer_test.go deleted file mode 100644 index d3c63ce12..000000000 --- a/prover/proof_producer/zkevm_rpcd_producer_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package producer - -import ( - "context" - "testing" - "time" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/types" - "github.com/stretchr/testify/require" - - "github.com/taikoxyz/taiko-client/bindings" -) - -func TestNewZkevmRpcdProducer(t *testing.T) { - dummyZkevmRpcdProducer, err := NewZkevmRpcdProducer( - "http://localhost:18545", - "", - "", - "", - false, - &bindings.TaikoDataConfig{}, - ) - require.Nil(t, err) - require.False(t, dummyZkevmRpcdProducer.Cancellable()) - - dummyZkevmRpcdProducer.CustomProofHook = func() ([]byte, uint64, error) { - return []byte{0}, CircuitsIdx, nil - } - - blockID := common.Big32 - header := &types.Header{ - ParentHash: randHash(), - UncleHash: randHash(), - Coinbase: common.HexToAddress("0x0000777735367b36bC9B61C50022d9D0700dB4Ec"), - Root: randHash(), - TxHash: randHash(), - ReceiptHash: randHash(), - Difficulty: common.Big0, - Number: common.Big256, - GasLimit: 1024, - GasUsed: 1024, - Time: uint64(time.Now().Unix()), - Extra: randHash().Bytes(), - MixDigest: randHash(), - Nonce: types.BlockNonce{}, - } - - res, err := dummyZkevmRpcdProducer.RequestProof( - context.Background(), - &ProofRequestOptions{}, - blockID, - &bindings.TaikoDataBlockMetadata{}, - header, - ) - require.Nil(t, err) - - require.Equal(t, res.BlockID, blockID) - require.Equal(t, res.Header, header) - require.NotEmpty(t, res.Proof) - - require.Nil(t, dummyZkevmRpcdProducer.Cancel(context.Background(), common.Big1)) -} - -func TestZkevmRpcdProducerCalls(t *testing.T) { - dummyZkevmRpcdProducer, err := NewZkevmRpcdProducer( - "", - "", - "", - "", - false, - &bindings.TaikoDataConfig{ - BlockMaxGasLimit: uint32(randHash().Big().Uint64()), - BlockMaxTxListBytes: randHash().Big(), - }, - ) - require.Nil(t, err) - require.False(t, dummyZkevmRpcdProducer.Cancellable()) - - dummyZkevmRpcdProducer.CustomProofHook = func() ([]byte, uint64, error) { - return []byte{0}, CircuitsIdx, nil - } - - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - _, _, err = dummyZkevmRpcdProducer.callProverDaemon( - ctx, - &ProofRequestOptions{BlockID: common.Big32}, - &bindings.TaikoDataBlockMetadata{}, - ) - - require.Nil(t, err) -} diff --git a/prover/proof_submitter/proof_submitter_test.go b/prover/proof_submitter/proof_submitter_test.go index db0053601..9d5307f50 100644 --- a/prover/proof_submitter/proof_submitter_test.go +++ b/prover/proof_submitter/proof_submitter_test.go @@ -106,8 +106,6 @@ func (s *ProofSubmitterTestSuite) SetupTest() { ProverEndpoints: s.ProverEndpoints, OptimisticTierFee: common.Big256, SgxTierFee: common.Big256, - PseZkevmTierFee: common.Big256, - SgxAndPseZkevmTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, L1BlockBuilderTip: common.Big0, diff --git a/prover/prover.go b/prover/prover.go index 6e2a3b9f7..c31c8db9b 100644 --- a/prover/prover.go +++ b/prover/prover.go @@ -163,54 +163,6 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) { sgxProducer.DummyProofProducer = new(proofProducer.DummyProofProducer) } producer = sgxProducer - case encoding.TierSgxAndPseZkevmID: - zkEvmRpcdProducer, err := proofProducer.NewZkevmRpcdProducer( - cfg.ZKEvmRpcdEndpoint, - cfg.ZkEvmRpcdParamsPath, - cfg.L1HttpEndpoint, - cfg.L2HttpEndpoint, - true, - p.protocolConfigs, - ) - if err != nil { - return err - } - - sgxProducer, err := proofProducer.NewSGXProducer( - cfg.RaikoHostEndpoint, - cfg.L1HttpEndpoint, - cfg.L1BeaconEndpoint, - cfg.L2HttpEndpoint, - ) - if err != nil { - return err - } - - if p.cfg.Dummy { - zkEvmRpcdProducer.DummyProofProducer = new(proofProducer.DummyProofProducer) - sgxProducer.DummyProofProducer = new(proofProducer.DummyProofProducer) - } - - producer = &proofProducer.SGXAndZkevmRpcdProducer{ - SGXProofProducer: sgxProducer, - ZkevmRpcdProducer: zkEvmRpcdProducer, - } - case encoding.TierPseZkevmID: - zkEvmRpcdProducer, err := proofProducer.NewZkevmRpcdProducer( - cfg.ZKEvmRpcdEndpoint, - cfg.ZkEvmRpcdParamsPath, - cfg.L1HttpEndpoint, - cfg.L2HttpEndpoint, - true, - p.protocolConfigs, - ) - if err != nil { - return err - } - if p.cfg.Dummy { - zkEvmRpcdProducer.DummyProofProducer = new(proofProducer.DummyProofProducer) - } - producer = zkEvmRpcdProducer case encoding.TierGuardianID: producer = proofProducer.NewGuardianProofProducer(p.cfg.EnableLivenessBondProof) } @@ -267,21 +219,19 @@ func InitFromConfig(ctx context.Context, p *Prover, cfg *Config) (err error) { // Prover server proverServerOpts := &server.NewProverServerOpts{ - ProverPrivateKey: p.cfg.L1ProverPrivKey, - MinOptimisticTierFee: p.cfg.MinOptimisticTierFee, - MinSgxTierFee: p.cfg.MinSgxTierFee, - MinPseZkevmTierFee: p.cfg.MinPseZkevmTierFee, - MinSgxAndPseZkevmTierFee: p.cfg.MinSgxAndPseZkevmTierFee, - MaxExpiry: p.cfg.MaxExpiry, - MaxBlockSlippage: p.cfg.MaxBlockSlippage, - TaikoL1Address: p.cfg.TaikoL1Address, - AssignmentHookAddress: p.cfg.AssignmentHookAddress, - ProposeConcurrencyGuard: p.proposeConcurrencyGuard, - RPC: p.rpc, - ProtocolConfigs: &protocolConfigs, - LivenessBond: protocolConfigs.LivenessBond, - IsGuardian: p.IsGuardianProver(), - DB: db, + ProverPrivateKey: p.cfg.L1ProverPrivKey, + MinOptimisticTierFee: p.cfg.MinOptimisticTierFee, + MinSgxTierFee: p.cfg.MinSgxTierFee, + MaxExpiry: p.cfg.MaxExpiry, + MaxBlockSlippage: p.cfg.MaxBlockSlippage, + TaikoL1Address: p.cfg.TaikoL1Address, + AssignmentHookAddress: p.cfg.AssignmentHookAddress, + ProposeConcurrencyGuard: p.proposeConcurrencyGuard, + RPC: p.rpc, + ProtocolConfigs: &protocolConfigs, + LivenessBond: protocolConfigs.LivenessBond, + IsGuardian: p.IsGuardianProver(), + DB: db, } if p.srv, err = server.New(proverServerOpts); err != nil { return err diff --git a/prover/prover_test.go b/prover/prover_test.go index 3b5d84aaa..04a0b0a64 100644 --- a/prover/prover_test.go +++ b/prover/prover_test.go @@ -89,8 +89,6 @@ func (s *ProverTestSuite) SetupTest() { ProverEndpoints: []*url.URL{proverServerURL}, OptimisticTierFee: common.Big256, SgxTierFee: common.Big256, - PseZkevmTierFee: common.Big256, - SgxAndPseZkevmTierFee: common.Big256, MaxTierFeePriceBumps: 3, TierFeePriceBump: common.Big2, L1BlockBuilderTip: common.Big0, @@ -478,30 +476,28 @@ func (s *ProverTestSuite) initProver( p := new(Prover) s.Nil(InitFromConfig(ctx, p, &Config{ - L1WsEndpoint: os.Getenv("L1_NODE_WS_ENDPOINT"), - L1HttpEndpoint: os.Getenv("L1_NODE_HTTP_ENDPOINT"), - L2WsEndpoint: os.Getenv("L2_EXECUTION_ENGINE_WS_ENDPOINT"), - L2HttpEndpoint: os.Getenv("L2_EXECUTION_ENGINE_HTTP_ENDPOINT"), - TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), - TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), - TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), - AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), - L1ProverPrivKey: key, - Dummy: true, - ProveUnassignedBlocks: true, - Capacity: 1024, - MinOptimisticTierFee: common.Big1, - MinSgxTierFee: common.Big1, - MinPseZkevmTierFee: common.Big1, - MinSgxAndPseZkevmTierFee: common.Big1, - HTTPServerPort: uint64(port), - WaitReceiptTimeout: 12 * time.Second, - DatabasePath: "", - Allowance: allowance, - RPCTimeout: 3 * time.Second, - BackOffMaxRetrys: 3, - L1NodeVersion: "1.0.0", - L2NodeVersion: "0.1.0", + L1WsEndpoint: os.Getenv("L1_NODE_WS_ENDPOINT"), + L1HttpEndpoint: os.Getenv("L1_NODE_HTTP_ENDPOINT"), + L2WsEndpoint: os.Getenv("L2_EXECUTION_ENGINE_WS_ENDPOINT"), + L2HttpEndpoint: os.Getenv("L2_EXECUTION_ENGINE_HTTP_ENDPOINT"), + TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), + TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")), + TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")), + AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), + L1ProverPrivKey: key, + Dummy: true, + ProveUnassignedBlocks: true, + Capacity: 1024, + MinOptimisticTierFee: common.Big1, + MinSgxTierFee: common.Big1, + HTTPServerPort: uint64(port), + WaitReceiptTimeout: 12 * time.Second, + DatabasePath: "", + Allowance: allowance, + RPCTimeout: 3 * time.Second, + BackOffMaxRetrys: 3, + L1NodeVersion: "1.0.0", + L2NodeVersion: "0.1.0", })) p.srv = s.NewTestProverServer( key, diff --git a/prover/server/api.go b/prover/server/api.go index 9cc4968ee..2ea1c7f06 100644 --- a/prover/server/api.go +++ b/prover/server/api.go @@ -37,7 +37,6 @@ type CreateAssignmentRequestBody struct { type Status struct { MinOptimisticTierFee uint64 `json:"minOptimisticTierFee"` MinSgxTierFee uint64 `json:"minSgxTierFee"` - MinPseZkevmTierFee uint64 `json:"minPseZkevmTierFee"` MaxExpiry uint64 `json:"maxExpiry"` Prover string `json:"prover"` } @@ -54,7 +53,6 @@ func (srv *ProverServer) GetStatus(c echo.Context) error { return c.JSON(http.StatusOK, &Status{ MinOptimisticTierFee: srv.minOptimisticTierFee.Uint64(), MinSgxTierFee: srv.minSgxTierFee.Uint64(), - MinPseZkevmTierFee: srv.minPseZkevmTierFee.Uint64(), MaxExpiry: uint64(srv.maxExpiry.Seconds()), Prover: srv.proverAddress.Hex(), }) @@ -139,10 +137,6 @@ func (srv *ProverServer) CreateAssignment(c echo.Context) error { minTierFee = srv.minOptimisticTierFee case encoding.TierSgxID: minTierFee = srv.minSgxTierFee - case encoding.TierPseZkevmID: - minTierFee = srv.minPseZkevmTierFee - case encoding.TierSgxAndPseZkevmID: - minTierFee = srv.minSgxAndPseZkevmTierFee default: log.Warn("Unknown tier", "tier", tier.Tier, "fee", tier.Fee, "proposerIP", c.RealIP()) } diff --git a/prover/server/api_test.go b/prover/server/api_test.go index 1d0b6b245..ada4de0fe 100644 --- a/prover/server/api_test.go +++ b/prover/server/api_test.go @@ -25,7 +25,6 @@ func (s *ProverServerTestSuite) TestGetStatusSuccess() { s.Equal(s.s.minOptimisticTierFee.Uint64(), status.MinOptimisticTierFee) s.Equal(s.s.minSgxTierFee.Uint64(), status.MinSgxTierFee) - s.Equal(s.s.minSgxAndPseZkevmTierFee.Uint64(), status.MinSgxTierFee) s.Equal(uint64(s.s.maxExpiry.Seconds()), status.MaxExpiry) s.NotEmpty(status.Prover) } @@ -36,7 +35,6 @@ func (s *ProverServerTestSuite) TestProposeBlockSuccess() { TierFees: []encoding.TierFee{ {Tier: encoding.TierOptimisticID, Fee: common.Big256}, {Tier: encoding.TierSgxID, Fee: common.Big256}, - {Tier: encoding.TierSgxAndPseZkevmID, Fee: common.Big256}, }, Expiry: uint64(time.Now().Add(time.Minute).Unix()), TxListHash: common.BigToHash(common.Big1), diff --git a/prover/server/server.go b/prover/server/server.go index 6bf3a30e4..a2584d0da 100644 --- a/prover/server/server.go +++ b/prover/server/server.go @@ -31,67 +31,61 @@ import ( // ProverServer represents a prover server instance. type ProverServer struct { - echo *echo.Echo - proverPrivateKey *ecdsa.PrivateKey - proverAddress common.Address - minOptimisticTierFee *big.Int - minSgxTierFee *big.Int - minPseZkevmTierFee *big.Int - minSgxAndPseZkevmTierFee *big.Int - maxExpiry time.Duration - maxSlippage uint64 - maxProposedIn uint64 - proposeConcurrencyGuard chan struct{} - taikoL1Address common.Address - assignmentHookAddress common.Address - rpc *rpc.Client - protocolConfigs *bindings.TaikoDataConfig - livenessBond *big.Int - isGuardian bool - db ethdb.KeyValueStore + echo *echo.Echo + proverPrivateKey *ecdsa.PrivateKey + proverAddress common.Address + minOptimisticTierFee *big.Int + minSgxTierFee *big.Int + maxExpiry time.Duration + maxSlippage uint64 + maxProposedIn uint64 + proposeConcurrencyGuard chan struct{} + taikoL1Address common.Address + assignmentHookAddress common.Address + rpc *rpc.Client + protocolConfigs *bindings.TaikoDataConfig + livenessBond *big.Int + isGuardian bool + db ethdb.KeyValueStore } // NewProverServerOpts contains all configurations for creating a prover server instance. type NewProverServerOpts struct { - ProverPrivateKey *ecdsa.PrivateKey - MinOptimisticTierFee *big.Int - MinSgxTierFee *big.Int - MinPseZkevmTierFee *big.Int - MinSgxAndPseZkevmTierFee *big.Int - MaxExpiry time.Duration - MaxBlockSlippage uint64 - MaxProposedIn uint64 - ProposeConcurrencyGuard chan struct{} - TaikoL1Address common.Address - AssignmentHookAddress common.Address - RPC *rpc.Client - ProtocolConfigs *bindings.TaikoDataConfig - LivenessBond *big.Int - IsGuardian bool - DB ethdb.KeyValueStore + ProverPrivateKey *ecdsa.PrivateKey + MinOptimisticTierFee *big.Int + MinSgxTierFee *big.Int + MaxExpiry time.Duration + MaxBlockSlippage uint64 + MaxProposedIn uint64 + ProposeConcurrencyGuard chan struct{} + TaikoL1Address common.Address + AssignmentHookAddress common.Address + RPC *rpc.Client + ProtocolConfigs *bindings.TaikoDataConfig + LivenessBond *big.Int + IsGuardian bool + DB ethdb.KeyValueStore } // New creates a new prover server instance. func New(opts *NewProverServerOpts) (*ProverServer, error) { srv := &ProverServer{ - proverPrivateKey: opts.ProverPrivateKey, - proverAddress: crypto.PubkeyToAddress(opts.ProverPrivateKey.PublicKey), - echo: echo.New(), - minOptimisticTierFee: opts.MinOptimisticTierFee, - minSgxTierFee: opts.MinSgxTierFee, - minPseZkevmTierFee: opts.MinPseZkevmTierFee, - minSgxAndPseZkevmTierFee: opts.MinSgxAndPseZkevmTierFee, - maxExpiry: opts.MaxExpiry, - maxProposedIn: opts.MaxProposedIn, - maxSlippage: opts.MaxBlockSlippage, - proposeConcurrencyGuard: opts.ProposeConcurrencyGuard, - taikoL1Address: opts.TaikoL1Address, - assignmentHookAddress: opts.AssignmentHookAddress, - rpc: opts.RPC, - protocolConfigs: opts.ProtocolConfigs, - livenessBond: opts.LivenessBond, - isGuardian: opts.IsGuardian, - db: opts.DB, + proverPrivateKey: opts.ProverPrivateKey, + proverAddress: crypto.PubkeyToAddress(opts.ProverPrivateKey.PublicKey), + echo: echo.New(), + minOptimisticTierFee: opts.MinOptimisticTierFee, + minSgxTierFee: opts.MinSgxTierFee, + maxExpiry: opts.MaxExpiry, + maxProposedIn: opts.MaxProposedIn, + maxSlippage: opts.MaxBlockSlippage, + proposeConcurrencyGuard: opts.ProposeConcurrencyGuard, + taikoL1Address: opts.TaikoL1Address, + assignmentHookAddress: opts.AssignmentHookAddress, + rpc: opts.RPC, + protocolConfigs: opts.ProtocolConfigs, + livenessBond: opts.LivenessBond, + isGuardian: opts.IsGuardian, + db: opts.DB, } srv.echo.HideBanner = true diff --git a/prover/server/server_test.go b/prover/server/server_test.go index c36946dcc..13889a331 100644 --- a/prover/server/server_test.go +++ b/prover/server/server_test.go @@ -48,20 +48,18 @@ func (s *ProverServerTestSuite) SetupTest() { s.Nil(err) p, err := New(&NewProverServerOpts{ - ProverPrivateKey: l1ProverPrivKey, - MinOptimisticTierFee: common.Big1, - MinSgxTierFee: common.Big1, - MinPseZkevmTierFee: common.Big1, - MinSgxAndPseZkevmTierFee: common.Big1, - MaxExpiry: time.Hour, - ProposeConcurrencyGuard: make(chan struct{}, 1024), - TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), - AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), - RPC: rpcClient, - ProtocolConfigs: &configs, - LivenessBond: common.Big0, - IsGuardian: false, - DB: memorydb.New(), + ProverPrivateKey: l1ProverPrivKey, + MinOptimisticTierFee: common.Big1, + MinSgxTierFee: common.Big1, + MaxExpiry: time.Hour, + ProposeConcurrencyGuard: make(chan struct{}, 1024), + TaikoL1Address: common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")), + AssignmentHookAddress: common.HexToAddress(os.Getenv("ASSIGNMENT_HOOK_ADDRESS")), + RPC: rpcClient, + ProtocolConfigs: &configs, + LivenessBond: common.Big0, + IsGuardian: false, + DB: memorydb.New(), }) s.Nil(err)