Skip to content

Commit

Permalink
Transaction chain_id
Browse files Browse the repository at this point in the history
  • Loading branch information
sergerad committed Aug 29, 2024
1 parent fa74bbc commit 6051ab7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions rollup/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ mod address;
pub use address::Address;

pub const BLOCK_PERIOD_MILLIS: u64 = 2000;
pub const CHAIN_ID: u64 = 83479;
6 changes: 5 additions & 1 deletion rollup/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ use secp256k1::{Message, Secp256k1};
use serde::{Deserialize, Serialize};

use crate::signer::{Signature, Signer};
use crate::Address;
use crate::{Address, CHAIN_ID};

/// A transaction header containing metadata about the transaction.
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct TransactionHeader {
/// The identifier of the chain on which the transaction was intended to be executed.
chain_id: u64,
/// The address of the sender of the transaction.
sender: Address,
/// The address of the recipient of the transaction.
Expand Down Expand Up @@ -66,6 +68,7 @@ impl Transaction {
pub fn dynamic(sender: Address, amount: u64) -> Self {
Transaction::Dynamic(DynamicTxData {
header: TransactionHeader {
chain_id: CHAIN_ID,
sender,
recipient: Address::random(),
amount,
Expand All @@ -79,6 +82,7 @@ impl Transaction {
pub fn withdrawal(sender: Address, amount: u64, dest_chain: u64) -> Self {
Transaction::Withdrawal(WithdrawalTxData {
header: TransactionHeader {
chain_id: CHAIN_ID,
sender,
recipient: sender,
amount,
Expand Down

0 comments on commit 6051ab7

Please sign in to comment.