Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(API): U256 for chainId in api::Transaction struct #211

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/lib/dal/src/models/storage_transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl<'r> FromRow<'r, PgRow> for StorageApiTransaction {
.unwrap_or_default()
.map(U64::from),
access_list: None,
chain_id: 0,
chain_id: U256::zero(),
l1_batch_number: db_row
.try_get::<i64, &str>("l1_batch_number_tx")
.ok()
Expand Down Expand Up @@ -502,7 +502,7 @@ pub fn web3_transaction_select_sql() -> &'static str {

pub fn extract_web3_transaction(db_row: PgRow, chain_id: L2ChainId) -> api::Transaction {
let mut storage_api_tx = StorageApiTransaction::from_row(&db_row).unwrap();
storage_api_tx.inner_api_transaction.chain_id = chain_id.as_u64();
storage_api_tx.inner_api_transaction.chain_id = U256::from(chain_id.as_u64());
if storage_api_tx.inner_api_transaction.transaction_type == Some(U64::from(0)) {
storage_api_tx.inner_api_transaction.v = storage_api_tx
.inner_api_transaction
Expand Down
2 changes: 1 addition & 1 deletion core/lib/types/src/api/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ pub struct Transaction {
pub max_priority_fee_per_gas: Option<U256>,
/// Id of the current chain
#[serde(rename = "chainId")]
pub chain_id: u64,
pub chain_id: U256,
/// Number of the l1 batch this transaction was included within.
#[serde(
rename = "l1BatchNumber",
Expand Down
2 changes: 1 addition & 1 deletion core/lib/types/src/l2/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ impl From<L2Tx> for api::Transaction {

Self {
hash: tx.hash(),
chain_id: tx.common_data.extract_chain_id().unwrap_or_default(),
chain_id: U256::from(tx.common_data.extract_chain_id().unwrap_or_default()),
nonce: U256::from(tx.common_data.nonce.0),
from: Some(tx.common_data.initiator_address),
to: Some(tx.recipient_account()),
Expand Down