(ctx context.Context, client *ethclient.Client, l1Contract, miner common.Address, lg log.Logger)
| 95 | } |
| 96 | |
| 97 | func initStorageConfig(ctx context.Context, client *ethclient.Client, l1Contract, miner common.Address, lg log.Logger) (*storage.StorageConfig, error) { |
| 98 | cr := newContractReader(ctx, client, l1Contract, lg) |
| 99 | exist, err := cr.contractExists() |
| 100 | if err != nil { |
| 101 | return nil, err |
| 102 | } |
| 103 | if !exist { |
| 104 | return nil, fmt.Errorf("contract does not exist") |
| 105 | } |
| 106 | maxKvSizeBits, err := cr.readUint("maxKvSizeBits") |
| 107 | if err != nil { |
| 108 | return nil, err |
| 109 | } |
| 110 | chunkSizeBits := maxKvSizeBits |
| 111 | shardEntryBits, err := cr.readUint("shardEntryBits") |
| 112 | if err != nil { |
| 113 | return nil, err |
| 114 | } |
| 115 | return &storage.StorageConfig{ |
| 116 | L1Contract: l1Contract, |
| 117 | Miner: miner, |
| 118 | KvSize: 1 << maxKvSizeBits, |
| 119 | ChunkSize: 1 << chunkSizeBits, |
| 120 | KvEntriesPerShard: 1 << shardEntryBits, |
| 121 | }, nil |
| 122 | } |
| 123 | |
| 124 | func getShardList(ctx context.Context, client *ethclient.Client, contract common.Address, shardLen int) ([]uint64, error) { |
| 125 | var shardId uint64 = 0 |
no test coverage detected