You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In development environments, it is useful to have a local private network with all the contracts deployed in it. One way to achieve that is to run some development node (such as Anvil) and deploy the contracts through the deployment scripts.
One off-side to this approach is that the developer must have Node.js and pnpm installed in their local machine. Another option, if they are using Anvil as the development node, is to serialize the post-deployment state to a file.
This is an already supported feature of Anvil. Through the --dump-state option, you can serialize the state of the blockchain into a JSON file, which can be later recuperated by the --load-state command. If you want to load a state, do something, and then dump this new state into the same file, you can just use the --state command.
However, because Anvil is still under active development, and doesn't follow a strict semantic versioning approach, breaking changes can be introduced to the serialization format. Even recently, @tuler has improved Anvil by including mined transactions (see foundry-rs/foundry#8411). Because of this, it might be wise to pin a specific version of Anvil and let it be clear on the name of state file that this version should be used. A later version might be compatible, but we won't hold any warranty.
✔️ Solution
On the CI, we can run anvil --dump-state state.json and pnpm deploy:localhost (after #317).
The resulting file can be renamed to incorporate the version of Foundry used, and uploaded as a GitHub Release artifact. Users can then download this artifact through the GitHub web UI or by downloading the file directly with curl or wget. On their side, they can then run anvil --load-state state.json.
Additionally, we should also add the export/abi/localhost.json (after #317) file to the list of GitHub Release artifacts so that users can more easily interact with the contracts, knowing their addresses and ABIs.
📈 Subtasks
Edit CI to upload state file
Release an RC to test the CI
Check that state file indeed works
The text was updated successfully, but these errors were encountered:
Yes, but @cartesi/devnet includes several contracts that are, although useful, unrelated to rollups-contracts, such as dummy token contracts, and account abstraction contracts.
📚 Context
In development environments, it is useful to have a local private network with all the contracts deployed in it. One way to achieve that is to run some development node (such as Anvil) and deploy the contracts through the deployment scripts.
One off-side to this approach is that the developer must have Node.js and
pnpm
installed in their local machine. Another option, if they are using Anvil as the development node, is to serialize the post-deployment state to a file.This is an already supported feature of Anvil. Through the
--dump-state
option, you can serialize the state of the blockchain into a JSON file, which can be later recuperated by the--load-state
command. If you want to load a state, do something, and then dump this new state into the same file, you can just use the--state
command.However, because Anvil is still under active development, and doesn't follow a strict semantic versioning approach, breaking changes can be introduced to the serialization format. Even recently, @tuler has improved Anvil by including mined transactions (see foundry-rs/foundry#8411). Because of this, it might be wise to pin a specific version of Anvil and let it be clear on the name of state file that this version should be used. A later version might be compatible, but we won't hold any warranty.
✔️ Solution
On the CI, we can run
anvil --dump-state state.json
andpnpm deploy:localhost
(after #317).The resulting file can be renamed to incorporate the version of Foundry used, and uploaded as a GitHub Release artifact. Users can then download this artifact through the GitHub web UI or by downloading the file directly with
curl
orwget
. On their side, they can then runanvil --load-state state.json
.Additionally, we should also add the
export/abi/localhost.json
(after #317) file to the list of GitHub Release artifacts so that users can more easily interact with the contracts, knowing their addresses and ABIs.📈 Subtasks
The text was updated successfully, but these errors were encountered: