Ownership Predicate Specification¶
Overview¶
The ownership predicate is the one of the simplest useful predicates. It gives an address, specified as the state.data.owner , the ability to execute a state transition which changes any part of the owned subrange to a new StateObject by signing an approval transaction.
Predicate API¶
getOwner¶
{
name: "getOwner",
constant: true,
inputs: [],
outputs: [
{
name: "stateOwner",
type: "address"
}
]
}
Description¶
The getOwner API method allows the client or operator to query the current owner of the state.
Inputs¶
N/A
Outputs¶
- stateOwner - address: the current owner based on the state object. Will equal
data.owner.
Justification¶
This function allows developers to get the owner without directly dissecting the state object.
send¶
{
name: "send",
constant: false,
inputs: [
{
name: "newState",
type: "StateObject"
},
{
name: "originBlock",
type: "uint"
},
{
name: "maxBlock",
type: "uint"
}
],
outputs: []
}
Description¶
The send method is used to set the state to a new arbitrary state object, given a signature.
Inputs¶
newState-StateObject: the state object that the owner desires to mutate to.originBlock-uint: the maximum plasma blocknumber of the ownershipStateUpdates from which you are spending.maxBlock-uint: the maximum plasma block number for which the send is valid.
Outputs¶
N/A
Justification¶
Being able to spend to any new state is the base property of ownership. The targetBlock may be used to produce replay protection while allowing some level of asynchronicity between the client and operator.
State Object Specification¶
struct ownershipStateData:
owner: address
Fields¶
- owner - address: The Ethereum public address of the person who may mutate the state.
Additional Predicate Contract Logic¶
N/A
Predicate Interface¶
Transition Execution¶
def verifyStateTransition(preState: StateUpdate, input: StandardTransaction, witness: bytes postState: StateUpdate)
Requirements¶
- MUST ensure that the
input.witnessis a signature by thepreState.stateObject.owner. - MUST ensure that the
preState.plasmaBlockNumberis less thana theinput.parameters.originBlock. - MUST ensure that the
postState.rangeis the same asinput.startandinput.end. - MUST ensure that the
input.parameters.newStateis the same as thepostState.state. - MUST ensure that the
input.parameters.targetBlockis greater than or equal to thepostState.plasmaBlockNumber.
Rationale¶
The addition of limbo exits has removed the need to always specify a target block number which is one more than the client’s currently verified block. Thus, we can allow transactions to be in flight for multiple blocks with this predicate.
Exit Finalization¶
def onExitGameFinalized(exit: Checkpoint, witness: myExitabilityWitness)
Requirements¶
- MUST Send the total balance of the subrange to the
exit.stateUpdate.state.owner.
Rationale¶
Verification Plugin¶
State Transitions¶
def executeStateTransition(preState: StateUpdate, transaction: StandardTransaction)
Requirements¶
- MUST ensure that the
transaction.witnessis a signature by thepreState.stateObject.owner. - MUST ensure that the
preState.plasmaBlockNumberis less thana theinput.parameters.originBlock. - MUST return a
StateUpdatewith a range the same astransaction.startandtransaction.end. - MUST return a
StateUpdatewithstateis the same as thetransaction.parameters.newState. - MUST ensure that the
transaction.parameters.targetBlockis greater than or equal to the pending plasma block number .
Rationale¶
These steps always produce a StateUpdate which passes the predicate contract’s verifyStateTransition step.
Guarding Plugin¶
TODO