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

feat(mev-boost): update constraints api #276

Merged
merged 11 commits into from
Oct 10, 2024

Conversation

namn-grg
Copy link
Contributor

@namn-grg namn-grg commented Oct 7, 2024

Closes #272

@namn-grg namn-grg marked this pull request as ready for review October 7, 2024 13:31
Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

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

Looks good! Tried to run it locally and noticed the following:

Failed to send web demo event: Post "http://host.docker.internal:3001/events": dial tcp 198.19.248.254:3001: connect: connection refusedtime="2024-10-07T15:00:26.088Z" level=info msg="sending request for 1 constraint to relay" method=submitConstraint ua=bolt-sidecar url="http://172.16.0.21:4040/constraints/v1/builder/constraints" version=
time="2024-10-07T15:00:26.088Z" level=info msg="sent request for 1 constraint to relay. err = HTTP error response: 400 / Serde decode error: missing field `transactions` at line 1 column 378" method=submitConstraint ua=bolt-sidecar url="http://172.16.0.21:4040/constraints/v1/builder/constraints" version=
time="2024-10-07T15:00:26.088Z" level=warning msg="error calling submitConstraint on relay" error="HTTP error response: 400 / Serde decode error: missing field `transactions` at line 1 column 378" method=submitConstraint ua=bolt-sidecar url="http://172.16.0.21:4040/constraints/v1/builder/constraints" version=
time="2024-10-07T15:00:26.088Z" level=info msg="http: POST /constraints/v1/builder/constraints 502" duration=0.001555 method=POST path=/constraints/v1/builder/constraints status=502 version=
time="2024-10-07T15:00:26.19Z" level=info msg=submitConstraint method=submitConstraint ua=bolt-sidecar version=
time="2024-10-07T15:00:26.19Z" level=info msg="[BOLT]: adding inclusion constraints to cache. slot = 201, validatorPubkey = [171 209 38 120 199 52 99 236 234 88 103 168 12 175 37 109 92 94 107 165 63 241 136 177 67 164 213 190 131 54 90 210 87 237 243 158 170 27 168 117 60 76 223 76 99 47 249 158], number of relays = 1" method=submitConstraint ua=bolt-sidecar version=
time="2024-10-07T15:00:26.19Z" level=info msg="[BOLT]: added inclusion constraints to cache. slot = 201, validatorPubkey = [171 209 38 120 199 52 99 236 234 88 103 168 12 175 37 109 92 94 107 165 63 241 136 177 67 164 213 190 131 54 90 210 87 237 243 158 170 27 168 117 60 76 223 76 99 47 249 158], number of relays = 1" method=submitConstraint ua=bolt-sidecar version=
Failed to send web demo event: Post "http://host.docker.internal:3001/events": dial tcp 198.19.248.254:3001: connect: connection refusedtime="2024-10-07T15:00:26.191Z" level=info msg="sending request for 1 constraint to relay" method=submitConstraint ua=bolt-sidecar url="http://172.16.0.21:4040/constraints/v1/builder/constraints" version=
time="2024-10-07T15:00:26.191Z" level=info msg="sent request for 1 constraint to relay. err = HTTP error response: 400 / Serde decode error: missing field `transactions` at line 1 column 378" method=submitConstraint ua=bolt-sidecar url="http://172.16.0.21:4040/constraints/v1/builder/constraints" version=
time="2024-10-07T15:00:26.191Z" level=warning msg="error calling submitConstraint on relay" error="HTTP error response: 400 / Serde decode error: missing field `transactions` at line 1 column 378" method=submitConstraint ua=bolt-sidecar url="http://172.16.0.21:4040/constraints/v1/builder/constraints" version=
  • Can you please remove also the web demo logs? It is now deprecated
  • Validator pubkey isn't displayed well
  • There is a 400 when sending constraints, we need to check whether this code should change or Helix.

I'm running on the latest unstable commit, therefore consider rebasing as well!

pathGetHeader = "/eth/v1/builder/header/{slot:[0-9]+}/{parent_hash:0x[a-fA-F0-9]+}/{pubkey:0x[a-fA-F0-9]+}"
pathGetHeaderWithProofs = "/eth/v1/builder/header_with_proofs/{slot:[0-9]+}/{parent_hash:0x[a-fA-F0-9]+}/{pubkey:0x[a-fA-F0-9]+}"
pathGetPayload = "/eth/v1/builder/blinded_blocks"

// Constraints namespace paths
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add reference link here?

Comment on lines 108 to 130
type SignedDelegation struct {
Message Delegation `json:"message"`
Signature phase0.BLSSignature `json:"signature"`
}

type Delegation struct {
ValidatorPubkey phase0.BLSPubKey `json:"validator_pubkey"`
DelegateePubkey phase0.BLSPubKey `json:"delegatee_pubkey"`
}

type SignedRevocation struct {
Message Delegation `json:"message"`
Signature phase0.BLSSignature `json:"signature"`
}

type Revocation struct {
ValidatorPubkey phase0.BLSPubKey `json:"validator_pubkey"`
DelegateePubkey phase0.BLSPubKey `json:"delegatee_pubkey"`
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here for reference links! Thank you

Comment on lines 359 to 366
log.Debug("delegate")

payload := SignedDelegation{}
if err := DecodeJSON(req.Body, &payload); err != nil {
m.respondError(w, http.StatusBadRequest, err.Error())
return
}

Copy link
Contributor

Choose a reason for hiding this comment

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

the log.Debug("delegate") has little utility, perhaps could you print the payload instead?

Pubkey phase0.BLSPubKey `json:"pubkey"`
Slot uint64 `json:"slot"`
Top bool `json:"top"`
Transactions []Transaction // Custom marshal and unmarshal implemented below
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Transactions []Transaction // Custom marshal and unmarshal implemented below
Transactions []*Transaction `json:"transactions"`

You probably don't need to do additional encoding and decoding here so the concrete transaction type with custom marshal and unmarshal done here https://github.com/chainbound/bolt/blob/naman%2Ffeat%2Fmev-boost%2Fconstraints-api/builder/core/types/constraints.go#L178-L230 is probably not needed.
However you still have to specify the name of the field otherwise the error:

time="2024-10-07T15:00:26.088Z" level=info msg="sent request for 1 constraint to relay. err = HTTP error response: 400 / Serde decode error: missing field `transactions` at line 1 column 378" method=submitConstraint ua=bolt-sidecar url="http://172.16.0.21:4040/constraints/v1/builder/constraints" version=

is thrown

@namn-grg namn-grg force-pushed the naman/feat/mev-boost/constraints-api branch 2 times, most recently from 87bc2d2 to e4e589e Compare October 8, 2024 05:11
@namn-grg
Copy link
Contributor Author

namn-grg commented Oct 8, 2024

This should be ready to be merged!

@thedevbirb thedevbirb force-pushed the naman/feat/mev-boost/constraints-api branch from 0b1225f to 2694da8 Compare October 8, 2024 15:24
Copy link
Contributor

@thedevbirb thedevbirb left a comment

Choose a reason for hiding this comment

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

Great, let's test this e2e and make eventual fixes in other PRs.

@merklefruit merklefruit changed the base branch from unstable to nico/devnet-fix October 9, 2024 17:46
@merklefruit merklefruit force-pushed the naman/feat/mev-boost/constraints-api branch from 3d8123e to eb47e26 Compare October 9, 2024 17:47
Copy link
Collaborator

@merklefruit merklefruit left a comment

Choose a reason for hiding this comment

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

PBS flow is working on Kurtosis at latest commit. 🎉

Copy link
Contributor

@mempirate mempirate left a comment

Choose a reason for hiding this comment

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

LGTM!

@thedevbirb thedevbirb merged commit b9b38f1 into nico/devnet-fix Oct 10, 2024
3 checks passed
@thedevbirb thedevbirb deleted the naman/feat/mev-boost/constraints-api branch October 10, 2024 08:40
This was referenced Oct 10, 2024
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.

Update constraints-API in mev-boost
4 participants