Skip to content

Latest commit

 

History

History
78 lines (50 loc) · 5.74 KB

NOTES.md

File metadata and controls

78 lines (50 loc) · 5.74 KB

Notes

Bookmarks

Dev Notes

  1. Protocol upgrades:
Network protocol version is ProtocolVersion(44), but the maximum supported version by the binary is 43. Please upgrade the binary. panic.file="crates/sui-protocol-config/src/lib.rs" panic.line=1252 panic.column=9
  1. Construct
  • Package = Contract, has an address (case-insensitive). Package can also be a dep of another package.
  • Account
  • Object
  • Transactions
    • Transactions specify a Gas Object / Coin used to pay for gas. Txns also specify a gas Price and Budget similar to ethereum txns.
  • Transaction Blocks: chain multiple commands in a single transaction
  1. MOVE language unique properties
  • In Move, each account that owns a token typically has a piece of data stored in an account that directly represents the token. This contrasts with the representation of tokens in Solidity, which is typically a single large “mapping” from accounts to the numbers of tokens they own.

  • If a transaction involves two accounts that interact only with each other, that transaction can happen in parallel with other transactions. Programmable resources supports higher thruput

    • it possible to automatically verify that programs do not have certain kinds of errors: for example, that a resource is never silently dropped or duplicated
  • Move also has built-in support for formal verification and intentionally excludes language constructs that tend to make formal verification difficult.

  • Move supports generics

    • programming paradigm that allows types (such as data structures and functions) to be parameterized by other types. This enables writing code that can work with different types without sacrificing type safety or code duplication
    • Type-safety (is specified), but the type is a generic identity function T
  • Move implements a Rust-like ownership system for values of struct types, where each value is owned by the variable or field that contains it

    • References do not own any values to which they point. By default, struct values can only be moved to another owner. They cannot be copied or dropped.
    • Move has a typing feature called abilities that controls what actions are permissible for a value of a given type - Copy, Drop, Store, Key
  • A resource is a struct that has only key and store abilities. Resources cannot be copied or dropped. This makes resources suitable for directly representing items of value such as coins

  • A reference is a type of pointer that includes restrictions on how it can be used. When code creates a reference, the reference does not take ownership of the data. Instead, the code borrows the ability to read or write the data to avoid dangling references that can lead to vulnerabilities.

    • References to references are not allowed, and references cannot be stored in structs
  • Move has only expressions, not statements. The left-hand side and right-hand side of an if expression must have the same types.

  • In formal verification, a programmer writes specifications to mathematically express the desired behavior of the code. A tool checks the code meets the specs. If the check succeeds, the tool could not find any situation under which the specification would be violated.

    • But, there's always the possibility that the tool or the compiler contains a bug that could cause such a violation.
    • It may also fail to check complex code and requires specifications for smaller parts of the code to be added
  • Solidity has SMTChecker tool for requires and asserts. Move formal verification enables the specification of more complex properties. The Move development environment includes a checker called the Move Prover. The Move Prover uses Satisfiability Modulo Theory to prove specifications

  1. Move syntax
  • variables using let are immutable unless declared with mut, but same-name variables can be used for shadowing, so they have different values depending on the block of execution

  • Move does support negative integers (?) subtraction aborts of result is less than zero

  • Move supports casting (x as u16)

  • Move does not support overflow or underflow as a safety feature. additions will throw an error if the result is too large for the int type

  • Special type address and can be represented in hexadex 0x or named addresses defined in the manifest

  • Conversions use ::. Casting is explicit type coercion, while conversions use implicit conversion functions in the standard lib or compiler. Use casting for narrowing conversions or casting between known compatible types.