Skip to content

Commit

Permalink
fix: removed require statement from BlockManager (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
GauravJain9 authored Mar 8, 2022
1 parent 4fd81ca commit af10f62
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 168 deletions.
1 change: 0 additions & 1 deletion contracts/Core/BlockManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,6 @@ contract BlockManager is Initializable, BlockStorage, StateManager, BlockManager
); // TIR : total influence revealed
require(disputes[epoch][msg.sender].accWeight != 0, "Invalid dispute");
// Would revert if no block is proposed, or the asset specifed was not revealed
require(disputes[epoch][msg.sender].median > 0, "median can not be zero");
uint32 blockId = sortedProposedBlockIds[epoch][blockIndex];
require(proposedBlocks[epoch][blockId].valid, "Block already has been disputed");
uint16 medianIndex = disputes[epoch][msg.sender].medianIndex;
Expand Down
14 changes: 7 additions & 7 deletions docs/BlockStorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
function blockIndexToBeConfirmed() external view returns (int8)
```


block index that is to be confirmed if not disputed



Expand All @@ -33,7 +33,7 @@ function blockIndexToBeConfirmed() external view returns (int8)
function blocks(uint32) external view returns (bool valid, uint32 proposerId, uint256 iteration, uint256 biggestStake)
```


mapping of epoch -> blocks



Expand All @@ -58,7 +58,7 @@ function blocks(uint32) external view returns (bool valid, uint32 proposerId, ui
function disputes(uint32, address) external view returns (uint16 medianIndex, uint32 median, uint32 lastVisitedValue, uint256 accWeight)
```


mapping of epoch -> address -> dispute



Expand All @@ -84,7 +84,7 @@ function disputes(uint32, address) external view returns (uint16 medianIndex, ui
function epochLastProposed(uint32) external view returns (uint32)
```


mapping of stakerId->epoch



Expand All @@ -106,7 +106,7 @@ function epochLastProposed(uint32) external view returns (uint32)
function numProposedBlocks() external view returns (uint32)
```


total number of proposed blocks in an epoch



Expand All @@ -123,7 +123,7 @@ function numProposedBlocks() external view returns (uint32)
function proposedBlocks(uint32, uint32) external view returns (bool valid, uint32 proposerId, uint256 iteration, uint256 biggestStake)
```


mapping of epoch -> blockId -> block



Expand All @@ -149,7 +149,7 @@ function proposedBlocks(uint32, uint32) external view returns (bool valid, uint3
function sortedProposedBlockIds(uint32, uint256) external view returns (uint32)
```


mapping of epoch->blockId



Expand Down
26 changes: 13 additions & 13 deletions docs/Delegator.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@



> Delegator


Delegator acts as a bridge between the client and the protocol



Expand Down Expand Up @@ -392,7 +392,7 @@ function getCollectionID(bytes32 _hname) external view returns (uint16)




*using the hash of collection name, clients can query collection id with respect to its hash*

#### Parameters

Expand All @@ -404,7 +404,7 @@ function getCollectionID(bytes32 _hname) external view returns (uint16)

| Name | Type | Description |
|---|---|---|
| _0 | uint16 | undefined
| _0 | uint16 | collection ID

### getNumActiveCollections

Expand All @@ -421,7 +421,7 @@ function getNumActiveCollections() external view returns (uint256)

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined
| _0 | uint256 | number of active collections in the oracle

### getResult

Expand All @@ -431,19 +431,19 @@ function getResult(bytes32 _name) external view returns (uint32, int8)




*using the hash of collection name, clients can query the result of that collection*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _name | bytes32 | undefined
| _name | bytes32 | bytes32 hash of the collection name

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint32 | undefined
| _0 | uint32 | result of the collection and its power
| _1 | int8 | undefined

### getResultFromID
Expand All @@ -454,19 +454,19 @@ function getResultFromID(uint16 _id) external view returns (uint32, int8)




*using the collection id, clients can query the result of the collection*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _id | uint16 | undefined
| _id | uint16 | collection ID

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint32 | undefined
| _0 | uint32 | result of the collection and its power
| _1 | int8 | undefined

### getRoleAdmin
Expand Down Expand Up @@ -595,13 +595,13 @@ function updateAddress(address newDelegateAddress) external nonpayable




*updates the address of the Collection Manager contract from where the delegator will fetch results of the oracle*

#### Parameters

| Name | Type | Description |
|---|---|---|
| newDelegateAddress | address | undefined
| newDelegateAddress | address | address of the Collection Manager



Expand Down
16 changes: 8 additions & 8 deletions docs/IBlockManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,59 +16,59 @@
function confirmPreviousEpochBlock(uint32 stakerId) external nonpayable
```


if the proposed staker, whose block is valid and has the lowest iteration, does not call claimBlockReward() then in commit state, the staker who commits first will confirm this block and will receive the block reward inturn



#### Parameters

| Name | Type | Description |
|---|---|---|
| stakerId | uint32 | undefined
| stakerId | uint32 | id of the staker that is confirming the block

### getBlock

```solidity
function getBlock(uint32 epoch) external view returns (struct Structs.Block _block)
```


return the struct of the confirmed block



#### Parameters

| Name | Type | Description |
|---|---|---|
| epoch | uint32 | undefined
| epoch | uint32 | in which this block was confirmed

#### Returns

| Name | Type | Description |
|---|---|---|
| _block | Structs.Block | undefined
| _block | Structs.Block | : struct of the confirmed block

### isBlockConfirmed

```solidity
function isBlockConfirmed(uint32 epoch) external view returns (bool)
```


this is to check whether a block was confirmed in a particular epoch or not



#### Parameters

| Name | Type | Description |
|---|---|---|
| epoch | uint32 | undefined
| epoch | uint32 | for which this check is being done

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | bool | undefined
| _0 | bool | true or false. true if a block has been confirmed, else false



Expand Down
24 changes: 12 additions & 12 deletions docs/IDelegator.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@ function getCollectionID(bytes32 _name) external view returns (uint16)




*using the hash of collection name, clients can query collection id with respect to its hash*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _name | bytes32 | undefined
| _name | bytes32 | bytes32 hash of the collection name

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint16 | undefined
| _0 | uint16 | collection ID

### getNumActiveCollections

Expand All @@ -47,7 +47,7 @@ function getNumActiveCollections() external view returns (uint256)

| Name | Type | Description |
|---|---|---|
| _0 | uint256 | undefined
| _0 | uint256 | number of active collections in the oracle

### getResult

Expand All @@ -57,19 +57,19 @@ function getResult(bytes32 _name) external view returns (uint32, int8)




*using the hash of collection name, clients can query the result of that collection*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _name | bytes32 | undefined
| _name | bytes32 | bytes32 hash of the collection name

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint32 | undefined
| _0 | uint32 | result of the collection and its power
| _1 | int8 | undefined

### getResultFromID
Expand All @@ -80,19 +80,19 @@ function getResultFromID(uint16 _id) external view returns (uint32, int8)




*using the collection id, clients can query the result of the collection*

#### Parameters

| Name | Type | Description |
|---|---|---|
| _id | uint16 | undefined
| _id | uint16 | collection ID

#### Returns

| Name | Type | Description |
|---|---|---|
| _0 | uint32 | undefined
| _0 | uint32 | result of the collection and its power
| _1 | int8 | undefined

### updateAddress
Expand All @@ -103,13 +103,13 @@ function updateAddress(address newDelegateAddress) external nonpayable




*updates the address of the Collection Manager contract from where the delegator will fetch results of the oracle*

#### Parameters

| Name | Type | Description |
|---|---|---|
| newDelegateAddress | address | undefined
| newDelegateAddress | address | address of the Collection Manager



Expand Down
2 changes: 1 addition & 1 deletion docs/IStakedToken.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function burn(address account, uint256 amount) external nonpayable returns (bool
function getRZRDeposited(address delegator, uint256 sAmount) external view returns (uint256)
```


Used in withdraw



Expand Down
6 changes: 3 additions & 3 deletions docs/IStakedTokenFactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ function createStakedToken(address stakeManagerAddress, uint32 stakedID) externa




*a factory contract where the sRZR for a new staker is being deployed*

#### Parameters

| Name | Type | Description |
|---|---|---|
| stakeManagerAddress | address | undefined
| stakedID | uint32 | undefined
| stakeManagerAddress | address | address of the stake Manager contract
| stakedID | uint32 | id of the staker whom the sRZR is being deployed

#### Returns

Expand Down
Loading

0 comments on commit af10f62

Please sign in to comment.