mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-11 21:49:26 +00:00
Replace bincode with borsh (#452)
* Add SignalsConfig to chain_spec * Correct multiexp feature flagging for rand_core std * Remove bincode for borsh Replaces a non-canonical encoding with a canonical encoding which additionally should be faster. Also fixes an issue where we used bincode in transcripts where it cannot be trusted. This ended up fixing a myriad of other bugs observed, unfortunately. Accordingly, it either has to be merged or the bug fixes from it must be ported to a new PR. * Make serde optional, minimize usage * Make borsh an optional dependency of substrate/ crates * Remove unused dependencies * Use [u8; 64] where possible in the processor messages * Correct borsh feature flagging
This commit is contained in:
@@ -10,7 +10,7 @@ impl<D: Db> Queue<D> {
|
||||
}
|
||||
|
||||
fn message_count_key(&self) -> Vec<u8> {
|
||||
Self::key(b"message_count", bincode::serialize(&(self.1, self.2)).unwrap())
|
||||
Self::key(b"message_count", borsh::to_vec(&(self.1, self.2)).unwrap())
|
||||
}
|
||||
pub(crate) fn message_count(&self) -> u64 {
|
||||
self
|
||||
@@ -21,7 +21,7 @@ impl<D: Db> Queue<D> {
|
||||
}
|
||||
|
||||
fn last_acknowledged_key(&self) -> Vec<u8> {
|
||||
Self::key(b"last_acknowledged", bincode::serialize(&(self.1, self.2)).unwrap())
|
||||
Self::key(b"last_acknowledged", borsh::to_vec(&(self.1, self.2)).unwrap())
|
||||
}
|
||||
pub(crate) fn last_acknowledged(&self) -> Option<u64> {
|
||||
self
|
||||
@@ -31,7 +31,7 @@ impl<D: Db> Queue<D> {
|
||||
}
|
||||
|
||||
fn message_key(&self, id: u64) -> Vec<u8> {
|
||||
Self::key(b"message", bincode::serialize(&(self.1, self.2, id)).unwrap())
|
||||
Self::key(b"message", borsh::to_vec(&(self.1, self.2, id)).unwrap())
|
||||
}
|
||||
// TODO: This is fine as-used, yet gets from the DB while having a txn. It should get from the
|
||||
// txn
|
||||
|
||||
Reference in New Issue
Block a user