This repository was archived by the owner on Jan 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
This repository was archived by the owner on Jan 2, 2023. It is now read-only.
Improve nonce handling in StfEnclaveSigner #121
Copy link
Copy link
Closed
Description
Currently, indirect_call is initiated by enclave_account in indirect_call_executor, and the nonce of the account is read from storage. When a block has only one indirect_call, the nonce handing is no problem(read from stroage), but if there are multiple indirect_call in a block, a too low priority error will occur. Because the nonce will not increase before the indirect_call is executed.
This requires us to have a method to adjust the value of nonce. The solution can be:
- We can read the number of
pending_trusted_callsinitiated by enclave_account from top_pool (here I will call itpending_tx),current_noncepluspending_txshould be the value we need. Here are some code for reference
Sign call:
tee-worker/core-primitives/stf-executor/src/enclave_signer.rs
Lines 88 to 103 in 6b69cca
| fn sign_call_with_self( | |
| &self, | |
| trusted_call: &TrustedCall, | |
| shard: &ShardIdentifier, | |
| ) -> Result<TrustedCallSigned> { | |
| let mr_enclave = self.ocall_api.get_mrenclave_of_self()?; | |
| let enclave_account_nonce = self.get_enclave_account_nonce(shard)?; | |
| let enclave_call_signing_key = self.get_enclave_call_signing_key()?; | |
| Ok(trusted_call.sign( | |
| &KeyPair::Ed25519(enclave_call_signing_key), | |
| enclave_account_nonce.into(), | |
| &mr_enclave.m, | |
| shard, | |
| )) | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels