-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add poll_latest and sample_range scripts #1029
Conversation
a89739d
to
b7a8633
Compare
b7a8633
to
ae6b5ec
Compare
71c166d
to
30a579b
Compare
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.
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 don't like coupling script dependencies with trin dependencies in main Cargo.toml.
It is also expected to add more scripts in the future (purging db and etc).
Having a bin
directory inside src
is also confusing and it is not very clear which file is the trin binary and which one is script without looking into Cargo.toml
and the files.
I think a better strategy is to rename the src
folder to bin
and then add trin
crate inside bin
, for example see reth: https://github.com/paradigmxyz/reth/tree/main/bin/reth
This will require updating Cargo.toml
and adding the trin crate as a workspace member.
Тhen we can add any rust script as a separate crate inside bin/
. This way, Trin and any script will have separate Cargo.toml
and dependencies.
docker/Dockerfile
Outdated
@@ -39,6 +39,8 @@ FROM ubuntu:22.04 | |||
|
|||
# copy build artifacts from build stage | |||
COPY --from=builder /trin/target/release/trin /usr/bin/ | |||
COPY --from=builder /trin/target/release/purge_db /usr/bin/ |
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.
purge_db
was removed:
COPY --from=builder /trin/target/release/purge_db /usr/bin/ | |
COPY --from=builder /trin/target/release/poll_latest /usr/bin/ |
Agreed & agreed
That is the structure that is officially recommended. It's also the structure we were using when we had the
I don't really agree. Looking at reth, Basically, I do agree it's not great coupling script dependencies with trin dependencies, but it appears to me like we're following cargo best practices. Seems like this is still a bit of an unsolved issue with cargo? |
30a579b
to
5f6884a
Compare
5f6884a
to
d9f3e67
Compare
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.
⛵
src/bin/poll_latest.rs
Outdated
|
||
fn update_average_time(&mut self, new_time: Duration) { | ||
self.average_time = | ||
(self.average_time * (self.success_count - 1) + new_time) / self.success_count |
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.
nitpick:
(self.average_time * (self.success_count - 1) + new_time) / self.success_count | |
(self.average_time * self.success_count + new_time) / (self.success_count + 1) |
c4f068e
to
e905bf9
Compare
e905bf9
to
aba1093
Compare
What was wrong?
Added two scripts to help with quick & easy network testing. These are meant to be "backups" to glados, but also will be very useful for running tests on kurtosis.
Later, I'd like to implement support for providers other than infura, but given that
audit_latest
requires aws
connection, which is really only "easily" available via infura (eg. pandaops doesn't support this), then I figured pandaops / generic provider support can waitHow was it fixed?
audit_latest
script, which will basically poll how soon "latest" data appears on the networksample_range
script, which samples X number of randomly selected blocks from any given rangeTo-Do