tokamak-network/plasma-evm-contracts

add various request types

Opened this issue · 1 comments

4000D commented

Current apply functions only takes enter and exit request. They should be extended to support escape and undo request.

function applyRequestInRootChain(
    bool isExit,
    uint256 requestId,
    address requestor,
    bytes32 trieKey,
    bytes trieValue
) external returns (bool success);

function applyRequestInChildChain(
    bool isExit,
    uint256 requestId,
    address requestor,
    bytes32 trieKey,
    bytes trieValue
) external returns (bool success);

apply functions should be divided into request types, not chains.

function startEnter(
    bool isRootChain,
    uint256 requestId,
    address requestor,
    bytes32 trieKey,
    bytes trieValue
) external returns (bool success);

function startExit(
    bool isRootChain,
    uint256 requestId,
    address requestor,
    bytes32 trieKey,
    bytes trieValue
) external returns (bool success);

function startEscape(
    bool isRootChain,
    uint256 requestId,
    address requestor,
    bytes32 trieKey,
    bytes trieValue
) external returns (bool success);

function startUndo(
    bool isRootChain,
    uint256 requestId,
    address requestor,
    bytes32 trieKey,
    bytes trieValue
) external returns (bool success);
4000D commented

Undo request which cancels previous enter request have to refer the trieValue of previous enter request. I think it is enough to include this information in trieValue of previous request.

trieValue of enter request must be [current_value, value_to_request] to roll back the state to current_value before enter request is applied. And trieValue of undo request must be same as the enter request to be undone.