Skip to content

Dont panic!: General rework to remove all panic!, assert! & .unwrap() from library#56

Open
guilledk wants to merge 60 commits intotelosnetwork:masterfrom
openrepublic:dont_panic
Open

Dont panic!: General rework to remove all panic!, assert! & .unwrap() from library#56
guilledk wants to merge 60 commits intotelosnetwork:masterfrom
openrepublic:dont_panic

Conversation

@guilledk
Copy link

@guilledk guilledk commented May 30, 2025

NOTES:

  • Ideally this would be v0.4.0 of the library increased from v0.3.1 to indicate API breaking changes
  • To check for panics / code smells:
cargo test && cargo clippy --all -- \
    -D clippy::unwrap_used \
    -D clippy::expect_used  \
    -D clippy::panic \
    -D clippy::unimplemented`

API Changes:

  • Make Packer trait's unpack() return a Result<usize, PackerError> intead of just usize
  • Remove panics from chain stuct constructors, implement From/TryFrom/FromStr traits instead
  • Implement Display trait which automatically grants to_string for chain structs

Additions:

  • Implement FromStr many integer types for Name
  • Implement From<u64> for Name
  • Add .to_string() to TimePoint & TimePointSec
  • Add BlockTimestamp which is the slot based time point sec
  • Add serde name serializers in order to be able to do ABI json dumps
  • Add ABI type resolver system
  • Add ShipABI which represents the ABI that state_history_plugin sends as first message representing the session types
  • Add PartialEq to authority structs
  • Make some chain structs fields public like in ExtendedAsset, PackedTransaction & Signature
  • Make BinaryExtension's inner value public
  • Derive Debug on Checksum512
  • Implement FromStr for PrivateKey

Guillermo Rodriguez added 24 commits April 24, 2025 00:01
…aits like FromStr and TryFrom to instantiate the structs
…factor HasNameAndType into AbiTableView and make more complete
@guilledk guilledk marked this pull request as ready for review May 31, 2025 00:26
Guillermo Rodriguez and others added 25 commits May 30, 2025 21:32
…sing the .to_string() auto generated by Display trait impl for all checksums
…w only .to_string() should be used which is implemented using Display trait
…m_bytes in favour of From<&[u8]> on checksum classes
…slice() & bring BlockId def from custom module to checksums module, define it using the macro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant