Skip to content

Commit

Permalink
sharding/client: Add utils.go for blob serialization(prysmaticlabs#92)
Browse files Browse the repository at this point in the history
  • Loading branch information
nisdas committed May 2, 2018
1 parent 7a32d5e commit 8817ee0
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions sharding/client/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package client

import (
"fmt"
)

type collationbody []byte

var (
collationsizelimit = int64(2 * *20)
chunkSize = int64(32)
indicatorSize = int64(1)
chunkDataSize = chunkSize - indicatorSize
)

func (c *collationbody) validateBody() bool {
return len(c) < 2^20 && len(c) > 0
}

func createChunks(c collationbody) {
validCollation, err := c.validateBody
if err != nil {
fmt.Errorf("Error %v", err)
}
if !validCollation {
fmt.Errorf("Error %v", err)
}
index := int64(len(c)) / chunkDataSize

/*
for i = 0; i < index; i++ {
serialisedblob[i*chunksize] = 0
for f = 0; f <chunkdatasize ; f++ {
serialisedblob[(f+1) + i*chunksize] = collationbody[f + i*chunkdatasize]
}
serialisedblob[index*chunksize ] = len(collationbody) – index*chunkdatasize
}*/

}

0 comments on commit 8817ee0

Please sign in to comment.