Skip to content

Commit

Permalink
Changed 'publisher_id' to 'relayer_id'
Browse files Browse the repository at this point in the history
  • Loading branch information
Egor Ulesykiy committed Aug 31, 2022
1 parent ce474eb commit 1b52660
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion chain/chain/src/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ impl RuntimeAdapter for KeyValueRuntime {
receipt_id: create_receipt_nonce(from.clone(), to.clone(), amount, nonce),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: from.clone(),
publisher_id: None,
relayer_id: None,
signer_public_key: PublicKey::empty(KeyType::ED25519),
gas_price,
output_data_receivers: vec![],
Expand Down
12 changes: 6 additions & 6 deletions core/primitives/src/receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Receipt {

receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: "system".parse().unwrap(),
publisher_id: None,
relayer_id: None,
signer_public_key: PublicKey::empty(KeyType::ED25519),
gas_price: 0,
output_data_receivers: vec![],
Expand Down Expand Up @@ -80,7 +80,7 @@ impl Receipt {

receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: receiver_id.clone(),
publisher_id: None,
relayer_id: None,
signer_public_key,
gas_price: 0,
output_data_receivers: vec![],
Expand All @@ -91,7 +91,7 @@ impl Receipt {
}

pub fn new_delegate_actions(
publisher_id: &AccountId,
relayer_id: &AccountId,
predecessor_id: &AccountId,
delegate_action: &DelegateAction,
public_key: &PublicKey,
Expand All @@ -104,7 +104,7 @@ impl Receipt {

receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: predecessor_id.clone(),
publisher_id: Some(publisher_id.clone()),
relayer_id: Some(relayer_id.clone()),
signer_public_key: public_key.clone(),
gas_price: gas_price,
output_data_receivers: vec![],
Expand All @@ -129,8 +129,8 @@ pub enum ReceiptEnum {
pub struct ActionReceipt {
/// A signer of the original transaction
pub signer_id: AccountId,
/// A publisher's identifier in case of a delgated action
pub publisher_id: Option<AccountId>,
/// A relayer's identifier in case of a delgated action
pub relayer_id: Option<AccountId>,
/// An access key which was used to sign the original transaction
pub signer_public_key: PublicKey,
/// A gas_price which has been used to buy gas in the original transaction
Expand Down
2 changes: 1 addition & 1 deletion core/primitives/src/views.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ impl TryFrom<ReceiptView> for Receipt {
actions,
} => ReceiptEnum::Action(ActionReceipt {
signer_id,
publisher_id: None,
relayer_id: None,
signer_public_key,
gas_price,
output_data_receivers: output_data_receivers
Expand Down
2 changes: 1 addition & 1 deletion genesis-tools/genesis-csv-to-json/src/csv_parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ fn account_records(row: &Row, gas_price: Balance) -> Vec<StateRecord> {
receipt_id: hash(row.account_id.as_ref().as_bytes()),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: row.account_id.clone(),
publisher_id: None,
relayer_id: None,
// `signer_public_key` can be anything because the key checks are not applied when
// a transaction is already converted to a receipt.
signer_public_key: PublicKey::empty(KeyType::ED25519),
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/tests/standard_cases/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1414,7 +1414,7 @@ fn make_write_key_value_action(key: Vec<u64>, value: Vec<u64>) -> Action {
fn make_receipt(node: &impl Node, actions: Vec<Action>, receiver_id: AccountId) -> Receipt {
let receipt_enum = ReceiptEnum::Action(ActionReceipt {
signer_id: alice_account(),
publisher_id: None,
relayer_id: None,
signer_public_key: node.signer().as_ref().public_key(),
gas_price: 0,
output_data_receivers: vec![],
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime/src/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub(crate) fn action_function_call(
receipt_id: CryptoHash::default(),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: action_receipt.signer_id.clone(),
publisher_id: action_receipt.publisher_id.clone(),
relayer_id: action_receipt.relayer_id.clone(),
signer_public_key: action_receipt.signer_public_key.clone(),
gas_price: action_receipt.gas_price,
output_data_receivers: receipt.output_data_receivers,
Expand Down
4 changes: 2 additions & 2 deletions runtime/runtime/src/balance_checker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ mod tests {
receipt_id: Default::default(),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: tx.transaction.signer_id.clone(),
publisher_id: None,
relayer_id: None,
signer_public_key: tx.transaction.public_key.clone(),
gas_price,
output_data_receivers: vec![],
Expand Down Expand Up @@ -478,7 +478,7 @@ mod tests {
receipt_id: Default::default(),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: tx.transaction.signer_id.clone(),
publisher_id: None,
relayer_id: None,
signer_public_key: tx.transaction.public_key.clone(),
gas_price,
output_data_receivers: vec![],
Expand Down
14 changes: 7 additions & 7 deletions runtime/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl Runtime {
receipt_id,
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: transaction.signer_id.clone(),
publisher_id: None,
relayer_id: None,
signer_public_key: transaction.public_key.clone(),
gas_price: verification_result.receipt_gas_price,
output_data_receivers: vec![],
Expand Down Expand Up @@ -805,8 +805,8 @@ impl Runtime {

let signer_is_predecessor =
action_receipt.signer_id.as_str() == receipt.predecessor_id.as_str();
let refund_id = if action_receipt.publisher_id.is_some() && signer_is_predecessor {
action_receipt.publisher_id.as_ref().unwrap()
let refund_id = if action_receipt.relayer_id.is_some() && signer_is_predecessor {
action_receipt.relayer_id.as_ref().unwrap()
} else {
&receipt.predecessor_id
};
Expand Down Expand Up @@ -1521,7 +1521,7 @@ mod tests {
receipt_id: CryptoHash::default(),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: account_id,
publisher_id: None,
relayer_id: None,
signer_public_key: signer.public_key(),
gas_price: GAS_PRICE,
output_data_receivers: vec![],
Expand Down Expand Up @@ -1872,7 +1872,7 @@ mod tests {
receipt_id,
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: bob_account(),
publisher_id: None,
relayer_id: None,
signer_public_key: PublicKey::empty(KeyType::ED25519),
gas_price: GAS_PRICE,
output_data_receivers: vec![],
Expand Down Expand Up @@ -2188,7 +2188,7 @@ mod tests {
receipt_id: CryptoHash::default(),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: bob_account(),
publisher_id: None,
relayer_id: None,
signer_public_key: PublicKey::empty(KeyType::ED25519),
gas_price,
output_data_receivers: vec![],
Expand Down Expand Up @@ -2258,7 +2258,7 @@ mod tests {
receipt_id: CryptoHash::default(),
receipt: ReceiptEnum::Action(ActionReceipt {
signer_id: bob_account(),
publisher_id: None,
relayer_id: None,
signer_public_key: PublicKey::empty(KeyType::ED25519),
gas_price,
output_data_receivers: vec![],
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime/src/state_viewer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ impl TrieViewer {
};
let action_receipt = ActionReceipt {
signer_id: originator_id.clone(),
publisher_id: None,
relayer_id: None,
signer_public_key: public_key,
gas_price: 0,
output_data_receivers: vec![],
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime/src/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ mod tests {
&limit_config,
&ActionReceipt {
signer_id: alice_account(),
publisher_id: None,
relayer_id: None,
signer_public_key: PublicKey::empty(KeyType::ED25519),
gas_price: 100,
output_data_receivers: vec![],
Expand Down

0 comments on commit 1b52660

Please sign in to comment.