Skip to content

refactor: batcher non-paying messages - #1066

Closed
MarcosNicolau wants to merge 3 commits into
stagingfrom
1006-remove-batcher-duplicated-code-when-handling-nonpaying
Closed

refactor: batcher non-paying messages#1066
MarcosNicolau wants to merge 3 commits into
stagingfrom
1006-remove-batcher-duplicated-code-when-handling-nonpaying

Conversation

@MarcosNicolau

@MarcosNicolauMarcosNicolau commented Sep 24, 2024

Copy link
Copy Markdown
Collaborator

Changes
Refactors the handle_message function in the batcher, unifying the non_paying case.

Test
These new changes can be tested by setting up a local environment and:

  1. Sending proofs to the non-paying address and verifying that the batcher pays for us.
  2. Sending proofs to a custom address and verifying that we paid for the verification.

Closes#1006

@MarcosNicolau
MarcosNicolau changed the base branch from testnet to stagingSeptember 24, 2024 15:33
@MarcosNicolauMarcosNicolau changed the title 1006 remove batcher duplicated code when handling nonpayingrefactor: batcher non-paying messagesSep 24, 2024
@MarcosNicolau
MarcosNicolau marked this pull request as ready for review September 24, 2024 17:13
@MarcosNicolauMarcosNicolau self-assigned this Sep 24, 2024
send_message(ws_conn_sink.clone(), ValidityResponseMessage::InvalidProof).await;
return Ok(()); // Send error message to the client and return
}
if user_balance == U256::from(0) {

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand why here we check if the balance is zero instead of checking for the actual cost of the verification.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is because it's a non-paying message, so there isn't any particular balance the user needs to reach, as long as it's not empty. If that's the case, it's worth a code comment.

nonced_verification_data: NoncedVerificationData,
ws_conn_sink: Arc<RwLock<SplitSink<WebSocketStream<TcpStream>, Message>>>,
nonce_value: U256,
) -> bool {

Copy link
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function can never fail, but the return of the boolean is just to keep the consistency with the other methods and to account for a future failing point. Please tell me if I should better remove it.

@uri-99uri-99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking PR until Entropidelic's refactor is pushed

@uri-99

Copy link
Copy Markdown
Contributor

Closing as solved in #1106

@uri-99uri-99 closed this Oct 3, 2024
@uri-99
uri-99 deleted the 1006-remove-batcher-duplicated-code-when-handling-nonpaying branch October 3, 2024 20:30
Sign up for freeto 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.

3 participants

@MarcosNicolau@uri-99@Oppen