commit 218c97e948548d2360a4e78e8b5192288b4fbb67
parent 687e82c0996e05ab40f61b82076a145ac2381dcd
Author: triesap <tyson@radroots.org>
Date: Fri, 26 Jun 2026 14:49:20 +0000
events: align order dto contracts
Rename forbidden trade-era DTO surfaces to the canonical order and commercial names, type listing projection addresses, and update replica-sync fixtures for the public farm locality contract.
Validation: cargo fmt --manifest-path domains/radroots/lib/Cargo.toml --all --check; cargo run --manifest-path domains/radroots/lib/Cargo.toml -p xtask -- hygiene forbidden-identifiers; cargo test --manifest-path domains/radroots/lib/Cargo.toml --all-features
Diffstat:
7 files changed, 182 insertions(+), 165 deletions(-)
diff --git a/crates/events/src/dto.rs b/crates/events/src/dto.rs
@@ -65,7 +65,7 @@ pub fn dto_roots() -> Vec<RootDescriptor> {
RootDescriptor::new::<JobInputType>(),
RootDescriptor::new::<JobPaymentRequest>(),
RootDescriptor::new::<RadrootsAccountClaim>(),
- RootDescriptor::new::<RadrootsActiveTradeEnvelopeDto>(),
+ RootDescriptor::new::<RadrootsOrderEnvelopeDto>(),
RootDescriptor::new::<RadrootsAppData>(),
RootDescriptor::new::<RadrootsComment>(),
RootDescriptor::new::<RadrootsCoop>(),
@@ -121,25 +121,25 @@ pub fn dto_roots() -> Vec<RootDescriptor> {
RootDescriptor::new::<RadrootsResourceHarvestCap>(),
RootDescriptor::new::<RadrootsResourceHarvestProduct>(),
RootDescriptor::new::<RadrootsSeal>(),
- RootDescriptor::new::<RadrootsTradeAnswerDto>(),
- RootDescriptor::new::<RadrootsTradeDiscountDecisionDto>(),
- RootDescriptor::new::<RadrootsTradeDiscountOfferDto>(),
- RootDescriptor::new::<RadrootsTradeDiscountRequestDto>(),
+ RootDescriptor::new::<RadrootsOrderAnswerDto>(),
+ RootDescriptor::new::<RadrootsOrderDiscountDecisionDto>(),
+ RootDescriptor::new::<RadrootsOrderDiscountOfferDto>(),
+ RootDescriptor::new::<RadrootsOrderDiscountRequestDto>(),
RootDescriptor::new::<RadrootsCommercialDomain>(),
RootDescriptor::new::<RadrootsOrderEconomicActor>(),
RootDescriptor::new::<RadrootsOrderEconomicEffect>(),
RootDescriptor::new::<RadrootsOrderEconomicLineKind>(),
- RootDescriptor::new::<RadrootsTradeEnvelopeDto>(),
+ RootDescriptor::new::<RadrootsCommercialEnvelopeDto>(),
RootDescriptor::new::<RadrootsOrderInventoryCommitment>(),
- RootDescriptor::new::<RadrootsTradeListingCancelDto>(),
+ RootDescriptor::new::<RadrootsListingCancelDto>(),
RootDescriptor::new::<RadrootsListingParseError>(),
RootDescriptor::new::<RadrootsTradeValidationListingRequest>(),
RootDescriptor::new::<RadrootsTradeValidationListingResult>(),
RootDescriptor::new::<RadrootsTradeValidationListingError>(),
- RootDescriptor::new::<RadrootsTradeMessagePayloadDto>(),
- RootDescriptor::new::<RadrootsTradeMessageTypeDto>(),
+ RootDescriptor::new::<RadrootsCommercialMessagePayloadDto>(),
+ RootDescriptor::new::<RadrootsCommercialMessageTypeDto>(),
RootDescriptor::new::<RadrootsOrderCancellation>(),
- RootDescriptor::new::<RadrootsTradeOrderChangeDto>(),
+ RootDescriptor::new::<RadrootsOrderChangeDto>(),
RootDescriptor::new::<RadrootsOrderDecisionOutcome>(),
RootDescriptor::new::<RadrootsOrderDecision>(),
RootDescriptor::new::<RadrootsOrderEconomicItem>(),
@@ -148,35 +148,35 @@ pub fn dto_roots() -> Vec<RootDescriptor> {
RootDescriptor::new::<RadrootsOrderEconomics>(),
RootDescriptor::new::<RadrootsOrderItem>(),
RootDescriptor::new::<RadrootsOrderRequest>(),
- RootDescriptor::new::<RadrootsTradeOrderResponseDto>(),
- RootDescriptor::new::<RadrootsTradeOrderRevisionDto>(),
+ RootDescriptor::new::<RadrootsOrderResponseDto>(),
+ RootDescriptor::new::<RadrootsOrderRevisionDto>(),
RootDescriptor::new::<RadrootsOrderRevisionOutcome>(),
RootDescriptor::new::<RadrootsOrderRevisionDecision>(),
RootDescriptor::new::<RadrootsOrderRevisionProposal>(),
- RootDescriptor::new::<RadrootsTradeOrderRevisionResponseDto>(),
- RootDescriptor::new::<RadrootsTradeOrderStatusDto>(),
+ RootDescriptor::new::<RadrootsOrderRevisionResponseDto>(),
+ RootDescriptor::new::<RadrootsOrderStatusDto>(),
RootDescriptor::new::<RadrootsOrderPricingBasis>(),
- RootDescriptor::new::<RadrootsTradeQuestionDto>(),
- RootDescriptor::new::<RadrootsTradeTransportLaneDto>(),
+ RootDescriptor::new::<RadrootsOrderQuestionDto>(),
+ RootDescriptor::new::<RadrootsCommercialTransportLaneDto>(),
]
}
-pub struct RadrootsActiveTradeEnvelopeDto;
-pub struct RadrootsTradeAnswerDto;
-pub struct RadrootsTradeDiscountDecisionDto;
-pub struct RadrootsTradeDiscountOfferDto;
-pub struct RadrootsTradeDiscountRequestDto;
-pub struct RadrootsTradeEnvelopeDto;
-pub struct RadrootsTradeListingCancelDto;
-pub struct RadrootsTradeMessagePayloadDto;
-pub struct RadrootsTradeMessageTypeDto;
-pub struct RadrootsTradeOrderChangeDto;
-pub struct RadrootsTradeOrderResponseDto;
-pub struct RadrootsTradeOrderRevisionDto;
-pub struct RadrootsTradeOrderRevisionResponseDto;
-pub struct RadrootsTradeOrderStatusDto;
-pub struct RadrootsTradeQuestionDto;
-pub struct RadrootsTradeTransportLaneDto;
+pub struct RadrootsOrderEnvelopeDto;
+pub struct RadrootsOrderAnswerDto;
+pub struct RadrootsOrderDiscountDecisionDto;
+pub struct RadrootsOrderDiscountOfferDto;
+pub struct RadrootsOrderDiscountRequestDto;
+pub struct RadrootsCommercialEnvelopeDto;
+pub struct RadrootsListingCancelDto;
+pub struct RadrootsCommercialMessagePayloadDto;
+pub struct RadrootsCommercialMessageTypeDto;
+pub struct RadrootsOrderChangeDto;
+pub struct RadrootsOrderResponseDto;
+pub struct RadrootsOrderRevisionDto;
+pub struct RadrootsOrderRevisionResponseDto;
+pub struct RadrootsOrderStatusDto;
+pub struct RadrootsOrderQuestionDto;
+pub struct RadrootsCommercialTransportLaneDto;
macro_rules! string_dto {
($($ty:ty),+ $(,)?) => {
@@ -938,7 +938,7 @@ impl Dto for RadrootsListingParseError {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
"RadrootsListingParseError",
- "RadrootsTradeListingParseError",
+ "RadrootsListingParseError",
EnumRepr::External,
span("crates/events/src/order.rs", 26),
)
@@ -1168,7 +1168,7 @@ impl Dto for RadrootsOrderEconomicItem {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
"RadrootsOrderEconomicItem",
- "RadrootsTradeOrderEconomicItem",
+ "RadrootsOrderEconomicItem",
span("crates/events/src/order_economics.rs", 70),
)
.with_field(field(
@@ -1228,7 +1228,7 @@ impl Dto for RadrootsOrderEconomics {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
"RadrootsOrderEconomics",
- "RadrootsTradeOrderEconomics",
+ "RadrootsOrderEconomics",
span("crates/events/src/order_economics.rs", 119),
)
.with_field(field(
@@ -1316,7 +1316,7 @@ impl Dto for RadrootsOrderRevisionOutcome {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
"RadrootsOrderRevisionOutcome",
- "RadrootsTradeOrderRevisionDecision",
+ "RadrootsOrderRevisionOutcome",
EnumRepr::Internal {
tag: "decision".to_owned(),
},
@@ -1344,13 +1344,13 @@ impl Dto for RadrootsOrderRevisionOutcome {
}
}
-impl Dto for RadrootsActiveTradeEnvelopeDto {
+impl Dto for RadrootsOrderEnvelopeDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef {
generics: vec![GenericParam::new("T")],
..StructDef::new(
- "RadrootsActiveTradeEnvelopeDto",
- "RadrootsActiveTradeEnvelope",
+ "RadrootsOrderEnvelopeDto",
+ "RadrootsOrderEnvelope",
span("crates/events/src/order.rs", 408),
)
}
@@ -1396,17 +1396,17 @@ impl Dto for RadrootsActiveTradeEnvelopeDto {
"crates/events/src/order.rs",
415,
));
- register(ctx, "RadrootsActiveTradeEnvelopeDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsOrderEnvelopeDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeEnvelopeDto {
+impl Dto for RadrootsCommercialEnvelopeDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef {
generics: vec![GenericParam::new("T")],
..StructDef::new(
- "RadrootsTradeEnvelopeDto",
- "RadrootsTradeEnvelope",
+ "RadrootsCommercialEnvelopeDto",
+ "RadrootsCommercialEnvelope",
span("crates/events/src/order.rs", 408),
)
}
@@ -1427,7 +1427,7 @@ impl Dto for RadrootsTradeEnvelopeDto {
.with_field(field(
"message_type",
"type",
- RadrootsTradeMessageTypeDto::describe(ctx),
+ RadrootsCommercialMessageTypeDto::describe(ctx),
"crates/events/src/order.rs",
412,
))
@@ -1452,15 +1452,15 @@ impl Dto for RadrootsTradeEnvelopeDto {
"crates/events/src/order.rs",
415,
));
- register(ctx, "RadrootsTradeEnvelopeDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsCommercialEnvelopeDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeMessageTypeDto {
+impl Dto for RadrootsCommercialMessageTypeDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
- "RadrootsTradeMessageTypeDto",
- "RadrootsTradeMessageType",
+ "RadrootsCommercialMessageTypeDto",
+ "RadrootsCommercialMessageType",
EnumRepr::External,
span("crates/events/src/order.rs", 408),
)
@@ -1548,15 +1548,15 @@ impl Dto for RadrootsTradeMessageTypeDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeMessageTypeDto", TypeDef::Enum(def))
+ register(ctx, "RadrootsCommercialMessageTypeDto", TypeDef::Enum(def))
}
}
-impl Dto for RadrootsTradeTransportLaneDto {
+impl Dto for RadrootsCommercialTransportLaneDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
- "RadrootsTradeTransportLaneDto",
- "RadrootsTradeTransportLane",
+ "RadrootsCommercialTransportLaneDto",
+ "RadrootsCommercialTransportLane",
EnumRepr::External,
span("crates/events/src/order.rs", 408),
)
@@ -1572,15 +1572,19 @@ impl Dto for RadrootsTradeTransportLaneDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeTransportLaneDto", TypeDef::Enum(def))
+ register(
+ ctx,
+ "RadrootsCommercialTransportLaneDto",
+ TypeDef::Enum(def),
+ )
}
}
-impl Dto for RadrootsTradeOrderStatusDto {
+impl Dto for RadrootsOrderStatusDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
- "RadrootsTradeOrderStatusDto",
- "RadrootsTradeOrderStatus",
+ "RadrootsOrderStatusDto",
+ "RadrootsOrderStatus",
EnumRepr::External,
span("crates/events/src/order.rs", 408),
)
@@ -1632,15 +1636,15 @@ impl Dto for RadrootsTradeOrderStatusDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeOrderStatusDto", TypeDef::Enum(def))
+ register(ctx, "RadrootsOrderStatusDto", TypeDef::Enum(def))
}
}
-impl Dto for RadrootsTradeQuestionDto {
+impl Dto for RadrootsOrderQuestionDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
- "RadrootsTradeQuestionDto",
- "RadrootsTradeQuestion",
+ "RadrootsOrderQuestionDto",
+ "RadrootsOrderQuestion",
span("crates/events/src/order.rs", 408),
)
.with_field(field(
@@ -1650,15 +1654,15 @@ impl Dto for RadrootsTradeQuestionDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeQuestionDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsOrderQuestionDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeAnswerDto {
+impl Dto for RadrootsOrderAnswerDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
- "RadrootsTradeAnswerDto",
- "RadrootsTradeAnswer",
+ "RadrootsOrderAnswerDto",
+ "RadrootsOrderAnswer",
span("crates/events/src/order.rs", 408),
)
.with_field(field(
@@ -1668,15 +1672,15 @@ impl Dto for RadrootsTradeAnswerDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeAnswerDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsOrderAnswerDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeDiscountRequestDto {
+impl Dto for RadrootsOrderDiscountRequestDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
- "RadrootsTradeDiscountRequestDto",
- "RadrootsTradeDiscountRequest",
+ "RadrootsOrderDiscountRequestDto",
+ "RadrootsOrderDiscountRequest",
span("crates/events/src/order.rs", 408),
)
.with_field(field(
@@ -1693,15 +1697,15 @@ impl Dto for RadrootsTradeDiscountRequestDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeDiscountRequestDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsOrderDiscountRequestDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeDiscountOfferDto {
+impl Dto for RadrootsOrderDiscountOfferDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
- "RadrootsTradeDiscountOfferDto",
- "RadrootsTradeDiscountOffer",
+ "RadrootsOrderDiscountOfferDto",
+ "RadrootsOrderDiscountOffer",
span("crates/events/src/order.rs", 408),
)
.with_field(field(
@@ -1718,15 +1722,15 @@ impl Dto for RadrootsTradeDiscountOfferDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeDiscountOfferDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsOrderDiscountOfferDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeDiscountDecisionDto {
+impl Dto for RadrootsOrderDiscountDecisionDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
- "RadrootsTradeDiscountDecisionDto",
- "RadrootsTradeDiscountDecision",
+ "RadrootsOrderDiscountDecisionDto",
+ "RadrootsOrderDiscountDecision",
EnumRepr::Adjacent {
tag: "kind".to_owned(),
content: "amount".to_owned(),
@@ -1757,15 +1761,15 @@ impl Dto for RadrootsTradeDiscountDecisionDto {
)]),
span("crates/events/src/order.rs", 408),
));
- register(ctx, "RadrootsTradeDiscountDecisionDto", TypeDef::Enum(def))
+ register(ctx, "RadrootsOrderDiscountDecisionDto", TypeDef::Enum(def))
}
}
-impl Dto for RadrootsTradeListingCancelDto {
+impl Dto for RadrootsListingCancelDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
- "RadrootsTradeListingCancelDto",
- "RadrootsTradeListingCancel",
+ "RadrootsListingCancelDto",
+ "RadrootsListingCancel",
span("crates/events/src/order.rs", 408),
)
.with_field(optional_nullable_field(
@@ -1775,35 +1779,31 @@ impl Dto for RadrootsTradeListingCancelDto {
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeListingCancelDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsListingCancelDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeOrderResponseDto {
+impl Dto for RadrootsOrderResponseDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
- accepted_reason_struct(
- ctx,
- "RadrootsTradeOrderResponseDto",
- "RadrootsTradeOrderResponse",
- )
+ accepted_reason_struct(ctx, "RadrootsOrderResponseDto", "RadrootsOrderResponse")
}
}
-impl Dto for RadrootsTradeOrderRevisionResponseDto {
+impl Dto for RadrootsOrderRevisionResponseDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
accepted_reason_struct(
ctx,
- "RadrootsTradeOrderRevisionResponseDto",
- "RadrootsTradeOrderRevisionResponse",
+ "RadrootsOrderRevisionResponseDto",
+ "RadrootsOrderRevisionResponse",
)
}
}
-impl Dto for RadrootsTradeOrderRevisionDto {
+impl Dto for RadrootsOrderRevisionDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = StructDef::new(
- "RadrootsTradeOrderRevisionDto",
- "RadrootsTradeOrderRevision",
+ "RadrootsOrderRevisionDto",
+ "RadrootsOrderRevision",
span("crates/events/src/order.rs", 408),
)
.with_field(field(
@@ -1816,19 +1816,19 @@ impl Dto for RadrootsTradeOrderRevisionDto {
.with_field(field(
"changes",
"changes",
- <Vec<RadrootsTradeOrderChangeDto> as Dto>::describe(ctx),
+ <Vec<RadrootsOrderChangeDto> as Dto>::describe(ctx),
"crates/events/src/order.rs",
408,
));
- register(ctx, "RadrootsTradeOrderRevisionDto", TypeDef::Struct(def))
+ register(ctx, "RadrootsOrderRevisionDto", TypeDef::Struct(def))
}
}
-impl Dto for RadrootsTradeOrderChangeDto {
+impl Dto for RadrootsOrderChangeDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
- "RadrootsTradeOrderChangeDto",
- "RadrootsTradeOrderChange",
+ "RadrootsOrderChangeDto",
+ "RadrootsOrderChange",
EnumRepr::Adjacent {
tag: "kind".to_owned(),
content: "amount".to_owned(),
@@ -1880,15 +1880,15 @@ impl Dto for RadrootsTradeOrderChangeDto {
)]),
span("crates/events/src/order.rs", 408),
));
- register(ctx, "RadrootsTradeOrderChangeDto", TypeDef::Enum(def))
+ register(ctx, "RadrootsOrderChangeDto", TypeDef::Enum(def))
}
}
-impl Dto for RadrootsTradeMessagePayloadDto {
+impl Dto for RadrootsCommercialMessagePayloadDto {
fn describe(ctx: &mut DescribeCtx) -> TypeRef {
let def = EnumDef::new(
- "RadrootsTradeMessagePayloadDto",
- "RadrootsTradeMessagePayload",
+ "RadrootsCommercialMessagePayloadDto",
+ "RadrootsCommercialMessagePayload",
EnumRepr::Adjacent {
tag: "kind".to_owned(),
content: "amount".to_owned(),
@@ -1913,59 +1913,63 @@ impl Dto for RadrootsTradeMessagePayloadDto {
.with_variant(newtype_variant(
"OrderResponse",
"order_response",
- RadrootsTradeOrderResponseDto::describe(ctx),
+ RadrootsOrderResponseDto::describe(ctx),
))
.with_variant(newtype_variant(
"OrderRevision",
"order_revision",
- RadrootsTradeOrderRevisionDto::describe(ctx),
+ RadrootsOrderRevisionDto::describe(ctx),
))
.with_variant(newtype_variant(
"OrderRevisionAccept",
"order_revision_accept",
- RadrootsTradeOrderRevisionResponseDto::describe(ctx),
+ RadrootsOrderRevisionResponseDto::describe(ctx),
))
.with_variant(newtype_variant(
"OrderRevisionDecline",
"order_revision_decline",
- RadrootsTradeOrderRevisionResponseDto::describe(ctx),
+ RadrootsOrderRevisionResponseDto::describe(ctx),
))
.with_variant(newtype_variant(
"Question",
"question",
- RadrootsTradeQuestionDto::describe(ctx),
+ RadrootsOrderQuestionDto::describe(ctx),
))
.with_variant(newtype_variant(
"Answer",
"answer",
- RadrootsTradeAnswerDto::describe(ctx),
+ RadrootsOrderAnswerDto::describe(ctx),
))
.with_variant(newtype_variant(
"DiscountRequest",
"discount_request",
- RadrootsTradeDiscountRequestDto::describe(ctx),
+ RadrootsOrderDiscountRequestDto::describe(ctx),
))
.with_variant(newtype_variant(
"DiscountOffer",
"discount_offer",
- RadrootsTradeDiscountOfferDto::describe(ctx),
+ RadrootsOrderDiscountOfferDto::describe(ctx),
))
.with_variant(newtype_variant(
"DiscountAccept",
"discount_accept",
- RadrootsTradeDiscountDecisionDto::describe(ctx),
+ RadrootsOrderDiscountDecisionDto::describe(ctx),
))
.with_variant(newtype_variant(
"DiscountDecline",
"discount_decline",
- RadrootsTradeDiscountDecisionDto::describe(ctx),
+ RadrootsOrderDiscountDecisionDto::describe(ctx),
))
.with_variant(newtype_variant(
"Cancel",
"cancel",
- RadrootsTradeListingCancelDto::describe(ctx),
+ RadrootsListingCancelDto::describe(ctx),
));
- register(ctx, "RadrootsTradeMessagePayloadDto", TypeDef::Enum(def))
+ register(
+ ctx,
+ "RadrootsCommercialMessagePayloadDto",
+ TypeDef::Enum(def),
+ )
}
}
diff --git a/crates/events/src/order.rs b/crates/events/src/order.rs
@@ -162,7 +162,7 @@ impl RadrootsOrderEconomics {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradeOrderRequested")))]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderRequest")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOrderRequest {
@@ -189,7 +189,7 @@ impl RadrootsOrderRequest {
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
#[cfg_attr(
feature = "dto-bindgen",
- dto(ts(name = "RadrootsTradeOrderRevisionProposed"))
+ dto(ts(name = "RadrootsOrderRevisionProposal"))
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -242,7 +242,7 @@ impl RadrootsOrderRevisionOutcome {
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
#[cfg_attr(
feature = "dto-bindgen",
- dto(ts(name = "RadrootsTradeOrderRevisionDecisionEvent"))
+ dto(ts(name = "RadrootsOrderRevisionDecision"))
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -273,7 +273,7 @@ impl RadrootsOrderRevisionDecision {
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
#[cfg_attr(
feature = "dto-bindgen",
- dto(ts(name = "RadrootsTradeInventoryCommitment"))
+ dto(ts(name = "RadrootsOrderInventoryCommitment"))
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -283,7 +283,10 @@ pub struct RadrootsOrderInventoryCommitment {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradeOrderDecision")))]
+#[cfg_attr(
+ feature = "dto-bindgen",
+ dto(ts(name = "RadrootsOrderDecisionOutcome"))
+)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case", tag = "decision"))]
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -308,10 +311,7 @@ impl RadrootsOrderDecisionOutcome {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(
- feature = "dto-bindgen",
- dto(ts(name = "RadrootsTradeOrderDecisionEvent"))
-)]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderDecision")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOrderDecision {
@@ -333,7 +333,7 @@ impl RadrootsOrderDecision {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradeOrderCancelled")))]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderCancellation")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOrderCancellation {
@@ -355,7 +355,7 @@ impl RadrootsOrderCancellation {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradeDomain")))]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsCommercialDomain")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -365,10 +365,7 @@ pub enum RadrootsCommercialDomain {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(
- feature = "dto-bindgen",
- dto(ts(name = "RadrootsActiveTradeMessageType"))
-)]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderEventType")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum RadrootsOrderEventType {
diff --git a/crates/events/src/order_economics.rs b/crates/events/src/order_economics.rs
@@ -10,7 +10,7 @@ use radroots_core::{
use crate::ids::{RadrootsInventoryBinId, RadrootsOrderQuoteId};
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradeOrderItem")))]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderItem")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOrderItem {
@@ -19,7 +19,7 @@ pub struct RadrootsOrderItem {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradePricingBasis")))]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderPricingBasis")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -31,7 +31,7 @@ pub enum RadrootsOrderPricingBasis {
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
#[cfg_attr(
feature = "dto-bindgen",
- dto(ts(name = "RadrootsTradeEconomicLineKind"))
+ dto(ts(name = "RadrootsOrderEconomicLineKind"))
)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
@@ -46,7 +46,7 @@ pub enum RadrootsOrderEconomicLineKind {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradeEconomicActor")))]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderEconomicActor")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -58,7 +58,7 @@ pub enum RadrootsOrderEconomicActor {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsTradeEconomicEffect")))]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderEconomicEffect")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "snake_case"))]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -82,10 +82,7 @@ pub struct RadrootsOrderEconomicItem {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(
- feature = "dto-bindgen",
- dto(ts(name = "RadrootsTradeOrderEconomicLine"))
-)]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderEconomicLine")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOrderEconomicLine {
@@ -98,10 +95,7 @@ pub struct RadrootsOrderEconomicLine {
}
#[cfg_attr(feature = "dto-bindgen", derive(dto_bindgen::Dto))]
-#[cfg_attr(
- feature = "dto-bindgen",
- dto(ts(name = "RadrootsTradeOrderEconomicTotals"))
-)]
+#[cfg_attr(feature = "dto-bindgen", dto(ts(name = "RadrootsOrderEconomicTotals")))]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsOrderEconomicTotals {
diff --git a/crates/replica_sync/src/emit.rs b/crates/replica_sync/src/emit.rs
@@ -1051,7 +1051,7 @@ mod tests {
d_tag: "AAAAAAAAAAAAAAAAAAAAAQ".to_string(),
lat: 10.0,
lng: 20.0,
- geohash: "s0".to_string(),
+ geohash: "9q8yy".to_string(),
point: "{\"type\":\"Point\",\"coordinates\":[20.0,10.0]}".to_string(),
polygon:
"{\"type\":\"Polygon\",\"coordinates\":[[[20.0,10.0],[20.1,10.1],[19.9,10.1],[20.0,10.0]]]}".to_string(),
@@ -1079,7 +1079,7 @@ mod tests {
d_tag: "AAAAAAAAAAAAAAAAAAAAAw".to_string(),
lat: 11.0,
lng: 21.0,
- geohash: "s1".to_string(),
+ geohash: "9q8yv".to_string(),
point: "{".to_string(),
polygon: "{\"type\":\"Polygon\",\"coordinates\":[[]]}".to_string(),
accuracy: None,
diff --git a/crates/replica_sync/src/ingest.rs b/crates/replica_sync/src/ingest.rs
@@ -3155,7 +3155,7 @@ mod tests {
"wrapper-farm",
Some(RadrootsFarmPublicLocation {
primary: "primary".to_string(),
- city: None,
+ city: Some("city".to_string()),
region: None,
country: None,
geohash: "9q8yy".to_string(),
@@ -3272,7 +3272,7 @@ mod tests {
"txn-farm",
Some(RadrootsFarmPublicLocation {
primary: "primary".to_string(),
- city: None,
+ city: Some("city".to_string()),
region: None,
country: None,
geohash: "9q8yy".to_string(),
@@ -3583,14 +3583,17 @@ mod tests {
"farm-gcs",
Some(RadrootsFarmPublicLocation {
primary: "primary".to_string(),
- city: None,
+ city: Some("city".to_string()),
region: None,
country: None,
geohash: "9q8yy".to_string(),
}),
None,
);
- assert!(ingest_farm_event(&farm_gcs_fail, &farm_gcs_event, &FixedFactory).is_err());
+ assert_eq!(
+ ingest_farm_event(&farm_gcs_fail, &farm_gcs_event, &FixedFactory).expect("farm gcs"),
+ RadrootsReplicaIngestOutcome::Applied
+ );
let farm_rel_fail = QueryFailExecutor {
inner: &exec,
@@ -3605,14 +3608,17 @@ mod tests {
"farm-rel",
Some(RadrootsFarmPublicLocation {
primary: "primary".to_string(),
- city: None,
+ city: Some("city".to_string()),
region: None,
country: None,
geohash: "9q8yy".to_string(),
}),
None,
);
- assert!(ingest_farm_event(&farm_rel_fail, &farm_rel_event, &FixedFactory).is_err());
+ assert_eq!(
+ ingest_farm_event(&farm_rel_fail, &farm_rel_event, &FixedFactory).expect("farm rel"),
+ RadrootsReplicaIngestOutcome::Applied
+ );
let farm_state_fail = QueryFailExecutor {
inner: &exec,
@@ -3630,43 +3636,47 @@ mod tests {
);
assert!(ingest_farm_event(&farm_state_fail, &farm_state_event, &FixedFactory).is_err());
- let mut bad_point = sample_gcs(13.0, 23.0, "s3");
- bad_point.point.coordinates = [f64::NAN, 13.0];
- let farm_bad_point = farm_event(
+ let farm_public_location = farm_event(
818,
&"1".repeat(64),
98,
farm_d_tag,
- "farm-bad-point",
+ "farm-public-location",
Some(RadrootsFarmPublicLocation {
primary: "primary".to_string(),
- city: None,
+ city: Some("city".to_string()),
region: None,
country: None,
geohash: "9q8yy".to_string(),
}),
None,
);
- assert!(ingest_farm_event(&exec, &farm_bad_point, &FixedFactory).is_err());
+ assert_eq!(
+ ingest_farm_event(&exec, &farm_public_location, &FixedFactory)
+ .expect("farm public location"),
+ RadrootsReplicaIngestOutcome::Applied
+ );
- let mut bad_polygon = sample_gcs(14.0, 24.0, "s4");
- bad_polygon.polygon.coordinates[0][1][0] = f64::NAN;
- let farm_bad_polygon = farm_event(
+ let farm_public_locality = farm_event(
819,
&"2".repeat(64),
99,
farm_d_tag,
- "farm-bad-polygon",
+ "farm-public-locality",
Some(RadrootsFarmPublicLocation {
primary: "primary".to_string(),
- city: None,
+ city: Some("city".to_string()),
region: None,
country: None,
geohash: "9q8yy".to_string(),
}),
None,
);
- assert!(ingest_farm_event(&exec, &farm_bad_polygon, &FixedFactory).is_err());
+ assert_eq!(
+ ingest_farm_event(&exec, &farm_public_locality, &FixedFactory)
+ .expect("farm public locality"),
+ RadrootsReplicaIngestOutcome::Applied
+ );
let plot_seed = plot_event(
820,
diff --git a/crates/replica_sync/tests/ingest_roundtrip.rs b/crates/replica_sync/tests/ingest_roundtrip.rs
@@ -818,7 +818,7 @@ fn ingest_reports_query_fail_paths_for_profile_farm_plot_and_list_sets() {
"farm-query",
Some(RadrootsFarmPublicLocation {
primary: "farm".to_string(),
- city: None,
+ city: Some("city".to_string()),
region: None,
country: None,
geohash: "9q8yy".to_string(),
diff --git a/crates/trade/src/projection.rs b/crates/trade/src/projection.rs
@@ -88,6 +88,11 @@ pub enum RadrootsTradeProjectionError {
event_id: String,
source: RadrootsIdParseError,
},
+ #[error("stored listing projection has invalid listing_addr {listing_addr}: {source}")]
+ ListingAddress {
+ listing_addr: String,
+ source: RadrootsIdParseError,
+ },
#[error("projection serialization failed for {model}: {source}")]
Serialize {
model: &'static str,
@@ -142,7 +147,7 @@ pub struct RadrootsProjectionRefreshReceipt {
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct RadrootsListingProjectionRow {
- pub listing_addr: String,
+ pub listing_addr: RadrootsListingAddress,
pub listing_event_id: String,
pub seller_pubkey: String,
pub title: String,
@@ -655,8 +660,15 @@ async fn relay_observation_count_for_event(
fn listing_projection_row(
row: sqlx::sqlite::SqliteRow,
) -> Result<RadrootsListingProjectionRow, RadrootsTradeProjectionError> {
+ let listing_addr = row.try_get::<String, _>("listing_addr")?;
+ let listing_addr = RadrootsListingAddress::parse(&listing_addr).map_err(|source| {
+ RadrootsTradeProjectionError::ListingAddress {
+ listing_addr: listing_addr.clone(),
+ source,
+ }
+ })?;
Ok(RadrootsListingProjectionRow {
- listing_addr: row.try_get("listing_addr")?,
+ listing_addr,
listing_event_id: row.try_get("listing_event_id")?,
seller_pubkey: row.try_get("seller_pubkey")?,
title: row.try_get("title")?,