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

Make it possible to initialize COUNTER with a custom value #11

Merged
merged 1 commit into from
Feb 5, 2025

Conversation

igor-casper
Copy link
Contributor

@igor-casper igor-casper commented Feb 5, 2025

With the changes introduced in #1 , the request ids are ordinal, counted from 0. This is problematic for the CLI, which is stateless and short-lived, as it will always attempt to send a request with id=0. This PR adds the ability to initialize the internal counter with a specified value, so that the CLI can replicate its prior behavior of randomly picking out an id. It's also useful for consumers of the binary port access library facing similar issues.

See:

fn main() {
    let args = args::Args::parse();
    casper_binary_port_access::initialize_request_id(rand::rng().random());
    let result = match args.commands {
    // go on as usual
    // ...
}

@gRoussac
Copy link
Contributor

gRoussac commented Feb 5, 2025

@igor-casper Cool thanks, I was about to do he same as per your suggestion! LGTM, still this request id is now nested in the response request after coming changes and I think it should be in the response header like the tag and protocol version but I let you guys decide.

@igor-casper igor-casper marked this pull request as ready for review February 5, 2025 17:29
@igor-casper igor-casper merged commit 173ccfb into casper-ecosystem:master Feb 5, 2025
1 check passed
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.

2 participants