Skip to content

Commit

Permalink
rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Nov 30, 2023
1 parent a246857 commit 42fee21
Show file tree
Hide file tree
Showing 40 changed files with 5,173 additions and 3,370 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: IBlobHashReader
---

## IBlobHashReader

_Labeled in AddressResolver as "blob_hash_reader"
This interface and its corresponding implementation may deprecate once
solidity supports the new BLOBHASH opcode natively._

### getFirstBlobHash

```solidity
function getFirstBlobHash() external view returns (bytes32)
```

Returns the versioned hash for the first blob in this
transaction. If there is no blob found, 0x0 is returned.
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
title: Lib4844
---

## Lib4844

A library for handling EIP-4844 blobs
`solc contracts/libs/Lib4844.sol --ir > contracts/libs/Lib4844.yul`

### POINT_EVALUATION_PRECOMPILE_ADDRESS

```solidity
address POINT_EVALUATION_PRECOMPILE_ADDRESS
```

### FIELD_ELEMENTS_PERBLOB

```solidity
uint32 FIELD_ELEMENTS_PERBLOB
```

### BLS_MODULUS

```solidity
uint256 BLS_MODULUS
```

### EVAL_FAILED

```solidity
error EVAL_FAILED()
```

### POINT_X_TOO_LARGE

```solidity
error POINT_X_TOO_LARGE()
```

### POINT_Y_TOO_LARGE

```solidity
error POINT_Y_TOO_LARGE()
```

### evaluatePoint

```solidity
function evaluatePoint(bytes32 blobHash, uint256 x, uint256 y, bytes1[48] commitment, bytes1[48] pointProof) internal view
```

Evaluates the 4844 point using the precompile.

#### Parameters

| Name | Type | Description |
| ---------- | ---------- | -------------------- |
| blobHash | bytes32 | The versioned hash |
| x | uint256 | The evaluation point |
| y | uint256 | The expected output |
| commitment | bytes1[48] | The input kzg point |
| pointProof | bytes1[48] | The quotient kzg |
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ _Struct holding Taiko configuration parameters. See {TaikoConfig}._

```solidity
struct Config {
uint256 chainId;
bool relaySignalRoot;
uint64 chainId;
uint64 blockMaxProposals;
uint64 blockRingBufferSize;
uint64 maxBlocksToVerifyPerProposal;
uint32 blockMaxGasLimit;
uint32 blockFeeBaseGas;
uint24 blockMaxTxListBytes;
uint256 blockTxListExpiry;
uint256 proposerRewardPerSecond;
uint256 proposerRewardMax;
uint24 blobExpiry;
bool blobAllowedForDA;
uint96 livenessBond;
uint256 ethDepositRingBufferSize;
uint64 ethDepositMinCountPerBlock;
Expand All @@ -35,83 +32,97 @@ struct Config {
}
```

### StateVariables
### TierFee

_Struct holding state variables._
_Struct representing prover assignment_

```solidity
struct StateVariables {
uint64 genesisHeight;
uint64 genesisTimestamp;
uint64 nextEthDepositToProcess;
uint64 numEthDeposits;
uint64 numBlocks;
uint64 lastVerifiedBlockId;
struct TierFee {
uint16 tier;
uint128 fee;
}
```

### ProverAssignment and TierFee
### TierProof

_Struct representing prover assignment and associated tiers_
```solidity
struct TierProof {
uint16 tier;
bytes data;
}
```

### HookCall

```solidity
struct TierFee {
uint16 tier;
uint256 fee;
struct HookCall {
address hook;
bytes data;
}
```

### BlockParams

struct ProverAssignment {
address prover;
address feeToken;
TierFee[] tierFees;
uint64 expiry;
bytes signature;
```solidity
struct BlockParams {
address assignedProver;
bytes32 extraData;
bytes32 blobHash;
uint24 txListByteOffset;
uint24 txListByteSize;
bool cacheBlobForReuse;
bytes32 parentMetaHash;
struct TaikoData.HookCall[] hookCalls;
}
```

### BlockMetadata

_Struct containing data only required for proving a block
Warning: changing this struct requires changing {LibUtils.hashMetadata}
accordingly._
Note: On L2, `block.difficulty` is the pseudo name of
`block.prevrandao`, which returns a random number provided by the layer
1 chain._

```solidity
struct BlockMetadata {
bytes32 l1Hash;
bytes32 mixHash;
bytes32 txListHash;
bytes32 difficulty;
bytes32 blobHash;
bytes32 extraData;
bytes32 depositsHash;
address coinbase;
uint64 id;
uint32 gasLimit;
uint64 timestamp;
uint64 l1Height;
uint32 gasLimit;
address coinbase;
TaikoData.EthDeposit[] depositsProcessed;
uint24 txListByteOffset;
uint24 txListByteSize;
uint16 minTier;
bool blobUsed;
bytes32 parentMetaHash;
}
```

### BlockEvidence
### Transition

_Struct representing block evidence._
_Struct representing transition to be proven._

```solidity
struct BlockEvidence {
bytes32 metaHash;
struct Transition {
bytes32 parentHash;
bytes32 blockHash;
bytes32 signalRoot;
bytes32 graffiti;
uint16 tier;
bytes proof;
}
```

### Transition
### TransitionState

_Struct representing state transition data.
10 slots reserved for upgradability, 6 slots used._

```solidity
struct Transition {
struct TransitionState {
bytes32 key;
bytes32 blockHash;
bytes32 signalRoot;
Expand All @@ -121,6 +132,7 @@ struct Transition {
uint96 contestBond;
uint64 timestamp;
uint16 tier;
uint8 contestations;
bytes32[4] __reserved;
}
```
Expand All @@ -137,9 +149,9 @@ struct Block {
uint96 livenessBond;
uint64 blockId;
uint64 proposedAt;
uint64 proposedIn;
uint32 nextTransitionId;
uint32 verifiedTransitionId;
uint16 minTier;
bytes32[7] __reserved;
}
```
Expand Down Expand Up @@ -179,9 +191,8 @@ struct SlotA {
```solidity
struct SlotB {
uint64 numBlocks;
uint64 nextEthDepositToProcess;
uint64 lastVerifiedAt;
uint64 lastVerifiedBlockId;
bool provingPaused;
}
```

Expand All @@ -192,12 +203,13 @@ _Struct holding the state variables for the {TaikoL1} contract._
```solidity
struct State {
mapping(uint64 => struct TaikoData.Block) blocks;
mapping(uint64 => mapping(uint32 => struct TaikoData.Transition)) transitions;
mapping(uint64 => mapping(bytes32 => uint32)) transitionIds;
mapping(uint64 => mapping(uint32 => struct TaikoData.TransitionState)) transitions;
mapping(uint256 => uint256) ethDeposits;
mapping(address => uint256) tokenBalances;
mapping(bytes32 => uint256) reusableBlobs;
struct TaikoData.SlotA slotA;
struct TaikoData.SlotB slotB;
uint256[143] __gap;
uint256[142] __gap;
}
```
Loading

0 comments on commit 42fee21

Please sign in to comment.