-
Notifications
You must be signed in to change notification settings - Fork 90
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
Unify networks and add Base support #3091
Changes from all commits
7959140
5583cf9
ccdcea6
f852b45
51fa5cc
9b2d13e
489fc70
6a57edb
a6f8c61
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ mod auction; | |
mod observer; | ||
mod trade; | ||
mod transaction; | ||
use chain::Chain; | ||
pub use {auction::Auction, observer::Observer, trade::Trade, transaction::Transaction}; | ||
|
||
/// A settled transaction together with the `Auction`, for which it was executed | ||
|
@@ -106,7 +107,7 @@ impl Settlement { | |
pub async fn new( | ||
settled: Transaction, | ||
persistence: &infra::Persistence, | ||
chain: &infra::blockchain::Id, | ||
chain: &Chain, | ||
) -> Result<Self, Error> { | ||
let auction = persistence.get_auction(settled.auction_id).await?; | ||
|
||
|
@@ -138,23 +139,13 @@ impl Settlement { | |
} | ||
} | ||
|
||
const MAINNET_BLOCK_TIME: u64 = 13_000; // ms | ||
const GNOSIS_BLOCK_TIME: u64 = 5_000; // ms | ||
const SEPOLIA_BLOCK_TIME: u64 = 13_000; // ms | ||
const ARBITRUM_ONE_BLOCK_TIME: u64 = 100; // ms | ||
|
||
/// How old (in terms of blocks) a settlement should be, to be considered as a | ||
/// settlement from another environment. | ||
/// | ||
/// Currently set to ~6h | ||
fn max_settlement_age(chain: &infra::blockchain::Id) -> u64 { | ||
fn max_settlement_age(chain: &Chain) -> u64 { | ||
const TARGET_AGE: u64 = 6 * 60 * 60 * 1000; // 6h in ms | ||
match chain { | ||
infra::blockchain::Id::Mainnet => TARGET_AGE / MAINNET_BLOCK_TIME, | ||
infra::blockchain::Id::Gnosis => TARGET_AGE / GNOSIS_BLOCK_TIME, | ||
infra::blockchain::Id::Sepolia => TARGET_AGE / SEPOLIA_BLOCK_TIME, | ||
infra::blockchain::Id::ArbitrumOne => TARGET_AGE / ARBITRUM_ONE_BLOCK_TIME, | ||
} | ||
chain.blocks_in(TARGET_AGE).round() as u64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah, I thought of that, but blocks in X time seemed to me pretty generic, regardless of it is used only by autopilot or not 🤔 it is not domain code, it is generic code. That's why I kept the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's more, the code you are commenting on is NOT in the chain crate, but in the autopilot, so I don't know if you confused it 🤔 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, not a big deal for this function in particular. Just wanted to align what we put in |
||
} | ||
|
||
#[derive(Debug, thiserror::Error)] | ||
|
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was incorrect, it should've been 250. Any special reason for it @sunce86 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I just thought it's 100ms 😄