feat: A4 - LOG4 Opcode #300
Labels
enhancement
New feature or request
opcode
Implementation of an opcode
smart-contract-logic
A specific type of opcode that requires smart contract logic as opposed to pure cairo
Milestone
Append log record with four topics
Official Specification: https://github.com/ethereum/execution-specs/blob/master/src/ethereum/shanghai/vm/instructions/log.py#L33
Kakarot v0 implementation:
https://github.com/kkrt-labs/kakarot/blob/44dabfcab05a87f85bcfe0a457809059d11d83fb/src/kakarot/instructions/logging_operations.cairo#L83
And test cases from Geth:
https://github.com/ethereum/go-ethereum/tree/master/core/vm/testdata
Test cases from Kakarot v0:
https://github.com/kkrt-labs/kakarot/blob/44dabfcab05a87f85bcfe0a457809059d11d83fb/src/kakarot/instructions/logging_operations.cairo
Context on Logs in Cairo and Starknet:
https://docs.starknet.io/documentation/architecture_and_concepts/Smart_Contracts/starknet-events/
https://book.cairo-lang.org/ch99-01-03-03-contract-events.html?highlight=event#events
Index 1 is top of the stack. See PUSH.
Notes
This instruction has no effect on the EVM state. See here.
Stack input
offset
: byte offset in the memory in bytes.size
: byte size to copy.topic1
: 32-byte value.topic2
: 32-byte value.topic3
: 32-byte value.topic4
: 32-byte value.Error cases
The state changes done by the current context are reverted in those cases:
Dynamic gas
For LOG4,
topic_count
is 4. The memory expansion cost explanation can be found here.Estimate your gas cost
The text was updated successfully, but these errors were encountered: