Skip to content

Commit

Permalink
mirror sync to 7381458849b42
Browse files Browse the repository at this point in the history
  • Loading branch information
mm-zk authored Sep 5, 2023
1 parent ae905bd commit de72432
Show file tree
Hide file tree
Showing 9 changed files with 983 additions and 265 deletions.
8 changes: 4 additions & 4 deletions SystemConfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"GUARANTEED_PUBDATA_BYTES": 4000,
"MAX_PUBDATA_PER_BLOCK": 110000,
"MAX_TRANSACTIONS_IN_BLOCK": 1024,
"BLOCK_OVERHEAD_L2_GAS": 1200000,
"BLOCK_OVERHEAD_L1_GAS": 1000000,
"MAX_PUBDATA_PER_BATCH": 110000,
"MAX_TRANSACTIONS_IN_BATCH": 1024,
"BATCH_OVERHEAD_L2_GAS": 1200000,
"BATCH_OVERHEAD_L1_GAS": 1000000,
"L2_TX_INTRINSIC_GAS": 14070,
"L2_TX_INTRINSIC_PUBDATA": 0,
"L1_TX_INTRINSIC_L2_GAS": 167157,
Expand Down
504 changes: 373 additions & 131 deletions bootloader/bootloader.yul

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions contracts/ContractDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import "./interfaces/ISystemContract.sol";
contract ContractDeployer is IContractDeployer, ISystemContract {
/// @notice Information about an account contract.
/// @dev For EOA and simple contracts (i.e. not accounts) this value is 0.
mapping(address => AccountInfo) internal _accountInfo;
mapping(address => AccountInfo) internal accountInfo;

modifier onlySelf() {
require(msg.sender == address(this), "Callable only by self");
Expand All @@ -31,13 +31,13 @@ contract ContractDeployer is IContractDeployer, ISystemContract {

/// @notice Returns information about a certain account.
function getAccountInfo(address _address) external view returns (AccountInfo memory info) {
return _accountInfo[_address];
return accountInfo[_address];
}

/// @notice Returns the account abstraction version if `_address` is a deployed contract.
/// Returns the latest supported account abstraction version if `_address` is an EOA.
function extendedAccountVersion(address _address) public view returns (AccountAbstractionVersion) {
AccountInfo memory info = _accountInfo[_address];
AccountInfo memory info = accountInfo[_address];
if (info.supportedAAVersion != AccountAbstractionVersion.None) {
return info.supportedAAVersion;
}
Expand All @@ -52,14 +52,14 @@ contract ContractDeployer is IContractDeployer, ISystemContract {

/// @notice Stores the new account information
function _storeAccountInfo(address _address, AccountInfo memory _newInfo) internal {
_accountInfo[_address] = _newInfo;
accountInfo[_address] = _newInfo;
}

/// @notice Update the used version of the account.
/// @param _version The new version of the AA protocol to use.
/// @dev Note that it allows changes from account to non-account and vice versa.
function updateAccountVersion(AccountAbstractionVersion _version) external onlySystemCall {
_accountInfo[msg.sender].supportedAAVersion = _version;
accountInfo[msg.sender].supportedAAVersion = _version;

emit AccountVersionUpdated(msg.sender, _version);
}
Expand All @@ -68,7 +68,7 @@ contract ContractDeployer is IContractDeployer, ISystemContract {
/// it only allows changes from sequential to arbitrary ordering.
/// @param _nonceOrdering The new nonce ordering to use.
function updateNonceOrdering(AccountNonceOrdering _nonceOrdering) external onlySystemCall {
AccountInfo memory currentInfo = _accountInfo[msg.sender];
AccountInfo memory currentInfo = accountInfo[msg.sender];

require(
_nonceOrdering == AccountNonceOrdering.Arbitrary &&
Expand Down
2 changes: 1 addition & 1 deletion contracts/L1Messenger.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import "./libraries/EfficientCall.sol";
contract L1Messenger is IL1Messenger {
/// @notice Sends an arbitrary length message to L1.
/// @param _message The variable length message to be sent to L1.
/// @return hash Returns the keccak256 hashed value of the message.
/// @return hash The keccak256 hashed value of the message.
function sendToL1(bytes calldata _message) external override returns (bytes32 hash) {
hash = EfficientCall.keccak(_message);

Expand Down
442 changes: 392 additions & 50 deletions contracts/SystemContext.sol

Large diffs are not rendered by default.

33 changes: 26 additions & 7 deletions contracts/interfaces/ISystemContext.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,25 @@ pragma solidity ^0.8.0;
* block-scoped, tx-scoped or system-wide.
*/
interface ISystemContext {
struct BlockInfo {
uint128 timestamp;
uint128 number;
}

/// @notice A structure representing the timeline for the upgrade from the batch numbers to the L2 block numbers.
/// @dev It will used for the L1 batch -> L2 block migration in Q3 2023 only.
struct VirtualBlockUpgradeInfo {
/// @notice In order to maintain consistent results for `blockhash` requests, we'll
/// have to remember the number of the batch when the upgrade to the virtual blocks has been done.
/// The hashes for virtual blocks before the upgrade are identical to the hashes of the corresponding batches.
uint128 virtualBlockStartBatch;

/// @notice L2 block when the virtual blocks have caught up with the L2 blocks. Starting from this block,
/// all the information returned to users for block.timestamp/number, etc should be the information about the L2 blocks and
/// not virtual blocks.
uint128 virtualBlockFinishL2Block;
}

function chainId() external view returns (uint256);

function origin() external view returns (address);
Expand All @@ -22,15 +41,15 @@ interface ISystemContext {

function baseFee() external view returns (uint256);

function blockHash(uint256 _block) external view returns (bytes32);

function getBlockHashEVM(uint256 _block) external view returns (bytes32);

function getBlockNumberAndTimestamp() external view returns (uint256 blockNumber, uint256 blockTimestamp);
function getBatchHash(uint256 _batchNumber) external view returns (bytes32 hash);

function getBlockNumber() external view returns (uint128);

function getBlockTimestamp() external view returns (uint128);

// Note, that for now, the implementation of the bootloader allows this variables to
// be incremented multiple times inside a block, so it should not relied upon right now.
function getBlockNumber() external view returns (uint256);
function getBatchNumberAndTimestamp() external view returns (uint128 blockNumber, uint128 blockTimestamp);

function getBlockTimestamp() external view returns (uint256);
function getL2BlockNumberAndTimestamp() external view returns (uint128 blockNumber, uint128 blockTimestamp);
}
Loading

0 comments on commit de72432

Please sign in to comment.