v0.1.0-pre.062
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
// file: kb-lib/src/materializer/transaction/annotations.rs
|
||||
// version: 4
|
||||
// version: 5
|
||||
|
||||
//! Exact committed SPL Memo transaction annotation projection.
|
||||
|
||||
@@ -16,17 +16,17 @@ enum MemoGeneration {
|
||||
impl MemoGeneration {
|
||||
fn from_event(event: &crate::MdDecodedProtocolEvent) -> std::option::Option<Self> {
|
||||
if event.program_id.0 == kb_program_ids::SPL_MEMO_V1_PROGRAM_ID
|
||||
&& event.surface_code.0 == "spl_memo_v1"
|
||||
&& event.surface_code.0 == "spl.memo.v1"
|
||||
{
|
||||
return std::option::Option::Some(Self::V1);
|
||||
}
|
||||
if event.program_id.0 == kb_program_ids::SPL_MEMO_V3_PROGRAM_ID
|
||||
&& event.surface_code.0 == "spl_memo_v3"
|
||||
&& event.surface_code.0 == "spl.memo.v3"
|
||||
{
|
||||
return std::option::Option::Some(Self::V3);
|
||||
}
|
||||
if event.program_id.0 == kb_program_ids::SPL_MEMO_V4_PROGRAM_ID
|
||||
&& event.surface_code.0 == "spl_memo_v4"
|
||||
&& event.surface_code.0 == "spl.memo.v4"
|
||||
{
|
||||
return std::option::Option::Some(Self::V4);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ impl crate::MtApiEventMaterializer for crate::MtTransactionAnnotationMaterialize
|
||||
payload_json: serde_json::json!({
|
||||
"projectionVersion": crate::MT_TRANSACTION_ANNOTATIONS_PROJECTION_VERSION,
|
||||
"domain": "transaction_annotation",
|
||||
"annotationKind": "spl_memo",
|
||||
"annotationKind": "spl.memo",
|
||||
"idempotenceKey": idempotence_key,
|
||||
"signature": observation.event.signature.0.clone(),
|
||||
"slot": observation.event.slot.0,
|
||||
@@ -199,7 +199,7 @@ impl crate::MtApiEventMaterializer for crate::MtTransactionAnnotationMaterialize
|
||||
|
||||
fn accepts_event(event: &crate::MdDecodedProtocolEvent) -> bool {
|
||||
return event.event_family == crate::MdEventFamily::Audit
|
||||
&& event.protocol_code.0 == "spl_memo"
|
||||
&& event.protocol_code.0 == "spl.memo"
|
||||
&& (event.source_kind == crate::MdEventSourceKind::Instruction
|
||||
|| event.source_kind == crate::MdEventSourceKind::InnerInstruction)
|
||||
&& MemoGeneration::from_event(event).is_some()
|
||||
@@ -416,7 +416,7 @@ mod tests {
|
||||
slot: crate::MdSlot(42),
|
||||
instruction_path: crate::MdInstructionPath("1/0".to_string()),
|
||||
program_id: crate::MdProgramId(program_id.to_string()),
|
||||
protocol_code: crate::MdProtocolCode("spl_memo".to_string()),
|
||||
protocol_code: crate::MdProtocolCode("spl.memo".to_string()),
|
||||
surface_code: crate::MdSurfaceCode(surface_code.to_string()),
|
||||
event_code: crate::MdEventCode(format!("{surface_code}.{event_name}")),
|
||||
event_name: crate::MdEventName(event_name.to_string()),
|
||||
@@ -465,7 +465,7 @@ mod tests {
|
||||
fn v4() -> crate::DcApiDecodedObservation {
|
||||
return observation(
|
||||
kb_program_ids::SPL_MEMO_V4_PROGRAM_ID,
|
||||
"spl_memo_v4",
|
||||
"spl.memo.v4",
|
||||
"v4",
|
||||
"add_memo",
|
||||
false,
|
||||
@@ -498,9 +498,9 @@ mod tests {
|
||||
#[test]
|
||||
fn exact_v1_v3_and_v4_surfaces_are_accepted() {
|
||||
for (program_id, surface, generation) in [
|
||||
(kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, "spl_memo_v1", "v1"),
|
||||
(kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, "spl_memo_v3", "v3"),
|
||||
(kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, "spl_memo_v4", "v4"),
|
||||
(kb_program_ids::SPL_MEMO_V1_PROGRAM_ID, "spl.memo.v1", "v1"),
|
||||
(kb_program_ids::SPL_MEMO_V3_PROGRAM_ID, "spl.memo.v3", "v3"),
|
||||
(kb_program_ids::SPL_MEMO_V4_PROGRAM_ID, "spl.memo.v4", "v4"),
|
||||
] {
|
||||
let observation = observation(
|
||||
program_id,
|
||||
@@ -523,7 +523,7 @@ mod tests {
|
||||
fn v1_observed_accounts_are_not_claimed_as_runtime_verified() {
|
||||
let observation = observation(
|
||||
kb_program_ids::SPL_MEMO_V1_PROGRAM_ID,
|
||||
"spl_memo_v1",
|
||||
"spl.memo.v1",
|
||||
"v1",
|
||||
"add_memo",
|
||||
false,
|
||||
@@ -546,7 +546,7 @@ mod tests {
|
||||
fn failed_or_uncommitted_memo_is_refused_without_output() {
|
||||
let observation = observation(
|
||||
kb_program_ids::SPL_MEMO_V4_PROGRAM_ID,
|
||||
"spl_memo_v4",
|
||||
"spl.memo.v4",
|
||||
"v4",
|
||||
"memo_intent",
|
||||
true,
|
||||
|
||||
Reference in New Issue
Block a user