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

refactor: remove coinbase constructor arg #1438

Merged
merged 8 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion kakarot_scripts/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class ChainId(IntEnum):
ETH_TOKEN_ADDRESS = 0x49D36570D4E46F48E99674BD3FCC84644DDD6B96F7C741B1562B82F9E004DC7
COINBASE = int(
ClementWalter marked this conversation as resolved.
Show resolved Hide resolved
os.getenv("KAKAROT_COINBASE_RECIPIENT")
or "0x20eB005C0b9c906691F885eca5895338E15c36De",
or "0x20eB005C0b9c906691F885eca5895338E15c36De", # Defaults to faucet on appchain sepolia
16,
)
CAIRO_ZERO_DIR = Path("src")
Expand Down
12 changes: 9 additions & 3 deletions kakarot_scripts/deploy_kakarot.py
ClementWalter marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
ARACHNID_PROXY_DEPLOYER,
ARACHNID_PROXY_SIGNED_TX,
BLOCK_GAS_LIMIT,
COINBASE,
CREATEX_DEPLOYER,
CREATEX_SIGNED_TX,
DECLARED_CONTRACTS,
Expand Down Expand Up @@ -63,7 +62,6 @@ async def main():
class_hash["account_contract"], # account_contract_class_hash_
class_hash["uninitialized_account"], # uninitialized_account_class_hash_
class_hash["Cairo1Helpers"],
COINBASE,
BLOCK_GAS_LIMIT,
)
starknet_deployments["Counter"] = await deploy_starknet("Counter")
Expand Down Expand Up @@ -105,7 +103,6 @@ async def main():
class_hash["account_contract"], # account_contract_class_hash_
class_hash["uninitialized_account"], # uninitialized_account_class_hash_
class_hash["Cairo1Helpers"],
COINBASE,
BLOCK_GAS_LIMIT,
)
await invoke(
Expand Down Expand Up @@ -149,6 +146,15 @@ async def main():
)
await invoke("kakarot", "set_coinbase", int(bridge.address, 16))

coinbase = await RPC_CLIENT.call_contract(
starknet_deployments["kakarot"]["address"], "get_coinbase"
)

if coinbase == 0:
logger.error("❌ Coinbase is set to 0, all transaction fees will be lost")
else:
logger.info(f"✅ Coinbase set to: 0x{coinbase:040x}")

weth = await deploy_evm("WETH", "WETH9")
evm_deployments["WETH"] = {
"address": int(weth.address, 16),
Expand Down
2 changes: 0 additions & 2 deletions src/kakarot/kakarot.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr
account_contract_class_hash: felt,
uninitialized_account_class_hash: felt,
cairo1_helpers_class_hash: felt,
coinbase: felt,
block_gas_limit: felt,
) {
return Kakarot.constructor(
Expand All @@ -87,7 +86,6 @@ func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr
account_contract_class_hash,
uninitialized_account_class_hash,
cairo1_helpers_class_hash,
coinbase,
block_gas_limit,
);
}
Expand Down
3 changes: 0 additions & 3 deletions src/kakarot/library.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,19 @@ namespace Kakarot {
// @param account_contract_class_hash The clash hash of the contract account.
// @param uninitialized_account_class_hash The class hash of the uninitialized account used for deterministic address calculation.
// @param cairo1_helpers_class_hash The precompiles class hash for precompiles not implemented in Kakarot.
// @param coinbase The EOA whose key is owned by the deployer (or known to be owned by Coinbase)
func constructor{syscall_ptr: felt*, pedersen_ptr: HashBuiltin*, range_check_ptr}(
owner: felt,
native_token_address,
account_contract_class_hash,
uninitialized_account_class_hash,
cairo1_helpers_class_hash,
coinbase,
block_gas_limit,
) {
Ownable.initializer(owner);
Kakarot_native_token_address.write(native_token_address);
Kakarot_account_contract_class_hash.write(account_contract_class_hash);
Kakarot_uninitialized_account_class_hash.write(uninitialized_account_class_hash);
Kakarot_cairo1_helpers_class_hash.write(cairo1_helpers_class_hash);
Kakarot_coinbase.write(coinbase);
Kakarot_block_gas_limit.write(block_gas_limit);
return ();
}
Expand Down
5 changes: 0 additions & 5 deletions tests/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@
# Account balance is the amount of funds that the account has after being deployed
ACCOUNT_BALANCE = PRE_FUND_AMOUNT

# Coinbase address is the address of the sequencer
MOCK_COINBASE_ADDRESS = (
0x388CA486B82E20CC81965D056B4CDCAACDFFE0CF08E20ED8BA10EA97A487004
)

# STACK
STACK_MAX_DEPTH = 1024

Expand Down
Loading