Skip to content

feat(src20): emit Transfer event to both sender and recipient#130

Merged
ameya-deshmukh merged 3 commits intomainfrom
ameya/emit-event-to-both-parties-src20
Mar 25, 2026
Merged

feat(src20): emit Transfer event to both sender and recipient#130
ameya-deshmukh merged 3 commits intomainfrom
ameya/emit-event-to-both-parties-src20

Conversation

@ameya-deshmukh
Copy link
Copy Markdown
Contributor

@ameya-deshmukh ameya-deshmukh commented Mar 24, 2026

Summary

  • Symmetric event emission: emitTransferEncrypted now emits the Transfer event to both the sender and recipient, independently. Previously only the recipient received it.
  • Each party gets an encrypted event if they have a registered AES key, or a zero-hash/empty-data event if they don't.
  • Adds 12 tests in SRC20Events.t.sol covering all combinations: both have keys, only sender, only recipient, neither — for transfer, transferFrom, mint, and burn.

Test plan

  • All 12 new event tests pass via sforge test --match-contract SRC20EventsTest
  • Verify existing SRC20 tests still pass in CI
  • Manual smoke test on devnet with registered/unregistered AES keys

Previously, emitTransferEncrypted only emitted the encrypted Transfer
event to the recipient. This makes it symmetric by also emitting to the
sender, independently of whether the other party has a registered AES
key. Adds 12 tests covering all combinations of key registration for
transfer, transferFrom, mint, and burn.
…enerated AES keys

Use deployCodeTo to deploy real Directory and Intelligence contracts at
their genesis addresses. Generate AES keys via the RNG precompile
(CryptoUtils.generateRandomAESKey) and register them with Directory.
Validate events using vm.recordLogs instead of mock expectations.
For every test where a party has a registered AES key, decrypt the
emitted encrypted amount using Directory.decrypt() and assert it matches
the original transfer amount. This verifies the full encrypt→emit→decrypt
round-trip through real AES-256-GCM precompiles.
@ameya-deshmukh ameya-deshmukh merged commit 885d57b into main Mar 25, 2026
4 checks passed
@ameya-deshmukh ameya-deshmukh deleted the ameya/emit-event-to-both-parties-src20 branch March 25, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant