note: DeployCode.Code has data reference of param source
(source *common.ZeroCopySource)
| 141 | |
| 142 | //note: DeployCode.Code has data reference of param source |
| 143 | func (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 | |
| 188 | const maxWasmCodeSize = 512 * 1024 |
| 189 |