|
7 | 7 |
|
8 | 8 | "github.com/ethereum/go-ethereum/common"
|
9 | 9 | "github.com/ethereum/go-ethereum/core/types"
|
| 10 | + "github.com/ethereum/go-ethereum/crypto" |
10 | 11 | "github.com/stretchr/testify/require"
|
11 | 12 |
|
12 | 13 | "github.com/taikoxyz/taiko-client/bindings"
|
@@ -49,3 +50,41 @@ func TestGuardianProducerRequestProof(t *testing.T) {
|
49 | 50 | require.Equal(t, res.Tier, encoding.TierGuardianID)
|
50 | 51 | require.NotEmpty(t, res.Proof)
|
51 | 52 | }
|
| 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