MCPcopy Create free account
hub / github.com/DNAProject/DNA / Deserialization

Method Deserialization

core/payload/deploy_code.go:143–186  ·  view source on GitHub ↗

note: DeployCode.Code has data reference of param source

(source *common.ZeroCopySource)

Source from the content-addressed store, hash-verified

141
142//note: DeployCode.Code has data reference of param source
143func (dc *DeployCode) Deserialization(source *common.ZeroCopySource) error {
144 var eof, irregular bool
145 dc.code, _, irregular, eof = source.NextVarBytes()
146 if irregular {
147 return common.ErrIrregularData
148 }
149
150 dc.vmFlags, eof = source.NextByte()
151 dc.Name, _, irregular, eof = source.NextString()
152 if irregular {
153 return common.ErrIrregularData
154 }
155
156 dc.Version, _, irregular, eof = source.NextString()
157 if irregular {
158 return common.ErrIrregularData
159 }
160
161 dc.Author, _, irregular, eof = source.NextString()
162 if irregular {
163 return common.ErrIrregularData
164 }
165
166 dc.Email, _, irregular, eof = source.NextString()
167 if irregular {
168 return common.ErrIrregularData
169 }
170
171 dc.Description, _, irregular, eof = source.NextString()
172 if irregular {
173 return common.ErrIrregularData
174 }
175
176 if eof {
177 return io.ErrUnexpectedEOF
178 }
179
180 err := validateDeployCode(dc)
181 if err != nil {
182 return err
183 }
184
185 return nil
186}
187
188const maxWasmCodeSize = 512 * 1024
189

Callers 1

TestDeployCode_SerializeFunction · 0.95

Calls 4

validateDeployCodeFunction · 0.85
NextVarBytesMethod · 0.80
NextByteMethod · 0.80
NextStringMethod · 0.80

Tested by 1

TestDeployCode_SerializeFunction · 0.76