Skip to content

Conversation

blockchainluffy
Copy link
Contributor

received_bid_digest text NOT NULL,
received_bid_signature text NOT NULL,
bidder_node_address text NOT NULL,
PRIMARY KEY (provider_address, commitment_digest, block_number)
Copy link
Contributor

Choose a reason for hiding this comment

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

isn't there a canonical commitment hash we can use as primary key? If not, commitment_digest and provider_address alone should be unique without including the block_number, shouldn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the commitment hash is not sent back when submitting Bid via grpc, anyway we can use commitment_digest and provider_address as primary key.

optional TraceContext trace = 3;
}

message Commitment {
Copy link
Contributor

Choose a reason for hiding this comment

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

can we import this from the primev repo instead of copy and pasting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it does not support our message handler interface, that's why I had to create this new message

@@ -0,0 +1,286 @@
package primev
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we use the multi event syncer from the service keyper here? The point of it was to avoid repeating all the event syncing code. Probably best to move it to medley so we don't have cross-keyperimpl dependencies. See e.g. eventtriggerregisteredprocessor.go for an example how to use it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

makes sense, lets add it in a separate PR

-- the schema. We'll use this to check we're using the right schema.

CREATE TABLE commitment(
tx_hashes text[] NOT NULL,
Copy link
Contributor

Choose a reason for hiding this comment

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

We have a separate table for txs. Does tx_hashes correspond to them? If so, we should get rid of the duplication and rely on referencing them (if it's for convenience it's better to aggregate in a query).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, the query is already aggregated as InsertMultipleTransactionsAndUpsertCommitment


// TODO: before sending the dec trigger, we need to check if majority of providers have generated commitments

h.decryptionTriggerChannel <- broker.NewEvent(decryptionTrigger)
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if it's a good idea to send the trigger in the handler directly or if we should rather only dump the commitments in the db and then check in a separate goroutine if a trigger should be sent. I guess the advantage of doing it here is that it most tight timing-wise, but conceptually it seems wrong and we potentially delay propagation of the commitment.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, in any case, this should check for context cancellation as it might block

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was hoping the context would be managed by p2p package already as this is just a handler for a message, let me know if it still needs any update.
The trigger sending is done here, to ensure no extra complexity is added in the new go routine, maybe it would make sense to include it in a separate go routine, once we introduce checking for number of providers committed.

@@ -0,0 +1,19 @@
package p2pmsg
Copy link
Contributor

Choose a reason for hiding this comment

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

why is this in a separate file instead of just messages.go where all the other ones are?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added in the same file, I just wanted to keep it separate as it is a new thing added, but yeah, makes sense to include in same file too

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