Skip to content

Commit

Permalink
fix: update scripts (kkrt-labs#565)
Browse files Browse the repository at this point in the history
<!--- Please provide a general summary of your changes in the title
above -->
An error caused the deployment script to crash when missing an evm
private key in the .env file.

<!-- Give an estimate of the time you spent on this PR in terms of work
days. Did you spend 0.5 days on this PR or rather 2 days? -->

Time spent on this PR: N/A

## Pull request type

<!-- Please try to limit your pull request to one type, submit multiple
pull requests if needed. -->

Please check the type of change your PR introduces:

- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, renaming)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] Documentation content changes
- [ ] Other (please describe):

## What is the current behavior?

<!-- Please describe the current behavior that you are modifying, or
link to a relevant issue. -->
Error in script prevents CI deployment of contracts.

Resolves N/A

## What is the new behavior?

<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Scripts are updated in order to allow deployment with missing evm
private key.
  • Loading branch information
greged93 authored Apr 7, 2023
1 parent 149037e commit 97587af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
9 changes: 6 additions & 3 deletions scripts/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,12 @@

ETH_TOKEN_ADDRESS = 0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7
EVM_PRIVATE_KEY = os.getenv("EVM_PRIVATE_KEY")
EVM_ADDRESS = keys.PrivateKey(
bytes.fromhex(EVM_PRIVATE_KEY[2:])
).public_key.to_checksum_address()
EVM_ADDRESS = (
EVM_PRIVATE_KEY
and keys.PrivateKey(
bytes.fromhex(EVM_PRIVATE_KEY[2:])
).public_key.to_checksum_address()
)
NETWORK = os.getenv("STARKNET_NETWORK", "starknet-devnet")
NETWORK = (
"testnet"
Expand Down
6 changes: 3 additions & 3 deletions scripts/deploy_kakarot.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
from math import ceil, log

from scripts.constants import CHAIN_ID, EVM_ADDRESS, GATEWAY_CLIENT
from scripts.utils import (
from scripts.utils.starknet import (
declare,
deploy,
deploy_and_fund_evm_address,
dump_declarations,
dump_deployments,
get_account,
get_declarations,
get_eth_contract,
get_starknet_account,
invoke,
)

Expand All @@ -25,7 +25,7 @@ async def main():
f"ℹ️ Connected to CHAIN_ID {CHAIN_ID.value.to_bytes(ceil(log(CHAIN_ID.value, 256)), 'big')} "
f"with GATEWAY {GATEWAY_CLIENT.net}"
)
account = await get_account()
account = await get_starknet_account()
logger.info(f"ℹ️ Using account {hex(account.address)} as deployer")

class_hash = {
Expand Down

0 comments on commit 97587af

Please sign in to comment.