make anvil-deploy can create a new orb but then perform the oath swearing on a different orb.
The reason for this is that the oath swearing would always be done on whatever orb is specified in your environment file's ORB_ADDRESS instead of using the newly created orb's address.
Solution
The simplest way to fix this should be to pass the new orb's address to the other contract calls instead of relying on a value from the env file!
We can do this quite easily by not treating the orb creation and oath swearing as two different local deployment scripts, and instead use flags to determine which actions should be run, i.e:
forge script ... or WITH_OATH=true forge script ...
The Makefile functionality remains the same, so:
make deploy-anvil calls the script with WITH_OATH=true so that the orb gets created with an oath by default.
make deploy-anvil-oathless calls the script without the WITH_OATH flag
One thing that this changes is that transactions from the script will no longer be batched into 1 block, but instead be mined at 1 tx per block.
Bug
make anvil-deploy
can create a new orb but then perform the oath swearing on a different orb.The reason for this is that the oath swearing would always be done on whatever orb is specified in your environment file's
ORB_ADDRESS
instead of using the newly created orb's address.Solution
The simplest way to fix this should be to pass the new orb's address to the other contract calls instead of relying on a value from the env file!
We can do this quite easily by not treating the orb creation and oath swearing as two different local deployment scripts, and instead use flags to determine which actions should be run, i.e:
forge script ...
orWITH_OATH=true forge script ...
The Makefile functionality remains the same, so:
make deploy-anvil
calls the script withWITH_OATH=true
so that the orb gets created with an oath by default.make deploy-anvil-oathless
calls the script without theWITH_OATH
flagOne thing that this changes is that transactions from the script will no longer be batched into 1 block, but instead be mined at 1 tx per block.
This seems to be a Forge quirk due to the fact that we're using multiple private keys in the same script.
However, as long as you have automining turned on, the script should only take ~ 10 seconds to complete:
https://github.com/orbland/orb/assets/2598660/67d631a8-7fdc-4fb3-8f0a-f536eecc28fd