Skip to content

Commit

Permalink
Merge branch 'main' into forbig_unknown_preimages
Browse files Browse the repository at this point in the history
  • Loading branch information
fleupold authored Feb 5, 2024
2 parents e51b289 + d2a6480 commit 37412e5
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 12 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Nag Stale Pull Requests
on:
schedule:
- cron: '0 0 * * *' # Run every day at midnight
jobs:
close_stale_prs:
runs-on: ubuntu-latest
steps:
- name: Close stale pull requests
uses: actions/stale@v5
with:
days-before-stale: 7
days-before-issue-stale: 60
days-before-close: 7
stale-pr-message: 'This pull request has been marked as stale because it has been inactive a while. Please update this pull request or it will be automatically closed.'
stale-issue-message: 'This issue has been marked as stale because it has been inactive a while. Please update this issue or it will be automatically closed.'
stale-pr-label: stale
1 change: 0 additions & 1 deletion crates/e2e/tests/e2e/ethflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,6 @@ impl EthFlowTradeIntent {
},
buy_token_balance: BuyTokenDestination::Erc20,
sell_token_balance: SellTokenSource::Erc20,
partially_fillable: false,
price_quality: PriceQuality::Optimal,
}
}
Expand Down
17 changes: 17 additions & 0 deletions crates/e2e/tests/e2e/limit_orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use {
ethcontract::{prelude::U256, H160},
model::{
order::{OrderClass, OrderCreation, OrderKind},
quote::{OrderQuoteRequest, OrderQuoteSide, SellAmount},
signature::EcdsaSigningScheme,
},
secp256k1::SecretKey,
Expand Down Expand Up @@ -543,6 +544,22 @@ async fn forked_mainnet_single_limit_order_test(web3: Web3) {
&onchain.contracts().domain_separator,
SecretKeyRef::from(&SecretKey::from_slice(trader.private_key()).unwrap()),
);

// Warm up co-located driver by quoting the order (otherwise placing an order
// may time out)
let _ = services
.submit_quote(&OrderQuoteRequest {
sell_token: token_usdc.address(),
buy_token: token_usdt.address(),
side: OrderQuoteSide::Sell {
sell_amount: SellAmount::BeforeFee {
value: to_wei_with_exp(1000, 6).try_into().unwrap(),
},
},
..Default::default()
})
.await;

let order_id = services.create_order(&order).await.unwrap();
let limit_order = services.get_order(&order_id).await.unwrap();
assert_eq!(limit_order.metadata.class, OrderClass::Limit);
Expand Down
3 changes: 0 additions & 3 deletions crates/model/src/quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ pub struct OrderQuoteRequest {
#[serde(flatten, deserialize_with = "deserialize_optional_app_data")]
pub app_data: OrderCreationAppData,
#[serde(default)]
pub partially_fillable: bool,
#[serde(default)]
pub sell_token_balance: SellTokenSource,
#[serde(default)]
pub buy_token_balance: BuyTokenDestination,
Expand Down Expand Up @@ -334,7 +332,6 @@ mod tests {
"buyAmountAfterFee": "1",
"validFor": 1800,
"appData": "0x0000000000000000000000000000000000000000000000000000000000000000",
"partiallyFillable": false,
"sellTokenBalance": "erc20",
"buyTokenBalance": "erc20",
"signingScheme": "eip712",
Expand Down
3 changes: 0 additions & 3 deletions crates/orderbook/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1385,9 +1385,6 @@ components:
In case they differ, the call will fail.
anyOf:
- $ref: "#/components/schemas/AppDataHash"
partiallyFillable:
description: Is the order fill-or-kill or partially fillable?
type: boolean
sellTokenBalance:
allOf:
- $ref: "#/components/schemas/SellTokenSource"
Expand Down
3 changes: 0 additions & 3 deletions crates/orderbook/src/api/post_quote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ mod tests {
},
validity: Validity::To(0x12345678),
app_data: AppDataHash([0x90; 32]).into(),
partially_fillable: false,
sell_token_balance: SellTokenSource::Erc20,
buy_token_balance: BuyTokenDestination::Internal,
signing_scheme: QuoteSigningScheme::PreSign {
Expand Down Expand Up @@ -168,7 +167,6 @@ mod tests {
},
validity: Validity::For(1000),
app_data: AppDataHash([0x90; 32]).into(),
partially_fillable: false,
sell_token_balance: SellTokenSource::External,
price_quality: PriceQuality::Fast,
..Default::default()
Expand Down Expand Up @@ -201,7 +199,6 @@ mod tests {
},
validity: Validity::To(0x12345678),
app_data: AppDataHash([0x90; 32]).into(),
partially_fillable: false,
..Default::default()
}
);
Expand Down
2 changes: 1 addition & 1 deletion crates/orderbook/src/quoter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl QuoteHandler {
},
fee_amount: quote.fee_amount,
kind: quote.data.kind,
partially_fillable: request.partially_fillable,
partially_fillable: false,
sell_token_balance: request.sell_token_balance,
buy_token_balance: request.buy_token_balance,
signing_scheme: request.signing_scheme.into(),
Expand Down
2 changes: 1 addition & 1 deletion crates/shared/src/order_quoting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ impl From<&OrderQuoteRequest> for PreOrderData {
buy_token: quote_request.buy_token,
receiver: quote_request.receiver.unwrap_or(owner),
valid_to: quote_request.validity.actual_valid_to(),
partially_fillable: quote_request.partially_fillable,
partially_fillable: false,
buy_token_balance: quote_request.buy_token_balance,
sell_token_balance: quote_request.sell_token_balance,
signing_scheme: quote_request.signing_scheme.into(),
Expand Down
19 changes: 19 additions & 0 deletions database/sql/V060__app_data_overrides.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-- Populates app data table with a set of legacy (ie not well formed) but known to be legitimate app data values.
-- We are assuming no specific metadata semantics (ie empty app data) for these values.
INSERT INTO app_data
(contract_app_data, full_app_data)
VALUES
-- Legit user 0x634b41c246f9afce16de397424704130b588139f
('\x1ba2c7f5680dd17a4d852b9c590afa0969893c2b1052a7f553542697f5668171', decode('{}', 'escape')),
-- Legit use case (lots of users)
('\x8906d5e6f69e3d8133f70c0451990044978ad5ed54be76f6f618b6c5784526c5', decode('{}', 'escape')),
-- Fee withdrawals
('\x2947be33ebfa25686ec204857135dd1c676f35d6c252eb066fffaf9b493a01b4', decode('{}', 'escape')),
-- Example python trading script
('\x0000000000000000000000000000000000000000000000000000000000000ccc', decode('{}', 'escape')),
-- Legit user 0xfcd2f5f382e4b3cd3b67a4e399ada0edf56d0383
('\xd19e76e4a302bc4e0018de6210f5fde3c55e3618a23a261fa94e4d19ceeb039d', decode('{}', 'escape')),
-- Limit order tutorial
('\xf785fae7a7c5abc49f3cd6a61f6df1ff26433392b066ee9ff2240ff1eb7ab6e4', decode('{}', 'escape')),
-- DCA Order (e.g. https://etherscan.io/address/0x224d04a92583936b9dd86c9ee8dd450290eded66#code)
('\x9b5c6dfa0fa4be89e17700f05bee8775b281aa6d2dac7dfbf3945e0f9642d777', decode('{}', 'escape'));

0 comments on commit 37412e5

Please sign in to comment.