 			else {
 				fatalError("invalid payload")
 			}
-			block.nonce = SQLBlock.NonceType(nonce)
+			block.nonce = nonceValue
 			block.signature = hash
 			assert(block.isSignatureValid, "persisted block signature is invalid! \(block)")
 			return block
 		}
+
+		assert(!res.hasRow, "invalid block data from storage")
 		return nil
 	}
 }

	}

	func archive(block: SQLBlock) throws {
		let insertStatement = SQLStatement.insert(SQLInsert(
			orReplace: false,
			into: self.table,

		let res = try self.database.perform(stmt.sql(dialect: self.database.dialect))
		if res.hasRow,
			case .int(let index) = res.values[1],
			case .blob(let nonce) = res.values[2],
			case .blob(let previousData) = res.values[3],
			nonce.count == MemoryLayout<SQLBlock.NonceType>.size {
			let previous = SQLBlock.HashType(hash: previousData)
			assert(index >= 0, "Index must be positive")

			var nonceValue: SQLBlock.NonceType = 0
			let buffer = UnsafeMutableBufferPointer(start: &nonceValue, count: 1)
			_ = nonce.copyBytes(to: buffer)

			// Payload can be null or block
			var block: SQLBlock
