orbland / contracts

🔮 Orb and related contracts. Auction + Harberger taxed ownership + invocations.
https://orb.land
MIT License
22 stars 5 forks source link

Make sure oath is sworn for newly created orb #154

Closed t4t5 closed 1 year ago

t4t5 commented 1 year ago

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 ... or WITH_OATH=true forge script ...

The Makefile functionality remains the same, so:


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.

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