Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: load previous db when testing with katana #1632

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
katana-db/ filter=lfs diff=lfs merge=lfs -text
katana-db/db.version filter=lfs diff=lfs merge=lfs -text
katana-db/mdbx.dat filter=lfs diff=lfs merge=lfs -text
katana-db/mdbx.lck filter=lfs diff=lfs merge=lfs -text
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ build-sol:
forge build --names --force

run-katana:
katana --chain-id test --validate-max-steps 1000000 --invoke-max-steps 9000000 --eth-gas-price 0 --strk-gas-price 0 --disable-fee --seed 0
katana --chain-id test --validate-max-steps 1000000 --invoke-max-steps 9000000 --eth-gas-price 0 --strk-gas-price 0 --disable-fee --seed 0 --db-dir ./katana-db

run-anvil:
anvil --block-base-fee-per-gas 1

run-nodes:
@echo "Starting Anvil and Katana in messaging mode"
@anvil --block-base-fee-per-gas 1 &
@katana --chain-id test --validate-max-steps 1000000 --invoke-max-steps 9000000 --eth-gas-price 0 --strk-gas-price 0 --disable-fee --messaging .katana/messaging_config.json --seed 0
@katana --chain-id test --validate-max-steps 1000000 --invoke-max-steps 9000000 --eth-gas-price 0 --strk-gas-price 0 --disable-fee --messaging .katana/messaging_config.json --seed 0 --db-dir ./katana-db
13 changes: 11 additions & 2 deletions kakarot_scripts/deployment/kakarot_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
EVM_ADDRESS,
NETWORK,
RPC_CLIENT,
NetworkType,
)
from kakarot_scripts.utils.starknet import deploy as deploy_starknet
from kakarot_scripts.utils.starknet import (
Expand All @@ -34,8 +33,18 @@ async def deploy_or_upgrade_kakarot(owner):
class_hash = get_declarations()
starknet_deployments = get_deployments()

if starknet_deployments.get("kakarot"):
try:
deployed_class_hash = await RPC_CLIENT.get_class_hash_at(
starknet_deployments["kakarot"]
)
except Exception:
deployed_class_hash = None
else:
deployed_class_hash = None

# Deploy or upgrade Kakarot
if starknet_deployments.get("kakarot") and NETWORK["type"] is not NetworkType.DEV:
if deployed_class_hash:
logger.info("ℹ️ Kakarot already deployed, checking version.")
deployed_class_hash = await RPC_CLIENT.get_class_hash_at(
starknet_deployments["kakarot"]
Expand Down
3 changes: 3 additions & 0 deletions katana-db/db.version
Git LFS file not shown
3 changes: 3 additions & 0 deletions katana-db/mdbx.dat
Git LFS file not shown
3 changes: 3 additions & 0 deletions katana-db/mdbx.lck
Git LFS file not shown
Loading