StateCommitmentChain.md 5.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
# StateCommitmentChain



> StateCommitmentChain



*The State Commitment Chain (SCC) contract contains a list of proposed state roots which Proposers assert to be a result of each transaction in the Canonical Transaction Chain (CTC). Elements here have a 1:1 correspondence with transactions in the CTC, and should be the unique state root calculated off-chain by applying the canonical transactions one by one.*

## Methods

### FRAUD_PROOF_WINDOW

```solidity
function FRAUD_PROOF_WINDOW() external view returns (uint256)
```






#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined

### SEQUENCER_PUBLISH_WINDOW

```solidity
function SEQUENCER_PUBLISH_WINDOW() external view returns (uint256)
```






#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined

### appendStateBatch

```solidity
function appendStateBatch(bytes32[] _batch, uint256 _shouldStartAtElement) external nonpayable
```

Appends a batch of state roots to the chain.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _batch | bytes32[] | Batch of state roots.
| _shouldStartAtElement | uint256 | Index of the element at which this batch should start.

### batches

```solidity
function batches() external view returns (contract IChainStorageContainer)
```

Accesses the batch storage container.




#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | contract IChainStorageContainer | Reference to the batch storage container.

### deleteStateBatch

```solidity
function deleteStateBatch(Lib_OVMCodec.ChainBatchHeader _batchHeader) external nonpayable
```

Indeavr's avatar
Indeavr committed
87
Deletes all state roots after (and including) a given batch.
88 89 90 91 92 93 94



#### Parameters

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
95
| _batchHeader | Lib_OVMCodec.ChainBatchHeader | Header of the batch to start deleting from.
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153

### getLastSequencerTimestamp

```solidity
function getLastSequencerTimestamp() external view returns (uint256 _lastSequencerTimestamp)
```

Retrieves the timestamp of the last batch submitted by the sequencer.




#### Returns

| Name | Type | Description |
|---|---|---|
| _lastSequencerTimestamp | uint256 | Last sequencer batch timestamp.

### getTotalBatches

```solidity
function getTotalBatches() external view returns (uint256 _totalBatches)
```

Retrieves the total number of batches submitted.




#### Returns

| Name | Type | Description |
|---|---|---|
| _totalBatches | uint256 | Total submitted batches.

### getTotalElements

```solidity
function getTotalElements() external view returns (uint256 _totalElements)
```

Retrieves the total number of elements submitted.




#### Returns

| Name | Type | Description |
|---|---|---|
| _totalElements | uint256 | Total submitted elements.

### insideFraudProofWindow

```solidity
function insideFraudProofWindow(Lib_OVMCodec.ChainBatchHeader _batchHeader) external view returns (bool _inside)
```

Indeavr's avatar
Indeavr committed
154
Checks whether a given batch is still inside its fraud proof window.
155 156 157 158 159 160 161



#### Parameters

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
162
| _batchHeader | Lib_OVMCodec.ChainBatchHeader | Header of the batch to check.
163 164 165 166 167

#### Returns

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
168
| _inside | bool | Whether or not the batch is inside the fraud proof window.
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214

### libAddressManager

```solidity
function libAddressManager() external view returns (contract Lib_AddressManager)
```






#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | contract Lib_AddressManager | undefined

### resolve

```solidity
function resolve(string _name) external view returns (address)
```

Resolves the address associated with a given name.



#### Parameters

| Name | Type | Description |
|---|---|---|
| _name | string | Name to resolve an address for.

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | address | Address associated with the given name.

### verifyStateCommitment

```solidity
function verifyStateCommitment(bytes32 _element, Lib_OVMCodec.ChainBatchHeader _batchHeader, Lib_OVMCodec.ChainInclusionProof _proof) external view returns (bool)
```

Indeavr's avatar
Indeavr committed
215
Verifies a batch inclusion proof.
216 217 218 219 220 221 222



#### Parameters

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
223 224 225
| _element | bytes32 | Hash of the element to verify a proof for.
| _batchHeader | Lib_OVMCodec.ChainBatchHeader | Header of the batch in which the element was included.
| _proof | Lib_OVMCodec.ChainInclusionProof | Merkle inclusion proof for the element.
226 227 228 229 230

#### Returns

| Name | Type | Description |
|---|---|---|
Mark Tyneway's avatar
Mark Tyneway committed
231
| _0 | bool | Whether or not the batch inclusion proof is verified.
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275



## Events

### StateBatchAppended

```solidity
event StateBatchAppended(uint256 indexed _batchIndex, bytes32 _batchRoot, uint256 _batchSize, uint256 _prevTotalElements, bytes _extraData)
```





#### Parameters

| Name | Type | Description |
|---|---|---|
| _batchIndex `indexed` | uint256 | undefined |
| _batchRoot  | bytes32 | undefined |
| _batchSize  | uint256 | undefined |
| _prevTotalElements  | uint256 | undefined |
| _extraData  | bytes | undefined |

### StateBatchDeleted

```solidity
event StateBatchDeleted(uint256 indexed _batchIndex, bytes32 _batchRoot)
```





#### Parameters

| Name | Type | Description |
|---|---|---|
| _batchIndex `indexed` | uint256 | undefined |
| _batchRoot  | bytes32 | undefined |