Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enrich contract events to contain data needed by child-chain and watcher #686

Merged
merged 6 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
});
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ library PaymentStartInFlightExit {

event InFlightExitStarted(
address indexed initiator,
bytes32 indexed txHash
bytes32 indexed txHash,
bytes inFlightTx,
uint256[] inputUtxosPos,
bytes[] inputTxs,
bytes[] inFlightTxWitnesses
);

/**
Expand Down Expand Up @@ -105,7 +109,14 @@ 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,
inputTxs: args.inputTxs,
inFlightTxWitnesses: args.inFlightTxWitnesses
});
}

function createStartExitData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ library PaymentStartStandardExit {

event ExitStarted(
address indexed owner,
uint168 exitId
uint168 exitId,
uint256 utxoPos,
bytes rlpOutputTx
Copy link
Contributor

@InoMurko InoMurko Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmmm, do we need rlpOutputTx ? I don't think we do. I thin it's only utxoPos that we pull out of calldata.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rlpOutputTx gets renamed into:

{"outputTxInclusionProof", :output_tx_inclusion_proof},
      {"rlpOutputTx", :output_tx},
      {"utxoPos", :utxo_pos}

so it's output_tx.

Copy link
Contributor Author

@pgebal pgebal Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need it in our current code @InoMurko . Check fields.ex and exit processor core. We are currently getting it from call data. We could work around that by getting the tx from rocksdb storage.

Copy link
Contributor

@InoMurko InoMurko Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah fields.ex is a mapping module for structural decoding of ABI data, it's not really used anywhere.

Copy link
Contributor Author

@pgebal pgebal Aug 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

);

/**
Expand Down Expand Up @@ -90,7 +92,12 @@ library PaymentStartStandardExit {
saveStandardExitData(data, exitMap);
enqueueStandardExit(data);

emit ExitStarted(msg.sender, data.exitId);
emit ExitStarted({
owner: msg.sender,
exitId: data.exitId,
utxoPos: args.utxoPos,
rlpOutputTx: args.rlpOutputTx
});
}

function setupStartStandardExitData(
Expand Down
257 changes: 257 additions & 0 deletions plasma_framework/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading