Skip to content

Commit 7f0145f

Browse files
committed
Add comments describing the intended usage of the KeyLock interface methods
1 parent 720f8c9 commit 7f0145f

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

services/requester/keystore/key_store.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,20 @@ var ErrNoKeysAvailable = fmt.Errorf("no signing keys available")
1717
const accountKeyBlockExpiration = flow.DefaultTransactionExpiry
1818

1919
type KeyLock interface {
20+
// This method is intended for the happy path of valid EVM transactions.
21+
// The event subscriber module only subscribes to EVM-related events:
22+
// - `EVM.TransactionExecuted`
23+
// - `EVM.BlockExecuted`
24+
//
25+
// Valid EVM transactions do emit `EVM.TransactionExecuted` events, so we
26+
// release the account key that was used by the Flow tx which emitted
27+
// the above EVM event.
2028
NotifyTransaction(txID flowsdk.Identifier)
29+
// This method is intended for the unhappy path of invalid EVM transactions.
30+
// For each new Flow block, we check the result status of all included Flow
31+
// transactions, and we release the account keys which they used. This also
32+
// handles the release of expired transactions, that weren't even included
33+
// in a Flow block.
2134
NotifyBlock(blockHeader flowsdk.BlockHeader)
2235
}
2336

0 commit comments

Comments
 (0)