@feelyourprotocol/evm 8141.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +690 -0
- package/dist/cjs/binaryTreeAccessWitness.d.ts +61 -0
- package/dist/cjs/binaryTreeAccessWitness.d.ts.map +1 -0
- package/dist/cjs/binaryTreeAccessWitness.js +314 -0
- package/dist/cjs/binaryTreeAccessWitness.js.map +1 -0
- package/dist/cjs/chunkCache.d.ts +13 -0
- package/dist/cjs/chunkCache.d.ts.map +1 -0
- package/dist/cjs/chunkCache.js +30 -0
- package/dist/cjs/chunkCache.js.map +1 -0
- package/dist/cjs/constructors.d.ts +11 -0
- package/dist/cjs/constructors.d.ts.map +1 -0
- package/dist/cjs/constructors.js +30 -0
- package/dist/cjs/constructors.js.map +1 -0
- package/dist/cjs/eip7708.d.ts +24 -0
- package/dist/cjs/eip7708.d.ts.map +1 -0
- package/dist/cjs/eip7708.js +37 -0
- package/dist/cjs/eip7708.js.map +1 -0
- package/dist/cjs/eof/constants.d.ts +22 -0
- package/dist/cjs/eof/constants.d.ts.map +1 -0
- package/dist/cjs/eof/constants.js +31 -0
- package/dist/cjs/eof/constants.js.map +1 -0
- package/dist/cjs/eof/container.d.ts +87 -0
- package/dist/cjs/eof/container.d.ts.map +1 -0
- package/dist/cjs/eof/container.js +380 -0
- package/dist/cjs/eof/container.js.map +1 -0
- package/dist/cjs/eof/errors.d.ts +66 -0
- package/dist/cjs/eof/errors.d.ts.map +1 -0
- package/dist/cjs/eof/errors.js +200 -0
- package/dist/cjs/eof/errors.js.map +1 -0
- package/dist/cjs/eof/setup.d.ts +9 -0
- package/dist/cjs/eof/setup.d.ts.map +1 -0
- package/dist/cjs/eof/setup.js +26 -0
- package/dist/cjs/eof/setup.js.map +1 -0
- package/dist/cjs/eof/stackDelta.d.ts +10 -0
- package/dist/cjs/eof/stackDelta.d.ts.map +1 -0
- package/dist/cjs/eof/stackDelta.js +164 -0
- package/dist/cjs/eof/stackDelta.js.map +1 -0
- package/dist/cjs/eof/util.d.ts +8 -0
- package/dist/cjs/eof/util.d.ts.map +1 -0
- package/dist/cjs/eof/util.js +18 -0
- package/dist/cjs/eof/util.js.map +1 -0
- package/dist/cjs/eof/verify.d.ts +38 -0
- package/dist/cjs/eof/verify.d.ts.map +1 -0
- package/dist/cjs/eof/verify.js +436 -0
- package/dist/cjs/eof/verify.js.map +1 -0
- package/dist/cjs/errors.d.ts +40 -0
- package/dist/cjs/errors.d.ts.map +1 -0
- package/dist/cjs/errors.js +43 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/evm.d.ts +181 -0
- package/dist/cjs/evm.d.ts.map +1 -0
- package/dist/cjs/evm.js +1142 -0
- package/dist/cjs/evm.js.map +1 -0
- package/dist/cjs/frameContext.d.ts +50 -0
- package/dist/cjs/frameContext.d.ts.map +1 -0
- package/dist/cjs/frameContext.js +17 -0
- package/dist/cjs/frameContext.js.map +1 -0
- package/dist/cjs/index.d.ts +18 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +43 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/interpreter.d.ts +361 -0
- package/dist/cjs/interpreter.d.ts.map +1 -0
- package/dist/cjs/interpreter.js +1057 -0
- package/dist/cjs/interpreter.js.map +1 -0
- package/dist/cjs/journal.d.ts +69 -0
- package/dist/cjs/journal.d.ts.map +1 -0
- package/dist/cjs/journal.js +247 -0
- package/dist/cjs/journal.js.map +1 -0
- package/dist/cjs/logger.d.ts +38 -0
- package/dist/cjs/logger.d.ts.map +1 -0
- package/dist/cjs/logger.js +126 -0
- package/dist/cjs/logger.js.map +1 -0
- package/dist/cjs/memory.d.ts +29 -0
- package/dist/cjs/memory.d.ts.map +1 -0
- package/dist/cjs/memory.js +75 -0
- package/dist/cjs/memory.js.map +1 -0
- package/dist/cjs/message.d.ts +70 -0
- package/dist/cjs/message.d.ts.map +1 -0
- package/dist/cjs/message.js +51 -0
- package/dist/cjs/message.js.map +1 -0
- package/dist/cjs/opcodes/EIP1283.d.ts +13 -0
- package/dist/cjs/opcodes/EIP1283.d.ts.map +1 -0
- package/dist/cjs/opcodes/EIP1283.js +58 -0
- package/dist/cjs/opcodes/EIP1283.js.map +1 -0
- package/dist/cjs/opcodes/EIP2200.d.ts +13 -0
- package/dist/cjs/opcodes/EIP2200.d.ts.map +1 -0
- package/dist/cjs/opcodes/EIP2200.js +64 -0
- package/dist/cjs/opcodes/EIP2200.js.map +1 -0
- package/dist/cjs/opcodes/EIP2929.d.ts +68 -0
- package/dist/cjs/opcodes/EIP2929.d.ts.map +1 -0
- package/dist/cjs/opcodes/EIP2929.js +146 -0
- package/dist/cjs/opcodes/EIP2929.js.map +1 -0
- package/dist/cjs/opcodes/codes.d.ts +45 -0
- package/dist/cjs/opcodes/codes.d.ts.map +1 -0
- package/dist/cjs/opcodes/codes.js +453 -0
- package/dist/cjs/opcodes/codes.js.map +1 -0
- package/dist/cjs/opcodes/functions.d.ts +11 -0
- package/dist/cjs/opcodes/functions.d.ts.map +1 -0
- package/dist/cjs/opcodes/functions.js +1778 -0
- package/dist/cjs/opcodes/functions.js.map +1 -0
- package/dist/cjs/opcodes/gas.d.ts +15 -0
- package/dist/cjs/opcodes/gas.d.ts.map +1 -0
- package/dist/cjs/opcodes/gas.js +1016 -0
- package/dist/cjs/opcodes/gas.js.map +1 -0
- package/dist/cjs/opcodes/index.d.ts +4 -0
- package/dist/cjs/opcodes/index.d.ts.map +1 -0
- package/dist/cjs/opcodes/index.js +20 -0
- package/dist/cjs/opcodes/index.js.map +1 -0
- package/dist/cjs/opcodes/util.d.ts +86 -0
- package/dist/cjs/opcodes/util.d.ts.map +1 -0
- package/dist/cjs/opcodes/util.js +281 -0
- package/dist/cjs/opcodes/util.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/params.d.ts +3 -0
- package/dist/cjs/params.d.ts.map +1 -0
- package/dist/cjs/params.js +424 -0
- package/dist/cjs/params.js.map +1 -0
- package/dist/cjs/precompiles/01-ecrecover.d.ts +4 -0
- package/dist/cjs/precompiles/01-ecrecover.d.ts.map +1 -0
- package/dist/cjs/precompiles/01-ecrecover.js +58 -0
- package/dist/cjs/precompiles/01-ecrecover.js.map +1 -0
- package/dist/cjs/precompiles/02-sha256.d.ts +4 -0
- package/dist/cjs/precompiles/02-sha256.d.ts.map +1 -0
- package/dist/cjs/precompiles/02-sha256.js +27 -0
- package/dist/cjs/precompiles/02-sha256.js.map +1 -0
- package/dist/cjs/precompiles/03-ripemd160.d.ts +4 -0
- package/dist/cjs/precompiles/03-ripemd160.d.ts.map +1 -0
- package/dist/cjs/precompiles/03-ripemd160.js +26 -0
- package/dist/cjs/precompiles/03-ripemd160.js.map +1 -0
- package/dist/cjs/precompiles/04-identity.d.ts +4 -0
- package/dist/cjs/precompiles/04-identity.d.ts.map +1 -0
- package/dist/cjs/precompiles/04-identity.js +24 -0
- package/dist/cjs/precompiles/04-identity.js.map +1 -0
- package/dist/cjs/precompiles/05-modexp.d.ts +5 -0
- package/dist/cjs/precompiles/05-modexp.d.ts.map +1 -0
- package/dist/cjs/precompiles/05-modexp.js +185 -0
- package/dist/cjs/precompiles/05-modexp.js.map +1 -0
- package/dist/cjs/precompiles/06-bn254-add.d.ts +4 -0
- package/dist/cjs/precompiles/06-bn254-add.d.ts.map +1 -0
- package/dist/cjs/precompiles/06-bn254-add.js +42 -0
- package/dist/cjs/precompiles/06-bn254-add.js.map +1 -0
- package/dist/cjs/precompiles/07-bn254-mul.d.ts +4 -0
- package/dist/cjs/precompiles/07-bn254-mul.d.ts.map +1 -0
- package/dist/cjs/precompiles/07-bn254-mul.js +43 -0
- package/dist/cjs/precompiles/07-bn254-mul.js.map +1 -0
- package/dist/cjs/precompiles/08-bn254-pairing.d.ts +4 -0
- package/dist/cjs/precompiles/08-bn254-pairing.d.ts.map +1 -0
- package/dist/cjs/precompiles/08-bn254-pairing.js +45 -0
- package/dist/cjs/precompiles/08-bn254-pairing.js.map +1 -0
- package/dist/cjs/precompiles/09-blake2f.d.ts +5 -0
- package/dist/cjs/precompiles/09-blake2f.d.ts.map +1 -0
- package/dist/cjs/precompiles/09-blake2f.js +201 -0
- package/dist/cjs/precompiles/09-blake2f.js.map +1 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.d.ts +5 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.d.ts.map +1 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.js +68 -0
- package/dist/cjs/precompiles/0a-kzg-point-evaluation.js.map +1 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.d.ts +4 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.d.ts.map +1 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.js +49 -0
- package/dist/cjs/precompiles/0b-bls12-g1add.js.map +1 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.d.ts +4 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.d.ts.map +1 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.js +62 -0
- package/dist/cjs/precompiles/0c-bls12-g1msm.js.map +1 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.d.ts +4 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.d.ts.map +1 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.js +51 -0
- package/dist/cjs/precompiles/0d-bls12-g2add.js.map +1 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.d.ts +4 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.d.ts.map +1 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.js +60 -0
- package/dist/cjs/precompiles/0e-bls12-g2msm.js.map +1 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.d.ts +4 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.d.ts.map +1 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.js +66 -0
- package/dist/cjs/precompiles/0f-bls12-pairing.js.map +1 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.d.ts +4 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.d.ts.map +1 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.js +44 -0
- package/dist/cjs/precompiles/10-bls12-map-fp-to-g1.js.map +1 -0
- package/dist/cjs/precompiles/100-p256verify.d.ts +4 -0
- package/dist/cjs/precompiles/100-p256verify.d.ts.map +1 -0
- package/dist/cjs/precompiles/100-p256verify.js +131 -0
- package/dist/cjs/precompiles/100-p256verify.js.map +1 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.d.ts +4 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.d.ts.map +1 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.js +47 -0
- package/dist/cjs/precompiles/11-bls12-map-fp2-to-g2.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/constants.d.ts +10 -0
- package/dist/cjs/precompiles/bls12_381/constants.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/constants.js +274 -0
- package/dist/cjs/precompiles/bls12_381/constants.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/index.d.ts +5 -0
- package/dist/cjs/precompiles/bls12_381/index.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/index.js +24 -0
- package/dist/cjs/precompiles/bls12_381/index.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/mcl.d.ts +45 -0
- package/dist/cjs/precompiles/bls12_381/mcl.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/mcl.js +264 -0
- package/dist/cjs/precompiles/bls12_381/mcl.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/noble.d.ts +39 -0
- package/dist/cjs/precompiles/bls12_381/noble.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/noble.js +228 -0
- package/dist/cjs/precompiles/bls12_381/noble.js.map +1 -0
- package/dist/cjs/precompiles/bls12_381/util.d.ts +35 -0
- package/dist/cjs/precompiles/bls12_381/util.d.ts.map +1 -0
- package/dist/cjs/precompiles/bls12_381/util.js +68 -0
- package/dist/cjs/precompiles/bls12_381/util.js.map +1 -0
- package/dist/cjs/precompiles/bn254/index.d.ts +3 -0
- package/dist/cjs/precompiles/bn254/index.d.ts.map +1 -0
- package/dist/cjs/precompiles/bn254/index.js +8 -0
- package/dist/cjs/precompiles/bn254/index.js.map +1 -0
- package/dist/cjs/precompiles/bn254/noble.d.ts +13 -0
- package/dist/cjs/precompiles/bn254/noble.d.ts.map +1 -0
- package/dist/cjs/precompiles/bn254/noble.js +124 -0
- package/dist/cjs/precompiles/bn254/noble.js.map +1 -0
- package/dist/cjs/precompiles/bn254/rustbn.d.ts +16 -0
- package/dist/cjs/precompiles/bn254/rustbn.d.ts.map +1 -0
- package/dist/cjs/precompiles/bn254/rustbn.js +33 -0
- package/dist/cjs/precompiles/bn254/rustbn.js.map +1 -0
- package/dist/cjs/precompiles/index.d.ts +67 -0
- package/dist/cjs/precompiles/index.d.ts.map +1 -0
- package/dist/cjs/precompiles/index.js +262 -0
- package/dist/cjs/precompiles/index.js.map +1 -0
- package/dist/cjs/precompiles/types.d.ts +13 -0
- package/dist/cjs/precompiles/types.d.ts.map +1 -0
- package/dist/cjs/precompiles/types.js +3 -0
- package/dist/cjs/precompiles/types.js.map +1 -0
- package/dist/cjs/precompiles/util.d.ts +30 -0
- package/dist/cjs/precompiles/util.d.ts.map +1 -0
- package/dist/cjs/precompiles/util.js +63 -0
- package/dist/cjs/precompiles/util.js.map +1 -0
- package/dist/cjs/stack.d.ts +55 -0
- package/dist/cjs/stack.d.ts.map +1 -0
- package/dist/cjs/stack.js +143 -0
- package/dist/cjs/stack.js.map +1 -0
- package/dist/cjs/stemCache.d.ts +20 -0
- package/dist/cjs/stemCache.d.ts.map +1 -0
- package/dist/cjs/stemCache.js +37 -0
- package/dist/cjs/stemCache.js.map +1 -0
- package/dist/cjs/transientStorage.d.ts +54 -0
- package/dist/cjs/transientStorage.d.ts.map +1 -0
- package/dist/cjs/transientStorage.js +113 -0
- package/dist/cjs/transientStorage.js.map +1 -0
- package/dist/cjs/types.d.ts +465 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +28 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/esm/binaryTreeAccessWitness.d.ts +61 -0
- package/dist/esm/binaryTreeAccessWitness.d.ts.map +1 -0
- package/dist/esm/binaryTreeAccessWitness.js +308 -0
- package/dist/esm/binaryTreeAccessWitness.js.map +1 -0
- package/dist/esm/chunkCache.d.ts +13 -0
- package/dist/esm/chunkCache.d.ts.map +1 -0
- package/dist/esm/chunkCache.js +26 -0
- package/dist/esm/chunkCache.js.map +1 -0
- package/dist/esm/constructors.d.ts +11 -0
- package/dist/esm/constructors.d.ts.map +1 -0
- package/dist/esm/constructors.js +27 -0
- package/dist/esm/constructors.js.map +1 -0
- package/dist/esm/eip7708.d.ts +24 -0
- package/dist/esm/eip7708.d.ts.map +1 -0
- package/dist/esm/eip7708.js +32 -0
- package/dist/esm/eip7708.js.map +1 -0
- package/dist/esm/eof/constants.d.ts +22 -0
- package/dist/esm/eof/constants.d.ts.map +1 -0
- package/dist/esm/eof/constants.js +28 -0
- package/dist/esm/eof/constants.js.map +1 -0
- package/dist/esm/eof/container.d.ts +87 -0
- package/dist/esm/eof/container.d.ts.map +1 -0
- package/dist/esm/eof/container.js +375 -0
- package/dist/esm/eof/container.js.map +1 -0
- package/dist/esm/eof/errors.d.ts +66 -0
- package/dist/esm/eof/errors.d.ts.map +1 -0
- package/dist/esm/eof/errors.js +195 -0
- package/dist/esm/eof/errors.js.map +1 -0
- package/dist/esm/eof/setup.d.ts +9 -0
- package/dist/esm/eof/setup.d.ts.map +1 -0
- package/dist/esm/eof/setup.js +23 -0
- package/dist/esm/eof/setup.js.map +1 -0
- package/dist/esm/eof/stackDelta.d.ts +10 -0
- package/dist/esm/eof/stackDelta.d.ts.map +1 -0
- package/dist/esm/eof/stackDelta.js +161 -0
- package/dist/esm/eof/stackDelta.js.map +1 -0
- package/dist/esm/eof/util.d.ts +8 -0
- package/dist/esm/eof/util.d.ts.map +1 -0
- package/dist/esm/eof/util.js +14 -0
- package/dist/esm/eof/util.js.map +1 -0
- package/dist/esm/eof/verify.d.ts +38 -0
- package/dist/esm/eof/verify.d.ts.map +1 -0
- package/dist/esm/eof/verify.js +432 -0
- package/dist/esm/eof/verify.js.map +1 -0
- package/dist/esm/errors.d.ts +40 -0
- package/dist/esm/errors.d.ts.map +1 -0
- package/dist/esm/errors.js +39 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/evm.d.ts +181 -0
- package/dist/esm/evm.d.ts.map +1 -0
- package/dist/esm/evm.js +1131 -0
- package/dist/esm/evm.js.map +1 -0
- package/dist/esm/frameContext.d.ts +50 -0
- package/dist/esm/frameContext.d.ts.map +1 -0
- package/dist/esm/frameContext.js +14 -0
- package/dist/esm/frameContext.js.map +1 -0
- package/dist/esm/index.d.ts +18 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +15 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/interpreter.d.ts +361 -0
- package/dist/esm/interpreter.d.ts.map +1 -0
- package/dist/esm/interpreter.js +1054 -0
- package/dist/esm/interpreter.js.map +1 -0
- package/dist/esm/journal.d.ts +69 -0
- package/dist/esm/journal.d.ts.map +1 -0
- package/dist/esm/journal.js +243 -0
- package/dist/esm/journal.js.map +1 -0
- package/dist/esm/logger.d.ts +38 -0
- package/dist/esm/logger.d.ts.map +1 -0
- package/dist/esm/logger.js +121 -0
- package/dist/esm/logger.js.map +1 -0
- package/dist/esm/memory.d.ts +29 -0
- package/dist/esm/memory.d.ts.map +1 -0
- package/dist/esm/memory.js +71 -0
- package/dist/esm/memory.js.map +1 -0
- package/dist/esm/message.d.ts +70 -0
- package/dist/esm/message.d.ts.map +1 -0
- package/dist/esm/message.js +47 -0
- package/dist/esm/message.js.map +1 -0
- package/dist/esm/opcodes/EIP1283.d.ts +13 -0
- package/dist/esm/opcodes/EIP1283.d.ts.map +1 -0
- package/dist/esm/opcodes/EIP1283.js +55 -0
- package/dist/esm/opcodes/EIP1283.js.map +1 -0
- package/dist/esm/opcodes/EIP2200.d.ts +13 -0
- package/dist/esm/opcodes/EIP2200.d.ts.map +1 -0
- package/dist/esm/opcodes/EIP2200.js +61 -0
- package/dist/esm/opcodes/EIP2200.js.map +1 -0
- package/dist/esm/opcodes/EIP2929.d.ts +68 -0
- package/dist/esm/opcodes/EIP2929.d.ts.map +1 -0
- package/dist/esm/opcodes/EIP2929.js +138 -0
- package/dist/esm/opcodes/EIP2929.js.map +1 -0
- package/dist/esm/opcodes/codes.d.ts +45 -0
- package/dist/esm/opcodes/codes.d.ts.map +1 -0
- package/dist/esm/opcodes/codes.js +448 -0
- package/dist/esm/opcodes/codes.js.map +1 -0
- package/dist/esm/opcodes/functions.d.ts +11 -0
- package/dist/esm/opcodes/functions.d.ts.map +1 -0
- package/dist/esm/opcodes/functions.js +1775 -0
- package/dist/esm/opcodes/functions.js.map +1 -0
- package/dist/esm/opcodes/gas.d.ts +15 -0
- package/dist/esm/opcodes/gas.d.ts.map +1 -0
- package/dist/esm/opcodes/gas.js +1013 -0
- package/dist/esm/opcodes/gas.js.map +1 -0
- package/dist/esm/opcodes/index.d.ts +4 -0
- package/dist/esm/opcodes/index.d.ts.map +1 -0
- package/dist/esm/opcodes/index.js +4 -0
- package/dist/esm/opcodes/index.js.map +1 -0
- package/dist/esm/opcodes/util.d.ts +86 -0
- package/dist/esm/opcodes/util.d.ts.map +1 -0
- package/dist/esm/opcodes/util.js +257 -0
- package/dist/esm/opcodes/util.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/params.d.ts +3 -0
- package/dist/esm/params.d.ts.map +1 -0
- package/dist/esm/params.js +421 -0
- package/dist/esm/params.js.map +1 -0
- package/dist/esm/precompiles/01-ecrecover.d.ts +4 -0
- package/dist/esm/precompiles/01-ecrecover.d.ts.map +1 -0
- package/dist/esm/precompiles/01-ecrecover.js +55 -0
- package/dist/esm/precompiles/01-ecrecover.js.map +1 -0
- package/dist/esm/precompiles/02-sha256.d.ts +4 -0
- package/dist/esm/precompiles/02-sha256.d.ts.map +1 -0
- package/dist/esm/precompiles/02-sha256.js +24 -0
- package/dist/esm/precompiles/02-sha256.js.map +1 -0
- package/dist/esm/precompiles/03-ripemd160.d.ts +4 -0
- package/dist/esm/precompiles/03-ripemd160.d.ts.map +1 -0
- package/dist/esm/precompiles/03-ripemd160.js +23 -0
- package/dist/esm/precompiles/03-ripemd160.js.map +1 -0
- package/dist/esm/precompiles/04-identity.d.ts +4 -0
- package/dist/esm/precompiles/04-identity.d.ts.map +1 -0
- package/dist/esm/precompiles/04-identity.js +21 -0
- package/dist/esm/precompiles/04-identity.js.map +1 -0
- package/dist/esm/precompiles/05-modexp.d.ts +5 -0
- package/dist/esm/precompiles/05-modexp.d.ts.map +1 -0
- package/dist/esm/precompiles/05-modexp.js +181 -0
- package/dist/esm/precompiles/05-modexp.js.map +1 -0
- package/dist/esm/precompiles/06-bn254-add.d.ts +4 -0
- package/dist/esm/precompiles/06-bn254-add.d.ts.map +1 -0
- package/dist/esm/precompiles/06-bn254-add.js +39 -0
- package/dist/esm/precompiles/06-bn254-add.js.map +1 -0
- package/dist/esm/precompiles/07-bn254-mul.d.ts +4 -0
- package/dist/esm/precompiles/07-bn254-mul.d.ts.map +1 -0
- package/dist/esm/precompiles/07-bn254-mul.js +40 -0
- package/dist/esm/precompiles/07-bn254-mul.js.map +1 -0
- package/dist/esm/precompiles/08-bn254-pairing.d.ts +4 -0
- package/dist/esm/precompiles/08-bn254-pairing.d.ts.map +1 -0
- package/dist/esm/precompiles/08-bn254-pairing.js +42 -0
- package/dist/esm/precompiles/08-bn254-pairing.js.map +1 -0
- package/dist/esm/precompiles/09-blake2f.d.ts +5 -0
- package/dist/esm/precompiles/09-blake2f.d.ts.map +1 -0
- package/dist/esm/precompiles/09-blake2f.js +197 -0
- package/dist/esm/precompiles/09-blake2f.js.map +1 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.d.ts +5 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.d.ts.map +1 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.js +64 -0
- package/dist/esm/precompiles/0a-kzg-point-evaluation.js.map +1 -0
- package/dist/esm/precompiles/0b-bls12-g1add.d.ts +4 -0
- package/dist/esm/precompiles/0b-bls12-g1add.d.ts.map +1 -0
- package/dist/esm/precompiles/0b-bls12-g1add.js +46 -0
- package/dist/esm/precompiles/0b-bls12-g1add.js.map +1 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.d.ts +4 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.d.ts.map +1 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.js +59 -0
- package/dist/esm/precompiles/0c-bls12-g1msm.js.map +1 -0
- package/dist/esm/precompiles/0d-bls12-g2add.d.ts +4 -0
- package/dist/esm/precompiles/0d-bls12-g2add.d.ts.map +1 -0
- package/dist/esm/precompiles/0d-bls12-g2add.js +48 -0
- package/dist/esm/precompiles/0d-bls12-g2add.js.map +1 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.d.ts +4 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.d.ts.map +1 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.js +57 -0
- package/dist/esm/precompiles/0e-bls12-g2msm.js.map +1 -0
- package/dist/esm/precompiles/0f-bls12-pairing.d.ts +4 -0
- package/dist/esm/precompiles/0f-bls12-pairing.d.ts.map +1 -0
- package/dist/esm/precompiles/0f-bls12-pairing.js +63 -0
- package/dist/esm/precompiles/0f-bls12-pairing.js.map +1 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.d.ts +4 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.d.ts.map +1 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.js +41 -0
- package/dist/esm/precompiles/10-bls12-map-fp-to-g1.js.map +1 -0
- package/dist/esm/precompiles/100-p256verify.d.ts +4 -0
- package/dist/esm/precompiles/100-p256verify.d.ts.map +1 -0
- package/dist/esm/precompiles/100-p256verify.js +128 -0
- package/dist/esm/precompiles/100-p256verify.js.map +1 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.d.ts +4 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.d.ts.map +1 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.js +44 -0
- package/dist/esm/precompiles/11-bls12-map-fp2-to-g2.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/constants.d.ts +10 -0
- package/dist/esm/precompiles/bls12_381/constants.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/constants.js +271 -0
- package/dist/esm/precompiles/bls12_381/constants.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/index.d.ts +5 -0
- package/dist/esm/precompiles/bls12_381/index.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/index.js +5 -0
- package/dist/esm/precompiles/bls12_381/index.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/mcl.d.ts +45 -0
- package/dist/esm/precompiles/bls12_381/mcl.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/mcl.js +254 -0
- package/dist/esm/precompiles/bls12_381/mcl.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/noble.d.ts +39 -0
- package/dist/esm/precompiles/bls12_381/noble.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/noble.js +218 -0
- package/dist/esm/precompiles/bls12_381/noble.js.map +1 -0
- package/dist/esm/precompiles/bls12_381/util.d.ts +35 -0
- package/dist/esm/precompiles/bls12_381/util.d.ts.map +1 -0
- package/dist/esm/precompiles/bls12_381/util.js +63 -0
- package/dist/esm/precompiles/bls12_381/util.js.map +1 -0
- package/dist/esm/precompiles/bn254/index.d.ts +3 -0
- package/dist/esm/precompiles/bn254/index.d.ts.map +1 -0
- package/dist/esm/precompiles/bn254/index.js +3 -0
- package/dist/esm/precompiles/bn254/index.js.map +1 -0
- package/dist/esm/precompiles/bn254/noble.d.ts +13 -0
- package/dist/esm/precompiles/bn254/noble.d.ts.map +1 -0
- package/dist/esm/precompiles/bn254/noble.js +120 -0
- package/dist/esm/precompiles/bn254/noble.js.map +1 -0
- package/dist/esm/precompiles/bn254/rustbn.d.ts +16 -0
- package/dist/esm/precompiles/bn254/rustbn.d.ts.map +1 -0
- package/dist/esm/precompiles/bn254/rustbn.js +29 -0
- package/dist/esm/precompiles/bn254/rustbn.js.map +1 -0
- package/dist/esm/precompiles/index.d.ts +67 -0
- package/dist/esm/precompiles/index.d.ts.map +1 -0
- package/dist/esm/precompiles/index.js +251 -0
- package/dist/esm/precompiles/index.js.map +1 -0
- package/dist/esm/precompiles/types.d.ts +13 -0
- package/dist/esm/precompiles/types.d.ts.map +1 -0
- package/dist/esm/precompiles/types.js +2 -0
- package/dist/esm/precompiles/types.js.map +1 -0
- package/dist/esm/precompiles/util.d.ts +30 -0
- package/dist/esm/precompiles/util.d.ts.map +1 -0
- package/dist/esm/precompiles/util.js +57 -0
- package/dist/esm/precompiles/util.js.map +1 -0
- package/dist/esm/stack.d.ts +55 -0
- package/dist/esm/stack.d.ts.map +1 -0
- package/dist/esm/stack.js +139 -0
- package/dist/esm/stack.js.map +1 -0
- package/dist/esm/stemCache.d.ts +20 -0
- package/dist/esm/stemCache.d.ts.map +1 -0
- package/dist/esm/stemCache.js +33 -0
- package/dist/esm/stemCache.js.map +1 -0
- package/dist/esm/transientStorage.d.ts +54 -0
- package/dist/esm/transientStorage.d.ts.map +1 -0
- package/dist/esm/transientStorage.js +109 -0
- package/dist/esm/transientStorage.js.map +1 -0
- package/dist/esm/types.d.ts +465 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +23 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
- package/package.json +98 -0
- package/src/binaryTreeAccessWitness.ts +447 -0
- package/src/chunkCache.ts +36 -0
- package/src/constructors.ts +35 -0
- package/src/eip7708.ts +47 -0
- package/src/eof/constants.ts +36 -0
- package/src/eof/container.ts +495 -0
- package/src/eof/errors.ts +214 -0
- package/src/eof/setup.ts +27 -0
- package/src/eof/stackDelta.ts +169 -0
- package/src/eof/util.ts +16 -0
- package/src/eof/verify.ts +531 -0
- package/src/errors.ts +45 -0
- package/src/evm.ts +1415 -0
- package/src/frameContext.ts +56 -0
- package/src/index.ts +75 -0
- package/src/interpreter.ts +1437 -0
- package/src/journal.ts +317 -0
- package/src/logger.ts +180 -0
- package/src/memory.ts +82 -0
- package/src/message.ts +114 -0
- package/src/opcodes/EIP1283.ts +77 -0
- package/src/opcodes/EIP2200.ts +87 -0
- package/src/opcodes/EIP2929.ts +173 -0
- package/src/opcodes/codes.ts +528 -0
- package/src/opcodes/functions.ts +1937 -0
- package/src/opcodes/gas.ts +1329 -0
- package/src/opcodes/index.ts +3 -0
- package/src/opcodes/util.ts +313 -0
- package/src/params.ts +423 -0
- package/src/precompiles/01-ecrecover.ts +77 -0
- package/src/precompiles/02-sha256.ts +32 -0
- package/src/precompiles/03-ripemd160.ts +32 -0
- package/src/precompiles/04-identity.ts +29 -0
- package/src/precompiles/05-modexp.ts +215 -0
- package/src/precompiles/06-bn254-add.ts +49 -0
- package/src/precompiles/07-bn254-mul.ts +50 -0
- package/src/precompiles/08-bn254-pairing.ts +54 -0
- package/src/precompiles/09-blake2f.ts +243 -0
- package/src/precompiles/0a-kzg-point-evaluation.ts +94 -0
- package/src/precompiles/0b-bls12-g1add.ts +63 -0
- package/src/precompiles/0c-bls12-g1msm.ts +87 -0
- package/src/precompiles/0d-bls12-g2add.ts +66 -0
- package/src/precompiles/0e-bls12-g2msm.ts +84 -0
- package/src/precompiles/0f-bls12-pairing.ts +86 -0
- package/src/precompiles/10-bls12-map-fp-to-g1.ts +58 -0
- package/src/precompiles/100-p256verify.ts +152 -0
- package/src/precompiles/11-bls12-map-fp2-to-g2.ts +61 -0
- package/src/precompiles/bls12_381/constants.ts +278 -0
- package/src/precompiles/bls12_381/index.ts +4 -0
- package/src/precompiles/bls12_381/mcl.ts +376 -0
- package/src/precompiles/bls12_381/noble.ts +307 -0
- package/src/precompiles/bls12_381/util.ts +78 -0
- package/src/precompiles/bn254/index.ts +2 -0
- package/src/precompiles/bn254/noble.ts +156 -0
- package/src/precompiles/bn254/rustbn.ts +35 -0
- package/src/precompiles/index.ts +344 -0
- package/src/precompiles/types.ts +15 -0
- package/src/precompiles/util.ts +70 -0
- package/src/stack.ts +166 -0
- package/src/stemCache.ts +45 -0
- package/src/transientStorage.ts +131 -0
- package/src/types.ts +538 -0
package/src/journal.ts
ADDED
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import { Hardfork } from '@feelyourprotocol/common'
|
|
2
|
+
import {
|
|
3
|
+
Address,
|
|
4
|
+
EthereumJSErrorWithoutCode,
|
|
5
|
+
RIPEMD160_ADDRESS_STRING,
|
|
6
|
+
bytesToHex,
|
|
7
|
+
bytesToUnprefixedHex,
|
|
8
|
+
hexToBytes,
|
|
9
|
+
isDebugEnabled,
|
|
10
|
+
stripHexPrefix,
|
|
11
|
+
unprefixedHexToBytes,
|
|
12
|
+
} from '@feelyourprotocol/util'
|
|
13
|
+
import debugDefault from 'debug'
|
|
14
|
+
|
|
15
|
+
import type { Common, StateManagerInterface } from '@feelyourprotocol/common'
|
|
16
|
+
import type { Account, PrefixedHexString } from '@feelyourprotocol/util'
|
|
17
|
+
import type { Debugger } from 'debug'
|
|
18
|
+
|
|
19
|
+
type AddressString = string
|
|
20
|
+
type SlotString = string
|
|
21
|
+
type WarmSlots = Set<SlotString>
|
|
22
|
+
|
|
23
|
+
type JournalType = Map<AddressString, WarmSlots>
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Journal Diff Item:
|
|
27
|
+
* Index 0: remove warm address
|
|
28
|
+
* Index 1: remove warm slots for this warm address
|
|
29
|
+
* Index 2: remove touched
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
type JournalDiffItem = [Set<AddressString>, Map<AddressString, Set<SlotString>>, Set<AddressString>]
|
|
33
|
+
|
|
34
|
+
type JournalHeight = number
|
|
35
|
+
|
|
36
|
+
export class Journal {
|
|
37
|
+
private stateManager: StateManagerInterface
|
|
38
|
+
private common: Common
|
|
39
|
+
private DEBUG: boolean
|
|
40
|
+
private _debug: Debugger
|
|
41
|
+
|
|
42
|
+
private journal!: JournalType
|
|
43
|
+
private alwaysWarmJournal!: Map<AddressString, Set<SlotString>>
|
|
44
|
+
private touched!: Set<AddressString>
|
|
45
|
+
private journalDiff!: [JournalHeight, JournalDiffItem][]
|
|
46
|
+
|
|
47
|
+
private journalHeight: JournalHeight
|
|
48
|
+
|
|
49
|
+
public accessList?: Map<AddressString, Set<SlotString>>
|
|
50
|
+
public preimages?: Map<PrefixedHexString, Uint8Array>
|
|
51
|
+
|
|
52
|
+
constructor(stateManager: StateManagerInterface, common: Common) {
|
|
53
|
+
// Skip DEBUG calls unless 'ethjs' included in environmental DEBUG variables
|
|
54
|
+
this.DEBUG = isDebugEnabled('ethjs')
|
|
55
|
+
|
|
56
|
+
this._debug = debugDefault('evm:journal')
|
|
57
|
+
|
|
58
|
+
// TODO maybe call into this.clearJournal
|
|
59
|
+
this.cleanJournal()
|
|
60
|
+
this.journalHeight = 0
|
|
61
|
+
|
|
62
|
+
this.stateManager = stateManager
|
|
63
|
+
this.common = common
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Clears the internal `accessList` map, and mark this journal to start reporting
|
|
68
|
+
* which addresses and storages have been accessed
|
|
69
|
+
*/
|
|
70
|
+
startReportingAccessList() {
|
|
71
|
+
this.accessList = new Map()
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Clears the internal `preimages` map, and marks this journal to start reporting
|
|
76
|
+
* the images (hashed addresses) of the accounts that have been accessed
|
|
77
|
+
*/
|
|
78
|
+
startReportingPreimages() {
|
|
79
|
+
this.preimages = new Map()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async putAccount(address: Address, account: Account | undefined) {
|
|
83
|
+
this.touchAddress(address)
|
|
84
|
+
return this.stateManager.putAccount(address, account)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async deleteAccount(address: Address) {
|
|
88
|
+
this.touchAddress(address)
|
|
89
|
+
await this.stateManager.deleteAccount(address)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private touchAddress(address: Address): void {
|
|
93
|
+
const str = address.toString().slice(2)
|
|
94
|
+
this.touchAccount(str)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
private touchAccount(address: string) {
|
|
98
|
+
// If preimages are being reported, add the address to the preimages map
|
|
99
|
+
if (this.preimages !== undefined) {
|
|
100
|
+
const bytesAddress = unprefixedHexToBytes(address)
|
|
101
|
+
if (this.stateManager.getAppliedKey === undefined) {
|
|
102
|
+
throw EthereumJSErrorWithoutCode(
|
|
103
|
+
'touchAccount: stateManager.getAppliedKey can not be undefined if preimage storing is enabled',
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
const hashedKey = this.stateManager.getAppliedKey(bytesAddress)
|
|
107
|
+
this.preimages.set(bytesToHex(hashedKey), bytesAddress)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (!this.touched.has(address)) {
|
|
111
|
+
this.touched.add(address)
|
|
112
|
+
const diffArr = this.journalDiff[this.journalDiff.length - 1][1]
|
|
113
|
+
diffArr[2].add(address)
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
async commit() {
|
|
117
|
+
this.journalHeight--
|
|
118
|
+
this.journalDiff.push([this.journalHeight, [new Set(), new Map(), new Set()]])
|
|
119
|
+
await this.stateManager.commit()
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
async checkpoint() {
|
|
123
|
+
this.journalHeight++
|
|
124
|
+
this.journalDiff.push([this.journalHeight, [new Set(), new Map(), new Set()]])
|
|
125
|
+
await this.stateManager.checkpoint()
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
async revert() {
|
|
129
|
+
// Loop backwards over the journal diff and stop if we are at a lower height than current journal height
|
|
130
|
+
// During this process, delete all items.
|
|
131
|
+
// TODO check this logic, if there is this array: height [4,3,4] and we revert height 4, then the final
|
|
132
|
+
// diff arr will be reverted, but it will stop at height 3, so [4,3] are both not reverted..?
|
|
133
|
+
let finalI: number
|
|
134
|
+
for (let i = this.journalDiff.length - 1; i >= 0; i--) {
|
|
135
|
+
finalI = i
|
|
136
|
+
const [height, diff] = this.journalDiff[i]
|
|
137
|
+
if (height < this.journalHeight) {
|
|
138
|
+
break
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const addressSet = diff[0]
|
|
142
|
+
const slotsMap = diff[1]
|
|
143
|
+
const touchedSet = diff[2]
|
|
144
|
+
|
|
145
|
+
for (const address of addressSet) {
|
|
146
|
+
// Sanity check, journal should have the item
|
|
147
|
+
if (this.journal.has(address)) {
|
|
148
|
+
this.journal.delete(address)
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
for (const [address, delSlots] of slotsMap) {
|
|
153
|
+
// Sanity check, the address SHOULD be in the journal
|
|
154
|
+
if (this.journal.has(address)) {
|
|
155
|
+
const slots = this.journal.get(address)!
|
|
156
|
+
for (const delSlot of delSlots) {
|
|
157
|
+
slots.delete(delSlot)
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
for (const address of touchedSet) {
|
|
163
|
+
// Delete the address from the journal
|
|
164
|
+
if (address !== RIPEMD160_ADDRESS_STRING) {
|
|
165
|
+
// If RIPEMD160 is touched, keep it touched.
|
|
166
|
+
// Default behavior for others.
|
|
167
|
+
this.touched.delete(address)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
// the final diffs are reverted and we can dispose those
|
|
173
|
+
this.journalDiff = this.journalDiff.slice(0, finalI! + 1)
|
|
174
|
+
|
|
175
|
+
this.journalHeight--
|
|
176
|
+
|
|
177
|
+
await this.stateManager.revert()
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
public cleanJournal() {
|
|
181
|
+
this.journalHeight = 0
|
|
182
|
+
this.journal = new Map()
|
|
183
|
+
this.alwaysWarmJournal = new Map()
|
|
184
|
+
this.touched = new Set()
|
|
185
|
+
this.journalDiff = [[0, [new Set(), new Map(), new Set()]]]
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Removes accounts from the state trie that have been touched,
|
|
190
|
+
* as defined in EIP-161 (https://eips.ethereum.org/EIPS/eip-161).
|
|
191
|
+
* Also cleanups any other internal fields
|
|
192
|
+
*/
|
|
193
|
+
async cleanup(): Promise<void> {
|
|
194
|
+
if (this.common.gteHardfork(Hardfork.SpuriousDragon)) {
|
|
195
|
+
for (const addressHex of this.touched) {
|
|
196
|
+
const address = new Address(hexToBytes(`0x${addressHex}`))
|
|
197
|
+
const account = await this.stateManager.getAccount(address)
|
|
198
|
+
if (account === undefined || account.isEmpty()) {
|
|
199
|
+
await this.deleteAccount(address)
|
|
200
|
+
if (this.DEBUG) {
|
|
201
|
+
this._debug(`Cleanup touched account address=${address} (>= SpuriousDragon)`)
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
this.cleanJournal()
|
|
207
|
+
delete this.accessList
|
|
208
|
+
delete this.preimages
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
addAlwaysWarmAddress(addressStr: string, addToAccessList: boolean = false) {
|
|
212
|
+
const address = stripHexPrefix(addressStr)
|
|
213
|
+
if (!this.alwaysWarmJournal.has(address)) {
|
|
214
|
+
this.alwaysWarmJournal.set(address, new Set())
|
|
215
|
+
}
|
|
216
|
+
if (addToAccessList && this.accessList !== undefined) {
|
|
217
|
+
if (!this.accessList.has(address)) {
|
|
218
|
+
this.accessList.set(address, new Set())
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
addAlwaysWarmSlot(addressStr: string, slotStr: string, addToAccessList: boolean = false) {
|
|
224
|
+
const address = stripHexPrefix(addressStr)
|
|
225
|
+
this.addAlwaysWarmAddress(address, addToAccessList)
|
|
226
|
+
const slotsSet = this.alwaysWarmJournal.get(address)!
|
|
227
|
+
const slot = stripHexPrefix(slotStr)
|
|
228
|
+
slotsSet.add(slot)
|
|
229
|
+
if (addToAccessList && this.accessList !== undefined) {
|
|
230
|
+
this.accessList.get(address)!.add(slot)
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Returns true if the address is warm in the current context
|
|
236
|
+
* @param address - The address (as a Uint8Array) to check
|
|
237
|
+
*/
|
|
238
|
+
isWarmedAddress(address: Uint8Array): boolean {
|
|
239
|
+
// Using deprecated bytesToUnprefixedHex for performance: this is a hot path used in Map/Set lookups.
|
|
240
|
+
const addressHex = bytesToUnprefixedHex(address)
|
|
241
|
+
const warm = this.journal.has(addressHex) || this.alwaysWarmJournal.has(addressHex)
|
|
242
|
+
return warm
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Add a warm address in the current context
|
|
247
|
+
* @param addressArr - The address (as a Uint8Array) to check
|
|
248
|
+
*/
|
|
249
|
+
addWarmedAddress(addressArr: Uint8Array): void {
|
|
250
|
+
// Using deprecated bytesToUnprefixedHex for performance: this is a hot path used in Map/Set operations.
|
|
251
|
+
const address = bytesToUnprefixedHex(addressArr)
|
|
252
|
+
if (!this.journal.has(address)) {
|
|
253
|
+
this.journal.set(address, new Set())
|
|
254
|
+
const diffArr = this.journalDiff[this.journalDiff.length - 1][1]
|
|
255
|
+
diffArr[0].add(address)
|
|
256
|
+
}
|
|
257
|
+
if (this.accessList !== undefined) {
|
|
258
|
+
if (!this.accessList.has(address)) {
|
|
259
|
+
this.accessList.set(address, new Set())
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Returns true if the slot of the address is warm
|
|
266
|
+
* @param address - The address (as a Uint8Array) to check
|
|
267
|
+
* @param slot - The slot (as a Uint8Array) to check
|
|
268
|
+
*/
|
|
269
|
+
isWarmedStorage(address: Uint8Array, slot: Uint8Array): boolean {
|
|
270
|
+
// Using deprecated bytesToUnprefixedHex for performance: this is a hot path used in Map/Set lookups.
|
|
271
|
+
const addressHex = bytesToUnprefixedHex(address)
|
|
272
|
+
const slots = this.journal.get(addressHex)
|
|
273
|
+
if (slots === undefined) {
|
|
274
|
+
if (this.alwaysWarmJournal.has(addressHex)) {
|
|
275
|
+
return this.alwaysWarmJournal.get(addressHex)!.has(bytesToUnprefixedHex(slot))
|
|
276
|
+
}
|
|
277
|
+
return false
|
|
278
|
+
}
|
|
279
|
+
if (slots.has(bytesToUnprefixedHex(slot))) {
|
|
280
|
+
return true
|
|
281
|
+
} else if (this.alwaysWarmJournal.has(addressHex)) {
|
|
282
|
+
return this.alwaysWarmJournal.get(addressHex)!.has(bytesToUnprefixedHex(slot))
|
|
283
|
+
}
|
|
284
|
+
return false
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Mark the storage slot in the address as warm in the current context
|
|
289
|
+
* @param address - The address (as a Uint8Array) to check
|
|
290
|
+
* @param slot - The slot (as a Uint8Array) to check
|
|
291
|
+
*/
|
|
292
|
+
addWarmedStorage(address: Uint8Array, slot: Uint8Array): void {
|
|
293
|
+
// Using deprecated bytesToUnprefixedHex for performance: this is a hot path used in Map/Set operations.
|
|
294
|
+
const addressHex = bytesToUnprefixedHex(address)
|
|
295
|
+
let slots = this.journal.get(addressHex)
|
|
296
|
+
if (slots === undefined) {
|
|
297
|
+
this.addWarmedAddress(address)
|
|
298
|
+
slots = this.journal.get(addressHex)
|
|
299
|
+
}
|
|
300
|
+
const slotStr = bytesToUnprefixedHex(slot)
|
|
301
|
+
if (!slots!.has(slotStr)) {
|
|
302
|
+
slots!.add(slotStr)
|
|
303
|
+
const diff = this.journalDiff[this.journalDiff.length - 1][1]
|
|
304
|
+
const addressSlotMap = diff[1]
|
|
305
|
+
if (!addressSlotMap.has(addressHex)) {
|
|
306
|
+
addressSlotMap.set(addressHex, new Set())
|
|
307
|
+
}
|
|
308
|
+
const slotsSet = addressSlotMap.get(addressHex)!
|
|
309
|
+
slotsSet.add(slotStr)
|
|
310
|
+
}
|
|
311
|
+
if (this.accessList !== undefined) {
|
|
312
|
+
// Note: in `addWarmedAddress` the address is added to warm addresses
|
|
313
|
+
const addrSet = this.accessList.get(addressHex)!
|
|
314
|
+
addrSet.add(slotStr)
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
package/src/logger.ts
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { EthereumJSErrorWithoutCode } from '@feelyourprotocol/util'
|
|
2
|
+
|
|
3
|
+
type EVMPerformanceLogEntry = {
|
|
4
|
+
calls: number
|
|
5
|
+
time: number
|
|
6
|
+
gasUsed: number
|
|
7
|
+
staticGas?: number
|
|
8
|
+
dynamicGasUsed?: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type EVMPerformanceLogOutput = {
|
|
12
|
+
calls: number // Amount this opcode/precompile was called
|
|
13
|
+
totalTime: number // Amount of seconds taken for this opcode/precompile (rounded to 3 digits)
|
|
14
|
+
avgTimePerCall: number // Avg time per call of this opcode/precompile (rounded to 3 digits)
|
|
15
|
+
gasUsed: number // Total amount of gas used by this opcode/precompile
|
|
16
|
+
millionGasPerSecond: number // How much million gas is executed per second (rounded to 3 digits)
|
|
17
|
+
blocksPerSlot: number // How many blocks is executed per beacon chain slot (rounded to 3 digits)
|
|
18
|
+
tag: string // opcode/precompile tag
|
|
19
|
+
staticGasUsed?: number // total static gas units spent
|
|
20
|
+
dynamicGasUsed?: number // total dynamic gas units spent
|
|
21
|
+
staticGas?: number // static gas of the opcode
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type EVMPerformanceLogs = {
|
|
25
|
+
[tag: string]: EVMPerformanceLogEntry
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const blockGasLimit = 30_000_000 // Block gas limit
|
|
29
|
+
const slotTime = 12 // Time in seconds per slot
|
|
30
|
+
|
|
31
|
+
// Normalize constant to check if execution time is above one block per slot (>=1) or not (<1)
|
|
32
|
+
const bpsNormalizer = blockGasLimit / slotTime
|
|
33
|
+
|
|
34
|
+
export class Timer {
|
|
35
|
+
private startTime: number
|
|
36
|
+
private runTime = 0
|
|
37
|
+
tag: string
|
|
38
|
+
|
|
39
|
+
constructor(tag: string) {
|
|
40
|
+
this.tag = tag
|
|
41
|
+
this.startTime = performance.now()
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
pause() {
|
|
45
|
+
this.runTime = this.runTime + performance.now() - this.startTime
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
unpause() {
|
|
49
|
+
this.startTime = performance.now()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
time() {
|
|
53
|
+
return (performance.now() - this.startTime + this.runTime) / 1000
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class EVMPerformanceLogger {
|
|
58
|
+
private opcodes!: EVMPerformanceLogs
|
|
59
|
+
private precompiles!: EVMPerformanceLogs
|
|
60
|
+
|
|
61
|
+
private currentTimer?: Timer
|
|
62
|
+
|
|
63
|
+
constructor() {
|
|
64
|
+
this.clear()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
clear() {
|
|
68
|
+
this.opcodes = {}
|
|
69
|
+
this.precompiles = {}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
getLogs() {
|
|
73
|
+
// Return nicely formatted logs
|
|
74
|
+
function getLogsFor(obj: EVMPerformanceLogs) {
|
|
75
|
+
const output: EVMPerformanceLogOutput[] = []
|
|
76
|
+
for (const key in obj) {
|
|
77
|
+
const field = obj[key]
|
|
78
|
+
const gasPerSecond = field.gasUsed / field.time
|
|
79
|
+
const entry: EVMPerformanceLogOutput = {
|
|
80
|
+
calls: field.calls,
|
|
81
|
+
totalTime: Math.round(field.time * 1e6) / 1e3,
|
|
82
|
+
avgTimePerCall: Math.round((field.time / field.calls) * 1e6) / 1e3,
|
|
83
|
+
gasUsed: field.gasUsed,
|
|
84
|
+
millionGasPerSecond: Math.round(gasPerSecond / 1e3) / 1e3,
|
|
85
|
+
blocksPerSlot: Math.round((gasPerSecond / bpsNormalizer) * 1e3) / 1e3,
|
|
86
|
+
tag: key,
|
|
87
|
+
}
|
|
88
|
+
if (field.dynamicGasUsed !== undefined) {
|
|
89
|
+
// This is an opcode entry
|
|
90
|
+
entry.staticGas = field.staticGas
|
|
91
|
+
entry.staticGasUsed = field.staticGas! * field.calls
|
|
92
|
+
entry.dynamicGasUsed = field.dynamicGasUsed
|
|
93
|
+
}
|
|
94
|
+
output.push(entry)
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
output.sort((a, b) => {
|
|
98
|
+
return b.millionGasPerSecond - a.millionGasPerSecond
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
return output
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return {
|
|
105
|
+
opcodes: getLogsFor(this.opcodes),
|
|
106
|
+
precompiles: getLogsFor(this.precompiles),
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
hasTimer() {
|
|
111
|
+
return this.currentTimer !== undefined
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// Start a new timer
|
|
115
|
+
// Only one timer can be timing at the same time
|
|
116
|
+
startTimer(tag: string) {
|
|
117
|
+
if (this.currentTimer !== undefined) {
|
|
118
|
+
throw EthereumJSErrorWithoutCode('Cannot have two timers running at the same time')
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
this.currentTimer = new Timer(tag)
|
|
122
|
+
return this.currentTimer
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Pauses current timer and returns that timer
|
|
126
|
+
pauseTimer() {
|
|
127
|
+
const timer = this.currentTimer
|
|
128
|
+
if (timer === undefined) {
|
|
129
|
+
throw EthereumJSErrorWithoutCode('No timer to pause')
|
|
130
|
+
}
|
|
131
|
+
timer.pause()
|
|
132
|
+
this.currentTimer = undefined
|
|
133
|
+
return timer
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Unpauses current timer and returns that timer
|
|
137
|
+
unpauseTimer(timer: Timer) {
|
|
138
|
+
if (this.currentTimer !== undefined) {
|
|
139
|
+
throw EthereumJSErrorWithoutCode('Cannot unpause timer: another timer is already running')
|
|
140
|
+
}
|
|
141
|
+
timer.unpause()
|
|
142
|
+
this.currentTimer = timer
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// Stops a timer from running
|
|
146
|
+
stopTimer(
|
|
147
|
+
timer: Timer,
|
|
148
|
+
gasUsed: number,
|
|
149
|
+
targetTimer: 'precompiles' | 'opcodes' = 'opcodes',
|
|
150
|
+
staticGas?: number,
|
|
151
|
+
dynamicGas?: number,
|
|
152
|
+
) {
|
|
153
|
+
if (this.currentTimer === undefined || this.currentTimer !== timer) {
|
|
154
|
+
throw EthereumJSErrorWithoutCode('Cannot stop timer: another timer is already running')
|
|
155
|
+
}
|
|
156
|
+
const time = timer.time()
|
|
157
|
+
const tag = timer.tag
|
|
158
|
+
this.currentTimer = undefined
|
|
159
|
+
|
|
160
|
+
// Update the fields
|
|
161
|
+
const target = this[targetTimer]
|
|
162
|
+
if (target[tag] === undefined) {
|
|
163
|
+
target[tag] = {
|
|
164
|
+
calls: 0,
|
|
165
|
+
time: 0,
|
|
166
|
+
gasUsed: 0,
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const obj = target[tag]
|
|
170
|
+
|
|
171
|
+
obj.calls++
|
|
172
|
+
obj.time += time
|
|
173
|
+
obj.gasUsed += gasUsed
|
|
174
|
+
|
|
175
|
+
if (targetTimer === 'opcodes') {
|
|
176
|
+
obj.staticGas = staticGas
|
|
177
|
+
obj.dynamicGasUsed = (obj.dynamicGasUsed ?? 0) + dynamicGas!
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
package/src/memory.ts
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { EthereumJSErrorWithoutCode, concatBytes } from '@feelyourprotocol/util'
|
|
2
|
+
|
|
3
|
+
const ceil = (value: number, ceiling: number): number => {
|
|
4
|
+
const r = value % ceiling
|
|
5
|
+
if (r === 0) {
|
|
6
|
+
return value
|
|
7
|
+
} else {
|
|
8
|
+
return value + ceiling - r
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const CONTAINER_SIZE = 8192
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Memory implements a simple memory model
|
|
16
|
+
* for the ethereum virtual machine.
|
|
17
|
+
*/
|
|
18
|
+
export class Memory {
|
|
19
|
+
_store: Uint8Array
|
|
20
|
+
|
|
21
|
+
constructor() {
|
|
22
|
+
this._store = new Uint8Array(CONTAINER_SIZE)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Extends the memory given an offset and size. Rounds extended
|
|
27
|
+
* memory to word-size.
|
|
28
|
+
*/
|
|
29
|
+
extend(offset: number, size: number) {
|
|
30
|
+
if (size === 0) {
|
|
31
|
+
return
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const newSize = ceil(offset + size, 32)
|
|
35
|
+
const sizeDiff = newSize - this._store.length
|
|
36
|
+
if (sizeDiff > 0) {
|
|
37
|
+
const expandBy = Math.ceil(sizeDiff / CONTAINER_SIZE) * CONTAINER_SIZE
|
|
38
|
+
this._store = concatBytes(this._store, new Uint8Array(expandBy))
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Writes a byte array with length `size` to memory, starting from `offset`.
|
|
44
|
+
* @param offset - Starting position
|
|
45
|
+
* @param size - How many bytes to write
|
|
46
|
+
* @param value - Value
|
|
47
|
+
*/
|
|
48
|
+
write(offset: number, size: number, value: Uint8Array) {
|
|
49
|
+
if (size === 0) {
|
|
50
|
+
return
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
this.extend(offset, size)
|
|
54
|
+
|
|
55
|
+
if (value.length !== size) throw EthereumJSErrorWithoutCode('Invalid value size')
|
|
56
|
+
if (offset + size > this._store.length)
|
|
57
|
+
throw EthereumJSErrorWithoutCode('Value exceeds memory capacity')
|
|
58
|
+
|
|
59
|
+
this._store.set(value, offset)
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Reads a slice of memory from `offset` till `offset + size` as a `Uint8Array`.
|
|
64
|
+
* It fills up the difference between memory's length and `offset + size` with zeros.
|
|
65
|
+
* @param offset - Starting position
|
|
66
|
+
* @param size - How many bytes to read
|
|
67
|
+
* @param avoidCopy - Avoid memory copy if possible for performance reasons (optional)
|
|
68
|
+
*/
|
|
69
|
+
read(offset: number, size: number, avoidCopy?: boolean): Uint8Array<ArrayBuffer> {
|
|
70
|
+
this.extend(offset, size)
|
|
71
|
+
|
|
72
|
+
const loaded = this._store.subarray(offset, offset + size) as Uint8Array<ArrayBuffer>
|
|
73
|
+
if (avoidCopy === true) {
|
|
74
|
+
return loaded
|
|
75
|
+
}
|
|
76
|
+
const returnBytes = new Uint8Array(size)
|
|
77
|
+
// Copy the stored "buffer" from memory into the return Uint8Array
|
|
78
|
+
returnBytes.set(loaded)
|
|
79
|
+
|
|
80
|
+
return returnBytes
|
|
81
|
+
}
|
|
82
|
+
}
|
package/src/message.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { BIGINT_0, EthereumJSErrorWithoutCode, createZeroAddress } from '@feelyourprotocol/util'
|
|
2
|
+
|
|
3
|
+
import type { BinaryTreeAccessWitnessInterface } from '@feelyourprotocol/common'
|
|
4
|
+
import type { Address, PrefixedHexString } from '@feelyourprotocol/util'
|
|
5
|
+
import type { PrecompileFunc } from './precompiles/index.ts'
|
|
6
|
+
import type { EOFEnv, SelfdestructMap } from './types.ts'
|
|
7
|
+
|
|
8
|
+
const defaults = {
|
|
9
|
+
value: BIGINT_0,
|
|
10
|
+
caller: createZeroAddress(),
|
|
11
|
+
data: new Uint8Array(0),
|
|
12
|
+
depth: 0,
|
|
13
|
+
isStatic: false,
|
|
14
|
+
isCompiled: false,
|
|
15
|
+
delegatecall: false,
|
|
16
|
+
gasRefund: BIGINT_0,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface MessageOpts {
|
|
20
|
+
to?: Address
|
|
21
|
+
value?: bigint
|
|
22
|
+
caller?: Address
|
|
23
|
+
gasLimit: bigint
|
|
24
|
+
data?: Uint8Array
|
|
25
|
+
eofCallData?: Uint8Array
|
|
26
|
+
depth?: number
|
|
27
|
+
code?: Uint8Array | PrecompileFunc
|
|
28
|
+
codeAddress?: Address
|
|
29
|
+
isStatic?: boolean
|
|
30
|
+
isCompiled?: boolean
|
|
31
|
+
salt?: Uint8Array
|
|
32
|
+
/**
|
|
33
|
+
* Selfdestructed addresses mapped to their beneficiary, see {@link Message.selfdestruct}
|
|
34
|
+
*/
|
|
35
|
+
selfdestruct?: SelfdestructMap
|
|
36
|
+
/**
|
|
37
|
+
* Map of addresses which were created (used in EIP 6780)
|
|
38
|
+
*/
|
|
39
|
+
createdAddresses?: Set<PrefixedHexString>
|
|
40
|
+
delegatecall?: boolean
|
|
41
|
+
gasRefund?: bigint
|
|
42
|
+
blobVersionedHashes?: PrefixedHexString[]
|
|
43
|
+
accessWitness?: BinaryTreeAccessWitnessInterface
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export class Message {
|
|
47
|
+
to?: Address
|
|
48
|
+
value: bigint
|
|
49
|
+
caller: Address
|
|
50
|
+
gasLimit: bigint
|
|
51
|
+
data: Uint8Array
|
|
52
|
+
eofCallData?: Uint8Array // Only used in EOFCreate to signal an EOF contract to be created with this calldata (via EOFCreate)
|
|
53
|
+
isCreate?: boolean
|
|
54
|
+
depth: number
|
|
55
|
+
code?: Uint8Array | PrecompileFunc
|
|
56
|
+
_codeAddress?: Address
|
|
57
|
+
isStatic: boolean
|
|
58
|
+
isCompiled: boolean
|
|
59
|
+
salt?: Uint8Array
|
|
60
|
+
eof?: EOFEnv
|
|
61
|
+
chargeCodeAccesses?: boolean
|
|
62
|
+
/**
|
|
63
|
+
* Selfdestructed addresses mapped to their beneficiary.
|
|
64
|
+
*/
|
|
65
|
+
selfdestruct?: SelfdestructMap
|
|
66
|
+
/**
|
|
67
|
+
* Map of addresses which were created (used in EIP 6780)
|
|
68
|
+
*/
|
|
69
|
+
createdAddresses?: Set<PrefixedHexString>
|
|
70
|
+
delegatecall: boolean
|
|
71
|
+
gasRefund: bigint // Keeps track of the gasRefund at the start of the frame (used for journaling purposes)
|
|
72
|
+
/**
|
|
73
|
+
* List of versioned hashes if message is a blob transaction in the outer VM
|
|
74
|
+
*/
|
|
75
|
+
blobVersionedHashes?: PrefixedHexString[]
|
|
76
|
+
accessWitness?: BinaryTreeAccessWitnessInterface
|
|
77
|
+
|
|
78
|
+
constructor(opts: MessageOpts) {
|
|
79
|
+
this.to = opts.to
|
|
80
|
+
this.value = opts.value ?? defaults.value
|
|
81
|
+
this.caller = opts.caller ?? defaults.caller
|
|
82
|
+
this.gasLimit = opts.gasLimit
|
|
83
|
+
this.data = opts.data ?? defaults.data
|
|
84
|
+
this.eofCallData = opts.eofCallData
|
|
85
|
+
this.depth = opts.depth ?? defaults.depth
|
|
86
|
+
this.code = opts.code
|
|
87
|
+
this._codeAddress = opts.codeAddress
|
|
88
|
+
this.isStatic = opts.isStatic ?? defaults.isStatic
|
|
89
|
+
this.isCompiled = opts.isCompiled ?? defaults.isCompiled
|
|
90
|
+
this.salt = opts.salt
|
|
91
|
+
this.selfdestruct = opts.selfdestruct
|
|
92
|
+
this.createdAddresses = opts.createdAddresses
|
|
93
|
+
this.delegatecall = opts.delegatecall ?? defaults.delegatecall
|
|
94
|
+
this.gasRefund = opts.gasRefund ?? defaults.gasRefund
|
|
95
|
+
this.blobVersionedHashes = opts.blobVersionedHashes
|
|
96
|
+
this.accessWitness = opts.accessWitness
|
|
97
|
+
if (this.value < 0) {
|
|
98
|
+
throw EthereumJSErrorWithoutCode(`value field cannot be negative, received ${this.value}`)
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Note: should only be called in instances where `_codeAddress` or `to` is defined.
|
|
104
|
+
*/
|
|
105
|
+
get codeAddress(): Address {
|
|
106
|
+
const codeAddress = this._codeAddress ?? this.to
|
|
107
|
+
if (!codeAddress) {
|
|
108
|
+
throw EthereumJSErrorWithoutCode('Missing codeAddress')
|
|
109
|
+
}
|
|
110
|
+
return codeAddress
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type MessageWithTo = Message & Pick<Required<MessageOpts>, 'to'>
|