This repository has been archived by the owner on Dec 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix CarriedState imports * Fix default config values * Return actual fee from execution info * Add class hash to deploy transactions * Parse transaction signature as hex * Bump cairo lang version to 0.8.1 * Update Solidity files * Add web3 as dev dependency * Update default general config * Use n steps fee weight from constants * Replace current carried state with state * Update python version in README * Change npm install to npm ci
- Loading branch information
1 parent
213f1dc
commit a6c8f8e
Showing
17 changed files
with
321 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ echo "poetry: $(poetry --version)" | |
|
||
# install dependencies | ||
poetry install | ||
npm install | ||
npm ci |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
""" | ||
Default general config. | ||
""" | ||
|
||
from starkware.starknet.definitions.general_config import ( | ||
build_general_config, | ||
DEFAULT_CHAIN_ID, | ||
DEFAULT_FEE_TOKEN_ADDRESS, | ||
DEFAULT_GAS_PRICE, | ||
DEFAULT_MAX_STEPS, | ||
DEFAULT_SEQUENCER_ADDRESS, | ||
) | ||
from starkware.starknet.definitions import constants | ||
|
||
DEFAULT_GENERAL_CONFIG = build_general_config({ | ||
"cairo_resource_fee_weights": { | ||
"n_steps": constants.N_STEPS_FEE_WEIGHT, | ||
}, | ||
"contract_storage_commitment_tree_height": constants.CONTRACT_STATES_COMMITMENT_TREE_HEIGHT, | ||
"event_commitment_tree_height": constants.EVENT_COMMITMENT_TREE_HEIGHT, | ||
"global_state_commitment_tree_height": constants.CONTRACT_ADDRESS_BITS, | ||
"invoke_tx_max_n_steps": DEFAULT_MAX_STEPS, | ||
"min_gas_price": DEFAULT_GAS_PRICE, | ||
"sequencer_address": hex(DEFAULT_SEQUENCER_ADDRESS), | ||
"starknet_os_config": { | ||
"chain_id": DEFAULT_CHAIN_ID.name, | ||
"fee_token_address": hex(DEFAULT_FEE_TOKEN_ADDRESS) | ||
}, | ||
"tx_version": constants.TRANSACTION_VERSION, | ||
"tx_commitment_tree_height": constants.TRANSACTION_COMMITMENT_TREE_HEIGHT | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,51 @@ | ||
// SPDX-License-Identifier: Apache-2.0. | ||
pragma solidity ^0.6.12; | ||
|
||
interface IStarknetMessaging { | ||
// This event needs to be compatible with the one defined in Output.sol. | ||
event LogMessageToL1( | ||
uint256 indexed from_address, | ||
address indexed to_address, | ||
uint256[] payload | ||
); | ||
|
||
// An event that is raised when a message is sent from L1 to L2. | ||
event LogMessageToL2( | ||
address indexed from_address, | ||
uint256 indexed to_address, | ||
uint256 indexed selector, | ||
uint256[] payload, | ||
uint256 nonce | ||
); | ||
|
||
// An event that is raised when a message from L2 to L1 is consumed. | ||
event ConsumedMessageToL1( | ||
uint256 indexed from_address, | ||
address indexed to_address, | ||
uint256[] payload | ||
); | ||
|
||
// An event that is raised when a message from L1 to L2 is consumed. | ||
event ConsumedMessageToL2( | ||
address indexed from_address, | ||
uint256 indexed to_address, | ||
uint256 indexed selector, | ||
uint256[] payload, | ||
uint256 nonce | ||
); | ||
import "./IStarknetMessagingEvents.sol"; | ||
|
||
interface IStarknetMessaging is IStarknetMessagingEvents { | ||
/** | ||
Sends a message to an L2 contract. | ||
Returns the hash of the message. | ||
*/ | ||
function sendMessageToL2( | ||
uint256 to_address, | ||
uint256 toAddress, | ||
uint256 selector, | ||
uint256[] calldata payload | ||
) external returns (bytes32); | ||
|
||
/** | ||
Consumes a message that was sent from an L2 contract. | ||
Returns the hash of the message. | ||
*/ | ||
function consumeMessageFromL2(uint256 fromAddress, uint256[] calldata payload) | ||
external | ||
returns (bytes32); | ||
|
||
/** | ||
Starts the cancellation of an L1 to L2 message. | ||
A message can be canceled messageCancellationDelay() seconds after this function is called. | ||
Note: This function may only be called for a message that is currently pending and the caller | ||
must be the sender of the that message. | ||
*/ | ||
function startL1ToL2MessageCancellation( | ||
uint256 toAddress, | ||
uint256 selector, | ||
uint256[] calldata payload, | ||
uint256 nonce | ||
) external; | ||
|
||
/** | ||
Cancels an L1 to L2 message, this function should be called messageCancellationDelay() seconds | ||
after the call to startL1ToL2MessageCancellation(). | ||
*/ | ||
function cancelL1ToL2Message( | ||
uint256 toAddress, | ||
uint256 selector, | ||
uint256[] calldata payload, | ||
uint256 nonce | ||
) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// SPDX-License-Identifier: Apache-2.0. | ||
pragma solidity ^0.6.12; | ||
|
||
interface IStarknetMessagingEvents { | ||
// This event needs to be compatible with the one defined in Output.sol. | ||
event LogMessageToL1(uint256 indexed fromAddress, address indexed toAddress, uint256[] payload); | ||
|
||
// An event that is raised when a message is sent from L1 to L2. | ||
event LogMessageToL2( | ||
address indexed fromAddress, | ||
uint256 indexed toAddress, | ||
uint256 indexed selector, | ||
uint256[] payload, | ||
uint256 nonce | ||
); | ||
|
||
// An event that is raised when a message from L2 to L1 is consumed. | ||
event ConsumedMessageToL1( | ||
uint256 indexed fromAddress, | ||
address indexed toAddress, | ||
uint256[] payload | ||
); | ||
|
||
// An event that is raised when a message from L1 to L2 is consumed. | ||
event ConsumedMessageToL2( | ||
address indexed fromAddress, | ||
uint256 indexed toAddress, | ||
uint256 indexed selector, | ||
uint256[] payload, | ||
uint256 nonce | ||
); | ||
|
||
// An event that is raised when a message from L1 to L2 Cancellation is started. | ||
event MessageToL2CancellationStarted( | ||
address indexed fromAddress, | ||
uint256 indexed toAddress, | ||
uint256 indexed selector, | ||
uint256[] payload, | ||
uint256 nonce | ||
); | ||
|
||
// An event that is raised when a message from L1 to L2 is canceled. | ||
event MessageToL2Canceled( | ||
address indexed fromAddress, | ||
uint256 indexed toAddress, | ||
uint256 indexed selector, | ||
uint256[] payload, | ||
uint256 nonce | ||
); | ||
} |
Oops, something went wrong.