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

Commit 3fb66e4

Browse files
committed
add test
1 parent 4832cb4 commit 3fb66e4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

prover/proof_producer/guardian_producer_test.go

+39
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77

88
"github.com/ethereum/go-ethereum/common"
99
"github.com/ethereum/go-ethereum/core/types"
10+
"github.com/ethereum/go-ethereum/crypto"
1011
"github.com/stretchr/testify/require"
1112

1213
"github.com/taikoxyz/taiko-client/bindings"
@@ -49,3 +50,41 @@ func TestGuardianProducerRequestProof(t *testing.T) {
4950
require.Equal(t, res.Tier, encoding.TierGuardianID)
5051
require.NotEmpty(t, res.Proof)
5152
}
53+
54+
func TestGuardianProducerRequestProofReturnLivenessBond(t *testing.T) {
55+
header := &types.Header{
56+
ParentHash: randHash(),
57+
UncleHash: randHash(),
58+
Coinbase: common.BytesToAddress(randHash().Bytes()),
59+
Root: randHash(),
60+
TxHash: randHash(),
61+
ReceiptHash: randHash(),
62+
Difficulty: common.Big0,
63+
Number: common.Big256,
64+
GasLimit: 1024,
65+
GasUsed: 1024,
66+
Time: uint64(time.Now().Unix()),
67+
Extra: randHash().Bytes(),
68+
MixDigest: randHash(),
69+
Nonce: types.BlockNonce{},
70+
}
71+
72+
var (
73+
producer = &GuardianProofProducer{LivenessBond: true}
74+
blockID = common.Big32
75+
)
76+
res, err := producer.RequestProof(
77+
context.Background(),
78+
&ProofRequestOptions{},
79+
blockID,
80+
&bindings.TaikoDataBlockMetadata{},
81+
header,
82+
)
83+
require.Nil(t, err)
84+
85+
require.Equal(t, res.BlockID, blockID)
86+
require.Equal(t, res.Header, header)
87+
require.Equal(t, res.Tier, encoding.TierGuardianID)
88+
require.NotEmpty(t, res.Proof)
89+
require.Equal(t, res.Proof, crypto.Keccak256([]byte("RETURN_LIVENESS_BOND")))
90+
}

0 commit comments

Comments
 (0)