Skip to content

BUG: incorrect nonce value #499

@greged93

Description

@greged93

I am sending a transaction to a contract which tries to get the nonce of the sender via the transaction info syscall. The below is the cairo 1 snippet I am running (with the link to the full code here):

assert(get_caller_address().is_zero(), 'Caller not 0');

let tx_info = get_tx_info().unbox();

let call_len = calls.len();
assert(call_len == 1, 'call len is not 1');

let call = calls.at(0);
assert(*call.to == self.kakarot_core_address(), 'to is not kakarot core');
assert!(
    *call.selector == selector!("eth_send_transaction"),
    "Validate: selector must be eth_send_transaction"
);

let signature = tx_info.signature;
let chain_id = self.chain_id();

let tx_metadata = TransactionMetadata {
     address: self.evm_address(),
     chain_id,
     account_nonce: tx_info.nonce.try_into().unwrap(),
     signature: signature
            .try_into_eth_signature(chain_id)
            .expect('signature extraction failed')
};

However, printing the tx_info.nonce value gets me a 0x1139045e000000000000000000000000000000000 instead of 0x0. I tried tracing the nonce value all the way to the wrap_get_execution_info_v2 and it seems the value was still correct. Couldn't figure out at what point the nonce gets set to this incorrect value.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions