ethereum-execution 2.18.0rc6.dev2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ethereum/__init__.py +30 -0
- ethereum/assets/blocks/block_1.json +22 -0
- ethereum/assets/blocks/block_1234567.json +22 -0
- ethereum/assets/blocks/block_12964999.json +2720 -0
- ethereum/assets/cache_sizes_2048_epochs.json +329 -0
- ethereum/assets/dataset_sizes_2048_epochs.json +412 -0
- ethereum/assets/mainnet.json +26711 -0
- ethereum/crypto/__init__.py +3 -0
- ethereum/crypto/blake2.py +265 -0
- ethereum/crypto/elliptic_curve.py +170 -0
- ethereum/crypto/hash.py +56 -0
- ethereum/crypto/kzg.py +176 -0
- ethereum/ethash.py +426 -0
- ethereum/exceptions.py +75 -0
- ethereum/fork_criteria.py +205 -0
- ethereum/forks/arrow_glacier/__init__.py +33 -0
- ethereum/forks/arrow_glacier/blocks.py +326 -0
- ethereum/forks/arrow_glacier/bloom.py +87 -0
- ethereum/forks/arrow_glacier/exceptions.py +58 -0
- ethereum/forks/arrow_glacier/fork.py +954 -0
- ethereum/forks/arrow_glacier/fork_types.py +62 -0
- ethereum/forks/arrow_glacier/state.py +644 -0
- ethereum/forks/arrow_glacier/transactions.py +573 -0
- ethereum/forks/arrow_glacier/trie.py +498 -0
- ethereum/forks/arrow_glacier/utils/__init__.py +3 -0
- ethereum/forks/arrow_glacier/utils/address.py +94 -0
- ethereum/forks/arrow_glacier/utils/hexadecimal.py +55 -0
- ethereum/forks/arrow_glacier/utils/message.py +90 -0
- ethereum/forks/arrow_glacier/vm/__init__.py +195 -0
- ethereum/forks/arrow_glacier/vm/exceptions.py +131 -0
- ethereum/forks/arrow_glacier/vm/gas.py +245 -0
- ethereum/forks/arrow_glacier/vm/instructions/__init__.py +353 -0
- ethereum/forks/arrow_glacier/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/arrow_glacier/vm/instructions/bitwise.py +245 -0
- ethereum/forks/arrow_glacier/vm/instructions/block.py +212 -0
- ethereum/forks/arrow_glacier/vm/instructions/comparison.py +177 -0
- ethereum/forks/arrow_glacier/vm/instructions/control_flow.py +171 -0
- ethereum/forks/arrow_glacier/vm/instructions/environment.py +544 -0
- ethereum/forks/arrow_glacier/vm/instructions/keccak.py +63 -0
- ethereum/forks/arrow_glacier/vm/instructions/log.py +88 -0
- ethereum/forks/arrow_glacier/vm/instructions/memory.py +141 -0
- ethereum/forks/arrow_glacier/vm/instructions/stack.py +204 -0
- ethereum/forks/arrow_glacier/vm/instructions/storage.py +126 -0
- ethereum/forks/arrow_glacier/vm/instructions/system.py +694 -0
- ethereum/forks/arrow_glacier/vm/interpreter.py +312 -0
- ethereum/forks/arrow_glacier/vm/memory.py +84 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/arrow_glacier/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/arrow_glacier/vm/runtime.py +69 -0
- ethereum/forks/arrow_glacier/vm/stack.py +58 -0
- ethereum/forks/berlin/__init__.py +43 -0
- ethereum/forks/berlin/blocks.py +297 -0
- ethereum/forks/berlin/bloom.py +87 -0
- ethereum/forks/berlin/exceptions.py +24 -0
- ethereum/forks/berlin/fork.py +839 -0
- ethereum/forks/berlin/fork_types.py +62 -0
- ethereum/forks/berlin/state.py +644 -0
- ethereum/forks/berlin/transactions.py +456 -0
- ethereum/forks/berlin/trie.py +498 -0
- ethereum/forks/berlin/utils/__init__.py +3 -0
- ethereum/forks/berlin/utils/address.py +94 -0
- ethereum/forks/berlin/utils/hexadecimal.py +55 -0
- ethereum/forks/berlin/utils/message.py +90 -0
- ethereum/forks/berlin/vm/__init__.py +194 -0
- ethereum/forks/berlin/vm/exceptions.py +123 -0
- ethereum/forks/berlin/vm/gas.py +246 -0
- ethereum/forks/berlin/vm/instructions/__init__.py +351 -0
- ethereum/forks/berlin/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/berlin/vm/instructions/bitwise.py +245 -0
- ethereum/forks/berlin/vm/instructions/block.py +212 -0
- ethereum/forks/berlin/vm/instructions/comparison.py +177 -0
- ethereum/forks/berlin/vm/instructions/control_flow.py +171 -0
- ethereum/forks/berlin/vm/instructions/environment.py +521 -0
- ethereum/forks/berlin/vm/instructions/keccak.py +63 -0
- ethereum/forks/berlin/vm/instructions/log.py +88 -0
- ethereum/forks/berlin/vm/instructions/memory.py +141 -0
- ethereum/forks/berlin/vm/instructions/stack.py +204 -0
- ethereum/forks/berlin/vm/instructions/storage.py +126 -0
- ethereum/forks/berlin/vm/instructions/system.py +706 -0
- ethereum/forks/berlin/vm/interpreter.py +308 -0
- ethereum/forks/berlin/vm/memory.py +84 -0
- ethereum/forks/berlin/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/berlin/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/berlin/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/berlin/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/berlin/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/berlin/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/berlin/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/berlin/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/berlin/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/berlin/vm/runtime.py +69 -0
- ethereum/forks/berlin/vm/stack.py +58 -0
- ethereum/forks/byzantium/__init__.py +50 -0
- ethereum/forks/byzantium/blocks.py +265 -0
- ethereum/forks/byzantium/bloom.py +87 -0
- ethereum/forks/byzantium/fork.py +816 -0
- ethereum/forks/byzantium/fork_types.py +61 -0
- ethereum/forks/byzantium/state.py +583 -0
- ethereum/forks/byzantium/transactions.py +261 -0
- ethereum/forks/byzantium/trie.py +498 -0
- ethereum/forks/byzantium/utils/__init__.py +3 -0
- ethereum/forks/byzantium/utils/address.py +63 -0
- ethereum/forks/byzantium/utils/hexadecimal.py +55 -0
- ethereum/forks/byzantium/utils/message.py +80 -0
- ethereum/forks/byzantium/vm/__init__.py +186 -0
- ethereum/forks/byzantium/vm/exceptions.py +123 -0
- ethereum/forks/byzantium/vm/gas.py +245 -0
- ethereum/forks/byzantium/vm/instructions/__init__.py +337 -0
- ethereum/forks/byzantium/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/byzantium/vm/instructions/bitwise.py +153 -0
- ethereum/forks/byzantium/vm/instructions/block.py +189 -0
- ethereum/forks/byzantium/vm/instructions/comparison.py +177 -0
- ethereum/forks/byzantium/vm/instructions/control_flow.py +171 -0
- ethereum/forks/byzantium/vm/instructions/environment.py +436 -0
- ethereum/forks/byzantium/vm/instructions/keccak.py +63 -0
- ethereum/forks/byzantium/vm/instructions/log.py +88 -0
- ethereum/forks/byzantium/vm/instructions/memory.py +141 -0
- ethereum/forks/byzantium/vm/instructions/stack.py +204 -0
- ethereum/forks/byzantium/vm/instructions/storage.py +88 -0
- ethereum/forks/byzantium/vm/instructions/system.py +601 -0
- ethereum/forks/byzantium/vm/interpreter.py +299 -0
- ethereum/forks/byzantium/vm/memory.py +84 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/__init__.py +36 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/mapping.py +43 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/modexp.py +168 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/byzantium/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/byzantium/vm/runtime.py +69 -0
- ethereum/forks/byzantium/vm/stack.py +58 -0
- ethereum/forks/cancun/__init__.py +49 -0
- ethereum/forks/cancun/blocks.py +389 -0
- ethereum/forks/cancun/bloom.py +87 -0
- ethereum/forks/cancun/exceptions.py +109 -0
- ethereum/forks/cancun/fork.py +881 -0
- ethereum/forks/cancun/fork_types.py +63 -0
- ethereum/forks/cancun/state.py +667 -0
- ethereum/forks/cancun/transactions.py +721 -0
- ethereum/forks/cancun/trie.py +508 -0
- ethereum/forks/cancun/utils/__init__.py +3 -0
- ethereum/forks/cancun/utils/address.py +94 -0
- ethereum/forks/cancun/utils/hexadecimal.py +55 -0
- ethereum/forks/cancun/utils/message.py +90 -0
- ethereum/forks/cancun/vm/__init__.py +186 -0
- ethereum/forks/cancun/vm/exceptions.py +139 -0
- ethereum/forks/cancun/vm/gas.py +372 -0
- ethereum/forks/cancun/vm/instructions/__init__.py +365 -0
- ethereum/forks/cancun/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/cancun/vm/instructions/bitwise.py +245 -0
- ethereum/forks/cancun/vm/instructions/block.py +261 -0
- ethereum/forks/cancun/vm/instructions/comparison.py +177 -0
- ethereum/forks/cancun/vm/instructions/control_flow.py +171 -0
- ethereum/forks/cancun/vm/instructions/environment.py +600 -0
- ethereum/forks/cancun/vm/instructions/keccak.py +63 -0
- ethereum/forks/cancun/vm/instructions/log.py +88 -0
- ethereum/forks/cancun/vm/instructions/memory.py +177 -0
- ethereum/forks/cancun/vm/instructions/stack.py +208 -0
- ethereum/forks/cancun/vm/instructions/storage.py +188 -0
- ethereum/forks/cancun/vm/instructions/system.py +708 -0
- ethereum/forks/cancun/vm/interpreter.py +302 -0
- ethereum/forks/cancun/vm/memory.py +84 -0
- ethereum/forks/cancun/vm/precompiled_contracts/__init__.py +39 -0
- ethereum/forks/cancun/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/cancun/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/cancun/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/cancun/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/cancun/vm/precompiled_contracts/mapping.py +49 -0
- ethereum/forks/cancun/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/cancun/vm/precompiled_contracts/point_evaluation.py +72 -0
- ethereum/forks/cancun/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/cancun/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/cancun/vm/runtime.py +69 -0
- ethereum/forks/cancun/vm/stack.py +58 -0
- ethereum/forks/constantinople/__init__.py +51 -0
- ethereum/forks/constantinople/blocks.py +265 -0
- ethereum/forks/constantinople/bloom.py +87 -0
- ethereum/forks/constantinople/fork.py +816 -0
- ethereum/forks/constantinople/fork_types.py +62 -0
- ethereum/forks/constantinople/state.py +583 -0
- ethereum/forks/constantinople/transactions.py +261 -0
- ethereum/forks/constantinople/trie.py +498 -0
- ethereum/forks/constantinople/utils/__init__.py +3 -0
- ethereum/forks/constantinople/utils/address.py +93 -0
- ethereum/forks/constantinople/utils/hexadecimal.py +55 -0
- ethereum/forks/constantinople/utils/message.py +80 -0
- ethereum/forks/constantinople/vm/__init__.py +186 -0
- ethereum/forks/constantinople/vm/exceptions.py +123 -0
- ethereum/forks/constantinople/vm/gas.py +246 -0
- ethereum/forks/constantinople/vm/instructions/__init__.py +347 -0
- ethereum/forks/constantinople/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/constantinople/vm/instructions/bitwise.py +245 -0
- ethereum/forks/constantinople/vm/instructions/block.py +189 -0
- ethereum/forks/constantinople/vm/instructions/comparison.py +177 -0
- ethereum/forks/constantinople/vm/instructions/control_flow.py +171 -0
- ethereum/forks/constantinople/vm/instructions/environment.py +470 -0
- ethereum/forks/constantinople/vm/instructions/keccak.py +63 -0
- ethereum/forks/constantinople/vm/instructions/log.py +88 -0
- ethereum/forks/constantinople/vm/instructions/memory.py +141 -0
- ethereum/forks/constantinople/vm/instructions/stack.py +204 -0
- ethereum/forks/constantinople/vm/instructions/storage.py +88 -0
- ethereum/forks/constantinople/vm/instructions/system.py +673 -0
- ethereum/forks/constantinople/vm/interpreter.py +300 -0
- ethereum/forks/constantinople/vm/memory.py +84 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/__init__.py +36 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/mapping.py +43 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/modexp.py +168 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/constantinople/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/constantinople/vm/runtime.py +69 -0
- ethereum/forks/constantinople/vm/stack.py +58 -0
- ethereum/forks/dao_fork/__init__.py +29 -0
- ethereum/forks/dao_fork/blocks.py +265 -0
- ethereum/forks/dao_fork/bloom.py +87 -0
- ethereum/forks/dao_fork/dao.py +357 -0
- ethereum/forks/dao_fork/fork.py +816 -0
- ethereum/forks/dao_fork/fork_types.py +62 -0
- ethereum/forks/dao_fork/state.py +515 -0
- ethereum/forks/dao_fork/transactions.py +227 -0
- ethereum/forks/dao_fork/trie.py +498 -0
- ethereum/forks/dao_fork/utils/__init__.py +3 -0
- ethereum/forks/dao_fork/utils/address.py +62 -0
- ethereum/forks/dao_fork/utils/hexadecimal.py +55 -0
- ethereum/forks/dao_fork/utils/message.py +78 -0
- ethereum/forks/dao_fork/vm/__init__.py +163 -0
- ethereum/forks/dao_fork/vm/exceptions.py +86 -0
- ethereum/forks/dao_fork/vm/gas.py +212 -0
- ethereum/forks/dao_fork/vm/instructions/__init__.py +329 -0
- ethereum/forks/dao_fork/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/dao_fork/vm/instructions/bitwise.py +153 -0
- ethereum/forks/dao_fork/vm/instructions/block.py +189 -0
- ethereum/forks/dao_fork/vm/instructions/comparison.py +177 -0
- ethereum/forks/dao_fork/vm/instructions/control_flow.py +171 -0
- ethereum/forks/dao_fork/vm/instructions/environment.py +376 -0
- ethereum/forks/dao_fork/vm/instructions/keccak.py +63 -0
- ethereum/forks/dao_fork/vm/instructions/log.py +85 -0
- ethereum/forks/dao_fork/vm/instructions/memory.py +141 -0
- ethereum/forks/dao_fork/vm/instructions/stack.py +204 -0
- ethereum/forks/dao_fork/vm/instructions/storage.py +87 -0
- ethereum/forks/dao_fork/vm/instructions/system.py +457 -0
- ethereum/forks/dao_fork/vm/interpreter.py +274 -0
- ethereum/forks/dao_fork/vm/memory.py +84 -0
- ethereum/forks/dao_fork/vm/precompiled_contracts/__init__.py +27 -0
- ethereum/forks/dao_fork/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/dao_fork/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/dao_fork/vm/precompiled_contracts/mapping.py +33 -0
- ethereum/forks/dao_fork/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/dao_fork/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/dao_fork/vm/runtime.py +69 -0
- ethereum/forks/dao_fork/vm/stack.py +58 -0
- ethereum/forks/frontier/__init__.py +7 -0
- ethereum/forks/frontier/blocks.py +265 -0
- ethereum/forks/frontier/bloom.py +87 -0
- ethereum/forks/frontier/fork.py +789 -0
- ethereum/forks/frontier/fork_types.py +62 -0
- ethereum/forks/frontier/state.py +515 -0
- ethereum/forks/frontier/transactions.py +216 -0
- ethereum/forks/frontier/trie.py +499 -0
- ethereum/forks/frontier/utils/__init__.py +3 -0
- ethereum/forks/frontier/utils/address.py +62 -0
- ethereum/forks/frontier/utils/hexadecimal.py +55 -0
- ethereum/forks/frontier/utils/message.py +77 -0
- ethereum/forks/frontier/vm/__init__.py +162 -0
- ethereum/forks/frontier/vm/exceptions.py +86 -0
- ethereum/forks/frontier/vm/gas.py +212 -0
- ethereum/forks/frontier/vm/instructions/__init__.py +327 -0
- ethereum/forks/frontier/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/frontier/vm/instructions/bitwise.py +153 -0
- ethereum/forks/frontier/vm/instructions/block.py +189 -0
- ethereum/forks/frontier/vm/instructions/comparison.py +177 -0
- ethereum/forks/frontier/vm/instructions/control_flow.py +171 -0
- ethereum/forks/frontier/vm/instructions/environment.py +376 -0
- ethereum/forks/frontier/vm/instructions/keccak.py +63 -0
- ethereum/forks/frontier/vm/instructions/log.py +85 -0
- ethereum/forks/frontier/vm/instructions/memory.py +141 -0
- ethereum/forks/frontier/vm/instructions/stack.py +204 -0
- ethereum/forks/frontier/vm/instructions/storage.py +87 -0
- ethereum/forks/frontier/vm/instructions/system.py +403 -0
- ethereum/forks/frontier/vm/interpreter.py +272 -0
- ethereum/forks/frontier/vm/memory.py +84 -0
- ethereum/forks/frontier/vm/precompiled_contracts/__init__.py +27 -0
- ethereum/forks/frontier/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/frontier/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/frontier/vm/precompiled_contracts/mapping.py +33 -0
- ethereum/forks/frontier/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/frontier/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/frontier/vm/runtime.py +69 -0
- ethereum/forks/frontier/vm/stack.py +58 -0
- ethereum/forks/gray_glacier/__init__.py +34 -0
- ethereum/forks/gray_glacier/blocks.py +326 -0
- ethereum/forks/gray_glacier/bloom.py +87 -0
- ethereum/forks/gray_glacier/exceptions.py +58 -0
- ethereum/forks/gray_glacier/fork.py +954 -0
- ethereum/forks/gray_glacier/fork_types.py +62 -0
- ethereum/forks/gray_glacier/state.py +644 -0
- ethereum/forks/gray_glacier/transactions.py +573 -0
- ethereum/forks/gray_glacier/trie.py +498 -0
- ethereum/forks/gray_glacier/utils/__init__.py +3 -0
- ethereum/forks/gray_glacier/utils/address.py +94 -0
- ethereum/forks/gray_glacier/utils/hexadecimal.py +55 -0
- ethereum/forks/gray_glacier/utils/message.py +90 -0
- ethereum/forks/gray_glacier/vm/__init__.py +195 -0
- ethereum/forks/gray_glacier/vm/exceptions.py +131 -0
- ethereum/forks/gray_glacier/vm/gas.py +245 -0
- ethereum/forks/gray_glacier/vm/instructions/__init__.py +353 -0
- ethereum/forks/gray_glacier/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/gray_glacier/vm/instructions/bitwise.py +245 -0
- ethereum/forks/gray_glacier/vm/instructions/block.py +212 -0
- ethereum/forks/gray_glacier/vm/instructions/comparison.py +177 -0
- ethereum/forks/gray_glacier/vm/instructions/control_flow.py +171 -0
- ethereum/forks/gray_glacier/vm/instructions/environment.py +544 -0
- ethereum/forks/gray_glacier/vm/instructions/keccak.py +63 -0
- ethereum/forks/gray_glacier/vm/instructions/log.py +88 -0
- ethereum/forks/gray_glacier/vm/instructions/memory.py +141 -0
- ethereum/forks/gray_glacier/vm/instructions/stack.py +204 -0
- ethereum/forks/gray_glacier/vm/instructions/storage.py +126 -0
- ethereum/forks/gray_glacier/vm/instructions/system.py +694 -0
- ethereum/forks/gray_glacier/vm/interpreter.py +312 -0
- ethereum/forks/gray_glacier/vm/memory.py +84 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/gray_glacier/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/gray_glacier/vm/runtime.py +69 -0
- ethereum/forks/gray_glacier/vm/stack.py +58 -0
- ethereum/forks/homestead/__init__.py +34 -0
- ethereum/forks/homestead/blocks.py +265 -0
- ethereum/forks/homestead/bloom.py +87 -0
- ethereum/forks/homestead/fork.py +798 -0
- ethereum/forks/homestead/fork_types.py +62 -0
- ethereum/forks/homestead/state.py +515 -0
- ethereum/forks/homestead/transactions.py +227 -0
- ethereum/forks/homestead/trie.py +498 -0
- ethereum/forks/homestead/utils/__init__.py +3 -0
- ethereum/forks/homestead/utils/address.py +62 -0
- ethereum/forks/homestead/utils/hexadecimal.py +55 -0
- ethereum/forks/homestead/utils/message.py +78 -0
- ethereum/forks/homestead/vm/__init__.py +163 -0
- ethereum/forks/homestead/vm/exceptions.py +86 -0
- ethereum/forks/homestead/vm/gas.py +212 -0
- ethereum/forks/homestead/vm/instructions/__init__.py +329 -0
- ethereum/forks/homestead/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/homestead/vm/instructions/bitwise.py +153 -0
- ethereum/forks/homestead/vm/instructions/block.py +189 -0
- ethereum/forks/homestead/vm/instructions/comparison.py +177 -0
- ethereum/forks/homestead/vm/instructions/control_flow.py +171 -0
- ethereum/forks/homestead/vm/instructions/environment.py +376 -0
- ethereum/forks/homestead/vm/instructions/keccak.py +63 -0
- ethereum/forks/homestead/vm/instructions/log.py +85 -0
- ethereum/forks/homestead/vm/instructions/memory.py +141 -0
- ethereum/forks/homestead/vm/instructions/stack.py +204 -0
- ethereum/forks/homestead/vm/instructions/storage.py +87 -0
- ethereum/forks/homestead/vm/instructions/system.py +457 -0
- ethereum/forks/homestead/vm/interpreter.py +274 -0
- ethereum/forks/homestead/vm/memory.py +84 -0
- ethereum/forks/homestead/vm/precompiled_contracts/__init__.py +27 -0
- ethereum/forks/homestead/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/homestead/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/homestead/vm/precompiled_contracts/mapping.py +33 -0
- ethereum/forks/homestead/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/homestead/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/homestead/vm/runtime.py +69 -0
- ethereum/forks/homestead/vm/stack.py +58 -0
- ethereum/forks/istanbul/__init__.py +53 -0
- ethereum/forks/istanbul/blocks.py +265 -0
- ethereum/forks/istanbul/bloom.py +87 -0
- ethereum/forks/istanbul/fork.py +816 -0
- ethereum/forks/istanbul/fork_types.py +62 -0
- ethereum/forks/istanbul/state.py +644 -0
- ethereum/forks/istanbul/transactions.py +261 -0
- ethereum/forks/istanbul/trie.py +498 -0
- ethereum/forks/istanbul/utils/__init__.py +3 -0
- ethereum/forks/istanbul/utils/address.py +94 -0
- ethereum/forks/istanbul/utils/hexadecimal.py +55 -0
- ethereum/forks/istanbul/utils/message.py +80 -0
- ethereum/forks/istanbul/vm/__init__.py +186 -0
- ethereum/forks/istanbul/vm/exceptions.py +123 -0
- ethereum/forks/istanbul/vm/gas.py +248 -0
- ethereum/forks/istanbul/vm/instructions/__init__.py +351 -0
- ethereum/forks/istanbul/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/istanbul/vm/instructions/bitwise.py +245 -0
- ethereum/forks/istanbul/vm/instructions/block.py +212 -0
- ethereum/forks/istanbul/vm/instructions/comparison.py +177 -0
- ethereum/forks/istanbul/vm/instructions/control_flow.py +171 -0
- ethereum/forks/istanbul/vm/instructions/environment.py +499 -0
- ethereum/forks/istanbul/vm/instructions/keccak.py +63 -0
- ethereum/forks/istanbul/vm/instructions/log.py +88 -0
- ethereum/forks/istanbul/vm/instructions/memory.py +141 -0
- ethereum/forks/istanbul/vm/instructions/stack.py +204 -0
- ethereum/forks/istanbul/vm/instructions/storage.py +113 -0
- ethereum/forks/istanbul/vm/instructions/system.py +673 -0
- ethereum/forks/istanbul/vm/interpreter.py +306 -0
- ethereum/forks/istanbul/vm/memory.py +84 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/modexp.py +168 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/istanbul/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/istanbul/vm/runtime.py +69 -0
- ethereum/forks/istanbul/vm/stack.py +58 -0
- ethereum/forks/london/__init__.py +48 -0
- ethereum/forks/london/blocks.py +326 -0
- ethereum/forks/london/bloom.py +87 -0
- ethereum/forks/london/exceptions.py +58 -0
- ethereum/forks/london/fork.py +960 -0
- ethereum/forks/london/fork_types.py +62 -0
- ethereum/forks/london/state.py +644 -0
- ethereum/forks/london/transactions.py +573 -0
- ethereum/forks/london/trie.py +498 -0
- ethereum/forks/london/utils/__init__.py +3 -0
- ethereum/forks/london/utils/address.py +94 -0
- ethereum/forks/london/utils/hexadecimal.py +55 -0
- ethereum/forks/london/utils/message.py +90 -0
- ethereum/forks/london/vm/__init__.py +195 -0
- ethereum/forks/london/vm/exceptions.py +131 -0
- ethereum/forks/london/vm/gas.py +245 -0
- ethereum/forks/london/vm/instructions/__init__.py +353 -0
- ethereum/forks/london/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/london/vm/instructions/bitwise.py +245 -0
- ethereum/forks/london/vm/instructions/block.py +212 -0
- ethereum/forks/london/vm/instructions/comparison.py +177 -0
- ethereum/forks/london/vm/instructions/control_flow.py +171 -0
- ethereum/forks/london/vm/instructions/environment.py +544 -0
- ethereum/forks/london/vm/instructions/keccak.py +63 -0
- ethereum/forks/london/vm/instructions/log.py +88 -0
- ethereum/forks/london/vm/instructions/memory.py +141 -0
- ethereum/forks/london/vm/instructions/stack.py +204 -0
- ethereum/forks/london/vm/instructions/storage.py +126 -0
- ethereum/forks/london/vm/instructions/system.py +694 -0
- ethereum/forks/london/vm/interpreter.py +312 -0
- ethereum/forks/london/vm/memory.py +84 -0
- ethereum/forks/london/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/london/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/london/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/london/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/london/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/london/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/london/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/london/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/london/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/london/vm/runtime.py +69 -0
- ethereum/forks/london/vm/stack.py +58 -0
- ethereum/forks/muir_glacier/__init__.py +38 -0
- ethereum/forks/muir_glacier/blocks.py +265 -0
- ethereum/forks/muir_glacier/bloom.py +87 -0
- ethereum/forks/muir_glacier/fork.py +818 -0
- ethereum/forks/muir_glacier/fork_types.py +62 -0
- ethereum/forks/muir_glacier/state.py +644 -0
- ethereum/forks/muir_glacier/transactions.py +261 -0
- ethereum/forks/muir_glacier/trie.py +498 -0
- ethereum/forks/muir_glacier/utils/__init__.py +3 -0
- ethereum/forks/muir_glacier/utils/address.py +94 -0
- ethereum/forks/muir_glacier/utils/hexadecimal.py +55 -0
- ethereum/forks/muir_glacier/utils/message.py +80 -0
- ethereum/forks/muir_glacier/vm/__init__.py +186 -0
- ethereum/forks/muir_glacier/vm/exceptions.py +123 -0
- ethereum/forks/muir_glacier/vm/gas.py +248 -0
- ethereum/forks/muir_glacier/vm/instructions/__init__.py +351 -0
- ethereum/forks/muir_glacier/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/muir_glacier/vm/instructions/bitwise.py +245 -0
- ethereum/forks/muir_glacier/vm/instructions/block.py +212 -0
- ethereum/forks/muir_glacier/vm/instructions/comparison.py +177 -0
- ethereum/forks/muir_glacier/vm/instructions/control_flow.py +171 -0
- ethereum/forks/muir_glacier/vm/instructions/environment.py +499 -0
- ethereum/forks/muir_glacier/vm/instructions/keccak.py +63 -0
- ethereum/forks/muir_glacier/vm/instructions/log.py +88 -0
- ethereum/forks/muir_glacier/vm/instructions/memory.py +141 -0
- ethereum/forks/muir_glacier/vm/instructions/stack.py +204 -0
- ethereum/forks/muir_glacier/vm/instructions/storage.py +113 -0
- ethereum/forks/muir_glacier/vm/instructions/system.py +673 -0
- ethereum/forks/muir_glacier/vm/interpreter.py +306 -0
- ethereum/forks/muir_glacier/vm/memory.py +84 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/modexp.py +168 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/muir_glacier/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/muir_glacier/vm/runtime.py +69 -0
- ethereum/forks/muir_glacier/vm/stack.py +58 -0
- ethereum/forks/osaka/__init__.py +55 -0
- ethereum/forks/osaka/blocks.py +405 -0
- ethereum/forks/osaka/bloom.py +87 -0
- ethereum/forks/osaka/exceptions.py +131 -0
- ethereum/forks/osaka/fork.py +1059 -0
- ethereum/forks/osaka/fork_types.py +78 -0
- ethereum/forks/osaka/requests.py +191 -0
- ethereum/forks/osaka/state.py +667 -0
- ethereum/forks/osaka/transactions.py +887 -0
- ethereum/forks/osaka/trie.py +508 -0
- ethereum/forks/osaka/utils/__init__.py +3 -0
- ethereum/forks/osaka/utils/address.py +94 -0
- ethereum/forks/osaka/utils/hexadecimal.py +55 -0
- ethereum/forks/osaka/utils/message.py +90 -0
- ethereum/forks/osaka/vm/__init__.py +191 -0
- ethereum/forks/osaka/vm/eoa_delegation.py +211 -0
- ethereum/forks/osaka/vm/exceptions.py +139 -0
- ethereum/forks/osaka/vm/gas.py +396 -0
- ethereum/forks/osaka/vm/instructions/__init__.py +367 -0
- ethereum/forks/osaka/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/osaka/vm/instructions/bitwise.py +274 -0
- ethereum/forks/osaka/vm/instructions/block.py +261 -0
- ethereum/forks/osaka/vm/instructions/comparison.py +177 -0
- ethereum/forks/osaka/vm/instructions/control_flow.py +171 -0
- ethereum/forks/osaka/vm/instructions/environment.py +600 -0
- ethereum/forks/osaka/vm/instructions/keccak.py +63 -0
- ethereum/forks/osaka/vm/instructions/log.py +88 -0
- ethereum/forks/osaka/vm/instructions/memory.py +177 -0
- ethereum/forks/osaka/vm/instructions/stack.py +208 -0
- ethereum/forks/osaka/vm/instructions/storage.py +188 -0
- ethereum/forks/osaka/vm/instructions/system.py +751 -0
- ethereum/forks/osaka/vm/interpreter.py +324 -0
- ethereum/forks/osaka/vm/memory.py +83 -0
- ethereum/forks/osaka/vm/precompiled_contracts/__init__.py +55 -0
- ethereum/forks/osaka/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/osaka/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/__init__.py +622 -0
- ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/bls12_381_g1.py +151 -0
- ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/bls12_381_g2.py +153 -0
- ethereum/forks/osaka/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +69 -0
- ethereum/forks/osaka/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/osaka/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/osaka/vm/precompiled_contracts/mapping.py +77 -0
- ethereum/forks/osaka/vm/precompiled_contracts/modexp.py +175 -0
- ethereum/forks/osaka/vm/precompiled_contracts/p256verify.py +89 -0
- ethereum/forks/osaka/vm/precompiled_contracts/point_evaluation.py +72 -0
- ethereum/forks/osaka/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/osaka/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/osaka/vm/runtime.py +69 -0
- ethereum/forks/osaka/vm/stack.py +58 -0
- ethereum/forks/paris/__init__.py +43 -0
- ethereum/forks/paris/blocks.py +312 -0
- ethereum/forks/paris/bloom.py +87 -0
- ethereum/forks/paris/exceptions.py +58 -0
- ethereum/forks/paris/fork.py +651 -0
- ethereum/forks/paris/fork_types.py +62 -0
- ethereum/forks/paris/state.py +571 -0
- ethereum/forks/paris/transactions.py +573 -0
- ethereum/forks/paris/trie.py +498 -0
- ethereum/forks/paris/utils/__init__.py +3 -0
- ethereum/forks/paris/utils/address.py +94 -0
- ethereum/forks/paris/utils/hexadecimal.py +55 -0
- ethereum/forks/paris/utils/message.py +90 -0
- ethereum/forks/paris/vm/__init__.py +174 -0
- ethereum/forks/paris/vm/exceptions.py +131 -0
- ethereum/forks/paris/vm/gas.py +245 -0
- ethereum/forks/paris/vm/instructions/__init__.py +353 -0
- ethereum/forks/paris/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/paris/vm/instructions/bitwise.py +245 -0
- ethereum/forks/paris/vm/instructions/block.py +261 -0
- ethereum/forks/paris/vm/instructions/comparison.py +177 -0
- ethereum/forks/paris/vm/instructions/control_flow.py +171 -0
- ethereum/forks/paris/vm/instructions/environment.py +544 -0
- ethereum/forks/paris/vm/instructions/keccak.py +63 -0
- ethereum/forks/paris/vm/instructions/log.py +88 -0
- ethereum/forks/paris/vm/instructions/memory.py +141 -0
- ethereum/forks/paris/vm/instructions/stack.py +204 -0
- ethereum/forks/paris/vm/instructions/storage.py +126 -0
- ethereum/forks/paris/vm/instructions/system.py +689 -0
- ethereum/forks/paris/vm/interpreter.py +298 -0
- ethereum/forks/paris/vm/memory.py +84 -0
- ethereum/forks/paris/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/paris/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/paris/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/paris/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/paris/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/paris/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/paris/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/paris/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/paris/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/paris/vm/runtime.py +69 -0
- ethereum/forks/paris/vm/stack.py +58 -0
- ethereum/forks/prague/__init__.py +54 -0
- ethereum/forks/prague/blocks.py +405 -0
- ethereum/forks/prague/bloom.py +87 -0
- ethereum/forks/prague/exceptions.py +115 -0
- ethereum/forks/prague/fork.py +1044 -0
- ethereum/forks/prague/fork_types.py +78 -0
- ethereum/forks/prague/requests.py +191 -0
- ethereum/forks/prague/state.py +667 -0
- ethereum/forks/prague/transactions.py +879 -0
- ethereum/forks/prague/trie.py +508 -0
- ethereum/forks/prague/utils/__init__.py +3 -0
- ethereum/forks/prague/utils/address.py +94 -0
- ethereum/forks/prague/utils/hexadecimal.py +55 -0
- ethereum/forks/prague/utils/message.py +90 -0
- ethereum/forks/prague/vm/__init__.py +191 -0
- ethereum/forks/prague/vm/eoa_delegation.py +211 -0
- ethereum/forks/prague/vm/exceptions.py +139 -0
- ethereum/forks/prague/vm/gas.py +379 -0
- ethereum/forks/prague/vm/instructions/__init__.py +365 -0
- ethereum/forks/prague/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/prague/vm/instructions/bitwise.py +245 -0
- ethereum/forks/prague/vm/instructions/block.py +261 -0
- ethereum/forks/prague/vm/instructions/comparison.py +177 -0
- ethereum/forks/prague/vm/instructions/control_flow.py +171 -0
- ethereum/forks/prague/vm/instructions/environment.py +600 -0
- ethereum/forks/prague/vm/instructions/keccak.py +63 -0
- ethereum/forks/prague/vm/instructions/log.py +88 -0
- ethereum/forks/prague/vm/instructions/memory.py +177 -0
- ethereum/forks/prague/vm/instructions/stack.py +208 -0
- ethereum/forks/prague/vm/instructions/storage.py +188 -0
- ethereum/forks/prague/vm/instructions/system.py +751 -0
- ethereum/forks/prague/vm/interpreter.py +324 -0
- ethereum/forks/prague/vm/memory.py +83 -0
- ethereum/forks/prague/vm/precompiled_contracts/__init__.py +53 -0
- ethereum/forks/prague/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/prague/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/prague/vm/precompiled_contracts/bls12_381/__init__.py +622 -0
- ethereum/forks/prague/vm/precompiled_contracts/bls12_381/bls12_381_g1.py +151 -0
- ethereum/forks/prague/vm/precompiled_contracts/bls12_381/bls12_381_g2.py +153 -0
- ethereum/forks/prague/vm/precompiled_contracts/bls12_381/bls12_381_pairing.py +69 -0
- ethereum/forks/prague/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/prague/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/prague/vm/precompiled_contracts/mapping.py +74 -0
- ethereum/forks/prague/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/prague/vm/precompiled_contracts/point_evaluation.py +72 -0
- ethereum/forks/prague/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/prague/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/prague/vm/runtime.py +69 -0
- ethereum/forks/prague/vm/stack.py +58 -0
- ethereum/forks/shanghai/__init__.py +47 -0
- ethereum/forks/shanghai/blocks.py +360 -0
- ethereum/forks/shanghai/bloom.py +87 -0
- ethereum/forks/shanghai/exceptions.py +64 -0
- ethereum/forks/shanghai/fork.py +686 -0
- ethereum/forks/shanghai/fork_types.py +62 -0
- ethereum/forks/shanghai/state.py +571 -0
- ethereum/forks/shanghai/transactions.py +585 -0
- ethereum/forks/shanghai/trie.py +508 -0
- ethereum/forks/shanghai/utils/__init__.py +3 -0
- ethereum/forks/shanghai/utils/address.py +94 -0
- ethereum/forks/shanghai/utils/hexadecimal.py +55 -0
- ethereum/forks/shanghai/utils/message.py +90 -0
- ethereum/forks/shanghai/vm/__init__.py +179 -0
- ethereum/forks/shanghai/vm/exceptions.py +131 -0
- ethereum/forks/shanghai/vm/gas.py +266 -0
- ethereum/forks/shanghai/vm/instructions/__init__.py +355 -0
- ethereum/forks/shanghai/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/shanghai/vm/instructions/bitwise.py +245 -0
- ethereum/forks/shanghai/vm/instructions/block.py +261 -0
- ethereum/forks/shanghai/vm/instructions/comparison.py +177 -0
- ethereum/forks/shanghai/vm/instructions/control_flow.py +171 -0
- ethereum/forks/shanghai/vm/instructions/environment.py +544 -0
- ethereum/forks/shanghai/vm/instructions/keccak.py +63 -0
- ethereum/forks/shanghai/vm/instructions/log.py +88 -0
- ethereum/forks/shanghai/vm/instructions/memory.py +141 -0
- ethereum/forks/shanghai/vm/instructions/stack.py +208 -0
- ethereum/forks/shanghai/vm/instructions/storage.py +126 -0
- ethereum/forks/shanghai/vm/instructions/system.py +709 -0
- ethereum/forks/shanghai/vm/interpreter.py +299 -0
- ethereum/forks/shanghai/vm/memory.py +84 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/__init__.py +37 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/alt_bn128.py +230 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/blake2f.py +42 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/mapping.py +46 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/modexp.py +166 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/shanghai/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/shanghai/vm/runtime.py +69 -0
- ethereum/forks/shanghai/vm/stack.py +58 -0
- ethereum/forks/spurious_dragon/__init__.py +38 -0
- ethereum/forks/spurious_dragon/blocks.py +265 -0
- ethereum/forks/spurious_dragon/bloom.py +87 -0
- ethereum/forks/spurious_dragon/fork.py +807 -0
- ethereum/forks/spurious_dragon/fork_types.py +62 -0
- ethereum/forks/spurious_dragon/state.py +583 -0
- ethereum/forks/spurious_dragon/transactions.py +261 -0
- ethereum/forks/spurious_dragon/trie.py +498 -0
- ethereum/forks/spurious_dragon/utils/__init__.py +3 -0
- ethereum/forks/spurious_dragon/utils/address.py +63 -0
- ethereum/forks/spurious_dragon/utils/hexadecimal.py +55 -0
- ethereum/forks/spurious_dragon/utils/message.py +79 -0
- ethereum/forks/spurious_dragon/vm/__init__.py +184 -0
- ethereum/forks/spurious_dragon/vm/exceptions.py +86 -0
- ethereum/forks/spurious_dragon/vm/gas.py +244 -0
- ethereum/forks/spurious_dragon/vm/instructions/__init__.py +329 -0
- ethereum/forks/spurious_dragon/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/spurious_dragon/vm/instructions/bitwise.py +153 -0
- ethereum/forks/spurious_dragon/vm/instructions/block.py +189 -0
- ethereum/forks/spurious_dragon/vm/instructions/comparison.py +177 -0
- ethereum/forks/spurious_dragon/vm/instructions/control_flow.py +171 -0
- ethereum/forks/spurious_dragon/vm/instructions/environment.py +376 -0
- ethereum/forks/spurious_dragon/vm/instructions/keccak.py +63 -0
- ethereum/forks/spurious_dragon/vm/instructions/log.py +85 -0
- ethereum/forks/spurious_dragon/vm/instructions/memory.py +141 -0
- ethereum/forks/spurious_dragon/vm/instructions/stack.py +204 -0
- ethereum/forks/spurious_dragon/vm/instructions/storage.py +87 -0
- ethereum/forks/spurious_dragon/vm/instructions/system.py +491 -0
- ethereum/forks/spurious_dragon/vm/interpreter.py +292 -0
- ethereum/forks/spurious_dragon/vm/memory.py +84 -0
- ethereum/forks/spurious_dragon/vm/precompiled_contracts/__init__.py +27 -0
- ethereum/forks/spurious_dragon/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/spurious_dragon/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/spurious_dragon/vm/precompiled_contracts/mapping.py +33 -0
- ethereum/forks/spurious_dragon/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/spurious_dragon/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/spurious_dragon/vm/runtime.py +69 -0
- ethereum/forks/spurious_dragon/vm/stack.py +58 -0
- ethereum/forks/tangerine_whistle/__init__.py +32 -0
- ethereum/forks/tangerine_whistle/blocks.py +265 -0
- ethereum/forks/tangerine_whistle/bloom.py +87 -0
- ethereum/forks/tangerine_whistle/fork.py +798 -0
- ethereum/forks/tangerine_whistle/fork_types.py +62 -0
- ethereum/forks/tangerine_whistle/state.py +515 -0
- ethereum/forks/tangerine_whistle/transactions.py +227 -0
- ethereum/forks/tangerine_whistle/trie.py +498 -0
- ethereum/forks/tangerine_whistle/utils/__init__.py +3 -0
- ethereum/forks/tangerine_whistle/utils/address.py +63 -0
- ethereum/forks/tangerine_whistle/utils/hexadecimal.py +55 -0
- ethereum/forks/tangerine_whistle/utils/message.py +79 -0
- ethereum/forks/tangerine_whistle/vm/__init__.py +163 -0
- ethereum/forks/tangerine_whistle/vm/exceptions.py +86 -0
- ethereum/forks/tangerine_whistle/vm/gas.py +244 -0
- ethereum/forks/tangerine_whistle/vm/instructions/__init__.py +329 -0
- ethereum/forks/tangerine_whistle/vm/instructions/arithmetic.py +373 -0
- ethereum/forks/tangerine_whistle/vm/instructions/bitwise.py +153 -0
- ethereum/forks/tangerine_whistle/vm/instructions/block.py +189 -0
- ethereum/forks/tangerine_whistle/vm/instructions/comparison.py +177 -0
- ethereum/forks/tangerine_whistle/vm/instructions/control_flow.py +171 -0
- ethereum/forks/tangerine_whistle/vm/instructions/environment.py +376 -0
- ethereum/forks/tangerine_whistle/vm/instructions/keccak.py +63 -0
- ethereum/forks/tangerine_whistle/vm/instructions/log.py +85 -0
- ethereum/forks/tangerine_whistle/vm/instructions/memory.py +141 -0
- ethereum/forks/tangerine_whistle/vm/instructions/stack.py +204 -0
- ethereum/forks/tangerine_whistle/vm/instructions/storage.py +87 -0
- ethereum/forks/tangerine_whistle/vm/instructions/system.py +480 -0
- ethereum/forks/tangerine_whistle/vm/interpreter.py +274 -0
- ethereum/forks/tangerine_whistle/vm/memory.py +84 -0
- ethereum/forks/tangerine_whistle/vm/precompiled_contracts/__init__.py +27 -0
- ethereum/forks/tangerine_whistle/vm/precompiled_contracts/ecrecover.py +64 -0
- ethereum/forks/tangerine_whistle/vm/precompiled_contracts/identity.py +39 -0
- ethereum/forks/tangerine_whistle/vm/precompiled_contracts/mapping.py +33 -0
- ethereum/forks/tangerine_whistle/vm/precompiled_contracts/ripemd160.py +44 -0
- ethereum/forks/tangerine_whistle/vm/precompiled_contracts/sha256.py +41 -0
- ethereum/forks/tangerine_whistle/vm/runtime.py +69 -0
- ethereum/forks/tangerine_whistle/vm/stack.py +58 -0
- ethereum/genesis.py +279 -0
- ethereum/py.typed +0 -0
- ethereum/trace.py +252 -0
- ethereum/utils/__init__.py +18 -0
- ethereum/utils/byte.py +59 -0
- ethereum/utils/hexadecimal.py +221 -0
- ethereum/utils/numeric.py +208 -0
- ethereum_execution-2.18.0rc6.dev2.dist-info/METADATA +113 -0
- ethereum_execution-2.18.0rc6.dev2.dist-info/RECORD +816 -0
- ethereum_execution-2.18.0rc6.dev2.dist-info/WHEEL +5 -0
- ethereum_execution-2.18.0rc6.dev2.dist-info/entry_points.txt +17 -0
- ethereum_execution-2.18.0rc6.dev2.dist-info/licenses/LICENSE.md +35 -0
- ethereum_execution-2.18.0rc6.dev2.dist-info/top_level.txt +3 -0
- ethereum_optimized/__init__.py +78 -0
- ethereum_optimized/fork.py +72 -0
- ethereum_optimized/state_db.py +444 -0
- ethereum_optimized/utils.py +26 -0
- ethereum_spec_tools/__init__.py +6 -0
- ethereum_spec_tools/docc.py +1135 -0
- ethereum_spec_tools/evm_tools/__init__.py +119 -0
- ethereum_spec_tools/evm_tools/__main__.py +7 -0
- ethereum_spec_tools/evm_tools/b11r/__init__.py +143 -0
- ethereum_spec_tools/evm_tools/b11r/b11r_types.py +173 -0
- ethereum_spec_tools/evm_tools/daemon.py +202 -0
- ethereum_spec_tools/evm_tools/loaders/__init__.py +3 -0
- ethereum_spec_tools/evm_tools/loaders/fixture_loader.py +190 -0
- ethereum_spec_tools/evm_tools/loaders/fork_loader.py +320 -0
- ethereum_spec_tools/evm_tools/loaders/transaction_loader.py +208 -0
- ethereum_spec_tools/evm_tools/statetest/__init__.py +291 -0
- ethereum_spec_tools/evm_tools/t8n/__init__.py +402 -0
- ethereum_spec_tools/evm_tools/t8n/env.py +320 -0
- ethereum_spec_tools/evm_tools/t8n/evm_trace/__init__.py +5 -0
- ethereum_spec_tools/evm_tools/t8n/evm_trace/count.py +47 -0
- ethereum_spec_tools/evm_tools/t8n/evm_trace/eip3155.py +333 -0
- ethereum_spec_tools/evm_tools/t8n/evm_trace/group.py +39 -0
- ethereum_spec_tools/evm_tools/t8n/evm_trace/protocols.py +54 -0
- ethereum_spec_tools/evm_tools/t8n/t8n_types.py +393 -0
- ethereum_spec_tools/evm_tools/utils.py +187 -0
- ethereum_spec_tools/forks.py +302 -0
- ethereum_spec_tools/lint/__init__.py +195 -0
- ethereum_spec_tools/lint/__main__.py +11 -0
- ethereum_spec_tools/lint/lints/glacier_forks_hygiene.py +273 -0
- ethereum_spec_tools/lint/lints/import_hygiene.py +145 -0
- ethereum_spec_tools/lint/lints/patch_hygiene.py +161 -0
- ethereum_spec_tools/new_fork/__init__.py +4 -0
- ethereum_spec_tools/new_fork/builder.py +430 -0
- ethereum_spec_tools/new_fork/cli.py +216 -0
- ethereum_spec_tools/new_fork/codemod/__init__.py +3 -0
- ethereum_spec_tools/new_fork/codemod/comment.py +79 -0
- ethereum_spec_tools/new_fork/codemod/constant.py +141 -0
- ethereum_spec_tools/new_fork/codemod/string.py +79 -0
- ethereum_spec_tools/patch_tool.py +78 -0
- ethereum_spec_tools/py.typed +0 -0
- ethereum_spec_tools/sync.py +1016 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Ethereum Virtual Machine (EVM) Blake2 PRECOMPILED CONTRACT.
|
|
3
|
+
|
|
4
|
+
.. contents:: Table of Contents
|
|
5
|
+
:backlinks: none
|
|
6
|
+
:local:
|
|
7
|
+
|
|
8
|
+
Introduction
|
|
9
|
+
------------
|
|
10
|
+
|
|
11
|
+
Implementation of the `Blake2` precompiled contract.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from ethereum.crypto.blake2 import Blake2b
|
|
15
|
+
|
|
16
|
+
from ...vm import Evm
|
|
17
|
+
from ...vm.gas import GAS_BLAKE2_PER_ROUND, charge_gas
|
|
18
|
+
from ..exceptions import InvalidParameter
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def blake2f(evm: Evm) -> None:
|
|
22
|
+
"""
|
|
23
|
+
Writes the Blake2 hash to output.
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
evm :
|
|
28
|
+
The current EVM frame.
|
|
29
|
+
|
|
30
|
+
"""
|
|
31
|
+
data = evm.message.data
|
|
32
|
+
if len(data) != 213:
|
|
33
|
+
raise InvalidParameter
|
|
34
|
+
|
|
35
|
+
blake2b = Blake2b()
|
|
36
|
+
rounds, h, m, t_0, t_1, f = blake2b.get_blake2_parameters(data)
|
|
37
|
+
|
|
38
|
+
charge_gas(evm, GAS_BLAKE2_PER_ROUND * rounds)
|
|
39
|
+
if f not in [0, 1]:
|
|
40
|
+
raise InvalidParameter
|
|
41
|
+
|
|
42
|
+
evm.output = blake2b.compress(rounds, h, m, t_0, t_1, f)
|
|
@@ -0,0 +1,622 @@
|
|
|
1
|
+
"""
|
|
2
|
+
BLS12 381 Precompile.
|
|
3
|
+
|
|
4
|
+
.. contents:: Table of Contents
|
|
5
|
+
:backlinks: none
|
|
6
|
+
:local:
|
|
7
|
+
|
|
8
|
+
Introduction
|
|
9
|
+
------------
|
|
10
|
+
|
|
11
|
+
Precompile for BLS12-381 curve operations.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from functools import lru_cache
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
|
|
17
|
+
from ethereum_types.bytes import Bytes
|
|
18
|
+
from ethereum_types.numeric import U256, Uint
|
|
19
|
+
from py_ecc.optimized_bls12_381.optimized_curve import (
|
|
20
|
+
FQ,
|
|
21
|
+
FQ2,
|
|
22
|
+
b,
|
|
23
|
+
b2,
|
|
24
|
+
curve_order,
|
|
25
|
+
is_inf,
|
|
26
|
+
is_on_curve,
|
|
27
|
+
normalize,
|
|
28
|
+
)
|
|
29
|
+
from py_ecc.optimized_bls12_381.optimized_curve import (
|
|
30
|
+
multiply as bls12_multiply,
|
|
31
|
+
)
|
|
32
|
+
from py_ecc.typing import Optimized_Point3D as Point3D
|
|
33
|
+
|
|
34
|
+
from ....vm.memory import buffer_read
|
|
35
|
+
from ...exceptions import InvalidParameter
|
|
36
|
+
|
|
37
|
+
G1_K_DISCOUNT = [
|
|
38
|
+
1000,
|
|
39
|
+
949,
|
|
40
|
+
848,
|
|
41
|
+
797,
|
|
42
|
+
764,
|
|
43
|
+
750,
|
|
44
|
+
738,
|
|
45
|
+
728,
|
|
46
|
+
719,
|
|
47
|
+
712,
|
|
48
|
+
705,
|
|
49
|
+
698,
|
|
50
|
+
692,
|
|
51
|
+
687,
|
|
52
|
+
682,
|
|
53
|
+
677,
|
|
54
|
+
673,
|
|
55
|
+
669,
|
|
56
|
+
665,
|
|
57
|
+
661,
|
|
58
|
+
658,
|
|
59
|
+
654,
|
|
60
|
+
651,
|
|
61
|
+
648,
|
|
62
|
+
645,
|
|
63
|
+
642,
|
|
64
|
+
640,
|
|
65
|
+
637,
|
|
66
|
+
635,
|
|
67
|
+
632,
|
|
68
|
+
630,
|
|
69
|
+
627,
|
|
70
|
+
625,
|
|
71
|
+
623,
|
|
72
|
+
621,
|
|
73
|
+
619,
|
|
74
|
+
617,
|
|
75
|
+
615,
|
|
76
|
+
613,
|
|
77
|
+
611,
|
|
78
|
+
609,
|
|
79
|
+
608,
|
|
80
|
+
606,
|
|
81
|
+
604,
|
|
82
|
+
603,
|
|
83
|
+
601,
|
|
84
|
+
599,
|
|
85
|
+
598,
|
|
86
|
+
596,
|
|
87
|
+
595,
|
|
88
|
+
593,
|
|
89
|
+
592,
|
|
90
|
+
591,
|
|
91
|
+
589,
|
|
92
|
+
588,
|
|
93
|
+
586,
|
|
94
|
+
585,
|
|
95
|
+
584,
|
|
96
|
+
582,
|
|
97
|
+
581,
|
|
98
|
+
580,
|
|
99
|
+
579,
|
|
100
|
+
577,
|
|
101
|
+
576,
|
|
102
|
+
575,
|
|
103
|
+
574,
|
|
104
|
+
573,
|
|
105
|
+
572,
|
|
106
|
+
570,
|
|
107
|
+
569,
|
|
108
|
+
568,
|
|
109
|
+
567,
|
|
110
|
+
566,
|
|
111
|
+
565,
|
|
112
|
+
564,
|
|
113
|
+
563,
|
|
114
|
+
562,
|
|
115
|
+
561,
|
|
116
|
+
560,
|
|
117
|
+
559,
|
|
118
|
+
558,
|
|
119
|
+
557,
|
|
120
|
+
556,
|
|
121
|
+
555,
|
|
122
|
+
554,
|
|
123
|
+
553,
|
|
124
|
+
552,
|
|
125
|
+
551,
|
|
126
|
+
550,
|
|
127
|
+
549,
|
|
128
|
+
548,
|
|
129
|
+
547,
|
|
130
|
+
547,
|
|
131
|
+
546,
|
|
132
|
+
545,
|
|
133
|
+
544,
|
|
134
|
+
543,
|
|
135
|
+
542,
|
|
136
|
+
541,
|
|
137
|
+
540,
|
|
138
|
+
540,
|
|
139
|
+
539,
|
|
140
|
+
538,
|
|
141
|
+
537,
|
|
142
|
+
536,
|
|
143
|
+
536,
|
|
144
|
+
535,
|
|
145
|
+
534,
|
|
146
|
+
533,
|
|
147
|
+
532,
|
|
148
|
+
532,
|
|
149
|
+
531,
|
|
150
|
+
530,
|
|
151
|
+
529,
|
|
152
|
+
528,
|
|
153
|
+
528,
|
|
154
|
+
527,
|
|
155
|
+
526,
|
|
156
|
+
525,
|
|
157
|
+
525,
|
|
158
|
+
524,
|
|
159
|
+
523,
|
|
160
|
+
522,
|
|
161
|
+
522,
|
|
162
|
+
521,
|
|
163
|
+
520,
|
|
164
|
+
520,
|
|
165
|
+
519,
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
G2_K_DISCOUNT = [
|
|
169
|
+
1000,
|
|
170
|
+
1000,
|
|
171
|
+
923,
|
|
172
|
+
884,
|
|
173
|
+
855,
|
|
174
|
+
832,
|
|
175
|
+
812,
|
|
176
|
+
796,
|
|
177
|
+
782,
|
|
178
|
+
770,
|
|
179
|
+
759,
|
|
180
|
+
749,
|
|
181
|
+
740,
|
|
182
|
+
732,
|
|
183
|
+
724,
|
|
184
|
+
717,
|
|
185
|
+
711,
|
|
186
|
+
704,
|
|
187
|
+
699,
|
|
188
|
+
693,
|
|
189
|
+
688,
|
|
190
|
+
683,
|
|
191
|
+
679,
|
|
192
|
+
674,
|
|
193
|
+
670,
|
|
194
|
+
666,
|
|
195
|
+
663,
|
|
196
|
+
659,
|
|
197
|
+
655,
|
|
198
|
+
652,
|
|
199
|
+
649,
|
|
200
|
+
646,
|
|
201
|
+
643,
|
|
202
|
+
640,
|
|
203
|
+
637,
|
|
204
|
+
634,
|
|
205
|
+
632,
|
|
206
|
+
629,
|
|
207
|
+
627,
|
|
208
|
+
624,
|
|
209
|
+
622,
|
|
210
|
+
620,
|
|
211
|
+
618,
|
|
212
|
+
615,
|
|
213
|
+
613,
|
|
214
|
+
611,
|
|
215
|
+
609,
|
|
216
|
+
607,
|
|
217
|
+
606,
|
|
218
|
+
604,
|
|
219
|
+
602,
|
|
220
|
+
600,
|
|
221
|
+
598,
|
|
222
|
+
597,
|
|
223
|
+
595,
|
|
224
|
+
593,
|
|
225
|
+
592,
|
|
226
|
+
590,
|
|
227
|
+
589,
|
|
228
|
+
587,
|
|
229
|
+
586,
|
|
230
|
+
584,
|
|
231
|
+
583,
|
|
232
|
+
582,
|
|
233
|
+
580,
|
|
234
|
+
579,
|
|
235
|
+
578,
|
|
236
|
+
576,
|
|
237
|
+
575,
|
|
238
|
+
574,
|
|
239
|
+
573,
|
|
240
|
+
571,
|
|
241
|
+
570,
|
|
242
|
+
569,
|
|
243
|
+
568,
|
|
244
|
+
567,
|
|
245
|
+
566,
|
|
246
|
+
565,
|
|
247
|
+
563,
|
|
248
|
+
562,
|
|
249
|
+
561,
|
|
250
|
+
560,
|
|
251
|
+
559,
|
|
252
|
+
558,
|
|
253
|
+
557,
|
|
254
|
+
556,
|
|
255
|
+
555,
|
|
256
|
+
554,
|
|
257
|
+
553,
|
|
258
|
+
552,
|
|
259
|
+
552,
|
|
260
|
+
551,
|
|
261
|
+
550,
|
|
262
|
+
549,
|
|
263
|
+
548,
|
|
264
|
+
547,
|
|
265
|
+
546,
|
|
266
|
+
545,
|
|
267
|
+
545,
|
|
268
|
+
544,
|
|
269
|
+
543,
|
|
270
|
+
542,
|
|
271
|
+
541,
|
|
272
|
+
541,
|
|
273
|
+
540,
|
|
274
|
+
539,
|
|
275
|
+
538,
|
|
276
|
+
537,
|
|
277
|
+
537,
|
|
278
|
+
536,
|
|
279
|
+
535,
|
|
280
|
+
535,
|
|
281
|
+
534,
|
|
282
|
+
533,
|
|
283
|
+
532,
|
|
284
|
+
532,
|
|
285
|
+
531,
|
|
286
|
+
530,
|
|
287
|
+
530,
|
|
288
|
+
529,
|
|
289
|
+
528,
|
|
290
|
+
528,
|
|
291
|
+
527,
|
|
292
|
+
526,
|
|
293
|
+
526,
|
|
294
|
+
525,
|
|
295
|
+
524,
|
|
296
|
+
524,
|
|
297
|
+
]
|
|
298
|
+
|
|
299
|
+
G1_MAX_DISCOUNT = 519
|
|
300
|
+
G2_MAX_DISCOUNT = 524
|
|
301
|
+
MULTIPLIER = Uint(1000)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
# Note: Caching as a way to optimize client performance can create a DoS
|
|
305
|
+
# attack vector for worst-case inputs that trigger only cache misses. This
|
|
306
|
+
# should not be relied upon for client performance optimization in
|
|
307
|
+
# production systems.
|
|
308
|
+
@lru_cache(maxsize=128)
|
|
309
|
+
def _bytes_to_g1_cached(
|
|
310
|
+
data: bytes,
|
|
311
|
+
subgroup_check: bool = False,
|
|
312
|
+
) -> Point3D[FQ]:
|
|
313
|
+
"""
|
|
314
|
+
Internal cached version of `bytes_to_g1` that works with hashable `bytes`.
|
|
315
|
+
"""
|
|
316
|
+
if len(data) != 128:
|
|
317
|
+
raise InvalidParameter("Input should be 128 bytes long")
|
|
318
|
+
|
|
319
|
+
x = bytes_to_fq(data[:64])
|
|
320
|
+
y = bytes_to_fq(data[64:])
|
|
321
|
+
|
|
322
|
+
if x >= FQ.field_modulus:
|
|
323
|
+
raise InvalidParameter("x >= field modulus")
|
|
324
|
+
if y >= FQ.field_modulus:
|
|
325
|
+
raise InvalidParameter("y >= field modulus")
|
|
326
|
+
|
|
327
|
+
z = 1
|
|
328
|
+
if x == 0 and y == 0:
|
|
329
|
+
z = 0
|
|
330
|
+
point = FQ(x), FQ(y), FQ(z)
|
|
331
|
+
|
|
332
|
+
if not is_on_curve(point, b):
|
|
333
|
+
raise InvalidParameter("G1 point is not on curve")
|
|
334
|
+
|
|
335
|
+
if subgroup_check and not is_inf(bls12_multiply(point, curve_order)):
|
|
336
|
+
raise InvalidParameter("Subgroup check failed for G1 point.")
|
|
337
|
+
|
|
338
|
+
return point
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
def bytes_to_g1(
|
|
342
|
+
data: Bytes,
|
|
343
|
+
subgroup_check: bool = False,
|
|
344
|
+
) -> Point3D[FQ]:
|
|
345
|
+
"""
|
|
346
|
+
Decode 128 bytes to a G1 point with or without subgroup check.
|
|
347
|
+
|
|
348
|
+
Parameters
|
|
349
|
+
----------
|
|
350
|
+
data :
|
|
351
|
+
The bytes data to decode.
|
|
352
|
+
subgroup_check : bool
|
|
353
|
+
Whether to perform a subgroup check on the G1 point.
|
|
354
|
+
|
|
355
|
+
Returns
|
|
356
|
+
-------
|
|
357
|
+
point : Point3D[FQ]
|
|
358
|
+
The G1 point.
|
|
359
|
+
|
|
360
|
+
Raises
|
|
361
|
+
------
|
|
362
|
+
InvalidParameter
|
|
363
|
+
If a field element is invalid, the point is not on the curve, or the
|
|
364
|
+
subgroup check fails.
|
|
365
|
+
|
|
366
|
+
"""
|
|
367
|
+
# This is needed bc when we slice `Bytes` we get a `bytearray`,
|
|
368
|
+
# which is not hashable
|
|
369
|
+
return _bytes_to_g1_cached(bytes(data), subgroup_check)
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
def g1_to_bytes(
|
|
373
|
+
g1_point: Point3D[FQ],
|
|
374
|
+
) -> Bytes:
|
|
375
|
+
"""
|
|
376
|
+
Encode a G1 point to 128 bytes.
|
|
377
|
+
|
|
378
|
+
Parameters
|
|
379
|
+
----------
|
|
380
|
+
g1_point :
|
|
381
|
+
The G1 point to encode.
|
|
382
|
+
|
|
383
|
+
Returns
|
|
384
|
+
-------
|
|
385
|
+
data : Bytes
|
|
386
|
+
The encoded data.
|
|
387
|
+
|
|
388
|
+
"""
|
|
389
|
+
g1_normalized = normalize(g1_point)
|
|
390
|
+
x, y = g1_normalized
|
|
391
|
+
return int(x).to_bytes(64, "big") + int(y).to_bytes(64, "big")
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
def decode_g1_scalar_pair(
|
|
395
|
+
data: Bytes,
|
|
396
|
+
) -> Tuple[Point3D[FQ], int]:
|
|
397
|
+
"""
|
|
398
|
+
Decode 160 bytes to a G1 point and a scalar.
|
|
399
|
+
|
|
400
|
+
Parameters
|
|
401
|
+
----------
|
|
402
|
+
data :
|
|
403
|
+
The bytes data to decode.
|
|
404
|
+
|
|
405
|
+
Returns
|
|
406
|
+
-------
|
|
407
|
+
point : Tuple[Point3D[FQ], int]
|
|
408
|
+
The G1 point and the scalar.
|
|
409
|
+
|
|
410
|
+
Raises
|
|
411
|
+
------
|
|
412
|
+
InvalidParameter
|
|
413
|
+
If the subgroup check failed.
|
|
414
|
+
|
|
415
|
+
"""
|
|
416
|
+
if len(data) != 160:
|
|
417
|
+
InvalidParameter("Input should be 160 bytes long")
|
|
418
|
+
|
|
419
|
+
point = bytes_to_g1(data[:128], subgroup_check=True)
|
|
420
|
+
|
|
421
|
+
m = int.from_bytes(buffer_read(data, U256(128), U256(32)), "big")
|
|
422
|
+
|
|
423
|
+
return point, m
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def bytes_to_fq(data: Bytes) -> FQ:
|
|
427
|
+
"""
|
|
428
|
+
Decode 64 bytes to a FQ element.
|
|
429
|
+
|
|
430
|
+
Parameters
|
|
431
|
+
----------
|
|
432
|
+
data :
|
|
433
|
+
The bytes data to decode.
|
|
434
|
+
|
|
435
|
+
Returns
|
|
436
|
+
-------
|
|
437
|
+
fq : FQ
|
|
438
|
+
The FQ element.
|
|
439
|
+
|
|
440
|
+
Raises
|
|
441
|
+
------
|
|
442
|
+
InvalidParameter
|
|
443
|
+
If the field element is invalid.
|
|
444
|
+
|
|
445
|
+
"""
|
|
446
|
+
if len(data) != 64:
|
|
447
|
+
raise InvalidParameter("FQ should be 64 bytes long")
|
|
448
|
+
|
|
449
|
+
c = int.from_bytes(data[:64], "big")
|
|
450
|
+
|
|
451
|
+
if c >= FQ.field_modulus:
|
|
452
|
+
raise InvalidParameter("Invalid field element")
|
|
453
|
+
|
|
454
|
+
return FQ(c)
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
def bytes_to_fq2(data: Bytes) -> FQ2:
|
|
458
|
+
"""
|
|
459
|
+
Decode 128 bytes to an FQ2 element.
|
|
460
|
+
|
|
461
|
+
Parameters
|
|
462
|
+
----------
|
|
463
|
+
data :
|
|
464
|
+
The bytes data to decode.
|
|
465
|
+
|
|
466
|
+
Returns
|
|
467
|
+
-------
|
|
468
|
+
fq2 : FQ2
|
|
469
|
+
The FQ2 element.
|
|
470
|
+
|
|
471
|
+
Raises
|
|
472
|
+
------
|
|
473
|
+
InvalidParameter
|
|
474
|
+
If the field element is invalid.
|
|
475
|
+
|
|
476
|
+
"""
|
|
477
|
+
if len(data) != 128:
|
|
478
|
+
raise InvalidParameter("FQ2 input should be 128 bytes long")
|
|
479
|
+
c_0 = int.from_bytes(data[:64], "big")
|
|
480
|
+
c_1 = int.from_bytes(data[64:], "big")
|
|
481
|
+
|
|
482
|
+
if c_0 >= FQ.field_modulus:
|
|
483
|
+
raise InvalidParameter("Invalid field element")
|
|
484
|
+
if c_1 >= FQ.field_modulus:
|
|
485
|
+
raise InvalidParameter("Invalid field element")
|
|
486
|
+
|
|
487
|
+
return FQ2((c_0, c_1))
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
# Note: Caching as a way to optimize client performance can create a DoS
|
|
491
|
+
# attack vector for worst-case inputs that trigger only cache misses. This
|
|
492
|
+
# should not be relied upon for client performance optimization in
|
|
493
|
+
# production systems.
|
|
494
|
+
@lru_cache(maxsize=128)
|
|
495
|
+
def _bytes_to_g2_cached(
|
|
496
|
+
data: bytes,
|
|
497
|
+
subgroup_check: bool = False,
|
|
498
|
+
) -> Point3D[FQ2]:
|
|
499
|
+
"""
|
|
500
|
+
Internal cached version of `bytes_to_g2` that works with hashable `bytes`.
|
|
501
|
+
"""
|
|
502
|
+
if len(data) != 256:
|
|
503
|
+
raise InvalidParameter("G2 should be 256 bytes long")
|
|
504
|
+
|
|
505
|
+
x = bytes_to_fq2(data[:128])
|
|
506
|
+
y = bytes_to_fq2(data[128:])
|
|
507
|
+
|
|
508
|
+
z = (1, 0)
|
|
509
|
+
if x == FQ2((0, 0)) and y == FQ2((0, 0)):
|
|
510
|
+
z = (0, 0)
|
|
511
|
+
|
|
512
|
+
point = x, y, FQ2(z)
|
|
513
|
+
|
|
514
|
+
if not is_on_curve(point, b2):
|
|
515
|
+
raise InvalidParameter("Point is not on curve")
|
|
516
|
+
|
|
517
|
+
if subgroup_check and not is_inf(bls12_multiply(point, curve_order)):
|
|
518
|
+
raise InvalidParameter("Subgroup check failed for G2 point.")
|
|
519
|
+
|
|
520
|
+
return point
|
|
521
|
+
|
|
522
|
+
|
|
523
|
+
def bytes_to_g2(
|
|
524
|
+
data: Bytes,
|
|
525
|
+
subgroup_check: bool = False,
|
|
526
|
+
) -> Point3D[FQ2]:
|
|
527
|
+
"""
|
|
528
|
+
Decode 256 bytes to a G2 point with or without subgroup check.
|
|
529
|
+
|
|
530
|
+
Parameters
|
|
531
|
+
----------
|
|
532
|
+
data :
|
|
533
|
+
The bytes data to decode.
|
|
534
|
+
subgroup_check : bool
|
|
535
|
+
Whether to perform a subgroup check on the G2 point.
|
|
536
|
+
|
|
537
|
+
Returns
|
|
538
|
+
-------
|
|
539
|
+
point : Point3D[FQ2]
|
|
540
|
+
The G2 point.
|
|
541
|
+
|
|
542
|
+
Raises
|
|
543
|
+
------
|
|
544
|
+
InvalidParameter
|
|
545
|
+
If a field element is invalid, the point is not on the curve, or the
|
|
546
|
+
subgroup check fails.
|
|
547
|
+
|
|
548
|
+
"""
|
|
549
|
+
# This is needed bc when we slice `Bytes` we get a `bytearray`,
|
|
550
|
+
# which is not hashable
|
|
551
|
+
return _bytes_to_g2_cached(data, subgroup_check)
|
|
552
|
+
|
|
553
|
+
|
|
554
|
+
def fq2_to_bytes(fq2: FQ2) -> Bytes:
|
|
555
|
+
"""
|
|
556
|
+
Encode a FQ2 point to 128 bytes.
|
|
557
|
+
|
|
558
|
+
Parameters
|
|
559
|
+
----------
|
|
560
|
+
fq2 :
|
|
561
|
+
The FQ2 point to encode.
|
|
562
|
+
|
|
563
|
+
Returns
|
|
564
|
+
-------
|
|
565
|
+
data : Bytes
|
|
566
|
+
The encoded data.
|
|
567
|
+
|
|
568
|
+
"""
|
|
569
|
+
coord0, coord1 = fq2.coeffs
|
|
570
|
+
return int(coord0).to_bytes(64, "big") + int(coord1).to_bytes(64, "big")
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
def g2_to_bytes(
|
|
574
|
+
g2_point: Point3D[FQ2],
|
|
575
|
+
) -> Bytes:
|
|
576
|
+
"""
|
|
577
|
+
Encode a G2 point to 256 bytes.
|
|
578
|
+
|
|
579
|
+
Parameters
|
|
580
|
+
----------
|
|
581
|
+
g2_point :
|
|
582
|
+
The G2 point to encode.
|
|
583
|
+
|
|
584
|
+
Returns
|
|
585
|
+
-------
|
|
586
|
+
data : Bytes
|
|
587
|
+
The encoded data.
|
|
588
|
+
|
|
589
|
+
"""
|
|
590
|
+
x_coords, y_coords = normalize(g2_point)
|
|
591
|
+
return fq2_to_bytes(x_coords) + fq2_to_bytes(y_coords)
|
|
592
|
+
|
|
593
|
+
|
|
594
|
+
def decode_g2_scalar_pair(
|
|
595
|
+
data: Bytes,
|
|
596
|
+
) -> Tuple[Point3D[FQ2], int]:
|
|
597
|
+
"""
|
|
598
|
+
Decode 288 bytes to a G2 point and a scalar.
|
|
599
|
+
|
|
600
|
+
Parameters
|
|
601
|
+
----------
|
|
602
|
+
data :
|
|
603
|
+
The bytes data to decode.
|
|
604
|
+
|
|
605
|
+
Returns
|
|
606
|
+
-------
|
|
607
|
+
point : Tuple[Point3D[FQ2], int]
|
|
608
|
+
The G2 point and the scalar.
|
|
609
|
+
|
|
610
|
+
Raises
|
|
611
|
+
------
|
|
612
|
+
InvalidParameter
|
|
613
|
+
If the subgroup check failed.
|
|
614
|
+
|
|
615
|
+
"""
|
|
616
|
+
if len(data) != 288:
|
|
617
|
+
InvalidParameter("Input should be 288 bytes long")
|
|
618
|
+
|
|
619
|
+
point = bytes_to_g2(data[:256], subgroup_check=True)
|
|
620
|
+
n = int.from_bytes(data[256 : 256 + 32], "big")
|
|
621
|
+
|
|
622
|
+
return point, n
|