(endpoint string, kvIndex uint64, hash common.Hash)
| 249 | } |
| 250 | |
| 251 | func downloadBlobFromRPC(endpoint string, kvIndex uint64, hash common.Hash) ([]byte, error) { |
| 252 | rpcClient, err := rpc.DialOptions(context.Background(), endpoint, rpc.WithHTTPClient(http.DefaultClient)) |
| 253 | if err != nil { |
| 254 | return nil, err |
| 255 | } |
| 256 | |
| 257 | var result hexutil.Bytes |
| 258 | // kvIndex, blobHash, encodeType, offset, length |
| 259 | if err := rpcClient.Call(&result, "es_getBlob", kvIndex, hash, 0, 0, 4096*32); err != nil { |
| 260 | return nil, err |
| 261 | } |
| 262 | |
| 263 | blobhash, err := blobs.BlobToVersionedHash(result) |
| 264 | if err != nil { |
| 265 | return nil, fmt.Errorf("blobToCommitment failed: %w", err) |
| 266 | } |
| 267 | if !bytes.Equal(blobhash[:es.HashSizeInContract], hash[:es.HashSizeInContract]) { |
| 268 | return nil, fmt.Errorf("invalid blobhash for %d want: %x, got: %x", kvIndex, hash, blobhash) |
| 269 | } |
| 270 | |
| 271 | return result, nil |
| 272 | } |
| 273 | |
| 274 | func initShardManager(ctx *cli.Context, l1Rpc string, l1contract common.Address) (*es.ShardManager, error) { |
| 275 | miner := readRequiredFlag(ctx, flags.StorageMiner) |
no test coverage detected