Surfpoolでanchor testすると「Transaction simulation failed」エラー

現象

Surfpool (txtx) をインストールして anchor testすると以下のエラーが発生。

Transaction simulation failed: This program may not be used for executing instructions 

原因

surfpool startしたディレクトリにAnchorで作ったプロジェクトが入っていないため。

対応

Anchorで作ったプロジェクトが入っているディレクトリに移動してから、 surfpool start する。

備考

Surfpoolインストールからanchor testまでの流れ。

1つ目のターミナル

% brew tap txtx/taps
% brew install txtx/taps/surfpool

% anchor init my-project
% cd my-project

% surfpool start
<Enterを連打>

2つ目のターミナル

% cd my-project
% anchor test

参考: Surfpool in Action — Build, Test, Deploy, Repeat