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: initialize chain-id after upgrade #1631

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
6 changes: 6 additions & 0 deletions kakarot_scripts/deployment/kakarot_deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
RPC_CLIENT,
NetworkType,
)
from kakarot_scripts.utils.kakarot import eth_chain_id
from kakarot_scripts.utils.starknet import deploy as deploy_starknet
from kakarot_scripts.utils.starknet import (
dump_deployments,
Expand Down Expand Up @@ -52,6 +53,11 @@ async def deploy_or_upgrade_kakarot(owner):
"set_cairo1_helpers_class_hash",
class_hash["Cairo1Helpers"],
)

# Initialize the chain_id if it's value is not set
if await eth_chain_id() == 0:
await invoke("kakarot", "initialize_chain_id", NETWORK["chain_id"])

else:
logger.info("✅ Kakarot already up to date.")
else:
Expand Down
2 changes: 1 addition & 1 deletion kakarot_scripts/utils/kakarot.py
Original file line number Diff line number Diff line change
Expand Up @@ -700,7 +700,7 @@ async def eth_send_transaction(

payload = {
"type": 0x1,
"chainId": await eth_chain_id(),
"chainId": NETWORK["chain_id"],
"nonce": nonce,
"gas": gas,
"gasPrice": gas_price,
Expand Down
Loading