Conversation
📊 Tempo Precompiles Coverage |
Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019ce295-a43d-731f-a20d-dbfd6beae083
Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019ce295-a43d-731f-a20d-dbfd6beae083
Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019ce295-a43d-731f-a20d-dbfd6beae083
…nto rus/precompiles-cleanup
…orage (#3351) Upstream compound-policy tests in `tempo_pool.rs` used stale `PolicyData::encode_to_slot()` / manual slot encoding that #3107 deletes. Migrates all 5 call sites to `setup_storage` + typed `TIP403Registry` writes. Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Prompted by: rusowsky --------- Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com>
|
| /// | ||
| /// NOTE: Maker transfer policy authorization is intentionally NOT checked here. | ||
| /// Fills must never fail due to unexecutable orders from blacklisted makers, as that | ||
| /// would force takers to pay gas eating through stale liquidity. Instead, anyone can | ||
| /// call [`cancel_stale_order`](Self::cancel_stale_order) to remove orders from | ||
| /// blacklisted makers before they are filled. |
There was a problem hiding this comment.
nit: The reason that Maker transfer policy auth is not checked is to ensure that swaps can complete, rather than for gas efficiency. Consider updating the comment to something like the following:
/// NOTE: Maker transfer policy is not enforced here to not block swaps on the pair.
/// Note that TIP403 checks on order placement and withdraws are enforced.
/// [`cancel_stale_order`](Self::cancel_stale_order) can be used to remove orders.
| /// @dev Maker transfer policy authorization is intentionally NOT checked here. | ||
| /// Fills must never fail due to unexecutable orders from blacklisted makers, as that | ||
| /// would force takers to pay gas eating through stale liquidity. Instead, anyone can | ||
| /// call `cancelStaleOrder` to remove orders from blacklisted makers before they are filled. |
There was a problem hiding this comment.
nit: same thing here, it is important to not fail on 403 policies during swaps to ensure swap execution rather than this being a gas optimization.
| } | ||
| TipFeeManagerCall::FeeManager(IFeeManagerCalls::validatorTokens(call)) => { | ||
| view(call, |c| self.validator_tokens(c)) | ||
| view(call, |c| self.get_validator_token(c.validator)) |
There was a problem hiding this comment.
I think this should be fine, but lets make sure re-execution passes. Previously self.validator_tokens returned a Vec.
There was a problem hiding this comment.
i dropped it cause it returned an Address, so it's identical:
/// Reads the stored fee token preference for a validator, defaulting to [`DEFAULT_FEE_TOKEN`].
pub fn validator_tokens(&self, call: IFeeManager::validatorTokensCall) -> Result<Address> {
let token = self.validator_tokens[call.validator].read()?;
if token.is_zero() {
Ok(DEFAULT_FEE_TOKEN)
} else {
Ok(token)
}
} /// Returns the validator's preferred fee token, falling back to [`DEFAULT_FEE_TOKEN`].
pub fn get_validator_token(&self, beneficiary: Address) -> Result<Address> {
let token = self.validator_tokens[beneficiary].read()?;
if token.is_zero() {
Ok(DEFAULT_FEE_TOKEN)
} else {
Ok(token)
}
}Clarify that maker transfer policy is not enforced to avoid blocking swaps, not for gas efficiency. Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d3dd9-3244-706d-a2f6-f865f61c998c
this PR:
encode_to_slot/decode_from_slotin favor of typed patterns leveragingStorageCtxtempo-contractsso alloy consumers don't needtempo-precompilesdeps