Skip to content

Commit

Permalink
chore(protocol): remove tokenomics and format solidity file (#13822) (#…
Browse files Browse the repository at this point in the history
…13829)

Co-authored-by: dantaik <[email protected]>
Co-authored-by: dave | d1onys1us <[email protected]>
  • Loading branch information
3 people authored Jun 2, 2023
1 parent b67b406 commit 0f06392
Show file tree
Hide file tree
Showing 97 changed files with 2,844 additions and 3,253 deletions.
2 changes: 1 addition & 1 deletion packages/protocol/.solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"avoid-low-level-calls": "off",
"compiler-version": ["error", "^0.8.18"],
"func-visibility": ["warn", { "ignoreConstructors": true }],
"max-line-length": ["warn", 100],
"max-line-length": "off",
"no-empty-blocks": "off",
"no-inline-assembly": "off",
"not-rely-on-time": "off",
Expand Down
14 changes: 7 additions & 7 deletions packages/protocol/contracts/L1/TaikoConfig.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,39 @@

pragma solidity ^0.8.18;

import {TaikoData} from "../L1/TaikoData.sol";
import { TaikoData } from "../L1/TaikoData.sol";

library TaikoConfig {
function getConfig() internal pure returns (TaikoData.Config memory) {
return TaikoData.Config({
chainId: 167,
// Two weeks if avg block time is 10 seconds
maxNumProposedBlocks: 120960,
ringBufferSize: 120960 + 10,
maxNumProposedBlocks: 120_960,
ringBufferSize: 120_960 + 10,
// Each time one more block is verified, there will be ~20k
// more gas cost.
maxVerificationsPerTx: 10,
// Set it to 6M, since its the upper limit of the Alpha-2
// testnet's circuits.
blockMaxGasLimit: 6000000,
blockMaxGasLimit: 6_000_000,
// Set it to 79 (+1 TaikoL2.anchor transaction = 80),
// and 80 is the upper limit of the Alpha-2 testnet's circuits.
maxTransactionsPerBlock: 79,
minEthDepositsPerBlock: 8,
maxEthDepositsPerBlock: 32,
maxEthDepositAmount: 10000 ether,
maxEthDepositAmount: 10_000 ether,
minEthDepositAmount: 1 ether,
// Set it to 120KB, since 128KB is the upper size limit
// of a geth transaction, so using 120KB for the proposed
// transactions list calldata, 8K for the remaining tx fields.
maxBytesPerTxList: 120000,
maxBytesPerTxList: 120_000,
proofCooldownPeriod: 30 minutes,
systemProofCooldownPeriod: 15 minutes,
// Only need 1 real zkp per 10 blocks.
// If block number is N, then only when N % 10 == 0, the real ZKP
// is needed. For mainnet, this must be 0 or 1.
realProofSkipSize: 10,
ethDepositGas: 21000,
ethDepositGas: 21_000,
ethDepositMaxFee: 1 ether / 10,
txListCacheExpiry: 0,
relaySignalRoot: false
Expand Down
18 changes: 7 additions & 11 deletions packages/protocol/contracts/L1/TaikoData.sol
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,10 @@ library TaikoData {

struct StateVariables {
uint64 blockFee;
uint64 accBlockFees;
uint64 genesisHeight;
uint64 genesisTimestamp;
uint64 numBlocks;
uint64 proofTimeIssued;
uint64 proofTimeTarget;
uint64 lastVerifiedBlockId;
uint64 accProposedAt;
uint64 nextEthDepositToProcess;
uint64 numEthDeposits;
}
Expand Down Expand Up @@ -121,11 +117,11 @@ library TaikoData {
struct State {
// Ring buffer for proposed blocks and a some recent verified blocks.
mapping(uint256 blockId_mode_ringBufferSize => Block) blocks;
// solhint-disable-next-line max-line-length
mapping(
uint256 blockId
=> mapping(
bytes32 parentHash => mapping(uint32 parentGasUsed => uint256 forkChoiceId)
bytes32 parentHash
=> mapping(uint32 parentGasUsed => uint256 forkChoiceId)
)
) forkChoiceIds;
mapping(address account => uint256 balance) taikoTokenBalances;
Expand All @@ -135,19 +131,19 @@ library TaikoData {
// Slot 7: never or rarely changed
uint64 genesisHeight;
uint64 genesisTimestamp;
uint16 adjustmentQuotient;
uint16 __reserved70;
uint48 __reserved71;
uint64 __reserved72;
// Slot 8
uint64 accProposedAt;
uint64 accBlockFees;
uint64 __reserved80;
uint64 __reserved81;
uint64 numBlocks;
uint64 nextEthDepositToProcess;
// Slot 9
uint64 blockFee;
uint64 proofTimeIssued;
uint64 __reserved90;
uint64 lastVerifiedBlockId;
uint64 proofTimeTarget;
uint64 __reserved91;
// Reserved
uint256[42] __gap;
}
Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/contracts/L1/TaikoErrors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
pragma solidity ^0.8.18;

abstract contract TaikoErrors {
// The following custom errors must match the definitions in other V1 libraries.
// The following custom errors must match the definitions in other V1
// libraries.
error L1_ALREADY_PROVEN();
error L1_BLOCK_ID();
error L1_EVIDENCE_MISMATCH(bytes32 expected, bytes32 actual);
error L1_FORK_CHOICE_NOT_FOUND();
error L1_INSUFFICIENT_TOKEN();
error L1_INVALID_CONFIG();
error L1_INVALID_ETH_DEPOSIT();
error L1_INVALID_EVIDENCE();
Expand Down
14 changes: 10 additions & 4 deletions packages/protocol/contracts/L1/TaikoEvents.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@

pragma solidity ^0.8.18;

import {TaikoData} from "./TaikoData.sol";
import { TaikoData } from "./TaikoData.sol";

abstract contract TaikoEvents {
// The following events must match the definitions in corresponding L1 libraries.
event BlockProposed(uint256 indexed id, TaikoData.BlockMetadata meta, uint64 blockFee);
// The following events must match the definitions in corresponding L1
// libraries.
event BlockProposed(
uint256 indexed id, TaikoData.BlockMetadata meta, uint64 blockFee
);

event BlockProven(
uint256 indexed id,
Expand All @@ -26,6 +29,9 @@ abstract contract TaikoEvents {
event EthDeposited(TaikoData.EthDeposit deposit);

event ProofParamsChanged(
uint64 proofTimeTarget, uint64 proofTimeIssued, uint64 blockFee, uint16 adjustmentQuotient
uint64 proofTimeTarget,
uint64 proofTimeIssued,
uint64 blockFee,
uint16 adjustmentQuotient
);
}
Loading

0 comments on commit 0f06392

Please sign in to comment.