From 89c5bc2c594019609f0c3ee59629ccdf769089af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Gaspard?= Date: Fri, 16 Jun 2023 12:18:31 +0000 Subject: [PATCH] move DataReceiver to near-vm-errors See #9176 for the rationale, near-vm-errors will be merged into near-vm-runner as soon as circular dependencies are done for. --- core/primitives/src/receipt.rs | 20 ++------------------ runtime/near-vm-errors/src/lib.rs | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/core/primitives/src/receipt.rs b/core/primitives/src/receipt.rs index bca5f6b167c..0f07ee72249 100644 --- a/core/primitives/src/receipt.rs +++ b/core/primitives/src/receipt.rs @@ -11,6 +11,8 @@ use serde_with::serde_as; use std::borrow::Borrow; use std::fmt; +pub use near_vm_errors::DataReceiver; + /// Receipts are used for a cross-shard communication. /// Receipts could be 2 types (determined by a `ReceiptEnum`): `ReceiptEnum::Action` of `ReceiptEnum::Data`. #[derive( @@ -170,24 +172,6 @@ impl fmt::Debug for DataReceipt { } } -/// The outgoing (egress) data which will be transformed -/// to a `DataReceipt` to be sent to a `receipt.receiver` -#[derive( - BorshSerialize, - BorshDeserialize, - Hash, - Clone, - Debug, - PartialEq, - Eq, - serde::Serialize, - serde::Deserialize, -)] -pub struct DataReceiver { - pub data_id: CryptoHash, - pub receiver_id: AccountId, -} - /// A temporary data which is created by processing of DataReceipt /// stored in a state trie with a key = `account_id` + `data_id` until /// `input_data_ids` of all incoming Receipts are satisfied diff --git a/runtime/near-vm-errors/src/lib.rs b/runtime/near-vm-errors/src/lib.rs index 62c7bc96530..028a630b984 100644 --- a/runtime/near-vm-errors/src/lib.rs +++ b/runtime/near-vm-errors/src/lib.rs @@ -49,6 +49,24 @@ impl TrieNodesCount { }) } } + +/// The outgoing (egress) data which will be transformed +/// to a `DataReceipt` to be sent to a `receipt.receiver` +#[derive( + BorshSerialize, + BorshDeserialize, + Hash, + Clone, + Debug, + PartialEq, + Eq, + serde::Serialize, + serde::Deserialize, +)] +pub struct DataReceiver { + pub data_id: CryptoHash, + pub receiver_id: AccountId, +} // ---------->8---------- /// For bugs in the runtime itself, crash and die is the usual response.