Skip to content

Conversation

@jmg-duarte
Copy link
Contributor

Description

Not a great title I know. Again, during my order validation investigation I wrote some docs that aim to help with hovers and so on.

Changes

  • Docs for app data validator
  • Docs for the order creation members
  • Docs for a pair of magic bytes
  • Clarification for the simulate docs

How to test

NA

@jmg-duarte jmg-duarte requested a review from a team as a code owner October 9, 2025 09:04
Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Sorry for all the nits. But if we add new documentation we need to make sure that it's carrying its weight. 😅

/// receiver is the same as the owner.
#[serde(default)]
pub receiver: Option<H160>,
/// The *maximum* amount of `sell_token`s that should be sold.
Copy link
Contributor

Choose a reason for hiding this comment

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

Unfortunately it's not as easy as that. What these values represent also depends on partially_fillable and kind.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Then we need to update the DB readme as well, that was my reference 🤔

/// The owner's signature of the order.
#[serde(flatten)]
pub signature: Signature,
/// The ID of the quote this order refers to.
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like some of these comments don't really add much TBH.

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 get you but having some of them added and others not makes things confusing.

Also, I get that they won't help on the 500th read, but for people picking up the code base it can same a couple of clicks. Spread that over the codebase and you get a decent timesave when people are getting into the code for the first time

Comment on lines +930 to +953
/// the Vault, this is done by having a specific ERC20 allowance for the
/// Vault and relayer approval for the GPv2VaultRelayer.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You approve() an allowance so it seems confusing to use both words here.

Copy link
Contributor Author

@jmg-duarte jmg-duarte Oct 9, 2025

Choose a reason for hiding this comment

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

This is how it is explained in the official docs though
https://docs.cow.fi/cow-protocol/reference/contracts/core/vault-relayer#balancer-external-balances

Do you have any concrete ideas how to improve this?

Comment on lines +221 to +222
/// Creates a new app data [`Validator`] with the provided app data
/// `size_limit` (in bytes).
Copy link
Contributor

@squadgazzz squadgazzz Oct 9, 2025

Choose a reason for hiding this comment

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

Do we really need this to be documented, while the code is self-descriptive? IMO, this doc is redundant.

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 understand but leaving a single one undocumented feels kind of weird. Plus, when someone is reading the code for the first time and hover over this, they can see what it does without going in.

I think that in the end, it's a matter of taste, but providing docs even for these basic functions can help when people are just perusing and hovering over methods.

Copy link
Contributor

@squadgazzz squadgazzz left a comment

Choose a reason for hiding this comment

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

LGTM, just a few nits. Also, please collect at least one more approval from someone before merging.

Copy link
Contributor

@MartinquaXD MartinquaXD left a comment

Choose a reason for hiding this comment

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

Approved assuming the links get swapped.

///
/// Check the [CoW docs on Balancer Internal Balances](2) for more details.
///
/// [2]: https://docs.cow.fi/cow-protocol/reference/contracts/core/vault-relayer#balancer-external-balances
Copy link
Contributor

Choose a reason for hiding this comment

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

Internal and External links are still swapped.

@jmg-duarte jmg-duarte enabled auto-merge (squash) October 15, 2025 15:28
@jmg-duarte jmg-duarte merged commit 493344a into main Oct 15, 2025
17 checks passed
@jmg-duarte jmg-duarte deleted the jmgd/docs/varied branch October 15, 2025 15:31
@github-actions github-actions bot locked and limited conversation to collaborators Oct 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants