mirror of
https://gitlab.com/pezkuwichain/pezkuwi-sdk.git
synced 2026-11-06 10:51:09 +00:00
sync: mirror deployed github repo (chains + sanitized bridge), keep GitLab CI
Make this monorepo's tracked tree identical to the deployed github repo (github.com/pezkuwichain/pezkuwi-DKS): all RC/AH/People runtimes and framework carry the mainnet fixes (incl. U128CurrencyToVote everywhere, so the staking election stall cannot recur), and tools/usdt-bridge matches the current, public-safe custody tooling (real config/deploy units gitignored, secret-file locations and server IPs stripped, sanitized *.example templates committed). Only exception to the mirror: GitLab-native CI is preserved (.gitlab-ci.yml and .gitlab/), to be rebuilt to match the github CI pipeline in a follow-up.
This commit is contained in:
1 parent
82543bdfab
commit
d285d59108
736 files changed
+15082
-16359
No files matched your search
Vendored
+73
@@ -0,0 +1,73 @@
|
||||
#![cfg(feature = "borsh")]
|
||||
use std::fmt;
|
||||
extern crate arrayvec;
|
||||
extern crate borsh;
|
||||
|
||||
fn assert_ser<T: borsh::BorshSerialize>(v: &T, expected_bytes: &[u8]) {
|
||||
let mut actual_bytes = Vec::new();
|
||||
v.serialize(&mut actual_bytes).unwrap();
|
||||
assert_eq!(actual_bytes, expected_bytes);
|
||||
}
|
||||
|
||||
fn assert_roundtrip<T: borsh::BorshSerialize + borsh::BorshDeserialize + PartialEq + fmt::Debug>(v: &T) {
|
||||
let mut bytes = Vec::new();
|
||||
v.serialize(&mut bytes).unwrap();
|
||||
let v_de = T::try_from_slice(&bytes).unwrap();
|
||||
assert_eq!(*v, v_de);
|
||||
}
|
||||
|
||||
mod array_vec {
|
||||
use arrayvec::ArrayVec;
|
||||
use super::{assert_ser, assert_roundtrip};
|
||||
|
||||
#[test]
|
||||
fn test_empty() {
|
||||
let vec = ArrayVec::<u32, 0>::new();
|
||||
assert_ser(&vec, b"\0\0\0\0");
|
||||
assert_roundtrip(&vec);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_full() {
|
||||
let mut vec = ArrayVec::<u32, 3>::new();
|
||||
vec.push(0xdeadbeef);
|
||||
vec.push(0x123);
|
||||
vec.push(0x456);
|
||||
assert_ser(&vec, b"\x03\0\0\0\xef\xbe\xad\xde\x23\x01\0\0\x56\x04\0\0");
|
||||
assert_roundtrip(&vec);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_with_free_capacity() {
|
||||
let mut vec = ArrayVec::<u32, 3>::new();
|
||||
vec.push(0xdeadbeef);
|
||||
assert_ser(&vec, b"\x01\0\0\0\xef\xbe\xad\xde");
|
||||
assert_roundtrip(&vec);
|
||||
}
|
||||
}
|
||||
|
||||
mod array_string {
|
||||
use arrayvec::ArrayString;
|
||||
use super::{assert_ser, assert_roundtrip};
|
||||
|
||||
#[test]
|
||||
fn test_empty() {
|
||||
let string = ArrayString::<0>::new();
|
||||
assert_ser(&string, b"\0\0\0\0");
|
||||
assert_roundtrip(&string);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_full() {
|
||||
let string = ArrayString::from_byte_string(b"hello world").unwrap();
|
||||
assert_ser(&string, b"\x0b\0\0\0hello world");
|
||||
assert_roundtrip(&string);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_with_free_capacity() {
|
||||
let string = ArrayString::<16>::from("hello world").unwrap();
|
||||
assert_ser(&string, b"\x0b\0\0\0hello world");
|
||||
assert_roundtrip(&string);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user