@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
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { EthereumJSErrorWithoutCode, bytesToHex } from '@feelyourprotocol/util'
|
|
2
|
+
|
|
3
|
+
import type { Address } from '@feelyourprotocol/util'
|
|
4
|
+
import type { TransientStorageInterface } from './types.ts'
|
|
5
|
+
|
|
6
|
+
type TransientStorageCurrent = Map<string, Map<string, Uint8Array>>
|
|
7
|
+
|
|
8
|
+
interface TransientStorageModification {
|
|
9
|
+
addr: string
|
|
10
|
+
key: string
|
|
11
|
+
prevValue: Uint8Array
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
type TransientStorageJournal = TransientStorageModification[]
|
|
15
|
+
|
|
16
|
+
export class TransientStorage implements TransientStorageInterface {
|
|
17
|
+
/**
|
|
18
|
+
* The current values of the transient storage, keyed by contract address and then slot
|
|
19
|
+
*/
|
|
20
|
+
private _storage: TransientStorageCurrent = new Map()
|
|
21
|
+
/**
|
|
22
|
+
* Each change to storage is recorded in the journal. This is never cleared.
|
|
23
|
+
*/
|
|
24
|
+
private _changeJournal: TransientStorageJournal = []
|
|
25
|
+
/**
|
|
26
|
+
* The length of the journal at the beginning of each call in the call stack.
|
|
27
|
+
*/
|
|
28
|
+
private _indices: number[] = [0]
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Get the value for the given address and key
|
|
32
|
+
* @param addr the address for which transient storage is accessed
|
|
33
|
+
* @param key the key of the address to get
|
|
34
|
+
*/
|
|
35
|
+
public get(addr: Address, key: Uint8Array): Uint8Array {
|
|
36
|
+
const map = this._storage.get(addr.toString())
|
|
37
|
+
if (!map) {
|
|
38
|
+
return new Uint8Array(32)
|
|
39
|
+
}
|
|
40
|
+
const value = map.get(bytesToHex(key))
|
|
41
|
+
if (!value) {
|
|
42
|
+
return new Uint8Array(32)
|
|
43
|
+
}
|
|
44
|
+
return value
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Put the given value for the address and key
|
|
49
|
+
* @param addr the address of the contract for which the key is being set
|
|
50
|
+
* @param key the slot to set for the address
|
|
51
|
+
* @param value the new value of the transient storage slot to set
|
|
52
|
+
*/
|
|
53
|
+
public put(addr: Address, key: Uint8Array, value: Uint8Array) {
|
|
54
|
+
if (key.length !== 32) {
|
|
55
|
+
throw EthereumJSErrorWithoutCode('Transient storage key must be 32 bytes long')
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (value.length > 32) {
|
|
59
|
+
throw EthereumJSErrorWithoutCode('Transient storage value cannot be longer than 32 bytes')
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const addrString = addr.toString()
|
|
63
|
+
if (!this._storage.has(addrString)) {
|
|
64
|
+
this._storage.set(addrString, new Map())
|
|
65
|
+
}
|
|
66
|
+
const map = this._storage.get(addrString)!
|
|
67
|
+
|
|
68
|
+
const keyStr = bytesToHex(key)
|
|
69
|
+
const prevValue = map.get(keyStr) ?? new Uint8Array(32)
|
|
70
|
+
|
|
71
|
+
this._changeJournal.push({
|
|
72
|
+
addr: addrString,
|
|
73
|
+
key: keyStr,
|
|
74
|
+
prevValue,
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
map.set(keyStr, value)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Commit all the changes since the last checkpoint
|
|
82
|
+
*/
|
|
83
|
+
public commit(): void {
|
|
84
|
+
if (this._indices.length === 0) throw EthereumJSErrorWithoutCode('Nothing to commit')
|
|
85
|
+
// by discarding the length of the array from the last time checkpoint was called, all changes are included in the last stack
|
|
86
|
+
this._indices.pop()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* To be called whenever entering a new context. If revert is called after checkpoint, all changes after the latest checkpoint are reverted.
|
|
91
|
+
*/
|
|
92
|
+
public checkpoint(): void {
|
|
93
|
+
this._indices.push(this._changeJournal.length)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Revert transient storage to the last checkpoint
|
|
98
|
+
*/
|
|
99
|
+
public revert() {
|
|
100
|
+
const lastCheckpoint = this._indices.pop()
|
|
101
|
+
if (typeof lastCheckpoint === 'undefined') throw EthereumJSErrorWithoutCode('Nothing to revert')
|
|
102
|
+
|
|
103
|
+
for (let i = this._changeJournal.length - 1; i >= lastCheckpoint; i--) {
|
|
104
|
+
const { key, prevValue, addr } = this._changeJournal[i]
|
|
105
|
+
this._storage.get(addr)!.set(key, prevValue)
|
|
106
|
+
}
|
|
107
|
+
this._changeJournal.splice(lastCheckpoint, this._changeJournal.length - lastCheckpoint)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Create a JSON representation of the current transient storage state
|
|
112
|
+
*/
|
|
113
|
+
public toJSON(): { [address: string]: { [key: string]: string } } {
|
|
114
|
+
const result: { [address: string]: { [key: string]: string } } = {}
|
|
115
|
+
for (const [address, map] of this._storage.entries()) {
|
|
116
|
+
result[address] = {}
|
|
117
|
+
for (const [key, value] of map.entries()) {
|
|
118
|
+
result[address][key] = bytesToHex(value)
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return result
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Clear transient storage state.
|
|
126
|
+
*/
|
|
127
|
+
public clear(): void {
|
|
128
|
+
this._storage = new Map()
|
|
129
|
+
this._changeJournal = []
|
|
130
|
+
}
|
|
131
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
BinaryTreeAccessWitnessInterface,
|
|
3
|
+
Common,
|
|
4
|
+
ParamsDict,
|
|
5
|
+
StateManagerInterface,
|
|
6
|
+
} from '@feelyourprotocol/common'
|
|
7
|
+
import type { Account, Address, BlockLevelAccessList, PrefixedHexString } from '@feelyourprotocol/util'
|
|
8
|
+
import type { EventEmitter } from 'eventemitter3'
|
|
9
|
+
import type { BinaryTreeAccessWitness } from './binaryTreeAccessWitness.ts'
|
|
10
|
+
import type { EOFContainer } from './eof/container.ts'
|
|
11
|
+
import type { EVMError } from './errors.ts'
|
|
12
|
+
import type { FrameExecutionContext } from './frameContext.ts'
|
|
13
|
+
import type { InterpreterStep, RunState } from './interpreter.ts'
|
|
14
|
+
import type { Message } from './message.ts'
|
|
15
|
+
import type { AsyncDynamicGasHandler, SyncDynamicGasHandler } from './opcodes/gas.ts'
|
|
16
|
+
import type { OpHandler } from './opcodes/index.ts'
|
|
17
|
+
import type { CustomPrecompile } from './precompiles/index.ts'
|
|
18
|
+
import type { PrecompileFunc } from './precompiles/types.ts'
|
|
19
|
+
|
|
20
|
+
export type DeleteOpcode = {
|
|
21
|
+
opcode: number
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type AddOpcode = {
|
|
25
|
+
opcode: number
|
|
26
|
+
opcodeName: string
|
|
27
|
+
baseFee: number
|
|
28
|
+
gasFunction?: AsyncDynamicGasHandler | SyncDynamicGasHandler
|
|
29
|
+
logicFunction: OpHandler
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export type SelfdestructMap = Map<PrefixedHexString, PrefixedHexString>
|
|
33
|
+
|
|
34
|
+
export type CustomOpcode = AddOpcode | DeleteOpcode
|
|
35
|
+
|
|
36
|
+
// Typeguard
|
|
37
|
+
export function isAddOpcode(customOpcode: CustomOpcode): customOpcode is AddOpcode {
|
|
38
|
+
return (
|
|
39
|
+
'opcode' in customOpcode &&
|
|
40
|
+
'opcodeName' in customOpcode &&
|
|
41
|
+
'baseFee' in customOpcode &&
|
|
42
|
+
'logicFunction' in customOpcode
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Base options for the `EVM.runCode()` / `EVM.runCall()` method.
|
|
48
|
+
*/
|
|
49
|
+
interface EVMRunOpts {
|
|
50
|
+
/**
|
|
51
|
+
* The `block` the `tx` belongs to. If omitted a default blank block will be used.
|
|
52
|
+
*/
|
|
53
|
+
block?: Block
|
|
54
|
+
/**
|
|
55
|
+
* The gas price for the call. Defaults to `0`
|
|
56
|
+
*/
|
|
57
|
+
gasPrice?: bigint
|
|
58
|
+
/**
|
|
59
|
+
* The address where the call originated from. Defaults to the zero address.
|
|
60
|
+
*/
|
|
61
|
+
origin?: Address
|
|
62
|
+
/**
|
|
63
|
+
* The address that ran this code (`msg.sender`). Defaults to the zero address.
|
|
64
|
+
*/
|
|
65
|
+
caller?: Address
|
|
66
|
+
/**
|
|
67
|
+
* The EVM code to run.
|
|
68
|
+
*/
|
|
69
|
+
code?: Uint8Array
|
|
70
|
+
/**
|
|
71
|
+
* The input data.
|
|
72
|
+
*/
|
|
73
|
+
data?: Uint8Array
|
|
74
|
+
/**
|
|
75
|
+
* The gas limit for the call. Defaults to `16777215` (`0xffffff`)
|
|
76
|
+
*/
|
|
77
|
+
gasLimit?: bigint
|
|
78
|
+
/**
|
|
79
|
+
* The value in ether that is being sent to `opts.address`. Defaults to `0`
|
|
80
|
+
*/
|
|
81
|
+
value?: bigint
|
|
82
|
+
/**
|
|
83
|
+
* The call depth. Defaults to `0`
|
|
84
|
+
*/
|
|
85
|
+
depth?: number
|
|
86
|
+
/**
|
|
87
|
+
* If the call should be executed statically. Defaults to false.
|
|
88
|
+
*/
|
|
89
|
+
isStatic?: boolean
|
|
90
|
+
/**
|
|
91
|
+
* Selfdestructed addresses mapped to their beneficiary. Defaults to the empty map.
|
|
92
|
+
*/
|
|
93
|
+
selfdestruct?: SelfdestructMap
|
|
94
|
+
/**
|
|
95
|
+
* The address of the account that is executing this code (`address(this)`). Defaults to the zero address.
|
|
96
|
+
*/
|
|
97
|
+
to?: Address
|
|
98
|
+
/**
|
|
99
|
+
* Versioned hashes for each blob in a blob transaction
|
|
100
|
+
*/
|
|
101
|
+
blobVersionedHashes?: PrefixedHexString[]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export interface EVMRunCodeOpts extends EVMRunOpts {
|
|
105
|
+
/*
|
|
106
|
+
* The initial program counter. Defaults to `0`
|
|
107
|
+
*/
|
|
108
|
+
pc?: number
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Options for running a call (or create) operation with `EVM.runCall()`
|
|
113
|
+
*/
|
|
114
|
+
export interface EVMRunCallOpts extends EVMRunOpts {
|
|
115
|
+
/**
|
|
116
|
+
* If the code location is a precompile.
|
|
117
|
+
*/
|
|
118
|
+
isCompiled?: boolean
|
|
119
|
+
/**
|
|
120
|
+
* An optional salt to pass to CREATE2.
|
|
121
|
+
*/
|
|
122
|
+
salt?: Uint8Array
|
|
123
|
+
/**
|
|
124
|
+
* Created addresses in current context. Used in EIP 6780
|
|
125
|
+
*/
|
|
126
|
+
createdAddresses?: Set<PrefixedHexString>
|
|
127
|
+
/**
|
|
128
|
+
* Skip balance checks if true. If caller balance is less than message value,
|
|
129
|
+
* sets balance to message value to ensure execution doesn't fail.
|
|
130
|
+
*/
|
|
131
|
+
skipBalance?: boolean
|
|
132
|
+
/**
|
|
133
|
+
* If the call is a DELEGATECALL. Defaults to false.
|
|
134
|
+
*/
|
|
135
|
+
delegatecall?: boolean
|
|
136
|
+
/**
|
|
137
|
+
* Refund counter. Defaults to `0`
|
|
138
|
+
*/
|
|
139
|
+
gasRefund?: bigint
|
|
140
|
+
/**
|
|
141
|
+
* Optionally pass in an already-built message.
|
|
142
|
+
*/
|
|
143
|
+
message?: Message
|
|
144
|
+
|
|
145
|
+
accessWitness?: BinaryTreeAccessWitnessInterface
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
interface NewContractEvent {
|
|
149
|
+
address: Address
|
|
150
|
+
// The deployment code
|
|
151
|
+
code: Uint8Array
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type EVMEvent = {
|
|
155
|
+
newContract: (data: NewContractEvent, resolve?: (result?: any) => void) => void
|
|
156
|
+
beforeMessage: (data: Message, resolve?: (result?: any) => void) => void
|
|
157
|
+
afterMessage: (data: EVMResult, resolve?: (result?: any) => void) => void
|
|
158
|
+
step: (data: InterpreterStep, resolve?: (result?: any) => void) => void
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface EVMInterface {
|
|
162
|
+
common: Common
|
|
163
|
+
journal: {
|
|
164
|
+
commit(): Promise<void>
|
|
165
|
+
revert(): Promise<void>
|
|
166
|
+
checkpoint(): Promise<void>
|
|
167
|
+
cleanJournal(): void
|
|
168
|
+
cleanup(): Promise<void>
|
|
169
|
+
putAccount(address: Address, account: Account): Promise<void>
|
|
170
|
+
deleteAccount(address: Address): Promise<void>
|
|
171
|
+
accessList?: Map<string, Set<string>>
|
|
172
|
+
preimages?: Map<PrefixedHexString, Uint8Array>
|
|
173
|
+
addAlwaysWarmAddress(address: string, addToAccessList?: boolean): void
|
|
174
|
+
addAlwaysWarmSlot(address: string, slot: string, addToAccessList?: boolean): void
|
|
175
|
+
startReportingAccessList(): void
|
|
176
|
+
startReportingPreimages?(): void
|
|
177
|
+
}
|
|
178
|
+
stateManager: StateManagerInterface
|
|
179
|
+
precompiles: Map<string, PrecompileFunc>
|
|
180
|
+
getPrecompile?(address: Address | PrefixedHexString): PrecompileFunc | undefined
|
|
181
|
+
runCall(opts: EVMRunCallOpts): Promise<EVMResult>
|
|
182
|
+
runCode(opts: EVMRunCodeOpts): Promise<ExecResult>
|
|
183
|
+
events?: EventEmitter<EVMEvent>
|
|
184
|
+
binaryTreeAccessWitness?: BinaryTreeAccessWitness
|
|
185
|
+
systemBinaryTreeAccessWitness?: BinaryTreeAccessWitness
|
|
186
|
+
blockLevelAccessList?: BlockLevelAccessList
|
|
187
|
+
frameExecutionContext?: FrameExecutionContext
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
export type EVMProfilerOpts = {
|
|
191
|
+
enabled: boolean
|
|
192
|
+
// extra options here (such as use X hardfork for gas)
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Options for instantiating a {@link EVM}.
|
|
197
|
+
*/
|
|
198
|
+
export interface EVMOpts {
|
|
199
|
+
/**
|
|
200
|
+
* Use a {@link Common} instance for EVM instantiation.
|
|
201
|
+
*
|
|
202
|
+
* ### Supported EIPs
|
|
203
|
+
*
|
|
204
|
+
* - [EIP-1153](https://eips.ethereum.org/EIPS/eip-1153) - Transient storage opcodes (Cancun)
|
|
205
|
+
* - [EIP-1559](https://eips.ethereum.org/EIPS/eip-1559) - Fee market change for ETH 1.0 chain
|
|
206
|
+
* - [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - Precompile for BLS12-381 curve operations (Prague)
|
|
207
|
+
* - [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565) - ModExp gas cost
|
|
208
|
+
* - [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718) - Typed Transaction Envelope
|
|
209
|
+
* - [EIP-2935](https://eips.ethereum.org/EIPS/eip-2935) - Serve historical block hashes from state (Prague)
|
|
210
|
+
* - [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) - gas cost increases for state access opcodes
|
|
211
|
+
* - [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930) - Optional access list tx type
|
|
212
|
+
* - [EIP-3074](https://eips.ethereum.org/EIPS/eip-3074) - AUTH and AUTHCALL opcodes
|
|
213
|
+
* - [EIP-3198](https://eips.ethereum.org/EIPS/eip-3198) - Base fee Opcode
|
|
214
|
+
* - [EIP-3529](https://eips.ethereum.org/EIPS/eip-3529) - Reduction in refunds
|
|
215
|
+
* - [EIP-3541](https://eips.ethereum.org/EIPS/eip-3541) - Reject new contracts starting with the 0xEF byte
|
|
216
|
+
* - [EIP-3554](https://eips.ethereum.org/EIPS/eip-3554) - Difficulty Bomb Delay to December 2021 (only PoW networks)
|
|
217
|
+
* - [EIP-3607](https://eips.ethereum.org/EIPS/eip-3607) - Reject transactions from senders with deployed code
|
|
218
|
+
* - [EIP-3651](https://eips.ethereum.org/EIPS/eip-3651) - Warm COINBASE (Shanghai)
|
|
219
|
+
* - [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675) - Upgrade consensus to Proof-of-Stake
|
|
220
|
+
* - [EIP-3855](https://eips.ethereum.org/EIPS/eip-3855) - Push0 opcode (Shanghai)
|
|
221
|
+
* - [EIP-3860](https://eips.ethereum.org/EIPS/eip-3860) - Limit and meter initcode (Shanghai)
|
|
222
|
+
* - [EIP-4345](https://eips.ethereum.org/EIPS/eip-4345) - Difficulty Bomb Delay to June 2022
|
|
223
|
+
* - [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399) - Supplant DIFFICULTY opcode with PREVRANDAO (Merge)
|
|
224
|
+
* - [EIP-4788](https://eips.ethereum.org/EIPS/eip-4788) - Beacon block root in the EVM (Cancun)
|
|
225
|
+
* - [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) - Shard Blob Transactions (Cancun)
|
|
226
|
+
* - [EIP-4895](https://eips.ethereum.org/EIPS/eip-4895) - Beacon chain push withdrawals as operations (Shanghai)
|
|
227
|
+
* - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022 (Gray Glacier)
|
|
228
|
+
* - [EIP-5656](https://eips.ethereum.org/EIPS/eip-5656) - MCOPY - Memory copying instruction (Cancun)
|
|
229
|
+
* - [EIP-6110](https://eips.ethereum.org/EIPS/eip-6110) - Supply validator deposits on chain (Prague)
|
|
230
|
+
* - [EIP-6780](https://eips.ethereum.org/EIPS/eip-6780) - SELFDESTRUCT only in same transaction (Cancun)
|
|
231
|
+
* - [EIP-7002](https://eips.ethereum.org/EIPS/eip-7002) - Execution layer triggerable exits (Prague)
|
|
232
|
+
* - [EIP-7251](https://eips.ethereum.org/EIPS/eip-7251) - Increase the MAX_EFFECTIVE_BALANCE (Prague)
|
|
233
|
+
* - [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516) - BLOBBASEFEE opcode (Cancun)
|
|
234
|
+
* - [EIP-7623](https://eips.ethereum.org/EIPS/eip-7623) - Increase calldata cost (Prague)
|
|
235
|
+
* - [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685) - General purpose execution layer requests (Prague)
|
|
236
|
+
* - [EIP-7691](https://eips.ethereum.org/EIPS/eip-7691) - Blob throughput increase (Prague)
|
|
237
|
+
* - [EIP-7692](https://eips.ethereum.org/EIPS/eip-7692) - EVM Object Format (EOF) v1 (`experimental`)
|
|
238
|
+
* - [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) - Set EOA account code (Prague)
|
|
239
|
+
* - [EIP-7709](https://eips.ethereum.org/EIPS/eip-7709) - Read BLOCKHASH from storage and update cost (Verkle)
|
|
240
|
+
* - [EIP-7934](https://eips.ethereum.org/EIPS/eip-7934) - RLP Execution Block Size Limit
|
|
241
|
+
*
|
|
242
|
+
* *Annotations:*
|
|
243
|
+
*
|
|
244
|
+
* - `experimental`: behaviour can change on patch versions
|
|
245
|
+
*/
|
|
246
|
+
common?: Common
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Allows unlimited contract sizes while debugging. By setting this to `true`, the check for
|
|
250
|
+
* contract size limit of 24KB (see [EIP-170](https://git.io/vxZkK)) is bypassed.
|
|
251
|
+
*
|
|
252
|
+
* Default: `false` [ONLY set to `true` during debugging]
|
|
253
|
+
*/
|
|
254
|
+
allowUnlimitedContractSize?: boolean
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* Allows unlimited contract code-size init while debugging. This (partially) disables EIP-3860.
|
|
258
|
+
* Gas cost for initcode size analysis will still be charged. Use with caution.
|
|
259
|
+
*/
|
|
260
|
+
allowUnlimitedInitCodeSize?: boolean
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* EVM parameters sorted by EIP can be found in the exported `paramsEVM` dictionary,
|
|
264
|
+
* which is internally passed to the associated `@feelyourprotocol/common` instance which
|
|
265
|
+
* manages parameter selection based on the hardfork and EIP settings.
|
|
266
|
+
*
|
|
267
|
+
* This option allows providing a custom set of parameters. Note that parameters
|
|
268
|
+
* get fully overwritten, so you need to extend the default parameter dict
|
|
269
|
+
* to provide the full parameter set.
|
|
270
|
+
*
|
|
271
|
+
* It is recommended to deep-clone the params object for this to avoid side effects:
|
|
272
|
+
*
|
|
273
|
+
* ```ts
|
|
274
|
+
* const params = JSON.parse(JSON.stringify(paramsEVM))
|
|
275
|
+
* params['1679']['bn254AddGas'] = 100 // 150
|
|
276
|
+
* ```
|
|
277
|
+
*/
|
|
278
|
+
params?: ParamsDict
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Override or add custom opcodes to the EVM instruction set
|
|
282
|
+
* These custom opcodes are EIP-agnostic and are always statically added
|
|
283
|
+
* To delete an opcode, add an entry of format `{opcode: number}`. This will delete that opcode from the EVM.
|
|
284
|
+
* If this opcode is then used in the EVM, the `INVALID` opcode would instead be used.
|
|
285
|
+
* To add an opcode, add an entry of the following format:
|
|
286
|
+
* {
|
|
287
|
+
* // The opcode number which will invoke the custom opcode logic
|
|
288
|
+
* opcode: number
|
|
289
|
+
* // The name of the opcode (as seen in the `step` event)
|
|
290
|
+
* opcodeName: string
|
|
291
|
+
* // The base fee of the opcode
|
|
292
|
+
* baseFee: number
|
|
293
|
+
* // If the opcode charges dynamic gas, add this here. To charge the gas, use the `i` methods of the BN, to update the charged gas
|
|
294
|
+
* gasFunction?: function(runState: RunState, gas: BN, common: Common)
|
|
295
|
+
* // The logic of the opcode which holds the logic of changing the current state
|
|
296
|
+
* logicFunction: function(runState: RunState)
|
|
297
|
+
* }
|
|
298
|
+
* Note: gasFunction and logicFunction can both be async or synchronous functions
|
|
299
|
+
*/
|
|
300
|
+
customOpcodes?: CustomOpcode[]
|
|
301
|
+
|
|
302
|
+
/*
|
|
303
|
+
* Adds custom precompiles. This is hardfork-agnostic: these precompiles are always activated
|
|
304
|
+
* If only an address is given, the precompile is deleted
|
|
305
|
+
* If an address and a `PrecompileFunc` is given, this precompile is inserted or overridden
|
|
306
|
+
* Please ensure `PrecompileFunc` has exactly one parameter `input: PrecompileInput`
|
|
307
|
+
*/
|
|
308
|
+
customPrecompiles?: CustomPrecompile[]
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* For the EIP-2537 BLS Precompiles, the native JS `ethereum-cryptography` (`@noble/curves`)
|
|
312
|
+
* https://github.com/ethereum/js-ethereum-cryptography BLS12-381 curve implementation
|
|
313
|
+
* is used (see `noble.ts` file in the `precompiles/bls12_381/` folder).
|
|
314
|
+
*
|
|
315
|
+
* To use an alternative implementation this option can be used by passing
|
|
316
|
+
* in a wrapper implementation integrating the desired library and adhering
|
|
317
|
+
* to the `EVMBLSInterface` specification.
|
|
318
|
+
*
|
|
319
|
+
* An interface for the MCL WASM implementation https://github.com/herumi/mcl-wasm
|
|
320
|
+
* is shipped with this library which can be used as follows (with `mcl-wasm` being
|
|
321
|
+
* explicitly added to the set of dependencies):
|
|
322
|
+
*
|
|
323
|
+
* ```ts
|
|
324
|
+
* import * as mcl from 'mcl-wasm'
|
|
325
|
+
*
|
|
326
|
+
* await mcl.init(mcl.BLS12_381)
|
|
327
|
+
* const evm = await createEVM({ bls: new MCLBLS(mcl) })
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
bls?: EVMBLSInterface
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* For the EIP-196/EIP-197 BN254 (alt_BN128) EC precompiles, the native JS `ethereum-cryptography`
|
|
334
|
+
* (`@noble/curves`) https://github.com/ethereum/js-ethereum-cryptography BN254 curve implementation
|
|
335
|
+
* is used (see `noble.ts` file in the `precompiles/bn254/` folder).
|
|
336
|
+
*
|
|
337
|
+
* To use an alternative implementation this option can be used by passing
|
|
338
|
+
* in a wrapper implementation integrating the desired library and adhering
|
|
339
|
+
* to the `EVMBN254Interface` specification.
|
|
340
|
+
*
|
|
341
|
+
* An interface for a WASM wrapper https://github.com/ethereumjs/rustbn.js around the
|
|
342
|
+
* Parity fork of the Zcash bn pairing cryptography library is shipped with this library
|
|
343
|
+
* which can be used as follows (with `rustbn.js` being explicitly added to the set of
|
|
344
|
+
* dependencies):
|
|
345
|
+
*
|
|
346
|
+
* ```ts
|
|
347
|
+
* import { initRustBN } from 'rustbn-wasm'
|
|
348
|
+
*
|
|
349
|
+
* const bn254 = await initRustBN()
|
|
350
|
+
* const evm = await createEVM({ bn254: new RustBN254(bn254) })
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
bn254?: EVMBN254Interface
|
|
354
|
+
|
|
355
|
+
/*
|
|
356
|
+
* The EVM comes with a basic dependency-minimized `SimpleStateManager` implementation
|
|
357
|
+
* which serves most code execution use cases and which is included in the
|
|
358
|
+
* `@feelyourprotocol/statemanager` package.
|
|
359
|
+
*
|
|
360
|
+
* The `@feelyourprotocol/statemanager` package also provides a variety of state manager
|
|
361
|
+
* implementations for different needs (MPT-tree backed, RPC, experimental binary tree)
|
|
362
|
+
* which can be used by this option as a replacement.
|
|
363
|
+
*/
|
|
364
|
+
stateManager?: StateManagerInterface
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* The EVM comes with a basic mock blockchain interface and implementation for
|
|
368
|
+
* non-block containing use cases.
|
|
369
|
+
*
|
|
370
|
+
* For block-containing setups use the full blockchain implementation from the
|
|
371
|
+
* `@feelyourprotocol/blockchain package.
|
|
372
|
+
*/
|
|
373
|
+
blockchain?: EVMMockBlockchainInterface
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
*
|
|
377
|
+
*/
|
|
378
|
+
profiler?: EVMProfilerOpts
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* If EIP-7928 is activated, a block-level access list can be provided here.
|
|
382
|
+
* If not provided, a new one will be created if EIP-7928 is activated
|
|
383
|
+
*/
|
|
384
|
+
blockLevelAccessList?: BlockLevelAccessList
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* When running the EVM with PoA consensus, the `cliqueSigner` function from the `@feelyourprotocol/block` class
|
|
388
|
+
* must be provided along with a `BlockHeader` so that the coinbase can be correctly retrieved when the
|
|
389
|
+
* `Interpreter.getBlockCoinbase` method is called.
|
|
390
|
+
*/
|
|
391
|
+
cliqueSigner?: (header: Block['header']) => Address
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* Result of executing a message via the {@link EVM}.
|
|
396
|
+
*/
|
|
397
|
+
export interface EVMResult {
|
|
398
|
+
/**
|
|
399
|
+
* Address of created account during transaction, if any
|
|
400
|
+
*/
|
|
401
|
+
createdAddress?: Address
|
|
402
|
+
/**
|
|
403
|
+
* Contains the results from running the code, if any, as described in {@link runCode}
|
|
404
|
+
*/
|
|
405
|
+
execResult: ExecResult
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
/**
|
|
409
|
+
* Result of executing a call via the {@link EVM}.
|
|
410
|
+
*/
|
|
411
|
+
export interface ExecResult {
|
|
412
|
+
runState?: RunState
|
|
413
|
+
/**
|
|
414
|
+
* Description of the exception, if any occurred
|
|
415
|
+
*/
|
|
416
|
+
exceptionError?: EVMError
|
|
417
|
+
/**
|
|
418
|
+
* Amount of gas left
|
|
419
|
+
*/
|
|
420
|
+
gas?: bigint
|
|
421
|
+
/**
|
|
422
|
+
* Amount of gas the code used to run
|
|
423
|
+
*/
|
|
424
|
+
executionGasUsed: bigint
|
|
425
|
+
/**
|
|
426
|
+
* Return value from the contract
|
|
427
|
+
*/
|
|
428
|
+
returnValue: Uint8Array
|
|
429
|
+
/**
|
|
430
|
+
* Array of logs that the contract emitted
|
|
431
|
+
*/
|
|
432
|
+
logs?: Log[]
|
|
433
|
+
/**
|
|
434
|
+
* Selfdestructed accounts mapped to their beneficiary
|
|
435
|
+
*/
|
|
436
|
+
selfdestruct?: SelfdestructMap
|
|
437
|
+
/**
|
|
438
|
+
* Map of addresses which were created (used in EIP 6780)
|
|
439
|
+
*/
|
|
440
|
+
createdAddresses?: Set<PrefixedHexString>
|
|
441
|
+
/**
|
|
442
|
+
* The gas refund counter
|
|
443
|
+
*/
|
|
444
|
+
gasRefund?: bigint
|
|
445
|
+
/**
|
|
446
|
+
* Amount of blob gas consumed by the transaction
|
|
447
|
+
*/
|
|
448
|
+
blobGasUsed?: bigint
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* High level wrapper for BLS libraries used
|
|
453
|
+
* for the BLS precompiles
|
|
454
|
+
*/
|
|
455
|
+
export type EVMBLSInterface = {
|
|
456
|
+
init?(): void
|
|
457
|
+
addG1(input: Uint8Array): Uint8Array
|
|
458
|
+
addG2(input: Uint8Array): Uint8Array
|
|
459
|
+
mapFPtoG1(input: Uint8Array): Uint8Array
|
|
460
|
+
mapFP2toG2(input: Uint8Array): Uint8Array
|
|
461
|
+
msmG1(input: Uint8Array): Uint8Array
|
|
462
|
+
msmG2(input: Uint8Array): Uint8Array
|
|
463
|
+
pairingCheck(input: Uint8Array): Uint8Array
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* High level wrapper for BN254 (alt_BN128) libraries
|
|
468
|
+
* used for the BN254 (alt_BN128) EC precompiles
|
|
469
|
+
*/
|
|
470
|
+
export type EVMBN254Interface = {
|
|
471
|
+
add: (input: Uint8Array) => Uint8Array
|
|
472
|
+
mul: (input: Uint8Array) => Uint8Array
|
|
473
|
+
pairing: (input: Uint8Array) => Uint8Array
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Log that the contract emits.
|
|
478
|
+
*/
|
|
479
|
+
export type Log = [address: Uint8Array, topics: Uint8Array[], data: Uint8Array]
|
|
480
|
+
|
|
481
|
+
export type Block = {
|
|
482
|
+
header: {
|
|
483
|
+
number: bigint
|
|
484
|
+
coinbase: Address
|
|
485
|
+
timestamp: bigint
|
|
486
|
+
difficulty: bigint
|
|
487
|
+
prevRandao: Uint8Array
|
|
488
|
+
gasLimit: bigint
|
|
489
|
+
baseFeePerGas?: bigint
|
|
490
|
+
slotNumber?: bigint
|
|
491
|
+
getBlobGasPrice(): bigint | undefined
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export interface TransientStorageInterface {
|
|
496
|
+
get(addr: Address, key: Uint8Array): Uint8Array
|
|
497
|
+
put(addr: Address, key: Uint8Array, value: Uint8Array): void
|
|
498
|
+
commit(): void
|
|
499
|
+
checkpoint(): void
|
|
500
|
+
revert(): void
|
|
501
|
+
toJSON(): { [address: string]: { [key: string]: string } }
|
|
502
|
+
clear(): void
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
export type EVMMockBlock = {
|
|
506
|
+
hash(): Uint8Array
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export interface EVMMockBlockchainInterface {
|
|
510
|
+
getBlock(blockId: number): Promise<EVMMockBlock>
|
|
511
|
+
putBlock(block: EVMMockBlock): Promise<void>
|
|
512
|
+
shallowCopy(): EVMMockBlockchainInterface
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export class EVMMockBlockchain implements EVMMockBlockchainInterface {
|
|
516
|
+
async getBlock() {
|
|
517
|
+
return {
|
|
518
|
+
hash() {
|
|
519
|
+
return new Uint8Array(32)
|
|
520
|
+
},
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
async putBlock() {}
|
|
524
|
+
shallowCopy() {
|
|
525
|
+
return this
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// EOF type which holds the execution-related data for EOF
|
|
530
|
+
export type EOFEnv = {
|
|
531
|
+
container: EOFContainer
|
|
532
|
+
eofRunState: {
|
|
533
|
+
returnStack: number[]
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
|
|
537
|
+
// EIP-7702 flag: if contract code starts with these 3 bytes, it is a 7702-delegated EOA
|
|
538
|
+
export const DELEGATION_7702_FLAG = new Uint8Array([0xef, 0x01, 0x00])
|