evm-opcodes 0.1.2 → 0.2.0
raw patch · 10 files changed
+46/−31 lines, 10 filesdep ~containersPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: containers
API changes (from Hackage documentation)
- EVM.Opcode: DIFFICULTY :: Opcode' j
- EVM.Opcode: SHA3 :: Opcode' j
- EVM.Opcode.Internal: DIFFICULTY :: Opcode' j
- EVM.Opcode.Internal: SHA3 :: Opcode' j
+ EVM.Opcode: BASEFEE :: Opcode' j
+ EVM.Opcode: KECCAK256 :: Opcode' j
+ EVM.Opcode: PREVRANDAO :: Opcode' j
+ EVM.Opcode.Internal: BASEFEE :: Opcode' j
+ EVM.Opcode.Internal: KECCAK256 :: Opcode' j
+ EVM.Opcode.Internal: PREVRANDAO :: Opcode' j
+ EVM.Opcode.Internal: pattern SHA3 :: forall j. Opcode' j
Files
- LICENSE +1/−1
- README.md +5/−1
- evm-opcodes.cabal +7/−7
- src/EVM/Opcode.hs +5/−4
- src/EVM/Opcode/Internal.hs +15/−7
- src/EVM/Opcode/Labelled.hs +1/−1
- src/EVM/Opcode/Positional.hs +1/−1
- src/EVM/Opcode/Traversal.hs +5/−4
- test/OpcodeGenerators.hs +2/−2
- test/OpcodeTest.hs +4/−3
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2018-2022 Simon Shine+Copyright 2018-2024 Simon Shine Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
README.md view
@@ -1,6 +1,10 @@ # evm-opcodes -[](https://github.com/sshine/evm-opcodes/actions?query=workflow%3A%22Haskell+CI%22)+[](http://opensource.org/licenses/MIT)+[](https://hackage.haskell.org/package/evm-opcodes)+[](http://stackage.org/nightly/package/evm-opcodes)+[](http://stackage.org/lts/package/evm-opcodes)+[](https://github.com/sshine/evm-opcodes/actions/workflows/haskell.yml) This Haskell library provides opcode types for the Ethereum Virtual Machine (EVM).
evm-opcodes.cabal view
@@ -1,19 +1,19 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.36.1. -- -- see: https://github.com/sol/hpack name: evm-opcodes-version: 0.1.2+version: 0.2.0 synopsis: Opcode types for Ethereum Virtual Machine (EVM) description: This library provides opcode types for the Ethereum Virtual Machine. category: Ethereum, Finance, Network homepage: https://github.com/sshine/evm-opcodes bug-reports: https://github.com/sshine/evm-opcodes/issues author: Simon Shine-maintainer: shreddedglory@gmail.com-copyright: 2018-2022 Simon Shine+maintainer: simon@simonshine.dk+copyright: 2018-2024 Simon Shine license: MIT license-file: LICENSE build-type: Simple@@ -40,7 +40,7 @@ base >=4.12 && <5 , bytestring >=0.10 , cereal ==0.5.*- , containers ==0.6.*+ , containers >=0.6 && <0.8 , data-dword ==0.3.* , text >=1.2 default-language: Haskell2010@@ -58,7 +58,7 @@ base >=4.12 && <5 , bytestring >=0.10 , cereal ==0.5.*- , containers ==0.6.*+ , containers >=0.6 && <0.8 , data-dword ==0.3.* , evm-opcodes , hedgehog@@ -81,7 +81,7 @@ base >=4.12 && <5 , bytestring >=0.10 , cereal ==0.5.*- , containers ==0.6.*+ , containers >=0.6 && <0.8 , data-dword ==0.3.* , evm-opcodes , tasty-bench
src/EVM/Opcode.hs view
@@ -2,7 +2,7 @@ -- | -- Module: EVM.Opcode--- Copyright: 2018-2022 Simon Shine+-- Copyright: 2018-2024 Simon Shine -- Maintainer: Simon Shine <simon@simonshine.dk> -- License: MIT --@@ -204,8 +204,8 @@ 0x1c -> pure SHR 0x1d -> pure SAR - -- 20s: SHA3- 0x20 -> pure SHA3+ -- 20s: KECCAK256+ 0x20 -> pure KECCAK256 -- 30s: Environmental Information 0x30 -> pure ADDRESS@@ -230,10 +230,11 @@ 0x41 -> pure COINBASE 0x42 -> pure TIMESTAMP 0x43 -> pure NUMBER- 0x44 -> pure DIFFICULTY+ 0x44 -> pure PREVRANDAO 0x45 -> pure GASLIMIT 0x46 -> pure CHAINID 0x47 -> pure SELFBALANCE+ 0x48 -> pure BASEFEE -- 50s: Stack, Memory, Storage and Flow Operations 0x50 -> pure POP
src/EVM/Opcode/Internal.hs view
@@ -6,7 +6,7 @@ -- | -- Module: EVM.Opcode.Internal--- Copyright: 2018-2022 Simon Shine+-- Copyright: 2018-2024 Simon Shine -- Maintainer: Simon Shine <simon@simonshine.dk> -- License: MIT --@@ -61,8 +61,8 @@ | SHR -- ^ 0x1c, https://eips.ethereum.org/EIPS/eip-145 | SAR -- ^ 0x1d, https://eips.ethereum.org/EIPS/eip-145 - -- 20s: SHA3- | SHA3 -- ^ 0x20+ -- 20s: KECCAK256+ | KECCAK256 -- ^ 0x20, https://eips.ethereum.org/EIPS/eip-1803 -- 30s: Environmental Information | ADDRESS -- ^ 0x30@@ -87,10 +87,11 @@ | COINBASE -- ^ 0x41 | TIMESTAMP -- ^ 0x42 | NUMBER -- ^ 0x43- | DIFFICULTY -- ^ 0x44+ | PREVRANDAO -- ^ 0x44, https://eips.ethereum.org/EIPS/eip-4399 | GASLIMIT -- ^ 0x45 | CHAINID -- ^ 0x46, https://eips.ethereum.org/EIPS/eip-1344 | SELFBALANCE -- ^ 0x47, https://eips.ethereum.org/EIPS/eip-1884+ | BASEFEE -- ^ 0x48, https://eips.ethereum.org/EIPS/eip-3198 -- 50s: Stack, Memory, Storage and Flow Operations | POP -- ^ 0x50@@ -241,9 +242,9 @@ SHR -> OpcodeSpec 0x1c 2 1 "shr" SAR -> OpcodeSpec 0x1d 2 1 "sar" - -- 20s: SHA3+ -- 20s: KECCAK256 -- Hex α δ- SHA3 -> OpcodeSpec 0x20 2 1 "sha3"+ KECCAK256 -> OpcodeSpec 0x20 2 1 "keccak256" -- 30s: Environmental Information -- Opcode Hex α δ@@ -270,10 +271,11 @@ COINBASE -> OpcodeSpec 0x41 0 1 "coinbase" TIMESTAMP -> OpcodeSpec 0x42 0 1 "timestamp" NUMBER -> OpcodeSpec 0x43 0 1 "number"- DIFFICULTY -> OpcodeSpec 0x44 0 1 "difficulty"+ PREVRANDAO -> OpcodeSpec 0x44 0 1 "prevrandao" GASLIMIT -> OpcodeSpec 0x45 0 1 "gaslimit" CHAINID -> OpcodeSpec 0x46 0 1 "chainid" SELFBALANCE -> OpcodeSpec 0x47 0 1 "selfbalance"+ BASEFEE -> OpcodeSpec 0x48 0 1 "basefee" -- 50s: Stack, Memory, Storage and Flow Operations -- Hex α δ@@ -357,6 +359,12 @@ push' i = (opcode + 1, arg <> [fromIntegral i]) where (opcode, arg) = push' (i `shift` (-8))++-- | Provide both 'SHA3' and 'KECCAK256' patterns for backwards-compatibility+-- +-- Note that 'KECCAK256' replaces 'SHA3' because it is more precise.+pattern SHA3 :: forall j. Opcode' j+pattern SHA3 = KECCAK256 -- | Use 'DUP1' instead of @'DUP' 'Ord16_1'@. pattern DUP1 :: forall j. Opcode' j
src/EVM/Opcode/Labelled.hs view
@@ -2,7 +2,7 @@ -- | -- Module: EVM.Opcode.Labelled--- Copyright: 2018-2022 Simon Shine+-- Copyright: 2018-2024 Simon Shine -- Maintainer: Simon Shine <simon@simonshine.dk> -- License: MIT --
src/EVM/Opcode/Positional.hs view
@@ -1,6 +1,6 @@ -- | -- Module: EVM.Opcode.Positional--- Copyright: 2018-2022 Simon Shine+-- Copyright: 2018-2024 Simon Shine -- Maintainer: Simon Shine <simon@simonshine.dk> -- License: MIT --
src/EVM/Opcode/Traversal.hs view
@@ -2,7 +2,7 @@ -- | -- Module: EVM.Opcode.Traversal--- Copyright: 2018-2022 Simon Shine+-- Copyright: 2018-2024 Simon Shine -- Maintainer: Simon Shine <simon@simonshine.dk> -- License: MIT --@@ -67,8 +67,8 @@ SHR -> mapOnOther' SHR SHR SAR -> mapOnOther' SAR SAR - -- 20s: SHA3- SHA3 -> mapOnOther' SHA3 SHA3+ -- 20s: KECCAK256+ KECCAK256 -> mapOnOther' KECCAK256 KECCAK256 -- 30s: Environmental Information ADDRESS -> mapOnOther' ADDRESS ADDRESS@@ -93,10 +93,11 @@ COINBASE -> mapOnOther' COINBASE COINBASE TIMESTAMP -> mapOnOther' TIMESTAMP TIMESTAMP NUMBER -> mapOnOther' NUMBER NUMBER- DIFFICULTY -> mapOnOther' DIFFICULTY DIFFICULTY+ PREVRANDAO -> mapOnOther' PREVRANDAO PREVRANDAO GASLIMIT -> mapOnOther' GASLIMIT GASLIMIT CHAINID -> mapOnOther' CHAINID CHAINID SELFBALANCE -> mapOnOther' SELFBALANCE SELFBALANCE+ BASEFEE -> mapOnOther' BASEFEE BASEFEE -- 50s: Stack, Memory, Storage and Flow Operations POP -> mapOnOther' POP POP
test/OpcodeGenerators.hs view
@@ -82,14 +82,14 @@ opcode1 = [ STOP, ADD, MUL, SUB, DIV, SDIV, MOD, SMOD, ADDMOD, MULMOD, EXP, SIGNEXTEND , LT, GT, SLT, SGT, EQ, ISZERO, AND, OR, XOR, NOT, BYTE, SHL, SHR, SAR- , SHA3+ , KECCAK256 , ADDRESS, BALANCE, ORIGIN , CALLER, CALLVALUE, CALLDATALOAD, CALLDATASIZE, CALLDATACOPY , CODESIZE, CODECOPY , GASPRICE, EXTCODESIZE, EXTCODECOPY, RETURNDATASIZE, RETURNDATACOPY, EXTCODEHASH - , BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, DIFFICULTY, GASLIMIT, CHAINID, SELFBALANCE+ , BLOCKHASH, COINBASE, TIMESTAMP, NUMBER, PREVRANDAO, GASLIMIT, CHAINID, SELFBALANCE, BASEFEE , POP, MLOAD, MSTORE, MSTORE8, SLOAD, SSTORE {- , JUMP, JUMPI -}, PC, MSIZE, GAS {- , JUMPDEST -} {- , PUSH -}
test/OpcodeTest.hs view
@@ -177,8 +177,8 @@ it "shows SHR" $ show' SHR `shouldBe` "SHR" it "shows SAR" $ show' SAR `shouldBe` "SAR" - -- 20s: SHA3- it "shows SHA3" $ show' SHA3 `shouldBe` "SHA3"+ -- 20s: KECCAK256+ it "shows KECCAK256" $ show' KECCAK256 `shouldBe` "KECCAK256" -- 30s: Environmental Information it "shows ADDRESS" $ show' ADDRESS `shouldBe` "ADDRESS"@@ -203,10 +203,11 @@ it "shows COINBASE" $ show' COINBASE `shouldBe` "COINBASE" it "shows TIMESTAMP" $ show' TIMESTAMP `shouldBe` "TIMESTAMP" it "shows NUMBER" $ show' NUMBER `shouldBe` "NUMBER"- it "shows DIFFICULTY" $ show' DIFFICULTY `shouldBe` "DIFFICULTY"+ it "shows PREVRANDAO" $ show' PREVRANDAO `shouldBe` "PREVRANDAO" it "shows GASLIMIT" $ show' GASLIMIT `shouldBe` "GASLIMIT" it "shows CHAINID" $ show' CHAINID `shouldBe` "CHAINID" it "shows SELFBALANCE" $ show' SELFBALANCE `shouldBe` "SELFBALANCE"+ it "shows BASEFEE" $ show' BASEFEE `shouldBe` "BASEFEE" -- 50s: Stack, Memory, Storage and Flow Operations it "shows POP" $ show' POP `shouldBe` "POP"