You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Description
We were made aware that the interaction's value field is parsed using
the default U256 string parser (which assumes fields to be in base16
represenation). This was an oversight on our end and is being fixed in
this PR by interpreting the value as
- base16 string if prefixed by 0x
- base10 string otherwise
We also use the new type on most other "amount" fields in the solver
API.
Assuming that no solvers are currently using the value field with non
prefixed hex strings, this change should be backwards compatible. It
makes previous `u256_dec` deserialized values more permissive (allowing
to parse them from prefixed hex strings as well) while keeping their
serialisation behavior.
# Changes
- Implemented u256_hex_or_decimal deserialization (serialization same as
u256_dec)
- Use the new type for most value fields on the solver response
## How to test
Added a unit test for the serialization
## Related Issues
Fixes#1910
Problem
Change
InteractionData::Value
field to be serialized in a decimal format. Currently is serialized in hexadecimal format:https://github.com/cowprotocol/services/blob/main/crates/shared/src/http_solver/model.rs#L162
Slack discussion: https://cowservices.slack.com/archives/C0375NV72SC/p1696164285488129
Impact
Some solvers expressed this value as decimal by mistake and got their solutions rejected.
Expected behaviour
Should be serialized in decimal format.
The text was updated successfully, but these errors were encountered: