mirror of
https://github.com/logos-storage/logos-storage-nim.git
synced 2026-01-06 23:43:08 +00:00
Removed modules: - sales (including reservations, slot queue, marketplace abstractions, state machines, etc) - purchasing - erasure coding - contract interactions - prover - slot builder - block exchange payments - sales/purchasing from REST api - removed persistence command and all config params from cli configuration - CI workflows (devnet, dist tests, cirdl build, start eth node, contracts version reporting) - unused modules from tests - marketplace integration tests, and starting provider/validator/hardhat nodes - unused manifest properties - integration tests using the above # Conflicts: # .github/workflows/ci-reusable.yml # .github/workflows/docker.yml # build.nims # codex/blockexchange/engine/payments.nim # codex/codex.nim # codex/conf.nim # codex/contracts/Readme.md # codex/erasure.nim # codex/erasure/backend.nim # codex/erasure/backends/leopard.nim # codex/erasure/erasure.nim # codex/rest/api.nim # codex/sales.nim # codex/sales/reservations.nim # codex/sales/states/filled.nim # codex/sales/states/preparing.nim # codex/sales/states/provingsimulated.nim # codex/slots/builder/builder.nim # codex/slots/converters.nim # codex/slots/proofs/backends/circomcompat.nim # codex/slots/proofs/backends/converters.nim # codex/slots/proofs/prover.nim # codex/slots/sampler/sampler.nim # codex/slots/sampler/utils.nim # codex/slots/types.nim # tests/integration/5_minutes/testrestapivalidation.nim # tests/integration/hardhatprocess.nim # tests/integration/multinodes.nim # tools/cirdl/cirdl.nim
47 lines
1.2 KiB
Nim
47 lines
1.2 KiB
Nim
import std/random
|
|
import std/sequtils
|
|
import pkg/libp2p
|
|
import pkg/stint
|
|
import pkg/codex/rng
|
|
import pkg/codex/stores
|
|
import pkg/codex/blocktype as bt
|
|
import pkg/codex/merkletree
|
|
import pkg/codex/manifest
|
|
import ../examples
|
|
|
|
export examples
|
|
|
|
proc example*(_: type bt.Block, size: int = 4096): bt.Block =
|
|
let bytes = newSeqWith(size, rand(uint8))
|
|
bt.Block.new(bytes).tryGet()
|
|
|
|
proc example*(_: type PeerId): PeerId =
|
|
let key = PrivateKey.random(Rng.instance[]).get
|
|
PeerId.init(key.getPublicKey().get).get
|
|
|
|
proc example*(_: type BlockExcPeerCtx): BlockExcPeerCtx =
|
|
BlockExcPeerCtx(id: PeerId.example)
|
|
|
|
proc example*(_: type Cid): Cid =
|
|
bt.Block.example.cid
|
|
|
|
proc example*(_: type BlockAddress): BlockAddress =
|
|
let cid = Cid.example
|
|
BlockAddress.init(cid)
|
|
|
|
proc example*(_: type Manifest): Manifest =
|
|
Manifest.new(
|
|
treeCid = Cid.example,
|
|
blockSize = 256.NBytes,
|
|
datasetSize = 4096.NBytes,
|
|
filename = "example.txt".some,
|
|
mimetype = "text/plain".some,
|
|
)
|
|
|
|
proc example*(_: type MultiHash, mcodec = Sha256HashCodec): MultiHash =
|
|
let bytes = newSeqWith(256, rand(uint8))
|
|
MultiHash.digest($mcodec, bytes).tryGet()
|
|
|
|
proc example*(_: type MerkleProof): MerkleProof =
|
|
MerkleProof.init(3, @[MultiHash.example]).tryget()
|