Îõ³h*7n2¨Î      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍ0.2.02018-2024 Simon ShineMIT!Simon Shine  Safe-Inferred"9ØÝäì!ƒ evm-opcodesAn  for a given Û contains the numeric encoding of the opcode, the number of items that this opcode removes from the stack (±), and the number of items added to the stack (´). These values are documented in the Ethereum Yellow Paper. Examples of s: í-- Hex ± ´ OpcodeSpec 0x01 2 1 "add" OpcodeSpec 0x60 0 1 "push1 255" OpcodeSpec 0x61 0 1 "push2 256" evm-opcodesNumeric encoding of opcode evm-opcodes*Number of items opcode places on stack (±) evm-opcodes-Number of items opcode removes from stack (´) evm-opcodes Printable name for opcode, e.g. "add" evm-opcodes'Convenience type of cardinality 16 for _ and `. evm-opcodes&Convenience type of cardinality 5 for a. evm-opcodesAn 3 is an Ethereum VM Opcode with parameterised jumps.?For a plain opcode using the basic EVM stack-based jumps, use  instead.áThis type is used for defining and translating from annotated opcodes, e.g. with labelled jumps. evm-opcodes0x00 evm-opcodes0x01  evm-opcodes0x02! evm-opcodes0x03" evm-opcodes0x04# evm-opcodes0x05$ evm-opcodes0x06% evm-opcodes0x07& evm-opcodes0x08' evm-opcodes0x09( evm-opcodes0x0a) evm-opcodes0x0b* evm-opcodes0x10+ evm-opcodes0x11, evm-opcodes0x12- evm-opcodes0x13. evm-opcodes0x14/ evm-opcodes0x150 evm-opcodes0x161 evm-opcodes0x172 evm-opcodes0x183 evm-opcodes0x194 evm-opcodes0x1a5 evm-opcodes0x1b, &https://eips.ethereum.org/EIPS/eip-1456 evm-opcodes0x1c, &https://eips.ethereum.org/EIPS/eip-1457 evm-opcodes0x1d, &https://eips.ethereum.org/EIPS/eip-1458 evm-opcodes0x20, 'https://eips.ethereum.org/EIPS/eip-18039 evm-opcodes0x30: evm-opcodes0x31; evm-opcodes0x32< evm-opcodes0x33= evm-opcodes0x34> evm-opcodes0x35? evm-opcodes0x36@ evm-opcodes0x37A evm-opcodes0x38B evm-opcodes0x39C evm-opcodes0x3aD evm-opcodes0x3bE evm-opcodes0x3cF evm-opcodes0x3d, &https://eips.ethereum.org/EIPS/eip-211G evm-opcodes0x3e, &https://eips.ethereum.org/EIPS/eip-211H evm-opcodes0x3f, 'https://eips.ethereum.org/EIPS/eip-1052I evm-opcodes0x40J evm-opcodes0x41K evm-opcodes0x42L evm-opcodes0x43M evm-opcodes0x44, 'https://eips.ethereum.org/EIPS/eip-4399N evm-opcodes0x45O evm-opcodes0x46, 'https://eips.ethereum.org/EIPS/eip-1344P evm-opcodes0x47, 'https://eips.ethereum.org/EIPS/eip-1884Q evm-opcodes0x48, 'https://eips.ethereum.org/EIPS/eip-3198R evm-opcodes0x50S evm-opcodes0x51T evm-opcodes0x52U evm-opcodes0x53V evm-opcodes0x54W evm-opcodes0x55X evm-opcodes0x56Y evm-opcodes0x57Z evm-opcodes0x58[ evm-opcodes0x59\ evm-opcodes0x5a] evm-opcodes0x5b^ evm-opcodes0x60 - 0x7f (PUSH1 - PUSH32)_ evm-opcodes 0x80 - 0x8f ( - )` evm-opcodes 0x90 - 0x9f (€ - q)a evm-opcodes 0xa0 - 0xa4 (p - l)b evm-opcodes0xf0c evm-opcodes0xf1d evm-opcodes0xf2e evm-opcodes0xf3f evm-opcodes0xf4, $https://eips.ethereum.org/EIPS/eip-7g evm-opcodes0xf5, 'https://eips.ethereum.org/EIPS/eip-1014h evm-opcodes0xfai evm-opcodes0xfd, &https://eips.ethereum.org/EIPS/eip-140j evm-opcodes0xfe, &https://eips.ethereum.org/EIPS/eip-141k evm-opcodes0xff, $https://eips.ethereum.org/EIPS/eip-6l evm-opcodesUse l instead of a .m evm-opcodesUse m instead of a .n evm-opcodesUse n instead of a .o evm-opcodesUse o instead of a .p evm-opcodesUse p instead of a .q evm-opcodesUse q instead of ` , etc.r evm-opcodesUse r instead of ` , etc.s evm-opcodesUse s instead of ` , etc.t evm-opcodesUse t instead of ` , etc.u evm-opcodesUse u instead of ` , etc.v evm-opcodesUse v instead of ` , etc.w evm-opcodesUse w instead of ` , etc.x evm-opcodesUse x instead of ` , etc.y evm-opcodesUse y instead of ` , etc.z evm-opcodesUse z instead of `  , etc.{ evm-opcodesUse { instead of `  , etc.| evm-opcodesUse | instead of `  , etc.} evm-opcodesUse } instead of `  , etc.~ evm-opcodesUse ~ instead of `  , etc. evm-opcodesUse  instead of ` , etc.€ evm-opcodesUse € instead of ` , etc. evm-opcodesUse  instead of _ .‚ evm-opcodesUse ‚ instead of _ .ƒ evm-opcodesUse ƒ instead of _ .„ evm-opcodesUse „ instead of _ .… evm-opcodesUse … instead of _ .† evm-opcodesUse † instead of _ .‡ evm-opcodesUse ‡ instead of _ .ˆ evm-opcodesUse ˆ instead of _ .‰ evm-opcodesUse ‰ instead of _ .Š evm-opcodesUse Š instead of _  .‹ evm-opcodesUse ‹ instead of _  .Œ evm-opcodesUse Œ instead of _  . evm-opcodesUse  instead of _  .Ž evm-opcodesUse Ž instead of _  . evm-opcodesUse  instead of _ . evm-opcodesUse  instead of _ .‘ evm-opcodes Provide both ‘ and 8% patterns for backwards-compatibility Note that 8 replaces ‘ because it is more precise.’ evm-opcodes Convert any  a into an  ().“ evm-opcodes Extract the a from a X a or a Y a.” evm-opcodes Extract the a from a ] a.• evm-opcodes Convert an  or an  to a Î.– evm-opcodes Convert a Î to an  or an .— evm-opcodes Given an , produce its .For _, ` and a0 this depends on the specific variant, and for ^5 it depends on the size of the constant being pushed.˜ evm-opcodes#Convert the constant argument of a ^ to the opcode encoding (0x60--0x7f) and its constant split into Î segments.™ kjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/-,)('&%$#"! +.*lmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™kjihgfedcba`_^]\[ZYXWVUTSRQPONMLKJIHGFEDCBA@?>=<;:9876543210/-,)('&%$#"! +.*’“”•– —˜‘ŽŒ‹Š‰ˆ‡†…„ƒ‚€~}|{zyxwvutsrqponml2018-2024 Simon ShineMIT!Simon Shine  Safe-Inferredì&§ evm-opcodesAn §. is a plain, parameterless Ethereum VM Opcode.¨ evm-opcodes¨ is a plain parameterless §.© evm-opcodes© is a plain parameterless §.ª evm-opcodesª is a plain parameterless §.« evm-opcodes!Determine if a byte represents a _ opcode ( -- ).¬ evm-opcodes!Determine if a byte represents a ` opcode (€ -- q).­ evm-opcodes!Determine if a byte represents a a opcode (o -- l).® evm-opcodes!Determine if a byte represents a ^ opcode.¯ evm-opcodesRead a _ opcode ( --  ) safely.° evm-opcodesRead a ` opcode (€ -- q ) safely.± evm-opcodesRead a a opcode (o -- l ) safely.² evm-opcodesRead a ^ opcode safely.³ evm-opcodes Parse an § from a Î . In case of ^Á instructions, read the constant being pushed from a subsequent Ï.Ð evm-opcodesGet a Ñ from a Ï-Pads the ByteString with NULs up to 32 bytes.´ evm-opcodesShow § as Ò.µ evm-opcodes;Calculate the size in bytes of an encoded opcode. The only §" that uses more than one byte is ^+. Sizes are trivially determined for only §È with unlabelled jumps, since we cannot know e.g. where the label of a 1 points to before code generation has completed.¶ evm-opcodes Convert a [§]# to a string of ASCII hexadecimals.· evm-opcodes Convert a [§] to bytecode.¸ evm-opcodes Convert an § to a [Î].To convert many §s to bytecode, use ·.§*.+ !"#$%&'(),-/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijk—¨©ª“”’´µ¶·¸«¬­®¯°±²³ŽŒ‹Š‰ˆ‡†…„ƒ‚€~}|{zyxwvutsrqponml§*.+ !"#$%&'(),-/0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijk—¨©ª“”’´µ¶·¸«¬­®¯°±²³ŽŒ‹Š‰ˆ‡†…„ƒ‚€~}|{zyxwvutsrqponml2018-2024 Simon ShineMIT!Simon Shine  Safe-Inferred*¹ evm-opcodesA ¹! has byte positions annotated at X, Y and ]; on X and Y2 the positions denote where they jump to, and on ]/ they denote the position of the opcode itself.º evm-opcodesThe position of an Opcode.» evm-opcodes Translate a ¹ into an §$ by converting the position into a ^ instruction.¼ evm-opcodes-The size of a jump to some absolute position.º¹»¼º¹»¼2018-2024 Simon ShineMIT!Simon Shine  Safe-InferredÝ,‡½ evm-opcodesAn ½= is a collection of four mapping functions that can map any  a to an  b5. For each of the three opcodes that are annotated, X, Y and ]›, a separate mapping function is specified, and for any other opcode, a general mapping function is specified that falls back to the same opcode of type  b.See   for an example of usage.à evm-opcodes Given an ½ and an  a , produce m ( b).½¾¿ÀÁÂý¾¿ÀÁÂÃ2018-2024 Simon ShineMIT!Simon Shine  Safe-Inferred(2LÄ evm-opcodesTranslation of Ès into ¹1s may fail if a jump is made to a non-occurring ] or a ] occurs twice.È evm-opcodesÈs use É to represent jumps.In particular, X "name", Y "name" and ] "name"."All other opcodes remain the same.É evm-opcodesFor now, all labels are Ò.Ê evm-opcodes+Replace all labels with absolute positions.ËPositions are calculated by fixed-point iteration to account for variable sizes of jumps. Labelled jumps don't have a size defined, the size of a positional jump depends on the address being jumped to.For example, if jumping to the ] on the 256th position in a [È], this requires a PUSH2> instruction which uses an additional byte, which pushes the ] one byte ahead.Ë evm-opcodes Extract a Ó É º that describes where each ]Á is located, taking into account the sizes of all prior opcodes.Ô evm-opcodes Extract a Ó the position of every ].1Do this by keeping track of the current position./This function may not terminate for all inputs!Õ evm-opcodes A single step in the fixpoint function is going over every opcode and checking if its position is already aligned and updating the map of positions otherwise.ÉÈÄÅÆÇÊËÉÈÄÅÆÇÊË  Safe-Inferred2“ÖרÙÚÛÜÝÞ     !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂà ÄÅÅÆÇÈÉÊËËÌÍÎ ÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâã ä å æ ç è é ê ëì(evm-opcodes-0.2.0-8bTx8ASJDAnGMWfot5WuISEVM.Opcode.Internal EVM.OpcodeEVM.Opcode.PositionalEVM.Opcode.TraversalEVM.Opcode.Labelled evm-opcodesOpcodeLabelledOpcode translatePaths_evm_opcodes OpcodeSpecopcodeEncoding opcodeAlpha opcodeDelta opcodeNameOrd16Ord16_1Ord16_2Ord16_3Ord16_4Ord16_5Ord16_6Ord16_7Ord16_8Ord16_9Ord16_10Ord16_11Ord16_12Ord16_13Ord16_14Ord16_15Ord16_16Ord5Ord5_0Ord5_1Ord5_2Ord5_3Ord5_4Opcode'STOPADDMULSUBDIVSDIVMODSMODADDMODMULMODEXP SIGNEXTENDLTGTSLTSGTEQISZEROANDORXORNOTBYTESHLSHRSAR KECCAK256ADDRESSBALANCEORIGINCALLER CALLVALUE CALLDATALOAD CALLDATASIZE CALLDATACOPYCODESIZECODECOPYGASPRICE EXTCODESIZE EXTCODECOPYRETURNDATASIZERETURNDATACOPY EXTCODEHASH BLOCKHASHCOINBASE TIMESTAMPNUMBER PREVRANDAOGASLIMITCHAINID SELFBALANCEBASEFEEPOPMLOADMSTOREMSTORE8SLOADSSTOREJUMPJUMPIPCMSIZEGASJUMPDESTPUSHDUPSWAPLOGCREATECALLCALLCODERETURN DELEGATECALLCREATE2 STATICCALLREVERTINVALID SELFDESTRUCTLOG4LOG3LOG2LOG1LOG0SWAP16SWAP15SWAP14SWAP13SWAP12SWAP11SWAP10SWAP9SWAP8SWAP7SWAP6SWAP5SWAP4SWAP3SWAP2SWAP1DUP16DUP15DUP14DUP13DUP12DUP11DUP10DUP9DUP8DUP7DUP6DUP5DUP4DUP3DUP2DUP1SHA3concrete jumpAnnot jumpdestAnnottoWord8 fromWord8 opcodeSpecpush' $fShowOpcode'$fEqOpcodeSpec$fShowOpcodeSpec $fEqOpcode' $fOrdOpcode'$fFunctorOpcode' $fEqOrd16 $fOrdOrd16 $fEnumOrd16$fBoundedOrd16$fEqOrd5 $fOrdOrd5 $fEnumOrd5 $fBoundedOrd5jumpjumpijumpdestisDUPisSWAPisLOGisPUSHreadDUPreadSWAPreadLOGreadPUSHreadOp opcodeText opcodeSizetoHexpacktoBytesPositionalOpcodePositionjumpSize OpcodeMapper mapOnJump mapOnJumpi mapOnJumpdest mapOnOther mapOpcodeMTranslateErrortranslateErrorMissingJumpdests translateErrorDuplicateJumpdestsLabellabelPositions$fEqTranslateError$fShowTranslateErrorbaseGHC.WordWord8bytestring-0.11.5.2Data.ByteString.Internal.Type ByteStringword256)data-dword-0.3.2.1-FjwCaP6RAst8JYCpcmpp79Data.DoubleWordWord256 text-2.0.2Data.Text.InternalTextcontainers-0.6.7Data.Map.InternalMapfixpointstepversion getBinDir getLibDir getDynLibDir getDataDir getLibexecDirgetDataFileName getSysconfDir