kaiachain / kaia

GNU Lesser General Public License v3.0
21 stars 27 forks source link

kaiax/gov: Serialize/deserialize validator votes #132

Closed ian0371 closed 1 week ago

ian0371 commented 1 week ago

Proposed changes

Types of changes

Checklist

Further comments

This PR fixes encoding of multiple-address votes, because the previous scheme involves decoding RLP twice. This data does not exist in any on-chain blocks, so there's no need to support backward compatibility.

// before this PR
rlp decode 0xf85b94f39fd6e51aad88f6f4ce6ab8827279cfffb922669a676f7665726e616e63652e72656d6f766576616c696461746f72ea943c44cdddb6a900fa2b585dd299e03d12fa4293bc9490f79bf6eb2c4f870365e785982e1f101e93b906
["f39fd6e51aad88f6f4ce6ab8827279cfffb92266","676f7665726e616e63652e72656d6f766576616c696461746f72",["3c44cdddb6a900fa2b585dd299e03d12fa4293bc","90f79bf6eb2c4f870365e785982e1f101e93b906"]]

// after this PR
rlp decode 0xf85994f39fd6e51aad88f6f4ce6ab8827279cfffb922669a676f7665726e616e63652e72656d6f766576616c696461746f72a83c44cdddb6a900fa2b585dd299e03d12fa4293bc90f79bf6eb2c4f870365e785982e1f101e93b906
["f39fd6e51aad88f6f4ce6ab8827279cfffb92266","676f7665726e616e63652e72656d6f766576616c696461746f72","3c44cdddb6a900fa2b585dd299e03d12fa4293bc90f79bf6eb2c4f870365e785982e1f101e93b906"]