@feelyourprotocol/evm 8141.0.0
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.
- package/LICENSE +373 -0
- package/README.md +690 -0
- package/dist/cjs/binaryTreeAccessWitness.d.ts +61 -0
- package/dist/cjs/binaryTreeAccessWitness.d.ts.map +1 -0
- package/dist/cjs/binaryTreeAccessWitness.js +314 -0
- package/dist/cjs/binaryTreeAccessWitness.js.map +1 -0
- package/dist/cjs/chunkCache.d.ts +13 -0
- package/dist/cjs/chunkCache.d.ts.map +1 -0
- package/dist/cjs/chunkCache.js +30 -0
- package/dist/cjs/chunkCache.js.map +1 -0
- package/dist/cjs/constructors.d.ts +11 -0
- package/dist/cjs/constructors.d.ts.map +1 -0
- package/dist/cjs/constructors.js +30 -0
- package/dist/cjs/constructors.js.map +1 -0
- package/dist/cjs/eip7708.d.ts +24 -0
- package/dist/cjs/eip7708.d.ts.map +1 -0
- package/dist/cjs/eip7708.js +37 -0
- package/dist/cjs/eip7708.js.map +1 -0
- package/dist/cjs/eof/constants.d.ts +22 -0
- package/dist/cjs/eof/constants.d.ts.map +1 -0
- package/dist/cjs/eof/constants.js +31 -0
- package/dist/cjs/eof/constants.js.map +1 -0
- package/dist/cjs/eof/container.d.ts +87 -0
- package/dist/cjs/eof/container.d.ts.map +1 -0
- package/dist/cjs/eof/container.js +380 -0
- package/dist/cjs/eof/container.js.map +1 -0
- package/dist/cjs/eof/errors.d.ts +66 -0
- package/dist/cjs/eof/errors.d.ts.map +1 -0
- package/dist/cjs/eof/errors.js +200 -0
- package/dist/cjs/eof/errors.js.map +1 -0
- package/dist/cjs/eof/setup.d.ts +9 -0
- package/dist/cjs/eof/setup.d.ts.map +1 -0
- package/dist/cjs/eof/setup.js +26 -0
- package/dist/cjs/eof/setup.js.map +1 -0
- package/dist/cjs/eof/stackDelta.d.ts +10 -0
- package/dist/cjs/eof/stackDelta.d.ts.map +1 -0
- package/dist/cjs/eof/stackDelta.js +164 -0
- package/dist/cjs/eof/stackDelta.js.map +1 -0
- package/dist/cjs/eof/util.d.ts +8 -0
- package/dist/cjs/eof/util.d.ts.map +1 -0
- package/dist/cjs/eof/util.js +18 -0
- package/dist/cjs/eof/util.js.map +1 -0
- package/dist/cjs/eof/verify.d.ts +38 -0
- package/dist/cjs/eof/verify.d.ts.map +1 -0
- package/dist/cjs/eof/verify.js +436 -0
- package/dist/cjs/eof/verify.js.map +1 -0
- package/dist/cjs/errors.d.ts +40 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +43 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/evm.d.ts +181 -0
- package/dist/cjs/evm.d.ts.map +1 -0
- package/dist/cjs/evm.js +1142 -0
- package/dist/cjs/evm.js.map +1 -0
- package/dist/cjs/frameContext.d.ts +50 -0
- package/dist/cjs/frameContext.d.ts.map +1 -0
- package/dist/cjs/frameContext.js +17 -0
- package/dist/cjs/frameContext.js.map +1 -0
- package/dist/cjs/index.d.ts +18 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +43 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interpreter.d.ts +361 -0
- package/dist/cjs/interpreter.d.ts.map +1 -0
- package/dist/cjs/interpreter.js +1057 -0
- package/dist/cjs/interpreter.js.map +1 -0
- package/dist/cjs/journal.d.ts +69 -0
- package/dist/cjs/journal.d.ts.map +1 -0
- package/dist/cjs/journal.js +247 -0
- package/dist/cjs/journal.js.map +1 -0
- package/dist/cjs/logger.d.ts +38 -0
- package/dist/cjs/logger.d.ts.map +1 -0
- package/dist/cjs/logger.js +126 -0
- package/dist/cjs/logger.js.map +1 -0
- package/dist/cjs/memory.d.ts +29 -0
- package/dist/cjs/memory.d.ts.map +1 -0
- package/dist/cjs/memory.js +75 -0
- package/dist/cjs/memory.js.map +1 -0
- package/dist/cjs/message.d.ts +70 -0
- package/dist/cjs/message.d.ts.map +1 -0
- package/dist/cjs/message.js +51 -0
- package/dist/cjs/message.js.map +1 -0
- package/dist/cjs/opcodes/EIP1283.d.ts +13 -0
- package/dist/cjs/opcodes/EIP1283.d.ts.map +1 -0
- package/dist/cjs/opcodes/EIP1283.js +58 -0
- package/dist/cjs/opcodes/EIP1283.js.map +1 -0
- package/dist/cjs/opcodes/EIP2200.d.ts +13 -0
- package/dist/cjs/opcodes/EIP2200.d.ts.map +1 -0
- package/dist/cjs/opcodes/EIP2200.js +64 -0
- package/dist/cjs/opcodes/EIP2200.js.map +1 -0
- package/dist/cjs/opcodes/EIP2929.d.ts +68 -0
- package/dist/cjs/opcodes/EIP2929.d.ts.map +1 -0
- package/dist/cjs/opcodes/EIP2929.js +146 -0
- package/dist/cjs/opcodes/EIP2929.js.map +1 -0
- package/dist/cjs/opcodes/codes.d.ts +45 -0
- package/dist/cjs/opcodes/codes.d.ts.map +1 -0
- package/dist/cjs/opcodes/codes.js +453 -0
- package/dist/cjs/opcodes/codes.js.map +1 -0
- package/dist/cjs/opcodes/functions.d.ts +11 -0
- package/dist/cjs/opcodes/functions.d.ts.map +1 -0
- package/dist/cjs/opcodes/functions.js +1778 -0
- package/dist/cjs/opcodes/functions.js.map +1 -0
- package/dist/cjs/opcodes/gas.d.ts +15 -0
- package/dist/cjs/opcodes/gas.d.ts.map +1 -0
- package/dist/cjs/opcodes/gas.js +1016 -0
- package/dist/cjs/opcodes/gas.js.map +1 -0
- package/dist/cjs/opcodes/index.d.ts +4 -0
- package/dist/cjs/opcodes/index.d.ts.map +1 -0
- package/dist/cjs/opcodes/index.js +20 -0
- package/dist/cjs/opcodes/index.js.map +1 -0
- package/dist/cjs/opcodes/util.d.ts +86 -0
- package/dist/cjs/opcodes/util.d.ts.map +1 -0
- package/dist/cjs/opcodes/util.js +281 -0
- package/dist/cjs/opcodes/util.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/params.d.ts +3 -0
- package/dist/cjs/params.d.ts.map +1 -0
- package/dist/cjs/params.js +424 -0
- package/dist/cjs/params.js.map +1 -0
- package/dist/cjs/precompiles/01-ecrecover.d.ts +4 -0
- package/dist/cjs/precompiles/01-ecrecover.d.ts.map +1 -0
- package/dist/cjs/precompiles/01-ecrecover.js +58 -0
- package/dist/cjs/precompiles/01-ecrecover.js.map +1 -0
- package/dist/cjs/precompiles/02-sha256.d.ts +4 -0
- package/dist/cjs/precompiles/02-sha256.d.ts.map +1 -0
- package/dist/cjs/precompiles/02-sha256.js +27 -0
- package/dist/cjs/precompiles/02-sha256.js.map +1 -0
- package/dist/cjs/precompiles/03-ripemd160.d.ts +4 -0
- package/dist/cjs/precompiles/03-ripemd160.d.ts.map +1 -0
- package/dist/cjs/precompiles/03-ripemd160.js +26 -0
- package/dist/cjs/precompiles/03-ripemd160.js.map +1 -0
- package/dist/cjs/precompiles/04-identity.d.ts +4 -0
- package/dist/cjs/precompiles/04-identity.d.ts.map +1 -0
- package/dist/cjs/precompiles/04-identity.js +24 -0
- package/dist/cjs/precompiles/04-identity.js.map +1 -0
- package/dist/cjs/precompiles/05-modexp.d.ts +5 -0
- package/dist/cjs/precompiles/05-modexp.d.ts.map +1 -0
- package/dist/cjs/precompiles/05-modexp.js +185 -0
- package/dist/cjs/precompiles/05-modexp.js.map +1 -0
- package/dist/cjs/precompiles/06-bn254-add.d.ts +4 -0
- package/dist/cjs/precompiles/06-bn254-add.d.ts.map +1 -0
- package/dist/cjs/precompiles/06-bn254-add.js +42 -0
- package/dist/cjs/precompiles/06-bn254-add.js.map +1 -0
- package/dist/cjs/precompiles/07-bn254-mul.d.ts +4 -0
- package/dist/cjs/precompiles/07-bn254-mul.d.ts.map +1 -0
- package/dist/cjs/precompiles/07-bn254-mul.js +43 -0
- package/dist/cjs/precompiles/07-bn254-mul.js.map +1 -0
- package/dist/cjs/precompiles/08-bn254-pairing.d.ts +4 -0
- package/dist/cjs/precompiles/08-bn254-pairing.d.ts.map +1 -0
- package/dist/cjs/precompiles/08-bn254-pairing.js +45 -0
- package/dist/cjs/precompiles/08-bn254-pairing.js.map +1 -0
- package/dist/cjs/precompiles/09-blake2f.d.ts +5 -0
- package/dist/cjs/precompiles/09-blake2f.d.ts.map +1 -0
- package/dist/cjs/precompiles/09-blake2f.js +201 -0
- package/dist/cjs/precompiles/09-blake2f.js.map +1 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.d.ts +5 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.d.ts.map +1 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.js +68 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.js.map +1 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.d.ts +4 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.d.ts.map +1 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.js +49 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.js.map +1 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.d.ts +4 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.d.ts.map +1 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.js +62 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.js.map +1 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.d.ts +4 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.d.ts.map +1 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.js +51 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.js.map +1 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.d.ts +4 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.d.ts.map +1 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.js +60 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.js.map +1 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.d.ts +4 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.d.ts.map +1 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.js +66 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.js.map +1 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.d.ts +4 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.d.ts.map +1 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.js +44 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.js.map +1 -0
- package/dist/cjs/precompiles/100-p256verify.d.ts +4 -0
- package/dist/cjs/precompiles/100-p256verify.d.ts.map +1 -0
- package/dist/cjs/precompiles/100-p256verify.js +131 -0
- package/dist/cjs/precompiles/100-p256verify.js.map +1 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.d.ts +4 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.d.ts.map +1 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.js +47 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/constants.d.ts +10 -0
- package/dist/cjs/precompiles/bls12_381/constants.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/constants.js +274 -0
- package/dist/cjs/precompiles/bls12_381/constants.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/index.d.ts +5 -0
- package/dist/cjs/precompiles/bls12_381/index.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/index.js +24 -0
- package/dist/cjs/precompiles/bls12_381/index.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/mcl.d.ts +45 -0
- package/dist/cjs/precompiles/bls12_381/mcl.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/mcl.js +264 -0
- package/dist/cjs/precompiles/bls12_381/mcl.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/noble.d.ts +39 -0
- package/dist/cjs/precompiles/bls12_381/noble.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/noble.js +228 -0
- package/dist/cjs/precompiles/bls12_381/noble.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/util.d.ts +35 -0
- package/dist/cjs/precompiles/bls12_381/util.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/util.js +68 -0
- package/dist/cjs/precompiles/bls12_381/util.js.map +1 -0
- package/dist/cjs/precompiles/bn254/index.d.ts +3 -0
- package/dist/cjs/precompiles/bn254/index.d.ts.map +1 -0
- package/dist/cjs/precompiles/bn254/index.js +8 -0
- package/dist/cjs/precompiles/bn254/index.js.map +1 -0
- package/dist/cjs/precompiles/bn254/noble.d.ts +13 -0
- package/dist/cjs/precompiles/bn254/noble.d.ts.map +1 -0
- package/dist/cjs/precompiles/bn254/noble.js +124 -0
- package/dist/cjs/precompiles/bn254/noble.js.map +1 -0
- package/dist/cjs/precompiles/bn254/rustbn.d.ts +16 -0
- package/dist/cjs/precompiles/bn254/rustbn.d.ts.map +1 -0
- package/dist/cjs/precompiles/bn254/rustbn.js +33 -0
- package/dist/cjs/precompiles/bn254/rustbn.js.map +1 -0
- package/dist/cjs/precompiles/index.d.ts +67 -0
- package/dist/cjs/precompiles/index.d.ts.map +1 -0
- package/dist/cjs/precompiles/index.js +262 -0
- package/dist/cjs/precompiles/index.js.map +1 -0
- package/dist/cjs/precompiles/types.d.ts +13 -0
- package/dist/cjs/precompiles/types.d.ts.map +1 -0
- package/dist/cjs/precompiles/types.js +3 -0
- package/dist/cjs/precompiles/types.js.map +1 -0
- package/dist/cjs/precompiles/util.d.ts +30 -0
- package/dist/cjs/precompiles/util.d.ts.map +1 -0
- package/dist/cjs/precompiles/util.js +63 -0
- package/dist/cjs/precompiles/util.js.map +1 -0
- package/dist/cjs/stack.d.ts +55 -0
- package/dist/cjs/stack.d.ts.map +1 -0
- package/dist/cjs/stack.js +143 -0
- package/dist/cjs/stack.js.map +1 -0
- package/dist/cjs/stemCache.d.ts +20 -0
- package/dist/cjs/stemCache.d.ts.map +1 -0
- package/dist/cjs/stemCache.js +37 -0
- package/dist/cjs/stemCache.js.map +1 -0
- package/dist/cjs/transientStorage.d.ts +54 -0
- package/dist/cjs/transientStorage.d.ts.map +1 -0
- package/dist/cjs/transientStorage.js +113 -0
- package/dist/cjs/transientStorage.js.map +1 -0
- package/dist/cjs/types.d.ts +465 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +28 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/binaryTreeAccessWitness.d.ts +61 -0
- package/dist/esm/binaryTreeAccessWitness.d.ts.map +1 -0
- package/dist/esm/binaryTreeAccessWitness.js +308 -0
- package/dist/esm/binaryTreeAccessWitness.js.map +1 -0
- package/dist/esm/chunkCache.d.ts +13 -0
- package/dist/esm/chunkCache.d.ts.map +1 -0
- package/dist/esm/chunkCache.js +26 -0
- package/dist/esm/chunkCache.js.map +1 -0
- package/dist/esm/constructors.d.ts +11 -0
- package/dist/esm/constructors.d.ts.map +1 -0
- package/dist/esm/constructors.js +27 -0
- package/dist/esm/constructors.js.map +1 -0
- package/dist/esm/eip7708.d.ts +24 -0
- package/dist/esm/eip7708.d.ts.map +1 -0
- package/dist/esm/eip7708.js +32 -0
- package/dist/esm/eip7708.js.map +1 -0
- package/dist/esm/eof/constants.d.ts +22 -0
- package/dist/esm/eof/constants.d.ts.map +1 -0
- package/dist/esm/eof/constants.js +28 -0
- package/dist/esm/eof/constants.js.map +1 -0
- package/dist/esm/eof/container.d.ts +87 -0
- package/dist/esm/eof/container.d.ts.map +1 -0
- package/dist/esm/eof/container.js +375 -0
- package/dist/esm/eof/container.js.map +1 -0
- package/dist/esm/eof/errors.d.ts +66 -0
- package/dist/esm/eof/errors.d.ts.map +1 -0
- package/dist/esm/eof/errors.js +195 -0
- package/dist/esm/eof/errors.js.map +1 -0
- package/dist/esm/eof/setup.d.ts +9 -0
- package/dist/esm/eof/setup.d.ts.map +1 -0
- package/dist/esm/eof/setup.js +23 -0
- package/dist/esm/eof/setup.js.map +1 -0
- package/dist/esm/eof/stackDelta.d.ts +10 -0
- package/dist/esm/eof/stackDelta.d.ts.map +1 -0
- package/dist/esm/eof/stackDelta.js +161 -0
- package/dist/esm/eof/stackDelta.js.map +1 -0
- package/dist/esm/eof/util.d.ts +8 -0
- package/dist/esm/eof/util.d.ts.map +1 -0
- package/dist/esm/eof/util.js +14 -0
- package/dist/esm/eof/util.js.map +1 -0
- package/dist/esm/eof/verify.d.ts +38 -0
- package/dist/esm/eof/verify.d.ts.map +1 -0
- package/dist/esm/eof/verify.js +432 -0
- package/dist/esm/eof/verify.js.map +1 -0
- package/dist/esm/errors.d.ts +40 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +39 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/evm.d.ts +181 -0
- package/dist/esm/evm.d.ts.map +1 -0
- package/dist/esm/evm.js +1131 -0
- package/dist/esm/evm.js.map +1 -0
- package/dist/esm/frameContext.d.ts +50 -0
- package/dist/esm/frameContext.d.ts.map +1 -0
- package/dist/esm/frameContext.js +14 -0
- package/dist/esm/frameContext.js.map +1 -0
- package/dist/esm/index.d.ts +18 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interpreter.d.ts +361 -0
- package/dist/esm/interpreter.d.ts.map +1 -0
- package/dist/esm/interpreter.js +1054 -0
- package/dist/esm/interpreter.js.map +1 -0
- package/dist/esm/journal.d.ts +69 -0
- package/dist/esm/journal.d.ts.map +1 -0
- package/dist/esm/journal.js +243 -0
- package/dist/esm/journal.js.map +1 -0
- package/dist/esm/logger.d.ts +38 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +121 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/memory.d.ts +29 -0
- package/dist/esm/memory.d.ts.map +1 -0
- package/dist/esm/memory.js +71 -0
- package/dist/esm/memory.js.map +1 -0
- package/dist/esm/message.d.ts +70 -0
- package/dist/esm/message.d.ts.map +1 -0
- package/dist/esm/message.js +47 -0
- package/dist/esm/message.js.map +1 -0
- package/dist/esm/opcodes/EIP1283.d.ts +13 -0
- package/dist/esm/opcodes/EIP1283.d.ts.map +1 -0
- package/dist/esm/opcodes/EIP1283.js +55 -0
- package/dist/esm/opcodes/EIP1283.js.map +1 -0
- package/dist/esm/opcodes/EIP2200.d.ts +13 -0
- package/dist/esm/opcodes/EIP2200.d.ts.map +1 -0
- package/dist/esm/opcodes/EIP2200.js +61 -0
- package/dist/esm/opcodes/EIP2200.js.map +1 -0
- package/dist/esm/opcodes/EIP2929.d.ts +68 -0
- package/dist/esm/opcodes/EIP2929.d.ts.map +1 -0
- package/dist/esm/opcodes/EIP2929.js +138 -0
- package/dist/esm/opcodes/EIP2929.js.map +1 -0
- package/dist/esm/opcodes/codes.d.ts +45 -0
- package/dist/esm/opcodes/codes.d.ts.map +1 -0
- package/dist/esm/opcodes/codes.js +448 -0
- package/dist/esm/opcodes/codes.js.map +1 -0
- package/dist/esm/opcodes/functions.d.ts +11 -0
- package/dist/esm/opcodes/functions.d.ts.map +1 -0
- package/dist/esm/opcodes/functions.js +1775 -0
- package/dist/esm/opcodes/functions.js.map +1 -0
- package/dist/esm/opcodes/gas.d.ts +15 -0
- package/dist/esm/opcodes/gas.d.ts.map +1 -0
- package/dist/esm/opcodes/gas.js +1013 -0
- package/dist/esm/opcodes/gas.js.map +1 -0
- package/dist/esm/opcodes/index.d.ts +4 -0
- package/dist/esm/opcodes/index.d.ts.map +1 -0
- package/dist/esm/opcodes/index.js +4 -0
- package/dist/esm/opcodes/index.js.map +1 -0
- package/dist/esm/opcodes/util.d.ts +86 -0
- package/dist/esm/opcodes/util.d.ts.map +1 -0
- package/dist/esm/opcodes/util.js +257 -0
- package/dist/esm/opcodes/util.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/params.d.ts +3 -0
- package/dist/esm/params.d.ts.map +1 -0
- package/dist/esm/params.js +421 -0
- package/dist/esm/params.js.map +1 -0
- package/dist/esm/precompiles/01-ecrecover.d.ts +4 -0
- package/dist/esm/precompiles/01-ecrecover.d.ts.map +1 -0
- package/dist/esm/precompiles/01-ecrecover.js +55 -0
- package/dist/esm/precompiles/01-ecrecover.js.map +1 -0
- package/dist/esm/precompiles/02-sha256.d.ts +4 -0
- package/dist/esm/precompiles/02-sha256.d.ts.map +1 -0
- package/dist/esm/precompiles/02-sha256.js +24 -0
- package/dist/esm/precompiles/02-sha256.js.map +1 -0
- package/dist/esm/precompiles/03-ripemd160.d.ts +4 -0
- package/dist/esm/precompiles/03-ripemd160.d.ts.map +1 -0
- package/dist/esm/precompiles/03-ripemd160.js +23 -0
- package/dist/esm/precompiles/03-ripemd160.js.map +1 -0
- package/dist/esm/precompiles/04-identity.d.ts +4 -0
- package/dist/esm/precompiles/04-identity.d.ts.map +1 -0
- package/dist/esm/precompiles/04-identity.js +21 -0
- package/dist/esm/precompiles/04-identity.js.map +1 -0
- package/dist/esm/precompiles/05-modexp.d.ts +5 -0
- package/dist/esm/precompiles/05-modexp.d.ts.map +1 -0
- package/dist/esm/precompiles/05-modexp.js +181 -0
- package/dist/esm/precompiles/05-modexp.js.map +1 -0
- package/dist/esm/precompiles/06-bn254-add.d.ts +4 -0
- package/dist/esm/precompiles/06-bn254-add.d.ts.map +1 -0
- package/dist/esm/precompiles/06-bn254-add.js +39 -0
- package/dist/esm/precompiles/06-bn254-add.js.map +1 -0
- package/dist/esm/precompiles/07-bn254-mul.d.ts +4 -0
- package/dist/esm/precompiles/07-bn254-mul.d.ts.map +1 -0
- package/dist/esm/precompiles/07-bn254-mul.js +40 -0
- package/dist/esm/precompiles/07-bn254-mul.js.map +1 -0
- package/dist/esm/precompiles/08-bn254-pairing.d.ts +4 -0
- package/dist/esm/precompiles/08-bn254-pairing.d.ts.map +1 -0
- package/dist/esm/precompiles/08-bn254-pairing.js +42 -0
- package/dist/esm/precompiles/08-bn254-pairing.js.map +1 -0
- package/dist/esm/precompiles/09-blake2f.d.ts +5 -0
- package/dist/esm/precompiles/09-blake2f.d.ts.map +1 -0
- package/dist/esm/precompiles/09-blake2f.js +197 -0
- package/dist/esm/precompiles/09-blake2f.js.map +1 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.d.ts +5 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.d.ts.map +1 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.js +64 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.js.map +1 -0
- package/dist/esm/precompiles/0b-bls12-g1add.d.ts +4 -0
- package/dist/esm/precompiles/0b-bls12-g1add.d.ts.map +1 -0
- package/dist/esm/precompiles/0b-bls12-g1add.js +46 -0
- package/dist/esm/precompiles/0b-bls12-g1add.js.map +1 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.d.ts +4 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.d.ts.map +1 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.js +59 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.js.map +1 -0
- package/dist/esm/precompiles/0d-bls12-g2add.d.ts +4 -0
- package/dist/esm/precompiles/0d-bls12-g2add.d.ts.map +1 -0
- package/dist/esm/precompiles/0d-bls12-g2add.js +48 -0
- package/dist/esm/precompiles/0d-bls12-g2add.js.map +1 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.d.ts +4 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.d.ts.map +1 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.js +57 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.js.map +1 -0
- package/dist/esm/precompiles/0f-bls12-pairing.d.ts +4 -0
- package/dist/esm/precompiles/0f-bls12-pairing.d.ts.map +1 -0
- package/dist/esm/precompiles/0f-bls12-pairing.js +63 -0
- package/dist/esm/precompiles/0f-bls12-pairing.js.map +1 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.d.ts +4 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.d.ts.map +1 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.js +41 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.js.map +1 -0
- package/dist/esm/precompiles/100-p256verify.d.ts +4 -0
- package/dist/esm/precompiles/100-p256verify.d.ts.map +1 -0
- package/dist/esm/precompiles/100-p256verify.js +128 -0
- package/dist/esm/precompiles/100-p256verify.js.map +1 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.d.ts +4 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.d.ts.map +1 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.js +44 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/constants.d.ts +10 -0
- package/dist/esm/precompiles/bls12_381/constants.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/constants.js +271 -0
- package/dist/esm/precompiles/bls12_381/constants.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/index.d.ts +5 -0
- package/dist/esm/precompiles/bls12_381/index.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/index.js +5 -0
- package/dist/esm/precompiles/bls12_381/index.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/mcl.d.ts +45 -0
- package/dist/esm/precompiles/bls12_381/mcl.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/mcl.js +254 -0
- package/dist/esm/precompiles/bls12_381/mcl.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/noble.d.ts +39 -0
- package/dist/esm/precompiles/bls12_381/noble.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/noble.js +218 -0
- package/dist/esm/precompiles/bls12_381/noble.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/util.d.ts +35 -0
- package/dist/esm/precompiles/bls12_381/util.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/util.js +63 -0
- package/dist/esm/precompiles/bls12_381/util.js.map +1 -0
- package/dist/esm/precompiles/bn254/index.d.ts +3 -0
- package/dist/esm/precompiles/bn254/index.d.ts.map +1 -0
- package/dist/esm/precompiles/bn254/index.js +3 -0
- package/dist/esm/precompiles/bn254/index.js.map +1 -0
- package/dist/esm/precompiles/bn254/noble.d.ts +13 -0
- package/dist/esm/precompiles/bn254/noble.d.ts.map +1 -0
- package/dist/esm/precompiles/bn254/noble.js +120 -0
- package/dist/esm/precompiles/bn254/noble.js.map +1 -0
- package/dist/esm/precompiles/bn254/rustbn.d.ts +16 -0
- package/dist/esm/precompiles/bn254/rustbn.d.ts.map +1 -0
- package/dist/esm/precompiles/bn254/rustbn.js +29 -0
- package/dist/esm/precompiles/bn254/rustbn.js.map +1 -0
- package/dist/esm/precompiles/index.d.ts +67 -0
- package/dist/esm/precompiles/index.d.ts.map +1 -0
- package/dist/esm/precompiles/index.js +251 -0
- package/dist/esm/precompiles/index.js.map +1 -0
- package/dist/esm/precompiles/types.d.ts +13 -0
- package/dist/esm/precompiles/types.d.ts.map +1 -0
- package/dist/esm/precompiles/types.js +2 -0
- package/dist/esm/precompiles/types.js.map +1 -0
- package/dist/esm/precompiles/util.d.ts +30 -0
- package/dist/esm/precompiles/util.d.ts.map +1 -0
- package/dist/esm/precompiles/util.js +57 -0
- package/dist/esm/precompiles/util.js.map +1 -0
- package/dist/esm/stack.d.ts +55 -0
- package/dist/esm/stack.d.ts.map +1 -0
- package/dist/esm/stack.js +139 -0
- package/dist/esm/stack.js.map +1 -0
- package/dist/esm/stemCache.d.ts +20 -0
- package/dist/esm/stemCache.d.ts.map +1 -0
- package/dist/esm/stemCache.js +33 -0
- package/dist/esm/stemCache.js.map +1 -0
- package/dist/esm/transientStorage.d.ts +54 -0
- package/dist/esm/transientStorage.d.ts.map +1 -0
- package/dist/esm/transientStorage.js +109 -0
- package/dist/esm/transientStorage.js.map +1 -0
- package/dist/esm/types.d.ts +465 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +23 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
- package/package.json +98 -0
- package/src/binaryTreeAccessWitness.ts +447 -0
- package/src/chunkCache.ts +36 -0
- package/src/constructors.ts +35 -0
- package/src/eip7708.ts +47 -0
- package/src/eof/constants.ts +36 -0
- package/src/eof/container.ts +495 -0
- package/src/eof/errors.ts +214 -0
- package/src/eof/setup.ts +27 -0
- package/src/eof/stackDelta.ts +169 -0
- package/src/eof/util.ts +16 -0
- package/src/eof/verify.ts +531 -0
- package/src/errors.ts +45 -0
- package/src/evm.ts +1415 -0
- package/src/frameContext.ts +56 -0
- package/src/index.ts +75 -0
- package/src/interpreter.ts +1437 -0
- package/src/journal.ts +317 -0
- package/src/logger.ts +180 -0
- package/src/memory.ts +82 -0
- package/src/message.ts +114 -0
- package/src/opcodes/EIP1283.ts +77 -0
- package/src/opcodes/EIP2200.ts +87 -0
- package/src/opcodes/EIP2929.ts +173 -0
- package/src/opcodes/codes.ts +528 -0
- package/src/opcodes/functions.ts +1937 -0
- package/src/opcodes/gas.ts +1329 -0
- package/src/opcodes/index.ts +3 -0
- package/src/opcodes/util.ts +313 -0
- package/src/params.ts +423 -0
- package/src/precompiles/01-ecrecover.ts +77 -0
- package/src/precompiles/02-sha256.ts +32 -0
- package/src/precompiles/03-ripemd160.ts +32 -0
- package/src/precompiles/04-identity.ts +29 -0
- package/src/precompiles/05-modexp.ts +215 -0
- package/src/precompiles/06-bn254-add.ts +49 -0
- package/src/precompiles/07-bn254-mul.ts +50 -0
- package/src/precompiles/08-bn254-pairing.ts +54 -0
- package/src/precompiles/09-blake2f.ts +243 -0
- package/src/precompiles/0a-kzg-point-evaluation.ts +94 -0
- package/src/precompiles/0b-bls12-g1add.ts +63 -0
- package/src/precompiles/0c-bls12-g1msm.ts +87 -0
- package/src/precompiles/0d-bls12-g2add.ts +66 -0
- package/src/precompiles/0e-bls12-g2msm.ts +84 -0
- package/src/precompiles/0f-bls12-pairing.ts +86 -0
- package/src/precompiles/10-bls12-map-fp-to-g1.ts +58 -0
- package/src/precompiles/100-p256verify.ts +152 -0
- package/src/precompiles/11-bls12-map-fp2-to-g2.ts +61 -0
- package/src/precompiles/bls12_381/constants.ts +278 -0
- package/src/precompiles/bls12_381/index.ts +4 -0
- package/src/precompiles/bls12_381/mcl.ts +376 -0
- package/src/precompiles/bls12_381/noble.ts +307 -0
- package/src/precompiles/bls12_381/util.ts +78 -0
- package/src/precompiles/bn254/index.ts +2 -0
- package/src/precompiles/bn254/noble.ts +156 -0
- package/src/precompiles/bn254/rustbn.ts +35 -0
- package/src/precompiles/index.ts +344 -0
- package/src/precompiles/types.ts +15 -0
- package/src/precompiles/util.ts +70 -0
- package/src/stack.ts +166 -0
- package/src/stemCache.ts +45 -0
- package/src/transientStorage.ts +131 -0
- package/src/types.ts +538 -0
package/src/params.ts
ADDED
|
@@ -0,0 +1,423 @@
|
|
|
1
|
+
import type { ParamsDict } from '@feelyourprotocol/common'
|
|
2
|
+
import { SYSTEM_ADDRESS } from '@feelyourprotocol/util'
|
|
3
|
+
|
|
4
|
+
export const paramsEVM: ParamsDict = {
|
|
5
|
+
/**
|
|
6
|
+
* Frontier/Chainstart
|
|
7
|
+
*/
|
|
8
|
+
1: {
|
|
9
|
+
// gasConfig
|
|
10
|
+
maxRefundQuotient: 2, // Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)
|
|
11
|
+
// gasPrices
|
|
12
|
+
basefeeGas: 2, // Gas base cost, used e.g. for ChainID opcode (Istanbul)
|
|
13
|
+
expGas: 10, // Base fee of the EXP opcode
|
|
14
|
+
expByteGas: 10, // Times ceil(log256(exponent)) for the EXP instruction
|
|
15
|
+
keccak256Gas: 30, // Base fee of the SHA3 opcode
|
|
16
|
+
keccak256WordGas: 6, // Once per word of the SHA3 operation's data
|
|
17
|
+
sloadGas: 50, // Base fee of the SLOAD opcode
|
|
18
|
+
sstoreSetGas: 20000, // Once per SSTORE operation if the zeroness changes from zero
|
|
19
|
+
sstoreResetGas: 5000, // Once per SSTORE operation if the zeroness does not change from zero
|
|
20
|
+
sstoreRefundGas: 15000, // Once per SSTORE operation if the zeroness changes to zero
|
|
21
|
+
jumpdestGas: 1, // Base fee of the JUMPDEST opcode
|
|
22
|
+
logGas: 375, // Base fee of the LOG opcode
|
|
23
|
+
logDataGas: 8, // Per byte in a LOG* operation's data
|
|
24
|
+
logTopicGas: 375, // Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas
|
|
25
|
+
createGas: 32000, // Base fee of the CREATE opcode
|
|
26
|
+
callGas: 40, // Base fee of the CALL opcode
|
|
27
|
+
callStipendGas: 2300, // Free gas given at beginning of call
|
|
28
|
+
callValueTransferGas: 9000, // Paid for CALL when the value transfer is non-zero
|
|
29
|
+
callNewAccountGas: 25000, // Paid for CALL when the destination address didn't exist prior
|
|
30
|
+
selfdestructRefundGas: 24000, // Refunded following a selfdestruct operation
|
|
31
|
+
memoryGas: 3, // Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL
|
|
32
|
+
quadCoefficientDivGas: 512, // Divisor for the quadratic particle of the memory cost equation
|
|
33
|
+
createDataGas: 200, //
|
|
34
|
+
copyGas: 3, // Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added
|
|
35
|
+
ecRecoverGas: 3000,
|
|
36
|
+
sha256Gas: 60,
|
|
37
|
+
sha256WordGas: 12,
|
|
38
|
+
ripemd160Gas: 600,
|
|
39
|
+
ripemd160WordGas: 120,
|
|
40
|
+
identityGas: 15,
|
|
41
|
+
identityWordGas: 3,
|
|
42
|
+
stopGas: 0, // Base fee of the STOP opcode
|
|
43
|
+
addGas: 3, // Base fee of the ADD opcode
|
|
44
|
+
mulGas: 5, // Base fee of the MUL opcode
|
|
45
|
+
subGas: 3, // Base fee of the SUB opcode
|
|
46
|
+
divGas: 5, // Base fee of the DIV opcode
|
|
47
|
+
sdivGas: 5, // Base fee of the SDIV opcode
|
|
48
|
+
modGas: 5, // Base fee of the MOD opcode
|
|
49
|
+
smodGas: 5, // Base fee of the SMOD opcode
|
|
50
|
+
addmodGas: 8, // Base fee of the ADDMOD opcode
|
|
51
|
+
mulmodGas: 8, // Base fee of the MULMOD opcode
|
|
52
|
+
signextendGas: 5, // Base fee of the SIGNEXTEND opcode
|
|
53
|
+
ltGas: 3, // Base fee of the LT opcode
|
|
54
|
+
gtGas: 3, // Base fee of the GT opcode
|
|
55
|
+
sltGas: 3, // Base fee of the SLT opcode
|
|
56
|
+
sgtGas: 3, // Base fee of the SGT opcode
|
|
57
|
+
eqGas: 3, // Base fee of the EQ opcode
|
|
58
|
+
iszeroGas: 3, // Base fee of the ISZERO opcode
|
|
59
|
+
andGas: 3, // Base fee of the AND opcode
|
|
60
|
+
orGas: 3, // Base fee of the OR opcode
|
|
61
|
+
xorGas: 3, // Base fee of the XOR opcode
|
|
62
|
+
notGas: 3, // Base fee of the NOT opcode
|
|
63
|
+
byteGas: 3, // Base fee of the BYTE opcode
|
|
64
|
+
addressGas: 2, // Base fee of the ADDRESS opcode
|
|
65
|
+
balanceGas: 20, // Base fee of the BALANCE opcode
|
|
66
|
+
originGas: 2, // Base fee of the ORIGIN opcode
|
|
67
|
+
callerGas: 2, // Base fee of the CALLER opcode
|
|
68
|
+
callvalueGas: 2, // Base fee of the CALLVALUE opcode
|
|
69
|
+
calldataloadGas: 3, // Base fee of the CALLDATALOAD opcode
|
|
70
|
+
calldatasizeGas: 2, // Base fee of the CALLDATASIZE opcode
|
|
71
|
+
calldatacopyGas: 3, // Base fee of the CALLDATACOPY opcode
|
|
72
|
+
codesizeGas: 2, // Base fee of the CODESIZE opcode
|
|
73
|
+
codecopyGas: 3, // Base fee of the CODECOPY opcode
|
|
74
|
+
gaspriceGas: 2, // Base fee of the GASPRICE opcode
|
|
75
|
+
extcodesizeGas: 20, // Base fee of the EXTCODESIZE opcode
|
|
76
|
+
extcodecopyGas: 20, // Base fee of the EXTCODECOPY opcode
|
|
77
|
+
blockhashGas: 20, // Base fee of the BLOCKHASH opcode
|
|
78
|
+
coinbaseGas: 2, // Base fee of the COINBASE opcode
|
|
79
|
+
timestampGas: 2, // Base fee of the TIMESTAMP opcode
|
|
80
|
+
numberGas: 2, // Base fee of the NUMBER opcode
|
|
81
|
+
difficultyGas: 2, // Base fee of the DIFFICULTY opcode
|
|
82
|
+
gaslimitGas: 2, // Base fee of the GASLIMIT opcode
|
|
83
|
+
slotnumGas: 2, // Base fee of the SLOTNUM opcode (EIP-7843)
|
|
84
|
+
popGas: 2, // Base fee of the POP opcode
|
|
85
|
+
mloadGas: 3, // Base fee of the MLOAD opcode
|
|
86
|
+
mstoreGas: 3, // Base fee of the MSTORE opcode
|
|
87
|
+
mstore8Gas: 3, // Base fee of the MSTORE8 opcode
|
|
88
|
+
sstoreGas: 0, // Base fee of the SSTORE opcode
|
|
89
|
+
jumpGas: 8, // Base fee of the JUMP opcode
|
|
90
|
+
jumpiGas: 10, // Base fee of the JUMPI opcode
|
|
91
|
+
pcGas: 2, // Base fee of the PC opcode
|
|
92
|
+
msizeGas: 2, // Base fee of the MSIZE opcode
|
|
93
|
+
gasGas: 2, // Base fee of the GAS opcode
|
|
94
|
+
pushGas: 3, // Base fee of the PUSH opcode
|
|
95
|
+
dupGas: 3, // Base fee of the DUP opcode
|
|
96
|
+
swapGas: 3, // Base fee of the SWAP opcode
|
|
97
|
+
callcodeGas: 40, // Base fee of the CALLCODE opcode
|
|
98
|
+
returnGas: 0, // Base fee of the RETURN opcode
|
|
99
|
+
invalidGas: 0, // Base fee of the INVALID opcode
|
|
100
|
+
selfdestructGas: 0, // Base fee of the SELFDESTRUCT opcode
|
|
101
|
+
prevrandaoGas: 0, // TODO: these below 0-gas additions might also point to non-clean implementations in the code base
|
|
102
|
+
// evm
|
|
103
|
+
stackLimit: 1024, // Maximum size of VM stack allowed
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
. * Homestead HF Meta EIP
|
|
107
|
+
. */
|
|
108
|
+
606: {
|
|
109
|
+
// gasPrices
|
|
110
|
+
delegatecallGas: 40, // Base fee of the DELEGATECALL opcode
|
|
111
|
+
},
|
|
112
|
+
/**
|
|
113
|
+
. * TangerineWhistle HF Meta EIP
|
|
114
|
+
. */
|
|
115
|
+
608: {
|
|
116
|
+
// gasPrices
|
|
117
|
+
sloadGas: 200, // Once per SLOAD operation
|
|
118
|
+
callGas: 700, // Once per CALL operation & message call transaction
|
|
119
|
+
extcodesizeGas: 700, // Base fee of the EXTCODESIZE opcode
|
|
120
|
+
extcodecopyGas: 700, // Base fee of the EXTCODECOPY opcode
|
|
121
|
+
balanceGas: 400, // Base fee of the BALANCE opcode
|
|
122
|
+
delegatecallGas: 700, // Base fee of the DELEGATECALL opcode
|
|
123
|
+
callcodeGas: 700, // Base fee of the CALLCODE opcode
|
|
124
|
+
selfdestructGas: 5000, // Base fee of the SELFDESTRUCT opcode
|
|
125
|
+
},
|
|
126
|
+
/**
|
|
127
|
+
. * Spurious Dragon HF Meta EIP
|
|
128
|
+
. */
|
|
129
|
+
607: {
|
|
130
|
+
// gasPrices
|
|
131
|
+
expByteGas: 50, // Times ceil(log256(exponent)) for the EXP instruction
|
|
132
|
+
// evm
|
|
133
|
+
maxCodeSize: 24576, // Maximum length of contract code
|
|
134
|
+
},
|
|
135
|
+
/**
|
|
136
|
+
. * Byzantium HF Meta EIP
|
|
137
|
+
. */
|
|
138
|
+
609: {
|
|
139
|
+
// gasPrices
|
|
140
|
+
modexpGquaddivisorGas: 20, // Gquaddivisor from modexp precompile for gas calculation
|
|
141
|
+
bn254AddGas: 500, // Gas costs for curve addition precompile
|
|
142
|
+
bn254MulGas: 40000, // Gas costs for curve multiplication precompile
|
|
143
|
+
bn254PairingGas: 100000, // Base gas costs for curve pairing precompile
|
|
144
|
+
bn254PairingWordGas: 80000, // Gas costs regarding curve pairing precompile input length
|
|
145
|
+
revertGas: 0, // Base fee of the REVERT opcode
|
|
146
|
+
staticcallGas: 700, // Base fee of the STATICCALL opcode
|
|
147
|
+
returndatasizeGas: 2, // Base fee of the RETURNDATASIZE opcode
|
|
148
|
+
returndatacopyGas: 3, // Base fee of the RETURNDATACOPY opcode
|
|
149
|
+
},
|
|
150
|
+
/**
|
|
151
|
+
. * Constantinople HF Meta EIP
|
|
152
|
+
. */
|
|
153
|
+
1013: {
|
|
154
|
+
// gasPrices
|
|
155
|
+
netSstoreNoopGas: 200, // Once per SSTORE operation if the value doesn't change
|
|
156
|
+
netSstoreInitGas: 20000, // Once per SSTORE operation from clean zero
|
|
157
|
+
netSstoreCleanGas: 5000, // Once per SSTORE operation from clean non-zero
|
|
158
|
+
netSstoreDirtyGas: 200, // Once per SSTORE operation from dirty
|
|
159
|
+
netSstoreClearRefundGas: 15000, // Once per SSTORE operation for clearing an originally existing storage slot
|
|
160
|
+
netSstoreResetRefundGas: 4800, // Once per SSTORE operation for resetting to the original non-zero value
|
|
161
|
+
netSstoreResetClearRefundGas: 19800, // Once per SSTORE operation for resetting to the original zero value
|
|
162
|
+
shlGas: 3, // Base fee of the SHL opcode
|
|
163
|
+
shrGas: 3, // Base fee of the SHR opcode
|
|
164
|
+
sarGas: 3, // Base fee of the SAR opcode
|
|
165
|
+
extcodehashGas: 400, // Base fee of the EXTCODEHASH opcode
|
|
166
|
+
create2Gas: 32000, // Base fee of the CREATE2 opcode
|
|
167
|
+
},
|
|
168
|
+
/**
|
|
169
|
+
. * Petersburg HF Meta EIP
|
|
170
|
+
. */
|
|
171
|
+
1716: {
|
|
172
|
+
// gasPrices
|
|
173
|
+
netSstoreNoopGas: null, // Removed along EIP-1283
|
|
174
|
+
netSstoreInitGas: null, // Removed along EIP-1283
|
|
175
|
+
netSstoreCleanGas: null, // Removed along EIP-1283
|
|
176
|
+
netSstoreDirtyGas: null, // Removed along EIP-1283
|
|
177
|
+
netSstoreClearRefundGas: null, // Removed along EIP-1283
|
|
178
|
+
netSstoreResetRefundGas: null, // Removed along EIP-1283
|
|
179
|
+
netSstoreResetClearRefundGas: null, // Removed along EIP-1283
|
|
180
|
+
},
|
|
181
|
+
/**
|
|
182
|
+
. * Istanbul HF Meta EIP
|
|
183
|
+
. */
|
|
184
|
+
1679: {
|
|
185
|
+
// gasPrices
|
|
186
|
+
blake2RoundGas: 1, // Gas cost per round for the Blake2 F precompile
|
|
187
|
+
bn254AddGas: 150, // Gas costs for curve addition precompile
|
|
188
|
+
bn254MulGas: 6000, // Gas costs for curve multiplication precompile
|
|
189
|
+
bn254PairingGas: 45000, // Base gas costs for curve pairing precompile
|
|
190
|
+
bn254PairingWordGas: 34000, // Gas costs regarding curve pairing precompile input length
|
|
191
|
+
sstoreSentryEIP2200Gas: 2300, // Minimum gas required to be present for an SSTORE call, not consumed
|
|
192
|
+
sstoreNoopEIP2200Gas: 800, // Once per SSTORE operation if the value doesn't change
|
|
193
|
+
sstoreDirtyEIP2200Gas: 800, // Once per SSTORE operation if a dirty value is changed
|
|
194
|
+
sstoreInitEIP2200Gas: 20000, // Once per SSTORE operation from clean zero to non-zero
|
|
195
|
+
sstoreInitRefundEIP2200Gas: 19200, // Once per SSTORE operation for resetting to the original zero value
|
|
196
|
+
sstoreCleanEIP2200Gas: 5000, // Once per SSTORE operation from clean non-zero to something else
|
|
197
|
+
sstoreCleanRefundEIP2200Gas: 4200, // Once per SSTORE operation for resetting to the original non-zero value
|
|
198
|
+
sstoreClearRefundEIP2200Gas: 15000, // Once per SSTORE operation for clearing an originally existing storage slot
|
|
199
|
+
balanceGas: 700, // Base fee of the BALANCE opcode
|
|
200
|
+
extcodehashGas: 700, // Base fee of the EXTCODEHASH opcode
|
|
201
|
+
chainidGas: 2, // Base fee of the CHAINID opcode
|
|
202
|
+
selfbalanceGas: 5, // Base fee of the SELFBALANCE opcode
|
|
203
|
+
sloadGas: 800, // Base fee of the SLOAD opcode
|
|
204
|
+
},
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
. * DUPN, SWAPN and EXCHANGE instructions
|
|
208
|
+
. */
|
|
209
|
+
8024: {
|
|
210
|
+
// gasPrices
|
|
211
|
+
dupnGas: 3, // Base fee of the DUPN opcode
|
|
212
|
+
swapnGas: 3, // Base fee of the SWAPN opcode
|
|
213
|
+
exchangeGas: 3, // Base fee of the EXCHANGE opcode
|
|
214
|
+
},
|
|
215
|
+
/**
|
|
216
|
+
. * Transient storage opcodes
|
|
217
|
+
. */
|
|
218
|
+
1153: {
|
|
219
|
+
// gasPrices
|
|
220
|
+
tstoreGas: 100, // Base fee of the TSTORE opcode
|
|
221
|
+
tloadGas: 100, // Base fee of the TLOAD opcode
|
|
222
|
+
},
|
|
223
|
+
1559: {
|
|
224
|
+
elasticityMultiplier: 2, // Maximum block gas target elasticity
|
|
225
|
+
},
|
|
226
|
+
/**
|
|
227
|
+
. * ModExp gas cost
|
|
228
|
+
. */
|
|
229
|
+
2565: {
|
|
230
|
+
// gasPrices
|
|
231
|
+
modexpGquaddivisorGas: 3, // Gquaddivisor from modexp precompile for gas calculation
|
|
232
|
+
},
|
|
233
|
+
/**
|
|
234
|
+
* BLS12-381 precompiles
|
|
235
|
+
*/
|
|
236
|
+
2537: {
|
|
237
|
+
// gasPrices
|
|
238
|
+
bls12381G1AddGas: 375, // Gas cost of a single BLS12-381 G1 addition precompile-call
|
|
239
|
+
bls12381G1MulGas: 12000, // Gas cost of a single BLS12-381 G1 multiplication precompile-call
|
|
240
|
+
bls12381G2AddGas: 600, // Gas cost of a single BLS12-381 G2 addition precompile-call
|
|
241
|
+
bls12381G2MulGas: 22500, // Gas cost of a single BLS12-381 G2 multiplication precompile-call
|
|
242
|
+
bls12381PairingBaseGas: 37700, // Base gas cost of BLS12-381 pairing check
|
|
243
|
+
bls12381PairingPerPairGas: 32600, // Per-pair gas cost of BLS12-381 pairing check
|
|
244
|
+
bls12381MapG1Gas: 5500, // Gas cost of BLS12-381 map field element to G1
|
|
245
|
+
bls12381MapG2Gas: 23800, // Gas cost of BLS12-381 map field element to G2
|
|
246
|
+
},
|
|
247
|
+
/**
|
|
248
|
+
. * Gas cost increases for state access opcodes
|
|
249
|
+
. */
|
|
250
|
+
2929: {
|
|
251
|
+
// gasPrices
|
|
252
|
+
coldsloadGas: 2100, // Gas cost of the first read of storage from a given location (per transaction)
|
|
253
|
+
coldaccountaccessGas: 2600, // Gas cost of the first read of a given address (per transaction)
|
|
254
|
+
warmstoragereadGas: 100, // Gas cost of reading storage locations which have already loaded 'cold'
|
|
255
|
+
sstoreCleanEIP2200Gas: 2900, // Once per SSTORE operation from clean non-zero to something else
|
|
256
|
+
sstoreNoopEIP2200Gas: 100, // Once per SSTORE operation if the value doesn't change
|
|
257
|
+
sstoreDirtyEIP2200Gas: 100, // Once per SSTORE operation if a dirty value is changed
|
|
258
|
+
sstoreInitRefundEIP2200Gas: 19900, // Once per SSTORE operation for resetting to the original zero value
|
|
259
|
+
sstoreCleanRefundEIP2200Gas: 4900, // Once per SSTORE operation for resetting to the original non-zero value
|
|
260
|
+
callGas: 0, // Base fee of the CALL opcode
|
|
261
|
+
callcodeGas: 0, // Base fee of the CALLCODE opcode
|
|
262
|
+
delegatecallGas: 0, // Base fee of the DELEGATECALL opcode
|
|
263
|
+
staticcallGas: 0, // Base fee of the STATICCALL opcode
|
|
264
|
+
balanceGas: 0, // Base fee of the BALANCE opcode
|
|
265
|
+
extcodesizeGas: 0, // Base fee of the EXTCODESIZE opcode
|
|
266
|
+
extcodecopyGas: 0, // Base fee of the EXTCODECOPY opcode
|
|
267
|
+
extcodehashGas: 0, // Base fee of the EXTCODEHASH opcode
|
|
268
|
+
sloadGas: 0, // Base fee of the SLOAD opcode
|
|
269
|
+
sstoreGas: 0, // Base fee of the SSTORE opcode
|
|
270
|
+
},
|
|
271
|
+
/**
|
|
272
|
+
* Save historical block hashes in state (Verkle related usage, UNSTABLE)
|
|
273
|
+
*/
|
|
274
|
+
2935: {
|
|
275
|
+
// evm
|
|
276
|
+
historyStorageAddress: '0x0000F90827F1C53A10CB7A02335B175320002935', // The address where the historical blockhashes are stored
|
|
277
|
+
historyServeWindow: 8192, // The amount of blocks to be served by the historical blockhash contract
|
|
278
|
+
systemAddress: SYSTEM_ADDRESS, // The system address
|
|
279
|
+
},
|
|
280
|
+
/**
|
|
281
|
+
. * BASEFEE opcode
|
|
282
|
+
. */
|
|
283
|
+
3198: {
|
|
284
|
+
// gasPrices
|
|
285
|
+
basefeeGas: 2, // Gas cost of the BASEFEE opcode
|
|
286
|
+
},
|
|
287
|
+
/**
|
|
288
|
+
. * Reduction in refunds
|
|
289
|
+
. */
|
|
290
|
+
3529: {
|
|
291
|
+
// gasConfig
|
|
292
|
+
maxRefundQuotient: 5, // Maximum refund quotient; max tx refund is min(tx.gasUsed/maxRefundQuotient, tx.gasRefund)
|
|
293
|
+
// gasPrices
|
|
294
|
+
selfdestructRefundGas: 0, // Refunded following a selfdestruct operation
|
|
295
|
+
sstoreClearRefundEIP2200Gas: 4800, // Once per SSTORE operation for clearing an originally existing storage slot
|
|
296
|
+
},
|
|
297
|
+
/**
|
|
298
|
+
. * PUSH0 instruction
|
|
299
|
+
. */
|
|
300
|
+
3855: {
|
|
301
|
+
// gasPrices
|
|
302
|
+
push0Gas: 2, // Base fee of the PUSH0 opcode
|
|
303
|
+
},
|
|
304
|
+
/**
|
|
305
|
+
. * Limit and meter initcode
|
|
306
|
+
. */
|
|
307
|
+
3860: {
|
|
308
|
+
// gasPrices
|
|
309
|
+
initCodeWordGas: 2, // Gas to pay for each word (32 bytes) of initcode when creating a contract
|
|
310
|
+
// vm
|
|
311
|
+
maxInitCodeSize: 49152, // Maximum length of initialization code when creating a contract
|
|
312
|
+
},
|
|
313
|
+
/**
|
|
314
|
+
* EOF - Static relative jumps
|
|
315
|
+
*/
|
|
316
|
+
4200: {
|
|
317
|
+
// gasPrices
|
|
318
|
+
rjumpGas: 2, // Base fee of the RJUMP opcode
|
|
319
|
+
rjumpiGas: 4, // Base fee of the RJUMPI opcode
|
|
320
|
+
rjumpvGas: 4, // Base fee of the RJUMPV opcode
|
|
321
|
+
},
|
|
322
|
+
/**
|
|
323
|
+
. * Supplant DIFFICULTY opcode with PREVRANDAO
|
|
324
|
+
. */
|
|
325
|
+
4399: {
|
|
326
|
+
// gasPrices
|
|
327
|
+
prevrandaoGas: 2, // Base fee of the PREVRANDAO opcode (previously DIFFICULTY)
|
|
328
|
+
},
|
|
329
|
+
/**
|
|
330
|
+
* EOF - Functions
|
|
331
|
+
*/
|
|
332
|
+
4750: {
|
|
333
|
+
// gasPrices
|
|
334
|
+
callfGas: 5, // Base fee of the CALLF opcode
|
|
335
|
+
retfGas: 3, // Base fee of the RETF opcode
|
|
336
|
+
},
|
|
337
|
+
/**
|
|
338
|
+
. * Shard Blob Transactions
|
|
339
|
+
. */
|
|
340
|
+
4844: {
|
|
341
|
+
kzgPointEvaluationPrecompileGas: 50000, // The fee associated with the point evaluation precompile
|
|
342
|
+
blobhashGas: 3, // Base fee of the BLOBHASH opcode
|
|
343
|
+
// sharding
|
|
344
|
+
blobCommitmentVersionKzg: 1, // The number indicated a versioned hash is a KZG commitment
|
|
345
|
+
fieldElementsPerBlob: 4096, // The number of field elements allowed per blob
|
|
346
|
+
},
|
|
347
|
+
/**
|
|
348
|
+
* MCOPY - Memory copying instruction
|
|
349
|
+
*/
|
|
350
|
+
5656: {
|
|
351
|
+
// gasPrices
|
|
352
|
+
mcopyGas: 3, // Base fee of the MCOPY opcode
|
|
353
|
+
},
|
|
354
|
+
/**
|
|
355
|
+
* EOF - JUMPF and non-returning functions
|
|
356
|
+
*/
|
|
357
|
+
6206: {
|
|
358
|
+
// gasPrices
|
|
359
|
+
jumpfGas: 5, // Base fee of the JUMPF opcode
|
|
360
|
+
},
|
|
361
|
+
/**
|
|
362
|
+
. * Revamped CALL instructions
|
|
363
|
+
. */
|
|
364
|
+
7069: {
|
|
365
|
+
/* Note: per EIP these are the additionally required EIPs:
|
|
366
|
+
EIP 150 - This is the entire Tangerine Whistle hardfork
|
|
367
|
+
EIP 211 - (RETURNDATASIZE / RETURNDATACOPY) - Included in Byzantium
|
|
368
|
+
EIP 214 - (STATICCALL) - Included in Byzantium
|
|
369
|
+
*/
|
|
370
|
+
// gasPrices
|
|
371
|
+
extcallGas: 0, // Base fee of the EXTCALL opcode
|
|
372
|
+
extdelegatecallGas: 0, // Base fee of the EXTDELEGATECALL opcode
|
|
373
|
+
extstaticcallGas: 0, // Base fee of the EXTSTATICCALL opcode
|
|
374
|
+
returndataloadGas: 3, // Base fee of the RETURNDATALOAD opcode
|
|
375
|
+
minRetainedGas: 5000, // Minimum gas retained prior to executing an EXT*CALL opcode (this is the minimum gas available after performing the EXT*CALL)
|
|
376
|
+
minCalleeGas: 2300, //Minimum gas available to the the address called by an EXT*CALL opcode
|
|
377
|
+
},
|
|
378
|
+
/**
|
|
379
|
+
* EOF - Data section access instructions
|
|
380
|
+
*/
|
|
381
|
+
7480: {
|
|
382
|
+
// gasPrices
|
|
383
|
+
dataloadGas: 4, // Base fee of the DATALOAD opcode
|
|
384
|
+
dataloadnGas: 3, // Base fee of the DATALOADN opcode
|
|
385
|
+
datasizeGas: 2, // Base fee of the DATASIZE opcode
|
|
386
|
+
datacopyGas: 3, // Base fee of the DATACOPY opcode
|
|
387
|
+
},
|
|
388
|
+
/**
|
|
389
|
+
. * BLOBBASEFEE opcode
|
|
390
|
+
. */
|
|
391
|
+
7516: {
|
|
392
|
+
// gasPrices
|
|
393
|
+
blobbasefeeGas: 2, // Gas cost of the BLOBBASEFEE opcode
|
|
394
|
+
},
|
|
395
|
+
/**
|
|
396
|
+
. * EOF Contract Creation
|
|
397
|
+
. */
|
|
398
|
+
7620: {
|
|
399
|
+
/* Note: per EIP these are the additionally required EIPs:
|
|
400
|
+
EIP 170 - (Max contract size) - Included in Spurious Dragon
|
|
401
|
+
*/
|
|
402
|
+
// gasPrices
|
|
403
|
+
eofcreateGas: 32000, // Base fee of the EOFCREATE opcode (Same as CREATE/CREATE2)
|
|
404
|
+
returncontractGas: 0, // Base fee of the RETURNCONTRACT opcode
|
|
405
|
+
},
|
|
406
|
+
/**
|
|
407
|
+
. * Count leading zeros (CLZ) opcode
|
|
408
|
+
. */
|
|
409
|
+
7939: {
|
|
410
|
+
// gasPrices
|
|
411
|
+
clzGas: 5, // Base fee of the CLZ opcode (matching MUL as per EIP-7939)
|
|
412
|
+
},
|
|
413
|
+
/**
|
|
414
|
+
* EIP-8141: Frame Transaction
|
|
415
|
+
*/
|
|
416
|
+
8141: {
|
|
417
|
+
// gasPrices
|
|
418
|
+
approveGas: 0, // Base fee of the APPROVE opcode (terminates frame like RETURN)
|
|
419
|
+
txparamGas: 2, // Base fee of the TXPARAM opcode
|
|
420
|
+
framedataloadGas: 3, // Base fee of the FRAMEDATALOAD opcode (matches CALLDATALOAD)
|
|
421
|
+
framedatacopyGas: 3, // Base fee of the FRAMEDATACOPY opcode (matches CALLDATACOPY)
|
|
422
|
+
},
|
|
423
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
BIGINT_27,
|
|
3
|
+
BIGINT_28,
|
|
4
|
+
bytesToBigInt,
|
|
5
|
+
bytesToHex,
|
|
6
|
+
ecrecover,
|
|
7
|
+
publicToAddress,
|
|
8
|
+
setLengthLeft,
|
|
9
|
+
setLengthRight,
|
|
10
|
+
} from '@feelyourprotocol/util'
|
|
11
|
+
|
|
12
|
+
import { OOGResult } from '../evm.ts'
|
|
13
|
+
|
|
14
|
+
import { getPrecompileName } from './index.ts'
|
|
15
|
+
import { gasLimitCheck } from './util.ts'
|
|
16
|
+
|
|
17
|
+
import type { ExecResult } from '../types.ts'
|
|
18
|
+
import type { PrecompileInput } from './types.ts'
|
|
19
|
+
|
|
20
|
+
export function precompile01(opts: PrecompileInput): ExecResult {
|
|
21
|
+
const pName = getPrecompileName('01')
|
|
22
|
+
const ecrecoverFunction = opts.common.customCrypto.ecrecover ?? ecrecover
|
|
23
|
+
const gasUsed = opts.common.param('ecRecoverGas')
|
|
24
|
+
if (!gasLimitCheck(opts, gasUsed, pName)) {
|
|
25
|
+
return OOGResult(opts.gasLimit)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const data = setLengthRight(opts.data, 128, { allowTruncate: true })
|
|
29
|
+
|
|
30
|
+
const msgHash = data.subarray(0, 32)
|
|
31
|
+
const v = data.subarray(32, 64)
|
|
32
|
+
const vBigInt = bytesToBigInt(v)
|
|
33
|
+
|
|
34
|
+
// Guard against util's `ecrecover`: without providing chainId this will return
|
|
35
|
+
// a signature in most of the cases in the cases that `v=0` or `v=1`
|
|
36
|
+
// However, this should throw, only 27 and 28 is allowed as input
|
|
37
|
+
if (vBigInt !== BIGINT_27 && vBigInt !== BIGINT_28) {
|
|
38
|
+
if (opts._debug !== undefined) {
|
|
39
|
+
opts._debug(`${pName} failed: v neither 27 nor 28`)
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
executionGasUsed: gasUsed,
|
|
43
|
+
returnValue: new Uint8Array(),
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const r = data.subarray(64, 96)
|
|
48
|
+
const s = data.subarray(96, 128)
|
|
49
|
+
|
|
50
|
+
let publicKey
|
|
51
|
+
try {
|
|
52
|
+
if (opts._debug !== undefined) {
|
|
53
|
+
opts._debug(
|
|
54
|
+
`${pName}: PK recovery with msgHash=${bytesToHex(msgHash)} v=${bytesToHex(
|
|
55
|
+
v,
|
|
56
|
+
)} r=${bytesToHex(r)}s=${bytesToHex(s)}}`,
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
publicKey = ecrecoverFunction(msgHash, bytesToBigInt(v), r, s)
|
|
60
|
+
} catch {
|
|
61
|
+
if (opts._debug !== undefined) {
|
|
62
|
+
opts._debug(`${pName} failed: PK recovery failed`)
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
executionGasUsed: gasUsed,
|
|
66
|
+
returnValue: new Uint8Array(0),
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
const address = setLengthLeft(publicToAddress(publicKey), 32)
|
|
70
|
+
if (opts._debug !== undefined) {
|
|
71
|
+
opts._debug(`${pName} return address=${bytesToHex(address)}`)
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
executionGasUsed: gasUsed,
|
|
75
|
+
returnValue: address,
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { bytesToHex } from '@feelyourprotocol/util'
|
|
2
|
+
import { sha256 } from '@noble/hashes/sha2.js'
|
|
3
|
+
|
|
4
|
+
import { OOGResult } from '../evm.ts'
|
|
5
|
+
|
|
6
|
+
import { getPrecompileName } from './index.ts'
|
|
7
|
+
import { gasLimitCheck } from './util.ts'
|
|
8
|
+
|
|
9
|
+
import type { ExecResult } from '../types.ts'
|
|
10
|
+
import type { PrecompileInput } from './types.ts'
|
|
11
|
+
|
|
12
|
+
export function precompile02(opts: PrecompileInput): ExecResult {
|
|
13
|
+
const pName = getPrecompileName('02')
|
|
14
|
+
const data = opts.data
|
|
15
|
+
const sha256Function = opts.common.customCrypto.sha256 ?? sha256
|
|
16
|
+
let gasUsed = opts.common.param('sha256Gas')
|
|
17
|
+
gasUsed += opts.common.param('sha256WordGas') * BigInt(Math.ceil(data.length / 32))
|
|
18
|
+
|
|
19
|
+
if (!gasLimitCheck(opts, gasUsed, pName)) {
|
|
20
|
+
return OOGResult(opts.gasLimit)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const hash = sha256Function(data)
|
|
24
|
+
if (opts._debug !== undefined) {
|
|
25
|
+
opts._debug(`${pName} return hash=${bytesToHex(hash)}`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
executionGasUsed: gasUsed,
|
|
30
|
+
returnValue: hash,
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { bytesToHex, setLengthLeft } from '@feelyourprotocol/util'
|
|
2
|
+
import { ripemd160 } from '@noble/hashes/legacy.js'
|
|
3
|
+
|
|
4
|
+
import { OOGResult } from '../evm.ts'
|
|
5
|
+
|
|
6
|
+
import { getPrecompileName } from './index.ts'
|
|
7
|
+
import { gasLimitCheck } from './util.ts'
|
|
8
|
+
|
|
9
|
+
import type { ExecResult } from '../types.ts'
|
|
10
|
+
import type { PrecompileInput } from './types.ts'
|
|
11
|
+
|
|
12
|
+
export function precompile03(opts: PrecompileInput): ExecResult {
|
|
13
|
+
const pName = getPrecompileName('03')
|
|
14
|
+
const data = opts.data
|
|
15
|
+
|
|
16
|
+
let gasUsed = opts.common.param('ripemd160Gas')
|
|
17
|
+
gasUsed += opts.common.param('ripemd160WordGas') * BigInt(Math.ceil(data.length / 32))
|
|
18
|
+
|
|
19
|
+
if (!gasLimitCheck(opts, gasUsed, pName)) {
|
|
20
|
+
return OOGResult(opts.gasLimit)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const hash = setLengthLeft(ripemd160(data), 32)
|
|
24
|
+
if (opts._debug !== undefined) {
|
|
25
|
+
opts._debug(`${pName} return hash=${bytesToHex(hash)}`)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
executionGasUsed: gasUsed,
|
|
30
|
+
returnValue: setLengthLeft(ripemd160(data), 32),
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { short } from '@feelyourprotocol/util'
|
|
2
|
+
|
|
3
|
+
import { OOGResult } from '../evm.ts'
|
|
4
|
+
|
|
5
|
+
import { getPrecompileName } from './index.ts'
|
|
6
|
+
import { gasLimitCheck } from './util.ts'
|
|
7
|
+
|
|
8
|
+
import type { ExecResult } from '../types.ts'
|
|
9
|
+
import type { PrecompileInput } from './types.ts'
|
|
10
|
+
|
|
11
|
+
export function precompile04(opts: PrecompileInput): ExecResult {
|
|
12
|
+
const pName = getPrecompileName('04')
|
|
13
|
+
const data = opts.data
|
|
14
|
+
|
|
15
|
+
let gasUsed = opts.common.param('identityGas')
|
|
16
|
+
gasUsed += opts.common.param('identityWordGas') * BigInt(Math.ceil(data.length / 32))
|
|
17
|
+
if (!gasLimitCheck(opts, gasUsed, pName)) {
|
|
18
|
+
return OOGResult(opts.gasLimit)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (opts._debug !== undefined) {
|
|
22
|
+
opts._debug(`${pName} return data=${short(opts.data)}`)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return {
|
|
26
|
+
executionGasUsed: gasUsed,
|
|
27
|
+
returnValue: Uint8Array.from(data), // Copy the memory (`Uint8Array.from()`)
|
|
28
|
+
}
|
|
29
|
+
}
|