Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

add functions in the Transaction file #178

Closed
wants to merge 1 commit into from
Closed

add functions in the Transaction file #178

wants to merge 1 commit into from

Conversation

cryptoryda
Copy link

changed file: main/bus-mapping/src/circuit_input_builder/transaction.rs

New Functions added for getting additional details of transaction.

Type of change:

  • [1] Add a new method is_invalid to check if the transaction is invalid
  • [ 2] Add a new method sender_account to get the sender's account from the state database
  • [3 ]Add a new method get_call_by_index to get the call by index
  • [4 ]Add a new method value to get the transaction value
  • [5] Add a new method access_list_gas_cost to get the access list gas cost
This PR contains:
- Added `is_invalid`  `sender_account` `get_call_by_index` `value`  function to main/bus-mapping/src/circuit_input_builder/transaction.rs 

Dependencies/Impacts:

  • These changes are backward-compatible and do not introduce any dependencies on other parts of the codebase.

sender_account function example of how it looks:


 // Add a new method to get the sender's account from the state database
    pub fn sender_account(&self, sdb: &StateDB) -> Result<Account, Error> {
        let (found, account) = sdb.get_account(&self.tx.from);
        if !found {
            return Err(Error::AccountNotFound(self.tx.from));
        }
        Ok(account)
    }

Working:

  • above functions works is to find the account is sender's or not? if not then it will revert transaction.

Context:

  • The new functions provide additional details about transactions and enhance the capability to check for transaction validity, retrieve sender's account, etc.

@cryptoryda
Copy link
Author

P.S if you would like to consider each change individually I can redo and submit each PR separately

@cryptoryda cryptoryda closed this by deleting the head repository Mar 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant