Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface-test
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
董子豪
interface-test
Commits
391bf3d6
Commit
391bf3d6
authored
Sep 09, 2021
by
董子豪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify piece hash construction in EncodeDataToPieces
parent
79c7865a
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
88 additions
and
107 deletions
+88
-107
storage.go
build/storage/storage.go
+7
-0
seal_api.go
seal/seal_api.go
+79
-105
type.go
seal/type.go
+2
-2
No files found.
build/storage/storage.go
View file @
391bf3d6
...
@@ -11,6 +11,13 @@ type Data = io.Reader
...
@@ -11,6 +11,13 @@ type Data = io.Reader
type
Hash
=
[
32
]
byte
type
Hash
=
[
32
]
byte
type
DecodedData
struct
{
HasPre
bool
PreHash
Hash
Data
[]
byte
PieceHash
[]
Hash
}
type
SectorRef
struct
{
type
SectorRef
struct
{
ID
abi
.
SectorID
ID
abi
.
SectorID
ProofType
abi
.
RegisteredSealProof
ProofType
abi
.
RegisteredSealProof
...
...
seal/seal_api.go
View file @
391bf3d6
This diff is collapsed.
Click to expand it.
seal/type.go
View file @
391bf3d6
...
@@ -21,8 +21,8 @@ type SectorSealer interface{
...
@@ -21,8 +21,8 @@ type SectorSealer interface{
Sealed
(
ctx
context
.
Context
,
sid
storage
.
SectorRef
,
seed
abi
.
InteractiveSealRandomness
,
ticket
abi
.
SealRandomness
,
pieces
[]
abi
.
PieceInfo
)
(
storage
.
SectorCids
,
[]
byte
,
error
)
Sealed
(
ctx
context
.
Context
,
sid
storage
.
SectorRef
,
seed
abi
.
InteractiveSealRandomness
,
ticket
abi
.
SealRandomness
,
pieces
[]
abi
.
PieceInfo
)
(
storage
.
SectorCids
,
[]
byte
,
error
)
// Split and encode data into pieces
// Split and encode data into pieces
// Pieces structure is [ Tag | MetaData | HashData ] or [ Tag | PreHash | HashData]
// Pieces structure is [ Tag | MetaData | HashData ] or [ Tag | PreHash | HashData]
EncodeDataToPieces
(
ctx
context
.
Context
,
sectorSize
abi
.
SectorSize
,
file
storage
.
Data
)
(
storage
.
Hash
,
error
)
EncodeDataToPieces
(
ctx
context
.
Context
,
sectorSize
abi
.
SectorSize
,
file
storage
.
Data
)
(
storage
.
Hash
,
[]
storage
.
Hash
,
error
)
DecodePiece
(
ctx
context
.
Context
,
sectorSize
abi
.
SectorSize
,
in
io
.
Reader
,
start
storiface
.
UnpaddedByteIndex
,
end
storiface
.
UnpaddedByteIndex
)
(
bool
,
storage
.
Hash
,
[]
byte
,
[]
storage
.
Hash
,
error
)
DecodePiece
(
ctx
context
.
Context
,
sectorSize
abi
.
SectorSize
,
in
io
.
Reader
,
start
storiface
.
UnpaddedByteIndex
,
end
storiface
.
UnpaddedByteIndex
)
(
storage
.
DecodedData
,
error
)
GenerateCommit2Proof
(
ctx
context
.
Context
,
sid
storage
.
SectorRef
,
seed
abi
.
InteractiveSealRandomness
,
ticket
abi
.
SealRandomness
,
pieces
[]
abi
.
PieceInfo
,
cids
storage
.
SectorCids
)
(
storage
.
Proof
,
error
)
GenerateCommit2Proof
(
ctx
context
.
Context
,
sid
storage
.
SectorRef
,
seed
abi
.
InteractiveSealRandomness
,
ticket
abi
.
SealRandomness
,
pieces
[]
abi
.
PieceInfo
,
cids
storage
.
SectorCids
)
(
storage
.
Proof
,
error
)
GenerateWindowPoStProofs
(
ctx
context
.
Context
,
minerID
abi
.
ActorID
,
sectorInfo
[]
spproof
.
SectorInfo
,
randomness
abi
.
PoStRandomness
)
([]
spproof
.
PoStProof
,
[]
abi
.
SectorID
,
error
)
GenerateWindowPoStProofs
(
ctx
context
.
Context
,
minerID
abi
.
ActorID
,
sectorInfo
[]
spproof
.
SectorInfo
,
randomness
abi
.
PoStRandomness
)
([]
spproof
.
PoStProof
,
[]
abi
.
SectorID
,
error
)
UnsealedRange
(
ctx
context
.
Context
,
sid
storage
.
SectorRef
,
sectorSize
abi
.
SectorSize
,
ticket
abi
.
SealRandomness
,
commd
cid
.
Cid
,
out
io
.
Writer
,
offset
storiface
.
UnpaddedByteIndex
,
size
abi
.
UnpaddedPieceSize
)
error
UnsealedRange
(
ctx
context
.
Context
,
sid
storage
.
SectorRef
,
sectorSize
abi
.
SectorSize
,
ticket
abi
.
SealRandomness
,
commd
cid
.
Cid
,
out
io
.
Writer
,
offset
storiface
.
UnpaddedByteIndex
,
size
abi
.
UnpaddedPieceSize
)
error
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment