diff --git a/plasma_framework/contracts/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.sol b/plasma_framework/contracts/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.sol index 9f4a9d2b7..728c27fd4 100644 --- a/plasma_framework/contracts/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.sol +++ b/plasma_framework/contracts/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.sol @@ -31,7 +31,11 @@ library PaymentChallengeIFENotCanonical { event InFlightExitChallenged( address indexed challenger, bytes32 indexed txHash, - uint256 challengeTxPosition + uint256 challengeTxPosition, + uint16 inFlightTxInputIndex, + bytes challengeTx, + uint16 challengeTxInputIndex, + bytes challengeTxWitness ); event InFlightExitChallengeResponded( @@ -131,7 +135,15 @@ library PaymentChallengeIFENotCanonical { // Set a flag so that only the inputs are exitable, unless a response is received. ife.isCanonical = false; - emit InFlightExitChallenged(msg.sender, keccak256(args.inFlightTx), competitorPosition); + emit InFlightExitChallenged({ + challenger: msg.sender, + txHash: keccak256(args.inFlightTx), + challengeTxPosition: competitorPosition, + inFlightTxInputIndex: args.inFlightTxInputIndex, + challengeTx: args.competingTx, + challengeTxInputIndex: args.competingTxInputIndex, + challengeTxWitness: args.competingTxWitness + }); } /** diff --git a/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartInFlightExit.sol b/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartInFlightExit.sol index 5c8d50fa4..57cc29464 100644 --- a/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartInFlightExit.sol +++ b/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartInFlightExit.sol @@ -36,7 +36,10 @@ library PaymentStartInFlightExit { event InFlightExitStarted( address indexed initiator, - bytes32 indexed txHash + bytes32 indexed txHash, + bytes inFlightTx, + uint256[] inputUtxosPos, + bytes[] inFlightTxWitnesses ); /** @@ -105,7 +108,13 @@ library PaymentStartInFlightExit { StartExitData memory startExitData = createStartExitData(self, args); verifyStart(startExitData, inFlightExitMap); startExit(startExitData, inFlightExitMap); - emit InFlightExitStarted(msg.sender, startExitData.inFlightTxHash); + emit InFlightExitStarted({ + initiator: msg.sender, + txHash: startExitData.inFlightTxHash, + inFlightTx: args.inFlightTx, + inputUtxosPos: args.inputUtxosPos, + inFlightTxWitnesses: args.inFlightTxWitnesses + }); } function createStartExitData( diff --git a/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartStandardExit.sol b/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartStandardExit.sol index 79423607e..e6882b932 100644 --- a/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartStandardExit.sol +++ b/plasma_framework/contracts/src/exits/payment/controllers/PaymentStartStandardExit.sol @@ -43,7 +43,8 @@ library PaymentStartStandardExit { event ExitStarted( address indexed owner, - uint168 exitId + uint168 exitId, + uint256 utxoPos ); /** @@ -90,7 +91,11 @@ library PaymentStartStandardExit { saveStandardExitData(data, exitMap); enqueueStandardExit(data); - emit ExitStarted(msg.sender, data.exitId); + emit ExitStarted({ + owner: msg.sender, + exitId: data.exitId, + utxoPos: args.utxoPos + }); } function setupStartStandardExitData( diff --git a/plasma_framework/docs/contracts/Address.md b/plasma_framework/docs/contracts/Address.md index c097a3e35..c11c90cfa 100644 --- a/plasma_framework/docs/contracts/Address.md +++ b/plasma_framework/docs/contracts/Address.md @@ -43,6 +43,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Bits.md b/plasma_framework/docs/contracts/Bits.md index b1fa677ab..b620147c0 100644 --- a/plasma_framework/docs/contracts/Bits.md +++ b/plasma_framework/docs/contracts/Bits.md @@ -114,6 +114,7 @@ True, if the bit is '0'; otherwise, False * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/BlockController.md b/plasma_framework/docs/contracts/BlockController.md index dfbc929e9..69fde1f4b 100644 --- a/plasma_framework/docs/contracts/BlockController.md +++ b/plasma_framework/docs/contracts/BlockController.md @@ -121,6 +121,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/BlockModel.md b/plasma_framework/docs/contracts/BlockModel.md index ddd7bbd50..7d6965c69 100644 --- a/plasma_framework/docs/contracts/BlockModel.md +++ b/plasma_framework/docs/contracts/BlockModel.md @@ -29,6 +29,7 @@ struct Block { * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/BondSize.md b/plasma_framework/docs/contracts/BondSize.md index d989a2e6c..5532aae17 100644 --- a/plasma_framework/docs/contracts/BondSize.md +++ b/plasma_framework/docs/contracts/BondSize.md @@ -105,6 +105,7 @@ function validateBondSize(struct BondSize.Params self, uint128 newBondSize) priv * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/ECDSA.md b/plasma_framework/docs/contracts/ECDSA.md index f02eb4125..7184011e4 100644 --- a/plasma_framework/docs/contracts/ECDSA.md +++ b/plasma_framework/docs/contracts/ECDSA.md @@ -73,6 +73,7 @@ returns(bytes32) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Erc20DepositVerifier.md b/plasma_framework/docs/contracts/Erc20DepositVerifier.md index 58d9250e7..ca8537469 100644 --- a/plasma_framework/docs/contracts/Erc20DepositVerifier.md +++ b/plasma_framework/docs/contracts/Erc20DepositVerifier.md @@ -72,6 +72,7 @@ Verified (owner, token, amount) of the deposit ERC20 token data * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Erc20Vault.md b/plasma_framework/docs/contracts/Erc20Vault.md index 4039e5656..260694a3a 100644 --- a/plasma_framework/docs/contracts/Erc20Vault.md +++ b/plasma_framework/docs/contracts/Erc20Vault.md @@ -77,6 +77,7 @@ function withdraw(address payable receiver, address token, uint256 amount) exter * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/EthDepositVerifier.md b/plasma_framework/docs/contracts/EthDepositVerifier.md index 9838019fc..1deae6085 100644 --- a/plasma_framework/docs/contracts/EthDepositVerifier.md +++ b/plasma_framework/docs/contracts/EthDepositVerifier.md @@ -67,6 +67,7 @@ function verify(bytes depositTx, uint256 amount, address sender) external view * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/EthVault.md b/plasma_framework/docs/contracts/EthVault.md index 95dc5d6d3..ff46037c6 100644 --- a/plasma_framework/docs/contracts/EthVault.md +++ b/plasma_framework/docs/contracts/EthVault.md @@ -84,6 +84,7 @@ function withdraw(address payable receiver, uint256 amount) external nonpayable * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/ExitBounty.md b/plasma_framework/docs/contracts/ExitBounty.md new file mode 100644 index 000000000..d3e66cf1c --- /dev/null +++ b/plasma_framework/docs/contracts/ExitBounty.md @@ -0,0 +1,96 @@ +# ExitBounty.sol + +View Source: [contracts/src/exits/utils/ExitBounty.sol](../../contracts/src/exits/utils/ExitBounty.sol) + +**ExitBounty** + +## Functions + +- [processStandardExitBountySize(uint256 gasPriceStartExit)](#processstandardexitbountysize) + +### processStandardExitBountySize + +Returns the Process Exit Bounty size for standard exits + +```js +function processStandardExitBountySize(uint256 gasPriceStartExit) internal view +returns(uint256) +``` + +**Arguments** + +| Name | Type | Description | +| ------------- |------------- | -----| +| gasPriceStartExit | uint256 | | + +## Contracts + +* [Address](Address.md) +* [Bits](Bits.md) +* [BlockController](BlockController.md) +* [BlockModel](BlockModel.md) +* [BondSize](BondSize.md) +* [ECDSA](ECDSA.md) +* [Erc20DepositVerifier](Erc20DepositVerifier.md) +* [Erc20Vault](Erc20Vault.md) +* [EthDepositVerifier](EthDepositVerifier.md) +* [EthVault](EthVault.md) +* [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) +* [ExitGameController](ExitGameController.md) +* [ExitGameRegistry](ExitGameRegistry.md) +* [ExitId](ExitId.md) +* [ExitPriority](ExitPriority.md) +* [FailFastReentrancyGuard](FailFastReentrancyGuard.md) +* [FeeClaimOutputToPaymentTxCondition](FeeClaimOutputToPaymentTxCondition.md) +* [FeeExitGame](FeeExitGame.md) +* [FungibleTokenOutputModel](FungibleTokenOutputModel.md) +* [GenericTransaction](GenericTransaction.md) +* [IERC20](IERC20.md) +* [IErc20DepositVerifier](IErc20DepositVerifier.md) +* [IEthDepositVerifier](IEthDepositVerifier.md) +* [IExitProcessor](IExitProcessor.md) +* [ISpendingCondition](ISpendingCondition.md) +* [IStateTransitionVerifier](IStateTransitionVerifier.md) +* [Math](Math.md) +* [Merkle](Merkle.md) +* [Migrations](Migrations.md) +* [MoreVpFinalization](MoreVpFinalization.md) +* [OnlyFromAddress](OnlyFromAddress.md) +* [OnlyWithValue](OnlyWithValue.md) +* [OutputId](OutputId.md) +* [Ownable](Ownable.md) +* [PaymentChallengeIFEInputSpent](PaymentChallengeIFEInputSpent.md) +* [PaymentChallengeIFENotCanonical](PaymentChallengeIFENotCanonical.md) +* [PaymentChallengeIFEOutputSpent](PaymentChallengeIFEOutputSpent.md) +* [PaymentChallengeStandardExit](PaymentChallengeStandardExit.md) +* [PaymentDeleteInFlightExit](PaymentDeleteInFlightExit.md) +* [PaymentEip712Lib](PaymentEip712Lib.md) +* [PaymentExitDataModel](PaymentExitDataModel.md) +* [PaymentExitGame](PaymentExitGame.md) +* [PaymentExitGameArgs](PaymentExitGameArgs.md) +* [PaymentInFlightExitModelUtils](PaymentInFlightExitModelUtils.md) +* [PaymentInFlightExitRouter](PaymentInFlightExitRouter.md) +* [PaymentInFlightExitRouterArgs](PaymentInFlightExitRouterArgs.md) +* [PaymentOutputToPaymentTxCondition](PaymentOutputToPaymentTxCondition.md) +* [PaymentPiggybackInFlightExit](PaymentPiggybackInFlightExit.md) +* [PaymentProcessInFlightExit](PaymentProcessInFlightExit.md) +* [PaymentProcessStandardExit](PaymentProcessStandardExit.md) +* [PaymentStandardExitRouter](PaymentStandardExitRouter.md) +* [PaymentStandardExitRouterArgs](PaymentStandardExitRouterArgs.md) +* [PaymentStartInFlightExit](PaymentStartInFlightExit.md) +* [PaymentStartStandardExit](PaymentStartStandardExit.md) +* [PaymentTransactionModel](PaymentTransactionModel.md) +* [PaymentTransactionStateTransitionVerifier](PaymentTransactionStateTransitionVerifier.md) +* [PlasmaFramework](PlasmaFramework.md) +* [PosLib](PosLib.md) +* [PriorityQueue](PriorityQueue.md) +* [Protocol](Protocol.md) +* [Quarantine](Quarantine.md) +* [RLPReader](RLPReader.md) +* [SafeERC20](SafeERC20.md) +* [SafeEthTransfer](SafeEthTransfer.md) +* [SafeMath](SafeMath.md) +* [SpendingConditionRegistry](SpendingConditionRegistry.md) +* [Vault](Vault.md) +* [VaultRegistry](VaultRegistry.md) diff --git a/plasma_framework/docs/contracts/ExitGameController.md b/plasma_framework/docs/contracts/ExitGameController.md index a55f2e43e..e060c1f38 100644 --- a/plasma_framework/docs/contracts/ExitGameController.md +++ b/plasma_framework/docs/contracts/ExitGameController.md @@ -320,6 +320,7 @@ returns(bytes32) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/ExitGameRegistry.md b/plasma_framework/docs/contracts/ExitGameRegistry.md index 984f96b18..9e1be643b 100644 --- a/plasma_framework/docs/contracts/ExitGameRegistry.md +++ b/plasma_framework/docs/contracts/ExitGameRegistry.md @@ -179,6 +179,7 @@ returns(uint256) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/ExitId.md b/plasma_framework/docs/contracts/ExitId.md index 6566b39d9..526ff6718 100644 --- a/plasma_framework/docs/contracts/ExitId.md +++ b/plasma_framework/docs/contracts/ExitId.md @@ -47,7 +47,7 @@ returns(uint168) standardExitId Unique ID of the standard exit Anatomy of returned value, most significant bits first: 1-bit - in-flight flag (0 for standard exit) - 167-bits - hash(tx) or hash(tx|utxo) for deposit + 167-bits - outputId **Arguments** @@ -89,6 +89,7 @@ Unique in-flight exit ID * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/ExitPriority.md b/plasma_framework/docs/contracts/ExitPriority.md index 932f595f0..e6c45737f 100644 --- a/plasma_framework/docs/contracts/ExitPriority.md +++ b/plasma_framework/docs/contracts/ExitPriority.md @@ -84,6 +84,7 @@ returns(uint168) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/ExitableTimestamp.md b/plasma_framework/docs/contracts/ExitableTimestamp.md index e3120672d..c92ff75c6 100644 --- a/plasma_framework/docs/contracts/ExitableTimestamp.md +++ b/plasma_framework/docs/contracts/ExitableTimestamp.md @@ -64,6 +64,7 @@ returns(uint32) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/FailFastReentrancyGuard.md b/plasma_framework/docs/contracts/FailFastReentrancyGuard.md index 6fd4a7428..d50a1fd0c 100644 --- a/plasma_framework/docs/contracts/FailFastReentrancyGuard.md +++ b/plasma_framework/docs/contracts/FailFastReentrancyGuard.md @@ -42,6 +42,7 @@ modifier nonReentrant(ExitGameController exitGameController) internal * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/FeeClaimOutputToPaymentTxCondition.md b/plasma_framework/docs/contracts/FeeClaimOutputToPaymentTxCondition.md index ff42254fe..56678bdf1 100644 --- a/plasma_framework/docs/contracts/FeeClaimOutputToPaymentTxCondition.md +++ b/plasma_framework/docs/contracts/FeeClaimOutputToPaymentTxCondition.md @@ -75,6 +75,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/FeeExitGame.md b/plasma_framework/docs/contracts/FeeExitGame.md index 4a4bf4723..9ef16d064 100644 --- a/plasma_framework/docs/contracts/FeeExitGame.md +++ b/plasma_framework/docs/contracts/FeeExitGame.md @@ -19,6 +19,7 @@ View Source: [contracts/src/exits/fee/FeeExitGame.sol](../../contracts/src/exits * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/FungibleTokenOutputModel.md b/plasma_framework/docs/contracts/FungibleTokenOutputModel.md index bdf6fe589..fc167941b 100644 --- a/plasma_framework/docs/contracts/FungibleTokenOutputModel.md +++ b/plasma_framework/docs/contracts/FungibleTokenOutputModel.md @@ -76,6 +76,7 @@ returns(struct FungibleTokenOutputModel.Output) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/GenericTransaction.md b/plasma_framework/docs/contracts/GenericTransaction.md index 62e8af514..d03e8ed16 100644 --- a/plasma_framework/docs/contracts/GenericTransaction.md +++ b/plasma_framework/docs/contracts/GenericTransaction.md @@ -111,6 +111,7 @@ returns(struct GenericTransaction.Output) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/IERC20.md b/plasma_framework/docs/contracts/IERC20.md index 42d6019b3..9ac4e320b 100644 --- a/plasma_framework/docs/contracts/IERC20.md +++ b/plasma_framework/docs/contracts/IERC20.md @@ -147,6 +147,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/IErc20DepositVerifier.md b/plasma_framework/docs/contracts/IErc20DepositVerifier.md index f3ae66764..79a2a8020 100644 --- a/plasma_framework/docs/contracts/IErc20DepositVerifier.md +++ b/plasma_framework/docs/contracts/IErc20DepositVerifier.md @@ -46,6 +46,7 @@ Verified (owner, token, amount) of the deposit ERC20 token data * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/IEthDepositVerifier.md b/plasma_framework/docs/contracts/IEthDepositVerifier.md index 719c5fb4e..4eccac58c 100644 --- a/plasma_framework/docs/contracts/IEthDepositVerifier.md +++ b/plasma_framework/docs/contracts/IEthDepositVerifier.md @@ -41,6 +41,7 @@ function verify(bytes depositTx, uint256 amount, address sender) external view * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/IExitProcessor.md b/plasma_framework/docs/contracts/IExitProcessor.md index d7b3d046d..f8b538c15 100644 --- a/plasma_framework/docs/contracts/IExitProcessor.md +++ b/plasma_framework/docs/contracts/IExitProcessor.md @@ -11,7 +11,7 @@ An interface that allows custom logic to process exits for different requirement ## Functions -- [processExit(uint168 exitId, uint256 vaultId, address token)](#processexit) +- [processExit(uint168 exitId, uint256 vaultId, address token, address payable processor)](#processexit) ### processExit @@ -20,7 +20,7 @@ An interface that allows custom logic to process exits for different requirement Function interface for processing exits. ```js -function processExit(uint168 exitId, uint256 vaultId, address token) external nonpayable +function processExit(uint168 exitId, uint256 vaultId, address token, address payable processor) external nonpayable ``` **Arguments** @@ -30,6 +30,7 @@ function processExit(uint168 exitId, uint256 vaultId, address token) external no | exitId | uint168 | Unique ID for exit per tx type | | vaultId | uint256 | ID of the vault that funds the exit | | token | address | Address of the token contract | +| processor | address payable | Address of the processExit intitiator | ## Contracts @@ -44,6 +45,7 @@ function processExit(uint168 exitId, uint256 vaultId, address token) external no * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/ISpendingCondition.md b/plasma_framework/docs/contracts/ISpendingCondition.md index 84f26ab66..c16c628fe 100644 --- a/plasma_framework/docs/contracts/ISpendingCondition.md +++ b/plasma_framework/docs/contracts/ISpendingCondition.md @@ -46,6 +46,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/IStateTransitionVerifier.md b/plasma_framework/docs/contracts/IStateTransitionVerifier.md index b2b43262a..64da64439 100644 --- a/plasma_framework/docs/contracts/IStateTransitionVerifier.md +++ b/plasma_framework/docs/contracts/IStateTransitionVerifier.md @@ -38,6 +38,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Math.md b/plasma_framework/docs/contracts/Math.md index 8f87a7b81..5b94c1436 100644 --- a/plasma_framework/docs/contracts/Math.md +++ b/plasma_framework/docs/contracts/Math.md @@ -74,6 +74,7 @@ returns(uint256) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Merkle.md b/plasma_framework/docs/contracts/Merkle.md index 2b6e92cea..d8d051810 100644 --- a/plasma_framework/docs/contracts/Merkle.md +++ b/plasma_framework/docs/contracts/Merkle.md @@ -54,6 +54,7 @@ True, if the leaf hash is in the Merkle tree; otherwise, False * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Migrations.md b/plasma_framework/docs/contracts/Migrations.md index d004233dd..a4650f081 100644 --- a/plasma_framework/docs/contracts/Migrations.md +++ b/plasma_framework/docs/contracts/Migrations.md @@ -82,6 +82,7 @@ function upgrade(address new_address) public nonpayable restricted * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/MoreVpFinalization.md b/plasma_framework/docs/contracts/MoreVpFinalization.md index a664d9603..db7698840 100644 --- a/plasma_framework/docs/contracts/MoreVpFinalization.md +++ b/plasma_framework/docs/contracts/MoreVpFinalization.md @@ -60,6 +60,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/OnlyFromAddress.md b/plasma_framework/docs/contracts/OnlyFromAddress.md index 155b155c5..116acf1f7 100644 --- a/plasma_framework/docs/contracts/OnlyFromAddress.md +++ b/plasma_framework/docs/contracts/OnlyFromAddress.md @@ -37,6 +37,7 @@ modifier onlyFrom(address caller) internal * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/OnlyWithValue.md b/plasma_framework/docs/contracts/OnlyWithValue.md index b661cf417..95fd51de5 100644 --- a/plasma_framework/docs/contracts/OnlyWithValue.md +++ b/plasma_framework/docs/contracts/OnlyWithValue.md @@ -37,6 +37,7 @@ modifier onlyWithValue(uint256 _value) internal * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/OutputId.md b/plasma_framework/docs/contracts/OutputId.md index 4050c3bb5..f3e75e0f7 100644 --- a/plasma_framework/docs/contracts/OutputId.md +++ b/plasma_framework/docs/contracts/OutputId.md @@ -55,6 +55,7 @@ returns(bytes32) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Ownable.md b/plasma_framework/docs/contracts/Ownable.md index e8b459160..01e1bfe12 100644 --- a/plasma_framework/docs/contracts/Ownable.md +++ b/plasma_framework/docs/contracts/Ownable.md @@ -152,6 +152,7 @@ function _transferOwnership(address newOwner) internal nonpayable * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentChallengeIFEInputSpent.md b/plasma_framework/docs/contracts/PaymentChallengeIFEInputSpent.md index 6edfc95ed..2ee5c9342 100644 --- a/plasma_framework/docs/contracts/PaymentChallengeIFEInputSpent.md +++ b/plasma_framework/docs/contracts/PaymentChallengeIFEInputSpent.md @@ -125,6 +125,7 @@ function verifySpendingCondition(struct PaymentChallengeIFEInputSpent.ChallengeI * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentChallengeIFENotCanonical.md b/plasma_framework/docs/contracts/PaymentChallengeIFENotCanonical.md index 8d47ac4f7..2c428ecf9 100644 --- a/plasma_framework/docs/contracts/PaymentChallengeIFENotCanonical.md +++ b/plasma_framework/docs/contracts/PaymentChallengeIFENotCanonical.md @@ -18,7 +18,7 @@ struct Controller { **Events** ```js -event InFlightExitChallenged(address indexed challenger, bytes32 indexed txHash, uint256 challengeTxPosition); +event InFlightExitChallenged(address indexed challenger, bytes32 indexed txHash, uint256 challengeTxPosition, uint16 inFlightTxInputIndex, bytes challengeTx, uint16 challengeTxInputIndex, bytes challengeTxWitness); event InFlightExitChallengeResponded(address indexed challenger, bytes32 indexed txHash, uint256 challengeTxPosition); ``` @@ -127,6 +127,7 @@ returns(uint256) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentChallengeIFEOutputSpent.md b/plasma_framework/docs/contracts/PaymentChallengeIFEOutputSpent.md index 3fc36f8ec..c820d47ef 100644 --- a/plasma_framework/docs/contracts/PaymentChallengeIFEOutputSpent.md +++ b/plasma_framework/docs/contracts/PaymentChallengeIFEOutputSpent.md @@ -96,6 +96,7 @@ function verifyChallengingTransactionSpendsOutput(struct PaymentChallengeIFEOutp * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentChallengeStandardExit.md b/plasma_framework/docs/contracts/PaymentChallengeStandardExit.md index 0d16516e3..47fd51447 100644 --- a/plasma_framework/docs/contracts/PaymentChallengeStandardExit.md +++ b/plasma_framework/docs/contracts/PaymentChallengeStandardExit.md @@ -126,6 +126,7 @@ function verifySpendingCondition(struct PaymentChallengeStandardExit.ChallengeSt * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentDeleteInFlightExit.md b/plasma_framework/docs/contracts/PaymentDeleteInFlightExit.md index 31b30f74e..09a2a3bbb 100644 --- a/plasma_framework/docs/contracts/PaymentDeleteInFlightExit.md +++ b/plasma_framework/docs/contracts/PaymentDeleteInFlightExit.md @@ -67,6 +67,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentEip712Lib.md b/plasma_framework/docs/contracts/PaymentEip712Lib.md index 9aca70941..82cf7bda1 100644 --- a/plasma_framework/docs/contracts/PaymentEip712Lib.md +++ b/plasma_framework/docs/contracts/PaymentEip712Lib.md @@ -118,6 +118,7 @@ returns(bytes32) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentExitDataModel.md b/plasma_framework/docs/contracts/PaymentExitDataModel.md index b8aa228d6..fc3620282 100644 --- a/plasma_framework/docs/contracts/PaymentExitDataModel.md +++ b/plasma_framework/docs/contracts/PaymentExitDataModel.md @@ -16,7 +16,8 @@ struct StandardExit { bytes32 outputId, address payable exitTarget, uint256 amount, - uint256 bondSize + uint256 bondSize, + uint256 bountySize } ``` @@ -88,6 +89,7 @@ uint8 public constant MAX_OUTPUT_NUM; * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentExitGame.md b/plasma_framework/docs/contracts/PaymentExitGame.md index eb42451e2..09c0eec95 100644 --- a/plasma_framework/docs/contracts/PaymentExitGame.md +++ b/plasma_framework/docs/contracts/PaymentExitGame.md @@ -12,14 +12,16 @@ The exit game contract implementation for Payment Transaction **Constants & Variables** ```js -contract PlasmaFramework private plasmaFramework; +struct PaymentExitGameArgs.Args private paymentExitGameArgs; +bool private initDone; ``` ## Functions - [(struct PaymentExitGameArgs.Args args)](#) -- [processExit(uint168 exitId, uint256 , address token)](#processexit) +- [init()](#init) +- [processExit(uint168 exitId, uint256 , address token, address payable processor)](#processexit) - [getStandardExitId(bool _isDeposit, bytes _txBytes, uint256 _utxoPos)](#getstandardexitid) - [getInFlightExitId(bytes _txBytes)](#getinflightexitid) @@ -37,6 +39,17 @@ function (struct PaymentExitGameArgs.Args args) public nonpayable PaymentStandar | ------------- |------------- | -----| | args | struct PaymentExitGameArgs.Args | | +### init + +```js +function init() public nonpayable onlyFrom +``` + +**Arguments** + +| Name | Type | Description | +| ------------- |------------- | -----| + ### processExit ⤾ overrides [IExitProcessor.processExit](IExitProcessor.md#processexit) @@ -44,7 +57,7 @@ function (struct PaymentExitGameArgs.Args args) public nonpayable PaymentStandar Callback processes exit function for the PlasmaFramework to call ```js -function processExit(uint168 exitId, uint256 , address token) external nonpayable onlyFrom +function processExit(uint168 exitId, uint256 , address token, address payable processor) external nonpayable onlyFrom ``` **Arguments** @@ -54,6 +67,7 @@ function processExit(uint168 exitId, uint256 , address token) external nonpayabl | exitId | uint168 | The exit ID | | | uint256 | exitId The exit ID | | token | address | Token (ERC20 address or address(0) for ETH) of the exiting output | +| processor | address payable | The processExit initiator | ### getStandardExitId @@ -100,6 +114,7 @@ returns(uint168) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentExitGameArgs.md b/plasma_framework/docs/contracts/PaymentExitGameArgs.md index 74c27affc..5a82a82a6 100644 --- a/plasma_framework/docs/contracts/PaymentExitGameArgs.md +++ b/plasma_framework/docs/contracts/PaymentExitGameArgs.md @@ -34,6 +34,7 @@ struct Args { * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentInFlightExitModelUtils.md b/plasma_framework/docs/contracts/PaymentInFlightExitModelUtils.md index 2259eb3c3..05ce7170b 100644 --- a/plasma_framework/docs/contracts/PaymentInFlightExitModelUtils.md +++ b/plasma_framework/docs/contracts/PaymentInFlightExitModelUtils.md @@ -165,6 +165,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentInFlightExitRouter.md b/plasma_framework/docs/contracts/PaymentInFlightExitRouter.md index 26fceda11..94cb950c5 100644 --- a/plasma_framework/docs/contracts/PaymentInFlightExitRouter.md +++ b/plasma_framework/docs/contracts/PaymentInFlightExitRouter.md @@ -31,6 +31,7 @@ struct BondSize.Params internal piggybackBond; //private members contract PlasmaFramework private framework; +bool private bootDone; ``` @@ -55,7 +56,7 @@ event InFlightExitDeleted(uint168 indexed exitId); ## Functions -- [(struct PaymentExitGameArgs.Args args)](#) +- [boot(struct PaymentExitGameArgs.Args paymentExitGameArgs)](#boot) - [inFlightExits(uint168[] exitIds)](#inflightexits) - [startInFlightExit(struct PaymentInFlightExitRouterArgs.StartExitArgs args)](#startinflightexit) - [piggybackInFlightExitOnInput(struct PaymentInFlightExitRouterArgs.PiggybackInFlightExitOnInputArgs args)](#piggybackinflightexitoninput) @@ -71,17 +72,19 @@ event InFlightExitDeleted(uint168 indexed exitId); - [piggybackBondSize()](#piggybackbondsize) - [updatePiggybackBondSize(uint128 newBondSize)](#updatepiggybackbondsize) -### +### boot + +⤾ overrides [PaymentStandardExitRouter.boot](PaymentStandardExitRouter.md#boot) ```js -function (struct PaymentExitGameArgs.Args args) public nonpayable +function boot(struct PaymentExitGameArgs.Args paymentExitGameArgs) internal nonpayable ``` **Arguments** | Name | Type | Description | | ------------- |------------- | -----| -| args | struct PaymentExitGameArgs.Args | | +| paymentExitGameArgs | struct PaymentExitGameArgs.Args | | ### inFlightExits @@ -296,6 +299,7 @@ function updatePiggybackBondSize(uint128 newBondSize) public nonpayable onlyFrom * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentInFlightExitRouterArgs.md b/plasma_framework/docs/contracts/PaymentInFlightExitRouterArgs.md index 337ed8a04..d507be64d 100644 --- a/plasma_framework/docs/contracts/PaymentInFlightExitRouterArgs.md +++ b/plasma_framework/docs/contracts/PaymentInFlightExitRouterArgs.md @@ -95,6 +95,7 @@ struct ChallengeOutputSpent { * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentOutputToPaymentTxCondition.md b/plasma_framework/docs/contracts/PaymentOutputToPaymentTxCondition.md index 0c496163a..42d2e3fc0 100644 --- a/plasma_framework/docs/contracts/PaymentOutputToPaymentTxCondition.md +++ b/plasma_framework/docs/contracts/PaymentOutputToPaymentTxCondition.md @@ -72,6 +72,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentPiggybackInFlightExit.md b/plasma_framework/docs/contracts/PaymentPiggybackInFlightExit.md index bcb627ac7..a8b471e0d 100644 --- a/plasma_framework/docs/contracts/PaymentPiggybackInFlightExit.md +++ b/plasma_framework/docs/contracts/PaymentPiggybackInFlightExit.md @@ -129,6 +129,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentProcessInFlightExit.md b/plasma_framework/docs/contracts/PaymentProcessInFlightExit.md index f8da88e76..225b39004 100644 --- a/plasma_framework/docs/contracts/PaymentProcessInFlightExit.md +++ b/plasma_framework/docs/contracts/PaymentProcessInFlightExit.md @@ -229,6 +229,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentProcessStandardExit.md b/plasma_framework/docs/contracts/PaymentProcessStandardExit.md index 1d00f39cb..3748b996d 100644 --- a/plasma_framework/docs/contracts/PaymentProcessStandardExit.md +++ b/plasma_framework/docs/contracts/PaymentProcessStandardExit.md @@ -22,18 +22,19 @@ struct Controller { event ExitOmitted(uint168 indexed exitId); event ExitFinalized(uint168 indexed exitId); event BondReturnFailed(address indexed receiver, uint256 amount); +event BountyRewardFailed(address indexed receiver, uint256 amount); ``` ## Functions -- [run(struct PaymentProcessStandardExit.Controller self, struct PaymentExitDataModel.StandardExitMap exitMap, uint168 exitId, address token)](#run) +- [run(struct PaymentProcessStandardExit.Controller self, struct PaymentExitDataModel.StandardExitMap exitMap, uint168 exitId, address token, address payable processor)](#run) ### run Main logic function to process standard exit ```js -function run(struct PaymentProcessStandardExit.Controller self, struct PaymentExitDataModel.StandardExitMap exitMap, uint168 exitId, address token) public nonpayable +function run(struct PaymentProcessStandardExit.Controller self, struct PaymentExitDataModel.StandardExitMap exitMap, uint168 exitId, address token, address payable processor) public nonpayable ``` **Arguments** @@ -44,6 +45,7 @@ function run(struct PaymentProcessStandardExit.Controller self, struct PaymentEx | exitMap | struct PaymentExitDataModel.StandardExitMap | The storage of all standard exit data | | exitId | uint168 | The exitId of the standard exit | | token | address | The ERC20 token address of the exit. Uses address(0) to represent ETH. | +| processor | address payable | | ## Contracts @@ -58,6 +60,7 @@ function run(struct PaymentProcessStandardExit.Controller self, struct PaymentEx * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentStandardExitRouter.md b/plasma_framework/docs/contracts/PaymentStandardExitRouter.md index bae2c635e..9df67e9f4 100644 --- a/plasma_framework/docs/contracts/PaymentStandardExitRouter.md +++ b/plasma_framework/docs/contracts/PaymentStandardExitRouter.md @@ -25,6 +25,7 @@ struct BondSize.Params internal startStandardExitBond; //private members contract PlasmaFramework private framework; +bool private bootDone; ``` @@ -41,25 +42,28 @@ event BondReturnFailed(address indexed receiver, uint256 amount); ## Functions -- [(struct PaymentExitGameArgs.Args args)](#) +- [boot(struct PaymentExitGameArgs.Args paymentExitGameArgs)](#boot) - [standardExits(uint168[] exitIds)](#standardexits) - [startStandardExitBondSize()](#startstandardexitbondsize) - [updateStartStandardExitBondSize(uint128 newBondSize)](#updatestartstandardexitbondsize) +- [processStandardExitBountySize(uint256 gasPriceStartExit)](#processstandardexitbountysize) - [startStandardExit(struct PaymentStandardExitRouterArgs.StartStandardExitArgs args)](#startstandardexit) - [challengeStandardExit(struct PaymentStandardExitRouterArgs.ChallengeStandardExitArgs args)](#challengestandardexit) -- [processStandardExit(uint168 exitId, address token)](#processstandardexit) +- [processStandardExit(uint168 exitId, address token, address payable processor)](#processstandardexit) -### +### boot + +⤿ Overridden Implementation(s): [PaymentInFlightExitRouter.boot](PaymentInFlightExitRouter.md#boot) ```js -function (struct PaymentExitGameArgs.Args args) public nonpayable +function boot(struct PaymentExitGameArgs.Args paymentExitGameArgs) internal nonpayable ``` **Arguments** | Name | Type | Description | | ------------- |------------- | -----| -| args | struct PaymentExitGameArgs.Args | | +| paymentExitGameArgs | struct PaymentExitGameArgs.Args | | ### standardExits @@ -104,6 +108,21 @@ function updateStartStandardExitBondSize(uint128 newBondSize) public nonpayable | ------------- |------------- | -----| | newBondSize | uint128 | The new bond size | +### processStandardExitBountySize + +Retrieves the process standard exit bounty size + +```js +function processStandardExitBountySize(uint256 gasPriceStartExit) public view +returns(uint256) +``` + +**Arguments** + +| Name | Type | Description | +| ------------- |------------- | -----| +| gasPriceStartExit | uint256 | | + ### startStandardExit Starts a standard exit of a given output, using output-age priority @@ -137,7 +156,7 @@ function challengeStandardExit(struct PaymentStandardExitRouterArgs.ChallengeSta Process standard exit ```js -function processStandardExit(uint168 exitId, address token) internal nonpayable +function processStandardExit(uint168 exitId, address token, address payable processor) internal nonpayable ``` **Arguments** @@ -146,6 +165,7 @@ function processStandardExit(uint168 exitId, address token) internal nonpayable | ------------- |------------- | -----| | exitId | uint168 | The standard exit ID | | token | address | The token (in erc20 address or address(0) for ETH) of the exiting output | +| processor | address payable | The processExit initiator | ## Contracts @@ -160,6 +180,7 @@ function processStandardExit(uint168 exitId, address token) internal nonpayable * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentStandardExitRouterArgs.md b/plasma_framework/docs/contracts/PaymentStandardExitRouterArgs.md index 933a44827..64aef96f0 100644 --- a/plasma_framework/docs/contracts/PaymentStandardExitRouterArgs.md +++ b/plasma_framework/docs/contracts/PaymentStandardExitRouterArgs.md @@ -43,6 +43,7 @@ struct ChallengeStandardExitArgs { * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentStartInFlightExit.md b/plasma_framework/docs/contracts/PaymentStartInFlightExit.md index b1169960a..808a04be4 100644 --- a/plasma_framework/docs/contracts/PaymentStartInFlightExit.md +++ b/plasma_framework/docs/contracts/PaymentStartInFlightExit.md @@ -37,7 +37,7 @@ struct StartExitData { **Events** ```js -event InFlightExitStarted(address indexed initiator, bytes32 indexed txHash); +event InFlightExitStarted(address indexed initiator, bytes32 indexed txHash, bytes inFlightTx, uint256[] inputUtxosPos, bytes[] inFlightTxWitnesses); ``` ## Functions @@ -303,6 +303,7 @@ function setInFlightExitOutputs(struct PaymentExitDataModel.InFlightExit ife, st * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentStartStandardExit.md b/plasma_framework/docs/contracts/PaymentStartStandardExit.md index 7bab3272e..052fcc0df 100644 --- a/plasma_framework/docs/contracts/PaymentStartStandardExit.md +++ b/plasma_framework/docs/contracts/PaymentStartStandardExit.md @@ -37,7 +37,7 @@ struct StartStandardExitData { **Events** ```js -event ExitStarted(address indexed owner, uint168 exitId); +event ExitStarted(address indexed owner, uint168 exitId, uint256 utxoPos); ``` ## Functions @@ -168,6 +168,7 @@ function enqueueStandardExit(struct PaymentStartStandardExit.StartStandardExitDa * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentTransactionModel.md b/plasma_framework/docs/contracts/PaymentTransactionModel.md index 0c2237183..625d05dfd 100644 --- a/plasma_framework/docs/contracts/PaymentTransactionModel.md +++ b/plasma_framework/docs/contracts/PaymentTransactionModel.md @@ -155,6 +155,7 @@ returns(struct FungibleTokenOutputModel.Output) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PaymentTransactionStateTransitionVerifier.md b/plasma_framework/docs/contracts/PaymentTransactionStateTransitionVerifier.md index dca949988..376733ca5 100644 --- a/plasma_framework/docs/contracts/PaymentTransactionStateTransitionVerifier.md +++ b/plasma_framework/docs/contracts/PaymentTransactionStateTransitionVerifier.md @@ -99,6 +99,7 @@ returns(uint256) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PlasmaFramework.md b/plasma_framework/docs/contracts/PlasmaFramework.md index ba5c80c8e..3d4007291 100644 --- a/plasma_framework/docs/contracts/PlasmaFramework.md +++ b/plasma_framework/docs/contracts/PlasmaFramework.md @@ -98,6 +98,7 @@ function setVersion(string _version) public nonpayable onlyFrom * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PosLib.md b/plasma_framework/docs/contracts/PosLib.md index 86197cf91..2acdc0282 100644 --- a/plasma_framework/docs/contracts/PosLib.md +++ b/plasma_framework/docs/contracts/PosLib.md @@ -126,6 +126,7 @@ Position * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/PriorityQueue.md b/plasma_framework/docs/contracts/PriorityQueue.md index dccbab1d3..898257c19 100644 --- a/plasma_framework/docs/contracts/PriorityQueue.md +++ b/plasma_framework/docs/contracts/PriorityQueue.md @@ -181,6 +181,7 @@ returns(uint256) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Protocol.md b/plasma_framework/docs/contracts/Protocol.md index f04a6b16f..560afa710 100644 --- a/plasma_framework/docs/contracts/Protocol.md +++ b/plasma_framework/docs/contracts/Protocol.md @@ -71,6 +71,7 @@ returns(bool) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Quarantine.md b/plasma_framework/docs/contracts/Quarantine.md index f39f76e42..0b685d90b 100644 --- a/plasma_framework/docs/contracts/Quarantine.md +++ b/plasma_framework/docs/contracts/Quarantine.md @@ -66,6 +66,7 @@ function quarantine(struct Quarantine.Data _self, address _contractAddress) inte * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/RLPReader.md b/plasma_framework/docs/contracts/RLPReader.md index fac749094..e0d3e32c8 100644 --- a/plasma_framework/docs/contracts/RLPReader.md +++ b/plasma_framework/docs/contracts/RLPReader.md @@ -191,6 +191,7 @@ The length of the RLPItem (including the length field) and the offset of the pay * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/SafeERC20.md b/plasma_framework/docs/contracts/SafeERC20.md index 145254907..470206e24 100644 --- a/plasma_framework/docs/contracts/SafeERC20.md +++ b/plasma_framework/docs/contracts/SafeERC20.md @@ -120,6 +120,7 @@ function callOptionalReturn(IERC20 token, bytes data) private nonpayable * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/SafeEthTransfer.md b/plasma_framework/docs/contracts/SafeEthTransfer.md index fe5b76fb8..6be835a99 100644 --- a/plasma_framework/docs/contracts/SafeEthTransfer.md +++ b/plasma_framework/docs/contracts/SafeEthTransfer.md @@ -63,6 +63,7 @@ a flag showing the call is successful or not * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/SafeMath.md b/plasma_framework/docs/contracts/SafeMath.md index 8167fff38..20a1409a0 100644 --- a/plasma_framework/docs/contracts/SafeMath.md +++ b/plasma_framework/docs/contracts/SafeMath.md @@ -139,6 +139,7 @@ returns(uint256) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/SpendingConditionRegistry.md b/plasma_framework/docs/contracts/SpendingConditionRegistry.md index 57390bd86..13db8e908 100644 --- a/plasma_framework/docs/contracts/SpendingConditionRegistry.md +++ b/plasma_framework/docs/contracts/SpendingConditionRegistry.md @@ -64,6 +64,7 @@ function registerSpendingCondition(uint256 outputType, uint256 spendingTxType, I * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/Vault.md b/plasma_framework/docs/contracts/Vault.md index 8dcfa8b40..8d29be415 100644 --- a/plasma_framework/docs/contracts/Vault.md +++ b/plasma_framework/docs/contracts/Vault.md @@ -158,6 +158,7 @@ returns(bytes32) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/docs/contracts/VaultRegistry.md b/plasma_framework/docs/contracts/VaultRegistry.md index e3497571b..940aea6a0 100644 --- a/plasma_framework/docs/contracts/VaultRegistry.md +++ b/plasma_framework/docs/contracts/VaultRegistry.md @@ -141,6 +141,7 @@ returns(uint256) * [EthDepositVerifier](EthDepositVerifier.md) * [EthVault](EthVault.md) * [ExitableTimestamp](ExitableTimestamp.md) +* [ExitBounty](ExitBounty.md) * [ExitGameController](ExitGameController.md) * [ExitGameRegistry](ExitGameRegistry.md) * [ExitId](ExitId.md) diff --git a/plasma_framework/package-lock.json b/plasma_framework/package-lock.json index 5674a7c0b..e116883a3 100644 --- a/plasma_framework/package-lock.json +++ b/plasma_framework/package-lock.json @@ -255,6 +255,105 @@ "fastq": "^1.6.0" } }, + "@openzeppelin/contract-loader": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@openzeppelin/contract-loader/-/contract-loader-0.4.0.tgz", + "integrity": "sha512-K+Pl4tn0FbxMSP0H9sgi61ayCbecpqhQmuBshelC7A3q2MlpcqWRJan0xijpwdtv6TORNd5oZNe/+f3l+GD6tw==", + "dev": true, + "requires": { + "find-up": "^4.1.0", + "fs-extra": "^8.1.0", + "try-require": "^1.2.1" + }, + "dependencies": { + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + } + } + }, + "@openzeppelin/test-helpers": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/@openzeppelin/test-helpers/-/test-helpers-0.5.6.tgz", + "integrity": "sha512-8U4sR4ed4cFmc6UKj7akUxZzQJKU9P3p/3RbF+urQuRLLhBaB8zSya1m9VB7/anYEZnBmTDk8LuVgAmYaCPs9A==", + "dev": true, + "requires": { + "@openzeppelin/contract-loader": "^0.4.0", + "@truffle/contract": "^4.0.35 <4.2.2", + "ansi-colors": "^3.2.3", + "chai": "^4.2.0", + "chai-bn": "^0.2.1", + "ethjs-abi": "^0.2.1", + "lodash.flatten": "^4.4.0", + "semver": "^5.6.0", + "web3": "^1.2.1", + "web3-utils": "^1.2.1" + }, + "dependencies": { + "chai-bn": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/chai-bn/-/chai-bn-0.2.1.tgz", + "integrity": "sha512-01jt2gSXAw7UYFPT5K8d7HYjdXj2vyeIuE+0T/34FWzlNcVbs1JkPxRu7rYMfQnJhrHT8Nr6qjSf5ZwwLU2EYg==", + "dev": true + } + } + }, "@sindresorhus/is": { "version": "0.14.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", @@ -280,6 +379,77 @@ "integrity": "sha512-9MyQ/20M96clhIcC7fVFIckGSB8qMsmcdU6iYt98HXJ9GOLNKsCaJFz1OVsJncVreYwTUhoEXTrVBc8zrmPDJQ==", "dev": true }, + "@truffle/contract": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/@truffle/contract/-/contract-4.2.1.tgz", + "integrity": "sha512-af1rUyU/W75GYHt/i7r+NwHozwaCma7V/q/+SRZ3Cw2MFaGOQ0dA/ZGhH8P1F0fmDiUe1DBEIbKxXWai0PWFYg==", + "dev": true, + "requires": { + "@truffle/blockchain-utils": "^0.0.18", + "@truffle/contract-schema": "^3.1.0", + "@truffle/error": "^0.0.8", + "@truffle/interface-adapter": "^0.4.6", + "bignumber.js": "^7.2.1", + "ethereum-ens": "^0.8.0", + "ethers": "^4.0.0-beta.1", + "exorcist": "^1.0.1", + "source-map-support": "^0.5.16", + "web3": "1.2.1", + "web3-core-promievent": "1.2.1", + "web3-eth-abi": "1.2.1", + "web3-utils": "1.2.1" + }, + "dependencies": { + "@truffle/blockchain-utils": { + "version": "0.0.18", + "resolved": "https://registry.npmjs.org/@truffle/blockchain-utils/-/blockchain-utils-0.0.18.tgz", + "integrity": "sha512-XnRu5p1QO9krJizOeBY5WfzPDvEOmCnOT5u6qF8uN3Kkq9vcH3ZqW4XTuzz9ERZNpZfWb3UJx4PUosgeHLs5vw==", + "dev": true, + "requires": { + "source-map-support": "^0.5.16" + } + }, + "@truffle/contract-schema": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/@truffle/contract-schema/-/contract-schema-3.2.3.tgz", + "integrity": "sha512-dnR5wtqCBKVfJDX5g+sCUiDF1WDucpxoWsr6ZOwq9JqgyS4Gz7iJi1wMegMmcDctOykoKjsju6iAOi+HObrkfg==", + "dev": true, + "requires": { + "ajv": "^6.10.0", + "crypto-js": "^3.1.9-1", + "debug": "^4.1.0" + } + }, + "@truffle/error": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/@truffle/error/-/error-0.0.8.tgz", + "integrity": "sha512-x55rtRuNfRO1azmZ30iR0pf0OJ6flQqbax1hJz+Avk1K5fdmOv5cr22s9qFnwTWnS6Bw0jvJEoR0ITsM7cPKtQ==", + "dev": true + }, + "@truffle/interface-adapter": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/@truffle/interface-adapter/-/interface-adapter-0.4.15.tgz", + "integrity": "sha512-0EKUwiU5MZ9EqnideG9bHAEUwgGeo5zpSzAKDwgc/vMxJqAM00+HLro01fFfMItZSPqRh5ro4xP3hEiIXJpz+Q==", + "dev": true, + "requires": { + "bn.js": "^4.11.8", + "ethers": "^4.0.32", + "source-map-support": "^0.5.19", + "web3": "1.2.1" + } + }, + "source-map-support": { + "version": "0.5.19", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.19.tgz", + "integrity": "sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + } + } + }, "@truffle/contract-schema": { "version": "3.0.16", "resolved": "https://registry.npmjs.org/@truffle/contract-schema/-/contract-schema-3.0.16.tgz", @@ -4330,6 +4500,20 @@ "resolved": "https://registry.npmjs.org/ethereum-common/-/ethereum-common-0.2.0.tgz", "integrity": "sha512-XOnAR/3rntJgbCdGhqdaLIxDLWKLmsZOGhHdBKadEr6gEnJLH52k93Ou+TUdFaPN3hJc3isBZBal3U/XZ15abA==" }, + "ethereum-ens": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/ethereum-ens/-/ethereum-ens-0.8.0.tgz", + "integrity": "sha512-a8cBTF4AWw1Q1Y37V1LSCS9pRY4Mh3f8vCg5cbXCCEJ3eno1hbI/+Ccv9SZLISYpqQhaglP3Bxb/34lS4Qf7Bg==", + "dev": true, + "requires": { + "bluebird": "^3.4.7", + "eth-ens-namehash": "^2.0.0", + "js-sha3": "^0.5.7", + "pako": "^1.0.4", + "underscore": "^1.8.3", + "web3": "^1.0.0-beta.34" + } + }, "ethereum-protocol": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/ethereum-protocol/-/ethereum-protocol-1.0.1.tgz", @@ -4707,6 +4891,43 @@ "strip-eof": "^1.0.0" } }, + "exorcist": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/exorcist/-/exorcist-1.0.1.tgz", + "integrity": "sha1-eTFuPEiFhFSQ97tAXA5bXbEWfFI=", + "dev": true, + "requires": { + "is-stream": "~1.1.0", + "minimist": "0.0.5", + "mkdirp": "~0.5.1", + "mold-source-map": "~0.4.0" + }, + "dependencies": { + "minimist": { + "version": "0.0.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.5.tgz", + "integrity": "sha1-16oye87PUY+RBqxrjwA/o7zqhWY=", + "dev": true + }, + "mkdirp": { + "version": "0.5.5", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", + "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + }, + "dependencies": { + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + } + } + } + } + }, "express": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/express/-/express-4.17.1.tgz", @@ -6815,6 +7036,12 @@ "resolved": "https://registry.npmjs.org/lodash.flatmap/-/lodash.flatmap-4.5.0.tgz", "integrity": "sha1-74y/QI9uSCaGYzRTBcaswLd4cC4=" }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=", + "dev": true + }, "lodash.toarray": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/lodash.toarray/-/lodash.toarray-4.4.0.tgz", @@ -7290,6 +7517,24 @@ "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.10.1.tgz", "integrity": "sha512-w22rOL5ZYu6HbUehB5deurghGM0hS/xBVyHMGKOuQctkk93J9z9VEOhDsiWrXOprVNQpP9uzGKdl8v9mFspKuw==" }, + "mold-source-map": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/mold-source-map/-/mold-source-map-0.4.0.tgz", + "integrity": "sha1-z2fgsxxHq5uttcnCVlGGISe7gxc=", + "dev": true, + "requires": { + "convert-source-map": "^1.1.0", + "through": "~2.2.7" + }, + "dependencies": { + "through": { + "version": "2.2.7", + "resolved": "https://registry.npmjs.org/through/-/through-2.2.7.tgz", + "integrity": "sha1-bo4hIAGR1OtqmfbwEN9Gqhxusr0=", + "dev": true + } + } + }, "mri": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.4.tgz", @@ -7758,6 +8003,12 @@ "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", "dev": true }, + "pako": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz", + "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==", + "dev": true + }, "parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -10343,6 +10594,12 @@ "web3": "1.2.1" } }, + "try-require": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/try-require/-/try-require-1.2.1.tgz", + "integrity": "sha1-NEiaLKwMCcHMEO2RugEVlNQzO+I=", + "dev": true + }, "ts-essentials": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/ts-essentials/-/ts-essentials-1.0.4.tgz", diff --git a/plasma_framework/python_tests/tests/contracts/root_chain/test_process_exits.py b/plasma_framework/python_tests/tests/contracts/root_chain/test_process_exits.py index 06a509168..c42350c45 100644 --- a/plasma_framework/python_tests/tests/contracts/root_chain/test_process_exits.py +++ b/plasma_framework/python_tests/tests/contracts/root_chain/test_process_exits.py @@ -27,15 +27,11 @@ def test_process_exits_standard_exit_should_succeed(testlang, num_outputs, plasm utxo_pos, output_owner = prepare_exitable_utxo(testlang, [], amount, [], num_outputs) pre_balance = testlang.get_balance(output_owner) - testlang.flush_events() testlang.start_standard_exit(utxo_pos, output_owner) _, _, exit_id = plasma_framework.getNextExit(plasma_framework.eth_vault_id, NULL_ADDRESS_HEX) - start_exit_events = testlang.flush_events() - assert_events(start_exit_events, - [('ExitStarted', {"owner": output_owner.address, "exitId": exit_id}), - ('ExitQueued', {"exitId": exit_id})]) + testlang.flush_events() testlang.forward_timestamp(2 * MIN_EXIT_PERIOD + 1) testlang.process_exits(NULL_ADDRESS, 0, 100) diff --git a/plasma_framework/test/endToEndTests/FeeClaim.e2e.test.js b/plasma_framework/test/endToEndTests/FeeClaim.e2e.test.js index e48a57ab1..b364ef8c4 100644 --- a/plasma_framework/test/endToEndTests/FeeClaim.e2e.test.js +++ b/plasma_framework/test/endToEndTests/FeeClaim.e2e.test.js @@ -1,6 +1,8 @@ const EthVault = artifacts.require('EthVault'); const PaymentExitGame = artifacts.require('PaymentExitGame'); const PlasmaFramework = artifacts.require('PlasmaFramework'); +const PaymentStartStandardExit = artifacts.require('PaymentStartStandardExit'); +const PaymentStartInFlightExit = artifacts.require('PaymentStartInFlightExit'); const { constants, expectEvent, @@ -220,13 +222,14 @@ contract('PlasmaFramework - Fee Claim', ([_, _maintainer, authority, richFather, }; const bondSize = await this.paymentExitGame.startStandardExitBondSize(); - const tx = await this.paymentExitGame.startStandardExit( - args, { from: operatorFeeAddress, value: bondSize }, - ); - await expectEvent.inLogs( - tx.logs, + const { receipt } = await this.paymentExitGame.startStandardExit(args, { + from: operatorFeeAddress, + value: bondSize, + }); + await expectEvent.inTransaction( + receipt.transactionHash, + PaymentStartStandardExit, 'ExitStarted', - { owner: operatorFeeAddress }, ); }); @@ -242,12 +245,13 @@ contract('PlasmaFramework - Fee Claim', ([_, _maintainer, authority, richFather, }; const bondSize = await this.paymentExitGame.startIFEBondSize(); - const tx = await this.paymentExitGame.startInFlightExit( - args, - { from: alice, value: bondSize }, - ); - await expectEvent.inLogs( - tx.logs, + const { receipt } = await this.paymentExitGame.startInFlightExit(args, { + from: alice, + value: bondSize, + }); + await expectEvent.inTransaction( + receipt.transactionHash, + PaymentStartInFlightExit, 'InFlightExitStarted', ); }); diff --git a/plasma_framework/test/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.test.js b/plasma_framework/test/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.test.js index 592547d93..d6d676e89 100644 --- a/plasma_framework/test/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.test.js +++ b/plasma_framework/test/src/exits/payment/controllers/PaymentChallengeIFENotCanonical.test.js @@ -277,18 +277,23 @@ contract('PaymentChallengeIFENotCanonical', ([_, ifeOwner, inputOwner, outputOwn this.competingTxBlock.blockTimestamp, ); - const challengeIFETx = await this.exitGame.challengeInFlightExitNotCanonical( + const { receipt } = await this.exitGame.challengeInFlightExitNotCanonical( this.challengeArgs, { from: challenger }, ); const rlpInFlightTxBytes = web3.utils.bytesToHex(this.inFlightTx.rlpEncoded()); - await expectEvent.inLogs( - challengeIFETx.logs, + await expectEvent.inTransaction( + receipt.transactionHash, + PaymentChallengeIFENotCanonical, 'InFlightExitChallenged', { challenger, txHash: web3.utils.sha3(rlpInFlightTxBytes), challengeTxPosition: new BN(this.challengeArgs.competingTxPos), + inFlightTxInputIndex: new BN(this.challengeArgs.inFlightTxInputIndex), + challengeTx: this.challengeArgs.competingTx, + challengeTxInputIndex: new BN(this.challengeArgs.competingTxInputIndex), + challengeTxWitness: this.challengeArgs.competingTxWitness.toLowerCase(), }, ); }); @@ -310,13 +315,18 @@ contract('PaymentChallengeIFENotCanonical', ([_, ifeOwner, inputOwner, outputOwn it('should emit InFlightExitChallenged event', async () => { const rlpInFlightTxBytes = web3.utils.bytesToHex(this.inFlightTx.rlpEncoded()); - await expectEvent.inLogs( - this.challengeIFETx.logs, + await expectEvent.inTransaction( + this.challengeIFETx.receipt.transactionHash, + PaymentChallengeIFENotCanonical, 'InFlightExitChallenged', { challenger, txHash: web3.utils.sha3(rlpInFlightTxBytes), challengeTxPosition: new BN(this.challengeArgs.competingTxPos), + inFlightTxInputIndex: new BN(this.challengeArgs.inFlightTxInputIndex), + challengeTx: this.challengeArgs.competingTx, + challengeTxInputIndex: new BN(this.challengeArgs.competingTxInputIndex), + challengeTxWitness: this.challengeArgs.competingTxWitness.toLowerCase(), }, ); }); @@ -486,13 +496,15 @@ contract('PaymentChallengeIFENotCanonical', ([_, ifeOwner, inputOwner, outputOwn // it seems to be solidity `~uint256(0)` - what is important here: it's HUGE const expectedCompetitorPos = new BN(2).pow(new BN(256)).sub(new BN(1)); - const { logs } = await this.exitGame.challengeInFlightExitNotCanonical( + const { receipt } = await this.exitGame.challengeInFlightExitNotCanonical( this.challengeArgs, { from: challenger }, ); const rlpInFlightTxBytes = web3.utils.bytesToHex(this.inFlightTx.rlpEncoded()); - await expectEvent.inLogs( - logs, + + await expectEvent.inTransaction( + receipt.transactionHash, + PaymentChallengeIFENotCanonical, 'InFlightExitChallenged', { challenger, diff --git a/plasma_framework/test/src/exits/payment/controllers/PaymentStartInFlightExit.test.js b/plasma_framework/test/src/exits/payment/controllers/PaymentStartInFlightExit.test.js index 59922f464..ad7859f11 100644 --- a/plasma_framework/test/src/exits/payment/controllers/PaymentStartInFlightExit.test.js +++ b/plasma_framework/test/src/exits/payment/controllers/PaymentStartInFlightExit.test.js @@ -225,21 +225,36 @@ contract('PaymentStartInFlightExit', ([_, alice, richFather, carol]) => { }); it('should emit InFlightExitStarted event', async () => { - const { logs } = await this.exitGame.startInFlightExit( + const { receipt } = await this.exitGame.startInFlightExit( this.args, { from: alice, value: this.startIFEBondSize.toString() }, ); const expectedIfeHash = web3.utils.sha3(this.args.inFlightTx); - await expectEvent.inLogs( - logs, + await expectEvent.inTransaction( + receipt.transactionHash, + PaymentStartInFlightExit, 'InFlightExitStarted', { initiator: alice, txHash: expectedIfeHash, + inFlightTx: this.args.inFlightTx, }, ); + + // expectEvent.inTransaction can't properly match arrays + const txReceipt = await web3.eth.getTransactionReceipt(receipt.transactionHash); + const logs = PaymentStartInFlightExit.decodeLogs(txReceipt.logs); + const event = logs.filter(e => e.event === 'InFlightExitStarted')[0]; + + expect(event.args.inFlightTxWitnesses).to.have.ordered.members(this.args.inFlightTxWitnesses); + + const inputUtxosPos = this.args.inputUtxosPos.map(utxoPos => new BN(utxoPos)); + expect(event.args.inputUtxosPos).to.have.lengthOf(inputUtxosPos.length); + for (let i = 0; i < inputUtxosPos.length; i++) { + expect(event.args.inputUtxosPos[i].eq(inputUtxosPos[i])); + } }); it('should charge user with a bond', async () => { @@ -280,15 +295,16 @@ contract('PaymentStartInFlightExit', ([_, alice, richFather, carol]) => { }); it('should be able to start by non input or output owner', async () => { - const { logs } = await this.exitGame.startInFlightExit( + const { receipt } = await this.exitGame.startInFlightExit( this.args, { from: richFather, value: this.startIFEBondSize.toString() }, ); const expectedIfeHash = web3.utils.sha3(this.args.inFlightTx); - await expectEvent.inLogs( - logs, + await expectEvent.inTransaction( + receipt.transactionHash, + PaymentStartInFlightExit, 'InFlightExitStarted', { initiator: richFather, diff --git a/plasma_framework/test/src/exits/payment/controllers/PaymentStartStandardExit.test.js b/plasma_framework/test/src/exits/payment/controllers/PaymentStartStandardExit.test.js index 1ce5ca326..9ec66f7d4 100644 --- a/plasma_framework/test/src/exits/payment/controllers/PaymentStartStandardExit.test.js +++ b/plasma_framework/test/src/exits/payment/controllers/PaymentStartStandardExit.test.js @@ -35,13 +35,13 @@ contract('PaymentStartStandardExit', ([_, outputOwner, nonOutputOwner]) => { const INITIAL_IMMUNE_EXIT_GAME_NUM = 1; before('deploy and link with controller lib', async () => { - const startStandardExit = await PaymentStartStandardExit.new(); - const challengeStandardExit = await PaymentChallengeStandardExit.new(); - const processStandardExit = await PaymentProcessStandardExit.new(); + this.startStandardExit = await PaymentStartStandardExit.new(); + this.challengeStandardExit = await PaymentChallengeStandardExit.new(); + this.processStandardExit = await PaymentProcessStandardExit.new(); - await PaymentStandardExitRouter.link('PaymentStartStandardExit', startStandardExit.address); - await PaymentStandardExitRouter.link('PaymentChallengeStandardExit', challengeStandardExit.address); - await PaymentStandardExitRouter.link('PaymentProcessStandardExit', processStandardExit.address); + await PaymentStandardExitRouter.link('PaymentStartStandardExit', this.startStandardExit.address); + await PaymentStandardExitRouter.link('PaymentChallengeStandardExit', this.challengeStandardExit.address); + await PaymentStandardExitRouter.link('PaymentProcessStandardExit', this.processStandardExit.address); }); describe('startStandardExit', () => { @@ -346,14 +346,20 @@ contract('PaymentStartStandardExit', ([_, outputOwner, nonOutputOwner]) => { const isTxDeposit = await this.framework.isDeposit(this.dummyBlockNum); const exitId = await this.exitIdHelper.getStandardExitId(isTxDeposit, args.rlpOutputTx, args.utxoPos); - const { logs } = await this.exitGame.startStandardExit( - args, { from: outputOwner, value: this.startStandardExitBondSize }, - ); + const { receipt } = await this.exitGame.startStandardExit(args, { + from: outputOwner, + value: this.startStandardExitBondSize, + }); - await expectEvent.inLogs( - logs, + await expectEvent.inTransaction( + receipt.transactionHash, + PaymentStartStandardExit, 'ExitStarted', - { owner: outputOwner, exitId }, + { + owner: outputOwner, + exitId, + utxoPos: new BN(args.utxoPos), + }, ); }); @@ -371,28 +377,42 @@ contract('PaymentStartStandardExit', ([_, outputOwner, nonOutputOwner]) => { const isTxDeposit = await this.framework.isDeposit(BLOCK_NUM); - const { logs: logs1 } = await this.exitGame.startStandardExit( - args[0], { from: outputOwner, value: this.startStandardExitBondSize }, - ); + const { receipt: receipt1 } = await this.exitGame.startStandardExit(args[0], { + from: outputOwner, + value: this.startStandardExitBondSize, + }); const exitId1 = await this.exitIdHelper.getStandardExitId( isTxDeposit, args[0].rlpOutputTx, args[0].utxoPos, ); - await expectEvent.inLogs( - logs1, + + await expectEvent.inTransaction( + receipt1.transactionHash, + PaymentStartStandardExit, 'ExitStarted', - { owner: outputOwner, exitId: exitId1 }, + { + owner: outputOwner, + exitId: exitId1, + utxoPos: new BN(args[0].utxoPos), + }, ); - const { logs: logs2 } = await this.exitGame.startStandardExit( - args[1], { from: outputOwner, value: this.startStandardExitBondSize }, - ); + const { receipt: receipt2 } = await this.exitGame.startStandardExit(args[1], { + from: outputOwner, + value: this.startStandardExitBondSize, + }); const exitId2 = await this.exitIdHelper.getStandardExitId( isTxDeposit, args[1].rlpOutputTx, args[1].utxoPos, ); - await expectEvent.inLogs( - logs2, + + await expectEvent.inTransaction( + receipt2.transactionHash, + PaymentStartStandardExit, 'ExitStarted', - { owner: outputOwner, exitId: exitId2 }, + { + owner: outputOwner, + exitId: exitId2, + utxoPos: new BN(args[1].utxoPos), + }, ); }); });