title: The serialize of Pubkey are difference between borsh-js and borsh-rs
body: <p>I serialize a pubkey (solana account publickey）in the js and rust with borsh, but the output in js with a length of 4 bytes，and the pubkey in js client is a length of 44bytes string，but it is a pubkey with 32bytes in rust program，without the 4 bytes length before it, How to serialize them as same?</p>
  <p>In the JS:</p>
  <pre><code>class MintAccount extends Assignable { }
   console.log(MintAccount);
   const SCHEMA = new Map([
   [
     MintAccount,
     {
       kind: 'struct',
       fields: [
         ['tag', 'u8'],
         ['authority','string'],
         ['supply', 'u64']
       ],
     },
   ]
  ]);
  console.log(feePayer.publicKey.toString());
  let mintAccount = new MintAccount({tag:1,7xiHVn7EeQwbsPrAtaY3aokHekYTrURsgzReFxd1JeVR,supply:0})
  let accountDataBuffer = borsh.serialize(SCHEMA, mintAccount);
  console.log(accountDataBuffer);
  </code></pre>
  <p>and in the RUST:
  in states.rs</p>
  <pre><code>#[derive(BorshSerialize, BorshDeserialize, Debug, Clone, PartialEq)]
  pub enum AccountTag {
      Uninitialized,
      Mint,
      TokenAccount,
  }
  
  #[derive(BorshSerialize, BorshDeserialize, Debug, Clone)]
  pub struct Mint {
      pub tag: AccountTag,
      pub authority: Pubkey,
      pub supply: u64,
  }
  
  impl Mint {
      pub fn load_unchecked(ai: &amp;AccountInfo) -&gt; Result&lt;Self, ProgramError&gt; {
          msg!(&quot;ai:, {:?}, {:?}&quot;,ai,ai.data.borrow());
          Ok(Self::try_from_slice(&amp;ai.data.borrow())?)
      }
  
      fn validate(&amp;self) -&gt; ProgramResult {
          if self.tag != AccountTag::Mint {
              return Err(ProgramError::InvalidAccountData);
          }
          Ok(())
      }
  
      pub fn load(ai: &amp;AccountInfo) -&gt; Result&lt;Self, ProgramError&gt; {
          let mint = Self::try_from_slice(&amp;ai.data.borrow())?;
          mint.validate()?;
          Ok(mint)
      }
  
      pub fn save(&amp;self, ai: &amp;AccountInfo) -&gt; ProgramResult {
          Ok(self.serialize(&amp;mut *ai.data.borrow_mut())?)
      }
  }
  </code></pre>
  <p>in the processor.rs</p>
  <pre><code>impl Processor {
      pub fn process_instruction(
          _program_id: &amp;Pubkey,
          accounts: &amp;[AccountInfo],
          instruction_data: &amp;[u8],
      ) -&gt; ProgramResult {
          let instruction = TokenInstruction::try_from_slice(instruction_data)
              .map_err(|_| ProgramError::InvalidInstructionData)?;
          let accounts_iter = &amp;mut accounts.iter();
          match instruction {
              TokenInstruction::InitializeMint =&gt; {
                  msg!(&quot;Instruction:  ,{:?}&quot;,instruction);
                  let mint_ai = next_account_info(accounts_iter)?;
                  msg!(&quot;mint_ai:  ,{:?}&quot;,mint_ai);
                  let mint_authority = next_account_info(accounts_iter)?;
                  msg!(&quot;mint_authority:  ,{:?},{:?}&quot;,mint_authority,*mint_authority.key);
                  let mut mint = Mint::load_unchecked(mint_ai)?;
                  msg!(&quot;mint:  ,{:?}&quot;,mint);
                  assert_with_msg(
                      mint_authority.is_signer,
                      ProgramError::MissingRequiredSignature,
                      &quot;Mint Authority must sign&quot;,
                  )?;
                  // TODO
                  mint.tag = AccountTag::Mint;
                  mint.authority = *mint_authority.key;
                  mint.supply = 0;
                   
                  msg!(&quot;NewMint:  ,{:?},{:?},{:?}&quot;,mint,mint_ai.data,&amp;mut &amp;mut mint_ai.data.borrow_mut()[..]);
                  // mint.serialize(&amp;mut &amp;mut mint_ai.data.borrow_mut()[..])?;
                  mint.save(mint_ai)?;  `
  </code></pre>
  <p>as the same parameters, the outputs are different:
  JS:</p>
  <pre><code> &lt;Buffer 01 2c 00 00 00 37 78 69 48 56 6e 37 45 65 51 77 62 73 50 72 41 74 61 59 33 61 6f 6b 48 65 6b 59 54 72 55 52 73 67 7a 52 65 46 78 64 31 4a 65 56 52 00 ... 7 more bytes&gt;
  </code></pre>
  <p>RS:</p>
  <pre><code> &lt;Buffer 01 67 6b bf 1a 5c ad e2 3f a0 69 13 09 5e e8 6a 50 91 87 1c 3e 16 5d a4 43 84 d0 d6 f4 0e 9a 4f 8c 00 00 00 00 00 00 00 00&gt;
  </code></pre>