-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] adds simulation to block loop #71
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
base: main
Are you sure you want to change the base?
Conversation
- shifts the tx-poller to a more actor oriented approach by streaming transactions out of the cache. - transaction deduplication and validation is intended to be carried out by the simulator.
* fix: break loop on closure and improve tracing * refactor: break out the task future
- adds init4 metrics - updates provider types to account for alloy changes
- align to alloy @ 0.12.6 - transfer off of zenith-rs and use signet-sdk instead
ac4bbb1
to
47a2ed7
Compare
47a2ed7
to
1ee991f
Compare
} | ||
|
||
/// polls the tx-pool for unique transactions and evicts expired transactions. | ||
/// unique transactions that haven't been seen before are sent into the builder pipeline. | ||
/// Polls the transaction cache for transactions. | ||
pub async fn check_tx_cache(&mut self) -> Result<Vec<TxEnvelope>, Error> { |
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.
FYI, this PR pulls this functionality into the SDK - but no need to block on it
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.
Will address in a follow-up PR 👍
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.
we are going places 😎
|
||
let port = config.builder_port; | ||
let server = serve_builder_with_span(([0, 0, 0, 0], port), span); | ||
|
||
select! { | ||
_ = tx_poller_jh => { | ||
tracing::info!("tx_poller finished"); |
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.
i miss is cooked
:(
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.
is cooked
got cooked
pub config: BuilderConfig, | ||
/// Reqwest client for fetching transactions from the tx-pool | ||
/// Reqwest Client for fetching transactions from the cache. |
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.
we can replace this with TxCache
after init4tech/signet-sdk#39
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.
Will address in a follow up PR 👍
- adds newlines after arguments and returns sections in comments - pulls several functions out into methods
…ng with env config
- refactors the rollup provider type from a FillProvider to a RootProvider - defines the alloy database provider type around this - updates relevant connection functions to use the new RuProvider type - renames Provider to HostProvider - renames WalletlessProvider to RuProvider
src/consts.rs
Outdated
@@ -0,0 +1,4 @@ | |||
//! Constants used in the builder. |
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.
mega nit: let's just call this file constants.rs
since that's the usual name elsewhere
EDIT: well just saw on the prev review that this was the suggestion. feel free to ignore
src/config.rs
Outdated
address!("0x4E8cC181805aFC307C83298242271142b8e2f249"), | ||
address!("0xd553C4CA4792Af71F4B61231409eaB321c1Dd2Ce"), | ||
address!("0x1af3A16857C28917Ab2C4c78Be099fF251669200"), | ||
PredeployTokens::new( | ||
address!("0x885F8DB528dC8a38aA3DDad9D3F619746B4a6A81"), | ||
address!("0x7970D259D4a96764Fa9B23FF0715A35f06f52D1A"), | ||
address!("0x7970D259D4a96764Fa9B23FF0715A35f06f52D1A"), | ||
), | ||
); | ||
let rollup = RollupConfig::new( | ||
self.ru_chain_id, | ||
address!("0x4E8cC181805aFC307C83298242271142b8e2f249"), | ||
address!("0xd553C4CA4792Af71F4B61231409eaB321c1Dd2Ce"), | ||
address!("0xe0eDA3701D44511ce419344A4CeD30B52c9Ba231"), | ||
PredeployTokens::new( | ||
address!("0x0B8BC5e60EE10957E0d1A0d95598fA63E65605e2"), | ||
address!("0xF34326d3521F1b07d1aa63729cB14A372f8A737C"), | ||
address!("0xE3d7066115f7d6b65F88Dff86288dB4756a7D733"), |
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.
these should all be constants in constants.rs
|
||
let port = config.builder_port; | ||
let server = serve_builder_with_span(([0, 0, 0, 0], port), span); | ||
|
||
select! { | ||
_ = tx_poller_jh => { | ||
tracing::info!("tx_poller finished"); |
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.
is cooked
got cooked
/// Error checking available system concurrency | ||
#[error("failed to determine system concurrency: {0}")] | ||
Io(#[from] std::io::Error), |
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.
so, i think the error thrown when checking concurrency will add the specific info; therefore, we can keep this general as an "I/O error" instead of using Io
to describe the specific concurrency check error.
@@ -278,5 +309,18 @@ pub fn load_url(key: &str) -> Result<Cow<'static, str>, ConfigError> { | |||
/// Load an address from an environment variable. | |||
pub fn load_address(key: &str) -> Result<Address, ConfigError> { | |||
let address = load_string(key)?; | |||
Address::from_str(&address).map_err(Into::into) | |||
Address::from_str(&address) | |||
.map_err(|_| ConfigError::Var(format!("Invalid address format for {}", key))) |
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.
let's include the actual error source
[feat] adds simulation to block loop
This PR adds simulation to the block builder loop.
SlotCalculator
for managing slot timings.Configuration
Deploying this PR will require additional environment variables to be set
CONCURRENCY_LIMIT
to limit how many concurrent simulations the block builder runs.START_TIMESTAMP
to set the starting timestamp of the chain for anchoring slot calculation.Testing
This code is still being tested before final merge.
The current test plan is to