IStateCommitmentChain.md 3.56 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
# IStateCommitmentChain



> IStateCommitmentChain





## Methods

### 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.

### deleteStateBatch

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

Indeavr's avatar
Indeavr committed
36
Deletes all state roots after (and including) a given batch.
37 38 39 40 41 42 43



#### Parameters

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
44
| _batchHeader | Lib_OVMCodec.ChainBatchHeader | Header of the batch to start deleting from.
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102

### 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
103
Checks whether a given batch is still inside its fraud proof window.
104 105 106 107 108 109 110



#### Parameters

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
111
| _batchHeader | Lib_OVMCodec.ChainBatchHeader | Header of the batch to check.
112 113 114 115 116

#### Returns

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
117
| _inside | bool | Whether or not the batch is inside the fraud proof window.
118 119 120 121 122 123 124

### verifyStateCommitment

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

Indeavr's avatar
Indeavr committed
125
Verifies a batch inclusion proof.
126 127 128 129 130 131 132



#### Parameters

| Name | Type | Description |
|---|---|---|
Indeavr's avatar
Indeavr committed
133 134 135
| _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.
136 137 138 139 140

#### Returns

| Name | Type | Description |
|---|---|---|
Mark Tyneway's avatar
Mark Tyneway committed
141
| _verified | bool | Whether or not the batch inclusion proof is verified.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185



## 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 |