This page outlines some of the critical differences between Sway and Solidity, and between the FuelVM and the EVM.
Words in the FuelVM are 64 bits (8 bytes), rather than the 256 bits (32 bytes) of the EVM. Therefore, primitive integers only go up to
u64, and hashes (the
b256 type) are not in registers but rather in memory. A
b256 is therefore a pointer to a 32-byte memory region containing the hash value.
Only unsigned integers are provided as primitives:
u64. Signed integer arithmetic is not available in the FuelVM. Signed integers and signed integer arithmetic can be implemented in high-level libraries if needed.
Panics in the FuelVM (called "reverts" in Solidity and the EVM) are global, i.e. they cannot be caught. A panic will completely and unconditionally revert the stateful effects of a transaction, minus gas used.
Math in the FuelVM is by default safe (i.e. any overflow or exception is a panic). Safety checks are performed natively in the VM implementation, rather than at the bytecode level like Solidity's default safe math.
There is no practical code size limit to Sway contracts. The physical limit is governed by the
VM_MAX_RAM VM parameter, which at the time of writing is 64 MiB.
Account types in the FuelVM have type-safe wrappers around primitive
b256 hashes to clearly distinguish their respective types. The wrapper
Address mirrors that of an EOA (Externally Owned Account) and has the ability to hold UTXOs in the context of the EVM. The other wrapper,
ContractId, reflects that of a deployed contract in the EVM but cannot hold UTXOs.