Skip to content

Commit

Permalink
fix(og): N-04 - Eliminate redundant code (#4493)
Browse files Browse the repository at this point in the history
Signed-off-by: Reinis Martinsons <reinis@umaproject.org>
  • Loading branch information
Reinis-FRP committed Mar 22, 2023
1 parent c1e996c commit 835a6ff
Showing 1 changed file with 7 additions and 6 deletions.
Expand Up @@ -260,7 +260,7 @@ contract OptimisticGovernor is OptimisticOracleV3CallbackRecipientInterface, Mod
// This will fail if the proposer has not granted the Optimistic Governor contract an allowance
// of the collateral token equal to or greater than the totalBond.
uint256 totalBond = getProposalBond();
collateral.safeTransferFrom(msg.sender, address(this), totalBond);
collateral.safeTransferFrom(proposer, address(this), totalBond);
collateral.safeIncreaseAllowance(address(optimisticOracleV3), totalBond);
// Assert that the proposal is correct at the Optimistic Oracle V3.
Expand Down Expand Up @@ -301,14 +301,15 @@ contract OptimisticGovernor is OptimisticOracleV3CallbackRecipientInterface, Mod
// Recreate the proposal hash from the inputs and check that it matches the stored proposal hash.
bytes32 proposalHash = keccak256(abi.encode(transactions));
// This will reject the transaction if the proposal hash generated from the inputs does not match the stored
// proposal hash. This is possible when a) the transactions have not been proposed, b) transactions have already
// been executed, c) the proposal was disputed or d) the proposal was deleted after Optimistic Oracle V3 upgrade.
require(assertionIds[proposalHash] != bytes32(0), "Proposal hash does not exist");
// Get the original proposal assertionId.
bytes32 assertionId = assertionIds[proposalHash];
// This will reject the transaction if the proposal hash generated from the inputs does not have the associated
// assertionId stored. This is possible when a) the transactions have not been proposed, b) transactions have
// already been executed, c) the proposal was disputed or d) the proposal was deleted after Optimistic Oracle V3
// upgrade.
require(assertionId != bytes32(0), "Proposal hash does not exist");
// Remove proposal hash and assertionId so transactions can not be executed again.
delete assertionIds[proposalHash];
delete proposalHashes[assertionId];
Expand Down

0 comments on commit 835a6ff

Please sign in to comment.