Skip to content

Commit

Permalink
fix rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Eikix committed Feb 7, 2025
1 parent 2b7939a commit 56dc553
Showing 1 changed file with 9 additions and 169 deletions.
178 changes: 9 additions & 169 deletions cairo/ethereum/cancun/transactions_types.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ func get_transaction_type(tx: Transaction) -> felt {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
return 0;
ret;

Check warning on line 146 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L145-L146

Added lines #L145 - L146 were not covered by tests
}
}
func get_gas(tx: Transaction) -> Uint {
Expand All @@ -162,8 +162,7 @@ func get_gas(tx: Transaction) -> Uint {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
let res = Uint(0);
return res;
ret;

Check warning on line 165 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L164-L165

Added lines #L164 - L165 were not covered by tests
}
}
func get_r(tx: Transaction) -> U256 {
Expand All @@ -182,8 +181,7 @@ func get_r(tx: Transaction) -> U256 {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
tempvar res = U256(new U256Struct(0, 0));
return res;
ret;

Check warning on line 184 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L183-L184

Added lines #L183 - L184 were not covered by tests
}
}
func get_s(tx: Transaction) -> U256 {
Expand All @@ -202,8 +200,7 @@ func get_s(tx: Transaction) -> U256 {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
tempvar res = U256(new U256Struct(0, 0));
return res;
ret;

Check warning on line 203 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L202-L203

Added lines #L202 - L203 were not covered by tests
}
}
func get_max_fee_per_gas(tx: Transaction) -> Uint {
Expand All @@ -216,8 +213,7 @@ func get_max_fee_per_gas(tx: Transaction) -> Uint {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
let res = Uint(0);
return res;
ret;

Check warning on line 216 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L215-L216

Added lines #L215 - L216 were not covered by tests
}
}
func get_max_priority_fee_per_gas(tx: Transaction) -> Uint {
Expand All @@ -230,8 +226,7 @@ func get_max_priority_fee_per_gas(tx: Transaction) -> Uint {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
let res = Uint(0);
return res;
ret;

Check warning on line 229 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L228-L229

Added lines #L228 - L229 were not covered by tests
}
}
func get_gas_price(tx: Transaction) -> Uint {
Expand All @@ -244,8 +239,7 @@ func get_gas_price(tx: Transaction) -> Uint {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
let res = Uint(0);
return res;
ret;

Check warning on line 242 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L241-L242

Added lines #L241 - L242 were not covered by tests
}
}
func get_nonce(tx: Transaction) -> U256 {
Expand All @@ -264,8 +258,7 @@ func get_nonce(tx: Transaction) -> U256 {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
tempvar res = U256(new U256Struct(0, 0));
return res;
ret;

Check warning on line 261 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L260-L261

Added lines #L260 - L261 were not covered by tests
}
}
func get_value(tx: Transaction) -> U256 {
Expand All @@ -284,159 +277,6 @@ func get_value(tx: Transaction) -> U256 {
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
tempvar res = U256(new U256Struct(0, 0));
return res;
namespace TransactionImpl {
func get_transaction_type(tx: Transaction) -> felt {
if (cast(tx.value.legacy_transaction.value, felt) != 0) {
return TransactionType.LEGACY;
}
if (cast(tx.value.access_list_transaction.value, felt) != 0) {
return TransactionType.ACCESS_LIST;
}
if (cast(tx.value.fee_market_transaction.value, felt) != 0) {
return TransactionType.FEE_MARKET;
}
if (cast(tx.value.blob_transaction.value, felt) != 0) {
return TransactionType.BLOB;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_gas(tx: Transaction) -> Uint {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.LEGACY) {
return tx.value.legacy_transaction.value.gas;
}
if (tx_type == TransactionType.ACCESS_LIST) {
return tx.value.access_list_transaction.value.gas;
}
if (tx_type == TransactionType.FEE_MARKET) {
return tx.value.fee_market_transaction.value.gas;
}
if (tx_type == TransactionType.BLOB) {
return tx.value.blob_transaction.value.gas;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_r(tx: Transaction) -> U256 {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.LEGACY) {
return tx.value.legacy_transaction.value.r;
}
if (tx_type == TransactionType.ACCESS_LIST) {
return tx.value.access_list_transaction.value.r;
}
if (tx_type == TransactionType.FEE_MARKET) {
return tx.value.fee_market_transaction.value.r;
}
if (tx_type == TransactionType.BLOB) {
return tx.value.blob_transaction.value.r;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_s(tx: Transaction) -> U256 {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.LEGACY) {
return tx.value.legacy_transaction.value.s;
}
if (tx_type == TransactionType.ACCESS_LIST) {
return tx.value.access_list_transaction.value.s;
}
if (tx_type == TransactionType.FEE_MARKET) {
return tx.value.fee_market_transaction.value.s;
}
if (tx_type == TransactionType.BLOB) {
return tx.value.blob_transaction.value.s;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_max_fee_per_gas(tx: Transaction) -> Uint {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.FEE_MARKET) {
return tx.value.fee_market_transaction.value.max_fee_per_gas;
}
if (tx_type == TransactionType.BLOB) {
return tx.value.blob_transaction.value.max_fee_per_gas;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_max_priority_fee_per_gas(tx: Transaction) -> Uint {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.FEE_MARKET) {
return tx.value.fee_market_transaction.value.max_priority_fee_per_gas;
}
if (tx_type == TransactionType.BLOB) {
return tx.value.blob_transaction.value.max_priority_fee_per_gas;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_gas_price(tx: Transaction) -> Uint {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.LEGACY) {
return tx.value.legacy_transaction.value.gas_price;
}
if (tx_type == TransactionType.ACCESS_LIST) {
return tx.value.access_list_transaction.value.gas_price;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_nonce(tx: Transaction) -> U256 {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.LEGACY) {
return tx.value.legacy_transaction.value.nonce;
}
if (tx_type == TransactionType.ACCESS_LIST) {
return tx.value.access_list_transaction.value.nonce;
}
if (tx_type == TransactionType.FEE_MARKET) {
return tx.value.fee_market_transaction.value.nonce;
}
if (tx_type == TransactionType.BLOB) {
return tx.value.blob_transaction.value.nonce;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
}
func get_value(tx: Transaction) -> U256 {
let tx_type = get_transaction_type(tx);
if (tx_type == TransactionType.LEGACY) {
return tx.value.legacy_transaction.value.value;
}
if (tx_type == TransactionType.ACCESS_LIST) {
return tx.value.access_list_transaction.value.value;
}
if (tx_type == TransactionType.FEE_MARKET) {
return tx.value.fee_market_transaction.value.value;
}
if (tx_type == TransactionType.BLOB) {
return tx.value.blob_transaction.value.value;
}
with_attr error_message("InvalidTransaction") {
assert 0 = 1;
ret;
}
ret;

Check warning on line 280 in cairo/ethereum/cancun/transactions_types.cairo

View check run for this annotation

Codecov / codecov/patch

cairo/ethereum/cancun/transactions_types.cairo#L279-L280

Added lines #L279 - L280 were not covered by tests
}
}

0 comments on commit 56dc553

Please sign in to comment.