Skip to content

Commit

Permalink
Merge pull request #76 from argentlabs/fix/version
Browse files Browse the repository at this point in the history
move version check
  • Loading branch information
juniset authored Nov 19, 2022
2 parents c6d3ee5 + 2436a5d commit 597e6b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions contracts/account/ArgentAccount.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ func __validate__{
// get the tx info
let (tx_info) = get_tx_info();

// block transaction with version != 1 or QUERY
assert_correct_tx_version(tx_info.version);

if (call_array_len == 1) {
if (call_array[0].to == tx_info.account_contract_address) {
// a * b == 0 --> a == 0 OR b == 0
Expand Down Expand Up @@ -120,6 +117,11 @@ func __execute__{
retdata_size: felt, retdata: felt*
) {
alloc_locals;

let (tx_info) = get_tx_info();

// block transaction with version != 1 or QUERY
assert_correct_tx_version(tx_info.version);

// no reentrant call to prevent signature reutilization
assert_non_reentrant();
Expand All @@ -128,7 +130,6 @@ func __execute__{
let (retdata_len, retdata) = execute_call_array(call_array_len, call_array, calldata_len, calldata);

// emit event
let (tx_info) = get_tx_info();
transaction_executed.emit(
hash=tx_info.transaction_hash, response_len=retdata_len, response=retdata
);
Expand Down
9 changes: 5 additions & 4 deletions contracts/account/ArgentPluginAccount.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ func __validate__{
// get the tx info
let (tx_info) = get_tx_info();

// block transaction with version != 1 or QUERY
assert_correct_tx_version(tx_info.version);

if (call_array_len == 1) {
if (call_array[0].to == tx_info.account_contract_address) {
// a * b == 0 --> a == 0 OR b == 0
Expand Down Expand Up @@ -139,13 +136,17 @@ func __execute__{
) {
alloc_locals;

let (tx_info) = get_tx_info();

// block transaction with version != 1 or QUERY
assert_correct_tx_version(tx_info.version);

// no reentrant call to prevent signature reutilization
assert_non_reentrant();

let (retdata_len, retdata) = execute_call_array_plugin(call_array_len, call_array, calldata_len, calldata);

// emit event
let (tx_info) = get_tx_info();
transaction_executed.emit(
hash=tx_info.transaction_hash, response_len=retdata_len, response=retdata
);
Expand Down

0 comments on commit 597e6b2

Please sign in to comment.