github.com/annchain/OG@v0.0.9/og/protocol/ogmessage/archive/sequencer_gen.go (about)

     1  package archive
     2  
     3  // Code generated by github.com/tinylib/msgp DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/annchain/OG/common"
     7  	"github.com/tinylib/msgp/msgp"
     8  )
     9  
    10  // DecodeMsg implements msgp.Decodable
    11  func (z *BlsSigSet) DecodeMsg(dc *msgp.Reader) (err error) {
    12  	var zb0001 uint32
    13  	zb0001, err = dc.ReadArrayHeader()
    14  	if err != nil {
    15  		err = msgp.WrapError(err)
    16  		return
    17  	}
    18  	if zb0001 != 2 {
    19  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
    20  		return
    21  	}
    22  	z.PublicKey, err = dc.ReadBytes(z.PublicKey)
    23  	if err != nil {
    24  		err = msgp.WrapError(err, "PublicKey")
    25  		return
    26  	}
    27  	z.BlsSignature, err = dc.ReadBytes(z.BlsSignature)
    28  	if err != nil {
    29  		err = msgp.WrapError(err, "BlsSignature")
    30  		return
    31  	}
    32  	return
    33  }
    34  
    35  // EncodeMsg implements msgp.Encodable
    36  func (z *BlsSigSet) EncodeMsg(en *msgp.Writer) (err error) {
    37  	// array header, size 2
    38  	err = en.Append(0x92)
    39  	if err != nil {
    40  		return
    41  	}
    42  	err = en.WriteBytes(z.PublicKey)
    43  	if err != nil {
    44  		err = msgp.WrapError(err, "PublicKey")
    45  		return
    46  	}
    47  	err = en.WriteBytes(z.BlsSignature)
    48  	if err != nil {
    49  		err = msgp.WrapError(err, "BlsSignature")
    50  		return
    51  	}
    52  	return
    53  }
    54  
    55  // MarshalMsg implements msgp.Marshaler
    56  func (z *BlsSigSet) MarshalMsg(b []byte) (o []byte, err error) {
    57  	o = msgp.Require(b, z.Msgsize())
    58  	// array header, size 2
    59  	o = append(o, 0x92)
    60  	o = msgp.AppendBytes(o, z.PublicKey)
    61  	o = msgp.AppendBytes(o, z.BlsSignature)
    62  	return
    63  }
    64  
    65  // UnmarshalMsg implements msgp.Unmarshaler
    66  func (z *BlsSigSet) UnmarshalMsg(bts []byte) (o []byte, err error) {
    67  	var zb0001 uint32
    68  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
    69  	if err != nil {
    70  		err = msgp.WrapError(err)
    71  		return
    72  	}
    73  	if zb0001 != 2 {
    74  		err = msgp.ArrayError{Wanted: 2, Got: zb0001}
    75  		return
    76  	}
    77  	z.PublicKey, bts, err = msgp.ReadBytesBytes(bts, z.PublicKey)
    78  	if err != nil {
    79  		err = msgp.WrapError(err, "PublicKey")
    80  		return
    81  	}
    82  	z.BlsSignature, bts, err = msgp.ReadBytesBytes(bts, z.BlsSignature)
    83  	if err != nil {
    84  		err = msgp.WrapError(err, "BlsSignature")
    85  		return
    86  	}
    87  	o = bts
    88  	return
    89  }
    90  
    91  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
    92  func (z *BlsSigSet) Msgsize() (s int) {
    93  	s = 1 + msgp.BytesPrefixSize + len(z.PublicKey) + msgp.BytesPrefixSize + len(z.BlsSignature)
    94  	return
    95  }
    96  
    97  // DecodeMsg implements msgp.Decodable
    98  func (z *Sequencer) DecodeMsg(dc *msgp.Reader) (err error) {
    99  	var zb0001 uint32
   100  	zb0001, err = dc.ReadArrayHeader()
   101  	if err != nil {
   102  		err = msgp.WrapError(err)
   103  		return
   104  	}
   105  	if zb0001 != 5 {
   106  		err = msgp.ArrayError{Wanted: 5, Got: zb0001}
   107  		return
   108  	}
   109  	err = TxBase.DecodeMsg(dc)
   110  	if err != nil {
   111  		err = msgp.WrapError(err, "TxBase")
   112  		return
   113  	}
   114  	if dc.IsNil() {
   115  		err = dc.ReadNil()
   116  		if err != nil {
   117  			err = msgp.WrapError(err, "Issuer")
   118  			return
   119  		}
   120  		z.Issuer = nil
   121  	} else {
   122  		if z.Issuer == nil {
   123  			z.Issuer = new(common.Address)
   124  		}
   125  		err = z.Issuer.DecodeMsg(dc)
   126  		if err != nil {
   127  			err = msgp.WrapError(err, "Issuer")
   128  			return
   129  		}
   130  	}
   131  	err = z.BlsJointSig.DecodeMsg(dc)
   132  	if err != nil {
   133  		err = msgp.WrapError(err, "Signature")
   134  		return
   135  	}
   136  	err = z.BlsJointPubKey.DecodeMsg(dc)
   137  	if err != nil {
   138  		err = msgp.WrapError(err, "PublicKey")
   139  		return
   140  	}
   141  	err = z.StateRoot.DecodeMsg(dc)
   142  	if err != nil {
   143  		err = msgp.WrapError(err, "StateRoot")
   144  		return
   145  	}
   146  	return
   147  }
   148  
   149  // EncodeMsg implements msgp.Encodable
   150  func (z *Sequencer) EncodeMsg(en *msgp.Writer) (err error) {
   151  	// array header, size 5
   152  	err = en.Append(0x95)
   153  	if err != nil {
   154  		return
   155  	}
   156  	err = TxBase.EncodeMsg(en)
   157  	if err != nil {
   158  		err = msgp.WrapError(err, "TxBase")
   159  		return
   160  	}
   161  	if z.Issuer == nil {
   162  		err = en.WriteNil()
   163  		if err != nil {
   164  			return
   165  		}
   166  	} else {
   167  		err = z.Issuer.EncodeMsg(en)
   168  		if err != nil {
   169  			err = msgp.WrapError(err, "Issuer")
   170  			return
   171  		}
   172  	}
   173  	err = z.BlsJointSig.EncodeMsg(en)
   174  	if err != nil {
   175  		err = msgp.WrapError(err, "Signature")
   176  		return
   177  	}
   178  	err = z.BlsJointPubKey.EncodeMsg(en)
   179  	if err != nil {
   180  		err = msgp.WrapError(err, "PublicKey")
   181  		return
   182  	}
   183  	err = z.StateRoot.EncodeMsg(en)
   184  	if err != nil {
   185  		err = msgp.WrapError(err, "StateRoot")
   186  		return
   187  	}
   188  	return
   189  }
   190  
   191  // MarshalMsg implements msgp.Marshaler
   192  func (z *Sequencer) MarshalMsg(b []byte) (o []byte, err error) {
   193  	o = msgp.Require(b, z.Msgsize())
   194  	// array header, size 5
   195  	o = append(o, 0x95)
   196  	o, err = TxBase.MarshalMsg(o)
   197  	if err != nil {
   198  		err = msgp.WrapError(err, "TxBase")
   199  		return
   200  	}
   201  	if z.Issuer == nil {
   202  		o = msgp.AppendNil(o)
   203  	} else {
   204  		o, err = z.Issuer.MarshalMsg(o)
   205  		if err != nil {
   206  			err = msgp.WrapError(err, "Issuer")
   207  			return
   208  		}
   209  	}
   210  	o, err = z.BlsJointSig.MarshalMsg(o)
   211  	if err != nil {
   212  		err = msgp.WrapError(err, "Signature")
   213  		return
   214  	}
   215  	o, err = z.BlsJointPubKey.MarshalMsg(o)
   216  	if err != nil {
   217  		err = msgp.WrapError(err, "PublicKey")
   218  		return
   219  	}
   220  	o, err = z.StateRoot.MarshalMsg(o)
   221  	if err != nil {
   222  		err = msgp.WrapError(err, "StateRoot")
   223  		return
   224  	}
   225  	return
   226  }
   227  
   228  // UnmarshalMsg implements msgp.Unmarshaler
   229  func (z *Sequencer) UnmarshalMsg(bts []byte) (o []byte, err error) {
   230  	var zb0001 uint32
   231  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
   232  	if err != nil {
   233  		err = msgp.WrapError(err)
   234  		return
   235  	}
   236  	if zb0001 != 5 {
   237  		err = msgp.ArrayError{Wanted: 5, Got: zb0001}
   238  		return
   239  	}
   240  	bts, err = TxBase.UnmarshalMsg(bts)
   241  	if err != nil {
   242  		err = msgp.WrapError(err, "TxBase")
   243  		return
   244  	}
   245  	if msgp.IsNil(bts) {
   246  		bts, err = msgp.ReadNilBytes(bts)
   247  		if err != nil {
   248  			return
   249  		}
   250  		z.Issuer = nil
   251  	} else {
   252  		if z.Issuer == nil {
   253  			z.Issuer = new(common.Address)
   254  		}
   255  		bts, err = z.Issuer.UnmarshalMsg(bts)
   256  		if err != nil {
   257  			err = msgp.WrapError(err, "Issuer")
   258  			return
   259  		}
   260  	}
   261  	bts, err = z.BlsJointSig.UnmarshalMsg(bts)
   262  	if err != nil {
   263  		err = msgp.WrapError(err, "Signature")
   264  		return
   265  	}
   266  	bts, err = z.BlsJointPubKey.UnmarshalMsg(bts)
   267  	if err != nil {
   268  		err = msgp.WrapError(err, "PublicKey")
   269  		return
   270  	}
   271  	bts, err = z.StateRoot.UnmarshalMsg(bts)
   272  	if err != nil {
   273  		err = msgp.WrapError(err, "StateRoot")
   274  		return
   275  	}
   276  	o = bts
   277  	return
   278  }
   279  
   280  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   281  func (z *Sequencer) Msgsize() (s int) {
   282  	s = 1 + TxBase.Msgsize()
   283  	if z.Issuer == nil {
   284  		s += msgp.NilSize
   285  	} else {
   286  		s += z.Issuer.Msgsize()
   287  	}
   288  	s += z.BlsJointSig.Msgsize() + z.BlsJointPubKey.Msgsize() + z.StateRoot.Msgsize()
   289  	return
   290  }
   291  
   292  // DecodeMsg implements msgp.Decodable
   293  func (z *SequencerJson) DecodeMsg(dc *msgp.Reader) (err error) {
   294  	var zb0001 uint32
   295  	zb0001, err = dc.ReadArrayHeader()
   296  	if err != nil {
   297  		err = msgp.WrapError(err)
   298  		return
   299  	}
   300  	if zb0001 != 4 {
   301  		err = msgp.ArrayError{Wanted: 4, Got: zb0001}
   302  		return
   303  	}
   304  	err = TxBaseJson.DecodeMsg(dc)
   305  	if err != nil {
   306  		err = msgp.WrapError(err, "TxBaseJson")
   307  		return
   308  	}
   309  	if dc.IsNil() {
   310  		err = dc.ReadNil()
   311  		if err != nil {
   312  			err = msgp.WrapError(err, "Issuer")
   313  			return
   314  		}
   315  		z.Issuer = nil
   316  	} else {
   317  		if z.Issuer == nil {
   318  			z.Issuer = new(common.Address)
   319  		}
   320  		err = z.Issuer.DecodeMsg(dc)
   321  		if err != nil {
   322  			err = msgp.WrapError(err, "Issuer")
   323  			return
   324  		}
   325  	}
   326  	err = z.BlsJointSig.DecodeMsg(dc)
   327  	if err != nil {
   328  		err = msgp.WrapError(err, "Signature")
   329  		return
   330  	}
   331  	err = z.BlsJointPubKey.DecodeMsg(dc)
   332  	if err != nil {
   333  		err = msgp.WrapError(err, "PublicKey")
   334  		return
   335  	}
   336  	return
   337  }
   338  
   339  // EncodeMsg implements msgp.Encodable
   340  func (z *SequencerJson) EncodeMsg(en *msgp.Writer) (err error) {
   341  	// array header, size 4
   342  	err = en.Append(0x94)
   343  	if err != nil {
   344  		return
   345  	}
   346  	err = TxBaseJson.EncodeMsg(en)
   347  	if err != nil {
   348  		err = msgp.WrapError(err, "TxBaseJson")
   349  		return
   350  	}
   351  	if z.Issuer == nil {
   352  		err = en.WriteNil()
   353  		if err != nil {
   354  			return
   355  		}
   356  	} else {
   357  		err = z.Issuer.EncodeMsg(en)
   358  		if err != nil {
   359  			err = msgp.WrapError(err, "Issuer")
   360  			return
   361  		}
   362  	}
   363  	err = z.BlsJointSig.EncodeMsg(en)
   364  	if err != nil {
   365  		err = msgp.WrapError(err, "Signature")
   366  		return
   367  	}
   368  	err = z.BlsJointPubKey.EncodeMsg(en)
   369  	if err != nil {
   370  		err = msgp.WrapError(err, "PublicKey")
   371  		return
   372  	}
   373  	return
   374  }
   375  
   376  // MarshalMsg implements msgp.Marshaler
   377  func (z *SequencerJson) MarshalMsg(b []byte) (o []byte, err error) {
   378  	o = msgp.Require(b, z.Msgsize())
   379  	// array header, size 4
   380  	o = append(o, 0x94)
   381  	o, err = TxBaseJson.MarshalMsg(o)
   382  	if err != nil {
   383  		err = msgp.WrapError(err, "TxBaseJson")
   384  		return
   385  	}
   386  	if z.Issuer == nil {
   387  		o = msgp.AppendNil(o)
   388  	} else {
   389  		o, err = z.Issuer.MarshalMsg(o)
   390  		if err != nil {
   391  			err = msgp.WrapError(err, "Issuer")
   392  			return
   393  		}
   394  	}
   395  	o, err = z.BlsJointSig.MarshalMsg(o)
   396  	if err != nil {
   397  		err = msgp.WrapError(err, "Signature")
   398  		return
   399  	}
   400  	o, err = z.BlsJointPubKey.MarshalMsg(o)
   401  	if err != nil {
   402  		err = msgp.WrapError(err, "PublicKey")
   403  		return
   404  	}
   405  	return
   406  }
   407  
   408  // UnmarshalMsg implements msgp.Unmarshaler
   409  func (z *SequencerJson) UnmarshalMsg(bts []byte) (o []byte, err error) {
   410  	var zb0001 uint32
   411  	zb0001, bts, err = msgp.ReadArrayHeaderBytes(bts)
   412  	if err != nil {
   413  		err = msgp.WrapError(err)
   414  		return
   415  	}
   416  	if zb0001 != 4 {
   417  		err = msgp.ArrayError{Wanted: 4, Got: zb0001}
   418  		return
   419  	}
   420  	bts, err = TxBaseJson.UnmarshalMsg(bts)
   421  	if err != nil {
   422  		err = msgp.WrapError(err, "TxBaseJson")
   423  		return
   424  	}
   425  	if msgp.IsNil(bts) {
   426  		bts, err = msgp.ReadNilBytes(bts)
   427  		if err != nil {
   428  			return
   429  		}
   430  		z.Issuer = nil
   431  	} else {
   432  		if z.Issuer == nil {
   433  			z.Issuer = new(common.Address)
   434  		}
   435  		bts, err = z.Issuer.UnmarshalMsg(bts)
   436  		if err != nil {
   437  			err = msgp.WrapError(err, "Issuer")
   438  			return
   439  		}
   440  	}
   441  	bts, err = z.BlsJointSig.UnmarshalMsg(bts)
   442  	if err != nil {
   443  		err = msgp.WrapError(err, "Signature")
   444  		return
   445  	}
   446  	bts, err = z.BlsJointPubKey.UnmarshalMsg(bts)
   447  	if err != nil {
   448  		err = msgp.WrapError(err, "PublicKey")
   449  		return
   450  	}
   451  	o = bts
   452  	return
   453  }
   454  
   455  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   456  func (z *SequencerJson) Msgsize() (s int) {
   457  	s = 1 + TxBaseJson.Msgsize()
   458  	if z.Issuer == nil {
   459  		s += msgp.NilSize
   460  	} else {
   461  		s += z.Issuer.Msgsize()
   462  	}
   463  	s += z.BlsJointSig.Msgsize() + z.BlsJointPubKey.Msgsize()
   464  	return
   465  }
   466  
   467  // DecodeMsg implements msgp.Decodable
   468  func (z *Sequencers) DecodeMsg(dc *msgp.Reader) (err error) {
   469  	var zb0002 uint32
   470  	zb0002, err = dc.ReadArrayHeader()
   471  	if err != nil {
   472  		err = msgp.WrapError(err)
   473  		return
   474  	}
   475  	if cap((*z)) >= int(zb0002) {
   476  		(*z) = (*z)[:zb0002]
   477  	} else {
   478  		(*z) = make(Sequencers, zb0002)
   479  	}
   480  	for zb0001 := range *z {
   481  		if dc.IsNil() {
   482  			err = dc.ReadNil()
   483  			if err != nil {
   484  				err = msgp.WrapError(err, zb0001)
   485  				return
   486  			}
   487  			(*z)[zb0001] = nil
   488  		} else {
   489  			if (*z)[zb0001] == nil {
   490  				(*z)[zb0001] = new(Sequencer)
   491  			}
   492  			err = (*z)[zb0001].DecodeMsg(dc)
   493  			if err != nil {
   494  				err = msgp.WrapError(err, zb0001)
   495  				return
   496  			}
   497  		}
   498  	}
   499  	return
   500  }
   501  
   502  // EncodeMsg implements msgp.Encodable
   503  func (z Sequencers) EncodeMsg(en *msgp.Writer) (err error) {
   504  	err = en.WriteArrayHeader(uint32(len(z)))
   505  	if err != nil {
   506  		err = msgp.WrapError(err)
   507  		return
   508  	}
   509  	for zb0003 := range z {
   510  		if z[zb0003] == nil {
   511  			err = en.WriteNil()
   512  			if err != nil {
   513  				return
   514  			}
   515  		} else {
   516  			err = z[zb0003].EncodeMsg(en)
   517  			if err != nil {
   518  				err = msgp.WrapError(err, zb0003)
   519  				return
   520  			}
   521  		}
   522  	}
   523  	return
   524  }
   525  
   526  // MarshalMsg implements msgp.Marshaler
   527  func (z Sequencers) MarshalMsg(b []byte) (o []byte, err error) {
   528  	o = msgp.Require(b, z.Msgsize())
   529  	o = msgp.AppendArrayHeader(o, uint32(len(z)))
   530  	for zb0003 := range z {
   531  		if z[zb0003] == nil {
   532  			o = msgp.AppendNil(o)
   533  		} else {
   534  			o, err = z[zb0003].MarshalMsg(o)
   535  			if err != nil {
   536  				err = msgp.WrapError(err, zb0003)
   537  				return
   538  			}
   539  		}
   540  	}
   541  	return
   542  }
   543  
   544  // UnmarshalMsg implements msgp.Unmarshaler
   545  func (z *Sequencers) UnmarshalMsg(bts []byte) (o []byte, err error) {
   546  	var zb0002 uint32
   547  	zb0002, bts, err = msgp.ReadArrayHeaderBytes(bts)
   548  	if err != nil {
   549  		err = msgp.WrapError(err)
   550  		return
   551  	}
   552  	if cap((*z)) >= int(zb0002) {
   553  		(*z) = (*z)[:zb0002]
   554  	} else {
   555  		(*z) = make(Sequencers, zb0002)
   556  	}
   557  	for zb0001 := range *z {
   558  		if msgp.IsNil(bts) {
   559  			bts, err = msgp.ReadNilBytes(bts)
   560  			if err != nil {
   561  				return
   562  			}
   563  			(*z)[zb0001] = nil
   564  		} else {
   565  			if (*z)[zb0001] == nil {
   566  				(*z)[zb0001] = new(Sequencer)
   567  			}
   568  			bts, err = (*z)[zb0001].UnmarshalMsg(bts)
   569  			if err != nil {
   570  				err = msgp.WrapError(err, zb0001)
   571  				return
   572  			}
   573  		}
   574  	}
   575  	o = bts
   576  	return
   577  }
   578  
   579  // Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message
   580  func (z Sequencers) Msgsize() (s int) {
   581  	s = msgp.ArrayHeaderSize
   582  	for zb0003 := range z {
   583  		if z[zb0003] == nil {
   584  			s += msgp.NilSize
   585  		} else {
   586  			s += z[zb0003].Msgsize()
   587  		}
   588  	}
   589  	return
   590  }