@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,447 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
AccessEventFlags,
|
|
3
|
+
BinaryTreeAccessWitnessInterface,
|
|
4
|
+
BinaryTreeAccessedState,
|
|
5
|
+
BinaryTreeAccessedStateWithAddress,
|
|
6
|
+
RawBinaryTreeAccessedState,
|
|
7
|
+
} from '@feelyourprotocol/common'
|
|
8
|
+
import { BinaryTreeAccessedStateType } from '@feelyourprotocol/common'
|
|
9
|
+
import {
|
|
10
|
+
BIGINT_0,
|
|
11
|
+
BINARY_TREE_BASIC_DATA_LEAF_KEY,
|
|
12
|
+
BINARY_TREE_CODE_HASH_LEAF_KEY,
|
|
13
|
+
BINARY_TREE_CODE_OFFSET,
|
|
14
|
+
BINARY_TREE_HEADER_STORAGE_OFFSET,
|
|
15
|
+
BINARY_TREE_MAIN_STORAGE_OFFSET,
|
|
16
|
+
BINARY_TREE_NODE_WIDTH,
|
|
17
|
+
bytesToHex,
|
|
18
|
+
equalsBytes,
|
|
19
|
+
getBinaryTreeIndicesForCodeChunk,
|
|
20
|
+
getBinaryTreeIndicesForStorageSlot,
|
|
21
|
+
getBinaryTreeKey,
|
|
22
|
+
getBinaryTreeStem,
|
|
23
|
+
hexToBytes,
|
|
24
|
+
intToBytes,
|
|
25
|
+
} from '@feelyourprotocol/util'
|
|
26
|
+
import debugDefault from 'debug'
|
|
27
|
+
|
|
28
|
+
import type { BinaryTree } from '@feelyourprotocol/binarytree'
|
|
29
|
+
import type { StatefulBinaryTreeStateManager } from '@feelyourprotocol/statemanager'
|
|
30
|
+
|
|
31
|
+
import type { Address, BinaryTreeExecutionWitness, PrefixedHexString } from '@feelyourprotocol/util'
|
|
32
|
+
import { ChunkCache } from './chunkCache.ts'
|
|
33
|
+
import { StemCache } from './stemCache.ts'
|
|
34
|
+
|
|
35
|
+
const debug = debugDefault('evm:binaryTree:aw')
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Tree key constants.
|
|
39
|
+
*/
|
|
40
|
+
const WitnessBranchReadCost = BigInt(1900)
|
|
41
|
+
const WitnessChunkReadCost = BigInt(200)
|
|
42
|
+
const WitnessBranchWriteCost = BigInt(3000)
|
|
43
|
+
const WitnessChunkWriteCost = BigInt(500)
|
|
44
|
+
const WitnessChunkFillCost = BigInt(6200)
|
|
45
|
+
|
|
46
|
+
// read is a default access event if stem or chunk is present
|
|
47
|
+
export type BinaryStemAccessEvent = { write?: boolean }
|
|
48
|
+
|
|
49
|
+
export type BinaryChunkAccessEvent = BinaryStemAccessEvent & { fill?: boolean }
|
|
50
|
+
|
|
51
|
+
// Since stem is hashed (could chang for binary), it is useful to maintain the reverse relationship
|
|
52
|
+
export type BinaryStemMeta = { address: Address; treeIndex: number | bigint }
|
|
53
|
+
|
|
54
|
+
export function decodeBinaryAccessState(
|
|
55
|
+
treeIndex: number | bigint,
|
|
56
|
+
chunkIndex: number,
|
|
57
|
+
): BinaryTreeAccessedState {
|
|
58
|
+
const position = BigInt(treeIndex) * BigInt(BINARY_TREE_NODE_WIDTH) + BigInt(chunkIndex)
|
|
59
|
+
switch (position) {
|
|
60
|
+
case BigInt(0):
|
|
61
|
+
return { type: BinaryTreeAccessedStateType.BasicData }
|
|
62
|
+
case BigInt(1):
|
|
63
|
+
return { type: BinaryTreeAccessedStateType.CodeHash }
|
|
64
|
+
default:
|
|
65
|
+
if (position < BINARY_TREE_HEADER_STORAGE_OFFSET) {
|
|
66
|
+
throw Error(`No attribute yet stored >=2 and <${BINARY_TREE_HEADER_STORAGE_OFFSET}`)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (position >= BINARY_TREE_HEADER_STORAGE_OFFSET && position < BINARY_TREE_CODE_OFFSET) {
|
|
70
|
+
const slot = position - BigInt(BINARY_TREE_HEADER_STORAGE_OFFSET)
|
|
71
|
+
return { type: BinaryTreeAccessedStateType.Storage, slot }
|
|
72
|
+
} else if (
|
|
73
|
+
position >= BINARY_TREE_CODE_OFFSET &&
|
|
74
|
+
position < BINARY_TREE_MAIN_STORAGE_OFFSET
|
|
75
|
+
) {
|
|
76
|
+
const codeChunkIdx = Number(position) - BINARY_TREE_CODE_OFFSET
|
|
77
|
+
return {
|
|
78
|
+
type: BinaryTreeAccessedStateType.Code,
|
|
79
|
+
codeOffset: codeChunkIdx * 31,
|
|
80
|
+
}
|
|
81
|
+
} else if (position >= BINARY_TREE_MAIN_STORAGE_OFFSET) {
|
|
82
|
+
const slot = BigInt(position - BINARY_TREE_MAIN_STORAGE_OFFSET)
|
|
83
|
+
return { type: BinaryTreeAccessedStateType.Storage, slot }
|
|
84
|
+
} else {
|
|
85
|
+
throw Error(
|
|
86
|
+
`Invalid treeIndex=${treeIndex} chunkIndex=${chunkIndex} for binary tree access`,
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export class BinaryTreeAccessWitness implements BinaryTreeAccessWitnessInterface {
|
|
93
|
+
stems: Map<PrefixedHexString, BinaryStemAccessEvent & BinaryStemMeta>
|
|
94
|
+
chunks: Map<PrefixedHexString, BinaryChunkAccessEvent>
|
|
95
|
+
stemCache: StemCache = new StemCache()
|
|
96
|
+
chunkCache: ChunkCache = new ChunkCache()
|
|
97
|
+
hashFunction: (msg: Uint8Array) => Uint8Array
|
|
98
|
+
constructor(opts: {
|
|
99
|
+
hashFunction: (msg: Uint8Array) => Uint8Array
|
|
100
|
+
stems?: Map<PrefixedHexString, BinaryStemAccessEvent & BinaryStemMeta>
|
|
101
|
+
chunks?: Map<PrefixedHexString, BinaryChunkAccessEvent>
|
|
102
|
+
}) {
|
|
103
|
+
this.hashFunction = opts.hashFunction
|
|
104
|
+
this.stems = opts.stems ?? new Map<PrefixedHexString, BinaryStemAccessEvent & BinaryStemMeta>()
|
|
105
|
+
this.chunks = opts.chunks ?? new Map<PrefixedHexString, BinaryChunkAccessEvent>()
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
readAccountBasicData(address: Address): bigint {
|
|
109
|
+
return this.touchAddressOnReadAndComputeGas(address, 0, BINARY_TREE_BASIC_DATA_LEAF_KEY)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
writeAccountBasicData(address: Address): bigint {
|
|
113
|
+
return this.touchAddressOnWriteAndComputeGas(address, 0, BINARY_TREE_BASIC_DATA_LEAF_KEY)
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
readAccountCodeHash(address: Address): bigint {
|
|
117
|
+
return this.touchAddressOnReadAndComputeGas(address, 0, BINARY_TREE_CODE_HASH_LEAF_KEY)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
writeAccountCodeHash(address: Address): bigint {
|
|
121
|
+
return this.touchAddressOnWriteAndComputeGas(address, 0, BINARY_TREE_CODE_HASH_LEAF_KEY)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
readAccountHeader(address: Address): bigint {
|
|
125
|
+
let gas = BIGINT_0
|
|
126
|
+
|
|
127
|
+
gas += this.readAccountBasicData(address)
|
|
128
|
+
gas += this.readAccountCodeHash(address)
|
|
129
|
+
|
|
130
|
+
return gas
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
writeAccountHeader(address: Address): bigint {
|
|
134
|
+
let gas = BIGINT_0
|
|
135
|
+
|
|
136
|
+
gas += this.writeAccountBasicData(address)
|
|
137
|
+
gas += this.writeAccountCodeHash(address)
|
|
138
|
+
|
|
139
|
+
return gas
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
readAccountCodeChunks(contract: Address, startPc: number, endPc: number): bigint {
|
|
143
|
+
let gas = BIGINT_0
|
|
144
|
+
for (let chunkNum = Math.floor(startPc / 31); chunkNum <= Math.floor(endPc / 31); chunkNum++) {
|
|
145
|
+
const { treeIndex, subIndex } = getBinaryTreeIndicesForCodeChunk(chunkNum)
|
|
146
|
+
gas += this.touchAddressOnReadAndComputeGas(contract, treeIndex, subIndex)
|
|
147
|
+
}
|
|
148
|
+
return gas
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
writeAccountCodeChunks(contract: Address, startPc: number, endPc: number): bigint {
|
|
152
|
+
let gas = BIGINT_0
|
|
153
|
+
for (let chunkNum = Math.floor(startPc / 31); chunkNum <= Math.floor(endPc / 31); chunkNum++) {
|
|
154
|
+
const { treeIndex, subIndex } = getBinaryTreeIndicesForCodeChunk(chunkNum)
|
|
155
|
+
gas += this.touchAddressOnWriteAndComputeGas(contract, treeIndex, subIndex)
|
|
156
|
+
}
|
|
157
|
+
return gas
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
readAccountStorage(address: Address, storageSlot: bigint): bigint {
|
|
161
|
+
const { treeIndex, subIndex } = getBinaryTreeIndicesForStorageSlot(storageSlot)
|
|
162
|
+
return this.touchAddressOnReadAndComputeGas(address, treeIndex, subIndex)
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
writeAccountStorage(address: Address, storageSlot: bigint): bigint {
|
|
166
|
+
const { treeIndex, subIndex } = getBinaryTreeIndicesForStorageSlot(storageSlot)
|
|
167
|
+
return this.touchAddressOnWriteAndComputeGas(address, treeIndex, subIndex)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
touchAddressOnWriteAndComputeGas(
|
|
171
|
+
address: Address,
|
|
172
|
+
treeIndex: number | bigint,
|
|
173
|
+
subIndex: number | Uint8Array,
|
|
174
|
+
): bigint {
|
|
175
|
+
return this.touchAddressAndComputeGas(address, treeIndex, subIndex, {
|
|
176
|
+
isWrite: true,
|
|
177
|
+
})
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
touchAddressOnReadAndComputeGas(
|
|
181
|
+
address: Address,
|
|
182
|
+
treeIndex: number | bigint,
|
|
183
|
+
subIndex: number | Uint8Array,
|
|
184
|
+
): bigint {
|
|
185
|
+
return this.touchAddressAndComputeGas(address, treeIndex, subIndex, {
|
|
186
|
+
isWrite: false,
|
|
187
|
+
})
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
touchAddressAndComputeGas(
|
|
191
|
+
address: Address,
|
|
192
|
+
treeIndex: number | bigint,
|
|
193
|
+
subIndex: number | Uint8Array,
|
|
194
|
+
{ isWrite }: { isWrite?: boolean },
|
|
195
|
+
): bigint {
|
|
196
|
+
let gas = BIGINT_0
|
|
197
|
+
|
|
198
|
+
const { stemRead, stemWrite, chunkRead, chunkWrite, chunkFill } = this.touchAddress(
|
|
199
|
+
address,
|
|
200
|
+
treeIndex,
|
|
201
|
+
subIndex,
|
|
202
|
+
{ isWrite },
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
if (stemRead === true) {
|
|
206
|
+
gas += WitnessBranchReadCost
|
|
207
|
+
}
|
|
208
|
+
if (stemWrite === true) {
|
|
209
|
+
gas += WitnessBranchWriteCost
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
if (chunkRead === true) {
|
|
213
|
+
gas += WitnessChunkReadCost
|
|
214
|
+
}
|
|
215
|
+
if (chunkWrite === true) {
|
|
216
|
+
gas += WitnessChunkWriteCost
|
|
217
|
+
}
|
|
218
|
+
if (chunkFill === true) {
|
|
219
|
+
gas += WitnessChunkFillCost
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
debug(
|
|
223
|
+
`touchAddressAndComputeGas=${gas} address=${address} treeIndex=${treeIndex} subIndex=${subIndex}`,
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
return gas
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
touchAddress(
|
|
230
|
+
address: Address,
|
|
231
|
+
treeIndex: number | bigint,
|
|
232
|
+
subIndex: number | Uint8Array,
|
|
233
|
+
{ isWrite }: { isWrite?: boolean } = {},
|
|
234
|
+
): AccessEventFlags {
|
|
235
|
+
let stemRead = false,
|
|
236
|
+
stemWrite = false,
|
|
237
|
+
chunkRead = false,
|
|
238
|
+
chunkWrite = false
|
|
239
|
+
// currently there are no gas charges for setting the chunk for the first time
|
|
240
|
+
// i.e. no fill cost is charged right now
|
|
241
|
+
const chunkFill = false
|
|
242
|
+
|
|
243
|
+
const accessedStemKey = getBinaryTreeStem(this.hashFunction, address, treeIndex)
|
|
244
|
+
const accessedStemHex = bytesToHex(accessedStemKey)
|
|
245
|
+
let accessedStem = this.stemCache.get(accessedStemHex) ?? this.stems.get(accessedStemHex)
|
|
246
|
+
if (accessedStem === undefined) {
|
|
247
|
+
stemRead = true
|
|
248
|
+
accessedStem = { address, treeIndex }
|
|
249
|
+
this.stemCache.set(accessedStemHex, accessedStem)
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
const accessedChunkKey = getBinaryTreeKey(
|
|
253
|
+
accessedStemKey,
|
|
254
|
+
typeof subIndex === 'number' ? intToBytes(subIndex) : subIndex,
|
|
255
|
+
)
|
|
256
|
+
const accessedChunkKeyHex = bytesToHex(accessedChunkKey)
|
|
257
|
+
let accessedChunk =
|
|
258
|
+
this.chunkCache.get(accessedChunkKeyHex) ?? this.chunks.get(accessedChunkKeyHex)
|
|
259
|
+
if (accessedChunk === undefined) {
|
|
260
|
+
chunkRead = true
|
|
261
|
+
accessedChunk = {}
|
|
262
|
+
this.chunkCache.set(accessedChunkKeyHex, accessedChunk)
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
if (isWrite === true) {
|
|
266
|
+
if (accessedStem.write !== true) {
|
|
267
|
+
stemWrite = true
|
|
268
|
+
// this would also directly modify in the map
|
|
269
|
+
accessedStem.write = true
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
if (accessedChunk.write !== true) {
|
|
273
|
+
chunkWrite = true
|
|
274
|
+
// this would also directly modify in the map
|
|
275
|
+
accessedChunk.write = true
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
debug(
|
|
280
|
+
`${accessedChunkKeyHex}: isWrite=${isWrite} for stemRead=${stemRead} stemWrite=${stemWrite} chunkRead=${chunkRead} chunkWrite=${chunkWrite} chunkFill=${chunkFill}`,
|
|
281
|
+
)
|
|
282
|
+
return { stemRead, stemWrite, chunkRead, chunkWrite, chunkFill }
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
merge(accessWitness: BinaryTreeAccessWitness): void {
|
|
286
|
+
for (const [chunkKey, chunkValue] of accessWitness.chunks.entries()) {
|
|
287
|
+
const stemKey = chunkKey.slice(0, chunkKey.length - 2) as PrefixedHexString
|
|
288
|
+
const stem = accessWitness.stems.get(stemKey)
|
|
289
|
+
if (stem === undefined) {
|
|
290
|
+
throw Error(`Internal error: missing stem for the chunkKey=${chunkKey}`)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
const thisStem = this.stems.get(stemKey)
|
|
294
|
+
if (thisStem === undefined) {
|
|
295
|
+
this.stems.set(stemKey, stem)
|
|
296
|
+
} else {
|
|
297
|
+
thisStem.write = thisStem.write !== true ? stem.write : true
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
const thisChunk = this.chunks.get(chunkKey)
|
|
301
|
+
if (thisChunk === undefined) {
|
|
302
|
+
this.chunks.set(chunkKey, chunkValue)
|
|
303
|
+
} else {
|
|
304
|
+
thisChunk.write = thisChunk.write !== true ? chunkValue.write : true
|
|
305
|
+
thisChunk.fill = thisChunk.fill !== true ? thisChunk.fill : true
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
commit(): void {
|
|
311
|
+
const cachedStems = this.stemCache.commit()
|
|
312
|
+
for (const [stemKey, stemValue] of cachedStems) {
|
|
313
|
+
this.stems.set(stemKey, stemValue)
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const cachedChunks = this.chunkCache.commit()
|
|
317
|
+
for (const [chunkKey, chunkValue] of cachedChunks) {
|
|
318
|
+
this.chunks.set(chunkKey, chunkValue)
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
revert(): void {
|
|
323
|
+
this.stemCache.clear()
|
|
324
|
+
this.chunkCache.clear()
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
debugWitnessCost(): void {
|
|
328
|
+
// Calculate the aggregate gas cost for binary access witness per type
|
|
329
|
+
let stemReads = 0,
|
|
330
|
+
stemWrites = 0,
|
|
331
|
+
chunkReads = 0,
|
|
332
|
+
chunkWrites = 0
|
|
333
|
+
|
|
334
|
+
for (const [_, { write }] of this.stems.entries()) {
|
|
335
|
+
stemReads++
|
|
336
|
+
if (write === true) {
|
|
337
|
+
stemWrites++
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
for (const [_, { write }] of this.chunks.entries()) {
|
|
341
|
+
chunkReads++
|
|
342
|
+
if (write === true) {
|
|
343
|
+
chunkWrites++
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
debug(
|
|
347
|
+
`${stemReads} stem reads, totalling ${BigInt(stemReads) * WitnessBranchReadCost} gas units`,
|
|
348
|
+
)
|
|
349
|
+
debug(
|
|
350
|
+
`${stemWrites} stem writes, totalling ${BigInt(stemWrites) * WitnessBranchWriteCost} gas units`,
|
|
351
|
+
)
|
|
352
|
+
debug(
|
|
353
|
+
`${chunkReads} chunk reads, totalling ${BigInt(chunkReads) * WitnessChunkReadCost} gas units`,
|
|
354
|
+
)
|
|
355
|
+
debug(
|
|
356
|
+
`${chunkWrites} chunk writes, totalling ${BigInt(chunkWrites) * WitnessChunkWriteCost} gas units`,
|
|
357
|
+
)
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
*rawAccesses(): Generator<RawBinaryTreeAccessedState> {
|
|
361
|
+
for (const chunkKey of this.chunks.keys()) {
|
|
362
|
+
// drop the last byte
|
|
363
|
+
const stemKey = chunkKey.slice(0, chunkKey.length - 2) as PrefixedHexString
|
|
364
|
+
const stem = this.stems.get(stemKey)
|
|
365
|
+
if (stem === undefined) {
|
|
366
|
+
throw Error(`Internal error: missing stem for the chunkKey=${chunkKey}`)
|
|
367
|
+
}
|
|
368
|
+
const { address, treeIndex } = stem
|
|
369
|
+
const chunkIndex = Number(`0x${chunkKey.slice(chunkKey.length - 2)}`)
|
|
370
|
+
const accessedState = { address, treeIndex, chunkIndex, chunkKey }
|
|
371
|
+
yield accessedState
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
*accesses(): Generator<BinaryTreeAccessedStateWithAddress> {
|
|
376
|
+
for (const rawAccess of this.rawAccesses()) {
|
|
377
|
+
const { address, treeIndex, chunkIndex, chunkKey } = rawAccess
|
|
378
|
+
const accessedState = decodeBinaryAccessState(treeIndex, chunkIndex)
|
|
379
|
+
yield { ...accessedState, address, chunkKey }
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Generate a {@link BinaryTreeExecutionWitness} from a state manager and an access witness.
|
|
386
|
+
* @param stateManager - The state manager containing the state to generate the witness for.
|
|
387
|
+
* @param accessWitness - The access witness containing the accessed states.
|
|
388
|
+
* @param parentStateRoot - The parent state root (i.e. prestate root) to generate the witness for.
|
|
389
|
+
* @returns The generated binary tree execution witness
|
|
390
|
+
*/
|
|
391
|
+
export const generateBinaryExecutionWitness = async (
|
|
392
|
+
stateManager: StatefulBinaryTreeStateManager,
|
|
393
|
+
accessWitness: BinaryTreeAccessWitness,
|
|
394
|
+
parentStateRoot: Uint8Array,
|
|
395
|
+
): Promise<BinaryTreeExecutionWitness> => {
|
|
396
|
+
const tree = stateManager['_tree'] as BinaryTree
|
|
397
|
+
await tree['_lock'].acquire()
|
|
398
|
+
const postStateRoot = await stateManager.getStateRoot()
|
|
399
|
+
const ew: BinaryTreeExecutionWitness = {
|
|
400
|
+
stateDiff: [],
|
|
401
|
+
parentStateRoot: bytesToHex(parentStateRoot),
|
|
402
|
+
proof: undefined as any, // Binary proofs are not implemented
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Generate a map of all stems with their accessed suffixes
|
|
406
|
+
const accessedSuffixes = new Map<PrefixedHexString, number[]>()
|
|
407
|
+
for (const chunkKey of accessWitness['chunks'].keys()) {
|
|
408
|
+
const stem = chunkKey.slice(0, 64) as PrefixedHexString
|
|
409
|
+
if (accessedSuffixes.has(stem)) {
|
|
410
|
+
const suffixes = accessedSuffixes.get(stem)
|
|
411
|
+
suffixes!.push(parseInt(chunkKey.slice(64), 16))
|
|
412
|
+
accessedSuffixes.set(stem, suffixes!)
|
|
413
|
+
} else {
|
|
414
|
+
accessedSuffixes.set(stem, [parseInt(chunkKey.slice(64), 16)])
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
// Get values from the tree for each stem and suffix
|
|
419
|
+
for (const stem of accessedSuffixes.keys()) {
|
|
420
|
+
tree.root(parentStateRoot)
|
|
421
|
+
const suffixes = accessedSuffixes.get(stem)
|
|
422
|
+
if (suffixes === undefined || suffixes.length === 0) continue
|
|
423
|
+
const currentValues = await tree.get(hexToBytes(stem), suffixes)
|
|
424
|
+
tree.root(postStateRoot)
|
|
425
|
+
const newValues = await tree.get(hexToBytes(stem), suffixes)
|
|
426
|
+
const stemStateDiff = []
|
|
427
|
+
for (let x = 0; x < suffixes.length; x++) {
|
|
428
|
+
// skip if both are the same
|
|
429
|
+
const currentValue = currentValues[x]
|
|
430
|
+
const newValue = newValues[x]
|
|
431
|
+
if (
|
|
432
|
+
currentValue instanceof Uint8Array &&
|
|
433
|
+
newValue instanceof Uint8Array &&
|
|
434
|
+
equalsBytes(currentValue, newValue)
|
|
435
|
+
)
|
|
436
|
+
continue
|
|
437
|
+
stemStateDiff.push({
|
|
438
|
+
suffix: suffixes[x],
|
|
439
|
+
currentValue: currentValue ? bytesToHex(currentValue) : null,
|
|
440
|
+
newValue: newValue ? bytesToHex(newValue) : null,
|
|
441
|
+
})
|
|
442
|
+
}
|
|
443
|
+
ew.stateDiff.push({ stem, suffixDiffs: stemStateDiff })
|
|
444
|
+
}
|
|
445
|
+
tree['_lock'].release()
|
|
446
|
+
return ew
|
|
447
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { PrefixedHexString } from '@feelyourprotocol/util'
|
|
2
|
+
import type { BinaryChunkAccessEvent } from './binaryTreeAccessWitness.ts'
|
|
3
|
+
|
|
4
|
+
export class ChunkCache {
|
|
5
|
+
cache: Map<PrefixedHexString, BinaryChunkAccessEvent>
|
|
6
|
+
|
|
7
|
+
constructor() {
|
|
8
|
+
this.cache = new Map<PrefixedHexString, BinaryChunkAccessEvent>()
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
set(stemKey: PrefixedHexString, accessedStem: BinaryChunkAccessEvent) {
|
|
12
|
+
this.cache.set(stemKey, accessedStem)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get(stemHex: PrefixedHexString): BinaryChunkAccessEvent | undefined {
|
|
16
|
+
return this.cache.get(stemHex)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
del(stemHex: PrefixedHexString): void {
|
|
20
|
+
this.cache.delete(stemHex)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
commit(): [PrefixedHexString, BinaryChunkAccessEvent][] {
|
|
24
|
+
const items: [PrefixedHexString, BinaryChunkAccessEvent][] = Array.from(this.cache.entries())
|
|
25
|
+
this.clear()
|
|
26
|
+
return items
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
clear(): void {
|
|
30
|
+
this.cache.clear()
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
size() {
|
|
34
|
+
return this.cache.size
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Common, Mainnet } from '@feelyourprotocol/common'
|
|
2
|
+
import { SimpleStateManager } from '@feelyourprotocol/statemanager'
|
|
3
|
+
|
|
4
|
+
import { EVM } from './index.ts'
|
|
5
|
+
import { NobleBN254 } from './precompiles/index.ts'
|
|
6
|
+
import { EVMMockBlockchain } from './types.ts'
|
|
7
|
+
|
|
8
|
+
import type { EVMOpts } from './index.ts'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Use this async static constructor for the initialization
|
|
12
|
+
* of an EVM object
|
|
13
|
+
*
|
|
14
|
+
* @param createOpts The EVM options
|
|
15
|
+
* @returns A new EVM
|
|
16
|
+
*/
|
|
17
|
+
export async function createEVM(createOpts?: EVMOpts) {
|
|
18
|
+
const opts = createOpts ?? ({} as EVMOpts)
|
|
19
|
+
|
|
20
|
+
opts.bn254 = new NobleBN254()
|
|
21
|
+
|
|
22
|
+
if (opts.common === undefined) {
|
|
23
|
+
opts.common = new Common({ chain: Mainnet })
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (opts.blockchain === undefined) {
|
|
27
|
+
opts.blockchain = new EVMMockBlockchain()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (opts.stateManager === undefined) {
|
|
31
|
+
opts.stateManager = new SimpleStateManager()
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return new EVM(opts)
|
|
35
|
+
}
|
package/src/eip7708.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
type Address,
|
|
3
|
+
SYSTEM_ADDRESS_BYTES,
|
|
4
|
+
bigIntToBytes,
|
|
5
|
+
hexToBytes,
|
|
6
|
+
setLengthLeft,
|
|
7
|
+
} from '@feelyourprotocol/util'
|
|
8
|
+
import type { Log } from './types.ts'
|
|
9
|
+
|
|
10
|
+
/** EIP-7708 system address (canonical SYSTEM_ADDRESS_BYTES from util) */
|
|
11
|
+
export const EIP7708_SYSTEM_ADDRESS = SYSTEM_ADDRESS_BYTES
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* EIP-7708: keccak256('Transfer(address,address,uint256)')
|
|
15
|
+
* This matches the ERC-20 Transfer event signature
|
|
16
|
+
*/
|
|
17
|
+
export const EIP7708_TRANSFER_TOPIC = hexToBytes(
|
|
18
|
+
'0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* EIP-7708: keccak256('Selfdestruct(address,uint256)')
|
|
23
|
+
* Emitted when a contract selfdestructs and burns remaining balance
|
|
24
|
+
*/
|
|
25
|
+
export const EIP7708_SELFDESTRUCT_TOPIC = hexToBytes(
|
|
26
|
+
'0x4bfaba3443c1a1836cd362418edc679fc96cae8449cbefccb6457cdf2c943083',
|
|
27
|
+
)
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates an EIP-7708 ETH transfer log (used for CALL/CREATE value transfers).
|
|
31
|
+
* EIP-7708 logs are emitted from the system address with Transfer(address,address,uint256) topic.
|
|
32
|
+
*/
|
|
33
|
+
export function createEIP7708TransferLog(from: Address, to: Address, value: bigint): Log {
|
|
34
|
+
const fromTopic = setLengthLeft(from.bytes, 32)
|
|
35
|
+
const toTopic = setLengthLeft(to.bytes, 32)
|
|
36
|
+
const data = setLengthLeft(bigIntToBytes(value), 32)
|
|
37
|
+
return [EIP7708_SYSTEM_ADDRESS, [EIP7708_TRANSFER_TOPIC, fromTopic, toTopic], data]
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Creates an EIP-7708 SELFDESTRUCT burn log for residual balance finalization.
|
|
42
|
+
*/
|
|
43
|
+
export function createEIP7708SelfdestructLog(contract: Address, value: bigint): Log {
|
|
44
|
+
const contractTopic = setLengthLeft(contract.bytes, 32)
|
|
45
|
+
const data = setLengthLeft(bigIntToBytes(value), 32)
|
|
46
|
+
return [EIP7708_SYSTEM_ADDRESS, [EIP7708_SELFDESTRUCT_TOPIC, contractTopic], data]
|
|
47
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Constants, which are taken from https://eips.ethereum.org/EIPS/eip-3540
|
|
2
|
+
|
|
3
|
+
// The "starting bytes" of an EOF contract
|
|
4
|
+
export const FORMAT = 0xef
|
|
5
|
+
export const MAGIC = 0x00
|
|
6
|
+
export const VERSION = 0x01
|
|
7
|
+
|
|
8
|
+
// The min/max sizes of valid headers
|
|
9
|
+
export const MIN_HEADER_SIZE = 15 // Min size used to invalidate an invalid container quickly
|
|
10
|
+
export const MAX_HEADER_SIZE = 49152 // Max initcode size, EIP 3860
|
|
11
|
+
|
|
12
|
+
export const KIND_TYPE = 0x01 // Type byte of types section
|
|
13
|
+
export const KIND_CODE = 0x02 // Type byte of code section
|
|
14
|
+
export const KIND_CONTAINER = 0x03 // Type byte of container section (the only optional section in the header)
|
|
15
|
+
export const KIND_DATA = 0x04 // Type byte of data section
|
|
16
|
+
export const TERMINATOR = 0x00 // Terminator byte of header
|
|
17
|
+
|
|
18
|
+
export const TYPE_MIN = 0x0004 // Minimum size of types section
|
|
19
|
+
export const TYPE_MAX = 0x1000 // Maximum size of types section
|
|
20
|
+
export const TYPE_DIVISOR = 4 // Divisor of types: the type section size should be a multiple of this
|
|
21
|
+
|
|
22
|
+
export const CODE_MIN = 0x0001 // Minimum size of code section
|
|
23
|
+
|
|
24
|
+
export const CODE_SIZE_MIN = 1 // Minimum size of a code section in the body (the actual code)
|
|
25
|
+
|
|
26
|
+
export const CONTAINER_MIN = 0x0001 // Minimum size of container section
|
|
27
|
+
export const CONTAINER_MAX = 0x0100 // Maximum size of container section
|
|
28
|
+
|
|
29
|
+
export const CONTAINER_SIZE_MIN = 1 // Minimum size of a container in the body
|
|
30
|
+
|
|
31
|
+
// Constants regarding the type section in the body of the container
|
|
32
|
+
export const INPUTS_MAX = 0x7f // Max inputs to a code section in the body
|
|
33
|
+
export const OUTPUTS_MAX = 0x80 // Max outputs of a code section in the body
|
|
34
|
+
// Note: 0x80 special amount, marks the code section as "terminating"
|
|
35
|
+
// A terminating section will exit the current call frame, such as RETURN / STOP opcodes. It will not RETF to another code section
|
|
36
|
+
export const MAX_STACK_HEIGHT = 0x03ff // Maximum stack height of a code section (enforces that the stack of this section cannot overflow)
|