Load the state of the wallet from a file.
(load-stat state) → (mv error? stat? state)
The name suffix
serialize-read throws a hard error upon failure. This may acceptable if the shell script that calls the wallet can catch that and turn into a more user-oriented error message.
Function:
(defun load-stat (state) (declare (xargs :stobjs (state))) (declare (xargs :guard t)) (b* (((mv stat? state) (serialize-read *stat-filepath*)) ((unless (and (statp stat?) (stat-wfp stat?))) (mv (command-error-state-file-malformed) nil state))) (mv nil stat? state)))
Theorem:
(defthm maybe-command-error-p-of-load-stat.error? (b* (((mv ?error? ?stat? acl2::?state) (load-stat state))) (maybe-command-error-p error?)) :rule-classes :rewrite)
Theorem:
(defthm maybe-statp-of-load-stat.stat? (b* (((mv ?error? ?stat? acl2::?state) (load-stat state))) (maybe-statp stat?)) :rule-classes :rewrite)
Theorem:
(defthm statp-of-load-stat-when-no-error (b* (((mv error? stat? &) (load-stat state))) (implies (not error?) (statp stat?))))
Theorem:
(defthm stat-wfp-of-load-stat-when-no-error (b* (((mv error? stat? &) (load-stat state))) (implies (not error?) (stat-wfp stat?))))