Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
fix following comments
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 committed May 6, 2024
1 parent 0962c82 commit 1d8fe98
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 63 deletions.
1 change: 1 addition & 0 deletions integration_test/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ check_env "ASSIGNMENT_HOOK_ADDRESS"
check_env "TIMELOCK_CONTROLLER"
check_env "ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS"
check_env "GUARDIAN_PROVER_CONTRACT_ADDRESS"
check_env "GUARDIAN_PROVER_MINORITY_ADDRESS"
check_env "L1_CONTRACT_OWNER_PRIVATE_KEY"
check_env "L1_SECURITY_COUNCIL_PRIVATE_KEY"
check_env "L1_PROPOSER_PRIVATE_KEY"
Expand Down
2 changes: 2 additions & 0 deletions integration_test/test_env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export ASSIGNMENT_HOOK_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.assignment_hook'
export TIMELOCK_CONTROLLER=$(echo "$DEPLOYMENT_JSON" | jq '.timelock_controller' | sed 's/\"//g')
export ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.rollup_address_manager' | sed 's/\"//g')
export GUARDIAN_PROVER_CONTRACT_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.guardian_prover' | sed 's/\"//g')
export GUARDIAN_PROVER_MINORITY_ADDRESS=$(echo "$DEPLOYMENT_JSON" | jq '.guardian_prover_minority' | sed 's/\"//g')
export L1_CONTRACT_OWNER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
export L1_SECURITY_COUNCIL_PRIVATE_KEY=0xdbda1821b80551c9d65939329250298aa3472ba22feea921c0cf5d620ea67b97
export L1_PROPOSER_PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Expand All @@ -40,6 +41,7 @@ ASSIGNMENT_HOOK_ADDRESS=$ASSIGNMENT_HOOK_ADDRESS
TIMELOCK_CONTROLLER=$TIMELOCK_CONTROLLER
ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS=$ROLLUP_ADDRESS_MANAGER_CONTRACT_ADDRESS
GUARDIAN_PROVER_CONTRACT_ADDRESS=$GUARDIAN_PROVER_CONTRACT_ADDRESS
GUARDIAN_PROVER_MINORITY_ADDRESS=$GUARDIAN_PROVER_MINORITY_ADDRESS
L1_CONTRACT_OWNER_PRIVATE_KEY=$L1_CONTRACT_OWNER_PRIVATE_KEY
L1_SECURITY_COUNCIL_PRIVATE_KEY=$L1_SECURITY_COUNCIL_PRIVATE_KEY
L1_PROPOSER_PRIVATE_KEY=$L1_PROPOSER_PRIVATE_KEY
Expand Down
2 changes: 1 addition & 1 deletion internal/testutils/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *ClientTestSuite) SetupTest() {
TaikoL2Address: common.HexToAddress(os.Getenv("TAIKO_L2_ADDRESS")),
TaikoTokenAddress: common.HexToAddress(os.Getenv("TAIKO_TOKEN_ADDRESS")),
GuardianProverMajorityAddress: common.HexToAddress(os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS")),
GuardianProverMinorityAddress: common.HexToAddress(os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS")),
GuardianProverMinorityAddress: common.HexToAddress(os.Getenv("GUARDIAN_PROVER_MINORITY_ADDRESS")),
L2EngineEndpoint: os.Getenv("L2_EXECUTION_ENGINE_AUTH_ENDPOINT"),
JwtSecret: string(jwtSecret),
})
Expand Down
2 changes: 1 addition & 1 deletion prover/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (s *ProverTestSuite) TestNewConfigFromCliContextGuardianProver() {
"--" + flags.MinSgxTierFee.Name, fmt.Sprint(minTierFee),
"--" + flags.ProverCapacity.Name, "8",
"--" + flags.GuardianProverMajority.Name, os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS"),
"--" + flags.GuardianProverMinority.Name, os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS"),
"--" + flags.GuardianProverMinority.Name, os.Getenv("GUARDIAN_PROVER_MINORITY_ADDRESS"),
"--" + flags.AssignmentHookAddress.Name, os.Getenv("ASSIGNMENT_HOOK_ADDRESS"),
"--" + flags.Graffiti.Name, "",
"--" + flags.ProveUnassignedBlocks.Name,
Expand Down
46 changes: 46 additions & 0 deletions prover/proof_producer/guardian_producer.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,24 @@ type GuardianProofProducer struct {
DummyProofProducer
}

// MinorityGuardianProofProducer always returns an optimistic (dummy) proof.
type MinorityGuardianProofProducer struct {
returnLivenessBond bool
DummyProofProducer
}

func NewGuardianProofProducer(returnLivenessBond bool) *GuardianProofProducer {
return &GuardianProofProducer{
returnLivenessBond: returnLivenessBond,
}
}

func NewMinorityGuardianProofProducer(returnLivenessBond bool) *MinorityGuardianProofProducer {
return &MinorityGuardianProofProducer{
returnLivenessBond: returnLivenessBond,
}
}

// RequestProof implements the ProofProducer interface.
func (g *GuardianProofProducer) RequestProof(
_ context.Context,
Expand Down Expand Up @@ -54,7 +66,41 @@ func (g *GuardianProofProducer) RequestProof(
return g.DummyProofProducer.RequestProof(opts, blockID, meta, header, g.Tier())
}

func (m *MinorityGuardianProofProducer) RequestProof(
_ context.Context,
opts *ProofRequestOptions,
blockID *big.Int,
meta *bindings.TaikoDataBlockMetadata,
header *types.Header,
) (*ProofWithHeader, error) {
log.Info(
"Request guardian proof",
"blockID", blockID,
"coinbase", meta.Coinbase,
"height", header.Number,
"hash", header.Hash(),
)

if m.returnLivenessBond {
return &ProofWithHeader{
BlockID: blockID,
Meta: meta,
Header: header,
Proof: crypto.Keccak256([]byte("RETURN_LIVENESS_BOND")),
Opts: opts,
Tier: m.Tier(),
}, nil
}

return m.DummyProofProducer.RequestProof(opts, blockID, meta, header, m.Tier())
}

// Tier implements the ProofProducer interface.
func (g *GuardianProofProducer) Tier() uint16 {
return encoding.TierGuardianMajorityID
}

// Tier returns TierGuardianMinorityID
func (m *MinorityGuardianProofProducer) Tier() uint16 {
return encoding.TierGuardianMinorityID
}
59 changes: 0 additions & 59 deletions prover/proof_producer/minority_guardian_producer.go

This file was deleted.

2 changes: 1 addition & 1 deletion prover/proof_submitter/proof_submitter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func (s *ProofSubmitterTestSuite) SetupTest() {
s.RPCClient,
common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")),
common.HexToAddress(os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS")),
common.HexToAddress(os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS")),
common.HexToAddress(os.Getenv("GUARDIAN_PROVER_MINORITY_ADDRESS")),
)

l1ProverPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROVER_PRIVATE_KEY")))
Expand Down
2 changes: 1 addition & 1 deletion prover/proof_submitter/transaction/sender_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (s *TransactionTestSuite) SetupTest() {
s.RPCClient,
common.HexToAddress(os.Getenv("TAIKO_L1_ADDRESS")),
common.HexToAddress(os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS")),
common.HexToAddress(os.Getenv("GUARDIAN_PROVER_CONTRACT_ADDRESS")),
common.HexToAddress(os.Getenv("GUARDIAN_PROVER_MINORITY_ADDRESS")),
)

l1ProverPrivKey, err := crypto.ToECDSA(common.FromHex(os.Getenv("L1_PROVER_PRIVATE_KEY")))
Expand Down

0 comments on commit 1d8fe98

Please sign in to comment.