| 72 | } |
| 73 | |
| 74 | func (q *RandaoBlockQuerier) getLatestNumber(ctx context.Context) (*big.Int, error) { |
| 75 | h := crypto.Keccak256Hash([]byte("number()")) |
| 76 | ret, err := q.cc.CallContract(ctx, ethereum.CallMsg{ |
| 77 | To: &l1BlockContract, |
| 78 | Data: h[0:4], |
| 79 | }, nil) |
| 80 | if err != nil { |
| 81 | return nil, fmt.Errorf("failed to call number() %v", err) |
| 82 | } |
| 83 | curBlock := new(big.Int).SetBytes(ret) |
| 84 | q.lg.Debug("Got latest block number by Randao querier", "number", curBlock) |
| 85 | return curBlock, nil |
| 86 | } |
| 87 | |
| 88 | func (q *RandaoBlockQuerier) GetLatestHeader() (*types.Header, error) { |
| 89 | ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) |