Skip to content

Commit

Permalink
Cleaner ver
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Nov 18, 2020
1 parent 93fab6d commit bcc8fca
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 125 deletions.
2 changes: 1 addition & 1 deletion contracts/contracts/Config.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ contract Config {
uint constant UPGRADE_NOTICE_PERIOD = MASS_FULL_EXIT_PERIOD + PRIORITY_EXPIRATION_PERIOD + TIME_TO_WITHDRAW_FUNDS_FROM_FULL_EXIT;

/// @dev Timestamp - seconds since unix epoch
uint constant COMMIT_TIMESTAMP_NOT_OLDER = 2 hours;
uint constant COMMIT_TIMESTAMP_NOT_OLDER = 8 hours;

/// @dev Maximum available error between real commit block timestamp and analog used in the verifier (in seconds)
/// @dev Must be used cause miner's `block.timestamp` value can differ on some small value (as we know - 15 seconds)
Expand Down
26 changes: 11 additions & 15 deletions contracts/contracts/Storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ contract Storage {
uint public upgradePreparationActivationTime;

/// @dev Verifier contract. Used to verify block proof and exit proof
Verifier internal verifier;
Verifier public verifier;

/// @dev Governance contract. Contains the governor (the owner) of whole system, validators list, possible tokens list
Governance internal governance;
Governance public governance;

struct BalanceToWithdraw {
uint128 balanceToWithdraw;
Expand All @@ -37,24 +37,22 @@ contract Storage {
/// @notice Root-chain balances (per owner and token id, see packAddressAndTokenId) to withdraw
mapping(bytes22 => BalanceToWithdraw) public balancesToWithdraw;

/// @notice verified withdrawal pending to be executed.
struct PendingWithdrawal {
// @dev Pending withdrawals are not used in this version
struct PendingWithdrawal_DEPRECATED {
address to;
uint16 tokenId;
}

/// @notice Verified but not executed withdrawals for addresses stored in here (key is pendingWithdrawal's index in pending withdrawals queue)
mapping(uint32 => PendingWithdrawal) public pendingWithdrawals;
uint32 public firstPendingWithdrawalIndex;
uint32 public numberOfPendingWithdrawals;
mapping(uint32 => PendingWithdrawal_DEPRECATED) public pendingWithdrawals_DEPRECATED;
uint32 public firstPendingWithdrawalIndex_DEPRECATED;
uint32 public numberOfPendingWithdrawals_DEPRECATED;

/// @notice Total number of verified blocks i.e. blocks[totalBlocksVerified] points at the latest verified block (block 0 is genesis)
uint32 public totalBlocksVerified;

/// @notice Total number of committed blocks i.e. blocks[totalBlocksCommitted] points at the latest committed block
uint32 public totalBlocksCommitted;

/// @notice Rollup block data (once per block)
/// @Old rollup block stored data - not used in current version
/// @member validator Block producer
/// @member committedAtBlock ETH block number at which this block was committed
/// @member cumulativeOnchainOperations Total number of operations in this and all previous blocks
Expand All @@ -63,17 +61,15 @@ contract Storage {
/// @member stateRoot New tree root hash
///
/// Consider memory alignment when changing field order: https://solidity.readthedocs.io/en/v0.4.21/miscellaneous.html
struct Block {
struct Block_DEPRECATED {
uint32 committedAtBlock;
uint64 priorityOperations;
uint32 chunks;
bytes32 withdrawalsDataHash; // can be restricted to 16 bytes to reduce number of required storage slots
bytes32 commitment;
bytes32 stateRoot;
}

/// @notice Blocks by Franklin block id
mapping(uint32 => Block) public blocks;
mapping(uint32 => Block_DEPRECATED) public blocks_DEPRECATED;

/// @notice Onchain operations - operations processed inside rollup blocks
/// @member opType Onchain operation type
Expand Down Expand Up @@ -129,7 +125,7 @@ contract Storage {
return balancesToWithdraw[packAddressAndTokenId(_address, _tokenId)].balanceToWithdraw;
}

/// @notice Block info stored hashed in contract storage
/// @Rollup block stored data - not used in current version
struct StoredBlockInfo {
uint32 blockNumber;
uint64 priorityOperations;
Expand Down
Loading

0 comments on commit bcc8fca

Please sign in to comment.