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

require txOrigin for RFQ orders, allow origins to register alternate … #47

Merged
merged 6 commits into from
Nov 24, 2020

Conversation

smarx
Copy link
Contributor

@smarx smarx commented Nov 24, 2020

…addresses that can fill orders

Description

RFQ orders now require that the tx.origin is either txOrigin or another address that's been specifically allowed (via registerAllowedOrigin()).

Testing instructions

yarn test

Types of changes

  • New feature / breaking change: txOrigin == 0 no longer means RFQ orders are open to any tx.origin.

Checklist:

  • Prefix PR title with [WIP] if necessary.
  • Add tests to cover changes as needed.
  • Update documentation as needed.
  • Add new entries to the relevant CHANGELOG.jsons.

@smarx
Copy link
Contributor Author

smarx commented Nov 24, 2020

Question: what (if any) events do we need to add for registering and unregistering allowed origins?

Copy link
Contributor

@dorothy-zbornak dorothy-zbornak left a comment

Choose a reason for hiding this comment

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

Yup, makes sense.

@@ -862,8 +880,11 @@ contract NativeOrdersFeature is
).rrevert();
}

LibNativeOrdersStorage.Storage storage stor =
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we block scope this to free up the stack?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just fixed this.

@@ -86,10 +86,10 @@ blockchainTests.resets('NativeOrdersFeature', env => {
await makerToken.mint(maker, order.makerAmount).awaitTransactionSuccessAsync();
if ('takerTokenFeeAmount' in order) {
await takerToken
.mint(taker, order.takerAmount.plus(order.takerTokenFeeAmount))
.mint(_taker, order.takerAmount.plus(order.takerTokenFeeAmount))
Copy link
Contributor

Choose a reason for hiding this comment

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

😇

/// @param origin The address doing the registration.
/// @param addr The address being registered.
/// @param allowed Indicates whether the address should be allowed.
event OriginAllowed(
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's make these names more verbose, like RfqOrderOriginAllowed

/// specifies the message sender as its txOrigin.
/// @param origin The origin to update.
/// @param allowed True to register, false to unregister.
function registerAllowedOrigin(address origin, bool allowed)
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe

Suggested change
function registerAllowedOrigin(address origin, bool allowed)
function registerAllowedRfqOrigin(address origin, bool allowed)

@smarx smarx force-pushed the feat/origin-registry branch from 831a2ae to 737bd0e Compare November 24, 2020 21:34
Copy link
Contributor

@hysz hysz left a comment

Choose a reason for hiding this comment

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

Looks great! Let's merge (~‾▿‾)~

@smarx smarx merged commit 841e4ee into development Nov 24, 2020
@smarx smarx deleted the feat/origin-registry branch November 24, 2020 21:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants