@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,1054 @@
|
|
|
1
|
+
import { ConsensusAlgorithm } from '@feelyourprotocol/common';
|
|
2
|
+
import { Account, BIGINT_0, BIGINT_1, BIGINT_2, EthereumJSErrorWithoutCode, MAX_UINT64, bigIntToBytes, bigIntToHex, bytesToBigInt, bytesToHex, equalsBytes, setLengthLeft, setLengthRight, } from '@feelyourprotocol/util';
|
|
3
|
+
import debugDefault from 'debug';
|
|
4
|
+
import { EIP7708_SELFDESTRUCT_TOPIC, EIP7708_SYSTEM_ADDRESS, EIP7708_TRANSFER_TOPIC, } from "./eip7708.js";
|
|
5
|
+
import { FORMAT, MAGIC, VERSION } from "./eof/constants.js";
|
|
6
|
+
import { EOFContainerMode, validateEOF } from "./eof/container.js";
|
|
7
|
+
import { setupEOF } from "./eof/setup.js";
|
|
8
|
+
import { ContainerSectionType } from "./eof/verify.js";
|
|
9
|
+
import { EVMError, EVMErrorTypeString } from "./errors.js";
|
|
10
|
+
import {} from "./logger.js";
|
|
11
|
+
import { Memory } from "./memory.js";
|
|
12
|
+
import { Message } from "./message.js";
|
|
13
|
+
import { trap } from "./opcodes/index.js";
|
|
14
|
+
import { isEIP8024PairImmediateValid, isEIP8024SingleImmediateValid } from "./opcodes/util.js";
|
|
15
|
+
import { Stack } from "./stack.js";
|
|
16
|
+
import { stackDelta } from "./eof/stackDelta.js";
|
|
17
|
+
const debugGas = debugDefault('evm:gas');
|
|
18
|
+
/**
|
|
19
|
+
* Parses and executes EVM bytecode.
|
|
20
|
+
*/
|
|
21
|
+
export class Interpreter {
|
|
22
|
+
// TODO remove gasLeft as constructor argument
|
|
23
|
+
constructor(evm, stateManager, blockchain, env, gasLeft, journal, performanceLogs, profilerOpts) {
|
|
24
|
+
// Opcode debuggers (e.g. { 'push': [debug Object], 'sstore': [debug Object], ...})
|
|
25
|
+
this.opDebuggers = {};
|
|
26
|
+
this._evm = evm;
|
|
27
|
+
this._stateManager = stateManager;
|
|
28
|
+
this.common = this._evm.common;
|
|
29
|
+
if (this.common.consensusType() === 'poa' &&
|
|
30
|
+
this._evm['_optsCached'].cliqueSigner === undefined)
|
|
31
|
+
throw EthereumJSErrorWithoutCode('Must include cliqueSigner function if clique/poa is being used for consensus type');
|
|
32
|
+
this._runState = {
|
|
33
|
+
programCounter: 0,
|
|
34
|
+
opCode: 0xfe, // INVALID opcode
|
|
35
|
+
memory: new Memory(),
|
|
36
|
+
memoryWordCount: BIGINT_0,
|
|
37
|
+
highestMemCost: BIGINT_0,
|
|
38
|
+
stack: new Stack(),
|
|
39
|
+
code: new Uint8Array(0),
|
|
40
|
+
validJumps: Uint8Array.from([]),
|
|
41
|
+
cachedPushes: {},
|
|
42
|
+
stateManager: this._stateManager,
|
|
43
|
+
blockchain,
|
|
44
|
+
env,
|
|
45
|
+
shouldDoJumpAnalysis: true,
|
|
46
|
+
interpreter: this,
|
|
47
|
+
gasRefund: env.gasRefund,
|
|
48
|
+
gasLeft,
|
|
49
|
+
returnBytes: new Uint8Array(0),
|
|
50
|
+
};
|
|
51
|
+
this.journal = journal;
|
|
52
|
+
this._env = env;
|
|
53
|
+
this._result = {
|
|
54
|
+
logs: env.initialLogs ? [...env.initialLogs] : [],
|
|
55
|
+
returnValue: undefined,
|
|
56
|
+
selfdestruct: new Map(),
|
|
57
|
+
};
|
|
58
|
+
this.profilerOpts = profilerOpts;
|
|
59
|
+
this.performanceLogger = performanceLogs;
|
|
60
|
+
}
|
|
61
|
+
async run(code, opts = {}) {
|
|
62
|
+
if (!this.common.isActivatedEIP(3540) || code[0] !== FORMAT) {
|
|
63
|
+
// EIP-3540 isn't active and first byte is not 0xEF - treat as legacy bytecode
|
|
64
|
+
this._runState.code = code;
|
|
65
|
+
}
|
|
66
|
+
else if (this.common.isActivatedEIP(3540)) {
|
|
67
|
+
if (code[1] !== MAGIC) {
|
|
68
|
+
// Bytecode contains invalid EOF magic byte
|
|
69
|
+
return {
|
|
70
|
+
runState: this._runState,
|
|
71
|
+
exceptionError: new EVMError(EVMError.errorMessages.INVALID_BYTECODE_RESULT),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (code[2] !== VERSION) {
|
|
75
|
+
// Bytecode contains invalid EOF version number
|
|
76
|
+
return {
|
|
77
|
+
runState: this._runState,
|
|
78
|
+
exceptionError: new EVMError(EVMError.errorMessages.INVALID_EOF_FORMAT),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
this._runState.code = code;
|
|
82
|
+
const isTxCreate = this._env.isCreate && this._env.depth === 0;
|
|
83
|
+
const eofMode = isTxCreate ? EOFContainerMode.TxInitmode : EOFContainerMode.Default;
|
|
84
|
+
try {
|
|
85
|
+
setupEOF(this._runState, eofMode);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return {
|
|
89
|
+
runState: this._runState,
|
|
90
|
+
exceptionError: new EVMError(EVMError.errorMessages.INVALID_EOF_FORMAT), // TODO: verify if all gas should be consumed
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
if (isTxCreate) {
|
|
94
|
+
// Tx tries to deploy container
|
|
95
|
+
try {
|
|
96
|
+
validateEOF(this._runState.code, this._evm, ContainerSectionType.InitCode, EOFContainerMode.TxInitmode);
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
// Trying to deploy an invalid EOF container
|
|
100
|
+
return {
|
|
101
|
+
runState: this._runState,
|
|
102
|
+
exceptionError: new EVMError(EVMError.errorMessages.INVALID_EOF_FORMAT), // TODO: verify if all gas should be consumed
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
this._runState.programCounter = opts.pc ?? this._runState.programCounter;
|
|
108
|
+
// Check that the programCounter is in range
|
|
109
|
+
const pc = this._runState.programCounter;
|
|
110
|
+
if (pc !== 0 && (pc < 0 || pc >= this._runState.code.length)) {
|
|
111
|
+
throw EthereumJSErrorWithoutCode('Internal error: program counter not in range');
|
|
112
|
+
}
|
|
113
|
+
let err;
|
|
114
|
+
let cachedOpcodes;
|
|
115
|
+
let doJumpAnalysis = true;
|
|
116
|
+
let timer;
|
|
117
|
+
let overheadTimer;
|
|
118
|
+
if (this.profilerOpts?.enabled === true && this.performanceLogger.hasTimer()) {
|
|
119
|
+
timer = this.performanceLogger.pauseTimer();
|
|
120
|
+
overheadTimer = this.performanceLogger.startTimer('Overhead');
|
|
121
|
+
}
|
|
122
|
+
// Iterate through the given ops until something breaks or we hit STOP
|
|
123
|
+
while (this._runState.programCounter < this._runState.code.length) {
|
|
124
|
+
const programCounter = this._runState.programCounter;
|
|
125
|
+
let opCode;
|
|
126
|
+
let opCodeObj;
|
|
127
|
+
if (doJumpAnalysis) {
|
|
128
|
+
opCode = this._runState.code[programCounter];
|
|
129
|
+
// Only run the jump destination analysis if `code` actually contains a JUMP/JUMPI/JUMPSUB opcode
|
|
130
|
+
if (opCode === 0x56 || opCode === 0x57 || opCode === 0x5e) {
|
|
131
|
+
const { jumps, pushes, opcodesCached } = this._getValidJumpDestinations(this._runState.code);
|
|
132
|
+
this._runState.validJumps = jumps;
|
|
133
|
+
this._runState.cachedPushes = pushes;
|
|
134
|
+
this._runState.shouldDoJumpAnalysis = false;
|
|
135
|
+
cachedOpcodes = opcodesCached;
|
|
136
|
+
doJumpAnalysis = false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
opCodeObj = cachedOpcodes[programCounter];
|
|
141
|
+
opCode = opCodeObj.opcodeInfo.code;
|
|
142
|
+
}
|
|
143
|
+
// if its an invalid opcode with binary activated, then check if its because of a missing code
|
|
144
|
+
// chunk in the witness, and throw appropriate error to distinguish from an actual invalid opcode
|
|
145
|
+
if (opCode === 0xfe &&
|
|
146
|
+
this.common.isActivatedEIP(7864) &&
|
|
147
|
+
// is this a code loaded from state using witnesses
|
|
148
|
+
this._runState.env.chargeCodeAccesses === true) {
|
|
149
|
+
const contract = this._runState.interpreter.getAddress();
|
|
150
|
+
if (!(await this._runState.stateManager.checkChunkWitnessPresent(contract, programCounter))) {
|
|
151
|
+
throw Error(`Invalid witness with missing codeChunk for pc=${programCounter}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
this._runState.opCode = opCode;
|
|
155
|
+
try {
|
|
156
|
+
if (overheadTimer !== undefined) {
|
|
157
|
+
this.performanceLogger.pauseTimer();
|
|
158
|
+
}
|
|
159
|
+
await this.runStep(opCodeObj);
|
|
160
|
+
if (overheadTimer !== undefined) {
|
|
161
|
+
this.performanceLogger.unpauseTimer(overheadTimer);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
// Revert access witness changes if we revert - per EIP-4762
|
|
166
|
+
this._runState.env.accessWitness?.revert();
|
|
167
|
+
if (overheadTimer !== undefined) {
|
|
168
|
+
this.performanceLogger.unpauseTimer(overheadTimer);
|
|
169
|
+
}
|
|
170
|
+
// re-throw on non-VM errors
|
|
171
|
+
if (!('errorType' in e && e.errorType === EVMErrorTypeString)) {
|
|
172
|
+
throw e;
|
|
173
|
+
}
|
|
174
|
+
// STOP is not an exception
|
|
175
|
+
if (e.error !== EVMError.errorMessages.STOP) {
|
|
176
|
+
err = e;
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (timer !== undefined) {
|
|
182
|
+
this.performanceLogger.stopTimer(overheadTimer, 0);
|
|
183
|
+
this.performanceLogger.unpauseTimer(timer);
|
|
184
|
+
}
|
|
185
|
+
return {
|
|
186
|
+
runState: this._runState,
|
|
187
|
+
exceptionError: err,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Executes the opcode to which the program counter is pointing,
|
|
192
|
+
* reducing its base gas cost, and increments the program counter.
|
|
193
|
+
*/
|
|
194
|
+
async runStep(opcodeObj) {
|
|
195
|
+
const opEntry = opcodeObj ?? this.lookupOpInfo(this._runState.opCode);
|
|
196
|
+
const opInfo = opEntry.opcodeInfo;
|
|
197
|
+
let timer;
|
|
198
|
+
if (this.profilerOpts?.enabled === true) {
|
|
199
|
+
timer = this.performanceLogger.startTimer(opInfo.name);
|
|
200
|
+
}
|
|
201
|
+
let gas = opInfo.feeBigInt;
|
|
202
|
+
// Cache pre-gas memory size if doing tracing (EIP-7756)
|
|
203
|
+
const memorySizeCache = this._runState.memoryWordCount;
|
|
204
|
+
try {
|
|
205
|
+
if (opInfo.dynamicGas) {
|
|
206
|
+
// This function updates the gas in-place.
|
|
207
|
+
// It needs the base fee, for correct gas limit calculation for the CALL opcodes
|
|
208
|
+
gas = await opEntry.gasHandler(this._runState, gas, this.common);
|
|
209
|
+
}
|
|
210
|
+
if (this._evm.events.listenerCount('step') > 0 || this._evm.DEBUG) {
|
|
211
|
+
// Only run this stepHook function if there is an event listener (e.g. test runner)
|
|
212
|
+
// or if the vm is running in debug mode (to display opcode debug logs)
|
|
213
|
+
await this._runStepHook(gas, this.getGasLeft(), memorySizeCache);
|
|
214
|
+
}
|
|
215
|
+
if ((this.common.isActivatedEIP(6800) || this.common.isActivatedEIP(7864)) &&
|
|
216
|
+
this._env.chargeCodeAccesses === true) {
|
|
217
|
+
const contract = this._runState.interpreter.getAddress();
|
|
218
|
+
const statelessGas = this._runState.env.accessWitness.readAccountCodeChunks(contract, this._runState.programCounter, this._runState.programCounter);
|
|
219
|
+
gas += statelessGas;
|
|
220
|
+
debugGas(`codechunk accessed statelessGas=${statelessGas} (-> ${gas})`);
|
|
221
|
+
}
|
|
222
|
+
// Check for invalid opcode
|
|
223
|
+
if (opInfo.isInvalid) {
|
|
224
|
+
throw new EVMError(EVMError.errorMessages.INVALID_OPCODE);
|
|
225
|
+
}
|
|
226
|
+
// Reduce opcode's base fee
|
|
227
|
+
this.useGas(gas, opInfo);
|
|
228
|
+
// Advance program counter
|
|
229
|
+
this._runState.programCounter++;
|
|
230
|
+
// Execute opcode handler
|
|
231
|
+
const opFn = opEntry.opHandler;
|
|
232
|
+
if (opInfo.isAsync) {
|
|
233
|
+
await opFn.apply(null, [this._runState, this.common]);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
opFn.apply(null, [this._runState, this.common]);
|
|
237
|
+
}
|
|
238
|
+
this._runState.env.accessWitness?.commit();
|
|
239
|
+
}
|
|
240
|
+
finally {
|
|
241
|
+
if (this.profilerOpts?.enabled === true) {
|
|
242
|
+
this.performanceLogger.stopTimer(timer, Number(gas), 'opcodes', opInfo.fee, Number(gas) - opInfo.fee);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Get info for an opcode from EVM's list of opcodes.
|
|
248
|
+
*/
|
|
249
|
+
lookupOpInfo(op) {
|
|
250
|
+
return this._evm['_opcodeMap'][op];
|
|
251
|
+
}
|
|
252
|
+
async _runStepHook(dynamicFee, gasLeft, memorySize) {
|
|
253
|
+
const opcodeInfo = this.lookupOpInfo(this._runState.opCode).opcodeInfo;
|
|
254
|
+
const section = this._env.eof?.container.header.getSectionFromProgramCounter(this._runState.programCounter);
|
|
255
|
+
let error = undefined;
|
|
256
|
+
let immediate = undefined;
|
|
257
|
+
if (opcodeInfo.code === 0xfd) {
|
|
258
|
+
// If opcode is REVERT, read error data and return in trace
|
|
259
|
+
const [offset, length] = this._runState.stack.peek(2);
|
|
260
|
+
error = new Uint8Array(0);
|
|
261
|
+
if (length !== BIGINT_0) {
|
|
262
|
+
error = this._runState.memory.read(Number(offset), Number(length));
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
// Add immediate if present (i.e. bytecode parameter for a preceding opcode like (RJUMP 01 - jumps to PC 1))
|
|
266
|
+
if (stackDelta[opcodeInfo.code] !== undefined &&
|
|
267
|
+
stackDelta[opcodeInfo.code].intermediates > 0) {
|
|
268
|
+
immediate = this._runState.code.slice(this._runState.programCounter + 1, // immediates start "immediately" following current opcode
|
|
269
|
+
this._runState.programCounter + 1 + stackDelta[opcodeInfo.code].intermediates);
|
|
270
|
+
}
|
|
271
|
+
// Create event object for step
|
|
272
|
+
const eventObj = {
|
|
273
|
+
pc: this._runState.programCounter,
|
|
274
|
+
gasLeft,
|
|
275
|
+
gasRefund: this._runState.gasRefund,
|
|
276
|
+
opcode: {
|
|
277
|
+
name: opcodeInfo.fullName,
|
|
278
|
+
fee: opcodeInfo.fee,
|
|
279
|
+
dynamicFee,
|
|
280
|
+
isAsync: opcodeInfo.isAsync,
|
|
281
|
+
code: opcodeInfo.code,
|
|
282
|
+
},
|
|
283
|
+
stack: this._runState.stack.getStack(),
|
|
284
|
+
depth: this._env.depth,
|
|
285
|
+
address: this._env.address,
|
|
286
|
+
account: this._env.contract,
|
|
287
|
+
memory: this._runState.memory._store.subarray(0, Number(memorySize) * 32),
|
|
288
|
+
memoryWordCount: memorySize,
|
|
289
|
+
codeAddress: this._env.codeAddress,
|
|
290
|
+
stateManager: this._runState.stateManager,
|
|
291
|
+
eofSection: section,
|
|
292
|
+
immediate,
|
|
293
|
+
error,
|
|
294
|
+
eofFunctionDepth: this._env.eof !== undefined ? this._env.eof?.eofRunState.returnStack.length + 1 : undefined,
|
|
295
|
+
};
|
|
296
|
+
if (this._evm.DEBUG) {
|
|
297
|
+
// Create opTrace for debug functionality
|
|
298
|
+
let hexStack = [];
|
|
299
|
+
hexStack = eventObj.stack.map((item) => {
|
|
300
|
+
return bigIntToHex(BigInt(item));
|
|
301
|
+
});
|
|
302
|
+
const name = eventObj.opcode.name;
|
|
303
|
+
const opTrace = {
|
|
304
|
+
pc: eventObj.pc,
|
|
305
|
+
op: name,
|
|
306
|
+
gas: bigIntToHex(eventObj.gasLeft),
|
|
307
|
+
gasCost: bigIntToHex(dynamicFee),
|
|
308
|
+
stack: hexStack,
|
|
309
|
+
depth: eventObj.depth,
|
|
310
|
+
};
|
|
311
|
+
if (!(name in this.opDebuggers)) {
|
|
312
|
+
this.opDebuggers[name] = debugDefault(`evm:ops:${name}`);
|
|
313
|
+
}
|
|
314
|
+
this.opDebuggers[name](JSON.stringify(opTrace));
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* The `step` event for trace output
|
|
318
|
+
*
|
|
319
|
+
* @event Event: step
|
|
320
|
+
* @type {Object}
|
|
321
|
+
* @property {Number} pc representing the program counter
|
|
322
|
+
* @property {Object} opcode the next opcode to be ran
|
|
323
|
+
* @property {string} opcode.name
|
|
324
|
+
* @property {fee} opcode.number Base fee of the opcode
|
|
325
|
+
* @property {dynamicFee} opcode.dynamicFee Dynamic opcode fee
|
|
326
|
+
* @property {boolean} opcode.isAsync opcode is async
|
|
327
|
+
* @property {number} opcode.code opcode code
|
|
328
|
+
* @property {BigInt} gasLeft amount of gasLeft
|
|
329
|
+
* @property {BigInt} gasRefund gas refund
|
|
330
|
+
* @property {StateManager} stateManager a {@link StateManager} instance
|
|
331
|
+
* @property {Array} stack an `Array` of `Uint8Arrays` containing the stack
|
|
332
|
+
* @property {Array} returnStack the return stack
|
|
333
|
+
* @property {Account} account the Account which owns the code running
|
|
334
|
+
* @property {Address} address the address of the `account`
|
|
335
|
+
* @property {Number} depth the current number of calls deep the contract is
|
|
336
|
+
* @property {Uint8Array} memory the memory of the EVM as a `Uint8Array`
|
|
337
|
+
* @property {BigInt} memoryWordCount current size of memory in words
|
|
338
|
+
* @property {Address} codeAddress the address of the code which is currently being ran (this differs from `address` in a `DELEGATECALL` and `CALLCODE` call)
|
|
339
|
+
* @property {number} eofSection the current EOF code section referenced by the PC
|
|
340
|
+
* @property {Uint8Array} immediate the immediate argument of the opcode
|
|
341
|
+
* @property {Uint8Array} error the error data of the opcode (only present for REVERT)
|
|
342
|
+
* @property {number} eofFunctionDepth the depth of the function call (only present for EOF)
|
|
343
|
+
* @property {Array} storage an array of tuples, where each tuple contains a storage key and value
|
|
344
|
+
*/
|
|
345
|
+
await this._evm['_emit']('step', eventObj);
|
|
346
|
+
}
|
|
347
|
+
// Returns all valid jump and jumpsub destinations.
|
|
348
|
+
_getValidJumpDestinations(code) {
|
|
349
|
+
const jumps = new Uint8Array(code.length);
|
|
350
|
+
const pushes = {};
|
|
351
|
+
const opcodesCached = Array(code.length);
|
|
352
|
+
for (let i = 0; i < code.length; i++) {
|
|
353
|
+
const opcode = code[i];
|
|
354
|
+
opcodesCached[i] = this.lookupOpInfo(opcode);
|
|
355
|
+
// skip over PUSH0-32 since no jump destinations in the middle of a push block
|
|
356
|
+
if (opcode <= 0x7f) {
|
|
357
|
+
if (opcode >= 0x60) {
|
|
358
|
+
const bytesToPush = opcode - 0x5f;
|
|
359
|
+
let pushBytes = code.subarray(i + 1, i + opcode - 0x5e);
|
|
360
|
+
if (pushBytes.length < bytesToPush) {
|
|
361
|
+
pushBytes = setLengthRight(pushBytes, bytesToPush);
|
|
362
|
+
}
|
|
363
|
+
const push = bytesToBigInt(pushBytes);
|
|
364
|
+
pushes[i + 1] = push;
|
|
365
|
+
i += bytesToPush;
|
|
366
|
+
}
|
|
367
|
+
else if (opcode === 0x5b) {
|
|
368
|
+
// Define a JUMPDEST as a 1 in the valid jumps array
|
|
369
|
+
jumps[i] = 1;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
else if (this.common.isActivatedEIP(8024) &&
|
|
373
|
+
(opcode === 0xe6 || opcode === 0xe7 || opcode === 0xe8)) {
|
|
374
|
+
const immediate = code[i + 1];
|
|
375
|
+
if (immediate === undefined) {
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
378
|
+
const skipImmediate = opcode === 0xe8
|
|
379
|
+
? isEIP8024PairImmediateValid(immediate)
|
|
380
|
+
: isEIP8024SingleImmediateValid(immediate);
|
|
381
|
+
if (skipImmediate === true) {
|
|
382
|
+
i++;
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
return { jumps, pushes, opcodesCached };
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Subtracts an amount from the gas counter.
|
|
390
|
+
* @param amount - Amount of gas to consume
|
|
391
|
+
* @param context - Usage context for debugging
|
|
392
|
+
* @throws if out of gas
|
|
393
|
+
*/
|
|
394
|
+
useGas(amount, context) {
|
|
395
|
+
this._runState.gasLeft -= amount;
|
|
396
|
+
if (this._evm.DEBUG) {
|
|
397
|
+
let tempString = '';
|
|
398
|
+
if (typeof context === 'string') {
|
|
399
|
+
tempString = context + ': ';
|
|
400
|
+
}
|
|
401
|
+
else if (context !== undefined) {
|
|
402
|
+
tempString = `${context.name} fee: `;
|
|
403
|
+
}
|
|
404
|
+
debugGas(`${tempString}used ${amount} gas (-> ${this._runState.gasLeft})`);
|
|
405
|
+
}
|
|
406
|
+
if (this._runState.gasLeft < BIGINT_0) {
|
|
407
|
+
this._runState.gasLeft = BIGINT_0;
|
|
408
|
+
trap(EVMError.errorMessages.OUT_OF_GAS);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Adds a positive amount to the gas counter.
|
|
413
|
+
* @param amount - Amount of gas refunded
|
|
414
|
+
* @param context - Usage context for debugging
|
|
415
|
+
*/
|
|
416
|
+
refundGas(amount, context) {
|
|
417
|
+
if (this._evm.DEBUG) {
|
|
418
|
+
debugGas(`${typeof context === 'string' ? context + ': ' : ''}refund ${amount} gas (-> ${this._runState.gasRefund})`);
|
|
419
|
+
}
|
|
420
|
+
this._runState.gasRefund += amount;
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Reduces amount of gas to be refunded by a positive value.
|
|
424
|
+
* @param amount - Amount to subtract from gas refunds
|
|
425
|
+
* @param context - Usage context for debugging
|
|
426
|
+
*/
|
|
427
|
+
subRefund(amount, context) {
|
|
428
|
+
if (this._evm.DEBUG) {
|
|
429
|
+
debugGas(`${typeof context === 'string' ? context + ': ' : ''}sub gas refund ${amount} (-> ${this._runState.gasRefund})`);
|
|
430
|
+
}
|
|
431
|
+
this._runState.gasRefund -= amount;
|
|
432
|
+
if (this._runState.gasRefund < BIGINT_0) {
|
|
433
|
+
this._runState.gasRefund = BIGINT_0;
|
|
434
|
+
trap(EVMError.errorMessages.REFUND_EXHAUSTED);
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Increments the internal gasLeft counter. Used for adding callStipend.
|
|
439
|
+
* @param amount - Amount to add
|
|
440
|
+
*/
|
|
441
|
+
addStipend(amount) {
|
|
442
|
+
if (this._evm.DEBUG) {
|
|
443
|
+
debugGas(`add stipend ${amount} (-> ${this._runState.gasLeft})`);
|
|
444
|
+
}
|
|
445
|
+
this._runState.gasLeft += amount;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* Returns balance of the given account.
|
|
449
|
+
* @param address - Address of account
|
|
450
|
+
*/
|
|
451
|
+
async getExternalBalance(address) {
|
|
452
|
+
// Track address access for EIP-7928 BAL
|
|
453
|
+
if (this._evm.common.isActivatedEIP(7928)) {
|
|
454
|
+
this._evm.blockLevelAccessList?.addAddress(address.toString());
|
|
455
|
+
}
|
|
456
|
+
// shortcut if current account
|
|
457
|
+
if (address.equals(this._env.address)) {
|
|
458
|
+
return this._env.contract.balance;
|
|
459
|
+
}
|
|
460
|
+
let account = await this._stateManager.getAccount(address);
|
|
461
|
+
if (!account) {
|
|
462
|
+
account = new Account();
|
|
463
|
+
}
|
|
464
|
+
return account.balance;
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Store 256-bit a value in memory to persistent storage.
|
|
468
|
+
*/
|
|
469
|
+
async storageStore(key, value) {
|
|
470
|
+
// EIP-7928: Get the original (pre-transaction) value BEFORE storing
|
|
471
|
+
// This is needed to detect no-op writes (where new value equals original value)
|
|
472
|
+
let originalValue;
|
|
473
|
+
if (this._evm.common.isActivatedEIP(7928)) {
|
|
474
|
+
originalValue = await this._stateManager.originalStorageCache.get(this._env.address, key);
|
|
475
|
+
}
|
|
476
|
+
await this._stateManager.putStorage(this._env.address, key, value);
|
|
477
|
+
if (this._evm.common.isActivatedEIP(7928)) {
|
|
478
|
+
this._evm.blockLevelAccessList?.addStorageWrite(this._env.address.toString(), key, value, this._evm.blockLevelAccessList.blockAccessIndex, originalValue);
|
|
479
|
+
}
|
|
480
|
+
const account = await this._stateManager.getAccount(this._env.address);
|
|
481
|
+
if (!account) {
|
|
482
|
+
throw EthereumJSErrorWithoutCode('could not read account while persisting memory');
|
|
483
|
+
}
|
|
484
|
+
this._env.contract = account;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* Loads a 256-bit value to memory from persistent storage.
|
|
488
|
+
* @param key - Storage key
|
|
489
|
+
* @param original - If true, return the original storage value (default: false)
|
|
490
|
+
* @param trackBAL - If true, track in BAL storageReads (default: true). Set to false for
|
|
491
|
+
* implicit reads (e.g., SSTORE gas calculation) that should not appear in BAL.
|
|
492
|
+
*/
|
|
493
|
+
async storageLoad(key, original = false, trackBAL = true) {
|
|
494
|
+
if (this._evm.common.isActivatedEIP(7928) && trackBAL) {
|
|
495
|
+
this._evm.blockLevelAccessList?.addStorageRead(this._env.address.toString(), key);
|
|
496
|
+
}
|
|
497
|
+
if (original) {
|
|
498
|
+
return this._stateManager.originalStorageCache.get(this._env.address, key);
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
return this._stateManager.getStorage(this._env.address, key);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
/**
|
|
505
|
+
* Store 256-bit a value in memory to transient storage.
|
|
506
|
+
* @param address Address to use
|
|
507
|
+
* @param key Storage key
|
|
508
|
+
* @param value Storage value
|
|
509
|
+
*/
|
|
510
|
+
transientStorageStore(key, value) {
|
|
511
|
+
return this._evm.transientStorage.put(this._env.address, key, value);
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* Loads a 256-bit value to memory from transient storage.
|
|
515
|
+
* @param address Address to use
|
|
516
|
+
* @param key Storage key
|
|
517
|
+
*/
|
|
518
|
+
transientStorageLoad(key) {
|
|
519
|
+
return this._evm.transientStorage.get(this._env.address, key);
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Set the returning output data for the execution.
|
|
523
|
+
* @param returnData - Output data to return
|
|
524
|
+
*/
|
|
525
|
+
finish(returnData) {
|
|
526
|
+
this._result.returnValue = returnData;
|
|
527
|
+
trap(EVMError.errorMessages.STOP);
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* Set the returning output data for the execution. This will halt the
|
|
531
|
+
* execution immediately and set the execution result to "reverted".
|
|
532
|
+
* @param returnData - Output data to return
|
|
533
|
+
*/
|
|
534
|
+
revert(returnData) {
|
|
535
|
+
this._result.returnValue = returnData;
|
|
536
|
+
trap(EVMError.errorMessages.REVERT);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Returns address of currently executing account.
|
|
540
|
+
*/
|
|
541
|
+
getAddress() {
|
|
542
|
+
return this._env.address;
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Returns balance of self.
|
|
546
|
+
*/
|
|
547
|
+
getSelfBalance() {
|
|
548
|
+
return this._env.contract.balance;
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Returns the deposited value by the instruction/transaction
|
|
552
|
+
* responsible for this execution.
|
|
553
|
+
*/
|
|
554
|
+
getCallValue() {
|
|
555
|
+
return this._env.callValue;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Returns input data in current environment. This pertains to the input
|
|
559
|
+
* data passed with the message call instruction or transaction.
|
|
560
|
+
*/
|
|
561
|
+
getCallData() {
|
|
562
|
+
return this._env.callData;
|
|
563
|
+
}
|
|
564
|
+
/**
|
|
565
|
+
* Returns size of input data in current environment. This pertains to the
|
|
566
|
+
* input data passed with the message call instruction or transaction.
|
|
567
|
+
*/
|
|
568
|
+
getCallDataSize() {
|
|
569
|
+
return BigInt(this._env.callData.length);
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Returns caller address. This is the address of the account
|
|
573
|
+
* that is directly responsible for this execution.
|
|
574
|
+
*/
|
|
575
|
+
getCaller() {
|
|
576
|
+
return bytesToBigInt(this._env.caller.bytes);
|
|
577
|
+
}
|
|
578
|
+
/**
|
|
579
|
+
* Returns the size of code running in current environment.
|
|
580
|
+
*/
|
|
581
|
+
getCodeSize() {
|
|
582
|
+
return BigInt(this._env.code.length);
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Returns the code running in current environment.
|
|
586
|
+
*/
|
|
587
|
+
getCode() {
|
|
588
|
+
return this._env.code;
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Returns the current gasCounter.
|
|
592
|
+
*/
|
|
593
|
+
getGasLeft() {
|
|
594
|
+
return this._runState.gasLeft;
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Returns size of current return data buffer. This contains the return data
|
|
598
|
+
* from the last executed call, callCode, callDelegate, callStatic or create.
|
|
599
|
+
* Note: create only fills the return data buffer in case of a failure.
|
|
600
|
+
*/
|
|
601
|
+
getReturnDataSize() {
|
|
602
|
+
return BigInt(this._runState.returnBytes.length);
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Returns the current return data buffer. This contains the return data
|
|
606
|
+
* from last executed call, callCode, callDelegate, callStatic or create.
|
|
607
|
+
* Note: create only fills the return data buffer in case of a failure.
|
|
608
|
+
*/
|
|
609
|
+
getReturnData() {
|
|
610
|
+
return this._runState.returnBytes;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Returns true if the current call must be executed statically.
|
|
614
|
+
*/
|
|
615
|
+
isStatic() {
|
|
616
|
+
return this._env.isStatic;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Returns price of gas in current environment.
|
|
620
|
+
*/
|
|
621
|
+
getTxGasPrice() {
|
|
622
|
+
return this._env.gasPrice;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Returns the execution's origination address. This is the
|
|
626
|
+
* sender of original transaction; it is never an account with
|
|
627
|
+
* non-empty associated code.
|
|
628
|
+
*/
|
|
629
|
+
getTxOrigin() {
|
|
630
|
+
return bytesToBigInt(this._env.origin.bytes);
|
|
631
|
+
}
|
|
632
|
+
/**
|
|
633
|
+
* Returns the block's number.
|
|
634
|
+
*/
|
|
635
|
+
getBlockNumber() {
|
|
636
|
+
return this._env.block.header.number;
|
|
637
|
+
}
|
|
638
|
+
/**
|
|
639
|
+
* Returns the block's beneficiary address.
|
|
640
|
+
*/
|
|
641
|
+
getBlockCoinbase() {
|
|
642
|
+
let coinbase;
|
|
643
|
+
if (this.common.consensusAlgorithm() === ConsensusAlgorithm.Clique) {
|
|
644
|
+
coinbase = this._evm['_optsCached'].cliqueSigner(this._env.block.header);
|
|
645
|
+
}
|
|
646
|
+
else {
|
|
647
|
+
coinbase = this._env.block.header.coinbase;
|
|
648
|
+
}
|
|
649
|
+
return bytesToBigInt(coinbase.toBytes());
|
|
650
|
+
}
|
|
651
|
+
/**
|
|
652
|
+
* Returns the block's timestamp.
|
|
653
|
+
*/
|
|
654
|
+
getBlockTimestamp() {
|
|
655
|
+
return this._env.block.header.timestamp;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Returns the block's difficulty.
|
|
659
|
+
*/
|
|
660
|
+
getBlockDifficulty() {
|
|
661
|
+
return this._env.block.header.difficulty;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Returns the block's prevRandao field.
|
|
665
|
+
*/
|
|
666
|
+
getBlockPrevRandao() {
|
|
667
|
+
return bytesToBigInt(this._env.block.header.prevRandao);
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Returns the block's gas limit.
|
|
671
|
+
*/
|
|
672
|
+
getBlockGasLimit() {
|
|
673
|
+
return this._env.block.header.gasLimit;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Returns the block's slot number (EIP-7843).
|
|
677
|
+
*/
|
|
678
|
+
getBlockSlotNumber() {
|
|
679
|
+
if (this._env.block.header.slotNumber === undefined) {
|
|
680
|
+
throw EthereumJSErrorWithoutCode('slotNumber is not available on this block');
|
|
681
|
+
}
|
|
682
|
+
return this._env.block.header.slotNumber;
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Returns the Base Fee of the block as proposed in [EIP-3198](https://eips.ethereum.org/EIPS/eip-3198)
|
|
686
|
+
*/
|
|
687
|
+
getBlockBaseFee() {
|
|
688
|
+
const baseFee = this._env.block.header.baseFeePerGas;
|
|
689
|
+
if (baseFee === undefined) {
|
|
690
|
+
// Sanity check
|
|
691
|
+
throw EthereumJSErrorWithoutCode('Block has no Base Fee');
|
|
692
|
+
}
|
|
693
|
+
return baseFee;
|
|
694
|
+
}
|
|
695
|
+
/**
|
|
696
|
+
* Returns the Blob Base Fee of the block as proposed in [EIP-7516](https://eips.ethereum.org/EIPS/eip-7516)
|
|
697
|
+
*/
|
|
698
|
+
getBlobBaseFee() {
|
|
699
|
+
const blobBaseFee = this._env.block.header.getBlobGasPrice();
|
|
700
|
+
if (blobBaseFee === undefined) {
|
|
701
|
+
// Sanity check
|
|
702
|
+
throw EthereumJSErrorWithoutCode('Block has no Blob Base Fee');
|
|
703
|
+
}
|
|
704
|
+
return blobBaseFee;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Returns the chain ID for current chain. Introduced for the
|
|
708
|
+
* CHAINID opcode proposed in [EIP-1344](https://eips.ethereum.org/EIPS/eip-1344).
|
|
709
|
+
*/
|
|
710
|
+
getChainId() {
|
|
711
|
+
return this.common.chainId();
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Sends a message with arbitrary data to a given address path.
|
|
715
|
+
*/
|
|
716
|
+
async call(gasLimit, address, value, data) {
|
|
717
|
+
const msg = new Message({
|
|
718
|
+
caller: this._env.address,
|
|
719
|
+
gasLimit,
|
|
720
|
+
to: address,
|
|
721
|
+
value,
|
|
722
|
+
data,
|
|
723
|
+
isStatic: this._env.isStatic,
|
|
724
|
+
depth: this._env.depth + 1,
|
|
725
|
+
blobVersionedHashes: this._env.blobVersionedHashes,
|
|
726
|
+
accessWitness: this._env.accessWitness,
|
|
727
|
+
});
|
|
728
|
+
return this._baseCall(msg);
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Message-call into this account with an alternative account's code.
|
|
732
|
+
*/
|
|
733
|
+
async callCode(gasLimit, address, value, data) {
|
|
734
|
+
const msg = new Message({
|
|
735
|
+
caller: this._env.address,
|
|
736
|
+
gasLimit,
|
|
737
|
+
to: this._env.address,
|
|
738
|
+
codeAddress: address,
|
|
739
|
+
value,
|
|
740
|
+
data,
|
|
741
|
+
isStatic: this._env.isStatic,
|
|
742
|
+
depth: this._env.depth + 1,
|
|
743
|
+
blobVersionedHashes: this._env.blobVersionedHashes,
|
|
744
|
+
accessWitness: this._env.accessWitness,
|
|
745
|
+
});
|
|
746
|
+
return this._baseCall(msg);
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Sends a message with arbitrary data to a given address path, but disallow
|
|
750
|
+
* state modifications. This includes log, create, selfdestruct and call with
|
|
751
|
+
* a non-zero value.
|
|
752
|
+
*/
|
|
753
|
+
async callStatic(gasLimit, address, value, data) {
|
|
754
|
+
const msg = new Message({
|
|
755
|
+
caller: this._env.address,
|
|
756
|
+
gasLimit,
|
|
757
|
+
to: address,
|
|
758
|
+
value,
|
|
759
|
+
data,
|
|
760
|
+
isStatic: true,
|
|
761
|
+
depth: this._env.depth + 1,
|
|
762
|
+
blobVersionedHashes: this._env.blobVersionedHashes,
|
|
763
|
+
accessWitness: this._env.accessWitness,
|
|
764
|
+
});
|
|
765
|
+
return this._baseCall(msg);
|
|
766
|
+
}
|
|
767
|
+
/**
|
|
768
|
+
* Message-call into this account with an alternative account's code, but
|
|
769
|
+
* persisting the current values for sender and value.
|
|
770
|
+
*/
|
|
771
|
+
async callDelegate(gasLimit, address, value, data) {
|
|
772
|
+
const msg = new Message({
|
|
773
|
+
caller: this._env.caller,
|
|
774
|
+
gasLimit,
|
|
775
|
+
to: this._env.address,
|
|
776
|
+
codeAddress: address,
|
|
777
|
+
value,
|
|
778
|
+
data,
|
|
779
|
+
isStatic: this._env.isStatic,
|
|
780
|
+
delegatecall: true,
|
|
781
|
+
depth: this._env.depth + 1,
|
|
782
|
+
blobVersionedHashes: this._env.blobVersionedHashes,
|
|
783
|
+
accessWitness: this._env.accessWitness,
|
|
784
|
+
});
|
|
785
|
+
return this._baseCall(msg);
|
|
786
|
+
}
|
|
787
|
+
async _baseCall(msg) {
|
|
788
|
+
const selfdestruct = new Map(this._result.selfdestruct);
|
|
789
|
+
msg.selfdestruct = selfdestruct;
|
|
790
|
+
msg.gasRefund = this._runState.gasRefund;
|
|
791
|
+
// empty the return data Uint8Array
|
|
792
|
+
this._runState.returnBytes = new Uint8Array(0);
|
|
793
|
+
let createdAddresses;
|
|
794
|
+
if (this.common.isActivatedEIP(6780)) {
|
|
795
|
+
createdAddresses = new Set(this._result.createdAddresses);
|
|
796
|
+
msg.createdAddresses = createdAddresses;
|
|
797
|
+
}
|
|
798
|
+
// empty the return data Uint8Array
|
|
799
|
+
this._runState.returnBytes = new Uint8Array(0);
|
|
800
|
+
// Check if account has enough ether and max depth not exceeded
|
|
801
|
+
if (this._env.depth >= Number(this.common.param('stackLimit')) ||
|
|
802
|
+
(msg.delegatecall !== true && this._env.contract.balance < msg.value)) {
|
|
803
|
+
return BIGINT_0;
|
|
804
|
+
}
|
|
805
|
+
const results = await this._evm.runCall({ message: msg });
|
|
806
|
+
if (results.execResult.logs) {
|
|
807
|
+
this._result.logs = this._result.logs.concat(results.execResult.logs);
|
|
808
|
+
}
|
|
809
|
+
// this should always be safe
|
|
810
|
+
this.useGas(results.execResult.executionGasUsed, 'CALL, STATICCALL, DELEGATECALL, CALLCODE');
|
|
811
|
+
// Set return value
|
|
812
|
+
if (results.execResult.returnValue !== undefined &&
|
|
813
|
+
(!results.execResult.exceptionError ||
|
|
814
|
+
results.execResult.exceptionError.error === EVMError.errorMessages.REVERT)) {
|
|
815
|
+
this._runState.returnBytes = results.execResult.returnValue;
|
|
816
|
+
}
|
|
817
|
+
if (!results.execResult.exceptionError) {
|
|
818
|
+
for (const [addressToSelfdestructHex, beneficiaryHex] of selfdestruct) {
|
|
819
|
+
this._result.selfdestruct.set(addressToSelfdestructHex, beneficiaryHex);
|
|
820
|
+
}
|
|
821
|
+
if (this.common.isActivatedEIP(6780)) {
|
|
822
|
+
// copy over the items to result via iterator
|
|
823
|
+
for (const item of createdAddresses) {
|
|
824
|
+
this._result.createdAddresses.add(item);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
// update stateRoot on current contract
|
|
828
|
+
const account = await this._stateManager.getAccount(this._env.address);
|
|
829
|
+
if (!account) {
|
|
830
|
+
throw EthereumJSErrorWithoutCode('could not read contract account');
|
|
831
|
+
}
|
|
832
|
+
this._env.contract = account;
|
|
833
|
+
this._runState.gasRefund = results.execResult.gasRefund ?? BIGINT_0;
|
|
834
|
+
}
|
|
835
|
+
return this._getReturnCode(results);
|
|
836
|
+
}
|
|
837
|
+
/**
|
|
838
|
+
* Creates a new contract with a given value.
|
|
839
|
+
*/
|
|
840
|
+
async create(gasLimit, value, codeToRun, salt, eofCallData) {
|
|
841
|
+
const selfdestruct = new Map(this._result.selfdestruct);
|
|
842
|
+
const caller = this._env.address;
|
|
843
|
+
const depth = this._env.depth + 1;
|
|
844
|
+
// empty the return data buffer
|
|
845
|
+
this._runState.returnBytes = new Uint8Array(0);
|
|
846
|
+
// Check if account has enough ether and max depth not exceeded
|
|
847
|
+
if (this._env.depth >= Number(this.common.param('stackLimit')) ||
|
|
848
|
+
this._env.contract.balance < value) {
|
|
849
|
+
return BIGINT_0;
|
|
850
|
+
}
|
|
851
|
+
// EIP-2681 check
|
|
852
|
+
if (this._env.contract.nonce >= MAX_UINT64) {
|
|
853
|
+
return BIGINT_0;
|
|
854
|
+
}
|
|
855
|
+
this._env.contract.nonce += BIGINT_1;
|
|
856
|
+
await this.journal.putAccount(this._env.address, this._env.contract);
|
|
857
|
+
if (this.common.isActivatedEIP(7928)) {
|
|
858
|
+
this._evm.blockLevelAccessList.addNonceChange(this._env.address.toString(), this._env.contract.nonce, this._evm.blockLevelAccessList.blockAccessIndex);
|
|
859
|
+
}
|
|
860
|
+
if (this.common.isActivatedEIP(3860)) {
|
|
861
|
+
if (codeToRun.length > Number(this.common.param('maxInitCodeSize')) &&
|
|
862
|
+
this._evm.allowUnlimitedInitCodeSize === false) {
|
|
863
|
+
return BIGINT_0;
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
const message = new Message({
|
|
867
|
+
caller,
|
|
868
|
+
gasLimit,
|
|
869
|
+
value,
|
|
870
|
+
data: codeToRun,
|
|
871
|
+
eofCallData,
|
|
872
|
+
salt,
|
|
873
|
+
depth,
|
|
874
|
+
selfdestruct,
|
|
875
|
+
gasRefund: this._runState.gasRefund,
|
|
876
|
+
blobVersionedHashes: this._env.blobVersionedHashes,
|
|
877
|
+
accessWitness: this._env.accessWitness,
|
|
878
|
+
});
|
|
879
|
+
let createdAddresses;
|
|
880
|
+
if (this.common.isActivatedEIP(6780)) {
|
|
881
|
+
createdAddresses = new Set(this._result.createdAddresses);
|
|
882
|
+
message.createdAddresses = createdAddresses;
|
|
883
|
+
}
|
|
884
|
+
const results = await this._evm.runCall({ message });
|
|
885
|
+
if (results.execResult.logs) {
|
|
886
|
+
this._result.logs = this._result.logs.concat(results.execResult.logs);
|
|
887
|
+
}
|
|
888
|
+
// this should always be safe
|
|
889
|
+
this.useGas(results.execResult.executionGasUsed, 'CREATE');
|
|
890
|
+
// Set return buffer in case revert happened
|
|
891
|
+
if (results.execResult.exceptionError &&
|
|
892
|
+
results.execResult.exceptionError.error === EVMError.errorMessages.REVERT) {
|
|
893
|
+
this._runState.returnBytes = results.execResult.returnValue;
|
|
894
|
+
}
|
|
895
|
+
if (!results.execResult.exceptionError ||
|
|
896
|
+
results.execResult.exceptionError.error === EVMError.errorMessages.CODESTORE_OUT_OF_GAS) {
|
|
897
|
+
for (const [addressToSelfdestructHex, beneficiaryHex] of selfdestruct) {
|
|
898
|
+
this._result.selfdestruct.set(addressToSelfdestructHex, beneficiaryHex);
|
|
899
|
+
}
|
|
900
|
+
if (this.common.isActivatedEIP(6780)) {
|
|
901
|
+
// copy over the items to result via iterator
|
|
902
|
+
for (const item of createdAddresses) {
|
|
903
|
+
this._result.createdAddresses.add(item);
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
// update stateRoot on current contract
|
|
907
|
+
const account = await this._stateManager.getAccount(this._env.address);
|
|
908
|
+
if (!account) {
|
|
909
|
+
throw EthereumJSErrorWithoutCode('could not read contract account');
|
|
910
|
+
}
|
|
911
|
+
this._env.contract = account;
|
|
912
|
+
this._runState.gasRefund = results.execResult.gasRefund ?? BIGINT_0;
|
|
913
|
+
if (results.createdAddress) {
|
|
914
|
+
// push the created address to the stack
|
|
915
|
+
return bytesToBigInt(results.createdAddress.bytes);
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return this._getReturnCode(results, true);
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Creates a new contract with a given value. Generates
|
|
922
|
+
* a deterministic address via CREATE2 rules.
|
|
923
|
+
*/
|
|
924
|
+
async create2(gasLimit, value, data, salt) {
|
|
925
|
+
return this.create(gasLimit, value, data, salt);
|
|
926
|
+
}
|
|
927
|
+
/**
|
|
928
|
+
* Creates a new contract with a given value. Generates
|
|
929
|
+
* a deterministic address via EOFCREATE rules.
|
|
930
|
+
*/
|
|
931
|
+
async eofcreate(gasLimit, value, containerData, salt, callData) {
|
|
932
|
+
return this.create(gasLimit, value, containerData, salt, callData);
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Mark account for later deletion and give the remaining balance to the
|
|
936
|
+
* specified beneficiary address. This will cause a trap and the
|
|
937
|
+
* execution will be aborted immediately.
|
|
938
|
+
* @param toAddress - Beneficiary address
|
|
939
|
+
*/
|
|
940
|
+
async selfDestruct(toAddress) {
|
|
941
|
+
return this._selfDestruct(toAddress);
|
|
942
|
+
}
|
|
943
|
+
async _selfDestruct(toAddress) {
|
|
944
|
+
// only add to refund if this is the first selfdestruct for the address
|
|
945
|
+
const selfdestructAddressHex = bytesToHex(this._env.address.bytes);
|
|
946
|
+
if (!this._result.selfdestruct.has(selfdestructAddressHex)) {
|
|
947
|
+
this.refundGas(this.common.param('selfdestructRefundGas'));
|
|
948
|
+
}
|
|
949
|
+
this._result.selfdestruct.set(selfdestructAddressHex, toAddress.toString());
|
|
950
|
+
const toSelf = equalsBytes(toAddress.bytes, this._env.address.bytes);
|
|
951
|
+
const contractBalance = this._env.contract.balance;
|
|
952
|
+
// EIP-7708: Emit ETH transfer log for SELFDESTRUCT with value to a different account
|
|
953
|
+
if (this.common.isActivatedEIP(7708) && contractBalance > BIGINT_0 && !toSelf) {
|
|
954
|
+
// Transfer log: from contract to beneficiary
|
|
955
|
+
const fromTopic = setLengthLeft(this._env.address.bytes, 32);
|
|
956
|
+
const toTopic = setLengthLeft(toAddress.bytes, 32);
|
|
957
|
+
const data = setLengthLeft(bigIntToBytes(contractBalance), 32);
|
|
958
|
+
const transferLog = [
|
|
959
|
+
EIP7708_SYSTEM_ADDRESS,
|
|
960
|
+
[EIP7708_TRANSFER_TOPIC, fromTopic, toTopic],
|
|
961
|
+
data,
|
|
962
|
+
];
|
|
963
|
+
this._result.logs.push(transferLog);
|
|
964
|
+
}
|
|
965
|
+
// Add to beneficiary balance
|
|
966
|
+
if (!toSelf) {
|
|
967
|
+
let toAccount = await this._stateManager.getAccount(toAddress);
|
|
968
|
+
if (!toAccount) {
|
|
969
|
+
toAccount = new Account();
|
|
970
|
+
}
|
|
971
|
+
const originalBalance = toAccount.balance;
|
|
972
|
+
toAccount.balance += contractBalance;
|
|
973
|
+
await this.journal.putAccount(toAddress, toAccount);
|
|
974
|
+
if (this.common.isActivatedEIP(7928)) {
|
|
975
|
+
this._evm.blockLevelAccessList.addBalanceChange(toAddress.toString(), toAccount.balance, this._evm.blockLevelAccessList.blockAccessIndex, originalBalance);
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
// Modify the account (set balance to 0) flag
|
|
979
|
+
let doModify = !this.common.isActivatedEIP(6780); // Always do this if 6780 is not active
|
|
980
|
+
if (!doModify) {
|
|
981
|
+
// If 6780 is active, check if current address is being created. If so
|
|
982
|
+
// old behavior of SELFDESTRUCT exists and balance should be set to 0 of this account
|
|
983
|
+
// (i.e. burn the ETH in current account)
|
|
984
|
+
doModify = this._env.createdAddresses.has(this._env.address.toString());
|
|
985
|
+
// If contract is not being created in this tx...
|
|
986
|
+
if (!doModify) {
|
|
987
|
+
// Check if ETH being sent to another account (thus set balance to 0)
|
|
988
|
+
doModify = !toSelf;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
// EIP-7708: Emit a Selfdestruct log for SELFDESTRUCT to self only when the balance
|
|
992
|
+
// is actually zeroed (doModify=true, i.e. same-tx contract creation). Pre-existing
|
|
993
|
+
// contracts where EIP-6780 prevents the burn should not emit a log.
|
|
994
|
+
if (this.common.isActivatedEIP(7708) && contractBalance > BIGINT_0 && toSelf && doModify) {
|
|
995
|
+
const contractTopic = setLengthLeft(this._env.address.bytes, 32);
|
|
996
|
+
const data = setLengthLeft(bigIntToBytes(contractBalance), 32);
|
|
997
|
+
const selfdestructLog = [
|
|
998
|
+
EIP7708_SYSTEM_ADDRESS,
|
|
999
|
+
[EIP7708_SELFDESTRUCT_TOPIC, contractTopic],
|
|
1000
|
+
data,
|
|
1001
|
+
];
|
|
1002
|
+
this._result.logs.push(selfdestructLog);
|
|
1003
|
+
}
|
|
1004
|
+
// Set contract balance to 0
|
|
1005
|
+
if (doModify) {
|
|
1006
|
+
const originalBalance = this._env.contract.balance;
|
|
1007
|
+
await this._stateManager.modifyAccountFields(this._env.address, {
|
|
1008
|
+
balance: BIGINT_0,
|
|
1009
|
+
});
|
|
1010
|
+
if (this.common.isActivatedEIP(7928)) {
|
|
1011
|
+
this._evm.blockLevelAccessList.addBalanceChange(this._env.address.toString(), BIGINT_0, this._evm.blockLevelAccessList.blockAccessIndex, originalBalance);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
trap(EVMError.errorMessages.STOP);
|
|
1015
|
+
}
|
|
1016
|
+
/**
|
|
1017
|
+
* Creates a new log in the current environment.
|
|
1018
|
+
*/
|
|
1019
|
+
log(data, numberOfTopics, topics) {
|
|
1020
|
+
if (numberOfTopics < 0 || numberOfTopics > 4) {
|
|
1021
|
+
trap(EVMError.errorMessages.OUT_OF_RANGE);
|
|
1022
|
+
}
|
|
1023
|
+
if (topics.length !== numberOfTopics) {
|
|
1024
|
+
trap(EVMError.errorMessages.INTERNAL_ERROR);
|
|
1025
|
+
}
|
|
1026
|
+
const log = [this._env.address.bytes, topics, data];
|
|
1027
|
+
this._result.logs.push(log);
|
|
1028
|
+
}
|
|
1029
|
+
_getReturnCode(results, isEOFCreate = false) {
|
|
1030
|
+
if (this._runState.env.eof === undefined || isEOFCreate) {
|
|
1031
|
+
if (results.execResult.exceptionError) {
|
|
1032
|
+
return BIGINT_0;
|
|
1033
|
+
}
|
|
1034
|
+
else {
|
|
1035
|
+
return BIGINT_1;
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
else {
|
|
1039
|
+
// EOF mode, call was either EXTCALL / EXTDELEGATECALL / EXTSTATICCALL
|
|
1040
|
+
if (results.execResult.exceptionError !== undefined) {
|
|
1041
|
+
if (results.execResult.exceptionError.error === EVMError.errorMessages.REVERT) {
|
|
1042
|
+
// Revert
|
|
1043
|
+
return BIGINT_1;
|
|
1044
|
+
}
|
|
1045
|
+
else {
|
|
1046
|
+
// Failure
|
|
1047
|
+
return BIGINT_2;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
return BIGINT_0;
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
//# sourceMappingURL=interpreter.js.map
|