├── .github └── workflows │ ├── build-and-test.yml │ ├── nightly-check-db.yml │ └── qkcli-test.yml ├── .gitignore ├── .pre-commit-config.yaml ├── DAPP.MD ├── LICENSE ├── README.md ├── STYLE ├── change_coinbase.sh ├── devnet └── singularity │ └── cluster_config.json ├── ethereum └── pow │ ├── ethash.py │ ├── ethash_utils.py │ ├── ethpow.py │ └── tests │ └── test_ethash.py ├── fixtures ├── GeneralStateTests │ ├── stArgsZeroOneBalance │ │ ├── addNonConst.json │ │ ├── addmodNonConst.json │ │ ├── andNonConst.json │ │ ├── balanceNonConst.json │ │ ├── byteNonConst.json │ │ ├── callNonConst.json │ │ ├── callcodeNonConst.json │ │ ├── calldatacopyNonConst.json │ │ ├── calldataloadNonConst.json │ │ ├── codecopyNonConst.json │ │ ├── createNonConst.json │ │ ├── delegatecallNonConst.json │ │ ├── divNonConst.json │ │ ├── eqNonConst.json │ │ ├── expNonConst.json │ │ ├── extcodecopyNonConst.json │ │ ├── extcodesizeNonConst.json │ │ ├── gtNonConst.json │ │ ├── iszeroNonConst.json │ │ ├── jumpNonConst.json │ │ ├── jumpiNonConst.json │ │ ├── log0NonConst.json │ │ ├── log1NonConst.json │ │ ├── log2NonConst.json │ │ ├── log3NonConst.json │ │ ├── ltNonConst.json │ │ ├── mloadNonConst.json │ │ ├── modNonConst.json │ │ ├── mstore8NonConst.json │ │ ├── mstoreNonConst.json │ │ ├── mulNonConst.json │ │ ├── mulmodNonConst.json │ │ ├── notNonConst.json │ │ ├── orNonConst.json │ │ ├── returnNonConst.json │ │ ├── sdivNonConst.json │ │ ├── sgtNonConst.json │ │ ├── sha3NonConst.json │ │ ├── signextNonConst.json │ │ ├── sloadNonConst.json │ │ ├── sltNonConst.json │ │ ├── smodNonConst.json │ │ ├── sstoreNonConst.json │ │ ├── subNonConst.json │ │ ├── suicideNonConst.json │ │ └── xorNonConst.json │ ├── stAttackTest │ │ ├── ContractCreationSpam.json │ │ └── CrashingTransaction.json │ ├── stBadOpcode │ │ └── badOpcodes.json │ ├── stBugs │ │ ├── evmBytecode.json │ │ ├── randomStatetestDEFAULT-Tue_07_58_41-15153-575192.json │ │ ├── returndatacopyPythonBug_Tue_03_48_41-1432.json │ │ └── staticcall_createfails.json │ ├── stCallCodes │ │ ├── call_OOG_additionalGasCosts1.json │ │ ├── call_OOG_additionalGasCosts2.json │ │ ├── callcall_00.json │ │ ├── callcall_00_OOGE.json │ │ ├── callcall_00_OOGE_valueTransfer.json │ │ ├── callcall_00_SuicideEnd.json │ │ ├── callcallcall_000.json │ │ ├── callcallcall_000_OOGE.json │ │ ├── callcallcall_000_OOGMAfter.json │ │ ├── callcallcall_000_OOGMBefore.json │ │ ├── callcallcall_000_SuicideEnd.json │ │ ├── callcallcall_000_SuicideMiddle.json │ │ ├── callcallcall_ABCB_RECURSIVE.json │ │ ├── callcallcallcode_001.json │ │ ├── callcallcallcode_001_OOGE.json │ │ ├── callcallcallcode_001_OOGMAfter.json │ │ ├── callcallcallcode_001_OOGMBefore.json │ │ ├── callcallcallcode_001_SuicideEnd.json │ │ ├── callcallcallcode_001_SuicideMiddle.json │ │ ├── callcallcallcode_ABCB_RECURSIVE.json │ │ ├── callcallcode_01.json │ │ ├── callcallcode_01_OOGE.json │ │ ├── callcallcode_01_SuicideEnd.json │ │ ├── callcallcodecall_010.json │ │ ├── callcallcodecall_010_OOGE.json │ │ ├── callcallcodecall_010_OOGMAfter.json │ │ ├── callcallcodecall_010_OOGMBefore.json │ │ ├── callcallcodecall_010_SuicideEnd.json │ │ ├── callcallcodecall_010_SuicideMiddle.json │ │ ├── callcallcodecall_ABCB_RECURSIVE.json │ │ ├── callcallcodecallcode_011.json │ │ ├── callcallcodecallcode_011_OOGE.json │ │ ├── callcallcodecallcode_011_OOGMAfter.json │ │ ├── callcallcodecallcode_011_OOGMBefore.json │ │ ├── callcallcodecallcode_011_SuicideEnd.json │ │ ├── callcallcodecallcode_011_SuicideMiddle.json │ │ ├── callcallcodecallcode_ABCB_RECURSIVE.json │ │ ├── callcodeDynamicCode.json │ │ ├── callcodeDynamicCode2SelfCall.json │ │ ├── callcodeEmptycontract.json │ │ ├── callcodeInInitcodeToEmptyContract.json │ │ ├── callcodeInInitcodeToExisContractWithVTransferNEMoney.json │ │ ├── callcodeInInitcodeToExistingContract.json │ │ ├── callcodeInInitcodeToExistingContractWithValueTransfer.json │ │ ├── callcode_checkPC.json │ │ ├── callcodecall_10.json │ │ ├── callcodecall_10_OOGE.json │ │ ├── callcodecall_10_SuicideEnd.json │ │ ├── callcodecallcall_100.json │ │ ├── callcodecallcall_100_OOGE.json │ │ ├── callcodecallcall_100_OOGMAfter.json │ │ ├── callcodecallcall_100_OOGMBefore.json │ │ ├── callcodecallcall_100_SuicideEnd.json │ │ ├── callcodecallcall_100_SuicideMiddle.json │ │ ├── callcodecallcall_ABCB_RECURSIVE.json │ │ ├── callcodecallcallcode_101.json │ │ ├── callcodecallcallcode_101_OOGE.json │ │ ├── callcodecallcallcode_101_OOGMAfter.json │ │ ├── callcodecallcallcode_101_OOGMBefore.json │ │ ├── callcodecallcallcode_101_SuicideEnd.json │ │ ├── callcodecallcallcode_101_SuicideMiddle.json │ │ ├── callcodecallcallcode_ABCB_RECURSIVE.json │ │ ├── callcodecallcode_11.json │ │ ├── callcodecallcode_11_OOGE.json │ │ ├── callcodecallcode_11_SuicideEnd.json │ │ ├── callcodecallcodecall_110.json │ │ ├── callcodecallcodecall_110_OOGE.json │ │ ├── callcodecallcodecall_110_OOGMAfter.json │ │ ├── callcodecallcodecall_110_OOGMBefore.json │ │ ├── callcodecallcodecall_110_SuicideEnd.json │ │ ├── callcodecallcodecall_110_SuicideMiddle.json │ │ ├── callcodecallcodecall_ABCB_RECURSIVE.json │ │ ├── callcodecallcodecallcode_111.json │ │ ├── callcodecallcodecallcode_111_OOGE.json │ │ ├── callcodecallcodecallcode_111_OOGMAfter.json │ │ ├── callcodecallcodecallcode_111_OOGMBefore.json │ │ ├── callcodecallcodecallcode_111_SuicideEnd.json │ │ ├── callcodecallcodecallcode_111_SuicideMiddle.json │ │ └── callcodecallcodecallcode_ABCB_RECURSIVE.json │ ├── stCallCreateCallCodeTest │ │ ├── Call1024BalanceTooLow.json │ │ ├── Call1024OOG.json │ │ ├── Call1024PreCalls.json │ │ ├── CallLoseGasOOG.json │ │ ├── CallRecursiveBombPreCall.json │ │ ├── Callcode1024BalanceTooLow.json │ │ ├── Callcode1024OOG.json │ │ ├── CallcodeLoseGasOOG.json │ │ ├── callOutput1.json │ │ ├── callOutput2.json │ │ ├── callOutput3.json │ │ ├── callOutput3Fail.json │ │ ├── callOutput3partial.json │ │ ├── callOutput3partialFail.json │ │ ├── callWithHighValue.json │ │ ├── callWithHighValueAndGasOOG.json │ │ ├── callWithHighValueAndOOGatTxLevel.json │ │ ├── callWithHighValueOOGinCall.json │ │ ├── callcodeOutput1.json │ │ ├── callcodeOutput2.json │ │ ├── callcodeOutput3.json │ │ ├── callcodeOutput3Fail.json │ │ ├── callcodeOutput3partial.json │ │ ├── callcodeOutput3partialFail.json │ │ ├── callcodeWithHighValue.json │ │ ├── callcodeWithHighValueAndGasOOG.json │ │ ├── createFailBalanceTooLow.json │ │ ├── createInitFailBadJumpDestination.json │ │ ├── createInitFailStackSizeLargerThan1024.json │ │ ├── createInitFailStackUnderflow.json │ │ ├── createInitFailUndefinedInstruction.json │ │ ├── createInitFail_OOGduringInit.json │ │ ├── createInitOOGforCREATE.json │ │ ├── createJS_ExampleContract.json │ │ ├── createJS_NoCollision.json │ │ ├── createNameRegistratorPerTxs.json │ │ ├── createNameRegistratorPerTxsNotEnoughGas.json │ │ ├── createNameRegistratorPreStore1NotEnoughGas.json │ │ └── createNameRegistratorendowmentTooHigh.json │ ├── stCallDelegateCodesCallCodeHomestead │ │ ├── callcallcallcode_001.json │ │ ├── callcallcallcode_001_OOGE.json │ │ ├── callcallcallcode_001_OOGMAfter.json │ │ ├── callcallcallcode_001_OOGMBefore.json │ │ ├── callcallcallcode_001_SuicideEnd.json │ │ ├── callcallcallcode_001_SuicideMiddle.json │ │ ├── callcallcallcode_ABCB_RECURSIVE.json │ │ ├── callcallcode_01.json │ │ ├── callcallcode_01_OOGE.json │ │ ├── callcallcode_01_SuicideEnd.json │ │ ├── callcallcodecall_010.json │ │ ├── callcallcodecall_010_OOGE.json │ │ ├── callcallcodecall_010_OOGMAfter.json │ │ ├── callcallcodecall_010_OOGMBefore.json │ │ ├── callcallcodecall_010_SuicideEnd.json │ │ ├── callcallcodecall_010_SuicideMiddle.json │ │ ├── callcallcodecall_ABCB_RECURSIVE.json │ │ ├── callcallcodecallcode_011.json │ │ ├── callcallcodecallcode_011_OOGE.json │ │ ├── callcallcodecallcode_011_OOGMAfter.json │ │ ├── callcallcodecallcode_011_OOGMBefore.json │ │ ├── callcallcodecallcode_011_SuicideEnd.json │ │ ├── callcallcodecallcode_011_SuicideMiddle.json │ │ ├── callcallcodecallcode_ABCB_RECURSIVE.json │ │ ├── callcodecall_10.json │ │ ├── callcodecall_10_OOGE.json │ │ ├── callcodecall_10_SuicideEnd.json │ │ ├── callcodecallcall_100.json │ │ ├── callcodecallcall_100_OOGE.json │ │ ├── callcodecallcall_100_OOGMAfter.json │ │ ├── callcodecallcall_100_OOGMBefore.json │ │ ├── callcodecallcall_100_SuicideEnd.json │ │ ├── callcodecallcall_100_SuicideMiddle.json │ │ ├── callcodecallcall_ABCB_RECURSIVE.json │ │ ├── callcodecallcallcode_101.json │ │ ├── callcodecallcallcode_101_OOGE.json │ │ ├── callcodecallcallcode_101_OOGMAfter.json │ │ ├── callcodecallcallcode_101_OOGMBefore.json │ │ ├── callcodecallcallcode_101_SuicideEnd.json │ │ ├── callcodecallcallcode_101_SuicideMiddle.json │ │ ├── callcodecallcallcode_ABCB_RECURSIVE.json │ │ ├── callcodecallcode_11.json │ │ ├── callcodecallcode_11_OOGE.json │ │ ├── callcodecallcode_11_SuicideEnd.json │ │ ├── callcodecallcodecall_110.json │ │ ├── callcodecallcodecall_110_OOGE.json │ │ ├── callcodecallcodecall_110_OOGMAfter.json │ │ ├── callcodecallcodecall_110_OOGMBefore.json │ │ ├── callcodecallcodecall_110_SuicideEnd.json │ │ ├── callcodecallcodecall_110_SuicideMiddle.json │ │ ├── callcodecallcodecall_ABCB_RECURSIVE.json │ │ ├── callcodecallcodecallcode_111.json │ │ ├── callcodecallcodecallcode_111_OOGE.json │ │ ├── callcodecallcodecallcode_111_OOGMAfter.json │ │ ├── callcodecallcodecallcode_111_OOGMBefore.json │ │ ├── callcodecallcodecallcode_111_SuicideEnd.json │ │ ├── callcodecallcodecallcode_111_SuicideMiddle.json │ │ └── callcodecallcodecallcode_ABCB_RECURSIVE.json │ ├── stCallDelegateCodesHomestead │ │ ├── callcallcallcode_001.json │ │ ├── callcallcallcode_001_OOGE.json │ │ ├── callcallcallcode_001_OOGMAfter.json │ │ ├── callcallcallcode_001_OOGMBefore.json │ │ ├── callcallcallcode_001_SuicideEnd.json │ │ ├── callcallcallcode_001_SuicideMiddle.json │ │ ├── callcallcallcode_ABCB_RECURSIVE.json │ │ ├── callcallcode_01.json │ │ ├── callcallcode_01_OOGE.json │ │ ├── callcallcode_01_SuicideEnd.json │ │ ├── callcallcodecall_010.json │ │ ├── callcallcodecall_010_OOGE.json │ │ ├── callcallcodecall_010_OOGMAfter.json │ │ ├── callcallcodecall_010_OOGMBefore.json │ │ ├── callcallcodecall_010_SuicideEnd.json │ │ ├── callcallcodecall_010_SuicideMiddle.json │ │ ├── callcallcodecall_ABCB_RECURSIVE.json │ │ ├── callcallcodecallcode_011.json │ │ ├── callcallcodecallcode_011_OOGE.json │ │ ├── callcallcodecallcode_011_OOGMAfter.json │ │ ├── callcallcodecallcode_011_OOGMBefore.json │ │ ├── callcallcodecallcode_011_SuicideEnd.json │ │ ├── callcallcodecallcode_011_SuicideMiddle.json │ │ ├── callcallcodecallcode_ABCB_RECURSIVE.json │ │ ├── callcodecall_10.json │ │ ├── callcodecall_10_OOGE.json │ │ ├── callcodecall_10_SuicideEnd.json │ │ ├── callcodecallcall_100.json │ │ ├── callcodecallcall_100_OOGE.json │ │ ├── callcodecallcall_100_OOGMAfter.json │ │ ├── callcodecallcall_100_OOGMBefore.json │ │ ├── callcodecallcall_100_SuicideEnd.json │ │ ├── callcodecallcall_100_SuicideMiddle.json │ │ ├── callcodecallcall_ABCB_RECURSIVE.json │ │ ├── callcodecallcallcode_101.json │ │ ├── callcodecallcallcode_101_OOGE.json │ │ ├── callcodecallcallcode_101_OOGMAfter.json │ │ ├── callcodecallcallcode_101_OOGMBefore.json │ │ ├── callcodecallcallcode_101_SuicideEnd.json │ │ ├── callcodecallcallcode_101_SuicideMiddle.json │ │ ├── callcodecallcallcode_ABCB_RECURSIVE.json │ │ ├── callcodecallcode_11.json │ │ ├── callcodecallcode_11_OOGE.json │ │ ├── callcodecallcode_11_SuicideEnd.json │ │ ├── callcodecallcodecall_110.json │ │ ├── callcodecallcodecall_110_OOGE.json │ │ ├── callcodecallcodecall_110_OOGMAfter.json │ │ ├── callcodecallcodecall_110_OOGMBefore.json │ │ ├── callcodecallcodecall_110_SuicideEnd.json │ │ ├── callcodecallcodecall_110_SuicideMiddle.json │ │ ├── callcodecallcodecall_ABCB_RECURSIVE.json │ │ ├── callcodecallcodecallcode_111.json │ │ ├── callcodecallcodecallcode_111_OOGE.json │ │ ├── callcodecallcodecallcode_111_OOGMAfter.json │ │ ├── callcodecallcodecallcode_111_OOGMBefore.json │ │ ├── callcodecallcodecallcode_111_SuicideEnd.json │ │ ├── callcodecallcodecallcode_111_SuicideMiddle.json │ │ └── callcodecallcodecallcode_ABCB_RECURSIVE.json │ ├── stChangedEIP150 │ │ ├── Call1024BalanceTooLow.json │ │ ├── Call1024PreCalls.json │ │ ├── Callcode1024BalanceTooLow.json │ │ ├── callcall_00_OOGE_1.json │ │ ├── callcall_00_OOGE_2.json │ │ ├── callcall_00_OOGE_valueTransfer.json │ │ ├── callcallcall_000_OOGMAfter.json │ │ ├── callcallcallcode_001_OOGMAfter_1.json │ │ ├── callcallcallcode_001_OOGMAfter_2.json │ │ ├── callcallcallcode_001_OOGMAfter_3.json │ │ ├── callcallcodecall_010_OOGMAfter_1.json │ │ ├── callcallcodecall_010_OOGMAfter_2.json │ │ ├── callcallcodecall_010_OOGMAfter_3.json │ │ ├── callcallcodecallcode_011_OOGMAfter_1.json │ │ ├── callcallcodecallcode_011_OOGMAfter_2.json │ │ ├── callcodecallcall_100_OOGMAfter_1.json │ │ ├── callcodecallcall_100_OOGMAfter_2.json │ │ ├── callcodecallcall_100_OOGMAfter_3.json │ │ ├── callcodecallcallcode_101_OOGMAfter_1.json │ │ ├── callcodecallcallcode_101_OOGMAfter_2.json │ │ ├── callcodecallcallcode_101_OOGMAfter_3.json │ │ ├── callcodecallcodecall_110_OOGMAfter_1.json │ │ ├── callcodecallcodecall_110_OOGMAfter_2.json │ │ ├── callcodecallcodecall_110_OOGMAfter_3.json │ │ ├── callcodecallcodecallcode_111_OOGMAfter.json │ │ ├── callcodecallcodecallcode_111_OOGMAfter_1.json │ │ ├── callcodecallcodecallcode_111_OOGMAfter_2.json │ │ ├── callcodecallcodecallcode_111_OOGMAfter_3.json │ │ ├── contractCreationMakeCallThatAskMoreGasThenTransactionProvided.json │ │ └── createInitFail_OOGduringInit.json │ ├── stCodeCopyTest │ │ ├── ExtCodeCopyTargetRangeLongerThanCodeTests.json │ │ └── ExtCodeCopyTests.json │ ├── stCodeSizeLimit │ │ ├── codesizeInit.json │ │ ├── codesizeOOGInvalidSize.json │ │ └── codesizeValid.json │ ├── stCreate2 │ │ ├── CREATE2_Bounds.json │ │ ├── CREATE2_Bounds2.json │ │ ├── CREATE2_Bounds3.json │ │ ├── CREATE2_ContractSuicideDuringInit_ThenStoreThenReturn.json │ │ ├── CREATE2_Suicide.json │ │ ├── Create2OOGafterInitCode.json │ │ ├── Create2OOGafterInitCodeReturndata.json │ │ ├── Create2OOGafterInitCodeReturndata2.json │ │ ├── Create2OOGafterInitCodeReturndata3.json │ │ ├── Create2OOGafterInitCodeReturndataSize.json │ │ ├── Create2OOGafterInitCodeRevert.json │ │ ├── Create2OOGafterInitCodeRevert2.json │ │ ├── Create2OnDepth1023.json │ │ ├── Create2OnDepth1024.json │ │ ├── Create2Recursive.json │ │ ├── CreateMessageReverted.json │ │ ├── CreateMessageRevertedOOGInInit.json │ │ ├── RevertDepthCreate2OOG.json │ │ ├── RevertDepthCreateAddressCollision.json │ │ ├── RevertInCreateInInitCreate2.json │ │ ├── RevertOpcodeCreate.json │ │ ├── RevertOpcodeInCreateReturnsCreate2.json │ │ ├── call_outsize_then_create2_successful_then_returndatasize.json │ │ ├── call_then_create2_successful_then_returndatasize.json │ │ ├── create2InitCodes.json │ │ ├── create2SmartInitCode.json │ │ ├── create2callPrecompiles.json │ │ ├── create2checkFieldsInInitcode.json │ │ ├── create2collisionBalance.json │ │ ├── create2collisionCode.json │ │ ├── create2collisionCode2.json │ │ ├── create2collisionNonce.json │ │ ├── create2collisionSelfdestructed.json │ │ ├── create2collisionSelfdestructed2.json │ │ ├── create2collisionSelfdestructedOOG.json │ │ ├── create2collisionSelfdestructedRevert.json │ │ ├── create2collisionStorage.json │ │ ├── create2noCash.json │ │ ├── returndatacopy_0_0_following_successful_create.json │ │ ├── returndatacopy_afterFailing_create.json │ │ ├── returndatacopy_following_create.json │ │ ├── returndatacopy_following_revert_in_create.json │ │ ├── returndatacopy_following_successful_create.json │ │ └── returndatasize_following_successful_create.json │ ├── stCreateTest │ │ ├── CREATE_AcreateB_BSuicide_BStore.json │ │ ├── CREATE_ContractRETURNBigOffset.json │ │ ├── CREATE_ContractSSTOREDuringInit.json │ │ ├── CREATE_ContractSuicideDuringInit.json │ │ ├── CREATE_ContractSuicideDuringInit_ThenStoreThenReturn.json │ │ ├── CREATE_ContractSuicideDuringInit_WithValue.json │ │ ├── CREATE_ContractSuicideDuringInit_WithValueToItself.json │ │ ├── CREATE_EContractCreateEContractInInit_Tr.json │ │ ├── CREATE_EContractCreateNEContractInInitOOG_Tr.json │ │ ├── CREATE_EContractCreateNEContractInInit_Tr.json │ │ ├── CREATE_EContract_ThenCALLToNonExistentAcc.json │ │ ├── CREATE_EmptyContract.json │ │ ├── CREATE_EmptyContractAndCallIt_0wei.json │ │ ├── CREATE_EmptyContractAndCallIt_1wei.json │ │ ├── CREATE_EmptyContractWithBalance.json │ │ ├── CREATE_EmptyContractWithStorage.json │ │ ├── CREATE_EmptyContractWithStorageAndCallIt_0wei.json │ │ ├── CREATE_EmptyContractWithStorageAndCallIt_1wei.json │ │ ├── CREATE_empty000CreateinInitCode_Transaction.json │ │ ├── CreateCollisionToEmpty.json │ │ ├── CreateOOGafterInitCode.json │ │ ├── CreateOOGafterInitCodeReturndata.json │ │ ├── CreateOOGafterInitCodeReturndata2.json │ │ ├── CreateOOGafterInitCodeReturndata3.json │ │ ├── CreateOOGafterInitCodeReturndataSize.json │ │ ├── CreateOOGafterInitCodeRevert.json │ │ ├── CreateOOGafterInitCodeRevert2.json │ │ ├── TransactionCollisionToEmpty.json │ │ ├── TransactionCollisionToEmptyButCode.json │ │ └── TransactionCollisionToEmptyButNonce.json │ ├── stDelegatecallTestHomestead │ │ ├── Call1024BalanceTooLow.json │ │ ├── Call1024OOG.json │ │ ├── Call1024PreCalls.json │ │ ├── CallLoseGasOOG.json │ │ ├── CallRecursiveBombPreCall.json │ │ ├── CallcodeLoseGasOOG.json │ │ ├── Delegatecall1024.json │ │ ├── Delegatecall1024OOG.json │ │ ├── callOutput1.json │ │ ├── callOutput2.json │ │ ├── callOutput3.json │ │ ├── callOutput3Fail.json │ │ ├── callOutput3partial.json │ │ ├── callOutput3partialFail.json │ │ ├── callWithHighValueAndGasOOG.json │ │ ├── callcodeOutput1.json │ │ ├── callcodeOutput2.json │ │ ├── callcodeOutput3.json │ │ ├── callcodeOutput3Fail.json │ │ ├── callcodeOutput3partial.json │ │ ├── callcodeOutput3partialFail.json │ │ ├── callcodeWithHighValueAndGasOOG.json │ │ ├── deleagateCallAfterValueTransfer.json │ │ ├── delegatecallAndOOGatTxLevel.json │ │ ├── delegatecallBasic.json │ │ ├── delegatecallEmptycontract.json │ │ ├── delegatecallInInitcodeToEmptyContract.json │ │ ├── delegatecallInInitcodeToExistingContract.json │ │ ├── delegatecallInInitcodeToExistingContractOOG.json │ │ ├── delegatecallOOGinCall.json │ │ ├── delegatecallSenderCheck.json │ │ ├── delegatecallValueCheck.json │ │ ├── delegatecodeDynamicCode.json │ │ └── delegatecodeDynamicCode2SelfCall.json │ ├── stEIP150Specific │ │ ├── CallAndCallcodeConsumeMoreGasThenTransactionHas.json │ │ ├── CallAskMoreGasOnDepth2ThenTransactionHas.json │ │ ├── CallGoesOOGOnSecondLevel.json │ │ ├── CallGoesOOGOnSecondLevel2.json │ │ ├── CreateAndGasInsideCreate.json │ │ ├── DelegateCallOnEIP.json │ │ ├── ExecuteCallThatAskForeGasThenTrabsactionHas.json │ │ ├── NewGasPriceForCodes.json │ │ ├── SuicideToExistingContract.json │ │ ├── SuicideToNotExistingContract.json │ │ ├── Transaction64Rule_d64e0.json │ │ ├── Transaction64Rule_d64m1.json │ │ └── Transaction64Rule_d64p1.json │ ├── stEIP150singleCodeGasPrices │ │ ├── RawBalanceGas.json │ │ ├── RawCallCodeGas.json │ │ ├── RawCallCodeGasAsk.json │ │ ├── RawCallCodeGasMemory.json │ │ ├── RawCallCodeGasMemoryAsk.json │ │ ├── RawCallCodeGasValueTransfer.json │ │ ├── RawCallCodeGasValueTransferAsk.json │ │ ├── RawCallCodeGasValueTransferMemory.json │ │ ├── RawCallCodeGasValueTransferMemoryAsk.json │ │ ├── RawCallGas.json │ │ ├── RawCallGasAsk.json │ │ ├── RawCallGasValueTransfer.json │ │ ├── RawCallGasValueTransferAsk.json │ │ ├── RawCallGasValueTransferMemory.json │ │ ├── RawCallGasValueTransferMemoryAsk.json │ │ ├── RawCallMemoryGas.json │ │ ├── RawCallMemoryGasAsk.json │ │ ├── RawCreateFailGasValueTransfer.json │ │ ├── RawCreateFailGasValueTransfer2.json │ │ ├── RawCreateGas.json │ │ ├── RawCreateGasMemory.json │ │ ├── RawCreateGasValueTransfer.json │ │ ├── RawCreateGasValueTransferMemory.json │ │ ├── RawDelegateCallGas.json │ │ ├── RawDelegateCallGasAsk.json │ │ ├── RawDelegateCallGasMemory.json │ │ ├── RawDelegateCallGasMemoryAsk.json │ │ ├── RawExtCodeCopyGas.json │ │ ├── RawExtCodeCopyMemoryGas.json │ │ └── RawExtCodeSizeGas.json │ ├── stEIP158Specific │ │ ├── CALL_OneVCallSuicide.json │ │ ├── CALL_ZeroVCallSuicide.json │ │ ├── EXP_Empty.json │ │ ├── EXTCODESIZE_toEpmty.json │ │ ├── EXTCODESIZE_toNonExistent.json │ │ ├── callToEmptyThenCallError.json │ │ └── vitalikTransactionTest.json │ ├── stEWASMTests │ │ └── .gitkeep │ ├── stExample │ │ └── add11.json │ ├── stExtCodeHash │ │ ├── codeCopyZero.json │ │ ├── dynamicAccountOverwriteEmpty.json │ │ ├── extCodeCopyBounds.json │ │ ├── extCodeHashAccountWithoutCode.json │ │ ├── extCodeHashCALL.json │ │ ├── extCodeHashCALLCODE.json │ │ ├── extCodeHashChangedAccount.json │ │ ├── extCodeHashCreatedAndDeletedAccount.json │ │ ├── extCodeHashCreatedAndDeletedAccountCall.json │ │ ├── extCodeHashCreatedAndDeletedAccountRecheckInOuterCall.json │ │ ├── extCodeHashCreatedAndDeletedAccountStaticCall.json │ │ ├── extCodeHashDELEGATECALL.json │ │ ├── extCodeHashDeletedAccount.json │ │ ├── extCodeHashDeletedAccount1.json │ │ ├── extCodeHashDeletedAccount2.json │ │ ├── extCodeHashDeletedAccount3.json │ │ ├── extCodeHashDeletedAccount4.json │ │ ├── extCodeHashDynamicArgument.json │ │ ├── extCodeHashInInitCode.json │ │ ├── extCodeHashMaxCodeSize.json │ │ ├── extCodeHashNewAccount.json │ │ ├── extCodeHashNonExistingAccount.json │ │ ├── extCodeHashPrecompiles.json │ │ ├── extCodeHashSTATICCALL.json │ │ ├── extCodeHashSelf.json │ │ ├── extCodeHashSelfInInit.json │ │ ├── extCodeHashSubcallOOG.json │ │ └── extCodeHashSubcallSuicide.json │ ├── stHomesteadSpecific │ │ ├── contractCreationOOGdontLeaveEmptyContract.json │ │ ├── contractCreationOOGdontLeaveEmptyContractViaTransaction.json │ │ ├── createContractViaContract.json │ │ ├── createContractViaContractOOGInitCode.json │ │ └── createContractViaTransactionCost53000.json │ ├── stInitCodeTest │ │ ├── CallContractToCreateContractAndCallItOOG.json │ │ ├── CallContractToCreateContractNoCash.json │ │ ├── CallContractToCreateContractOOG.json │ │ ├── CallContractToCreateContractOOGBonusGas.json │ │ ├── CallContractToCreateContractWhichWouldCreateContractIfCalled.json │ │ ├── CallContractToCreateContractWhichWouldCreateContractInInitCode.json │ │ ├── CallRecursiveContract.json │ │ ├── CallTheContractToCreateEmptyContract.json │ │ ├── NotEnoughCashContractCreation.json │ │ ├── OutOfGasContractCreation.json │ │ ├── OutOfGasPrefundedContractCreation.json │ │ ├── ReturnTest.json │ │ ├── ReturnTest2.json │ │ ├── StackUnderFlowContractCreation.json │ │ ├── TransactionCreateAutoSuicideContract.json │ │ ├── TransactionCreateRandomInitCode.json │ │ ├── TransactionCreateStopInInitcode.json │ │ └── TransactionCreateSuicideInInitcode.json │ ├── stLogTests │ │ ├── log0_emptyMem.json │ │ ├── log0_logMemStartTooHigh.json │ │ ├── log0_logMemsizeTooHigh.json │ │ ├── log0_logMemsizeZero.json │ │ ├── log0_nonEmptyMem.json │ │ ├── log0_nonEmptyMem_logMemSize1.json │ │ ├── log0_nonEmptyMem_logMemSize1_logMemStart31.json │ │ ├── log1_Caller.json │ │ ├── log1_MaxTopic.json │ │ ├── log1_emptyMem.json │ │ ├── log1_logMemStartTooHigh.json │ │ ├── log1_logMemsizeTooHigh.json │ │ ├── log1_logMemsizeZero.json │ │ ├── log1_nonEmptyMem.json │ │ ├── log1_nonEmptyMem_logMemSize1.json │ │ ├── log1_nonEmptyMem_logMemSize1_logMemStart31.json │ │ ├── log2_Caller.json │ │ ├── log2_MaxTopic.json │ │ ├── log2_emptyMem.json │ │ ├── log2_logMemStartTooHigh.json │ │ ├── log2_logMemsizeTooHigh.json │ │ ├── log2_logMemsizeZero.json │ │ ├── log2_nonEmptyMem.json │ │ ├── log2_nonEmptyMem_logMemSize1.json │ │ ├── log2_nonEmptyMem_logMemSize1_logMemStart31.json │ │ ├── log3_Caller.json │ │ ├── log3_MaxTopic.json │ │ ├── log3_PC.json │ │ ├── log3_emptyMem.json │ │ ├── log3_logMemStartTooHigh.json │ │ ├── log3_logMemsizeTooHigh.json │ │ ├── log3_logMemsizeZero.json │ │ ├── log3_nonEmptyMem.json │ │ ├── log3_nonEmptyMem_logMemSize1.json │ │ ├── log3_nonEmptyMem_logMemSize1_logMemStart31.json │ │ ├── log4_Caller.json │ │ ├── log4_MaxTopic.json │ │ ├── log4_PC.json │ │ ├── log4_emptyMem.json │ │ ├── log4_logMemStartTooHigh.json │ │ ├── log4_logMemsizeTooHigh.json │ │ ├── log4_logMemsizeZero.json │ │ ├── log4_nonEmptyMem.json │ │ ├── log4_nonEmptyMem_logMemSize1.json │ │ ├── log4_nonEmptyMem_logMemSize1_logMemStart31.json │ │ └── logInOOG_Call.json │ ├── stMemExpandingEIP150Calls │ │ ├── CallAndCallcodeConsumeMoreGasThenTransactionHasWithMemExpandingCalls.json │ │ ├── CallAskMoreGasOnDepth2ThenTransactionHasWithMemExpandingCalls.json │ │ ├── CallGoesOOGOnSecondLevel2WithMemExpandingCalls.json │ │ ├── CallGoesOOGOnSecondLevelWithMemExpandingCalls.json │ │ ├── CreateAndGasInsideCreateWithMemExpandingCalls.json │ │ ├── DelegateCallOnEIPWithMemExpandingCalls.json │ │ ├── ExecuteCallThatAskMoreGasThenTransactionHasWithMemExpandingCalls.json │ │ └── NewGasPriceForCodesWithMemExpandingCalls.json │ ├── stMemoryStressTest │ │ ├── CALLCODE_Bounds.json │ │ ├── CALLCODE_Bounds2.json │ │ ├── CALLCODE_Bounds3.json │ │ ├── CALLCODE_Bounds4.json │ │ ├── CALL_Bounds.json │ │ ├── CALL_Bounds2.json │ │ ├── CALL_Bounds2a.json │ │ ├── CALL_Bounds3.json │ │ ├── CREATE_Bounds.json │ │ ├── CREATE_Bounds2.json │ │ ├── CREATE_Bounds3.json │ │ ├── DELEGATECALL_Bounds.json │ │ ├── DELEGATECALL_Bounds2.json │ │ ├── DELEGATECALL_Bounds3.json │ │ ├── DUP_Bounds.json │ │ ├── FillStack.json │ │ ├── JUMPI_Bounds.json │ │ ├── JUMP_Bounds.json │ │ ├── JUMP_Bounds2.json │ │ ├── MLOAD_Bounds.json │ │ ├── MLOAD_Bounds2.json │ │ ├── MLOAD_Bounds3.json │ │ ├── MSTORE_Bounds.json │ │ ├── MSTORE_Bounds2.json │ │ ├── MSTORE_Bounds2a.json │ │ ├── POP_Bounds.json │ │ ├── RETURN_Bounds.json │ │ ├── SLOAD_Bounds.json │ │ ├── SSTORE_Bounds.json │ │ ├── mload32bitBound.json │ │ ├── mload32bitBound2.json │ │ ├── mload32bitBound_Msize.json │ │ ├── mload32bitBound_return.json │ │ ├── mload32bitBound_return2.json │ │ ├── static_CALL_Bounds.json │ │ ├── static_CALL_Bounds2.json │ │ ├── static_CALL_Bounds2a.json │ │ └── static_CALL_Bounds3.json │ ├── stMemoryTest │ │ ├── callDataCopyOffset.json │ │ ├── calldatacopy_dejavu.json │ │ ├── calldatacopy_dejavu2.json │ │ ├── codeCopyOffset.json │ │ ├── codecopy_dejavu.json │ │ ├── codecopy_dejavu2.json │ │ ├── extcodecopy_dejavu.json │ │ ├── log1_dejavu.json │ │ ├── log2_dejavu.json │ │ ├── log3_dejavu.json │ │ ├── log4_dejavu.json │ │ ├── mem0b_singleByte.json │ │ ├── mem31b_singleByte.json │ │ ├── mem32b_singleByte.json │ │ ├── mem32kb+1.json │ │ ├── mem32kb+31.json │ │ ├── mem32kb+32.json │ │ ├── mem32kb+33.json │ │ ├── mem32kb-1.json │ │ ├── mem32kb-31.json │ │ ├── mem32kb-32.json │ │ ├── mem32kb-33.json │ │ ├── mem32kb.json │ │ ├── mem32kb_singleByte+1.json │ │ ├── mem32kb_singleByte+31.json │ │ ├── mem32kb_singleByte+32.json │ │ ├── mem32kb_singleByte+33.json │ │ ├── mem32kb_singleByte-1.json │ │ ├── mem32kb_singleByte-31.json │ │ ├── mem32kb_singleByte-32.json │ │ ├── mem32kb_singleByte-33.json │ │ ├── mem32kb_singleByte.json │ │ ├── mem33b_singleByte.json │ │ ├── mem64kb+1.json │ │ ├── mem64kb+31.json │ │ ├── mem64kb+32.json │ │ ├── mem64kb+33.json │ │ ├── mem64kb-1.json │ │ ├── mem64kb-31.json │ │ ├── mem64kb-32.json │ │ ├── mem64kb-33.json │ │ ├── mem64kb.json │ │ ├── mem64kb_singleByte+1.json │ │ ├── mem64kb_singleByte+31.json │ │ ├── mem64kb_singleByte+32.json │ │ ├── mem64kb_singleByte+33.json │ │ ├── mem64kb_singleByte-1.json │ │ ├── mem64kb_singleByte-31.json │ │ ├── mem64kb_singleByte-32.json │ │ ├── mem64kb_singleByte-33.json │ │ ├── mem64kb_singleByte.json │ │ ├── memReturn.json │ │ ├── mload16bitBound.json │ │ ├── mload8bitBound.json │ │ ├── mload_dejavu.json │ │ ├── mstore_dejavu.json │ │ ├── mstroe8_dejavu.json │ │ ├── sha3_dejavu.json │ │ ├── stackLimitGas_1023.json │ │ ├── stackLimitGas_1024.json │ │ ├── stackLimitGas_1025.json │ │ ├── stackLimitPush31_1023.json │ │ ├── stackLimitPush31_1024.json │ │ ├── stackLimitPush31_1025.json │ │ ├── stackLimitPush32_1023.json │ │ ├── stackLimitPush32_1024.json │ │ └── stackLimitPush32_1025.json │ ├── stNonZeroCallsTest │ │ ├── NonZeroValue_CALL.json │ │ ├── NonZeroValue_CALLCODE.json │ │ ├── NonZeroValue_CALLCODE_ToEmpty.json │ │ ├── NonZeroValue_CALLCODE_ToNonNonZeroBalance.json │ │ ├── NonZeroValue_CALLCODE_ToOneStorageKey.json │ │ ├── NonZeroValue_CALL_ToEmpty.json │ │ ├── NonZeroValue_CALL_ToNonNonZeroBalance.json │ │ ├── NonZeroValue_CALL_ToOneStorageKey.json │ │ ├── NonZeroValue_DELEGATECALL.json │ │ ├── NonZeroValue_DELEGATECALL_ToEmpty.json │ │ ├── NonZeroValue_DELEGATECALL_ToNonNonZeroBalance.json │ │ ├── NonZeroValue_DELEGATECALL_ToOneStorageKey.json │ │ ├── NonZeroValue_SUICIDE.json │ │ ├── NonZeroValue_SUICIDE_ToEmpty.json │ │ ├── NonZeroValue_SUICIDE_ToNonNonZeroBalance.json │ │ ├── NonZeroValue_SUICIDE_ToOneStorageKey.json │ │ ├── NonZeroValue_TransactionCALL.json │ │ ├── NonZeroValue_TransactionCALL_ToEmpty.json │ │ ├── NonZeroValue_TransactionCALL_ToNonNonZeroBalance.json │ │ ├── NonZeroValue_TransactionCALL_ToOneStorageKey.json │ │ ├── NonZeroValue_TransactionCALLwithData.json │ │ ├── NonZeroValue_TransactionCALLwithData_ToEmpty.json │ │ ├── NonZeroValue_TransactionCALLwithData_ToNonNonZeroBalance.json │ │ └── NonZeroValue_TransactionCALLwithData_ToOneStorageKey.json │ ├── stPreCompiledContracts │ │ ├── identity_to_bigger.json │ │ ├── identity_to_smaller.json │ │ ├── modexp.json │ │ ├── modexp_0_0_0_1000000.json │ │ ├── modexp_0_0_0_155000.json │ │ ├── modexp_0_1_0_1000000.json │ │ ├── modexp_0_1_0_155000.json │ │ ├── modexp_0_1_0_20500.json │ │ ├── modexp_0_1_0_22000.json │ │ ├── modexp_0_1_0_25000.json │ │ ├── modexp_0_1_0_35000.json │ │ ├── modexp_0_3_100_1000000.json │ │ ├── modexp_0_3_100_155000.json │ │ ├── modexp_0_3_100_20500.json │ │ ├── modexp_0_3_100_22000.json │ │ ├── modexp_0_3_100_25000.json │ │ ├── modexp_0_3_100_35000.json │ │ ├── modexp_1_0_0_1000000.json │ │ ├── modexp_1_0_0_155000.json │ │ ├── modexp_1_0_0_20500.json │ │ ├── modexp_1_0_0_22000.json │ │ ├── modexp_1_0_0_25000.json │ │ ├── modexp_1_0_0_35000.json │ │ ├── modexp_1_0_1_1000000.json │ │ ├── modexp_1_0_1_155000.json │ │ ├── modexp_1_0_1_20500.json │ │ ├── modexp_1_0_1_22000.json │ │ ├── modexp_1_0_1_25000.json │ │ ├── modexp_1_0_1_35000.json │ │ ├── modexp_1_1_1_1000000.json │ │ ├── modexp_1_1_1_155000.json │ │ ├── modexp_1_1_1_20500.json │ │ ├── modexp_1_1_1_22000.json │ │ ├── modexp_1_1_1_25000.json │ │ ├── modexp_1_1_1_35000.json │ │ ├── modexp_37120_22411_22000.json │ │ ├── modexp_37120_37111_0_1000000.json │ │ ├── modexp_37120_37111_0_155000.json │ │ ├── modexp_37120_37111_0_20500.json │ │ ├── modexp_37120_37111_0_22000.json │ │ ├── modexp_37120_37111_0_25000.json │ │ ├── modexp_37120_37111_0_35000.json │ │ ├── modexp_37120_37111_1_1000000.json │ │ ├── modexp_37120_37111_1_155000.json │ │ ├── modexp_37120_37111_1_20500.json │ │ ├── modexp_37120_37111_1_25000.json │ │ ├── modexp_37120_37111_1_35000.json │ │ ├── modexp_37120_37111_37111_1000000.json │ │ ├── modexp_37120_37111_37111_155000.json │ │ ├── modexp_37120_37111_37111_20500.json │ │ ├── modexp_37120_37111_37111_22000.json │ │ ├── modexp_37120_37111_37111_25000.json │ │ ├── modexp_37120_37111_37111_35000.json │ │ ├── modexp_37120_37111_97_1000000.json │ │ ├── modexp_37120_37111_97_155000.json │ │ ├── modexp_37120_37111_97_20500.json │ │ ├── modexp_37120_37111_97_22000.json │ │ ├── modexp_37120_37111_97_25000.json │ │ ├── modexp_37120_37111_97_35000.json │ │ ├── modexp_39936_1_55201_1000000.json │ │ ├── modexp_39936_1_55201_155000.json │ │ ├── modexp_39936_1_55201_20500.json │ │ ├── modexp_39936_1_55201_22000.json │ │ ├── modexp_39936_1_55201_25000.json │ │ ├── modexp_39936_1_55201_35000.json │ │ ├── modexp_3_09984_39936_1000000.json │ │ ├── modexp_3_09984_39936_155000.json │ │ ├── modexp_3_09984_39936_22000.json │ │ ├── modexp_3_09984_39936_25000.json │ │ ├── modexp_3_09984_39936_35000.json │ │ ├── modexp_3_28948_11579_20500.json │ │ ├── modexp_3_5_100_1000000.json │ │ ├── modexp_3_5_100_155000.json │ │ ├── modexp_3_5_100_20500.json │ │ ├── modexp_3_5_100_22000.json │ │ ├── modexp_3_5_100_25000.json │ │ ├── modexp_3_5_100_35000.json │ │ ├── modexp_49_2401_2401_1000000.json │ │ ├── modexp_49_2401_2401_155000.json │ │ ├── modexp_49_2401_2401_20500.json │ │ ├── modexp_49_2401_2401_22000.json │ │ ├── modexp_49_2401_2401_25000.json │ │ ├── modexp_49_2401_2401_35000.json │ │ ├── modexp_55190_55190_42965_1000000.json │ │ ├── modexp_55190_55190_42965_155000.json │ │ ├── modexp_55190_55190_42965_20500.json │ │ ├── modexp_55190_55190_42965_22000.json │ │ ├── modexp_55190_55190_42965_25000.json │ │ ├── modexp_55190_55190_42965_35000.json │ │ ├── modexp_9_37111_37111_1000000.json │ │ ├── modexp_9_37111_37111_155000.json │ │ ├── modexp_9_37111_37111_20500.json │ │ ├── modexp_9_37111_37111_22000.json │ │ ├── modexp_9_37111_37111_35000.json │ │ ├── modexp_9_3711_37111_25000.json │ │ └── sec80.json │ ├── stPreCompiledContracts2 │ │ ├── CALLCODEEcrecover0.json │ │ ├── CALLCODEEcrecover0_0input.json │ │ ├── CALLCODEEcrecover0_Gas2999.json │ │ ├── CALLCODEEcrecover0_NoGas.json │ │ ├── CALLCODEEcrecover0_completeReturnValue.json │ │ ├── CALLCODEEcrecover0_gas3000.json │ │ ├── CALLCODEEcrecover0_overlappingInputOutput.json │ │ ├── CALLCODEEcrecover1.json │ │ ├── CALLCODEEcrecover2.json │ │ ├── CALLCODEEcrecover3.json │ │ ├── CALLCODEEcrecover80.json │ │ ├── CALLCODEEcrecoverH_prefixed0.json │ │ ├── CALLCODEEcrecoverR_prefixed0.json │ │ ├── CALLCODEEcrecoverS_prefixed0.json │ │ ├── CALLCODEEcrecoverV_prefixed0.json │ │ ├── CALLCODEEcrecoverV_prefixedf0.json │ │ ├── CALLCODEIdentitiy_0.json │ │ ├── CALLCODEIdentitiy_1.json │ │ ├── CALLCODEIdentity_1_nonzeroValue.json │ │ ├── CALLCODEIdentity_2.json │ │ ├── CALLCODEIdentity_3.json │ │ ├── CALLCODEIdentity_4.json │ │ ├── CALLCODEIdentity_4_gas17.json │ │ ├── CALLCODEIdentity_4_gas18.json │ │ ├── CALLCODEIdentity_5.json │ │ ├── CALLCODERipemd160_0.json │ │ ├── CALLCODERipemd160_1.json │ │ ├── CALLCODERipemd160_2.json │ │ ├── CALLCODERipemd160_3.json │ │ ├── CALLCODERipemd160_3_postfixed0.json │ │ ├── CALLCODERipemd160_3_prefixed0.json │ │ ├── CALLCODERipemd160_4.json │ │ ├── CALLCODERipemd160_4_gas719.json │ │ ├── CALLCODERipemd160_5.json │ │ ├── CALLCODESha256_0.json │ │ ├── CALLCODESha256_1.json │ │ ├── CALLCODESha256_1_nonzeroValue.json │ │ ├── CALLCODESha256_2.json │ │ ├── CALLCODESha256_3.json │ │ ├── CALLCODESha256_3_postfix0.json │ │ ├── CALLCODESha256_3_prefix0.json │ │ ├── CALLCODESha256_4.json │ │ ├── CALLCODESha256_4_gas99.json │ │ ├── CALLCODESha256_5.json │ │ ├── CallEcrecover0.json │ │ ├── CallEcrecover0_0input.json │ │ ├── CallEcrecover0_Gas2999.json │ │ ├── CallEcrecover0_NoGas.json │ │ ├── CallEcrecover0_completeReturnValue.json │ │ ├── CallEcrecover0_gas3000.json │ │ ├── CallEcrecover0_overlappingInputOutput.json │ │ ├── CallEcrecover1.json │ │ ├── CallEcrecover2.json │ │ ├── CallEcrecover3.json │ │ ├── CallEcrecover80.json │ │ ├── CallEcrecoverCheckLength.json │ │ ├── CallEcrecoverCheckLengthWrongV.json │ │ ├── CallEcrecoverH_prefixed0.json │ │ ├── CallEcrecoverInvalidSignature.json │ │ ├── CallEcrecoverR_prefixed0.json │ │ ├── CallEcrecoverS_prefixed0.json │ │ ├── CallEcrecoverUnrecoverableKey.json │ │ ├── CallEcrecoverV_prefixed0.json │ │ ├── CallIdentitiy_0.json │ │ ├── CallIdentitiy_1.json │ │ ├── CallIdentity_1_nonzeroValue.json │ │ ├── CallIdentity_2.json │ │ ├── CallIdentity_3.json │ │ ├── CallIdentity_4.json │ │ ├── CallIdentity_4_gas17.json │ │ ├── CallIdentity_4_gas18.json │ │ ├── CallIdentity_5.json │ │ ├── CallIdentity_6_inputShorterThanOutput.json │ │ ├── CallRipemd160_0.json │ │ ├── CallRipemd160_1.json │ │ ├── CallRipemd160_2.json │ │ ├── CallRipemd160_3.json │ │ ├── CallRipemd160_3_postfixed0.json │ │ ├── CallRipemd160_3_prefixed0.json │ │ ├── CallRipemd160_4.json │ │ ├── CallRipemd160_4_gas719.json │ │ ├── CallRipemd160_5.json │ │ ├── CallSha256_0.json │ │ ├── CallSha256_1.json │ │ ├── CallSha256_1_nonzeroValue.json │ │ ├── CallSha256_2.json │ │ ├── CallSha256_3.json │ │ ├── CallSha256_3_postfix0.json │ │ ├── CallSha256_3_prefix0.json │ │ ├── CallSha256_4.json │ │ ├── CallSha256_4_gas99.json │ │ ├── CallSha256_5.json │ │ ├── modexpRandomInput.json │ │ ├── modexp_0_0_0_20500.json │ │ ├── modexp_0_0_0_22000.json │ │ ├── modexp_0_0_0_25000.json │ │ └── modexp_0_0_0_35000.json │ ├── stQuadraticComplexityTest │ │ ├── Call1MB1024Calldepth.json │ │ ├── Call50000.json │ │ ├── Call50000_ecrec.json │ │ ├── Call50000_identity.json │ │ ├── Call50000_identity2.json │ │ ├── Call50000_rip160.json │ │ ├── Call50000_sha256.json │ │ ├── Call50000bytesContract50_1.json │ │ ├── Call50000bytesContract50_2.json │ │ ├── Call50000bytesContract50_3.json │ │ ├── Callcode50000.json │ │ ├── Create1000.json │ │ ├── Create1000Byzantium.json │ │ ├── QuadraticComplexitySolidity_CallDataCopy.json │ │ ├── Return50000.json │ │ └── Return50000_2.json │ ├── stRandom │ │ ├── randomStatetest0.json │ │ ├── randomStatetest1.json │ │ ├── randomStatetest10.json │ │ ├── randomStatetest100.json │ │ ├── randomStatetest101.json │ │ ├── randomStatetest102.json │ │ ├── randomStatetest103.json │ │ ├── randomStatetest104.json │ │ ├── randomStatetest105.json │ │ ├── randomStatetest106.json │ │ ├── randomStatetest107.json │ │ ├── randomStatetest108.json │ │ ├── randomStatetest11.json │ │ ├── randomStatetest110.json │ │ ├── randomStatetest111.json │ │ ├── randomStatetest112.json │ │ ├── randomStatetest114.json │ │ ├── randomStatetest115.json │ │ ├── randomStatetest116.json │ │ ├── randomStatetest117.json │ │ ├── randomStatetest118.json │ │ ├── randomStatetest119.json │ │ ├── randomStatetest12.json │ │ ├── randomStatetest120.json │ │ ├── randomStatetest121.json │ │ ├── randomStatetest122.json │ │ ├── randomStatetest123.json │ │ ├── randomStatetest124.json │ │ ├── randomStatetest125.json │ │ ├── randomStatetest126.json │ │ ├── randomStatetest129.json │ │ ├── randomStatetest13.json │ │ ├── randomStatetest130.json │ │ ├── randomStatetest131.json │ │ ├── randomStatetest133.json │ │ ├── randomStatetest134.json │ │ ├── randomStatetest135.json │ │ ├── randomStatetest136.json │ │ ├── randomStatetest137.json │ │ ├── randomStatetest138.json │ │ ├── randomStatetest139.json │ │ ├── randomStatetest14.json │ │ ├── randomStatetest142.json │ │ ├── randomStatetest143.json │ │ ├── randomStatetest144.json │ │ ├── randomStatetest145.json │ │ ├── randomStatetest146.json │ │ ├── randomStatetest147.json │ │ ├── randomStatetest148.json │ │ ├── randomStatetest149.json │ │ ├── randomStatetest15.json │ │ ├── randomStatetest150.json │ │ ├── randomStatetest151.json │ │ ├── randomStatetest153.json │ │ ├── randomStatetest154.json │ │ ├── randomStatetest155.json │ │ ├── randomStatetest156.json │ │ ├── randomStatetest157.json │ │ ├── randomStatetest158.json │ │ ├── randomStatetest159.json │ │ ├── randomStatetest16.json │ │ ├── randomStatetest160.json │ │ ├── randomStatetest161.json │ │ ├── randomStatetest162.json │ │ ├── randomStatetest163.json │ │ ├── randomStatetest164.json │ │ ├── randomStatetest166.json │ │ ├── randomStatetest167.json │ │ ├── randomStatetest169.json │ │ ├── randomStatetest17.json │ │ ├── randomStatetest170.json │ │ ├── randomStatetest171.json │ │ ├── randomStatetest172.json │ │ ├── randomStatetest173.json │ │ ├── randomStatetest174.json │ │ ├── randomStatetest175.json │ │ ├── randomStatetest176.json │ │ ├── randomStatetest177.json │ │ ├── randomStatetest178.json │ │ ├── randomStatetest179.json │ │ ├── randomStatetest18.json │ │ ├── randomStatetest180.json │ │ ├── randomStatetest183.json │ │ ├── randomStatetest184.json │ │ ├── randomStatetest185.json │ │ ├── randomStatetest187.json │ │ ├── randomStatetest188.json │ │ ├── randomStatetest189.json │ │ ├── randomStatetest19.json │ │ ├── randomStatetest190.json │ │ ├── randomStatetest191.json │ │ ├── randomStatetest192.json │ │ ├── randomStatetest194.json │ │ ├── randomStatetest195.json │ │ ├── randomStatetest196.json │ │ ├── randomStatetest197.json │ │ ├── randomStatetest198.json │ │ ├── randomStatetest199.json │ │ ├── randomStatetest2.json │ │ ├── randomStatetest20.json │ │ ├── randomStatetest200.json │ │ ├── randomStatetest201.json │ │ ├── randomStatetest202.json │ │ ├── randomStatetest204.json │ │ ├── randomStatetest205.json │ │ ├── randomStatetest206.json │ │ ├── randomStatetest207.json │ │ ├── randomStatetest208.json │ │ ├── randomStatetest209.json │ │ ├── randomStatetest210.json │ │ ├── randomStatetest211.json │ │ ├── randomStatetest212.json │ │ ├── randomStatetest214.json │ │ ├── randomStatetest215.json │ │ ├── randomStatetest216.json │ │ ├── randomStatetest217.json │ │ ├── randomStatetest219.json │ │ ├── randomStatetest22.json │ │ ├── randomStatetest220.json │ │ ├── randomStatetest221.json │ │ ├── randomStatetest222.json │ │ ├── randomStatetest223.json │ │ ├── randomStatetest225.json │ │ ├── randomStatetest226.json │ │ ├── randomStatetest227.json │ │ ├── randomStatetest228.json │ │ ├── randomStatetest229.json │ │ ├── randomStatetest23.json │ │ ├── randomStatetest230.json │ │ ├── randomStatetest231.json │ │ ├── randomStatetest232.json │ │ ├── randomStatetest233.json │ │ ├── randomStatetest236.json │ │ ├── randomStatetest237.json │ │ ├── randomStatetest238.json │ │ ├── randomStatetest24.json │ │ ├── randomStatetest241.json │ │ ├── randomStatetest242.json │ │ ├── randomStatetest243.json │ │ ├── randomStatetest244.json │ │ ├── randomStatetest245.json │ │ ├── randomStatetest246.json │ │ ├── randomStatetest247.json │ │ ├── randomStatetest248.json │ │ ├── randomStatetest249.json │ │ ├── randomStatetest25.json │ │ ├── randomStatetest250.json │ │ ├── randomStatetest251.json │ │ ├── randomStatetest252.json │ │ ├── randomStatetest254.json │ │ ├── randomStatetest257.json │ │ ├── randomStatetest259.json │ │ ├── randomStatetest26.json │ │ ├── randomStatetest260.json │ │ ├── randomStatetest261.json │ │ ├── randomStatetest263.json │ │ ├── randomStatetest264.json │ │ ├── randomStatetest265.json │ │ ├── randomStatetest266.json │ │ ├── randomStatetest267.json │ │ ├── randomStatetest268.json │ │ ├── randomStatetest269.json │ │ ├── randomStatetest27.json │ │ ├── randomStatetest270.json │ │ ├── randomStatetest271.json │ │ ├── randomStatetest273.json │ │ ├── randomStatetest274.json │ │ ├── randomStatetest275.json │ │ ├── randomStatetest276.json │ │ ├── randomStatetest278.json │ │ ├── randomStatetest279.json │ │ ├── randomStatetest28.json │ │ ├── randomStatetest280.json │ │ ├── randomStatetest281.json │ │ ├── randomStatetest282.json │ │ ├── randomStatetest283.json │ │ ├── randomStatetest285.json │ │ ├── randomStatetest286.json │ │ ├── randomStatetest287.json │ │ ├── randomStatetest288.json │ │ ├── randomStatetest29.json │ │ ├── randomStatetest290.json │ │ ├── randomStatetest291.json │ │ ├── randomStatetest292.json │ │ ├── randomStatetest293.json │ │ ├── randomStatetest294.json │ │ ├── randomStatetest295.json │ │ ├── randomStatetest296.json │ │ ├── randomStatetest297.json │ │ ├── randomStatetest298.json │ │ ├── randomStatetest299.json │ │ ├── randomStatetest3.json │ │ ├── randomStatetest30.json │ │ ├── randomStatetest300.json │ │ ├── randomStatetest301.json │ │ ├── randomStatetest302.json │ │ ├── randomStatetest303.json │ │ ├── randomStatetest304.json │ │ ├── randomStatetest305.json │ │ ├── randomStatetest306.json │ │ ├── randomStatetest307.json │ │ ├── randomStatetest308.json │ │ ├── randomStatetest309.json │ │ ├── randomStatetest31.json │ │ ├── randomStatetest310.json │ │ ├── randomStatetest311.json │ │ ├── randomStatetest312.json │ │ ├── randomStatetest313.json │ │ ├── randomStatetest315.json │ │ ├── randomStatetest316.json │ │ ├── randomStatetest318.json │ │ ├── randomStatetest32.json │ │ ├── randomStatetest320.json │ │ ├── randomStatetest321.json │ │ ├── randomStatetest322.json │ │ ├── randomStatetest323.json │ │ ├── randomStatetest324.json │ │ ├── randomStatetest325.json │ │ ├── randomStatetest326.json │ │ ├── randomStatetest327.json │ │ ├── randomStatetest328.json │ │ ├── randomStatetest329.json │ │ ├── randomStatetest33.json │ │ ├── randomStatetest332.json │ │ ├── randomStatetest333.json │ │ ├── randomStatetest334.json │ │ ├── randomStatetest335.json │ │ ├── randomStatetest336.json │ │ ├── randomStatetest337.json │ │ ├── randomStatetest338.json │ │ ├── randomStatetest339.json │ │ ├── randomStatetest340.json │ │ ├── randomStatetest341.json │ │ ├── randomStatetest342.json │ │ ├── randomStatetest343.json │ │ ├── randomStatetest345.json │ │ ├── randomStatetest346.json │ │ ├── randomStatetest347.json │ │ ├── randomStatetest348.json │ │ ├── randomStatetest349.json │ │ ├── randomStatetest350.json │ │ ├── randomStatetest351.json │ │ ├── randomStatetest352.json │ │ ├── randomStatetest353.json │ │ ├── randomStatetest354.json │ │ ├── randomStatetest355.json │ │ ├── randomStatetest356.json │ │ ├── randomStatetest357.json │ │ ├── randomStatetest358.json │ │ ├── randomStatetest359.json │ │ ├── randomStatetest36.json │ │ ├── randomStatetest360.json │ │ ├── randomStatetest361.json │ │ ├── randomStatetest362.json │ │ ├── randomStatetest363.json │ │ ├── randomStatetest364.json │ │ ├── randomStatetest365.json │ │ ├── randomStatetest366.json │ │ ├── randomStatetest367.json │ │ ├── randomStatetest368.json │ │ ├── randomStatetest369.json │ │ ├── randomStatetest37.json │ │ ├── randomStatetest370.json │ │ ├── randomStatetest371.json │ │ ├── randomStatetest372.json │ │ ├── randomStatetest375.json │ │ ├── randomStatetest376.json │ │ ├── randomStatetest377.json │ │ ├── randomStatetest378.json │ │ ├── randomStatetest379.json │ │ ├── randomStatetest38.json │ │ ├── randomStatetest380.json │ │ ├── randomStatetest381.json │ │ ├── randomStatetest382.json │ │ ├── randomStatetest383.json │ │ ├── randomStatetest39.json │ │ ├── randomStatetest4.json │ │ ├── randomStatetest41.json │ │ ├── randomStatetest42.json │ │ ├── randomStatetest43.json │ │ ├── randomStatetest45.json │ │ ├── randomStatetest46.json │ │ ├── randomStatetest47.json │ │ ├── randomStatetest48.json │ │ ├── randomStatetest49.json │ │ ├── randomStatetest5.json │ │ ├── randomStatetest50.json │ │ ├── randomStatetest51.json │ │ ├── randomStatetest52.json │ │ ├── randomStatetest53.json │ │ ├── randomStatetest54.json │ │ ├── randomStatetest55.json │ │ ├── randomStatetest57.json │ │ ├── randomStatetest58.json │ │ ├── randomStatetest59.json │ │ ├── randomStatetest6.json │ │ ├── randomStatetest60.json │ │ ├── randomStatetest62.json │ │ ├── randomStatetest63.json │ │ ├── randomStatetest64.json │ │ ├── randomStatetest66.json │ │ ├── randomStatetest67.json │ │ ├── randomStatetest69.json │ │ ├── randomStatetest7.json │ │ ├── randomStatetest72.json │ │ ├── randomStatetest73.json │ │ ├── randomStatetest74.json │ │ ├── randomStatetest75.json │ │ ├── randomStatetest77.json │ │ ├── randomStatetest78.json │ │ ├── randomStatetest80.json │ │ ├── randomStatetest81.json │ │ ├── randomStatetest82.json │ │ ├── randomStatetest83.json │ │ ├── randomStatetest84.json │ │ ├── randomStatetest85.json │ │ ├── randomStatetest87.json │ │ ├── randomStatetest88.json │ │ ├── randomStatetest89.json │ │ ├── randomStatetest9.json │ │ ├── randomStatetest90.json │ │ ├── randomStatetest92.json │ │ ├── randomStatetest94.json │ │ ├── randomStatetest95.json │ │ ├── randomStatetest96.json │ │ ├── randomStatetest97.json │ │ └── randomStatetest98.json │ ├── stRandom2 │ │ ├── 201503110226PYTHON_DUP6.json │ │ ├── randomStatetest.json │ │ ├── randomStatetest384.json │ │ ├── randomStatetest385.json │ │ ├── randomStatetest386.json │ │ ├── randomStatetest387.json │ │ ├── randomStatetest388.json │ │ ├── randomStatetest389.json │ │ ├── randomStatetest391.json │ │ ├── randomStatetest393.json │ │ ├── randomStatetest395.json │ │ ├── randomStatetest396.json │ │ ├── randomStatetest397.json │ │ ├── randomStatetest398.json │ │ ├── randomStatetest399.json │ │ ├── randomStatetest401.json │ │ ├── randomStatetest402.json │ │ ├── randomStatetest404.json │ │ ├── randomStatetest405.json │ │ ├── randomStatetest406.json │ │ ├── randomStatetest407.json │ │ ├── randomStatetest408.json │ │ ├── randomStatetest409.json │ │ ├── randomStatetest410.json │ │ ├── randomStatetest411.json │ │ ├── randomStatetest412.json │ │ ├── randomStatetest413.json │ │ ├── randomStatetest414.json │ │ ├── randomStatetest415.json │ │ ├── randomStatetest416.json │ │ ├── randomStatetest417.json │ │ ├── randomStatetest418.json │ │ ├── randomStatetest419.json │ │ ├── randomStatetest420.json │ │ ├── randomStatetest421.json │ │ ├── randomStatetest422.json │ │ ├── randomStatetest423.json │ │ ├── randomStatetest424.json │ │ ├── randomStatetest425.json │ │ ├── randomStatetest426.json │ │ ├── randomStatetest428.json │ │ ├── randomStatetest429.json │ │ ├── randomStatetest430.json │ │ ├── randomStatetest433.json │ │ ├── randomStatetest435.json │ │ ├── randomStatetest436.json │ │ ├── randomStatetest437.json │ │ ├── randomStatetest438.json │ │ ├── randomStatetest439.json │ │ ├── randomStatetest440.json │ │ ├── randomStatetest441.json │ │ ├── randomStatetest442.json │ │ ├── randomStatetest443.json │ │ ├── randomStatetest444.json │ │ ├── randomStatetest445.json │ │ ├── randomStatetest446.json │ │ ├── randomStatetest447.json │ │ ├── randomStatetest448.json │ │ ├── randomStatetest449.json │ │ ├── randomStatetest450.json │ │ ├── randomStatetest451.json │ │ ├── randomStatetest452.json │ │ ├── randomStatetest454.json │ │ ├── randomStatetest455.json │ │ ├── randomStatetest456.json │ │ ├── randomStatetest457.json │ │ ├── randomStatetest458.json │ │ ├── randomStatetest460.json │ │ ├── randomStatetest461.json │ │ ├── randomStatetest462.json │ │ ├── randomStatetest464.json │ │ ├── randomStatetest465.json │ │ ├── randomStatetest466.json │ │ ├── randomStatetest467.json │ │ ├── randomStatetest468.json │ │ ├── randomStatetest469.json │ │ ├── randomStatetest470.json │ │ ├── randomStatetest471.json │ │ ├── randomStatetest472.json │ │ ├── randomStatetest473.json │ │ ├── randomStatetest474.json │ │ ├── randomStatetest475.json │ │ ├── randomStatetest476.json │ │ ├── randomStatetest477.json │ │ ├── randomStatetest478.json │ │ ├── randomStatetest480.json │ │ ├── randomStatetest481.json │ │ ├── randomStatetest482.json │ │ ├── randomStatetest483.json │ │ ├── randomStatetest484.json │ │ ├── randomStatetest485.json │ │ ├── randomStatetest487.json │ │ ├── randomStatetest488.json │ │ ├── randomStatetest489.json │ │ ├── randomStatetest491.json │ │ ├── randomStatetest493.json │ │ ├── randomStatetest494.json │ │ ├── randomStatetest495.json │ │ ├── randomStatetest496.json │ │ ├── randomStatetest497.json │ │ ├── randomStatetest498.json │ │ ├── randomStatetest499.json │ │ ├── randomStatetest500.json │ │ ├── randomStatetest501.json │ │ ├── randomStatetest502.json │ │ ├── randomStatetest503.json │ │ ├── randomStatetest504.json │ │ ├── randomStatetest505.json │ │ ├── randomStatetest506.json │ │ ├── randomStatetest507.json │ │ ├── randomStatetest508.json │ │ ├── randomStatetest509.json │ │ ├── randomStatetest510.json │ │ ├── randomStatetest511.json │ │ ├── randomStatetest512.json │ │ ├── randomStatetest513.json │ │ ├── randomStatetest514.json │ │ ├── randomStatetest516.json │ │ ├── randomStatetest517.json │ │ ├── randomStatetest518.json │ │ ├── randomStatetest519.json │ │ ├── randomStatetest520.json │ │ ├── randomStatetest521.json │ │ ├── randomStatetest523.json │ │ ├── randomStatetest524.json │ │ ├── randomStatetest525.json │ │ ├── randomStatetest526.json │ │ ├── randomStatetest527.json │ │ ├── randomStatetest528.json │ │ ├── randomStatetest531.json │ │ ├── randomStatetest532.json │ │ ├── randomStatetest533.json │ │ ├── randomStatetest534.json │ │ ├── randomStatetest535.json │ │ ├── randomStatetest536.json │ │ ├── randomStatetest537.json │ │ ├── randomStatetest538.json │ │ ├── randomStatetest539.json │ │ ├── randomStatetest541.json │ │ ├── randomStatetest542.json │ │ ├── randomStatetest543.json │ │ ├── randomStatetest544.json │ │ ├── randomStatetest545.json │ │ ├── randomStatetest546.json │ │ ├── randomStatetest547.json │ │ ├── randomStatetest548.json │ │ ├── randomStatetest549.json │ │ ├── randomStatetest550.json │ │ ├── randomStatetest552.json │ │ ├── randomStatetest553.json │ │ ├── randomStatetest554.json │ │ ├── randomStatetest555.json │ │ ├── randomStatetest556.json │ │ ├── randomStatetest558.json │ │ ├── randomStatetest559.json │ │ ├── randomStatetest560.json │ │ ├── randomStatetest562.json │ │ ├── randomStatetest563.json │ │ ├── randomStatetest564.json │ │ ├── randomStatetest565.json │ │ ├── randomStatetest566.json │ │ ├── randomStatetest567.json │ │ ├── randomStatetest569.json │ │ ├── randomStatetest571.json │ │ ├── randomStatetest572.json │ │ ├── randomStatetest573.json │ │ ├── randomStatetest574.json │ │ ├── randomStatetest575.json │ │ ├── randomStatetest576.json │ │ ├── randomStatetest577.json │ │ ├── randomStatetest578.json │ │ ├── randomStatetest579.json │ │ ├── randomStatetest580.json │ │ ├── randomStatetest581.json │ │ ├── randomStatetest582.json │ │ ├── randomStatetest583.json │ │ ├── randomStatetest584.json │ │ ├── randomStatetest585.json │ │ ├── randomStatetest586.json │ │ ├── randomStatetest587.json │ │ ├── randomStatetest588.json │ │ ├── randomStatetest589.json │ │ ├── randomStatetest592.json │ │ ├── randomStatetest594.json │ │ ├── randomStatetest596.json │ │ ├── randomStatetest597.json │ │ ├── randomStatetest599.json │ │ ├── randomStatetest600.json │ │ ├── randomStatetest601.json │ │ ├── randomStatetest602.json │ │ ├── randomStatetest603.json │ │ ├── randomStatetest604.json │ │ ├── randomStatetest605.json │ │ ├── randomStatetest607.json │ │ ├── randomStatetest608.json │ │ ├── randomStatetest609.json │ │ ├── randomStatetest610.json │ │ ├── randomStatetest611.json │ │ ├── randomStatetest612.json │ │ ├── randomStatetest615.json │ │ ├── randomStatetest616.json │ │ ├── randomStatetest618.json │ │ ├── randomStatetest619.json │ │ ├── randomStatetest620.json │ │ ├── randomStatetest621.json │ │ ├── randomStatetest624.json │ │ ├── randomStatetest625.json │ │ ├── randomStatetest626.json │ │ ├── randomStatetest627.json │ │ ├── randomStatetest628.json │ │ ├── randomStatetest629.json │ │ ├── randomStatetest630.json │ │ ├── randomStatetest632.json │ │ ├── randomStatetest633.json │ │ ├── randomStatetest635.json │ │ ├── randomStatetest636.json │ │ ├── randomStatetest637.json │ │ ├── randomStatetest638.json │ │ ├── randomStatetest639.json │ │ ├── randomStatetest640.json │ │ ├── randomStatetest641.json │ │ ├── randomStatetest642.json │ │ ├── randomStatetest643.json │ │ ├── randomStatetest644.json │ │ ├── randomStatetest645.json │ │ ├── randomStatetest646.json │ │ └── randomStatetest647.json │ ├── stRecursiveCreate │ │ ├── recursiveCreate.json │ │ └── recursiveCreateReturnValue.json │ ├── stRefundTest │ │ ├── refund50_1.json │ │ ├── refund50_2.json │ │ ├── refund50percentCap.json │ │ ├── refund600.json │ │ ├── refundSuicide50procentCap.json │ │ ├── refund_CallA.json │ │ ├── refund_CallA_OOG.json │ │ ├── refund_CallA_notEnoughGasInCall.json │ │ ├── refund_CallToSuicideNoStorage.json │ │ ├── refund_CallToSuicideStorage.json │ │ ├── refund_CallToSuicideTwice.json │ │ ├── refund_NoOOG_1.json │ │ ├── refund_OOG.json │ │ ├── refund_TxToSuicide.json │ │ ├── refund_TxToSuicideOOG.json │ │ ├── refund_changeNonZeroStorage.json │ │ ├── refund_getEtherBack.json │ │ ├── refund_multimpleSuicide.json │ │ └── refund_singleSuicide.json │ ├── stReturnDataTest │ │ ├── call_ecrec_success_empty_then_returndatasize.json │ │ ├── call_outsize_then_create_successful_then_returndatasize.json │ │ ├── call_then_call_value_fail_then_returndatasize.json │ │ ├── call_then_create_successful_then_returndatasize.json │ │ ├── create_callprecompile_returndatasize.json │ │ ├── modexp_modsize0_returndatasize.json │ │ ├── returndatacopy_0_0_following_successful_create.json │ │ ├── returndatacopy_afterFailing_create.json │ │ ├── returndatacopy_after_failing_callcode.json │ │ ├── returndatacopy_after_failing_delegatecall.json │ │ ├── returndatacopy_after_failing_staticcall.json │ │ ├── returndatacopy_after_revert_in_staticcall.json │ │ ├── returndatacopy_after_successful_callcode.json │ │ ├── returndatacopy_after_successful_delegatecall.json │ │ ├── returndatacopy_after_successful_staticcall.json │ │ ├── returndatacopy_following_call.json │ │ ├── returndatacopy_following_create.json │ │ ├── returndatacopy_following_failing_call.json │ │ ├── returndatacopy_following_revert.json │ │ ├── returndatacopy_following_revert_in_create.json │ │ ├── returndatacopy_following_successful_create.json │ │ ├── returndatacopy_following_too_big_transfer.json │ │ ├── returndatacopy_initial.json │ │ ├── returndatacopy_initial_256.json │ │ ├── returndatacopy_initial_big_sum.json │ │ ├── returndatacopy_overrun.json │ │ ├── returndatasize_after_failing_callcode.json │ │ ├── returndatasize_after_failing_delegatecall.json │ │ ├── returndatasize_after_failing_staticcall.json │ │ ├── returndatasize_after_oog_after_deeper.json │ │ ├── returndatasize_after_successful_callcode.json │ │ ├── returndatasize_after_successful_delegatecall.json │ │ ├── returndatasize_after_successful_staticcall.json │ │ ├── returndatasize_bug.json │ │ ├── returndatasize_following_successful_create.json │ │ ├── returndatasize_initial.json │ │ ├── returndatasize_initial_zero_read.json │ │ └── subcallReturnMoreThenExpected.json │ ├── stRevertTest │ │ ├── LoopCallsDepthThenRevert.json │ │ ├── LoopCallsDepthThenRevert2.json │ │ ├── LoopCallsDepthThenRevert3.json │ │ ├── LoopCallsThenRevert.json │ │ ├── LoopDelegateCallsDepthThenRevert.json │ │ ├── NashatyrevSuicideRevert.json │ │ ├── PythonRevertTestTue201814-1430.json │ │ ├── RevertDepth2.json │ │ ├── RevertDepthCreateAddressCollision.json │ │ ├── RevertDepthCreateOOG.json │ │ ├── RevertInCallCode.json │ │ ├── RevertInCreateInInit.json │ │ ├── RevertInDelegateCall.json │ │ ├── RevertInStaticCall.json │ │ ├── RevertOnEmptyStack.json │ │ ├── RevertOpcode.json │ │ ├── RevertOpcodeCalls.json │ │ ├── RevertOpcodeCreate.json │ │ ├── RevertOpcodeDirectCall.json │ │ ├── RevertOpcodeInCallsOnNonEmptyReturnData.json │ │ ├── RevertOpcodeInCreateReturns.json │ │ ├── RevertOpcodeInInit.json │ │ ├── RevertOpcodeMultipleSubCalls.json │ │ ├── RevertOpcodeReturn.json │ │ ├── RevertOpcodeWithBigOutputInInit.json │ │ ├── RevertPrecompiledTouch.json │ │ ├── RevertPrecompiledTouch_nonce.json │ │ ├── RevertPrecompiledTouch_noncestorage.json │ │ ├── RevertPrecompiledTouch_storage.json │ │ ├── RevertPrefound.json │ │ ├── RevertPrefoundCall.json │ │ ├── RevertPrefoundCallOOG.json │ │ ├── RevertPrefoundEmpty.json │ │ ├── RevertPrefoundEmptyCall.json │ │ ├── RevertPrefoundEmptyCallOOG.json │ │ ├── RevertPrefoundEmptyOOG.json │ │ ├── RevertPrefoundOOG.json │ │ ├── RevertRemoteSubCallStorageOOG.json │ │ ├── RevertRemoteSubCallStorageOOG2.json │ │ ├── RevertSubCallStorageOOG.json │ │ ├── RevertSubCallStorageOOG2.json │ │ ├── TouchToEmptyAccountRevert.json │ │ ├── TouchToEmptyAccountRevert2.json │ │ └── TouchToEmptyAccountRevert3.json │ ├── stSStoreTest │ │ ├── InitCollision.json │ │ ├── InitCollisionNonZeroNonce.json │ │ ├── SstoreCallToSelfSubRefundBelowZero.json │ │ ├── sstore_0to0.json │ │ ├── sstore_0to0to0.json │ │ ├── sstore_0to0toX.json │ │ ├── sstore_0toX.json │ │ ├── sstore_0toXto0.json │ │ ├── sstore_0toXto0toX.json │ │ ├── sstore_0toXtoX.json │ │ ├── sstore_0toXtoY.json │ │ ├── sstore_Xto0.json │ │ ├── sstore_Xto0to0.json │ │ ├── sstore_Xto0toX.json │ │ ├── sstore_Xto0toXto0.json │ │ ├── sstore_Xto0toY.json │ │ ├── sstore_XtoX.json │ │ ├── sstore_XtoXto0.json │ │ ├── sstore_XtoXtoX.json │ │ ├── sstore_XtoXtoY.json │ │ ├── sstore_XtoY.json │ │ ├── sstore_XtoYto0.json │ │ ├── sstore_XtoYtoX.json │ │ ├── sstore_XtoYtoY.json │ │ ├── sstore_XtoYtoZ.json │ │ ├── sstore_changeFromExternalCallInInitCode.json │ │ ├── sstore_combinations_initial0.json │ │ ├── sstore_combinations_initial1.json │ │ └── sstore_combinations_initial2.json │ ├── stShift │ │ ├── .stub │ │ ├── sar00.json │ │ ├── sar01.json │ │ ├── sar10.json │ │ ├── sar11.json │ │ ├── sar_0_256-1.json │ │ ├── sar_2^254_254.json │ │ ├── sar_2^255-1_248.json │ │ ├── sar_2^255-1_254.json │ │ ├── sar_2^255-1_255.json │ │ ├── sar_2^255-1_256.json │ │ ├── sar_2^255_1.json │ │ ├── sar_2^255_255.json │ │ ├── sar_2^255_256.json │ │ ├── sar_2^255_257.json │ │ ├── sar_2^256-1_0.json │ │ ├── sar_2^256-1_1.json │ │ ├── sar_2^256-1_255.json │ │ ├── sar_2^256-1_256.json │ │ ├── shiftCombinations.json │ │ ├── shl01-0100.json │ │ ├── shl01-0101.json │ │ ├── shl01-ff.json │ │ ├── shl01.json │ │ ├── shl10.json │ │ ├── shl11.json │ │ ├── shl_-1_0.json │ │ ├── shl_-1_1.json │ │ ├── shl_-1_255.json │ │ ├── shl_-1_256.json │ │ ├── shl_2^255-1_1.json │ │ ├── shr01.json │ │ ├── shr10.json │ │ ├── shr11.json │ │ ├── shr_-1_0.json │ │ ├── shr_-1_1.json │ │ ├── shr_-1_255.json │ │ ├── shr_-1_256.json │ │ ├── shr_2^255_1.json │ │ ├── shr_2^255_255.json │ │ ├── shr_2^255_256.json │ │ └── shr_2^255_257.json │ ├── stSolidityTest │ │ ├── AmbiguousMethod.json │ │ ├── CallInfiniteLoop.json │ │ ├── CallLowLevelCreatesSolidity.json │ │ ├── CallRecursiveMethods.json │ │ ├── ContractInheritance.json │ │ ├── CreateContractFromMethod.json │ │ ├── RecursiveCreateContracts.json │ │ ├── RecursiveCreateContractsCreate4Contracts.json │ │ ├── TestBlockAndTransactionProperties.json │ │ ├── TestContractInteraction.json │ │ ├── TestContractSuicide.json │ │ ├── TestCryptographicFunctions.json │ │ ├── TestKeywords.json │ │ ├── TestOverflow.json │ │ ├── TestStoreGasPrices.json │ │ └── TestStructuresAndVariabless.json │ ├── stSpecialTest │ │ ├── FailedCreateRevertsDeletion.json │ │ ├── JUMPDEST_Attack.json │ │ ├── JUMPDEST_AttackwithJump.json │ │ ├── OverflowGasMakeMoney.json │ │ ├── StackDepthLimitSEC.json │ │ ├── block504980.json │ │ ├── deploymentError.json │ │ ├── failed_tx_xcf416c53.json │ │ ├── gasPrice0.json │ │ ├── makeMoney.json │ │ ├── push32withoutByte.json │ │ ├── sha3_deja.json │ │ ├── txCost-sec73.json │ │ └── tx_e1c174e2.json │ ├── stStackTests │ │ ├── shallowStack.json │ │ ├── stackOverflow.json │ │ ├── stackOverflowDUP.json │ │ ├── stackOverflowM1.json │ │ ├── stackOverflowM1DUP.json │ │ ├── stackOverflowM1PUSH.json │ │ └── stackOverflowPUSH.json │ ├── stStaticCall │ │ ├── static_ABAcalls0.json │ │ ├── static_ABAcalls1.json │ │ ├── static_ABAcalls2.json │ │ ├── static_ABAcalls3.json │ │ ├── static_ABAcallsSuicide0.json │ │ ├── static_ABAcallsSuicide1.json │ │ ├── static_CALL_OneVCallSuicide.json │ │ ├── static_CALL_ZeroVCallSuicide.json │ │ ├── static_CREATE_ContractSuicideDuringInit.json │ │ ├── static_CREATE_ContractSuicideDuringInit_ThenStoreThenReturn.json │ │ ├── static_CREATE_ContractSuicideDuringInit_WithValue.json │ │ ├── static_CREATE_EmptyContractAndCallIt_0wei.json │ │ ├── static_CREATE_EmptyContractWithStorageAndCallIt_0wei.json │ │ ├── static_Call10.json │ │ ├── static_Call1024BalanceTooLow.json │ │ ├── static_Call1024BalanceTooLow2.json │ │ ├── static_Call1024OOG.json │ │ ├── static_Call1024PreCalls.json │ │ ├── static_Call1024PreCalls2.json │ │ ├── static_Call1024PreCalls3.json │ │ ├── static_Call1MB1024Calldepth.json │ │ ├── static_Call50000.json │ │ ├── static_Call50000_ecrec.json │ │ ├── static_Call50000_identity.json │ │ ├── static_Call50000_identity2.json │ │ ├── static_Call50000_rip160.json │ │ ├── static_Call50000_sha256.json │ │ ├── static_Call50000bytesContract50_1.json │ │ ├── static_Call50000bytesContract50_2.json │ │ ├── static_Call50000bytesContract50_3.json │ │ ├── static_CallAndCallcodeConsumeMoreGasThenTransactionHas.json │ │ ├── static_CallAskMoreGasOnDepth2ThenTransactionHas.json │ │ ├── static_CallContractToCreateContractAndCallItOOG.json │ │ ├── static_CallContractToCreateContractOOG.json │ │ ├── static_CallContractToCreateContractOOGBonusGas.json │ │ ├── static_CallContractToCreateContractWhichWouldCreateContractIfCalled.json │ │ ├── static_CallEcrecover0.json │ │ ├── static_CallEcrecover0_0input.json │ │ ├── static_CallEcrecover0_Gas2999.json │ │ ├── static_CallEcrecover0_NoGas.json │ │ ├── static_CallEcrecover0_completeReturnValue.json │ │ ├── static_CallEcrecover0_gas3000.json │ │ ├── static_CallEcrecover0_overlappingInputOutput.json │ │ ├── static_CallEcrecover1.json │ │ ├── static_CallEcrecover2.json │ │ ├── static_CallEcrecover3.json │ │ ├── static_CallEcrecover80.json │ │ ├── static_CallEcrecoverCheckLength.json │ │ ├── static_CallEcrecoverCheckLengthWrongV.json │ │ ├── static_CallEcrecoverH_prefixed0.json │ │ ├── static_CallEcrecoverR_prefixed0.json │ │ ├── static_CallEcrecoverS_prefixed0.json │ │ ├── static_CallEcrecoverV_prefixed0.json │ │ ├── static_CallGoesOOGOnSecondLevel.json │ │ ├── static_CallGoesOOGOnSecondLevel2.json │ │ ├── static_CallIdentitiy_1.json │ │ ├── static_CallIdentity_1_nonzeroValue.json │ │ ├── static_CallIdentity_2.json │ │ ├── static_CallIdentity_3.json │ │ ├── static_CallIdentity_4.json │ │ ├── static_CallIdentity_4_gas17.json │ │ ├── static_CallIdentity_4_gas18.json │ │ ├── static_CallIdentity_5.json │ │ ├── static_CallLoseGasOOG.json │ │ ├── static_CallRecursiveBomb0.json │ │ ├── static_CallRecursiveBomb0_OOG_atMaxCallDepth.json │ │ ├── static_CallRecursiveBomb1.json │ │ ├── static_CallRecursiveBomb2.json │ │ ├── static_CallRecursiveBomb3.json │ │ ├── static_CallRecursiveBombLog.json │ │ ├── static_CallRecursiveBombLog2.json │ │ ├── static_CallRecursiveBombPreCall.json │ │ ├── static_CallRecursiveBombPreCall2.json │ │ ├── static_CallRipemd160_1.json │ │ ├── static_CallRipemd160_2.json │ │ ├── static_CallRipemd160_3.json │ │ ├── static_CallRipemd160_3_postfixed0.json │ │ ├── static_CallRipemd160_3_prefixed0.json │ │ ├── static_CallRipemd160_4.json │ │ ├── static_CallRipemd160_4_gas719.json │ │ ├── static_CallRipemd160_5.json │ │ ├── static_CallSha256_1.json │ │ ├── static_CallSha256_1_nonzeroValue.json │ │ ├── static_CallSha256_2.json │ │ ├── static_CallSha256_3.json │ │ ├── static_CallSha256_3_postfix0.json │ │ ├── static_CallSha256_3_prefix0.json │ │ ├── static_CallSha256_4.json │ │ ├── static_CallSha256_4_gas99.json │ │ ├── static_CallSha256_5.json │ │ ├── static_CallToNameRegistrator0.json │ │ ├── static_CallToReturn1.json │ │ ├── static_CalltoReturn2.json │ │ ├── static_CheckCallCostOOG.json │ │ ├── static_CheckOpcodes.json │ │ ├── static_CheckOpcodes2.json │ │ ├── static_CheckOpcodes3.json │ │ ├── static_CheckOpcodes4.json │ │ ├── static_CheckOpcodes5.json │ │ ├── static_ExecuteCallThatAskForeGasThenTrabsactionHas.json │ │ ├── static_InternalCallHittingGasLimit.json │ │ ├── static_InternalCallHittingGasLimit2.json │ │ ├── static_InternlCallStoreClearsOOG.json │ │ ├── static_LoopCallsDepthThenRevert.json │ │ ├── static_LoopCallsDepthThenRevert2.json │ │ ├── static_LoopCallsDepthThenRevert3.json │ │ ├── static_LoopCallsThenRevert.json │ │ ├── static_PostToReturn1.json │ │ ├── static_RETURN_Bounds.json │ │ ├── static_RETURN_BoundsOOG.json │ │ ├── static_RawCallGasAsk.json │ │ ├── static_Return50000_2.json │ │ ├── static_ReturnTest.json │ │ ├── static_ReturnTest2.json │ │ ├── static_RevertDepth2.json │ │ ├── static_RevertOpcodeCalls.json │ │ ├── static_ZeroValue_CALL_OOGRevert.json │ │ ├── static_ZeroValue_SUICIDE_OOGRevert.json │ │ ├── static_callBasic.json │ │ ├── static_callChangeRevert.json │ │ ├── static_callCreate.json │ │ ├── static_callCreate2.json │ │ ├── static_callCreate3.json │ │ ├── static_callOutput1.json │ │ ├── static_callOutput2.json │ │ ├── static_callOutput3.json │ │ ├── static_callOutput3Fail.json │ │ ├── static_callOutput3partial.json │ │ ├── static_callOutput3partialFail.json │ │ ├── static_callToCallCodeOpCodeCheck.json │ │ ├── static_callToCallOpCodeCheck.json │ │ ├── static_callToDelCallOpCodeCheck.json │ │ ├── static_callToStaticOpCodeCheck.json │ │ ├── static_callWithHighValue.json │ │ ├── static_callWithHighValueAndGasOOG.json │ │ ├── static_callWithHighValueAndOOGatTxLevel.json │ │ ├── static_callWithHighValueOOGinCall.json │ │ ├── static_call_OOG_additionalGasCosts1.json │ │ ├── static_call_OOG_additionalGasCosts2.json │ │ ├── static_call_value_inherit.json │ │ ├── static_call_value_inherit_from_call.json │ │ ├── static_callcall_00.json │ │ ├── static_callcall_00_OOGE.json │ │ ├── static_callcall_00_OOGE_1.json │ │ ├── static_callcall_00_OOGE_2.json │ │ ├── static_callcall_00_SuicideEnd.json │ │ ├── static_callcallcall_000.json │ │ ├── static_callcallcall_000_OOGE.json │ │ ├── static_callcallcall_000_OOGMAfter.json │ │ ├── static_callcallcall_000_OOGMAfter2.json │ │ ├── static_callcallcall_000_OOGMBefore.json │ │ ├── static_callcallcall_000_SuicideEnd.json │ │ ├── static_callcallcall_000_SuicideMiddle.json │ │ ├── static_callcallcall_ABCB_RECURSIVE.json │ │ ├── static_callcallcallcode_001.json │ │ ├── static_callcallcallcode_001_2.json │ │ ├── static_callcallcallcode_001_OOGE.json │ │ ├── static_callcallcallcode_001_OOGE_2.json │ │ ├── static_callcallcallcode_001_OOGMAfter.json │ │ ├── static_callcallcallcode_001_OOGMAfter2.json │ │ ├── static_callcallcallcode_001_OOGMAfter_2.json │ │ ├── static_callcallcallcode_001_OOGMAfter_3.json │ │ ├── static_callcallcallcode_001_OOGMBefore.json │ │ ├── static_callcallcallcode_001_OOGMBefore2.json │ │ ├── static_callcallcallcode_001_SuicideEnd.json │ │ ├── static_callcallcallcode_001_SuicideEnd2.json │ │ ├── static_callcallcallcode_001_SuicideMiddle.json │ │ ├── static_callcallcallcode_001_SuicideMiddle2.json │ │ ├── static_callcallcallcode_ABCB_RECURSIVE.json │ │ ├── static_callcallcallcode_ABCB_RECURSIVE2.json │ │ ├── static_callcallcode_01_2.json │ │ ├── static_callcallcode_01_OOGE_2.json │ │ ├── static_callcallcode_01_SuicideEnd.json │ │ ├── static_callcallcode_01_SuicideEnd2.json │ │ ├── static_callcallcodecall_010.json │ │ ├── static_callcallcodecall_010_2.json │ │ ├── static_callcallcodecall_010_OOGE.json │ │ ├── static_callcallcodecall_010_OOGE_2.json │ │ ├── static_callcallcodecall_010_OOGMAfter.json │ │ ├── static_callcallcodecall_010_OOGMAfter2.json │ │ ├── static_callcallcodecall_010_OOGMAfter_2.json │ │ ├── static_callcallcodecall_010_OOGMAfter_3.json │ │ ├── static_callcallcodecall_010_OOGMBefore.json │ │ ├── static_callcallcodecall_010_OOGMBefore2.json │ │ ├── static_callcallcodecall_010_SuicideEnd.json │ │ ├── static_callcallcodecall_010_SuicideEnd2.json │ │ ├── static_callcallcodecall_010_SuicideMiddle.json │ │ ├── static_callcallcodecall_010_SuicideMiddle2.json │ │ ├── static_callcallcodecall_ABCB_RECURSIVE.json │ │ ├── static_callcallcodecall_ABCB_RECURSIVE2.json │ │ ├── static_callcallcodecallcode_011.json │ │ ├── static_callcallcodecallcode_011_2.json │ │ ├── static_callcallcodecallcode_011_OOGE.json │ │ ├── static_callcallcodecallcode_011_OOGE_2.json │ │ ├── static_callcallcodecallcode_011_OOGMAfter.json │ │ ├── static_callcallcodecallcode_011_OOGMAfter2.json │ │ ├── static_callcallcodecallcode_011_OOGMAfter_1.json │ │ ├── static_callcallcodecallcode_011_OOGMAfter_2.json │ │ ├── static_callcallcodecallcode_011_OOGMBefore.json │ │ ├── static_callcallcodecallcode_011_OOGMBefore2.json │ │ ├── static_callcallcodecallcode_011_SuicideEnd.json │ │ ├── static_callcallcodecallcode_011_SuicideEnd2.json │ │ ├── static_callcallcodecallcode_011_SuicideMiddle.json │ │ ├── static_callcallcodecallcode_011_SuicideMiddle2.json │ │ ├── static_callcallcodecallcode_ABCB_RECURSIVE.json │ │ ├── static_callcallcodecallcode_ABCB_RECURSIVE2.json │ │ ├── static_callcode_checkPC.json │ │ ├── static_callcodecall_10.json │ │ ├── static_callcodecall_10_2.json │ │ ├── static_callcodecall_10_OOGE.json │ │ ├── static_callcodecall_10_OOGE_2.json │ │ ├── static_callcodecall_10_SuicideEnd.json │ │ ├── static_callcodecall_10_SuicideEnd2.json │ │ ├── static_callcodecallcall_100.json │ │ ├── static_callcodecallcall_100_2.json │ │ ├── static_callcodecallcall_100_OOGE.json │ │ ├── static_callcodecallcall_100_OOGE2.json │ │ ├── static_callcodecallcall_100_OOGMAfter.json │ │ ├── static_callcodecallcall_100_OOGMAfter2.json │ │ ├── static_callcodecallcall_100_OOGMAfter_2.json │ │ ├── static_callcodecallcall_100_OOGMAfter_3.json │ │ ├── static_callcodecallcall_100_OOGMBefore.json │ │ ├── static_callcodecallcall_100_OOGMBefore2.json │ │ ├── static_callcodecallcall_100_SuicideEnd.json │ │ ├── static_callcodecallcall_100_SuicideEnd2.json │ │ ├── static_callcodecallcall_100_SuicideMiddle.json │ │ ├── static_callcodecallcall_100_SuicideMiddle2.json │ │ ├── static_callcodecallcall_ABCB_RECURSIVE.json │ │ ├── static_callcodecallcall_ABCB_RECURSIVE2.json │ │ ├── static_callcodecallcallcode_101.json │ │ ├── static_callcodecallcallcode_101_2.json │ │ ├── static_callcodecallcallcode_101_OOGE.json │ │ ├── static_callcodecallcallcode_101_OOGE_2.json │ │ ├── static_callcodecallcallcode_101_OOGMAfter.json │ │ ├── static_callcodecallcallcode_101_OOGMAfter2.json │ │ ├── static_callcodecallcallcode_101_OOGMAfter_1.json │ │ ├── static_callcodecallcallcode_101_OOGMAfter_3.json │ │ ├── static_callcodecallcallcode_101_OOGMBefore.json │ │ ├── static_callcodecallcallcode_101_OOGMBefore2.json │ │ ├── static_callcodecallcallcode_101_SuicideEnd.json │ │ ├── static_callcodecallcallcode_101_SuicideEnd2.json │ │ ├── static_callcodecallcallcode_101_SuicideMiddle.json │ │ ├── static_callcodecallcallcode_101_SuicideMiddle2.json │ │ ├── static_callcodecallcallcode_ABCB_RECURSIVE.json │ │ ├── static_callcodecallcallcode_ABCB_RECURSIVE2.json │ │ ├── static_callcodecallcodecall_110.json │ │ ├── static_callcodecallcodecall_1102.json │ │ ├── static_callcodecallcodecall_110_2.json │ │ ├── static_callcodecallcodecall_110_OOGE.json │ │ ├── static_callcodecallcodecall_110_OOGE2.json │ │ ├── static_callcodecallcodecall_110_OOGMAfter.json │ │ ├── static_callcodecallcodecall_110_OOGMAfter2.json │ │ ├── static_callcodecallcodecall_110_OOGMAfter_2.json │ │ ├── static_callcodecallcodecall_110_OOGMAfter_3.json │ │ ├── static_callcodecallcodecall_110_OOGMBefore.json │ │ ├── static_callcodecallcodecall_110_OOGMBefore2.json │ │ ├── static_callcodecallcodecall_110_SuicideEnd.json │ │ ├── static_callcodecallcodecall_110_SuicideEnd2.json │ │ ├── static_callcodecallcodecall_110_SuicideMiddle.json │ │ ├── static_callcodecallcodecall_110_SuicideMiddle2.json │ │ ├── static_callcodecallcodecall_ABCB_RECURSIVE.json │ │ ├── static_callcodecallcodecall_ABCB_RECURSIVE2.json │ │ ├── static_callcodecallcodecallcode_111_SuicideEnd.json │ │ ├── static_calldelcode_01.json │ │ ├── static_calldelcode_01_OOGE.json │ │ ├── static_contractCreationMakeCallThatAskMoreGasThenTransactionProvided.json │ │ ├── static_contractCreationOOGdontLeaveEmptyContractViaTransaction.json │ │ ├── static_log0_emptyMem.json │ │ ├── static_log0_logMemStartTooHigh.json │ │ ├── static_log0_logMemsizeTooHigh.json │ │ ├── static_log0_logMemsizeZero.json │ │ ├── static_log0_nonEmptyMem.json │ │ ├── static_log0_nonEmptyMem_logMemSize1.json │ │ ├── static_log0_nonEmptyMem_logMemSize1_logMemStart31.json │ │ ├── static_log1_MaxTopic.json │ │ ├── static_log1_emptyMem.json │ │ ├── static_log1_logMemStartTooHigh.json │ │ ├── static_log1_logMemsizeTooHigh.json │ │ ├── static_log1_logMemsizeZero.json │ │ ├── static_log_Caller.json │ │ ├── static_makeMoney.json │ │ ├── static_refund_CallA.json │ │ ├── static_refund_CallToSuicideNoStorage.json │ │ └── static_refund_CallToSuicideTwice.json │ ├── stSystemOperationsTest │ │ ├── ABAcalls0.json │ │ ├── ABAcalls1.json │ │ ├── ABAcalls2.json │ │ ├── ABAcalls3.json │ │ ├── ABAcallsSuicide0.json │ │ ├── ABAcallsSuicide1.json │ │ ├── Call10.json │ │ ├── CallRecursiveBomb0.json │ │ ├── CallRecursiveBomb0_OOG_atMaxCallDepth.json │ │ ├── CallRecursiveBomb1.json │ │ ├── CallRecursiveBomb2.json │ │ ├── CallRecursiveBomb3.json │ │ ├── CallRecursiveBombLog.json │ │ ├── CallRecursiveBombLog2.json │ │ ├── CallToNameRegistrator0.json │ │ ├── CallToNameRegistratorAddressTooBigLeft.json │ │ ├── CallToNameRegistratorAddressTooBigRight.json │ │ ├── CallToNameRegistratorMemOOGAndInsufficientBalance.json │ │ ├── CallToNameRegistratorNotMuchMemory0.json │ │ ├── CallToNameRegistratorNotMuchMemory1.json │ │ ├── CallToNameRegistratorOutOfGas.json │ │ ├── CallToNameRegistratorTooMuchMemory0.json │ │ ├── CallToNameRegistratorTooMuchMemory1.json │ │ ├── CallToNameRegistratorTooMuchMemory2.json │ │ ├── CallToNameRegistratorZeorSizeMemExpansion.json │ │ ├── CallToReturn1.json │ │ ├── CallToReturn1ForDynamicJump0.json │ │ ├── CallToReturn1ForDynamicJump1.json │ │ ├── CalltoReturn2.json │ │ ├── CreateHashCollision.json │ │ ├── PostToReturn1.json │ │ ├── TestNameRegistrator.json │ │ ├── balanceInputAddressTooBig.json │ │ ├── callValue.json │ │ ├── callcodeTo0.json │ │ ├── callcodeToNameRegistrator0.json │ │ ├── callcodeToNameRegistratorAddresTooBigLeft.json │ │ ├── callcodeToNameRegistratorAddresTooBigRight.json │ │ ├── callcodeToNameRegistratorZeroMemExpanion.json │ │ ├── callcodeToReturn1.json │ │ ├── callerAccountBalance.json │ │ ├── createNameRegistrator.json │ │ ├── createNameRegistratorOOG_MemExpansionOOV.json │ │ ├── createNameRegistratorOutOfMemoryBonds0.json │ │ ├── createNameRegistratorOutOfMemoryBonds1.json │ │ ├── createNameRegistratorValueTooHigh.json │ │ ├── createNameRegistratorZeroMem.json │ │ ├── createNameRegistratorZeroMem2.json │ │ ├── createNameRegistratorZeroMemExpansion.json │ │ ├── createWithInvalidOpcode.json │ │ ├── currentAccountBalance.json │ │ ├── doubleSelfdestructTest.json │ │ ├── doubleSelfdestructTest2.json │ │ ├── extcodecopy.json │ │ ├── return0.json │ │ ├── return1.json │ │ ├── return2.json │ │ ├── suicideAddress.json │ │ ├── suicideCaller.json │ │ ├── suicideCallerAddresTooBigLeft.json │ │ ├── suicideCallerAddresTooBigRight.json │ │ ├── suicideCoinbase.json │ │ ├── suicideNotExistingAccount.json │ │ ├── suicideOrigin.json │ │ ├── suicideSendEtherPostDeath.json │ │ ├── suicideSendEtherToMe.json │ │ └── testRandomTest.json │ ├── stTransactionTest │ │ ├── ContractStoreClearsOOG.json │ │ ├── ContractStoreClearsSuccess.json │ │ ├── CreateMessageReverted.json │ │ ├── CreateMessageSuccess.json │ │ ├── CreateTransactionReverted.json │ │ ├── CreateTransactionSuccess.json │ │ ├── EmptyTransaction.json │ │ ├── EmptyTransaction2.json │ │ ├── EmptyTransaction3.json │ │ ├── HighGasLimit.json │ │ ├── InternalCallHittingGasLimit.json │ │ ├── InternalCallHittingGasLimit2.json │ │ ├── InternalCallHittingGasLimitSuccess.json │ │ ├── InternlCallStoreClearsOOG.json │ │ ├── InternlCallStoreClearsSucces.json │ │ ├── Opcodes_TransactionInit.json │ │ ├── OverflowGasRequire.json │ │ ├── OverflowGasRequire2.json │ │ ├── RefundOverflow.json │ │ ├── RefundOverflow2.json │ │ ├── StoreClearsAndInternlCallStoreClearsOOG.json │ │ ├── StoreClearsAndInternlCallStoreClearsSuccess.json │ │ ├── StoreGasOnCreate.json │ │ ├── SuicidesAndInternlCallSuicidesBonusGasAtCall.json │ │ ├── SuicidesAndInternlCallSuicidesBonusGasAtCallFailed.json │ │ ├── SuicidesAndInternlCallSuicidesOOG.json │ │ ├── SuicidesAndInternlCallSuicidesSuccess.json │ │ ├── SuicidesAndSendMoneyToItselfEtherDestroyed.json │ │ ├── SuicidesMixingCoinbase.json │ │ ├── SuicidesStopAfterSuicide.json │ │ ├── TransactionDataCosts652.json │ │ ├── TransactionFromCoinbaseHittingBlockGasLimit.json │ │ ├── TransactionFromCoinbaseHittingBlockGasLimit1.json │ │ ├── TransactionFromCoinbaseNotEnoughFounds.json │ │ ├── TransactionNonceCheck.json │ │ ├── TransactionNonceCheck2.json │ │ ├── TransactionSendingToEmpty.json │ │ ├── TransactionSendingToZero.json │ │ ├── TransactionToAddressh160minusOne.json │ │ ├── TransactionToItself.json │ │ ├── TransactionToItselfNotEnoughFounds.json │ │ ├── UserTransactionGasLimitIsTooLowWhenZeroCost.json │ │ ├── UserTransactionZeroCost.json │ │ └── UserTransactionZeroCostWithData.json │ ├── stTransitionTest │ │ ├── createNameRegistratorPerTxsAfter.json │ │ ├── createNameRegistratorPerTxsAt.json │ │ ├── createNameRegistratorPerTxsBefore.json │ │ ├── createNameRegistratorPerTxsNotEnoughGasAfter.json │ │ ├── createNameRegistratorPerTxsNotEnoughGasAt.json │ │ ├── createNameRegistratorPerTxsNotEnoughGasBefore.json │ │ ├── delegatecallAfterTransition.json │ │ ├── delegatecallAtTransition.json │ │ └── delegatecallBeforeTransition.json │ ├── stWalletTest │ │ ├── dayLimitConstruction.json │ │ ├── dayLimitConstructionOOG.json │ │ ├── dayLimitConstructionPartial.json │ │ ├── dayLimitResetSpentToday.json │ │ ├── dayLimitSetDailyLimit.json │ │ ├── dayLimitSetDailyLimitNoData.json │ │ ├── multiOwnedAddOwner.json │ │ ├── multiOwnedAddOwnerAddMyself.json │ │ ├── multiOwnedChangeOwner.json │ │ ├── multiOwnedChangeOwnerNoArgument.json │ │ ├── multiOwnedChangeOwner_fromNotOwner.json │ │ ├── multiOwnedChangeOwner_toIsOwner.json │ │ ├── multiOwnedChangeRequirementTo0.json │ │ ├── multiOwnedChangeRequirementTo1.json │ │ ├── multiOwnedChangeRequirementTo2.json │ │ ├── multiOwnedConstructionCorrect.json │ │ ├── multiOwnedConstructionNotEnoughGas.json │ │ ├── multiOwnedConstructionNotEnoughGasPartial.json │ │ ├── multiOwnedIsOwnerFalse.json │ │ ├── multiOwnedIsOwnerTrue.json │ │ ├── multiOwnedRemoveOwner.json │ │ ├── multiOwnedRemoveOwnerByNonOwner.json │ │ ├── multiOwnedRemoveOwner_mySelf.json │ │ ├── multiOwnedRemoveOwner_ownerIsNotOwner.json │ │ ├── multiOwnedRevokeNothing.json │ │ ├── walletAddOwnerRemovePendingTransaction.json │ │ ├── walletChangeOwnerRemovePendingTransaction.json │ │ ├── walletChangeRequirementRemovePendingTransaction.json │ │ ├── walletConfirm.json │ │ ├── walletConstruction.json │ │ ├── walletConstructionOOG.json │ │ ├── walletConstructionPartial.json │ │ ├── walletDefault.json │ │ ├── walletDefaultWithOutValue.json │ │ ├── walletExecuteOverDailyLimitMultiOwner.json │ │ ├── walletExecuteOverDailyLimitOnlyOneOwner.json │ │ ├── walletExecuteOverDailyLimitOnlyOneOwnerNew.json │ │ ├── walletExecuteUnderDailyLimit.json │ │ ├── walletKill.json │ │ ├── walletKillNotByOwner.json │ │ ├── walletKillToWallet.json │ │ └── walletRemoveOwnerRemovePendingTransaction.json │ ├── stZeroCallsRevert │ │ ├── ZeroValue_CALLCODE_OOGRevert.json │ │ ├── ZeroValue_CALLCODE_ToEmpty_OOGRevert.json │ │ ├── ZeroValue_CALLCODE_ToNonZeroBalance_OOGRevert.json │ │ ├── ZeroValue_CALLCODE_ToOneStorageKey_OOGRevert.json │ │ ├── ZeroValue_CALL_OOGRevert.json │ │ ├── ZeroValue_CALL_ToEmpty_OOGRevert.json │ │ ├── ZeroValue_CALL_ToNonZeroBalance_OOGRevert.json │ │ ├── ZeroValue_CALL_ToOneStorageKey_OOGRevert.json │ │ ├── ZeroValue_DELEGATECALL_OOGRevert.json │ │ ├── ZeroValue_DELEGATECALL_ToEmpty_OOGRevert.json │ │ ├── ZeroValue_DELEGATECALL_ToNonZeroBalance_OOGRevert.json │ │ ├── ZeroValue_DELEGATECALL_ToOneStorageKey_OOGRevert.json │ │ ├── ZeroValue_SUICIDE_OOGRevert.json │ │ ├── ZeroValue_SUICIDE_ToEmpty_OOGRevert.json │ │ ├── ZeroValue_SUICIDE_ToNonZeroBalance_OOGRevert.json │ │ ├── ZeroValue_SUICIDE_ToOneStorageKey_OOGRevert.json │ │ ├── ZeroValue_TransactionCALL_OOGRevert.json │ │ ├── ZeroValue_TransactionCALL_ToEmpty_OOGRevert.json │ │ ├── ZeroValue_TransactionCALL_ToNonZeroBalance_OOGRevert.json │ │ ├── ZeroValue_TransactionCALL_ToOneStorageKey_OOGRevert.json │ │ ├── ZeroValue_TransactionCALLwithData_OOGRevert.json │ │ ├── ZeroValue_TransactionCALLwithData_ToEmpty_OOGRevert.json │ │ ├── ZeroValue_TransactionCALLwithData_ToNonZeroBalance_OOGRevert.json │ │ └── ZeroValue_TransactionCALLwithData_ToOneStorageKey_OOGRevert.json │ ├── stZeroCallsTest │ │ ├── ZeroValue_CALL.json │ │ ├── ZeroValue_CALLCODE.json │ │ ├── ZeroValue_CALLCODE_ToEmpty.json │ │ ├── ZeroValue_CALLCODE_ToNonZeroBalance.json │ │ ├── ZeroValue_CALLCODE_ToOneStorageKey.json │ │ ├── ZeroValue_CALL_ToEmpty.json │ │ ├── ZeroValue_CALL_ToNonZeroBalance.json │ │ ├── ZeroValue_CALL_ToOneStorageKey.json │ │ ├── ZeroValue_DELEGATECALL.json │ │ ├── ZeroValue_DELEGATECALL_ToEmpty.json │ │ ├── ZeroValue_DELEGATECALL_ToNonZeroBalance.json │ │ ├── ZeroValue_DELEGATECALL_ToOneStorageKey.json │ │ ├── ZeroValue_SUICIDE.json │ │ ├── ZeroValue_SUICIDE_ToEmpty.json │ │ ├── ZeroValue_SUICIDE_ToNonZeroBalance.json │ │ ├── ZeroValue_SUICIDE_ToOneStorageKey.json │ │ ├── ZeroValue_TransactionCALL.json │ │ ├── ZeroValue_TransactionCALL_ToEmpty.json │ │ ├── ZeroValue_TransactionCALL_ToNonZeroBalance.json │ │ ├── ZeroValue_TransactionCALL_ToOneStorageKey.json │ │ ├── ZeroValue_TransactionCALLwithData.json │ │ ├── ZeroValue_TransactionCALLwithData_ToEmpty.json │ │ ├── ZeroValue_TransactionCALLwithData_ToNonZeroBalance.json │ │ └── ZeroValue_TransactionCALLwithData_ToOneStorageKey.json │ ├── stZeroKnowledge │ │ ├── ecmul_1-2_2_28000_128.json │ │ ├── ecmul_1-2_2_28000_96.json │ │ ├── ecmul_1-2_340282366920938463463374607431768211456_21000_128.json │ │ ├── ecmul_1-2_340282366920938463463374607431768211456_21000_80.json │ │ ├── ecmul_1-2_340282366920938463463374607431768211456_21000_96.json │ │ ├── ecmul_1-2_340282366920938463463374607431768211456_28000_128.json │ │ ├── ecmul_1-2_340282366920938463463374607431768211456_28000_80.json │ │ ├── ecmul_1-2_340282366920938463463374607431768211456_28000_96.json │ │ ├── ecmul_1-2_5616_21000_128.json │ │ ├── ecmul_1-2_5616_21000_96.json │ │ ├── ecmul_1-2_5616_28000_128.json │ │ ├── ecmul_1-2_5617_21000_128.json │ │ ├── ecmul_1-2_5617_21000_96.json │ │ ├── ecmul_1-2_5617_28000_128.json │ │ ├── ecmul_1-2_5617_28000_96.json │ │ ├── ecmul_1-2_616_28000_96.json │ │ ├── ecmul_1-2_9935_21000_128.json │ │ ├── ecmul_1-2_9935_21000_96.json │ │ ├── ecmul_1-2_9935_28000_128.json │ │ ├── ecmul_1-2_9935_28000_96.json │ │ ├── ecmul_1-2_9_21000_128.json │ │ ├── ecmul_1-2_9_21000_96.json │ │ ├── ecmul_1-2_9_28000_128.json │ │ ├── ecmul_1-2_9_28000_96.json │ │ ├── ecmul_1-3_0_21000_128.json │ │ ├── ecmul_1-3_0_21000_64.json │ │ ├── ecmul_1-3_0_21000_80.json │ │ ├── ecmul_1-3_0_21000_96.json │ │ ├── ecmul_1-3_0_28000_128.json │ │ ├── ecmul_1-3_0_28000_64.json │ │ ├── ecmul_1-3_0_28000_80.json │ │ ├── ecmul_1-3_0_28000_96.json │ │ ├── ecmul_1-3_1_21000_128.json │ │ ├── ecmul_1-3_1_21000_96.json │ │ ├── ecmul_1-3_1_28000_128.json │ │ ├── ecmul_1-3_1_28000_96.json │ │ ├── ecmul_1-3_2_21000_128.json │ │ ├── ecmul_1-3_2_21000_96.json │ │ ├── ecmul_1-3_2_28000_128.json │ │ ├── ecmul_1-3_2_28000_96.json │ │ ├── ecmul_1-3_340282366920938463463374607431768211456_21000_128.json │ │ ├── ecmul_1-3_340282366920938463463374607431768211456_21000_80.json │ │ ├── ecmul_1-3_340282366920938463463374607431768211456_21000_96.json │ │ ├── ecmul_1-3_340282366920938463463374607431768211456_28000_128.json │ │ ├── ecmul_1-3_340282366920938463463374607431768211456_28000_80.json │ │ ├── ecmul_1-3_340282366920938463463374607431768211456_28000_96.json │ │ ├── ecmul_1-3_5616_21000_128.json │ │ ├── ecmul_1-3_5616_21000_96.json │ │ ├── ecmul_1-3_5616_28000_128.json │ │ ├── ecmul_1-3_5616_28000_96.json │ │ ├── ecmul_1-3_5617_21000_128.json │ │ ├── ecmul_1-3_5617_21000_96.json │ │ ├── ecmul_1-3_5617_28000_128.json │ │ ├── ecmul_1-3_5617_28000_96.json │ │ ├── ecmul_1-3_9935_21000_128.json │ │ ├── ecmul_1-3_9935_21000_96.json │ │ ├── ecmul_1-3_9935_28000_128.json │ │ ├── ecmul_1-3_9935_28000_96.json │ │ ├── ecmul_1-3_9_21000_128.json │ │ ├── ecmul_1-3_9_21000_96.json │ │ ├── ecmul_1-3_9_28000_128.json │ │ ├── ecmul_1-3_9_28000_96.json │ │ ├── ecmul_7827-6598_0_21000_128.json │ │ ├── ecmul_7827-6598_0_21000_64.json │ │ ├── ecmul_7827-6598_0_21000_80.json │ │ ├── ecmul_7827-6598_0_21000_96.json │ │ ├── ecmul_7827-6598_0_28000_128.json │ │ ├── ecmul_7827-6598_0_28000_64.json │ │ ├── ecmul_7827-6598_0_28000_80.json │ │ ├── ecmul_7827-6598_0_28000_96.json │ │ ├── ecmul_7827-6598_1456_21000_128.json │ │ ├── ecmul_7827-6598_1456_21000_80.json │ │ ├── ecmul_7827-6598_1456_21000_96.json │ │ ├── ecmul_7827-6598_1456_28000_128.json │ │ ├── ecmul_7827-6598_1456_28000_80.json │ │ ├── ecmul_7827-6598_1456_28000_96.json │ │ ├── ecmul_7827-6598_1_21000_128.json │ │ ├── ecmul_7827-6598_1_21000_96.json │ │ ├── ecmul_7827-6598_1_28000_128.json │ │ ├── ecmul_7827-6598_1_28000_96.json │ │ ├── ecmul_7827-6598_2_21000_128.json │ │ ├── ecmul_7827-6598_2_21000_96.json │ │ ├── ecmul_7827-6598_2_28000_128.json │ │ ├── ecmul_7827-6598_2_28000_96.json │ │ ├── ecmul_7827-6598_5616_21000_128.json │ │ ├── ecmul_7827-6598_5616_21000_96.json │ │ ├── ecmul_7827-6598_5616_28000_128.json │ │ ├── ecmul_7827-6598_5616_28000_96.json │ │ ├── ecmul_7827-6598_5617_21000_128.json │ │ ├── ecmul_7827-6598_5617_21000_96.json │ │ ├── ecmul_7827-6598_5617_28000_128.json │ │ ├── ecmul_7827-6598_5617_28000_96.json │ │ ├── ecmul_7827-6598_9935_21000_128.json │ │ ├── ecmul_7827-6598_9935_21000_96.json │ │ ├── ecmul_7827-6598_9935_28000_128.json │ │ ├── ecmul_7827-6598_9935_28000_96.json │ │ ├── ecmul_7827-6598_9_21000_128.json │ │ ├── ecmul_7827-6598_9_21000_96.json │ │ ├── ecmul_7827-6598_9_28000_128.json │ │ ├── ecmul_7827-6598_9_28000_96.json │ │ ├── ecpairing_bad_length_191.json │ │ ├── ecpairing_bad_length_193.json │ │ ├── ecpairing_empty_data.json │ │ ├── ecpairing_empty_data_insufficient_gas.json │ │ ├── ecpairing_one_point_fail.json │ │ ├── ecpairing_one_point_insufficient_gas.json │ │ ├── ecpairing_one_point_not_in_subgroup.json │ │ ├── ecpairing_one_point_with_g1_zero.json │ │ ├── ecpairing_one_point_with_g2_zero.json │ │ ├── ecpairing_one_point_with_g2_zero_and_g1_invalid.json │ │ ├── ecpairing_perturb_g2_by_curve_order.json │ │ ├── ecpairing_perturb_g2_by_field_modulus.json │ │ ├── ecpairing_perturb_g2_by_field_modulus_again.json │ │ ├── ecpairing_perturb_g2_by_one.json │ │ ├── ecpairing_perturb_zeropoint_by_curve_order.json │ │ ├── ecpairing_perturb_zeropoint_by_field_modulus.json │ │ ├── ecpairing_perturb_zeropoint_by_one.json │ │ ├── ecpairing_three_point_fail_1.json │ │ ├── ecpairing_three_point_match_1.json │ │ ├── ecpairing_two_point_fail_1.json │ │ ├── ecpairing_two_point_fail_2.json │ │ ├── ecpairing_two_point_match_1.json │ │ ├── ecpairing_two_point_match_2.json │ │ ├── ecpairing_two_point_match_3.json │ │ ├── ecpairing_two_point_match_4.json │ │ ├── ecpairing_two_point_match_5.json │ │ ├── ecpairing_two_point_oog.json │ │ ├── ecpairing_two_points_with_one_g2_zero.json │ │ ├── pairingTest.json │ │ ├── pointAdd.json │ │ ├── pointAddTrunc.json │ │ ├── pointMulAdd.json │ │ └── pointMulAdd2.json │ └── stZeroKnowledge2 │ │ ├── ecadd_0-0_0-0_21000_0.json │ │ ├── ecadd_0-0_0-0_21000_128.json │ │ ├── ecadd_0-0_0-0_21000_192.json │ │ ├── ecadd_0-0_0-0_21000_64.json │ │ ├── ecadd_0-0_0-0_21000_80.json │ │ ├── ecadd_0-0_0-0_25000_0.json │ │ ├── ecadd_0-0_0-0_25000_128.json │ │ ├── ecadd_0-0_0-0_25000_192.json │ │ ├── ecadd_0-0_0-0_25000_64.json │ │ ├── ecadd_0-0_0-0_25000_80.json │ │ ├── ecadd_0-0_1-2_21000_128.json │ │ ├── ecadd_0-0_1-2_21000_192.json │ │ ├── ecadd_0-0_1-2_25000_128.json │ │ ├── ecadd_0-0_1-2_25000_192.json │ │ ├── ecadd_0-0_1-3_21000_128.json │ │ ├── ecadd_0-0_1-3_25000_128.json │ │ ├── ecadd_0-3_1-2_21000_128.json │ │ ├── ecadd_0-3_1-2_25000_128.json │ │ ├── ecadd_1-2_0-0_21000_128.json │ │ ├── ecadd_1-2_0-0_21000_192.json │ │ ├── ecadd_1-2_0-0_21000_64.json │ │ ├── ecadd_1-2_0-0_25000_128.json │ │ ├── ecadd_1-2_0-0_25000_192.json │ │ ├── ecadd_1-2_0-0_25000_64.json │ │ ├── ecadd_1-2_1-2_21000_128.json │ │ ├── ecadd_1-2_1-2_21000_192.json │ │ ├── ecadd_1-2_1-2_25000_128.json │ │ ├── ecadd_1-2_1-2_25000_192.json │ │ ├── ecadd_1-3_0-0_21000_80.json │ │ ├── ecadd_1-3_0-0_25000_80.json │ │ ├── ecadd_1145-3932_1145-4651_21000_192.json │ │ ├── ecadd_1145-3932_1145-4651_25000_192.json │ │ ├── ecadd_1145-3932_2969-1336_21000_128.json │ │ ├── ecadd_1145-3932_2969-1336_25000_128.json │ │ ├── ecadd_6-9_19274124-124124_21000_128.json │ │ ├── ecadd_6-9_19274124-124124_25000_128.json │ │ ├── ecmul_0-0_0_21000_0.json │ │ ├── ecmul_0-0_0_21000_128.json │ │ ├── ecmul_0-0_0_21000_40.json │ │ ├── ecmul_0-0_0_21000_64.json │ │ ├── ecmul_0-0_0_21000_80.json │ │ ├── ecmul_0-0_0_21000_96.json │ │ ├── ecmul_0-0_0_28000_0.json │ │ ├── ecmul_0-0_0_28000_128.json │ │ ├── ecmul_0-0_0_28000_40.json │ │ ├── ecmul_0-0_0_28000_64.json │ │ ├── ecmul_0-0_0_28000_80.json │ │ ├── ecmul_0-0_0_28000_96.json │ │ ├── ecmul_0-0_1_21000_128.json │ │ ├── ecmul_0-0_1_21000_96.json │ │ ├── ecmul_0-0_1_28000_128.json │ │ ├── ecmul_0-0_1_28000_96.json │ │ ├── ecmul_0-0_2_21000_128.json │ │ ├── ecmul_0-0_2_21000_96.json │ │ ├── ecmul_0-0_2_28000_128.json │ │ ├── ecmul_0-0_2_28000_96.json │ │ ├── ecmul_0-0_340282366920938463463374607431768211456_21000_128.json │ │ ├── ecmul_0-0_340282366920938463463374607431768211456_21000_80.json │ │ ├── ecmul_0-0_340282366920938463463374607431768211456_21000_96.json │ │ ├── ecmul_0-0_340282366920938463463374607431768211456_28000_128.json │ │ ├── ecmul_0-0_340282366920938463463374607431768211456_28000_80.json │ │ ├── ecmul_0-0_340282366920938463463374607431768211456_28000_96.json │ │ ├── ecmul_0-0_5616_21000_128.json │ │ ├── ecmul_0-0_5616_21000_96.json │ │ ├── ecmul_0-0_5616_28000_128.json │ │ ├── ecmul_0-0_5616_28000_96.json │ │ ├── ecmul_0-0_5617_21000_128.json │ │ ├── ecmul_0-0_5617_21000_96.json │ │ ├── ecmul_0-0_5617_28000_128.json │ │ ├── ecmul_0-0_5617_28000_96.json │ │ ├── ecmul_0-0_9935_21000_128.json │ │ ├── ecmul_0-0_9935_21000_96.json │ │ ├── ecmul_0-0_9935_28000_128.json │ │ ├── ecmul_0-0_9935_28000_96.json │ │ ├── ecmul_0-0_9_21000_128.json │ │ ├── ecmul_0-0_9_21000_96.json │ │ ├── ecmul_0-0_9_28000_128.json │ │ ├── ecmul_0-0_9_28000_96.json │ │ ├── ecmul_0-3_0_21000_128.json │ │ ├── ecmul_0-3_0_21000_64.json │ │ ├── ecmul_0-3_0_21000_80.json │ │ ├── ecmul_0-3_0_21000_96.json │ │ ├── ecmul_0-3_0_28000_128.json │ │ ├── ecmul_0-3_0_28000_64.json │ │ ├── ecmul_0-3_0_28000_80.json │ │ ├── ecmul_0-3_0_28000_96.json │ │ ├── ecmul_0-3_1_21000_128.json │ │ ├── ecmul_0-3_1_21000_96.json │ │ ├── ecmul_0-3_1_28000_128.json │ │ ├── ecmul_0-3_1_28000_96.json │ │ ├── ecmul_0-3_2_21000_128.json │ │ ├── ecmul_0-3_2_21000_96.json │ │ ├── ecmul_0-3_2_28000_128.json │ │ ├── ecmul_0-3_2_28000_96.json │ │ ├── ecmul_0-3_340282366920938463463374607431768211456_21000_128.json │ │ ├── ecmul_0-3_340282366920938463463374607431768211456_21000_80.json │ │ ├── ecmul_0-3_340282366920938463463374607431768211456_21000_96.json │ │ ├── ecmul_0-3_340282366920938463463374607431768211456_28000_128.json │ │ ├── ecmul_0-3_340282366920938463463374607431768211456_28000_80.json │ │ ├── ecmul_0-3_340282366920938463463374607431768211456_28000_96.json │ │ ├── ecmul_0-3_5616_21000_128.json │ │ ├── ecmul_0-3_5616_21000_96.json │ │ ├── ecmul_0-3_5616_28000_128.json │ │ ├── ecmul_0-3_5616_28000_96.json │ │ ├── ecmul_0-3_5617_21000_128.json │ │ ├── ecmul_0-3_5617_21000_96.json │ │ ├── ecmul_0-3_5617_28000_128.json │ │ ├── ecmul_0-3_5617_28000_96.json │ │ ├── ecmul_0-3_9935_21000_128.json │ │ ├── ecmul_0-3_9935_21000_96.json │ │ ├── ecmul_0-3_9935_28000_128.json │ │ ├── ecmul_0-3_9935_28000_96.json │ │ ├── ecmul_0-3_9_21000_128.json │ │ ├── ecmul_0-3_9_21000_96.json │ │ ├── ecmul_0-3_9_28000_128.json │ │ ├── ecmul_0-3_9_28000_96.json │ │ ├── ecmul_1-2_0_21000_128.json │ │ ├── ecmul_1-2_0_21000_64.json │ │ ├── ecmul_1-2_0_21000_80.json │ │ ├── ecmul_1-2_0_21000_96.json │ │ ├── ecmul_1-2_0_28000_128.json │ │ ├── ecmul_1-2_0_28000_64.json │ │ ├── ecmul_1-2_0_28000_80.json │ │ ├── ecmul_1-2_0_28000_96.json │ │ ├── ecmul_1-2_1_21000_128.json │ │ ├── ecmul_1-2_1_21000_96.json │ │ ├── ecmul_1-2_1_28000_128.json │ │ ├── ecmul_1-2_1_28000_96.json │ │ ├── ecmul_1-2_2_21000_128.json │ │ └── ecmul_1-2_2_21000_96.json ├── QuarkChainStateTests │ ├── stContractCallMnt │ │ ├── CheckContractCreationInsideContract.json │ │ ├── CheckQueryTokenId.json │ │ ├── CheckQueryTokenIdDelegateCall.json │ │ ├── CheckQueryTokenIdTransfer.json │ │ ├── contractTransferMntFallback.json │ │ ├── contractTransferMntNotEnoughBalance.json │ │ ├── contractTransferMntQKCOnly.json │ │ ├── contractTransferMntWithData.json │ │ └── currentMntId.json │ ├── stCreateWithShardId │ │ └── delegateCallCreate.json │ ├── stDeployRootChainPoSW │ │ └── deployPoSW.json │ ├── stMintMnt │ │ └── contractMintNewToken.json │ └── stTransferTokenId │ │ └── normalTx.json └── TrieTests │ ├── hex_encoded_securetrie_test.json │ ├── test_case_0 │ ├── test_case_1 │ ├── test_case_2 │ ├── test_case_3 │ ├── test_case_4 │ ├── test_case_5 │ ├── trieanyorder.json │ ├── trieanyorder_secureTrie.json │ ├── trietest.json │ ├── trietest_secureTrie.json │ └── trietestnextprev.json ├── mainnet └── singularity │ ├── Dockerfile │ ├── cluster_config_bootnodes.json │ ├── cluster_config_template.json │ └── cluster_config_template_8nodes.json ├── papers ├── boson.pdf ├── posw.pdf ├── smooth_swap_protocol.pdf └── universal_v3_staking.pdf ├── qkchash ├── Makefile ├── README.md ├── qkchash.cpp ├── qkchash.pdf ├── qkchash.py ├── qkchash_llrb.cpp ├── qkchash_llrb.h ├── qkcpow.py ├── set_benchmark.cpp ├── tests │ └── test_qkcpow.py └── util.h ├── quarkchain ├── __init__.py ├── accounts.py ├── cluster │ ├── __init__.py │ ├── cluster.py │ ├── cluster_config.py │ ├── guardian.py │ ├── jsonrpc.py │ ├── log_filter.py │ ├── master.py │ ├── miner.py │ ├── monitoring.py │ ├── neighbor.py │ ├── p2p_commands.py │ ├── posw.py │ ├── prom.py │ ├── protocol.py │ ├── root_state.py │ ├── rpc.py │ ├── shard.py │ ├── shard_db_operator.py │ ├── shard_state.py │ ├── simple_network.py │ ├── slave.py │ ├── subscription.py │ ├── tests │ │ ├── __init__.py │ │ ├── test_cluster.py │ │ ├── test_cluster_config.py │ │ ├── test_filter.py │ │ ├── test_jsonrpc.py │ │ ├── test_miner.py │ │ ├── test_monitoring.py │ │ ├── test_native_token.py │ │ ├── test_neighbor.py │ │ ├── test_protocol.py │ │ ├── test_root_state.py │ │ ├── test_shard_db_operator.py │ │ ├── test_shard_state.py │ │ └── test_utils.py │ ├── tool_multi_cluster.py │ ├── tool_multi_cluster_fd_test.py │ └── tx_generator.py ├── config.py ├── constants.py ├── core.py ├── db.py ├── diff.py ├── env.py ├── evm │ ├── __init__.py │ ├── bloom.py │ ├── common.py │ ├── config.py │ ├── exceptions.py │ ├── fast_rlp.py │ ├── messages.py │ ├── opcodes.py │ ├── securetrie.py │ ├── slogging.py │ ├── solidity_abi_utils.py │ ├── specials.py │ ├── state.py │ ├── tests │ │ ├── __init__.py │ │ ├── conftest.py │ │ ├── gen_trie_tests.go │ │ ├── generate_test_cases.sh │ │ ├── new_statetest_utils.py │ │ ├── test_solidity_abi.py │ │ ├── test_specials.py │ │ ├── test_state.py │ │ ├── test_token_balances.py │ │ ├── test_transaction_queue.py │ │ ├── test_trie.py │ │ ├── test_trie_with_local_data.py │ │ └── testutils.py │ ├── transaction_queue.py │ ├── transactions.py │ ├── trie.py │ ├── utils.py │ └── vm.py ├── experimental │ ├── __init__.py │ ├── accumulator.py │ ├── async_cancel.py │ ├── bft_sm.py │ ├── diff.py │ ├── dual_pow_sim_with_order_stats.py │ ├── dual_pow_simulator.py │ ├── elliptic.py │ ├── ethash.py │ ├── event_driven_simulator.py │ ├── future.py │ ├── heap.py │ ├── latency_demo.py │ ├── pbft.py │ ├── photon_pos_simulator.py │ ├── proof_of_staked_work.py │ ├── proof_of_work.py │ ├── quark_eb_simulator.py │ ├── raft.py │ ├── random_sampling_simulator.py │ ├── sha2.py │ ├── sha3_perf.py │ ├── simulator.py │ ├── test_heap.py │ ├── tests │ │ ├── __init__.py │ │ └── test_diff.py │ ├── token_emission.py │ ├── tx_perf.py │ ├── uniswap.py │ └── whitelist.py ├── genesis.py ├── genesis_data │ ├── alloc │ │ ├── 0.json │ │ ├── 1.json │ │ └── 2.json │ └── loadtest.json ├── p2p │ ├── DEVELOPMENT.md │ ├── auth.py │ ├── cancel_token │ │ ├── README.md │ │ ├── exceptions.py │ │ ├── tests │ │ │ └── test_cancel_token.py │ │ └── token.py │ ├── cancellable.py │ ├── constants.py │ ├── discovery.py │ ├── ecies.py │ ├── events.py │ ├── exceptions.py │ ├── kademlia.py │ ├── nat.py │ ├── p2p_manager.py │ ├── p2p_proto.py │ ├── p2p_server.py │ ├── peer.py │ ├── poc │ │ ├── paragon_node.py │ │ ├── paragon_node_network.py │ │ ├── trinity_disc_network.py │ │ ├── trinity_discovery.py │ │ └── udp_nat.py │ ├── protocol.py │ ├── service.py │ ├── tests │ │ ├── __init__.py │ │ ├── auth_constants.py │ │ ├── test_auth.py │ │ ├── test_discovery.py │ │ ├── test_ecies.py │ │ ├── test_kademlia.py │ │ ├── test_peer_collect_sub_proto_msgs.py │ │ ├── test_peer_subscriber.py │ │ ├── test_server.py │ │ └── test_service.py │ ├── tools │ │ ├── __init__.py │ │ └── paragon │ │ │ ├── __init__.py │ │ │ ├── commands.py │ │ │ ├── helpers.py │ │ │ ├── peer.py │ │ │ └── proto.py │ └── utils.py ├── protocol.py ├── reward.py ├── rlp │ └── utils.py ├── testnet │ ├── __init__.py │ └── addresses_to_fund.json ├── tests │ ├── __init__.py │ ├── test_accounts.py │ ├── test_config.py │ ├── test_core.py │ └── test_utils.py ├── tools │ ├── __init__.py │ ├── accounts │ ├── adjust_difficulty.py │ ├── archivesnapshot.sh │ ├── balance_by_height.py │ ├── balance_watcher.py │ ├── batch_deploy_contract.py │ ├── block_owners.py │ ├── bootnode_health_check.py │ ├── check_syncing_state.py │ ├── client_version_poll.py │ ├── config_p2p.py │ ├── config_slave.py │ ├── count_total_balance.py │ ├── db_browser.py │ ├── erc20_balance_watcher.py │ ├── external_miner.py │ ├── external_miner_manager.sh │ ├── fund_testnet.py │ ├── miner_address.py │ ├── monitoring.py │ ├── newkey.py │ ├── pypy-fix-cython-warning.pth │ ├── query_balance.py │ ├── quick_miner_stopper.sh │ ├── quick_miner_tool.sh │ ├── reorg_detector.py │ ├── stats │ ├── tests │ │ └── test_monitoring.py │ ├── token_id.py │ └── utils.py └── utils.py ├── requirements.txt ├── resources └── dapp │ ├── step1.png │ ├── step2.png │ ├── step3.png │ ├── step4.png │ ├── step5.png │ ├── step6.png │ ├── step7.png │ └── step8.png ├── run_cluster.sh ├── setup.py └── testnet ├── 2 ├── cluster_config_bootnodes.json └── cluster_config_template.json ├── 2.4 ├── cluster_config_bootnodes.json └── cluster_config_template.json ├── 2.5 ├── cluster_config_bootnodes.json └── cluster_config_template.json ├── 2.6 ├── cluster_config_bootnodes.json └── cluster_config_template.json ├── 3.0 ├── cluster_config_bootnodes.json └── cluster_config_template.json ├── 3.1 ├── cluster_config_bootnodes.json └── cluster_config_template.json ├── 3.2 └── cluster_config_template.json ├── 3.3 └── cluster_config_template.json └── ci-qkcli ├── cluster_config.json └── constants.py.bac /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | name: commit-build-test 2 | 3 | on: [push] 4 | 5 | env: 6 | PYTHONPATH: ${{ github.workspace }} 7 | 8 | jobs: 9 | test-without-integration: 10 | runs-on: ubuntu-latest 11 | container: quarkchaindocker/pyquarkchain:mainnet1.1.1 12 | 13 | steps: 14 | - uses: actions/checkout@v4 15 | - name: Install Project Dependencies 16 | run: PYTHONPATH=/code/pyquarkchain pip3 install -e . 17 | 18 | - name: Run py.test tests excluding integration test 19 | run: | 20 | cd qkchash && make clean && make && cd - 21 | python3 -m pytest --ignore quarkchain/cluster/tests/test_cluster.py 22 | 23 | evm-tests-runner-1: 24 | runs-on: ubuntu-latest 25 | container: quarkchaindocker/pyquarkchain:mainnet1.1.1 26 | 27 | steps: 28 | - uses: actions/checkout@v4 29 | - name: Install Project Dependencies 30 | run: PYTHONPATH=/code/pyquarkchain pip3 install -e . 31 | 32 | - name: Run EVM tests - runner 1 33 | run: | 34 | find fixtures/GeneralStateTests -name "*.json" | sort | sed -n 'n;p' | xargs cp --parents -t /tmp/ && python3 quarkchain/evm/tests/test_state.py /tmp/fixtures/GeneralStateTests > /dev/null; 35 | 36 | evm-tests-runner-2: 37 | runs-on: ubuntu-latest 38 | container: quarkchaindocker/pyquarkchain:mainnet1.1.1 39 | 40 | steps: 41 | - uses: actions/checkout@v4 42 | - name: Install Project Dependencies 43 | run: PYTHONPATH=/code/pyquarkchain pip3 install -e . 44 | 45 | - name: Run EVM tests - runner 2 46 | run: | 47 | find fixtures/GeneralStateTests -name "*.json" | sort | sed -n 'p;n' | xargs cp --parents -t /tmp/ && python3 quarkchain/evm/tests/test_state.py /tmp/fixtures/GeneralStateTests > /dev/null; 48 | 49 | test-integration-and-qkc-specific-state: 50 | runs-on: ubuntu-latest 51 | container: quarkchaindocker/pyquarkchain:mainnet1.1.1 52 | 53 | steps: 54 | - uses: actions/checkout@v4 55 | - name: Install Project Dependencies 56 | run: PYTHONPATH=/code/pyquarkchain pip3 install -e . 57 | 58 | - name: Run py.test tests only on integration test 59 | run: | 60 | cd qkchash && make clean && make && cd - 61 | python3 -m pytest quarkchain/cluster/tests/test_cluster.py 62 | 63 | - name: Run QuarkChain-specific EVM tests 64 | run: | 65 | python3 quarkchain/evm/tests/test_state.py fixtures/QuarkChainStateTests/ 66 | -------------------------------------------------------------------------------- /.github/workflows/nightly-check-db.yml: -------------------------------------------------------------------------------- 1 | name: nightly-check-db 2 | 3 | on: 4 | schedule: 5 | - cron: '1 8 */2 * *' 6 | 7 | env: 8 | PYTHONPATH: ${{ github.workspace }} 9 | 10 | jobs: 11 | download-snapshot-and-checkdb: 12 | runs-on: self-hosted 13 | container: quarkchaindocker/pyquarkchain:mainnet1.6.1 14 | timeout-minutes: 4320 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | with: 19 | ref: master 20 | 21 | - name: Install Dependencies and Build 22 | run: | 23 | apt update && apt upgrade -y && apt install sshpass 24 | PYTHONPATH=/code/pyquarkchain pip3 install -e . 25 | cd qkchash && make clean && make 26 | 27 | - name: Download DB snapshot 28 | run: | 29 | mkdir -p quarkchain/cluster/qkc-data 30 | sshpass -p ${{ secrets.SBOX_SA_PASSWORD }} scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null u446960-sub2@u446960-sub2.your-storagebox.de:VERSION VERSION 31 | fileName=`cat VERSION` 32 | sshpass -p ${{ secrets.SBOX_SA_PASSWORD }} scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null u446960-sub2@u446960-sub2.your-storagebox.de:$fileName data.tar.gz 33 | tar xvfz data.tar.gz 34 | rm data.tar.gz && mv data quarkchain/cluster/qkc-data/mainnet 35 | 36 | - name: Check DB 37 | run: | 38 | height=$(python quarkchain/tools/db_browser.py --cluster_config=`pwd`/mainnet/singularity/cluster_config_template.json root_print_tip 2> /dev/null | grep "height" | awk "{print \$2}" | sed "s/,$//") 39 | day_of_week=`date +%u` 40 | end=$(( day_of_week == 7 ? 0 : height - 100000 )) # run whole dataset on Sunday 41 | echo "Checking: $height -> $end" 42 | QKC__QUARKCHAIN__DISABLE_POW_CHECK=True ./run_cluster.sh \ 43 | --check_db=True \ 44 | --check_db_rblock_batch=100 \ 45 | --check_db_rblock_from=$height \ 46 | --check_db_rblock_to=$end \ 47 | --cluster_config `pwd`/mainnet/singularity/cluster_config_template_8nodes.json 48 | -------------------------------------------------------------------------------- /.github/workflows/qkcli-test.yml: -------------------------------------------------------------------------------- 1 | name: qkcli-integration-test 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | mnt-test-using-qkcli: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | with: 14 | # In the future, add it as a submodule 15 | repository: QuarkChain/qkcli 16 | ref: master 17 | token: ${{ secrets.GH_TOKEN }} 18 | path: qkcli 19 | - uses: actions/setup-go@v5 20 | with: 21 | go-version: "~1.14.4" 22 | - run: go version 23 | - run: cd qkcli && go build && go install && cd tester && bash parallel_executor.sh 24 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Database dirs 2 | *.db 3 | 4 | # Byte-compiled / optimized / DLL files 5 | __pycache__/ 6 | *.py[cod] 7 | *$py.class 8 | 9 | # C extensions 10 | *.so 11 | 12 | # qkchash binaries 13 | qkchash/qkchash 14 | qkchash/qkchash_llrb 15 | 16 | # Distribution / packaging 17 | .Python 18 | build/ 19 | develop-eggs/ 20 | dist/ 21 | downloads/ 22 | eggs/ 23 | .eggs/ 24 | lib/ 25 | lib64/ 26 | parts/ 27 | sdist/ 28 | var/ 29 | wheels/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | MANIFEST 34 | 35 | # PyInstaller 36 | # Usually these files are written by a python script from a template 37 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 38 | *.manifest 39 | *.spec 40 | 41 | # Installer logs 42 | pip-log.txt 43 | pip-delete-this-directory.txt 44 | 45 | # Unit test / coverage reports 46 | htmlcov/ 47 | .tox/ 48 | .coverage 49 | .coverage.* 50 | .cache 51 | nosetests.xml 52 | coverage.xml 53 | *.cover 54 | .hypothesis/ 55 | .pytest_cache/ 56 | 57 | # Translations 58 | *.mo 59 | *.pot 60 | 61 | # Django stuff 62 | *.log 63 | .static_storage/ 64 | .media/ 65 | local_settings.py 66 | 67 | # Flask stuff 68 | instance/ 69 | .webassets-cache 70 | 71 | # Scrapy stuff 72 | .scrapy 73 | 74 | # Sphinx documentation 75 | docs/_build/ 76 | 77 | # PyBuilder 78 | target/ 79 | 80 | # Jupyter Notebook 81 | .ipynb_checkpoints 82 | 83 | # pyenv 84 | .python-version 85 | 86 | # celery beat schedule file 87 | celerybeat-schedule 88 | 89 | # SageMath parsed files 90 | *.sage.py 91 | 92 | # Environments 93 | .env 94 | .venv 95 | env/ 96 | venv/ 97 | pypy-env/ 98 | py3-env/ 99 | ENV/ 100 | env.bak/ 101 | venv.bak/ 102 | 103 | # Spyder project settings 104 | .spyderproject 105 | .spyproject 106 | 107 | # Rope project settings 108 | .ropeproject 109 | 110 | # mkdocs documentation 111 | /site 112 | 113 | # mypy 114 | .mypy_cache/ 115 | 116 | *~ 117 | 118 | # IDE 119 | .idea/ 120 | .vscode/ 121 | 122 | # IPython notebook 123 | *.ipynb 124 | 125 | # Local config 126 | /cluster-config.json 127 | 128 | # macOS 129 | .DS_Store 130 | 131 | # python pickle 132 | *.pickle 133 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: git://github.com/pre-commit/pre-commit-hooks 3 | rev: v1.4.0 4 | hooks: 5 | - id: end-of-file-fixer 6 | - repo: https://github.com/ambv/black 7 | rev: stable 8 | hooks: 9 | - id: black 10 | language_version: python3.7 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 QuarkChain 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /STYLE: -------------------------------------------------------------------------------- 1 | Coding Style for pyquarkchain Project 2 | 3 | ============= 4 | General Rules 5 | 6 | Follow PEP8 https://www.python.org/dev/peps/pep-0008/ 7 | For sublime, we suggest to use Anaconda package. 8 | 9 | ====== 10 | Naming 11 | 12 | - Package name: lower_case_with_underscore 13 | - Class name: UpperCamelCase 14 | - Method name: lower_case_with_underscore 15 | - Constant: UPPER_CASE_WITH_UNDERSCORE 16 | - Global function: lower_case_with_underscore 17 | - Local variable: lower_case_with_underscore 18 | 19 | ============== 20 | Code Formatter 21 | 22 | All py files should be formatted using the Black code formatter. 23 | https://github.com/ambv/black 24 | -------------------------------------------------------------------------------- /change_coinbase.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | QKC_CONFIG=`pwd`/mainnet/singularity/cluster_config_template.json ${PYTHON:=python3} quarkchain/tools/miner_address.py "$@" 4 | -------------------------------------------------------------------------------- /ethereum/pow/ethash.py: -------------------------------------------------------------------------------- 1 | import copy 2 | from functools import lru_cache 3 | from typing import Callable, Dict, List 4 | 5 | from ethereum.pow.ethash_utils import * 6 | 7 | cache_seeds = [b"\x00" * 32] # type: List[bytes] 8 | 9 | 10 | def mkcache(cache_size: int, block_number) -> List[List[int]]: 11 | while len(cache_seeds) <= block_number // EPOCH_LENGTH: 12 | new_seed = serialize_hash(ethash_sha3_256(cache_seeds[-1])) 13 | cache_seeds.append(new_seed) 14 | 15 | seed = cache_seeds[block_number // EPOCH_LENGTH] 16 | return _get_cache(seed, cache_size // HASH_BYTES) 17 | 18 | 19 | @lru_cache(10) 20 | def _get_cache(seed, n) -> List[List[int]]: 21 | # Sequentially produce the initial dataset 22 | o = [ethash_sha3_512(seed)] 23 | for i in range(1, n): 24 | o.append(ethash_sha3_512(o[-1])) 25 | 26 | # Use a low-round version of randmemohash 27 | for _ in range(CACHE_ROUNDS): 28 | for i in range(n): 29 | v = o[i][0] % n 30 | o[i] = ethash_sha3_512(list(map(xor, o[(i - 1 + n) % n], o[v]))) 31 | 32 | return o 33 | 34 | 35 | def calc_dataset_item(cache: List[List[int]], i: int) -> List[int]: 36 | n = len(cache) 37 | r = HASH_BYTES // WORD_BYTES 38 | # initialize the mix 39 | mix = copy.copy(cache[i % n]) # type: List[int] 40 | mix[0] ^= i 41 | mix = ethash_sha3_512(mix) 42 | # fnv it with a lot of random cache nodes based on i 43 | for j in range(DATASET_PARENTS): 44 | cache_index = fnv(i ^ j, mix[j % r]) 45 | mix = list(map(fnv, mix, cache[cache_index % n])) 46 | return ethash_sha3_512(mix) 47 | 48 | 49 | def calc_dataset(full_size, cache) -> List[List[int]]: 50 | o = [] 51 | for i in range(full_size // HASH_BYTES): 52 | o.append(calc_dataset_item(cache, i)) 53 | return o 54 | 55 | 56 | def hashimoto( 57 | header: bytes, 58 | nonce: bytes, 59 | full_size: int, 60 | dataset_lookup: Callable[[int], List[int]], 61 | ) -> Dict: 62 | n = full_size // HASH_BYTES 63 | w = MIX_BYTES // WORD_BYTES 64 | mixhashes = MIX_BYTES // HASH_BYTES 65 | # combine header+nonce into a 64 byte seed 66 | s = ethash_sha3_512(header + nonce[::-1]) 67 | mix = [] 68 | for _ in range(MIX_BYTES // HASH_BYTES): 69 | mix.extend(s) 70 | # mix in random dataset nodes 71 | for i in range(ACCESSES): 72 | p = fnv(i ^ s[0], mix[i % w]) % (n // mixhashes) * mixhashes 73 | newdata = [] 74 | for j in range(mixhashes): 75 | newdata.extend(dataset_lookup(p + j)) 76 | mix = list(map(fnv, mix, newdata)) 77 | # compress mix 78 | cmix = [] 79 | for i in range(0, len(mix), 4): 80 | cmix.append(fnv(fnv(fnv(mix[i], mix[i + 1]), mix[i + 2]), mix[i + 3])) 81 | return { 82 | b"mix digest": serialize_hash(cmix), 83 | b"result": serialize_hash(ethash_sha3_256(s + cmix)), 84 | } 85 | 86 | 87 | def hashimoto_light( 88 | full_size: int, cache: List[List[int]], header: bytes, nonce: bytes 89 | ) -> Dict: 90 | return hashimoto(header, nonce, full_size, lambda x: calc_dataset_item(cache, x)) 91 | 92 | 93 | def hashimoto_full(dataset: List[List[int]], header: bytes, nonce: bytes) -> Dict: 94 | return hashimoto(header, nonce, len(dataset) * HASH_BYTES, lambda x: dataset[x]) 95 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/Create2OOGafterInitCodeReturndataSize.json: -------------------------------------------------------------------------------- 1 | { 2 | "Create2OOGafterInitCodeReturndataSize" : { 3 | "_info" : { 4 | "comment" : "Calls a contract that runs CREATE2 which deploy a code. then OOG happens upon deployment of the actual code. check the RETURNDATASIZE after create. fails with OOG if RETURNDATASIZE != 0", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/Create2OOGafterInitCodeReturndataSizeFiller.json", 8 | "sourceHash" : "4caa44d0fcebcde6984e6ca3d1662626a962e6da75732a04f384b4143f703669" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x020000", 13 | "currentGasLimit" : "0x989680", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x9cf79b5bfc300fdfa91d033cd6f47bee3147cf82fe6a12a9ff47a8b0bc796759", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x9cf79b5bfc300fdfa91d033cd6f47bee3147cf82fe6a12a9ff47a8b0bc796759", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 44 | "balance" : "0xe8d4a51000", 45 | "code" : "", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 51 | "balance" : "0x00", 52 | "code" : "0x726960016001556001600255600052600a6016f360005260006013600d6000f5503d60020a", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0x" 61 | ], 62 | "gasLimit" : [ 63 | "0xd70e" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x00", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b", 69 | "value" : [ 70 | "0x01" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/RevertInCreateInInitCreate2.json: -------------------------------------------------------------------------------- 1 | { 2 | "RevertInCreateInInitCreate2" : { 3 | "_info" : { 4 | "comment" : "RevertInCreateInInit for CREATE2", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/RevertInCreateInInitCreate2Filler.json", 8 | "sourceHash" : "a242140f42b00d676dff043f5e8662782fdba368e61828fdff232c8f02a7421e" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0a00000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0xeeed149cdd8e47cea5160425fdf6f2479b0e00800eaa83b7bbe24455378918ee", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x0d9bca2eb555093089d9f4edcf46fc700f7b0d4c5785ea4ee960cdfc9b953f79", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x6295ee1b4f6dd65047762f924ecd367c17eabf8f" : { 44 | "balance" : "0x00", 45 | "code" : "", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | "0x00" : "0x01" 49 | } 50 | }, 51 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 52 | "balance" : "0x6400000000", 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x30506000600d80602760003960006000f56002553d6000556020600060003e60005160015500fe6211223360005260206000fd00" 62 | ], 63 | "gasLimit" : [ 64 | "0x0a00000000" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/RevertOpcodeInCreateReturnsCreate2.json: -------------------------------------------------------------------------------- 1 | { 2 | "RevertOpcodeInCreateReturnsCreate2" : { 3 | "_info" : { 4 | "comment" : "RevertOpcodeInCreateReturns for CREATE2", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/RevertOpcodeInCreateReturnsCreate2Filler.json", 8 | "sourceHash" : "aff95ea4e207fb74b2aa3bc9bd75b6cf0e808755e62d0a145fd628ee56c47900" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0a00000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x95f40858925fa62ff6bc9099b5ff5047715cc819db71e07335966c458554e373", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x95f40858925fa62ff6bc9099b5ff5047715cc819db71e07335966c458554e373", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 44 | "balance" : "0x00", 45 | "code" : "0x6000600d80601660003960006000f5503d60005500fe6211223360005260206000fd00", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | "0x00" : "0x01" 49 | } 50 | }, 51 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 52 | "balance" : "0x6400000000", 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x0a00000000" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/returndatacopy_0_0_following_successful_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "returndatacopy_0_0_following_successful_create" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/returndatacopy_0_0_following_successful_createFiller.json", 8 | "sourceHash" : "fa69b114d69ab3a6f723205c6be96e5edead2dc01111d28555c57679896ad83c" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0a00000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x80c74d9c89e828be33230eee7d8eb4d872d5aef1669f60fe76e28a80ebdf49b0", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x80c74d9c89e828be33230eee7d8eb4d872d5aef1669f60fe76e28a80ebdf49b0", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 44 | "balance" : "0x00", 45 | "code" : "0x6000600680601e60003960006000f5506000600060003e600060005500fe600160005500", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | "0x00" : "0x01" 49 | } 50 | }, 51 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 52 | "balance" : "0x6400000000", 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x0a00000000" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/returndatacopy_afterFailing_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "returndatacopy_afterFailing_create" : { 3 | "_info" : { 4 | "comment" : "Returndatacopy after failing create case due to 0xfd code.", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/returndatacopy_afterFailing_createFiller.json", 8 | "sourceHash" : "7ebe93e873ba7c0e641bae31d21e74ff7d2a8557c119d6f3b3f8d558567929bc" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0a00000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x9f759e236bba67d2b9fdca2d35f6680e3966cc682a6c3b99571aa89613e2a019", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x9f759e236bba67d2b9fdca2d35f6680e3966cc682a6c3b99571aa89613e2a019", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 44 | "balance" : "0x00", 45 | "code" : "0x69600260005260206000fd6000526000600a60166000f5503d6000556020600060003e600051600155", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | "0x00" : "0x01" 49 | } 50 | }, 51 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 52 | "balance" : "0x6400000000", 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x0a00000000" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/returndatacopy_following_revert_in_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "returndatacopy_following_revert_in_create" : { 3 | "_info" : { 4 | "comment" : "returndatacopy_following_revert_in_create for CREATE2", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/returndatacopy_following_revert_in_createFiller.json", 8 | "sourceHash" : "ec89def1f4f31fa14411195010d817f2abaa4cc4fce4f5ea0110dafca7a7cc99" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0a00000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0xfd626bc64987ba3746328001f2e5d261b56b244b6c55c120357d34ba4e452bee", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0xfd626bc64987ba3746328001f2e5d261b56b244b6c55c120357d34ba4e452bee", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 44 | "balance" : "0x00", 45 | "code" : "0x6000602880601f60003960006000f5506020600060003e60005160005500fe7d111122223333444455556666777788889999aaaabbbbccccddddeeeeffff60005260206000fd00", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | "0x00" : "0x01" 49 | } 50 | }, 51 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 52 | "balance" : "0x6400000000", 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x0a00000000" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/returndatacopy_following_successful_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "returndatacopy_following_successful_create" : { 3 | "_info" : { 4 | "comment" : "returndatacopy_following_successful_create for CREATE2", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/returndatacopy_following_successful_createFiller.json", 8 | "sourceHash" : "c5bdd0dd9d43c7be33976cfde27b5fa843e2e27648d88c177d7020bc8755351c" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0a00000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0xec7f21427a118e263cf4f8abbf477941217ad8ffd490a78823846272b516c32b", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0xec7f21427a118e263cf4f8abbf477941217ad8ffd490a78823846272b516c32b", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 44 | "balance" : "0x00", 45 | "code" : "0x6000600180601e60003960006000f5506020600160003e600051600055fe00", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | "0x00" : "0x02" 49 | } 50 | }, 51 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 52 | "balance" : "0x6400000000", 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x0a00000000" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stCreate2/returndatasize_following_successful_create.json: -------------------------------------------------------------------------------- 1 | { 2 | "returndatasize_following_successful_create" : { 3 | "_info" : { 4 | "comment" : "returndatasize_following_successful_create for create2", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stCreate2/returndatasize_following_successful_createFiller.json", 8 | "sourceHash" : "54f52fc3669c0a86a8f0a622ffb041707683fe2927dfe73f92111d6cd3d89a87" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0a00000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x58d1b872b79aa5928cf6dc5c09f5c4a8c802ec34220a2802c0ca43d23b1a04b2", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x58d1b872b79aa5928cf6dc5c09f5c4a8c802ec34220a2802c0ca43d23b1a04b2", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { 44 | "balance" : "0x00", 45 | "code" : "0x6000600c80601660003960006000f5503d60005500fe6211223360005260206000f3", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | "0x00" : "0x01" 49 | } 50 | }, 51 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 52 | "balance" : "0x6400000000", 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x0a00000000" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stEWASMTests/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/fixtures/GeneralStateTests/stEWASMTests/.gitkeep -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stExtCodeHash/extCodeHashCreatedAndDeletedAccount.json: -------------------------------------------------------------------------------- 1 | { 2 | "extCodeHashCreatedAndDeletedAccount" : { 3 | "_info" : { 4 | "comment" : "EXTCODEHASH/EXTCODESIZE of an account created then deleted in same transaction", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashCreatedAndDeletedAccountFiller.json", 8 | "sourceHash" : "ee152cae68b3cb6ec88aad0ba375c095c51f38c0442eaf5dfffcb9b35a71f6d0" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x28ec9cc4d5b3359131820d265caadf88b559339e71e83d19459e0fc3e7c7d91f", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x28ec9cc4d5b3359131820d265caadf88b559339e71e83d19459e0fc3e7c7d91f", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 44 | "balance" : "0x0de0b6b3a7640000", 45 | "code" : "", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xdeadbeef00000000000000000000000000000000" : { 51 | "balance" : "0x0de0b6b3a7640000", 52 | "code" : "0x6010600f80604360803960806000f56000526000513f6000556000513b6001556000600060006000600060005162010000f1506000513f6002556000513b60035500fe600380600c6000396000f3fe6000ff", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0x" 61 | ], 62 | "gasLimit" : [ 63 | "0x061a80" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x00", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0xdeadbeef00000000000000000000000000000000", 69 | "value" : [ 70 | "0x01" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stExtCodeHash/extCodeHashNewAccount.json: -------------------------------------------------------------------------------- 1 | { 2 | "extCodeHashNewAccount" : { 3 | "_info" : { 4 | "comment" : "EXTCODEHASH/EXTCODESIZE of an account created in same transaction", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashNewAccountFiller.json", 8 | "sourceHash" : "78be97c865cd561365d04ec131552a9e8e981c3fada8344ee81e5978381a581e" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0xe7d16e95df962ba25f3cb56fc93829d354c44b5dc06fcbd4ba17f69782b2dd8b", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0xe7d16e95df962ba25f3cb56fc93829d354c44b5dc06fcbd4ba17f69782b2dd8b", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 44 | "balance" : "0x0de0b6b3a7640000", 45 | "code" : "", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xdeadbeef00000000000000000000000000000000" : { 51 | "balance" : "0x0de0b6b3a7640000", 52 | "code" : "0x6010600b80602260003960006000f56000526000513f6000556000513b60015500fe61123460005260206000f3", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0x" 61 | ], 62 | "gasLimit" : [ 63 | "0x061a80" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x00", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0xdeadbeef00000000000000000000000000000000", 69 | "value" : [ 70 | "0x01" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stExtCodeHash/extCodeHashSelf.json: -------------------------------------------------------------------------------- 1 | { 2 | "extCodeHashSelf" : { 3 | "_info" : { 4 | "comment" : "EXTCODEHASH/EXTCODESIZE of the currently executing account", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashSelfFiller.json", 8 | "sourceHash" : "921198813f2341ae3e9d7ef6d9aa7b3da65bc9941a3b1baf4fe56f700f6cd762" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0xf4d9afb014cddaab6c38911576da8445ad61aa19ccfd9cc8255bf3f99de7950e", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0xf4d9afb014cddaab6c38911576da8445ad61aa19ccfd9cc8255bf3f99de7950e", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 44 | "balance" : "0x0de0b6b3a7640000", 45 | "code" : "", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xdeadbeef00000000000000000000000000000000" : { 51 | "balance" : "0x0de0b6b3a7640000", 52 | "code" : "0x73deadbeef000000000000000000000000000000003f60005573deadbeef000000000000000000000000000000003b600155", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | "0x00" : "0xdeadbeef" 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x061a80" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0xdeadbeef00000000000000000000000000000000", 70 | "value" : [ 71 | "0x01" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stExtCodeHash/extCodeHashSelfInInit.json: -------------------------------------------------------------------------------- 1 | { 2 | "extCodeHashSelfInInit" : { 3 | "_info" : { 4 | "comment" : "EXTCODEHASH/EXTCODESIZE of the account currently being created", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stExtCodeHash/extCodeHashSelfInInitFiller.json", 8 | "sourceHash" : "e37b28aa1c79131346753c731cb6bdd751522a18203fbe3913944da972b3ce96" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x318ee70503cfb93bf40ff733c0c32ba3e1a513f0a9869dfc905734a7e7932bf3", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x377e5cde92ce9574033a61bfade53da0c81e080642fa08e0ef5ff69c4f1cdfb4", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 44 | "balance" : "0x0de0b6b3a7640000", 45 | "code" : "", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xdeadbeef00000000000000000000000000000000" : { 51 | "balance" : "0x0de0b6b3a7640000", 52 | "code" : "0x6010600f80601260003960006000f55000fe303f600055303b60015560006000f3", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | "0x00" : "0xdeadbeef" 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x061a80" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0xdeadbeef00000000000000000000000000000000", 70 | "value" : [ 71 | "0x01" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stRandom2/randomStatetest647.json: -------------------------------------------------------------------------------- 1 | { 2 | "randomStatetest647" : { 3 | "_info" : { 4 | "comment" : "Malicious bytecode found by fuzztest tool: returndatacopy(0,-1)", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stRandom2/randomStatetest647Filler.json", 8 | "sourceHash" : "97c1071d1d021389fd141d9a39ec177e0de8c8e1ab9e0967e5d72f6a10f3aaf1" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0xd94f5374fce5edbc8e2a8697c15331677e6ebf0b", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x42fe8c95373ea1", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0xb9cdadfa4eb6b43788795e580e7cb36b4c85348412173e7bb3b9e7e954f7949f" 17 | }, 18 | "post" : { 19 | "Byzantium" : [ 20 | { 21 | "hash" : "0x608b059b4f2e5517a3f633e9376b656d476e66063c86d71072491d518eea8e84", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ] 30 | }, 31 | "pre" : { 32 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 33 | "balance" : "0x3b9aca00", 34 | "code" : "", 35 | "nonce" : "0x00", 36 | "storage" : { 37 | } 38 | }, 39 | "0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 40 | "balance" : "0x00", 41 | "code" : "0x6001600160000360003e00", 42 | "nonce" : "0x07", 43 | "storage" : { 44 | } 45 | } 46 | }, 47 | "transaction" : { 48 | "data" : [ 49 | "0x" 50 | ], 51 | "gasLimit" : [ 52 | "0x584d31" 53 | ], 54 | "gasPrice" : "0x01", 55 | "nonce" : "0x00", 56 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 57 | "to" : "0xc94f5374fce5edbc8e2a8697c15331677e6ebf0b", 58 | "value" : [ 59 | "0x00" 60 | ] 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stSStoreTest/SstoreCallToSelfSubRefundBelowZero.json: -------------------------------------------------------------------------------- 1 | { 2 | "SstoreCallToSelfSubRefundBelowZero" : { 3 | "_info" : { 4 | "comment" : "Test where accnt has slot 1 value of '2', is cleared, then calls itself and overwrites with '3', causing a refund-deduction in second call context", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stSStoreTest/SstoreCallToSelfSubRefundBelowZeroFiller.json", 8 | "sourceHash" : "d714915083bfa4e263426e2b7e738f094874b0991010377c9eb42df84b19b63d" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x1000000000", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x41cf9857a9d18ec5bb6599b269ce5259a97b360f85d379a232942c385b237b62", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0xdcdb44bc00263839310c64246d30c29d9a43ec76e14f6e08e73c022c1399ec26", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 44 | "balance" : "0xffffffffffffffff", 45 | "code" : "", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xe12d6474ac4964b9f23812bf3375c1fe637ad3b6" : { 51 | "balance" : "0x00", 52 | "code" : "0x3330146015576000600155600080808080305af1005b600360015500", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | "0x01" : "0x02" 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x241eb2" 65 | ], 66 | "gasPrice" : "0x01", 67 | "nonce" : "0x00", 68 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 69 | "to" : "0xe12d6474ac4964b9f23812bf3375c1fe637ad3b6", 70 | "value" : [ 71 | "0x00" 72 | ] 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stShift/.stub: -------------------------------------------------------------------------------- 1 | This file is here to keep the directory. 2 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stSolidityTest/AmbiguousMethod.json: -------------------------------------------------------------------------------- 1 | { 2 | "AmbiguousMethod" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stSolidityTest/AmbiguousMethodFiller.json", 8 | "sourceHash" : "ce3ae5dd578ea151015bde031df94907e43e07b7cd4ad3c2737d956b43d5f736" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x020000", 13 | "currentGasLimit" : "0x05f5e100", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Byzantium" : [ 20 | { 21 | "hash" : "0xd568910442624a2259901b496d69aeaa58375be8c9f8f18c5316251cf306f31e", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "Homestead" : [ 31 | { 32 | "hash" : "0xc55c94f5708aff56edbe823e1e448d4e7db3d9e4c693044f633c76395219a532", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { 44 | "balance" : "0x0186a0", 45 | "code" : "0x60003560e060020a90048063c040622614601557005b601b6021565b60006000f35b61014f60008190555056", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 51 | "balance" : "0x07a120", 52 | "code" : "", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0xc0406226" 61 | ], 62 | "gasLimit" : [ 63 | "0x0493e0" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x00", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", 69 | "value" : [ 70 | "0x01" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stSolidityTest/CallInfiniteLoop.json: -------------------------------------------------------------------------------- 1 | { 2 | "CallInfiniteLoop" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stSolidityTest/CallInfiniteLoopFiller.json", 8 | "sourceHash" : "02ad8004a36e096e79add76663c85145dd040c8466ae82451d1d62880a8d9b33" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x020000", 13 | "currentGasLimit" : "0x05f5e100", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Byzantium" : [ 20 | { 21 | "hash" : "0x94a768f71a8f2feee4dd28a9d71ac3c34b5324df442b634b47eb96139f2f9358", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "Homestead" : [ 31 | { 32 | "hash" : "0x94a768f71a8f2feee4dd28a9d71ac3c34b5324df442b634b47eb96139f2f9358", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { 44 | "balance" : "0x0186a0", 45 | "code" : "0x60003560e060020a90048063296df0df1460295780634893d88a146035578063981a316514604157005b602f604d565b60006000f35b603b6062565b60006000f35b6047605a565b60006000f35b5b600115605857604e565b565b60606062565b565b6068605a565b56", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 51 | "balance" : "0x07a120", 52 | "code" : "", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0x296df0df" 61 | ], 62 | "gasLimit" : [ 63 | "0x0493e0" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x00", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", 69 | "value" : [ 70 | "0x01" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stSolidityTest/CallRecursiveMethods.json: -------------------------------------------------------------------------------- 1 | { 2 | "CallRecursiveMethods" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stSolidityTest/CallRecursiveMethodsFiller.json", 8 | "sourceHash" : "3ee9a4724b34692c17722f7abc97af0ff53fa715df80922d7d87d0d3940604e3" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x020000", 13 | "currentGasLimit" : "0x05f5e100", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Byzantium" : [ 20 | { 21 | "hash" : "0x28775a9bfb2082afcf55670f0cec3345867d51cf068580a38bb823d375e44f1a", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "Homestead" : [ 31 | { 32 | "hash" : "0x28775a9bfb2082afcf55670f0cec3345867d51cf068580a38bb823d375e44f1a", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { 44 | "balance" : "0x0186a0", 45 | "code" : "0x7c01000000000000000000000000000000000000000000000000000000006000350463296df0df811460415780634893d88a14604d578063981a316514605957005b60476065565b60006000f35b6053607a565b60006000f35b605f6072565b60006000f35b5b6001156070576066565b565b6078607a565b565b60806072565b56", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 51 | "balance" : "0x07a120", 52 | "code" : "", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0x981a3165" 61 | ], 62 | "gasLimit" : [ 63 | "0xea60" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x00", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", 69 | "value" : [ 70 | "0x01" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stSpecialTest/OverflowGasMakeMoney.json: -------------------------------------------------------------------------------- 1 | { 2 | "OverflowGasMakeMoney" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stSpecialTest/OverflowGasMakeMoneyFiller.json", 8 | "sourceHash" : "424bdd64276c6dab2fbe313445d9a572c23c654ed70e7dc3a14078758f87c102" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x020000", 13 | "currentGasLimit" : "0x7fffffffffffffff", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Byzantium" : [ 20 | { 21 | "hash" : "0xa60566e0ecd43f9224e59c41de05e376869357327052aba6a61614fbcccf32ac", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "Constantinople" : [ 31 | { 32 | "hash" : "0xa60566e0ecd43f9224e59c41de05e376869357327052aba6a61614fbcccf32ac", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ], 41 | "ConstantinopleFix" : [ 42 | { 43 | "hash" : "0xa60566e0ecd43f9224e59c41de05e376869357327052aba6a61614fbcccf32ac", 44 | "indexes" : { 45 | "data" : 0, 46 | "gas" : 0, 47 | "value" : 0 48 | }, 49 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 50 | } 51 | ] 52 | }, 53 | "pre" : { 54 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 55 | "balance" : "0x03e8", 56 | "code" : "", 57 | "nonce" : "0x00", 58 | "storage" : { 59 | } 60 | } 61 | }, 62 | "transaction" : { 63 | "data" : [ 64 | "0x" 65 | ], 66 | "gasLimit" : [ 67 | "0x7ffffffffffffffe" 68 | ], 69 | "gasPrice" : "0x01", 70 | "nonce" : "0x00", 71 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 72 | "to" : "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b", 73 | "value" : [ 74 | "0x01f5" 75 | ] 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stSpecialTest/push32withoutByte.json: -------------------------------------------------------------------------------- 1 | { 2 | "push32withoutByte" : { 3 | "_info" : { 4 | "comment" : "push expect 32 bytes. but we have only 10 byte", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stSpecialTest/push32withoutByteFiller.json", 8 | "sourceHash" : "c3311ead39059528778aa07b9d4992008a02920fc299cb0988f51c90a1660199" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x68795C4AA09D6f4Ed3E5DeDDf8c2AD3049A601da", 12 | "currentDifficulty" : "0x020000", 13 | "currentGasLimit" : "0x2fefd8", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Constantinople" : [ 20 | { 21 | "hash" : "0x2b00b2a1abae901c353787d712f6971e95799968838044e7f0157fc55e0384cc", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "ConstantinopleFix" : [ 31 | { 32 | "hash" : "0x2b00b2a1abae901c353787d712f6971e95799968838044e7f0157fc55e0384cc", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x0dc02922f33e45537411b9f92a1dcc9750ba9932" : { 44 | "balance" : "0x00", 45 | "code" : "0x7f11223344556677889910", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 51 | "balance" : "0x0de0b6b3a7640000", 52 | "code" : "", 53 | "nonce" : "0x01", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0x" 61 | ], 62 | "gasLimit" : [ 63 | "0x07a120" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x01", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0x0dc02922f33e45537411b9f92a1dcc9750ba9932", 69 | "value" : [ 70 | "0x00" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stStaticCall/static_CallEcrecover0_NoGas.json: -------------------------------------------------------------------------------- 1 | { 2 | "static_CallEcrecover0_NoGas" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stStaticCall/static_CallEcrecover0_NoGasFiller.json", 8 | "sourceHash" : "e837953173c0ef58917fc77e696a20eaa6c4919cf54ba56ec323374fa4420962" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x989680", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Byzantium" : [ 20 | { 21 | "hash" : "0xa3d80dd4832c8359f2fac4635f36c90b2850deba982b96eccd67a76ab0976359", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "Constantinople" : [ 31 | { 32 | "hash" : "0xa080274c943c073d4b916dbe9aa6a1e5d7b0a3e46252b790f953f507eee1ab98", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre" : { 43 | "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { 44 | "balance" : "0x01312d00", 45 | "code" : "0x7f18c547e4f7b0f325ad1e56f57e26c745b09a3e503d86e00e5255ff7f715d3d1c600052601c6020527f73b1693892219d736caba55bdb67216e485557ea6b6af75f37096c9aa6a5a75f6040527feeb940b1d03b21e36b0e47e79769f095fe2ab855bd91e3a38756b7d75a9c4549606052602060806080600060016000fa60025560a060020a608051066000556000543214600155", 46 | "nonce" : "0x00", 47 | "storage" : { 48 | } 49 | }, 50 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 51 | "balance" : "0x0de0b6b3a7640000", 52 | "code" : "", 53 | "nonce" : "0x00", 54 | "storage" : { 55 | } 56 | } 57 | }, 58 | "transaction" : { 59 | "data" : [ 60 | "0x" 61 | ], 62 | "gasLimit" : [ 63 | "0x0592a8" 64 | ], 65 | "gasPrice" : "0x01", 66 | "nonce" : "0x00", 67 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 68 | "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", 69 | "value" : [ 70 | "0x0186a0" 71 | ] 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /fixtures/GeneralStateTests/stZeroCallsRevert/ZeroValue_TransactionCALL_OOGRevert.json: -------------------------------------------------------------------------------- 1 | { 2 | "ZeroValue_TransactionCALL_OOGRevert" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "testeth 1.6.0-alpha.0-11+commit.978e68d2", 6 | "lllcversion" : "Version: 0.5.0-develop.2018.11.9+commit.9709dfe0.Linux.g++", 7 | "source" : "src/GeneralStateTestsFiller/stZeroCallsRevert/ZeroValue_TransactionCALL_OOGRevertFiller.json", 8 | "sourceHash" : "8b653aee01be66613a5776f4c24c5e04c1c7829ae1612faa57e159862cab183e" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x020000", 13 | "currentGasLimit" : "0x989680", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "Byzantium" : [ 20 | { 21 | "hash" : "0x17ca3d673553cbfcf5de4a99ea08088763bbf64aa67ae17a485f585bcc01d3f2", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0 26 | }, 27 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 28 | } 29 | ], 30 | "Constantinople" : [ 31 | { 32 | "hash" : "0x17ca3d673553cbfcf5de4a99ea08088763bbf64aa67ae17a485f585bcc01d3f2", 33 | "indexes" : { 34 | "data" : 0, 35 | "gas" : 0, 36 | "value" : 0 37 | }, 38 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ], 41 | "ConstantinopleFix" : [ 42 | { 43 | "hash" : "0x17ca3d673553cbfcf5de4a99ea08088763bbf64aa67ae17a485f585bcc01d3f2", 44 | "indexes" : { 45 | "data" : 0, 46 | "gas" : 0, 47 | "value" : 0 48 | }, 49 | "logs" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 50 | } 51 | ] 52 | }, 53 | "pre" : { 54 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 55 | "balance" : "0xe8d4a51000", 56 | "code" : "", 57 | "nonce" : "0x00", 58 | "storage" : { 59 | } 60 | } 61 | }, 62 | "transaction" : { 63 | "data" : [ 64 | "0x" 65 | ], 66 | "gasLimit" : [ 67 | "0x4e20" 68 | ], 69 | "gasPrice" : "0x01", 70 | "nonce" : "0x00", 71 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 72 | "to" : "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b", 73 | "value" : [ 74 | "0x00" 75 | ] 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /fixtures/QuarkChainStateTests/stContractCallMnt/contractTransferMntNotEnoughBalance.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractTransferMntNotEnoughBalance": { 3 | "_info": { 4 | "comment": "deployed contract: https://gist.github.com/hanyunx/b758b44b4c866a4c175acf5017761b13", 5 | "filledwith": "byhand", 6 | "lllcversion": "byhand", 7 | "source": "NA", 8 | "sourceHash": "NA" 9 | }, 10 | "env": { 11 | "currentCoinbase": "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty": "0x020000", 13 | "currentGasLimit": "0xf5f5e100", 14 | "currentNumber": "0x01", 15 | "currentTimestamp": "0x03e8", 16 | "previousHash": "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post": { 19 | "ConstantinopleFix": [ 20 | { 21 | "hash": "0x242e94c635c64aee46c426997dd10eef7847579f49e1be79f8464264bcb49960", 22 | "indexes": { 23 | "data": 0, 24 | "gas": 0, 25 | "value": 0, 26 | "transferTokenId": 0 27 | } 28 | } 29 | ] 30 | }, 31 | "pre": { 32 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { 33 | "balances": { 34 | "0x8bb0": "0x0de0b6b3a7640000", 35 | "0x3de": "0x0de0b6b3a7640000" 36 | }, 37 | "code": "", 38 | "nonce": "0x00", 39 | "storage": { 40 | } 41 | }, 42 | "0x692a70D2e424a56D2C6C27aA97D1a86395877b3A": { 43 | "balance": "0x00", 44 | "code": "0x608060405260043610601c5760003560e01c8063c19d93fb1460a2575b602260d0565b3373ffffffffffffffffffffffffffffffffffffffff1681600060038110604557fe5b6020020181815250506103de81600160038110605d57fe5b602002018181525050600181600260038110607457fe5b602002018181525050600080606083600064514b430002600019f1609757600080fd5b600160008190555050005b34801560ad57600080fd5b5060b460ca565b6040518082815260200191505060405180910390f35b60005481565b604051806060016040528060039060208202803883398082019150509050509056fea265627a7a7231582000b4f7b5bc79e4d23adb9406e42c4099a4defa2fd3d41ed76b263f4cddac6d1564736f6c634300050b0032", 45 | "nonce": "0x00", 46 | "storage": { 47 | } 48 | } 49 | }, 50 | "transaction": { 51 | "data": [ 52 | "0x" 53 | ], 54 | "gasLimit": [ 55 | "0xf4c4b40" 56 | ], 57 | "gasPrice": "0x01", 58 | "nonce": "0x00", 59 | "secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 60 | "to": "0x692a70D2e424a56D2C6C27aA97D1a86395877b3A", 61 | "value": [ 62 | "0x00" 63 | ] 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /fixtures/QuarkChainStateTests/stContractCallMnt/currentMntId.json: -------------------------------------------------------------------------------- 1 | { 2 | "currentMntId": { 3 | "_info": { 4 | "comment": "deployed contract: https://gist.github.com/hanyunx/2288b72872721a4901d6bf7768c5fb88", 5 | "filledwith": "byhand", 6 | "lllcversion": "byhand", 7 | "source": "NA", 8 | "sourceHash": "NA" 9 | }, 10 | "env": { 11 | "currentCoinbase": "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b", 12 | "currentDifficulty": "0x020000", 13 | "currentGasLimit": "0xf5f5e100", 14 | "currentNumber": "0x01", 15 | "currentTimestamp": "0x03e8", 16 | "previousHash": "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post": { 19 | "ConstantinopleFix": [ 20 | { 21 | "hash": "0xf3ac0b21638880d41e37b94f7a6f7e2c14de94eb99774d8a20f7b7603a3729db", 22 | "indexes": { 23 | "data": 0, 24 | "gas": 0, 25 | "value": 0, 26 | "transferTokenId": 0 27 | }, 28 | "logs": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 29 | }, 30 | { 31 | "hash": "0x305b886cecf66e454a5e736caa1f53b3d9adbb7e1e78a5e7cd7847b3b91f5125", 32 | "indexes": { 33 | "data": 0, 34 | "gas": 0, 35 | "value": 0, 36 | "transferTokenId": 1 37 | }, 38 | "logs": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 39 | } 40 | ] 41 | }, 42 | "pre": { 43 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { 44 | "balances": { 45 | "0x8bb0": "0x0de0b6b3a7640000", 46 | "0x1234": "0x0de0b6b3a7640000" 47 | }, 48 | "code": "", 49 | "nonce": "0x00", 50 | "storage": { 51 | } 52 | }, 53 | "0x692a70d2e424a56d2c6c27aa97d1a86395877b3a": { 54 | "balance": "0x6000", 55 | "code": "0x60806040526004361061003b576000357c010000000000000000000000000000000000000000000000000000000090048063287c497714610040575b600080fd5b34801561004c57600080fd5b50610055610093565b6040518082600160200280838360005b83811015610080578082015181840152602081019050610065565b5050505090500191505060405180910390f35b61009b6100e7565b6100a361010a565b602082604083600064514b4300016064f180600081146100c2576100c7565b600080fd5b50508160006001811015156100d857fe5b60200201516000819055505090565b602060405190810160405280600190602082028038833980820191505090505090565b604080519081016040528060029060208202803883398082019150509050509056fea165627a7a72305820a74224f934ca37766972b102a044a156a042f980db26677580f095d2b8dd411b0029", 56 | "nonce": "0x00", 57 | "storage": { 58 | } 59 | } 60 | }, 61 | "transaction": { 62 | "data": [ 63 | "0x287c4977" 64 | ], 65 | "gasLimit": [ 66 | "0x2dc6c0" 67 | ], 68 | "transferTokenId": [ 69 | "0x8bb0", 70 | "0x1234" 71 | ], 72 | "gasPrice": "0x01", 73 | "nonce": "0x00", 74 | "secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 75 | "to": "0x692a70d2e424a56d2c6c27aa97d1a86395877b3a", 76 | "value": [ 77 | "0x00" 78 | ] 79 | } 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /fixtures/QuarkChainStateTests/stMintMnt/contractMintNewToken.json: -------------------------------------------------------------------------------- 1 | { 2 | "contractMintNewToken": { 3 | "_info": { 4 | "comment": "deployed contract: https://gist.github.com/hanyunx/7a13c4f61f9e66f2b9ae3c313388b134", 5 | "filledwith": "byhand", 6 | "lllcversion": "byhand", 7 | "source": "NA", 8 | "sourceHash": "NA" 9 | }, 10 | "env": { 11 | "currentCoinbase": "0xb94f5374fce5edbc8e2a8697c15331677e6ebf0b", 12 | "currentDifficulty": "0x020000", 13 | "currentGasLimit": "0xf5f5e100", 14 | "currentNumber": "0x01", 15 | "currentTimestamp": "0x03e8", 16 | "previousHash": "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6", 17 | "overrides": { 18 | "specialContractTimestamp": [{ 19 | "address": "000000000000000000000000000000514b430004", 20 | "timestamp": 0 21 | }] 22 | } 23 | }, 24 | "post": { 25 | "ConstantinopleFix": [ 26 | { 27 | "hash": "0x2110bff455d8a8bce3835c0c2c75d760bde4cfa1b8f52b8507a6b1ea5a7bb47c", 28 | "indexes": { 29 | "data": 0, 30 | "gas": 0, 31 | "value": 0, 32 | "transferTokenId": 0 33 | }, 34 | "logs": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" 35 | } 36 | ] 37 | }, 38 | "pre": { 39 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": { 40 | "balances": { 41 | "0x8bb0": "0x0de0b6b3a7640000" 42 | }, 43 | "code": "", 44 | "nonce": "0x00", 45 | "storage": { 46 | } 47 | }, 48 | "0x514b430000000000000000000000000000000002": { 49 | "balance": "0x6000", 50 | "code": "0x6080604052348015600f57600080fd5b5060166094565b3373ffffffffffffffffffffffffffffffffffffffff1681600060038110603957fe5b6020020181815250506201234581600160038110605257fe5b602002018181525050620186a081600260038110606b57fe5b6020020181815250506000602081606084600064514b430004600019f1609057600080fd5b5050005b604051806060016040528060039060208202803883398082019150509050509056fea265627a7a72315820253dc3f23e8eeaab59f5ce1741cb514d8c92716b7e5ffbd11f691966feaacaac64736f6c634300050b0032", 51 | "nonce": "0x00", 52 | "storage": { 53 | } 54 | } 55 | }, 56 | "transaction": { 57 | "data": [ 58 | "0x" 59 | ], 60 | "gasLimit": [ 61 | "0x2dc6c0" 62 | ], 63 | "gasPrice": "0x01", 64 | "nonce": "0x00", 65 | "secretKey": "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 66 | "to": "0x514b430000000000000000000000000000000002", 67 | "value": [ 68 | "0x00" 69 | ] 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /fixtures/QuarkChainStateTests/stTransferTokenId/normalTx.json: -------------------------------------------------------------------------------- 1 | { 2 | "normalTx" : { 3 | "_info" : { 4 | "comment" : "", 5 | "filledwith" : "byhand", 6 | "lllcversion" : "byhand", 7 | "source" : "NA", 8 | "sourceHash" : "NA" 9 | }, 10 | "env" : { 11 | "currentCoinbase" : "0x2adc25665018aa1fe0e6bc666dac8fc2697ff9ba", 12 | "currentDifficulty" : "0x20000", 13 | "currentGasLimit" : "0x0f4240", 14 | "currentNumber" : "0x01", 15 | "currentTimestamp" : "0x03e8", 16 | "previousHash" : "0x5e20a0453cecd065ea59c37ac63e079ee08998b6045136a8ce6635c7912ec0b6" 17 | }, 18 | "post" : { 19 | "ConstantinopleFix" : [ 20 | { 21 | "hash" : "0x2cd20ec2855fe5e1ac878edf74eb3746aedf86998461a653c9ea609dc2bca97b", 22 | "indexes" : { 23 | "data" : 0, 24 | "gas" : 0, 25 | "value" : 0, 26 | "transferTokenId": 0 27 | } 28 | }, 29 | { 30 | "hash" : "0x3273cde0e3787fc63b078836ae66a463009519a330f8d39c770167b548a9c530", 31 | "indexes" : { 32 | "data" : 0, 33 | "gas" : 0, 34 | "value" : 0, 35 | "transferTokenId": 1 36 | } 37 | } 38 | ] 39 | }, 40 | "pre" : { 41 | "0x095e7baea6a6c7c4c2dfeb977efac326af552d87" : { 42 | "balance" : "0x00", 43 | "code" : "", 44 | "nonce" : "0x00", 45 | "storage" : { 46 | } 47 | }, 48 | "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { 49 | "balances" : { 50 | "0x8bb0": "0x0de0b6b3a7640000", 51 | "0x1234": "0x0de0b6b3a7640000" 52 | }, 53 | "code" : "", 54 | "nonce" : "0x00", 55 | "storage" : { 56 | } 57 | } 58 | }, 59 | "transaction" : { 60 | "data" : [ 61 | "0x" 62 | ], 63 | "gasLimit" : [ 64 | "0x061a80" 65 | ], 66 | "transferTokenId": [ 67 | "0x8bb0", 68 | "0x1234" 69 | ], 70 | "gasPrice" : "0x01", 71 | "nonce" : "0x00", 72 | "secretKey" : "0x45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", 73 | "to" : "0x095e7baea6a6c7c4c2dfeb977efac326af552d87", 74 | "value" : [ 75 | "0x0186a0" 76 | ] 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /fixtures/TrieTests/test_case_0: -------------------------------------------------------------------------------- 1 | 0 0194fdc2fa2ffcc041d3ff12045b73c86e4ff95ff662a5eee82abdf44a2d0b75 882d5a8104c0ef3c913ca1da9862e30ffd8f5fb0f9527dcbec18d6067a45e6ee 2 | 1 fb180d394651850fd4a178892ee285ece1511455780875d64ee2d3d0d0de6bf8 109ef0848c9ab730bb6f2aa48ddc546978a38ffa4ff778119832e66ef83deb04 3 | 2 f9b44ce85ff03bbf857aab99c5b252c7429c32f3a8aeb79ef856f659c18f0dce 09ebbf08b2e81f3e791d1c76eb983dc70396a2690aaa50ff6564be2b10b09179 4 | 2 cc77c354f3ede2d6becc4ea3ae5e88526a9f4a578bcb9ef2d4a65314768d6d29 a1e6f74e5e3b53a197a657f599af0d75cbb4a81509b7247b98e941b0dc298602 5 | 3 9761ea9e4faae081ac8120c720efcd6cea84b6925e607be063716f96ddcdd01d 0239970d6a217314f97d10b5ee23d7fccb59217d0e324bceef01bc0d25ad8427 6 | 4 756bce6c512c3801aacaeedfad5b506664e8c0e4a771ece0b8b7c1965d918125 61c94e201e9b115debd6b7946ee256dd62ba391c36d839e4f0ee0067e86f5f13 7 | 5 1b7c9c9ca2efcdd2d12d2a79d074a8280ae9439eb0d6aeca0823ae02d67d866a a2be0038626b7355ddb4a2954f4aa2d1c3c7ebe732c277ca14cdcdc9c6971cff 8 | 1 40a2d7239c40b45ac3950d941fc4fe1c0cb96ad322d62282295fbfe11e26a433 6100bc6bc26dbfce09d17369867589fc877741189d89bf123a02f8e7eb4cbd4c 9 | 6 076db55c4a7ffbe8d181f7ed3b8cfe904f93f8f06d29bcd9ed847b182e046410 914098221f64dcfef93404c0b790908f111176fbc5feb98669f8820e8f856f39 10 | 7 f44bc4b0f3f057f8114130678ac04586c1e3c9342c8b8055c466d886441d2599 4de37bd11bf3adf24dad3f189f83089a07b60cc2ca116f9ce78a5ab5d564b986 11 | -------------------------------------------------------------------------------- /fixtures/TrieTests/test_case_1: -------------------------------------------------------------------------------- 1 | 50 52fdfc072182654f163f5f0f9a621d729566c74d10037c4d7bbb0407d1e2c649 ecda4c14389acefb7c911ff801371e75a6e9251514e1c8fd72bc2b72abf7c4a7 2 | 51 81855a1e00167939cb6694d2c422acd208a0072939487f6999eb9d18a4478404 94f16aff6f7c6239cc077ebec6505ba06c9025d49b22b55e7d3cd94fc88edd5c 3 | 52 5d87f3c67cf2367951baa2ff6cd471c483f15fb90badb37c5821b6d95526a41a 1e3a941bdddc957ed86a50c24de83297179a821f9fadd78f6295b4efffd6199a 4 | 53 95041b1d49d4955c8486216325253fec738dd7a9e28bf921119c160f07024486 dfaf1708d9dc815fc974c2f2f50029f4417186a022dfb24878d756549ab1cc09 5 | 54 15bbda0831f5059875921e668a5bdf2c7fc4844592d2572bcd0668d2d6c52f50 c417b2b3dee94001db0fa21b53386052d1b4b4047424f9f57ea10164931cb350 6 | 55 5474cb7476364cc3dbd968b0f7172ed85794bb358b0c3b525da1786f9fff0942 47d9ea78c532153e9681b445f7ab5efccd89fb7d922225db299f816495cff4cf 7 | 56 79db1944cbe0255aa5b7d44bec40f84c892b9bffd43629b0223beea5f4f74391 b8df5a274d8764f9c9ea5d2aac81bdccfa8b3497380a8d494ded45d1feb62768 8 | 57 040374f6924b98cbf8713f8d962d7c8d019192c24224e2cafccae3a61fb586b1 a7fdfba2b718485aab48f77701889fc204a919e4ed8fb4d7114bdaabc3a214cb 9 | 58 4323a6333ff993933bea6f5b3af6de0374366c4719e43a1b067d89bc7f01f1f5 22e4a43282cffc65b37684d6641c94f24d5dad2790987007be71bbf3145a3b18 10 | 59 73981659a44f39eb1e5849c6077dbb5722f5717a289a266f97647981998ebea8 4bf1d1f096c67c4d4458a862dbdedc5b0910077db1839818d7f4ee12b0092de4 11 | 58 9c0b11e4d7defa922daae7786667f7e936cd4f24abf7df866baa56038367ad61 9cc15755bb171837a31975e2c6dbfba21e48f61e3a4a42ba6763b9b34556da8e 12 | 56 45de1ee8f4b04883e56a156a8de563afa467d49dec6a40e9a1d007f033c28230 3c9cd25a85e89315bcb07b1e957c358c25d17a17c047504a989071100404c459 13 | 60 61a6430105220d0b29688b734b8ea0f3ca9936e8461f10d77c96ea80a7a665f6 dbcae930ec56b9ee0f7ed17677c72389256678599381c1f4b088d01a50711c7d 14 | 61 06f6a63b79e4d60f26686d9bf2fb26c901ff354cde1607ee294b39f32b7c7822 6c1a8b968d62c1bcf8c63b6b35cfb729da973728873b0857bb81ccb56e99ce99 15 | 62 c6e6b91c1fd3be8990434179d3af4491a369012db92d184fc39d1734ff571642 2ba2433197a4ea72ad3f7a4ad08bc877173ca8a6f267a747c2a275bb17f2c6ad 16 | 63 8953bb17c9028be9914eb7649c6c9347800979d1830356f2a54c3deab2a4b447 81daa225fe7c19ab38654cc82f8de38f4830f4de43335a0787d08ec04d62bf06 17 | 64 5d63afbe8fb56f1814be823350eab13935f31d84484517e924aef78ae151c007 0a6cb89830b56c5da0cccd2536f8e0bcf0c6868212aa9b905f7abcc866d84b8d 18 | 65 55920c30ec29a3703934bf50a28da102975deda77e758579ea3dfe4136abf752 33f9c4b43066d1be3f45e4cf1f9775a5e30ac3082a3e1bf91a8db91f7ebeb9bd 19 | 66 b3b8271d0375045f8efd69d22ae5411947cb553d7694267aef4ebcea406b32d6 295b257f37f2d114be8d8b4c8fccf68c4751b44f2113fa24954af6a09559ea76 20 | 67 10caac6e33feaa3263a399437024ba9c9b14678a274f01a910ae295f6efbfe5f 3ac53e8eda42e05fb58f8e27d9cc6d517af77334493ceba220a63e710934e628 21 | -------------------------------------------------------------------------------- /fixtures/TrieTests/trieanyorder.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleItem": { 3 | "in": { 4 | "A": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 5 | }, 6 | "root": "0xd23786fb4a010da3ce639d66d5e904a11dbc02746d1ce25029e53290cabf28ab" 7 | }, 8 | "dogs": { 9 | "in": { 10 | "doe": "reindeer", 11 | "dog": "puppy", 12 | "dogglesworth": "cat" 13 | }, 14 | "root": "0x8aad789dff2f538bca5d8ea56e8abe10f4c7ba3a5dea95fea4cd6e7c3a1168d3" 15 | }, 16 | "puppy": { 17 | "in": { 18 | "do": "verb", 19 | "horse": "stallion", 20 | "doge": "coin", 21 | "dog": "puppy" 22 | }, 23 | "root": "0x5991bb8c6514148a29db676a14ac506cd2cd5775ace63c30a4fe457715e9ac84" 24 | }, 25 | "foo": { 26 | "in": { 27 | "foo": "bar", 28 | "food": "bass" 29 | }, 30 | "root": "0x17beaa1648bafa633cda809c90c04af50fc8aed3cb40d16efbddee6fdf63c4c3" 31 | }, 32 | "smallValues": { 33 | "in": { 34 | "be": "e", 35 | "dog": "puppy", 36 | "bed": "d" 37 | }, 38 | "root": "0x3f67c7a47520f79faa29255d2d3c084a7a6df0453116ed7232ff10277a8be68b" 39 | }, 40 | "testy": { 41 | "in": { 42 | "test": "test", 43 | "te": "testy" 44 | }, 45 | "root": "0x8452568af70d8d140f58d941338542f645fcca50094b20f3c3d8c3df49337928" 46 | }, 47 | "hex": { 48 | "in": { 49 | "0x0045": "0x0123456789", 50 | "0x4500": "0x9876543210" 51 | }, 52 | "root": "0x285505fcabe84badc8aa310e2aae17eddc7d120aabec8a476902c8184b3a3503" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /fixtures/TrieTests/trieanyorder_secureTrie.json: -------------------------------------------------------------------------------- 1 | { 2 | "singleItem": { 3 | "in": { 4 | "A": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" 5 | }, 6 | "root": "0xe9e2935138352776cad724d31c9fa5266a5c593bb97726dd2a908fe6d53284df" 7 | }, 8 | "dogs": { 9 | "in": { 10 | "doe": "reindeer", 11 | "dog": "puppy", 12 | "dogglesworth": "cat" 13 | }, 14 | "root": "0xd4cd937e4a4368d7931a9cf51686b7e10abb3dce38a39000fd7902a092b64585" 15 | }, 16 | "puppy": { 17 | "in": { 18 | "do": "verb", 19 | "horse": "stallion", 20 | "doge": "coin", 21 | "dog": "puppy" 22 | }, 23 | "root": "0x29b235a58c3c25ab83010c327d5932bcf05324b7d6b1185e650798034783ca9d" 24 | }, 25 | "foo": { 26 | "in": { 27 | "foo": "bar", 28 | "food": "bass" 29 | }, 30 | "root": "0x1385f23a33021025d9e87cca5c66c00de06178807b96a9acc92b7d651ccde842" 31 | }, 32 | "smallValues": { 33 | "in": { 34 | "be": "e", 35 | "dog": "puppy", 36 | "bed": "d" 37 | }, 38 | "root": "0x826a4f9f9054a3e980e54b20da992c24fa20467f1ca635115ef4917be66e746f" 39 | }, 40 | "testy": { 41 | "in": { 42 | "test": "test", 43 | "te": "testy" 44 | }, 45 | "root": "0xaea54fb6c80499674248a462864c420c9d9f3b3d38c879c12425bade1ad76552" 46 | }, 47 | "hex": { 48 | "in": { 49 | "0x0045": "0x0123456789", 50 | "0x4500": "0x9876543210" 51 | }, 52 | "root": "0xbc11c02c8ab456db0c4d2728b6a2a6210d06f26a2ace4f7d8bdfc72ddf2630ab" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /fixtures/TrieTests/trietestnextprev.json: -------------------------------------------------------------------------------- 1 | { 2 | "basic": { 3 | "in": [ "cat", "doge", "wallace" ], 4 | "tests": [ 5 | [ "", "", "cat" ], 6 | [ "bobo", "", "cat" ], 7 | [ "c", "", "cat" ], 8 | [ "car", "", "cat" ], 9 | [ "cat", "", "doge" ], 10 | [ "catering", "cat", "doge" ], 11 | [ "d", "cat", "doge" ], 12 | [ "doge", "cat", "wallace" ], 13 | [ "dogerton", "doge", "wallace" ], 14 | [ "w", "doge", "wallace" ], 15 | [ "wallace", "doge", "" ], 16 | [ "wallace123", "wallace", ""] 17 | ] 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /mainnet/singularity/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7-buster 2 | LABEL maintainer="quarkchain" 3 | # install rocksdb 4 | RUN apt-get update && apt-get install -y \ 5 | libbz2-dev \ 6 | libgflags-dev \ 7 | liblz4-dev \ 8 | librocksdb-dev \ 9 | libsnappy-dev \ 10 | libzstd-dev \ 11 | zlib1g-dev \ 12 | && rm -rf /var/lib/apt/lists/* 13 | # set up code 14 | RUN mkdir /code 15 | WORKDIR /code 16 | RUN git clone --branch mainnet1.1.0 https://github.com/QuarkChain/pyquarkchain.git 17 | 18 | # py dep 19 | RUN pip install -r pyquarkchain/requirements.txt 20 | 21 | # add qkchash c++ lib 22 | ADD https://s3-us-west-2.amazonaws.com/pyqkcmainnet/libqkchash.so /code/pyquarkchain/qkchash/ 23 | 24 | EXPOSE 22 38291 38391 38491 25 | ENV PYTHONPATH /code/pyquarkchain 26 | ENV QKCHASHLIB /code/pyquarkchain/qkchash/libqkchash.so 27 | WORKDIR /code/pyquarkchain 28 | -------------------------------------------------------------------------------- /papers/boson.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/papers/boson.pdf -------------------------------------------------------------------------------- /papers/posw.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/papers/posw.pdf -------------------------------------------------------------------------------- /papers/smooth_swap_protocol.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/papers/smooth_swap_protocol.pdf -------------------------------------------------------------------------------- /papers/universal_v3_staking.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/papers/universal_v3_staking.pdf -------------------------------------------------------------------------------- /qkchash/Makefile: -------------------------------------------------------------------------------- 1 | CC=g++ 2 | CFLAGS=-Wall -O3 -std=c++17 3 | 4 | all: qkchash libqkchash.so qkchash_llrb 5 | 6 | qkchash: qkchash.cpp util.h 7 | $(CC) $(CFLAGS) -o qkchash qkchash.cpp 8 | 9 | libqkchash.so: qkchash.cpp util.h 10 | $(CC) $(CFLAGS) -o libqkchash.so -shared -fPIC qkchash.cpp 11 | 12 | qkchash_llrb: qkchash_llrb.cpp qkchash_llrb.h util.h 13 | $(CC) $(CFLAGS) -o qkchash_llrb qkchash_llrb.cpp 14 | 15 | clean: 16 | rm -f qkchash libqkchash.so qkchash_llrb 17 | -------------------------------------------------------------------------------- /qkchash/README.md: -------------------------------------------------------------------------------- 1 | To build `qkchash` executable and `libqkchash.so` run 2 | ```bash 3 | make 4 | ``` 5 | By default it uses `g++` to compile the C++ code. 6 | You may use a different binary by overriding the `CC` variable. For example to use `g++-7` run 7 | ```bash 8 | make CC=g++-7 9 | ``` 10 | Read `Makefile ` for more details. 11 | 12 | To test the python wrapper run 13 | ``` 14 | LD_LIBRARY_PATH=. python3 qkchash.py 15 | ``` 16 | 17 | The output is: 18 | ``` 19 | make_cache time: 0.09 20 | Python version, time used: 0.46, hashes per sec: 21.54 21 | Native version, time used: 6.16, hashes per sec: 162.23 22 | Equal: True 23 | ``` 24 | -------------------------------------------------------------------------------- /qkchash/qkchash.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/qkchash/qkchash.pdf -------------------------------------------------------------------------------- /qkchash/set_benchmark.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #define ELEMENT_TYPE uint64_t 12 | 13 | int main() { 14 | 15 | std::set oset; 16 | 17 | uint32_t key_size = 64 * 1024; 18 | 19 | std::uniform_int_distribution 20 | dist(0, std::numeric_limits::max()); 21 | std::uniform_int_distribution 22 | dist64(0, std::numeric_limits::max()); 23 | std::default_random_engine generator(475); 24 | 25 | // Prepare a search tree 26 | std::cout << "Inserting to set ..." << std::endl; 27 | auto t_start = std::chrono::steady_clock::now(); 28 | std::vector inserted; 29 | for (uint32_t i = 0; i < key_size; i++) { 30 | ELEMENT_TYPE v = dist(generator); 31 | inserted.push_back(v); 32 | oset.insert(v); 33 | } 34 | auto used_time = std::chrono::steady_clock::now() - t_start; 35 | std::cout << "Insert time: " 36 | << std::chrono::duration(used_time).count() 37 | << std::endl; 38 | 39 | // Performance random delete and insert 40 | uint32_t count = 1 * 1024 * 1024; 41 | t_start = std::chrono::steady_clock::now(); 42 | uint64_t total_count = 0; 43 | while (1) { 44 | for (uint32_t i = 0; i < count; i++) { 45 | uint64_t p = dist64(generator) % oset.size(); 46 | oset.erase(inserted[p]); 47 | inserted[p] = dist(generator); 48 | oset.insert(inserted[p]); 49 | } 50 | 51 | total_count += count; 52 | used_time = std::chrono::steady_clock::now() - t_start; 53 | auto used_time_count = 54 | (uint64_t)std::chrono::duration( 55 | used_time).count(); 56 | std::cout << total_count * 1000 / used_time_count << std::endl; 57 | } 58 | 59 | return 0; 60 | } 61 | -------------------------------------------------------------------------------- /qkchash/tests/test_qkcpow.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from qkchash.qkcpow import QkchashMiner, check_pow 4 | 5 | 6 | class TestQkcPow(unittest.TestCase): 7 | def test_pow(self): 8 | header = (2 ** 256 - 1234567890).to_bytes(32, "big") 9 | diff = 10 10 | height = 10 11 | miner = QkchashMiner(height, diff, header) 12 | nonce, mixhash = miner.mine() 13 | 14 | self.assertIsNotNone(nonce) 15 | self.assertIsNotNone(mixhash) 16 | 17 | # wrong nonce, mixhash order 18 | self.assertFalse(check_pow(height, header, nonce, mixhash, diff)) 19 | 20 | self.assertTrue(check_pow(height, header, mixhash, nonce, diff)) 21 | 22 | # In the same epoch 23 | height = 3000 24 | self.assertTrue(check_pow(height, header, mixhash, nonce, diff)) 25 | 26 | # wrong epoch 27 | height = 30001 28 | self.assertFalse(check_pow(height, header, mixhash, nonce, diff)) 29 | -------------------------------------------------------------------------------- /qkchash/util.h: -------------------------------------------------------------------------------- 1 | #ifndef __QKC_UTIL 2 | #define __QKC_UTIL 3 | 4 | const uint32_t FNV_PRIME_32 = 0x01000193; 5 | const uint64_t FNV_PRIME_64 = 0x100000001b3ULL; 6 | const uint64_t FNV_OFFSET_BASE_64 = 0xcbf29ce484222325ULL; 7 | 8 | /* 9 | * 32-bit FNV function 10 | */ 11 | uint32_t fnv32(uint32_t v1, uint32_t v2) { 12 | return (v1 * FNV_PRIME_32) ^ v2; 13 | } 14 | 15 | /* 16 | * 64-bit FNV function 17 | */ 18 | uint64_t fnv64(uint64_t v1, uint64_t v2) { 19 | return (v1 * FNV_PRIME_64) ^ v2; 20 | } 21 | 22 | /* 23 | * 64-bit FNV-1a function 24 | */ 25 | uint64_t fnv64_1a(uint64_t v1, uint64_t v2) { 26 | return (v1 ^ v2) * FNV_PRIME_64; 27 | } 28 | 29 | /* 30 | * Abort the code if cond is false. 31 | * Unlike assert(), which can be disabled by NDEBUG macro, 32 | * check() will always abort the code if cond is false. 33 | */ 34 | #define CHECK(COND) ((COND) ? (void)0 : abort()) 35 | 36 | #endif -------------------------------------------------------------------------------- /quarkchain/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/__init__.py -------------------------------------------------------------------------------- /quarkchain/cluster/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/cluster/__init__.py -------------------------------------------------------------------------------- /quarkchain/cluster/guardian.py: -------------------------------------------------------------------------------- 1 | class Guardian: 2 | @staticmethod 3 | def adjust_difficulty(original_difficulty: int, block_height: int): 4 | return original_difficulty // 1000 5 | # TODO: decide on the parameters for mainnet 6 | # if block_height < 1000: 7 | # return original_difficulty // 1000 8 | # if block_height < 10000: 9 | # return original_difficulty // 100 10 | # if block_height < 100000: 11 | # return original_difficulty // 10 12 | # return original_difficulty 13 | -------------------------------------------------------------------------------- /quarkchain/cluster/monitoring.py: -------------------------------------------------------------------------------- 1 | import json 2 | import requests 3 | import aiohttp 4 | from quarkchain.utils import Logger 5 | 6 | 7 | class KafkaSampleLogger: 8 | def __init__(self, cluster_config): 9 | self.cluster_config = cluster_config 10 | 11 | def log_kafka_sample(self, topic: str, sample: dict): 12 | """This is for testing/debugging only, use async version for production""" 13 | if self.cluster_config.MONITORING.KAFKA_REST_ADDRESS == "": 14 | return 15 | url = "http://{}/topics/{}".format( 16 | self.cluster_config.MONITORING.KAFKA_REST_ADDRESS, topic 17 | ) 18 | try: 19 | record_data = json.dumps({"records": [{"value": sample}]}) 20 | headers = { 21 | "Content-Type": "application/vnd.kafka.json.v2+json", 22 | "Accept": "application/vnd.kafka.v2+json", 23 | } 24 | response = requests.post(url, data=record_data, headers=headers) 25 | if response.status_code != 200: 26 | raise Exception( 27 | "non-OK response status code: {}".format(response.status_code) 28 | ) 29 | except Exception as ex: 30 | Logger.error_only("Failed to log sample to Kafka: {}".format(ex)) 31 | 32 | async def log_kafka_sample_async(self, topic: str, sample: dict): 33 | """logs sample to Kafka topic asynchronously 34 | Sample for monitoring purpose: 35 | Supports logging samples to Kafka via REST API (Confluent) 36 | 37 | Column guidelines: 38 | time: epoch in seconds 39 | sample_rate: pre-sampled record shall set this to sample rate, e.g., 100 means one sample is logged out of 100 40 | column type shall be log int, str, or vector of str 41 | """ 42 | if not self.cluster_config.MONITORING.KAFKA_REST_ADDRESS or not topic: 43 | return 44 | url = "http://{}/topics/{}".format( 45 | self.cluster_config.MONITORING.KAFKA_REST_ADDRESS, topic 46 | ) 47 | try: 48 | record_data = json.dumps({"records": [{"value": sample}]}) 49 | headers = { 50 | "Content-Type": "application/vnd.kafka.json.v2+json", 51 | "Accept": "application/vnd.kafka.v2+json", 52 | } 53 | session = aiohttp.ClientSession() 54 | response = await session.post(url, data=record_data, headers=headers) 55 | if response.status != 200: 56 | raise Exception( 57 | "non-OK response status code: {}".format(response.status_code) 58 | ) 59 | except Exception as ex: 60 | Logger.error_only_every_n( 61 | "Failed to log sample to Kafka: {}".format(ex), 100 62 | ) 63 | finally: 64 | await session.close() 65 | -------------------------------------------------------------------------------- /quarkchain/cluster/neighbor.py: -------------------------------------------------------------------------------- 1 | from quarkchain.core import Branch 2 | from quarkchain.utils import is_p2, check 3 | 4 | 5 | def is_neighbor(b1: Branch, b2: Branch, shard_size: int): 6 | """A naive algorithm to decide neighbor relationship 7 | TODO: a better algorithm, because the current one ensures 32 neighbors ONLY when there are 2^32 shards 8 | """ 9 | if shard_size <= 32: 10 | return True 11 | if b1.get_chain_id() == b2.get_chain_id(): 12 | return is_p2(abs(b1.get_shard_id() - b2.get_shard_id())) 13 | if b1.get_shard_id() == b2.get_shard_id(): 14 | return is_p2(abs(b1.get_chain_id() - b2.get_chain_id())) 15 | return False 16 | -------------------------------------------------------------------------------- /quarkchain/cluster/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/cluster/tests/__init__.py -------------------------------------------------------------------------------- /quarkchain/cluster/tests/test_cluster_config.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import os 3 | import unittest 4 | 5 | from quarkchain.cluster.cluster_config import ClusterConfig 6 | 7 | 8 | class TestClusterConfig(unittest.TestCase): 9 | def test_cluster_dict_with_loadtest(self): 10 | """convert to dict and back to check if the content changed, requires `__eq__` 11 | removing --loadtest will make the test faster 12 | passing more num_shards will increase runtime linearly 13 | """ 14 | parser = argparse.ArgumentParser() 15 | ClusterConfig.attach_arguments(parser) 16 | pwd = os.path.dirname(os.path.abspath(__file__)) 17 | default_genesis_dir = os.path.join(pwd, "../../genesis_data") 18 | args = parser.parse_args( 19 | ["--num_shards=4", "--genesis_dir=" + default_genesis_dir] 20 | ) 21 | cluster_config = ClusterConfig.create_from_args(args) 22 | 23 | args = parser.parse_args(["--cluster_config=" + cluster_config.json_filepath]) 24 | deserialized = ClusterConfig.create_from_args(args) 25 | 26 | self.assertTrue(cluster_config == deserialized) 27 | full_shard_id = 0 | 4 | 0 28 | # 12000 loadtest accounts + ? alloc accounts 29 | self.assertGreaterEqual( 30 | len(cluster_config.QUARKCHAIN.shards[full_shard_id].GENESIS.ALLOC), 12000 31 | ) 32 | 33 | def test_cluster_dict(self): 34 | parser = argparse.ArgumentParser() 35 | ClusterConfig.attach_arguments(parser) 36 | args = parser.parse_args(["--num_shards=4"]) 37 | cluster_config = ClusterConfig.create_from_args(args) 38 | 39 | args = parser.parse_args(["--cluster_config=" + cluster_config.json_filepath]) 40 | deserialized = ClusterConfig.create_from_args(args) 41 | 42 | self.assertTrue(cluster_config == deserialized) 43 | 44 | def test_cluster_slave_config_legacy(self): 45 | parser = argparse.ArgumentParser() 46 | ClusterConfig.attach_arguments(parser) 47 | args = parser.parse_args( 48 | ["--num_chains=8", "--num_shards_per_chain=1", "--num_slaves=4"] 49 | ) 50 | cluster_config = ClusterConfig.create_from_args(args) 51 | # remove full shard list but use chain mask 52 | d = cluster_config.to_dict() 53 | for i, s in enumerate(d["SLAVE_LIST"]): 54 | s["CHAIN_MASK_LIST"] = [i + 4] 55 | del (s["FULL_SHARD_ID_LIST"]) 56 | 57 | deserialized = ClusterConfig.from_dict(d) 58 | # chain mask translated config should equal previous full shard ID config 59 | self.assertTrue(cluster_config == deserialized) 60 | -------------------------------------------------------------------------------- /quarkchain/cluster/tests/test_monitoring.py: -------------------------------------------------------------------------------- 1 | import json 2 | import unittest 3 | import argparse 4 | from quarkchain.cluster.cluster_config import ClusterConfig 5 | 6 | 7 | class MonitoringTest(unittest.TestCase): 8 | def test_toJSON(self): 9 | sample = dict(a=1, b=2, c=["x", "y"]) 10 | self.assertEqual(json.dumps(sample), '{"a": 1, "b": 2, "c": ["x", "y"]}') 11 | 12 | def test_unknown_structure(self): 13 | parser = argparse.ArgumentParser() 14 | ClusterConfig.attach_arguments(parser) 15 | args = parser.parse_args(["--monitoring_kafka_rest_address=x"]) 16 | cluster_config = ClusterConfig.create_from_args(args) 17 | sample = dict(a=1, b=2, c={"x", "y"}) 18 | cluster_config.kafka_logger.log_kafka_sample( 19 | "topic", sample 20 | ) # should trigger warning log 21 | 22 | def test_kafka_log(self): 23 | parser = argparse.ArgumentParser() 24 | ClusterConfig.attach_arguments(parser) 25 | args = parser.parse_args( 26 | [] 27 | ) # set --kafka_rest_address correctly to see real actions 28 | cluster_config = ClusterConfig.create_from_args(args) 29 | sample = dict(a=1, b=2, c=["x", "y"]) 30 | cluster_config.kafka_logger.log_kafka_sample("dlltest", sample) 31 | -------------------------------------------------------------------------------- /quarkchain/cluster/tests/test_neighbor.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | 3 | from quarkchain.core import Branch 4 | from quarkchain.cluster.neighbor import is_neighbor 5 | 6 | 7 | class TestNeighbor(unittest.TestCase): 8 | def test_is_neighbor_same_chain_id(self): 9 | b1 = Branch(2 << 16 | 2 | 1) 10 | b2 = Branch(2 << 16 | 2 | 0) 11 | self.assertTrue(is_neighbor(b1, b2, 33)) 12 | 13 | def test_is_neighbor_same_shard_id(self): 14 | b1 = Branch(1 << 16 | 2 | 1) 15 | b2 = Branch(3 << 16 | 2 | 1) 16 | self.assertTrue(is_neighbor(b1, b2, 33)) 17 | 18 | def test_is_neighbor_small_shard_size(self): 19 | b1 = Branch(1 << 16 | 2 | 0) 20 | b2 = Branch(3 << 16 | 2 | 1) 21 | self.assertTrue(is_neighbor(b1, b2, 32)) 22 | 23 | def test_not_neighbor_diff_chain_id_and_diff_shard_id(self): 24 | b1 = Branch(1 << 16 | 2 | 0) 25 | b2 = Branch(3 << 16 | 2 | 1) 26 | self.assertFalse(is_neighbor(b1, b2, 33)) 27 | -------------------------------------------------------------------------------- /quarkchain/diff.py: -------------------------------------------------------------------------------- 1 | from quarkchain.utils import check 2 | 3 | 4 | class EthDifficultyCalculator: 5 | """ Using metropolis or homestead algorithm (check_uncle=True or False)""" 6 | 7 | def __init__(self, cutoff, diff_factor, minimum_diff=1): 8 | self.cutoff = cutoff 9 | self.diff_factor = diff_factor 10 | self.minimum_diff = minimum_diff 11 | 12 | def calculate_diff(self, chain, create_time=None): 13 | raise NotImplementedError() 14 | 15 | def calculate_diff_with_parent(self, parent, create_time): 16 | check(parent.create_time < create_time) 17 | sign = max(1 - (create_time - parent.create_time) // self.cutoff, -99) 18 | offset = parent.difficulty // self.diff_factor 19 | return int(max(parent.difficulty + offset * sign, self.minimum_diff)) 20 | -------------------------------------------------------------------------------- /quarkchain/evm/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/evm/__init__.py -------------------------------------------------------------------------------- /quarkchain/evm/bloom.py: -------------------------------------------------------------------------------- 1 | from quarkchain.utils import sha3_256 2 | from quarkchain.evm import utils 3 | 4 | """ 5 | Blooms are the 3-point, 2048-bit (11-bits/point) Bloom filter of each 6 | component (except data) of each log entry of each transaction. 7 | 8 | We set the bits of a 2048-bit value whose indices are given by 9 | the low order 11-bits 10 | of the first three double-bytes 11 | of the SHA3 12 | of each value. 13 | 14 | bloom(0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6) 15 | sha3: bd2b01afcd27800b54d2179edc49e2bffde5078bb6d0b204694169b1643fb108 16 | first double-bytes: bd2b, 01af, cd27 -- which leads to bits in bloom --> 1323, 431, 1319 17 | 18 | blooms in this module are of type 'int' 19 | """ 20 | 21 | BUCKETS_PER_VAL = 3 22 | 23 | 24 | def safe_ord(value): 25 | if isinstance(value, int): 26 | return value 27 | else: 28 | return ord(value) 29 | 30 | 31 | def bloom(val: bytes): 32 | return bloom_insert(0, val) 33 | 34 | 35 | def bloom_insert(bloom: int, val: bytes): 36 | h = sha3_256(val) 37 | for i in range(0, BUCKETS_PER_VAL * 2, 2): 38 | bloom |= 1 << ((safe_ord(h[i + 1]) + (safe_ord(h[i]) << 8)) & 2047) 39 | return bloom 40 | 41 | 42 | def bloom_bits(val: bytes): 43 | h = sha3_256(val) 44 | return [ 45 | bits_in_number(1 << ((safe_ord(h[i + 1]) + (safe_ord(h[i]) << 8)) & 2047)) 46 | for i in range(0, BUCKETS_PER_VAL * 2, 2) 47 | ] 48 | 49 | 50 | def bits_in_number(val: int): 51 | assert isinstance(val, int) 52 | return [n for n in range(2048) if (1 << n) & val] 53 | 54 | 55 | def bloom_query(bloom: int, val: bytes): 56 | bloom2 = bloom_insert(0, val) 57 | return (bloom & bloom2) == bloom2 58 | 59 | 60 | def bloom_combine(*args): 61 | bloom = 0 62 | for arg in args: 63 | bloom |= arg 64 | return bloom 65 | 66 | 67 | def bloom_from_list(args): 68 | return bloom_combine(*[bloom_insert(0, arg) for arg in args]) 69 | 70 | 71 | def b64(int_bloom): 72 | "returns b256" 73 | return utils.zpad(utils.int_to_big_endian(int_bloom), 256) 74 | -------------------------------------------------------------------------------- /quarkchain/evm/common.py: -------------------------------------------------------------------------------- 1 | import rlp 2 | from quarkchain.utils import sha3_256 3 | 4 | 5 | class FakeHeader(): 6 | """ A Fake Minor Block Header 7 | TODO: Move non-root-chain 8 | """ 9 | 10 | def __init__(self, hash=b'\x00' * 32, number=0, timestamp=0, difficulty=1, 11 | gas_limit=3141592, gas_used=0, uncles_hash=sha3_256(rlp.encode([]))): 12 | self.hash = hash 13 | self.number = number 14 | self.timestamp = timestamp 15 | self.difficulty = difficulty 16 | self.gas_limit = gas_limit 17 | self.gas_used = gas_used 18 | self.uncles_hash = uncles_hash 19 | 20 | def get_hash(self): 21 | return self.hash 22 | -------------------------------------------------------------------------------- /quarkchain/evm/config.py: -------------------------------------------------------------------------------- 1 | from quarkchain.rlp.utils import decode_hex 2 | 3 | from quarkchain.evm import utils 4 | from quarkchain.db import InMemoryDb, Db 5 | 6 | 7 | default_config = dict( 8 | # Genesis block difficulty 9 | GENESIS_DIFFICULTY=131072, 10 | # Genesis block gas limit 11 | GENESIS_GAS_LIMIT=3141592, 12 | # Genesis block prevhash, coinbase, nonce 13 | GENESIS_PREVHASH=b"\x00" * 32, 14 | GENESIS_COINBASE=b"\x00" * 20, 15 | GENESIS_NONCE=utils.zpad(utils.encode_int(42), 8), 16 | GENESIS_MIXHASH=b"\x00" * 32, 17 | GENESIS_TIMESTAMP=0, 18 | GENESIS_EXTRA_DATA=b"", 19 | GENESIS_INITIAL_ALLOC={}, 20 | # Minimum gas limit 21 | MIN_GAS_LIMIT=5000, 22 | MAX_GAS_LIMIT=2 ** 63 - 1, 23 | # Gas limit adjustment algo: 24 | # block.gas_limit=block.parent.gas_limit * 1023/1024 + 25 | # (block.gas_used * 6 / 5) / 1024 26 | GASLIMIT_EMA_FACTOR=1024, 27 | GASLIMIT_ADJMAX_FACTOR=1024, 28 | BLOCK_GAS_LIMIT=4712388, 29 | BLKLIM_FACTOR_NOM=3, 30 | BLKLIM_FACTOR_DEN=2, 31 | # Network ID 32 | NETWORK_ID=1, 33 | # Block reward 34 | BLOCK_REWARD=5000 * utils.denoms.finney, 35 | NEPHEW_REWARD=5000 * utils.denoms.finney // 32, # BLOCK_REWARD / 32 36 | # In Byzantium 37 | BYZANTIUM_BLOCK_REWARD=3000 * utils.denoms.finney, 38 | BYZANTIUM_NEPHEW_REWARD=3000 * utils.denoms.finney // 32, # BLOCK_REWARD / 32 39 | # GHOST constants 40 | UNCLE_DEPTH_PENALTY_FACTOR=8, 41 | MAX_UNCLE_DEPTH=6, # max (block.number - uncle.number) 42 | MAX_UNCLES=2, 43 | # Difficulty adjustment constants 44 | DIFF_ADJUSTMENT_CUTOFF=13, 45 | BLOCK_DIFF_FACTOR=2048, 46 | MIN_DIFF=131072, 47 | # PoW info 48 | POW_EPOCH_LENGTH=30000, 49 | # Maximum extra data length 50 | MAX_EXTRADATA_LENGTH=32, 51 | # Exponential difficulty timebomb period 52 | EXPDIFF_PERIOD=100000, 53 | EXPDIFF_FREE_PERIODS=2, 54 | # Blank account initial nonce 55 | ACCOUNT_INITIAL_NONCE=0, 56 | PREV_HEADER_DEPTH=256, 57 | # Custom specials 58 | CUSTOM_SPECIALS={}, 59 | ) 60 | assert default_config["NEPHEW_REWARD"] == default_config["BLOCK_REWARD"] // 32 61 | 62 | 63 | class Env(object): 64 | def __init__(self, db=None, config=None, global_config=None): 65 | self.db = InMemoryDb() if db is None else db 66 | assert isinstance(self.db, Db) 67 | self.config = config or dict(default_config) 68 | self.global_config = global_config or dict() 69 | -------------------------------------------------------------------------------- /quarkchain/evm/exceptions.py: -------------------------------------------------------------------------------- 1 | class UnknownParentException(Exception): 2 | pass 3 | 4 | 5 | class VerificationFailed(Exception): 6 | pass 7 | 8 | 9 | class InvalidTransaction(Exception): 10 | pass 11 | 12 | 13 | class UnsignedTransaction(InvalidTransaction): 14 | pass 15 | 16 | 17 | class InvalidNonce(InvalidTransaction): 18 | pass 19 | 20 | 21 | class InsufficientBalance(InvalidTransaction): 22 | pass 23 | 24 | 25 | class InsufficientStartGas(InvalidTransaction): 26 | pass 27 | 28 | 29 | class BlockGasLimitReached(InvalidTransaction): 30 | pass 31 | 32 | 33 | class GasPriceTooLow(InvalidTransaction): 34 | pass 35 | 36 | 37 | class InvalidNativeToken(InvalidTransaction): 38 | pass 39 | -------------------------------------------------------------------------------- /quarkchain/evm/securetrie.py: -------------------------------------------------------------------------------- 1 | from quarkchain import utils 2 | 3 | 4 | class SecureTrie(object): 5 | 6 | def __init__(self, t): 7 | self.trie = t 8 | self.db = t.db 9 | 10 | def update(self, k, v): 11 | h = utils.sha3_256(k) 12 | self.db.put(h, k) 13 | self.trie.update(h, v) 14 | 15 | def get(self, k): 16 | return self.trie.get(utils.sha3_256(k)) 17 | 18 | def delete(self, k): 19 | self.trie.delete(utils.sha3_256(k)) 20 | 21 | def to_dict(self): 22 | o = {} 23 | for h, v in list(self.trie.to_dict().items()): 24 | k = self.db.get(h) 25 | o[k] = v 26 | return o 27 | 28 | def iter_branch(self): 29 | for h, v in self.trie.iter_branch(): 30 | k = self.db.get(h) 31 | yield (k, v) 32 | 33 | def root_hash_valid(self): 34 | return self.trie.root_hash_valid() 35 | 36 | @property 37 | def root_hash(self): 38 | return self.trie.root_hash 39 | 40 | @root_hash.setter 41 | def root_hash(self, value): 42 | self.trie.root_hash = value 43 | 44 | @property 45 | def deletes(self): 46 | return self.trie.deletes 47 | 48 | @deletes.setter 49 | def deletes(self, value): 50 | self.trie.deletes = value 51 | 52 | def process_epoch(self, epoch): 53 | self.trie.process_epoch(epoch) 54 | 55 | def commit_death_row(self, epoch): 56 | self.trie.commit_death_row(epoch) 57 | 58 | def revert_epoch(self, epoch): 59 | self.trie.revert_epoch(epoch) 60 | -------------------------------------------------------------------------------- /quarkchain/evm/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/evm/tests/__init__.py -------------------------------------------------------------------------------- /quarkchain/evm/tests/conftest.py: -------------------------------------------------------------------------------- 1 | collect_ignore = ["test_state.py"] 2 | -------------------------------------------------------------------------------- /quarkchain/evm/tests/gen_trie_tests.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "encoding/binary" 5 | "encoding/hex" 6 | "fmt" 7 | "log" 8 | "math/rand" 9 | "os" 10 | "strconv" 11 | 12 | "github.com/ethereum/go-ethereum/trie" 13 | "github.com/ethereum/go-ethereum/common" 14 | "github.com/ethereum/go-ethereum/ethdb/memorydb" 15 | ) 16 | 17 | func newEmptySecure() *trie.SecureTrie { 18 | trie, _ := trie.NewSecure(common.Hash{}, trie.NewDatabase(memorydb.New())) 19 | return trie 20 | } 21 | 22 | func toHex(data []byte) []byte { 23 | dst := make([]byte, hex.EncodedLen(len(data))) 24 | hex.Encode(dst, data) 25 | return dst 26 | } 27 | 28 | func generateTestCase(size int, startValue int, updateRate int, seed int64) { 29 | var maxKey int = 0 30 | var key int 31 | random := rand.New(rand.NewSource(seed)) 32 | trie := newEmptySecure() 33 | 34 | for i :=0; i < size; i++ { 35 | keyData := make([]byte, 4) 36 | if maxKey != 0 && random.Intn(100) < updateRate { 37 | key = random.Intn(maxKey) 38 | } else { 39 | key = maxKey 40 | maxKey ++ 41 | } 42 | value := make([]byte, 32) 43 | _, _ = random.Read(value) 44 | binary.LittleEndian.PutUint32(keyData, uint32(key + startValue)) 45 | trie.Update(keyData, value) 46 | root, _ := trie.Commit(nil) 47 | fmt.Printf("%d %s %s\n", key + startValue, toHex(value), toHex(root.Bytes())) 48 | } 49 | } 50 | 51 | func main() { 52 | size, err := strconv.Atoi(os.Args[1]) 53 | if err != nil { 54 | log.Fatal(err) 55 | } 56 | startValue, err := strconv.Atoi(os.Args[2]) 57 | if err != nil { 58 | log.Fatal(err) 59 | } 60 | updateRate, err := strconv.Atoi(os.Args[3]) 61 | if err != nil { 62 | log.Fatal(err) 63 | } 64 | seed, err := strconv.Atoi(os.Args[4]) 65 | if err != nil { 66 | log.Fatal(err) 67 | } 68 | generateTestCase(size, startValue, updateRate, int64(seed)) 69 | } -------------------------------------------------------------------------------- /quarkchain/evm/tests/generate_test_cases.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | go run gen_trie_tests.go 10 0 30 0 > test_case_0 4 | go run gen_trie_tests.go 20 50 10 1 > test_case_1 5 | go run gen_trie_tests.go 30 100 0 2 > test_case_2 6 | go run gen_trie_tests.go 100 1000 50 3 > test_case_3 7 | go run gen_trie_tests.go 200 2000 25 4 > test_case_4 8 | go run gen_trie_tests.go 500 3000 75 5 > test_case_5 9 | -------------------------------------------------------------------------------- /quarkchain/evm/tests/test_state.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | import sys 3 | from fractions import Fraction 4 | 5 | from quarkchain.env import DEFAULT_ENV 6 | from quarkchain.evm.tests import new_statetest_utils, testutils 7 | 8 | from quarkchain.evm.slogging import get_logger, configure_logging 9 | 10 | logger = get_logger() 11 | # customize VM log output to your needs 12 | # hint: use 'py.test' with the '-s' option to dump logs to the console 13 | if "--trace" in sys.argv: # not default 14 | configure_logging(":trace") 15 | sys.argv.remove("--trace") 16 | 17 | checker = new_statetest_utils.verify_state_test 18 | place_to_check = "GeneralStateTests" 19 | 20 | 21 | def test_state(filename, testname, testdata): 22 | logger.debug("running test:%r in %r" % (testname, filename)) 23 | try: 24 | checker(testdata) 25 | except new_statetest_utils.EnvNotFoundException: 26 | pass 27 | 28 | 29 | def exclude_func(filename, _, __): 30 | return ( 31 | "stQuadraticComplexityTest" in filename 32 | or "stMemoryStressTest" in filename # Takes too long 33 | or "static_Call50000_sha256.json" in filename # Too long 34 | or "MLOAD_Bounds.json" in filename # We run out of memory 35 | # we know how to pass: force address 3 to get deleted. TODO confirm. 36 | or "failed_tx_xcf416c53" in filename 37 | # The test considers a "synthetic" scenario (the state described there can't 38 | # be arrived at using regular consensus rules). 39 | # * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418775512 40 | # The result is in conflict with the yellow-paper: 41 | # * https://github.com/ethereum/py-evm/pull/1224#issuecomment-418800369 42 | or "RevertInCreateInInit.json" in filename 43 | ) 44 | 45 | 46 | def pytest_generate_tests(metafunc): 47 | testutils.generate_test_params(place_to_check, metafunc, exclude_func=exclude_func) 48 | 49 | 50 | def main(): 51 | global fixtures, filename, tests, testname, testdata 52 | 53 | parser = argparse.ArgumentParser() 54 | parser.add_argument("fixtures", type=str, help="fixture file path to run tests") 55 | args = parser.parse_args() 56 | 57 | qkc_env = DEFAULT_ENV.copy() 58 | # disable root chain tax 59 | qkc_env.quark_chain_config.REWARD_TAX_RATE = Fraction(0) 60 | 61 | # load fixtures from specified file or dir 62 | fixtures = testutils.get_tests_from_file_or_dir(args.fixtures) 63 | for filename, tests in list(fixtures.items()): 64 | for testname, testdata in list(tests.items()): 65 | if exclude_func(filename, None, None): 66 | print("Skipping: %s %s" % (filename, testname)) 67 | continue 68 | print("Testing: %s %s" % (filename, testname)) 69 | # hack qkc env into the test 70 | testdata["qkc"] = qkc_env 71 | testdata["qkcstate"] = "QuarkChainStateTests" in filename 72 | testdata["testname"] = testname 73 | testdata["filename"] = filename 74 | checker(testdata) 75 | 76 | 77 | if __name__ == "__main__": 78 | main() 79 | -------------------------------------------------------------------------------- /quarkchain/evm/tests/test_trie.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | import quarkchain.evm.trie as trie 4 | from quarkchain.db import InMemoryDb 5 | import itertools 6 | from quarkchain.utils import Logger 7 | import unittest 8 | 9 | # customize VM log output to your needs 10 | # hint: use 'py.test' with the '-s' option to dump logs to the console 11 | # configure_logging(':trace') 12 | 13 | 14 | def check_testdata(data_keys, expected_keys): 15 | assert set(data_keys) == set(expected_keys), \ 16 | "test data changed, please adjust tests" 17 | 18 | 19 | fixture_path = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'fixtures') 20 | 21 | 22 | def load_tests_dict(): 23 | fixture = {} 24 | testdir = os.path.join(fixture_path, 'TrieTests') 25 | for f in os.listdir(testdir): 26 | if f != 'trietest.json': 27 | continue 28 | sub_fixture = json.load(open(os.path.join(testdir, f))) 29 | for k, v in sub_fixture.items(): 30 | fixture[f + "_" + k] = v 31 | return fixture 32 | 33 | 34 | def load_tests(loader, tests, pattern): 35 | # python3 unittest interface 36 | suite = unittest.TestSuite() 37 | for key, pairs in load_tests_dict().items(): 38 | test = unittest.FunctionTestCase((lambda key, pairs: lambda: run_test(key, pairs))(key, pairs), description=key) 39 | suite.addTests([test]) 40 | return suite 41 | 42 | 43 | def run_test(name, pairs): 44 | Logger.debug('testing %s' % name) 45 | 46 | def _dec(x): 47 | if isinstance(x, str) and x.startswith('0x'): 48 | return bytes.fromhex(str(x[2:])) 49 | if isinstance(x, str): 50 | return bytes(x, "ascii") 51 | return x 52 | 53 | pairs['in'] = [(_dec(k), _dec(v)) for k, v in pairs['in']] 54 | deletes = [(k, v) for k, v in pairs['in'] if v is None] 55 | 56 | N_PERMUTATIONS = 100 57 | for i, permut in enumerate(itertools.permutations(pairs['in'])): 58 | if i > N_PERMUTATIONS: 59 | break 60 | if pairs.get('nopermute', None) is not None and pairs['nopermute']: 61 | permut = pairs['in'] 62 | N_PERMUTATIONS = 1 63 | t = trie.Trie(InMemoryDb()) 64 | for k, v in permut: 65 | # logger.debug('updating with (%s, %s)' %(k, v)) 66 | if v is not None: 67 | t.update(k, v) 68 | else: 69 | t.delete(k) 70 | # make sure we have deletes at the end 71 | for k, v in deletes: 72 | t.delete(k) 73 | if pairs['root'] != '0x' + t.root_hash.hex(): 74 | raise Exception("Mismatch: %r %r %r %r" % ( 75 | name, pairs['root'], '0x' + t.root_hash.hex(), (i, list(permut) + deletes))) 76 | 77 | 78 | if __name__ == '__main__': 79 | for name, pairs in load_tests_dict().items(): 80 | run_test(name, pairs) 81 | -------------------------------------------------------------------------------- /quarkchain/evm/tests/test_trie_with_local_data.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import os 3 | 4 | from quarkchain.evm.securetrie import SecureTrie 5 | from quarkchain.evm.trie import Trie 6 | from quarkchain.db import InMemoryDb 7 | 8 | test_case_path = os.path.join(os.path.dirname(__file__), '..', '..', '..', 'fixtures', 'TrieTests') 9 | 10 | 11 | class TestLocalData(unittest.TestCase): 12 | def __test_with_file(self, filename): 13 | t = SecureTrie(Trie(InMemoryDb())) 14 | with open(os.path.join(test_case_path, filename)) as f: 15 | for line in f: 16 | values = line.strip("\n\r").split(" ") 17 | self.assertEqual(len(values), 3) 18 | 19 | key = int(values[0]) 20 | value = bytes.fromhex(values[1]) 21 | trie_hash = bytes.fromhex(values[2]) 22 | 23 | t.update(key.to_bytes(4, byteorder="little"), value) 24 | self.assertEqual(t.trie.root_hash, trie_hash) 25 | 26 | def test_all(self): 27 | self.__test_with_file("test_case_0") 28 | self.__test_with_file("test_case_1") 29 | self.__test_with_file("test_case_2") 30 | self.__test_with_file("test_case_3") 31 | self.__test_with_file("test_case_4") 32 | self.__test_with_file("test_case_5") 33 | -------------------------------------------------------------------------------- /quarkchain/evm/tests/testutils.py: -------------------------------------------------------------------------------- 1 | import os 2 | import json 3 | 4 | 5 | fixture_path = os.path.join(os.path.dirname(__file__), '../..', 'fixtures') 6 | 7 | 8 | def generate_test_params(testsource, metafunc, 9 | skip_func=None, exclude_func=None): 10 | import pytest 11 | if ['filename', 'testname', 'testdata'] != metafunc.fixturenames: 12 | return 13 | 14 | fixtures = get_tests_from_file_or_dir( 15 | os.path.join(fixture_path, testsource)) 16 | 17 | base_dir = os.path.dirname(os.path.dirname(__file__)) 18 | params = [] 19 | for filename, tests in fixtures.items(): 20 | if isinstance(tests, dict): 21 | filename = os.path.relpath(filename, base_dir) 22 | for testname, testdata in tests.items(): 23 | if exclude_func and exclude_func(filename, testname, testdata): 24 | continue 25 | if skip_func: 26 | skipif = pytest.mark.skipif( 27 | skip_func(filename, testname, testdata), 28 | reason="Excluded" 29 | ) 30 | params.append(skipif((filename, testname, testdata))) 31 | else: 32 | params.append((filename, testname, testdata)) 33 | 34 | metafunc.parametrize( 35 | ('filename', 'testname', 'testdata'), 36 | params 37 | ) 38 | return params[::-1] 39 | 40 | 41 | def get_tests_from_file_or_dir(dname, json_only=False): 42 | if os.path.isfile(dname): 43 | if dname[-5:] == '.json' or not json_only: 44 | with open(dname) as f: 45 | return {dname: json.load(f)} 46 | else: 47 | return {} 48 | else: 49 | o = {} 50 | for f in os.listdir(dname): 51 | fullpath = os.path.join(dname, f) 52 | for k, v in list(get_tests_from_file_or_dir( 53 | fullpath, True).items()): 54 | o[k] = v 55 | return o 56 | -------------------------------------------------------------------------------- /quarkchain/experimental/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/experimental/__init__.py -------------------------------------------------------------------------------- /quarkchain/experimental/accumulator.py: -------------------------------------------------------------------------------- 1 | from quarkchain.utils import sha3_256 2 | 3 | 4 | class Accumulator: 5 | def __init__(self): 6 | self.hlist = [] 7 | 8 | def append(self, data): 9 | h = sha3_256(data) 10 | for i in reversed(range(len(self.hlist))): 11 | if self.hlist[i] is None: 12 | self.hlist[i] = h 13 | return 14 | else: 15 | h = sha3_256(self.hlist[i] + h) 16 | self.hlist[i] = None 17 | self.hlist.insert(0, h) 18 | 19 | def hash(self): 20 | d = b"" 21 | for v in self.hlist: 22 | if v is None: 23 | d += bytes(32) 24 | else: 25 | d += v 26 | return sha3_256(d) 27 | 28 | 29 | def calc_list_hash(l): 30 | hl = [sha3_256(d) for d in l] 31 | hlist = [] 32 | while len(hl) != 0: 33 | nhl = [] 34 | for i in range(len(hl) // 2): 35 | nhl.append(sha3_256(hl[i * 2] + hl[i * 2 + 1])) 36 | if len(hl) % 2 != 0: 37 | hlist.append(hl[-1]) 38 | else: 39 | hlist.append(None) 40 | hl = nhl 41 | 42 | d = b"" 43 | for v in reversed(hlist): 44 | if v is None: 45 | d += bytes(32) 46 | else: 47 | d += v 48 | return sha3_256(d) 49 | 50 | 51 | def main(): 52 | ll = [] 53 | n = 10 54 | a = Accumulator() 55 | assert calc_list_hash(ll) == a.hash() 56 | for i in range(n): 57 | ll.append(i.to_bytes(4, byteorder="little")) 58 | a.append(i.to_bytes(4, byteorder="little")) 59 | assert calc_list_hash(ll) == a.hash() 60 | print("passed") 61 | 62 | 63 | if __name__ == "__main__": 64 | main() 65 | -------------------------------------------------------------------------------- /quarkchain/experimental/async_cancel.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | 4 | async def start(): 5 | print("enter start") 6 | try: 7 | await asyncio.wait_for(task1(), timeout=1) 8 | except asyncio.CancelledError: 9 | print("cancel in start") 10 | except asyncio.TimeoutError: 11 | print("timeout in start") 12 | print("exit start") 13 | 14 | 15 | async def task1(): 16 | print("enter task1") 17 | try: 18 | await asyncio.sleep(2) 19 | except asyncio.CancelledError: 20 | print("cancel in task1") 21 | pass 22 | print("exit task1") 23 | 24 | 25 | async def test_cancel(task): 26 | print("canceling task") 27 | task.cancel() 28 | 29 | 30 | async def task2(): 31 | print("enter task2") 32 | await asyncio.sleep(2) 33 | raise TimeoutError() 34 | print("exit task2") 35 | 36 | 37 | async def test_wait(task): 38 | done, pending = await asyncio.wait([task], return_when=asyncio.FIRST_COMPLETED) 39 | for d in done: 40 | d.exception() 41 | print("test_wait done") 42 | 43 | 44 | # Test group 1 45 | # task = asyncio.get_event_loop().create_task(start()) 46 | # asyncio.get_event_loop().create_task(test_cancel(task)) 47 | # asyncio.get_event_loop().create_task(test_cancel(task)) 48 | 49 | # Test group 2 50 | task = asyncio.get_event_loop().create_task(task2()) 51 | asyncio.get_event_loop().create_task(test_wait(task)) 52 | asyncio.get_event_loop().run_forever() 53 | -------------------------------------------------------------------------------- /quarkchain/experimental/bft_sm.py: -------------------------------------------------------------------------------- 1 | # Implement SM(m) algorithm in L. Lamport, R. Shostak, and M. Pease, 1982, "The Byzantine Generals Problem" 2 | # Some notes: 3 | # - Order is an integer 4 | # - Commander is always traitor as loyal command case is trival 5 | 6 | import collections 7 | import random 8 | 9 | 10 | def choice(orders): 11 | return min(orders) 12 | 13 | 14 | class Message: 15 | def __init__(self, order, sigs): 16 | self.order = order 17 | self.sigs = sigs 18 | 19 | def signMessage(self, nodeId): 20 | newSigs = self.sigs[:] 21 | newSigs.append(nodeId) 22 | return Message(self.order, newSigs) 23 | 24 | def isAllTraitors(self, M): 25 | for sig in self.sigs: 26 | if sig >= M: 27 | return False 28 | return True 29 | 30 | def toString(self): 31 | s = str(self.order) 32 | for sig in self.sigs: 33 | s = "{}:{}".format(s, sig) 34 | return s 35 | 36 | 37 | # # of nodes 38 | N = 5 39 | 40 | # # of traitors 41 | M = 3 42 | 43 | # SM(m) 44 | m = 2 45 | 46 | trials = 10 47 | 48 | for trial in range(trials): 49 | orders_set = [set() for i in range(N)] 50 | 51 | order = random.randint(0, 10000) 52 | 53 | message_queue = collections.deque() 54 | message_queue.append((Message(order, []), 0)) 55 | 56 | while len(message_queue) != 0: 57 | msg, nodeId = message_queue.popleft() 58 | print("Node {}: Receive {}".format(nodeId, msg.toString())) 59 | if nodeId < M: 60 | # Traitor 61 | if len(msg.sigs) == m + 1: 62 | continue 63 | 64 | canForge = msg.isAllTraitors(M) 65 | for i in range(1, N): 66 | if i in msg.sigs or i == nodeId: 67 | continue 68 | newMsg = msg.signMessage(nodeId) 69 | if canForge: 70 | newMsg.order = random.randint(0, 10000) 71 | message_queue.append((newMsg, i)) 72 | 73 | else: 74 | # Loyal 75 | 76 | # Order exist, do nothing. 77 | if msg.order in orders_set[nodeId]: 78 | continue 79 | 80 | orders_set[nodeId].add(msg.order) 81 | 82 | if len(msg.sigs) == m + 1: 83 | continue 84 | 85 | for i in range(1, N): 86 | if i in msg.sigs or i == nodeId: 87 | continue 88 | message_queue.append((msg.signMessage(nodeId), i)) 89 | 90 | c = None 91 | for i in range(M, N): 92 | if c is None: 93 | c = choice(orders_set[i]) 94 | assert c == choice(orders_set[i]) 95 | print("All choices are consistent") 96 | -------------------------------------------------------------------------------- /quarkchain/experimental/diff.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | # Simple moving average difficulty 4 | 5 | 6 | class MADifficultyCalculator: 7 | def __init__( 8 | self, ma_samples=16, target_interval_sec=1, bootstrap_samples=0, slide_size=1 9 | ): 10 | self.ma_samples = ma_samples 11 | self.target_interval_sec = target_interval_sec 12 | self.bootstrap_samples = bootstrap_samples 13 | self.slide_size = slide_size 14 | 15 | # Obtain the difficulty required for the next block 16 | def calculate_diff(self, chain): 17 | assert len(chain) >= 1 18 | gensis_diff = chain[0].get_required_diff() 19 | chain = chain[: len(chain) // self.slide_size * self.slide_size] 20 | if len(chain) <= self.bootstrap_samples + 1: 21 | return gensis_diff 22 | 23 | samples = self.ma_samples 24 | if len(chain) < samples + 1: 25 | samples = len(chain) - 1 26 | 27 | work_done = 0 28 | for block in chain[-samples:]: 29 | work_done = work_done + 1 / block.get_required_diff() 30 | 31 | time_used_sec = ( 32 | chain[-1].get_create_time_sec() - chain[-1 - samples].get_create_time_sec() 33 | ) 34 | 35 | return time_used_sec / self.target_interval_sec / work_done 36 | 37 | 38 | class FixedDifficultyCalculator: 39 | def __init__(self, diff): 40 | self.diff = diff 41 | 42 | def calculate_diff(self, chain): 43 | return self.diff 44 | -------------------------------------------------------------------------------- /quarkchain/experimental/dual_pow_sim_with_order_stats.py: -------------------------------------------------------------------------------- 1 | # A simulator of dual PoW with order statistics 2 | import random 3 | import heapq 4 | 5 | HASH_MAX = (2 ** 64) - 1 6 | hp_list = [40, 30, 20, 10] 7 | # hp_list = [50, 30, 20] 8 | COINBASE = 10 ** 20 9 | 10 | # Number of statistics to reveal 11 | K = 8 12 | 13 | 14 | class Miner: 15 | def __init__(self, hp): 16 | self.hp = hp 17 | 18 | def mine_next(self): 19 | h = [] 20 | for i in range(self.hp): 21 | v = random.randint(0, HASH_MAX) 22 | if len(h) < K: 23 | heapq.heappush(h, -v) 24 | elif v < -h[0]: 25 | heapq.heapreplace(h, -v) 26 | 27 | ret = [-i for i in h] 28 | ret.sort() 29 | return ret 30 | 31 | 32 | def to_diff(v): 33 | """ Hash vaoue to difficulty 34 | """ 35 | return HASH_MAX // v 36 | 37 | 38 | N = 100000 39 | miners = [Miner(hp) for hp in hp_list] 40 | blocks = [0] * len(hp_list) 41 | selfish_blocks = [0] * len(hp_list) 42 | # miners = [MaliciousMiner(hp) for hp in hp_list] 43 | rewards = [0] * len(hp_list) 44 | 45 | for i in range(N): 46 | min_h = [] 47 | min_j = 0 48 | min_hh = None 49 | for j in range(len(miners)): 50 | h = miners[j].mine_next() 51 | if len(min_h) == 0 or h[0] < min_h[0][0]: 52 | min_hh = h 53 | min_j = j 54 | for v in h: 55 | min_h.append((v, j)) 56 | min_h.sort() 57 | min_h = min_h[0:K] 58 | 59 | blocks[min_j] += 1 60 | if [v[0] for v in min_h] == min_hh: 61 | selfish_blocks[min_j] += 1 62 | 63 | diff = [to_diff(v[0]) for v in min_h] 64 | total_diff = sum(diff) 65 | for j in range(len(min_h)): 66 | rewards[min_h[j][1]] += COINBASE * diff[j] // total_diff 67 | 68 | 69 | print(blocks) 70 | print([i / N for i in selfish_blocks]) 71 | total_rewards = sum(rewards) 72 | print([v / total_rewards for v in rewards]) 73 | -------------------------------------------------------------------------------- /quarkchain/experimental/dual_pow_simulator.py: -------------------------------------------------------------------------------- 1 | # A simulator to demonstrate that selfish mining can be a serious attack on dual PoW algorithm. 2 | import random 3 | 4 | HASH_MAX = (2 ** 64) - 1 5 | hp_list = [40, 30, 20, 10] 6 | 7 | 8 | class Miner: 9 | def __init__(self, hp): 10 | self.hp = hp 11 | 12 | def mine_next(self): 13 | min_h = HASH_MAX 14 | for i in range(self.hp): 15 | min_h = min(min_h, random.randint(0, HASH_MAX)) 16 | return min_h 17 | 18 | 19 | class MaliciousMiner: 20 | def __init__(self, hp): 21 | self.hp = hp 22 | self.prev_min_h = HASH_MAX 23 | self.total_saved_hp = 0 24 | 25 | def mine_next(self): 26 | min_h = self.prev_min_h 27 | saved_hp = 0 28 | for i in range(self.hp): 29 | min_h = min(min_h, random.randint(0, HASH_MAX)) 30 | if min_h < HASH_MAX // 100: 31 | saved_hp = self.hp - i - 1 32 | self.total_saved_hp += saved_hp 33 | print(min_h, i, saved_hp) 34 | saved_hp = 0 35 | # print(saved_hp) 36 | break 37 | self.prev_min_h = HASH_MAX 38 | for i in range(saved_hp): 39 | self.prev_min_h = min(self.prev_min_h, random.randint(0, HASH_MAX)) 40 | return min_h 41 | 42 | 43 | N = 100000 44 | miners = [Miner(hp) for hp in hp_list] 45 | blocks = [0] * len(hp_list) 46 | miners[0] = MaliciousMiner(hp_list[0]) 47 | # miners = [MaliciousMiner(hp) for hp in hp_list] 48 | 49 | for i in range(N): 50 | min_h = None 51 | min_j = 0 52 | for j in range(len(miners)): 53 | h = miners[j].mine_next() 54 | if min_h is None or h < min_h: 55 | min_h = h 56 | min_j = j 57 | blocks[min_j] += 1 58 | 59 | print(blocks) 60 | print(miners[0].total_saved_hp) 61 | -------------------------------------------------------------------------------- /quarkchain/experimental/future.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import asyncio 4 | 5 | 6 | async def slow_operation(future): 7 | await asyncio.sleep(1) 8 | future.set_result("Future is done") 9 | 10 | 11 | async def int_operation(future): 12 | await asyncio.sleep(0.5) 13 | future.cancel() 14 | 15 | 16 | async def next_operation(): 17 | future = asyncio.Future() 18 | asyncio.run_coroutine_threadsafe(slow_operation(future), asyncio.get_event_loop()) 19 | asyncio.run_coroutine_threadsafe(int_operation(future), asyncio.get_event_loop()) 20 | await future 21 | print("Done") 22 | 23 | 24 | loop = asyncio.get_event_loop() 25 | 26 | loop.run_until_complete(next_operation()) 27 | -------------------------------------------------------------------------------- /quarkchain/experimental/proof_of_staked_work.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | # A miner uses two addresses to mine depending on whether PoSW condition is satisfied. 4 | optimal_posw = True 5 | 6 | # Hash power of each miner 7 | h = [100, 100, 100, 100] 8 | # window_size = 64 9 | window_size = 256 10 | alpha = 2 11 | beta = 20 # 0 means the miner must have allowance 12 | sp = [1, 2, 4, 13] 13 | 14 | 15 | h = [100, 200, 400, 800, 1600] 16 | sp = [1, 1, 1, 1, 1] 17 | # h = [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 10, 10, 10, 20, 20] 18 | # window_size = 256 19 | # sp = h 20 | 21 | # Maximum number of blocks produced by each miner in the window 22 | s = [int(alpha * v * window_size / sum(sp)) for v in sp] 23 | 24 | 25 | def main(): 26 | print("Total hash power: ", sum(h)) 27 | print("Window size: ", window_size) 28 | print("Max blocks in window: ", s) 29 | print("Alpha: %d, Beta: %d" % (alpha, beta)) 30 | blocks = [] 31 | N = 100000 32 | blocks_in_window = [0] * len(h) * 2 33 | ch = [0] * len(h) 34 | eh = [0] * len(h) 35 | eH = 0 36 | for i in range(N): 37 | for j in range(len(s)): 38 | if blocks_in_window[j] >= s[j]: 39 | if beta != 0: 40 | ch[j] = h[j] // beta 41 | else: 42 | ch[j] = 0 43 | else: 44 | ch[j] = h[j] 45 | eh[j] += ch[j] 46 | H = sum(ch) 47 | eH += H 48 | c = random.randint(0, H - 1) 49 | bp = -1 50 | for j in range(len(h)): 51 | if ch[j] == 0: 52 | continue 53 | if c < ch[j]: 54 | bp = j 55 | break 56 | c -= ch[j] 57 | 58 | # If not benefit from posw, using the address without stake 59 | if ch[bp] != h[bp] and optimal_posw: 60 | bp += len(h) 61 | blocks.append(bp) 62 | blocks_in_window[bp] += 1 63 | 64 | if len(blocks) > window_size: 65 | bp_remove = blocks[len(blocks) - window_size - 1] 66 | blocks_in_window[bp_remove] -= 1 67 | 68 | bc = [0] * len(h) 69 | for b in blocks: 70 | bc[b % len(h)] += 1 71 | 72 | for i in range(len(bc)): 73 | print("Miner %d: %.2f%%" % (i, bc[i] / N * 100)) 74 | 75 | print("Effective hashpower: %.2f" % (eH / N)) 76 | for i in range(len(bc)): 77 | print("Miner %d: %.2f (%.2f%%)" % (i, eh[i] / N, eh[i] / eH)) 78 | 79 | 80 | if __name__ == '__main__': 81 | main() 82 | -------------------------------------------------------------------------------- /quarkchain/experimental/proof_of_work.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import asyncio 4 | import numpy.random 5 | import time 6 | 7 | 8 | class PoW: 9 | # hash_power, number of hashs per second 10 | def __init__(self, hash_power): 11 | self.hash_power = hash_power 12 | 13 | # Return a realization of mining time in sec 14 | def mine(self, diff): 15 | return numpy.random.exponential(1 / diff / self.hash_power) 16 | 17 | 18 | async def test_po_w(): 19 | hash_power = 100 20 | diff = 0.01 21 | # Target block rate is 1sec 22 | p = PoW(hash_power) 23 | for i in range(10): 24 | start_time = time.time() 25 | await asyncio.sleep(p.mine(diff)) 26 | used_time = time.time() - start_time 27 | print(used_time) 28 | 29 | 30 | def main(): 31 | loop = asyncio.get_event_loop() 32 | loop.run_until_complete(test_po_w()) 33 | 34 | 35 | if __name__ == "__main__": 36 | main() 37 | -------------------------------------------------------------------------------- /quarkchain/experimental/random_sampling_simulator.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | committee_size = 150 4 | shard_size = 1024 5 | pool_size = 150 * 1024 6 | 7 | # Percentage of attackers in pool 8 | attacker_p = 0.15 9 | attacker_n = int(attacker_p * pool_size) 10 | 11 | # Attack threshold (a committee with t percent of attackers) 12 | attacker_tn = int(committee_size / 3) 13 | 14 | # Monte-carlo trials 15 | trials = 100000 16 | 17 | # Pool members 1 - attacker; 2 - honest validator 18 | pool = [1 for i in range(attacker_n)] 19 | pool.extend([0 for i in range(pool_size - attacker_n)]) 20 | 21 | attacked_trials = 0 22 | for trial in range(trials): 23 | if trial != 0 and trial % 10 == 0: 24 | print("Trial %d, attack prob: %f" % (trial, attacked_trials / trial)) 25 | random.shuffle(pool) 26 | for j in range(shard_size): 27 | if sum(pool[j * committee_size : (j + 1) * committee_size]) >= attacker_tn: 28 | attacked_trials += 1 29 | break 30 | 31 | print("Attack prob: %f" % (attacked_trials / trials)) 32 | -------------------------------------------------------------------------------- /quarkchain/experimental/sha3_perf.py: -------------------------------------------------------------------------------- 1 | # Performance of verification of transactions 2 | # 3 | # Some numbers on my machine (i7 7700K 4.2 GHZ): 4 | # SHA3 80000 shas/sec 5 | # SHA3 514.86 Mb/s 6 | # One i7 4700K 3.5 GHZ): 7 | # SHA3 69000 shas/sec with pycryptodome. 8 | # SHA3 134000 shas/sec with pysha3. 9 | 10 | from quarkchain.core import MinorBlockHeader 11 | import argparse 12 | import time 13 | import profile 14 | import os 15 | 16 | from quarkchain.utils import sha3_256 17 | 18 | 19 | def test_perf(): 20 | N = 20000 21 | start_time = time.time() 22 | m_header = MinorBlockHeader() 23 | for i in range(N): 24 | m_header.nonce = i 25 | m_header.get_hash() 26 | duration = time.time() - start_time 27 | print("TPS: %.2f" % (N / duration)) 28 | 29 | 30 | def test_perf_data(): 31 | N = 100 32 | S = 1024 * 1024 33 | start_time = time.time() 34 | b = os.urandom(S) 35 | for i in range(N): 36 | sha3_256(b) 37 | duration = time.time() - start_time 38 | print("Data per sec: %.2f Mb/s" % (N * S / 1024 / 1024 / duration)) 39 | 40 | 41 | def main(): 42 | parser = argparse.ArgumentParser() 43 | parser.add_argument("--profile", default=False) 44 | args = parser.parse_args() 45 | 46 | if args.profile: 47 | profile.run("test_perf()") 48 | profile.run("test_perf_data()") 49 | else: 50 | test_perf() 51 | test_perf_data() 52 | 53 | 54 | if __name__ == "__main__": 55 | main() 56 | -------------------------------------------------------------------------------- /quarkchain/experimental/test_heap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | from quarkchain.experimental import heap 4 | import random 5 | import unittest 6 | 7 | 8 | class HeapTestItem: 9 | def __init__(self, value): 10 | self.value = value 11 | self.heap_index = 0 12 | 13 | def __str__(self): 14 | return str(self.value) 15 | 16 | def __repr__(self): 17 | return self.__str__() 18 | 19 | 20 | class TestHeap(unittest.TestCase): 21 | def test_heap_sort(self): 22 | N = 100 23 | data = [HeapTestItem(i) for i in range(N)] 24 | random.shuffle(data) 25 | h = heap.Heap(lambda x, y: x.value - y.value) 26 | for d in data: 27 | h.push(d) 28 | self.assertTrue(h.check_integrity()) 29 | for i in range(N): 30 | self.assertEqual(h.pop_top().value, i) 31 | self.assertTrue(h.check_integrity()) 32 | self.assertTrue(h.is_empty()) 33 | 34 | def test_heap_random_pop(self): 35 | N = 100 36 | data = [HeapTestItem(i) for i in range(N)] 37 | random.shuffle(data) 38 | h = heap.Heap(lambda x, y: x.value - y.value) 39 | for d in data: 40 | h.push(d) 41 | self.assertTrue(h.check_integrity()) 42 | random.shuffle(data) 43 | for d in data: 44 | h.pop(d) 45 | self.assertTrue(h.check_integrity()) 46 | self.assertTrue(h.is_empty()) 47 | -------------------------------------------------------------------------------- /quarkchain/experimental/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/experimental/tests/__init__.py -------------------------------------------------------------------------------- /quarkchain/experimental/tests/test_diff.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | import quarkchain.experimental.diff as diff 3 | import quarkchain.experimental.proof_of_work as proof_of_work 4 | import statistics as stat 5 | 6 | 7 | class Block: 8 | def __init__(self, n_time=0.0, required_diff=0.1): 9 | self.n_time = n_time 10 | self.required_diff = required_diff 11 | 12 | def get_required_diff(self): 13 | return self.required_diff 14 | 15 | def get_create_time_sec(self): 16 | return self.n_time 17 | 18 | 19 | class TestMADifficulty(unittest.TestCase): 20 | def test_none_sample(self): 21 | chain = [Block(0, 0.1)] 22 | diff_calc = diff.MADifficultyCalculator(ma_samples=2, target_interval_sec=5.0) 23 | self.assertEqual(diff_calc.calculate_diff(chain), 0.1) 24 | 25 | def test_one_sample(self): 26 | chain = [Block(0, 0.1), Block(4.0, 0.1)] 27 | diff_calc = diff.MADifficultyCalculator(ma_samples=2, target_interval_sec=5.0) 28 | self.assertEqual(diff_calc.calculate_diff(chain), 0.08) 29 | 30 | def test_two_sample(self): 31 | chain = [Block(0, 0.1), Block(4.0, 0.1), Block(10, 0.08)] 32 | diff_calc = diff.MADifficultyCalculator(ma_samples=2, target_interval_sec=5.0) 33 | self.assertEqual(diff_calc.calculate_diff(chain), 1 / 11.25) 34 | 35 | 36 | def main(): 37 | target_interval_sec = 5 38 | diff_calc = diff.MADifficultyCalculator( 39 | ma_samples=32, target_interval_sec=target_interval_sec 40 | ) 41 | hash_power = 100 42 | 43 | cTime = 0.0 44 | chain = [Block(0, 0.002)] 45 | usedTimeList = [] 46 | p = proof_of_work.PoW(hash_power) 47 | 48 | for i in range(1000): 49 | required_diff = diff_calc.calculate_diff(chain) 50 | cTime = cTime + p.mine(required_diff) 51 | block = Block(cTime, required_diff) 52 | used_time = block.n_time - chain[-1].n_time 53 | chain.append(block) 54 | usedTimeList.append(used_time) 55 | print( 56 | "Time %.2f, block %d, requiredWork %.2f, used_time %.2f" 57 | % (block.n_time, i + 1, 1 / block.required_diff, used_time) 58 | ) 59 | 60 | print( 61 | "Max: %.2f, min: %.2f, avg: %.2f, std: %.2f" 62 | % ( 63 | max(usedTimeList), 64 | min(usedTimeList), 65 | stat.mean(usedTimeList), 66 | stat.stdev(usedTimeList), 67 | ) 68 | ) 69 | 70 | 71 | if __name__ == "__main__": 72 | main() 73 | -------------------------------------------------------------------------------- /quarkchain/experimental/whitelist.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | 4 | class Candidate: 5 | def __init__(self, key, score): 6 | self.key = key 7 | self.score = score 8 | 9 | 10 | def get_whitelist(candidate_list, n, seed): 11 | random.seed(seed) 12 | white_list = [] 13 | candidate_list.sort(key=lambda p: p.key) 14 | for i in range(n): 15 | total_score = sum([p.score for p in candidate_list]) 16 | chosen = random.randint(0, total_score - 1) 17 | for idx, p in enumerate(candidate_list): 18 | if chosen <= p.score: 19 | white_list.append(p) 20 | candidate_list.pop(idx) 21 | break 22 | chosen -= p.score 23 | return white_list 24 | 25 | 26 | def generate_person_list(n, seed): 27 | random.seed(seed) 28 | return [ 29 | Candidate(key=random.random(), score=random.randint(1, 100)) for i in range(n) 30 | ] 31 | 32 | 33 | candidate_list = generate_person_list(100, 123) 34 | white_list = get_whitelist(candidate_list, 50, 321) 35 | for p in white_list: 36 | print(p.key, p.score) 37 | -------------------------------------------------------------------------------- /quarkchain/genesis_data/alloc/0.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "68fb978bf0e4c69ba338d4fa5a4e5eaa88438aa80000d4aa", 4 | "key": "966a253dd39a1832306487c6218da1425e429fae01c1a40eb50965dff31a04ed" 5 | }, 6 | { 7 | "address": "39af711e492db9249cc03134459078deb5f4f3f1000031de", 8 | "key": "653088d87cac950f7134f7aaf727dd173dba00706f30699fad03898b1d0acf0d" 9 | }, 10 | { 11 | "address": "33f99d65322731353c948808b2e9208d2b22f5520000888d", 12 | "key": "8d298c57e269a379c4956583f095b2557c8f07226410e02ae852bc4563864790" 13 | }, 14 | { 15 | "address": "9c79b27aee912e9ceb7901ea15654d3d7c778d600000013d", 16 | "key": "1d8556c79fb221ee123c4bf3c81034bcf2c719c064e3acd1ac52b48bd9a541ed" 17 | }, 18 | { 19 | "address": "6f2f9b3a54a8c4686fe80c33d863079b6dc7abee00000c9b", 20 | "key": "1204fda761249130840855476f0dc005ab102dc1b0117e4642bbb2cc6808cd2a" 21 | }, 22 | { 23 | "address": "653ef52aa0d9f9186f3f311193c92ed84707519c000031d8", 24 | "key": "2c757b4d8aa63527a515f5febaffde0fefa859959411223fce05c0be3962d1f4" 25 | }, 26 | { 27 | "address": "99ed730e11c6996fcd97bd1ede8ad69ad264a7fa0000bd9a", 28 | "key": "37c16fa19244957bb2f23811d5761bc5bf7ef62384950c760c3fe6abd391f693" 29 | } 30 | ] 31 | -------------------------------------------------------------------------------- /quarkchain/genesis_data/alloc/1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "916b2d4b0ecaf9802ee9fdef7050edb26a72a1040001fdb2", 4 | "key": "749bfe4567e157eddfb808c8accee65c86e0708b3c2d08ad0d3e2b3e8a056f97" 5 | }, 6 | { 7 | "address": "c62edcb3bf5964909cf19818abf2551a4de406160001981a", 8 | "key": "06ce41f7224dba3d78d452b55391c3ae675074f9121cd215271dc3d7f013114a" 9 | }, 10 | { 11 | "address": "c63ea0419f6e994111a378db9ca3ae5ae50c69ea0001785a", 12 | "key": "a5b8d579cd3b1c8a01fbfac18d355a557fa3a42447cf2f3c00c26b83cbe10271" 13 | }, 14 | { 15 | "address": "ffaeda8d5c1911b077b009b0e12ce3d63fd44fd0000109d6", 16 | "key": "7519806d08ad552d918d693330d0a0d57e515a970948eb2306fa59f6f41bb966" 17 | }, 18 | { 19 | "address": "425a6e88667521c6617f271285a02a0e508de2670001270e", 20 | "key": "e3d4a68cb671b30e680e8ab1b1be0b7e888101c718d278c164a7248a33f55747" 21 | }, 22 | { 23 | "address": "70aef79f91cae455f4d6de71094b664a7d5b91de0001de4a", 24 | "key": "57359775fd52ef33edb1e1a2ba8d0c898751590faf232d3b68dd5938f29ec518" 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /quarkchain/genesis_data/alloc/2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "7c4022e9d4b9a2960ca2ae319a524ea98621e5df0002aea9", 4 | "key": "473ca7e5ae5c56bbb7556c07f451a30c1fb51941c705e8861ff5065bd65c4d24" 5 | }, 6 | { 7 | "address": "da0b569a598d348013fee9616e81437c11da62380002e97c", 8 | "key": "59efa2785487d9b92cc1e2dce8d69f77994ca7f2398f4c3b2d2a649be8657806" 9 | }, 10 | { 11 | "address": "9b7667c5dce09b38c434346d53418d520f3cb70900023452", 12 | "key": "e37a007ee526c9967cf28ec9395356ae95f7df70048b3ccdb2bd77b322a546d0" 13 | }, 14 | { 15 | "address": "d46157c34ee5de72179b6b39efa296d9ce874af000026bd9", 16 | "key": "7c6764947cd4f287aaad86ee76154b9d78c7f329cd560f10b335988fc6cfce24" 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /quarkchain/p2p/DEVELOPMENT.md: -------------------------------------------------------------------------------- 1 | # QuarkChain p2p module 2 | 3 | ## Status 4 | QuarkChain Testnet 2.0 is presented with the new p2p module 5 | - Kademlia 6 | - Discovery 7 | - P2P server and peer manager 8 | - Peer secure communication protocol 9 | 10 | ## Guidelines 11 | - loosely based on [py-evm (Trinity)'s implementation of devp2p](https://github.com/ethereum/py-evm/tree/master/p2p) 12 | - loosely follow [devp2p specifications](https://github.com/ethereum/devp2p) 13 | - adopt [discv5](https://github.com/fjl/p2p-drafts) 14 | 15 | ## Motivation 16 | First version of QuarkChain testnet used simple_network which connects all peers with a fully connected topology, and it soon became unrealistic to run a testnet with 100 nodes with fully connection (each node maintains 99 peers). We used pydevp2p that was part of pyethereum for QuarkChain testnet 1.0 which worked fine. However, pydevp2p is no longer in the list of [devp2p official implementations](https://github.com/ethereum/devp2p), albeit there is no real protocol changes of devp2p since 2014. And we need the new features brought by discv5. Discarding gevent and adopting asyncio is a bonus. 17 | 18 | We need a better p2p library for QuarkChain mainnet. 19 | 20 | We now propose our own implementation of devp2p-like specifications, learning from the implementations of ethereum (py-evm and go-ethereum) and adding our own features (treating shards as topics for discv5) 21 | -------------------------------------------------------------------------------- /quarkchain/p2p/cancel_token/README.md: -------------------------------------------------------------------------------- 1 | # cancel-token for QuarkChain services 2 | ported from https://github.com/ethereum/asyncio-cancel-token to work with python3.5 (pypy) 3 | 4 | ## What is CancelToken? 5 | see https://vorpus.org/blog/timeouts-and-cancellation-for-humans/ 6 | 7 | Essentially, it allows your async operations to "give up after ". Its chaining feature allows cancelling complex service/tasks altogether. 8 | -------------------------------------------------------------------------------- /quarkchain/p2p/cancel_token/exceptions.py: -------------------------------------------------------------------------------- 1 | class BaseCancelTokenException(Exception): 2 | """ 3 | Base exception class for the `asyncio-cancel-token` library. 4 | """ 5 | 6 | pass 7 | 8 | 9 | class EventLoopMismatch(BaseCancelTokenException): 10 | """ 11 | Raised when two different asyncio event loops are referenced, but must be equal 12 | """ 13 | 14 | pass 15 | 16 | 17 | class OperationCancelled(BaseCancelTokenException): 18 | """ 19 | Raised when an operation was cancelled. 20 | """ 21 | 22 | pass 23 | -------------------------------------------------------------------------------- /quarkchain/p2p/cancellable.py: -------------------------------------------------------------------------------- 1 | from typing import Awaitable, TypeVar 2 | 3 | from quarkchain.p2p.cancel_token.token import CancelToken 4 | 5 | 6 | class CancellableMixin: 7 | cancel_token = None # : CancelToken 8 | 9 | _TReturn = TypeVar("_TReturn") 10 | 11 | async def wait( 12 | self, 13 | awaitable: Awaitable[_TReturn], 14 | token: CancelToken = None, 15 | timeout: float = None, 16 | ) -> _TReturn: 17 | """See wait_first()""" 18 | return await self.wait_first(awaitable, token=token, timeout=timeout) 19 | 20 | async def wait_first( 21 | self, 22 | *awaitables: Awaitable[_TReturn], 23 | token: CancelToken = None, 24 | timeout: float = None 25 | ) -> _TReturn: 26 | """ 27 | Wait for the first awaitable to complete, unless we timeout or the token chain is triggered. 28 | 29 | The given token is chained with this service's token, so triggering either will cancel 30 | this. 31 | 32 | Returns the result of the first one to complete. 33 | 34 | Raises TimeoutError if we timeout or OperationCancelled if the token chain is triggered. 35 | 36 | All pending futures are cancelled before returning. 37 | """ 38 | if token is None: 39 | token_chain = self.cancel_token 40 | else: 41 | token_chain = token.chain(self.cancel_token) 42 | return await token_chain.cancellable_wait(*awaitables, timeout=timeout) 43 | -------------------------------------------------------------------------------- /quarkchain/p2p/events.py: -------------------------------------------------------------------------------- 1 | from typing import ( 2 | Type, 3 | ) 4 | 5 | from lahja import ( 6 | BaseEvent, 7 | BaseRequestResponseEvent, 8 | ) 9 | 10 | 11 | class PeerCountResponse(BaseEvent): 12 | 13 | def __init__(self, peer_count: int) -> None: 14 | self.peer_count = peer_count 15 | 16 | 17 | class PeerCountRequest(BaseRequestResponseEvent[PeerCountResponse]): 18 | 19 | @staticmethod 20 | def expected_response_type() -> Type[PeerCountResponse]: 21 | return PeerCountResponse 22 | -------------------------------------------------------------------------------- /quarkchain/p2p/poc/trinity_discovery.py: -------------------------------------------------------------------------------- 1 | """ 2 | trinity_discovery.py - runs a single discover service that connects to the specified bootnode on startup 3 | Example runs: 4 | # this is the correct private key for the default bootnode, discovery will figure out that it is bootnode itself and won't bond at all ("Failed to bond with bootstrap nodes" message is expected) 5 | python p2p/poc/p2p_app.py --privkey=31552f186bf90908ce386fb547dd0410bf443309125cc43fd0ffd642959bf6d9 6 | # after bootnode is up, running a new node will populate discovery table of both nodes 7 | python trinity_discovery.py --listen_port=29001 8 | """ 9 | import argparse 10 | import asyncio 11 | import signal 12 | 13 | from eth_keys import keys 14 | 15 | from quarkchain.utils import Logger 16 | from quarkchain.p2p import ecies 17 | from quarkchain.p2p import kademlia 18 | from quarkchain.p2p.cancel_token.token import CancelToken, OperationCancelled 19 | from quarkchain.p2p.discovery import DiscoveryProtocol 20 | 21 | 22 | def main(): 23 | Logger.set_logging_level("debug") 24 | loop = asyncio.get_event_loop() 25 | loop.set_debug(True) 26 | 27 | parser = argparse.ArgumentParser() 28 | parser.add_argument( 29 | "--bootnode", 30 | default="enode://c571e0db93d17cc405cb57640826b70588a6a28785f38b21be471c609ca12fcb06cb306ac44872908f5bed99046031a5af82072d484e3ef9029560c1707193a0@127.0.0.1:29000", 31 | type=str, 32 | ) 33 | parser.add_argument("--listen_host", default="127.0.0.1", type=str) 34 | parser.add_argument( 35 | "--listen_port", 36 | default=29000, 37 | help="port for discovery UDP and P2P TCP connection", 38 | type=int, 39 | ) 40 | parser.add_argument("--max_peers", default=10, type=int) 41 | # private key of the bootnode above is 31552f186bf90908ce386fb547dd0410bf443309125cc43fd0ffd642959bf6d9 42 | parser.add_argument( 43 | "--privkey", 44 | default="", 45 | help="hex string of private key; if empty, will be auto-generated", 46 | type=str, 47 | ) 48 | 49 | args = parser.parse_args() 50 | 51 | if args.privkey: 52 | privkey = keys.PrivateKey(bytes.fromhex(args.privkey)) 53 | else: 54 | privkey = ecies.generate_privkey() 55 | addr = kademlia.Address(args.listen_host, args.listen_port, args.listen_port) 56 | bootstrap_nodes = tuple([kademlia.Node.from_uri(args.bootnode)]) 57 | 58 | cancel_token = CancelToken("discovery") 59 | discovery = DiscoveryProtocol(privkey, addr, bootstrap_nodes, cancel_token) 60 | 61 | async def run() -> None: 62 | await loop.create_datagram_endpoint( 63 | lambda: discovery, local_addr=("0.0.0.0", args.listen_port) 64 | ) 65 | try: 66 | await discovery.bootstrap() 67 | while True: 68 | Logger.info("Routing table size={}".format(len(discovery.routing))) 69 | await cancel_token.cancellable_wait(asyncio.sleep(5)) 70 | except OperationCancelled: 71 | pass 72 | finally: 73 | await discovery.stop() 74 | 75 | for sig in [signal.SIGINT, signal.SIGTERM]: 76 | loop.add_signal_handler(sig, cancel_token.trigger) 77 | 78 | loop.run_until_complete(run()) 79 | loop.close() 80 | 81 | 82 | if __name__ == "__main__": 83 | main() 84 | -------------------------------------------------------------------------------- /quarkchain/p2p/poc/udp_nat.py: -------------------------------------------------------------------------------- 1 | """ 2 | This is an exploratory piece of code to understand how UDP works with NAT. 3 | 4 | Tested with an Apple AirPort Extreme Router: 5 | 1. run this file on a computer (ALICE) behind router 6 | 2. find a machine (BOB) with public IP (eg. AWS), run the following code snippet, ALICE would not be able to receive the UDP packets: 7 | import socket 8 | import time 9 | sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) 10 | sock.bind(('0.0.0.0', 60999)) 11 | while True: 12 | sock.sendto(b"hello there", ("$PUBLIC_IP_OF_ALICE", 9999)) 13 | time.sleep(0.2) 14 | 3. uncomment the part `transport.sendto(b"hello world", ("$PUBLIC_IP_OF_BOB", 60999))`, and run this file again 15 | 16 | It looks our router determined that ALICE:9999 is communicating with BOB:60999, and setup NAT traversal automatically so that packets that come from BOB:60999 (note we set up sock.bind so that packets are marked from 60999 although nobody is listening on BOB) are automatically forwarded to ALICE:9999. 17 | 18 | This demonstrates how NAT traversal is automatically handled in certain cases. 19 | 20 | In real world usage, if you want a reliable way for your application to be connected from outside your private network, setup port forwarding on your router, as there is no guarantee that this will work in all cases. 21 | """ 22 | 23 | import asyncio 24 | 25 | 26 | class EchoServerProtocol: 27 | def connection_made(self, transport): 28 | self.transport = transport 29 | 30 | def datagram_received(self, data, addr): 31 | message = data.decode() 32 | print("Received %r from %s" % (message, addr)) 33 | # print('Send %r to %s' % (message, addr)) 34 | # self.transport.sendto(data, addr) 35 | 36 | 37 | if __name__ == "__main__": 38 | loop = asyncio.get_event_loop() 39 | port = 9999 40 | print("Starting UDP server on port {}".format(port)) 41 | # One protocol instance will be created to serve all client requests 42 | listen = loop.create_datagram_endpoint( 43 | EchoServerProtocol, local_addr=("0.0.0.0", port) 44 | ) 45 | transport, protocol = loop.run_until_complete(listen) 46 | 47 | # transport.sendto(b"hello world", ("$PUBLIC_IP_OF_BOB", 60999)) 48 | 49 | try: 50 | loop.run_forever() 51 | except KeyboardInterrupt: 52 | pass 53 | 54 | transport.close() 55 | loop.close() 56 | -------------------------------------------------------------------------------- /quarkchain/p2p/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/p2p/tests/__init__.py -------------------------------------------------------------------------------- /quarkchain/p2p/tests/test_peer_collect_sub_proto_msgs.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import logging 3 | 4 | import pytest 5 | 6 | from quarkchain.p2p.tools.paragon import BroadcastData, GetSum 7 | from quarkchain.p2p.tools.paragon.helpers import get_directly_linked_peers 8 | 9 | @pytest.mark.asyncio 10 | async def test_peer_subscriber_filters_messages(request, event_loop): 11 | peer, remote = await get_directly_linked_peers(request, event_loop) 12 | 13 | with peer.collect_sub_proto_messages() as collector: 14 | assert collector in peer._subscribers 15 | remote.sub_proto.send_broadcast_data(b"broadcast-a") 16 | remote.sub_proto.send_broadcast_data(b"broadcast-b") 17 | remote.sub_proto.send_get_sum(7, 8) 18 | remote.sub_proto.send_broadcast_data(b"broadcast-c") 19 | await asyncio.sleep(0.1) 20 | 21 | assert collector not in peer._subscribers 22 | 23 | # yield to let remote and peer transmit. 24 | 25 | all_messages = collector.get_messages() 26 | assert len(all_messages) == 4 27 | 28 | assert isinstance(all_messages[0][1], BroadcastData) 29 | assert isinstance(all_messages[1][1], BroadcastData) 30 | assert isinstance(all_messages[2][1], GetSum) 31 | assert isinstance(all_messages[3][1], BroadcastData) 32 | 33 | # make sure it isn't still collecting 34 | remote.sub_proto.send_broadcast_data(b"broadcast-d") 35 | 36 | await asyncio.sleep(0.01) 37 | 38 | assert len(collector.get_messages()) == 0 39 | -------------------------------------------------------------------------------- /quarkchain/p2p/tests/test_peer_subscriber.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import logging 3 | 4 | import pytest 5 | 6 | from quarkchain.utils import Logger 7 | 8 | from quarkchain.p2p.peer import PeerSubscriber 9 | from quarkchain.p2p.protocol import Command 10 | 11 | from quarkchain.p2p.tools.paragon import GetSum 12 | from quarkchain.p2p.tools.paragon.helpers import get_directly_linked_peers 13 | 14 | 15 | class GetSumSubscriber(PeerSubscriber): 16 | logger = Logger 17 | msg_queue_maxsize = 10 18 | subscription_msg_types = {GetSum} 19 | 20 | 21 | class AllSubscriber(PeerSubscriber): 22 | logger = Logger 23 | msg_queue_maxsize = 10 24 | subscription_msg_types = {Command} 25 | 26 | 27 | @pytest.mark.asyncio 28 | async def test_peer_subscriber_filters_messages(request, event_loop): 29 | peer, remote = await get_directly_linked_peers(request, event_loop) 30 | 31 | get_sum_subscriber = GetSumSubscriber() 32 | all_subscriber = AllSubscriber() 33 | 34 | peer.add_subscriber(get_sum_subscriber) 35 | peer.add_subscriber(all_subscriber) 36 | 37 | remote.sub_proto.send_broadcast_data(b"value-a") 38 | remote.sub_proto.send_broadcast_data(b"value-b") 39 | remote.sub_proto.send_get_sum(7, 8) 40 | remote.sub_proto.send_get_sum(1234, 4321) 41 | remote.sub_proto.send_broadcast_data(b"value-b") 42 | 43 | # yeild to let remote and peer transmit. 44 | await asyncio.sleep(0.2) 45 | 46 | assert get_sum_subscriber.queue_size == 2 47 | assert all_subscriber.queue_size == 5 48 | -------------------------------------------------------------------------------- /quarkchain/p2p/tests/test_server.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | from quarkchain.p2p.p2p_manager import encode_bytes 4 | 5 | 6 | @pytest.mark.parametrize( 7 | "data, output", 8 | ( 9 | ( 10 | b"hello", 11 | ( 12 | b"\x00\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 13 | b"hello", 14 | ), 15 | ), 16 | ( 17 | b"hello world", 18 | ( 19 | b"\x00\x00\x00\x0b\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 20 | b"hello world", 21 | ), 22 | ), 23 | ( 24 | b"It was the best of times, it was the worst of times, it was the age of wisdom", 25 | ( 26 | b"\x00\x00\x00M\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 27 | b"It was the best of times, it was the worst of times, it was the age of wisdom", 28 | ), 29 | ), 30 | ), 31 | ) 32 | def test_encode_bytes(data, output): 33 | assert encode_bytes(data) == output 34 | -------------------------------------------------------------------------------- /quarkchain/p2p/tests/test_service.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import gc 3 | import pytest 4 | 5 | from quarkchain.p2p.service import BaseService 6 | 7 | 8 | class ParentService(BaseService): 9 | """A Service which just runs WaitService with run_daemon() and waits for its cancel token to 10 | be triggered. 11 | """ 12 | 13 | async def _run(self): 14 | self.daemon = WaitService(token=self.cancel_token) 15 | self.run_daemon(self.daemon) 16 | await self.cancel_token.wait() 17 | 18 | 19 | class WaitService(BaseService): 20 | async def _run(self): 21 | await self.cancel_token.wait() 22 | 23 | 24 | @pytest.mark.asyncio 25 | async def test_daemon_exit_causes_parent_cancellation(): 26 | service = ParentService() 27 | asyncio.ensure_future(service.run()) 28 | 29 | await asyncio.sleep(0.01) 30 | 31 | assert service.daemon.is_operational 32 | assert service.daemon.is_running 33 | 34 | await service.daemon.cancel() 35 | await asyncio.sleep(0.01) 36 | 37 | assert not service.is_operational 38 | assert not service.is_running 39 | 40 | await asyncio.wait_for(service.events.cleaned_up.wait(), timeout=1) 41 | 42 | 43 | @pytest.mark.asyncio 44 | async def test_service_tasks_do_not_leak_memory(): 45 | service = WaitService() 46 | asyncio.ensure_future(service.run()) 47 | 48 | end = asyncio.Event() 49 | 50 | async def run_until_end(): 51 | await end.wait() 52 | 53 | service.run_task(run_until_end()) 54 | 55 | # inspect internals to determine if memory is leaking 56 | 57 | # confirm that task is tracked: 58 | assert len(service._tasks) == 1 59 | 60 | end.set() 61 | # allow the coro to exit 62 | await asyncio.sleep(0) 63 | 64 | # due to pypy, either use gc.collect or call service.gc() 65 | # gc.collect() # https://bitbucket.org/pypy/pypy/issues/1269/weakrefweakset-does-not-work-correctly 66 | service.gc() 67 | 68 | # confirm that task is no longer tracked: 69 | assert len(service._tasks) == 0 70 | 71 | # test cleanup 72 | await service.cancel() 73 | 74 | 75 | @pytest.mark.asyncio 76 | async def test_service_children_do_not_leak_memory(): 77 | parent = WaitService() 78 | child = WaitService() 79 | asyncio.ensure_future(parent.run()) 80 | 81 | parent.run_child_service(child) 82 | 83 | # inspect internals to determine if memory is leaking 84 | 85 | # confirm that child service is tracked: 86 | assert len(parent._child_services) == 1 87 | 88 | # give child a chance to start 89 | await asyncio.sleep(0) 90 | 91 | # ... and then end it 92 | await child.cancel() 93 | 94 | # remove the final reference to the child service 95 | del child 96 | 97 | # gc.collect() DOES NOT work here... have to use parent.gc() 98 | parent.gc() 99 | 100 | # confirm that child service is no longer tracked: 101 | assert len(parent._child_services) == 0 102 | 103 | # test cleanup 104 | await parent.cancel() 105 | -------------------------------------------------------------------------------- /quarkchain/p2p/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/p2p/tools/__init__.py -------------------------------------------------------------------------------- /quarkchain/p2p/tools/paragon/__init__.py: -------------------------------------------------------------------------------- 1 | from .commands import ( # noqa: F401 2 | BroadcastData, 3 | GetSum, 4 | Sum, 5 | ) 6 | from .proto import ( # noqa: F401 7 | ParagonProtocol, 8 | ) 9 | from .peer import ( # noqa: F401 10 | ParagonContext, 11 | ParagonPeer, 12 | ParagonPeerFactory, 13 | ParagonPeerPool, 14 | ) 15 | from .helpers import ( # noqa: F401 16 | get_directly_connected_streams, 17 | get_directly_linked_peers, 18 | get_directly_linked_peers_without_handshake, 19 | ) 20 | -------------------------------------------------------------------------------- /quarkchain/p2p/tools/paragon/commands.py: -------------------------------------------------------------------------------- 1 | from rlp import sedes 2 | 3 | from quarkchain.p2p.protocol import Command 4 | 5 | 6 | class BroadcastData(Command): 7 | _cmd_id = 0 8 | structure = [("data", sedes.binary)] 9 | 10 | 11 | class GetSum(Command): 12 | _cmd_id = 2 13 | structure = [("a", sedes.big_endian_int), ("b", sedes.big_endian_int)] 14 | 15 | 16 | class Sum(Command): 17 | _cmd_id = 3 18 | structure = [("result", sedes.big_endian_int)] 19 | -------------------------------------------------------------------------------- /quarkchain/p2p/tools/paragon/peer.py: -------------------------------------------------------------------------------- 1 | from quarkchain.p2p.peer import BasePeer, BasePeerContext, BasePeerPool, BasePeerFactory 2 | from quarkchain.p2p.protocol import Command, _DecodedMsgType 3 | 4 | from .proto import ParagonProtocol 5 | 6 | 7 | class ParagonPeer(BasePeer): 8 | _supported_sub_protocols = [ParagonProtocol] 9 | sub_proto = None # : ParagonProtocol 10 | peer_idle_timeout = None # do not timeout for connected paragon peers 11 | 12 | async def send_sub_proto_handshake(self) -> None: 13 | pass 14 | 15 | async def process_sub_proto_handshake( 16 | self, cmd: Command, msg: _DecodedMsgType 17 | ) -> None: 18 | pass 19 | 20 | async def do_sub_proto_handshake(self) -> None: 21 | pass 22 | 23 | 24 | class ParagonContext(BasePeerContext): 25 | # nothing magic here. Simply an example of how the context class can be 26 | # used to store data specific to a certain peer class. 27 | paragon = "paragon" # : str 28 | 29 | 30 | class ParagonPeerFactory(BasePeerFactory): 31 | peer_class = ParagonPeer 32 | context = None # : ParagonContext 33 | 34 | 35 | class ParagonPeerPool(BasePeerPool): 36 | peer_factory_class = ParagonPeerFactory 37 | context = None # : ParagonContext 38 | -------------------------------------------------------------------------------- /quarkchain/p2p/tools/paragon/proto.py: -------------------------------------------------------------------------------- 1 | from quarkchain.utils import Logger 2 | from quarkchain.p2p.protocol import Protocol 3 | 4 | from .commands import BroadcastData, GetSum, Sum 5 | 6 | 7 | class ParagonProtocol(Protocol): 8 | name = "paragon" 9 | version = 1 10 | _commands = [BroadcastData, GetSum, Sum] 11 | cmd_length = 3 12 | logger = Logger 13 | 14 | # 15 | # Broadcast 16 | # 17 | def send_broadcast_data(self, data: bytes) -> None: 18 | cmd = BroadcastData(self.cmd_id_offset) 19 | header, body = cmd.encode({"data": data}) 20 | self.send(header, body) 21 | 22 | # 23 | # Sum 24 | # 25 | def send_get_sum(self, value_a: int, value_b: int) -> None: 26 | cmd = GetSum(self.cmd_id_offset) 27 | header, body = cmd.encode({"a": value_a, "b": value_b}) 28 | self.send(header, body) 29 | 30 | def send_sum(self, result: int) -> None: 31 | cmd = GetSum(self.cmd_id_offset) 32 | header, body = cmd.encode({"result": result}) 33 | self.send(header, body) 34 | -------------------------------------------------------------------------------- /quarkchain/p2p/utils.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | from typing import Tuple 3 | 4 | import rlp 5 | 6 | CLUSTER_PEER_ID_LEN = 2 ** 64 7 | 8 | RESERVED_CLUSTER_PEER_ID = 0 9 | 10 | 11 | def sxor(s1: bytes, s2: bytes) -> bytes: 12 | if len(s1) != len(s2): 13 | raise ValueError("Cannot sxor strings of different length") 14 | return bytes(x ^ y for x, y in zip(s1, s2)) 15 | 16 | 17 | def roundup_16(x: int) -> int: 18 | """Rounds up the given value to the next multiple of 16.""" 19 | remainder = x % 16 20 | if remainder != 0: 21 | x += 16 - remainder 22 | return x 23 | 24 | 25 | def get_devp2p_cmd_id(msg: bytes) -> int: 26 | """Return the cmd_id for the given devp2p msg. 27 | 28 | The cmd_id, also known as the payload type, is always the first entry of the RLP, interpreted 29 | as an integer. 30 | """ 31 | return rlp.decode(msg[:1], sedes=rlp.sedes.big_endian_int) 32 | 33 | 34 | def time_since(start_time: datetime.datetime) -> Tuple[int, int, int, int]: 35 | delta = datetime.datetime.now() - start_time 36 | hours, remainder = divmod(delta.seconds, 3600) 37 | minutes, seconds = divmod(remainder, 60) 38 | return delta.days, hours, minutes, seconds 39 | 40 | 41 | # colors from devp2p/utils.py 42 | # ###### colors ############### 43 | 44 | COLOR_FAIL = "\033[91m" 45 | COLOR_BOLD = "\033[1m" 46 | COLOR_UNDERLINE = "\033[4m" 47 | COLOR_END = "\033[0m" 48 | 49 | colors = ["\033[9%dm" % i for i in range(0, 7)] 50 | colors += ["\033[4%dm" % i for i in range(1, 8)] 51 | 52 | 53 | def cstr(num, txt): 54 | return "%s%s%s" % (colors[num % len(colors)], txt, COLOR_END) 55 | 56 | 57 | def cprint(num, txt): 58 | print(cstr(num, txt)) 59 | 60 | 61 | if __name__ == "__main__": 62 | for i in range(len(colors)): 63 | cprint(i, "test") 64 | -------------------------------------------------------------------------------- /quarkchain/reward.py: -------------------------------------------------------------------------------- 1 | class ConstMinorBlockRewardCalcultor: 2 | def __init__(self, env): 3 | self.env = env 4 | 5 | def get_block_reward(self): 6 | return 100000000000000000000 7 | -------------------------------------------------------------------------------- /quarkchain/rlp/utils.py: -------------------------------------------------------------------------------- 1 | import abc 2 | import binascii 3 | from math import ceil 4 | 5 | 6 | class Atomic(type.__new__(abc.ABCMeta, "metaclass", (), {})): 7 | """ABC for objects that can be RLP encoded as is.""" 8 | 9 | pass 10 | 11 | 12 | Atomic.register(str) 13 | Atomic.register(bytes) 14 | 15 | 16 | """ 17 | from pyrlp<1.0.0 18 | """ 19 | 20 | 21 | def str_to_bytes(value): 22 | if isinstance(value, bytearray): 23 | value = bytes(value) 24 | if isinstance(value, bytes): 25 | return value 26 | return bytes(value, "utf-8") 27 | 28 | 29 | def bytes_to_str(value): 30 | if isinstance(value, str): 31 | return value 32 | return value.decode("utf-8") 33 | 34 | 35 | def ascii_chr(value): 36 | return bytes([value]) 37 | 38 | 39 | def int_to_big_endian(value): 40 | byte_length = max(ceil(value.bit_length() / 8), 1) 41 | return (value).to_bytes(byte_length, byteorder="big") 42 | 43 | 44 | def big_endian_to_int(value): 45 | return int.from_bytes(value, byteorder="big") 46 | 47 | 48 | def is_integer(value): 49 | return isinstance(value, int) 50 | 51 | 52 | def decode_hex(s): 53 | if isinstance(s, str): 54 | return bytes.fromhex(s) 55 | if isinstance(s, (bytes, bytearray)): 56 | return binascii.unhexlify(s) 57 | raise TypeError("Value must be an instance of str or bytes") 58 | 59 | 60 | def encode_hex(b): 61 | if isinstance(b, str): 62 | b = bytes(b, "utf-8") 63 | if isinstance(b, (bytes, bytearray)): 64 | return str(binascii.hexlify(b), "utf-8") 65 | raise TypeError("Value must be an instance of str or bytes") 66 | 67 | 68 | def safe_ord(c): 69 | try: 70 | return ord(c) 71 | except TypeError: 72 | assert isinstance(c, int) 73 | return c 74 | -------------------------------------------------------------------------------- /quarkchain/testnet/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/testnet/__init__.py -------------------------------------------------------------------------------- /quarkchain/testnet/addresses_to_fund.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "address": "000000000000000000000000000000000000000000000000", 4 | "value": 1000 5 | }, 6 | { 7 | "address": "111111111111111111111111111111111111111111111111", 8 | "value": 1000 9 | }, 10 | { 11 | "address": "222222222222222222222222222222222222222222222222", 12 | "value": 1000 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /quarkchain/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/tests/__init__.py -------------------------------------------------------------------------------- /quarkchain/tests/test_accounts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | 3 | import os 4 | import unittest 5 | 6 | from quarkchain.accounts import Account 7 | from quarkchain.core import Address, Identity 8 | 9 | PRIVATE_KEY = "7a28b5ba57c53603b0b07b56bba752f7784bf506fa95edc395f5cf6c7514fe9d" 10 | ADDRESS = "008aeeda4d805471df9b2a5b0f38a0c3bcba786b0000002a" 11 | 12 | 13 | class TestAccount(unittest.TestCase): 14 | def test_create_account_with_key(self): 15 | account = Account.new(key=PRIVATE_KEY) 16 | assert account.privkey == PRIVATE_KEY 17 | assert account.address == ADDRESS 18 | # check integer version of full shard id matches 19 | assert account.qkc_address.full_shard_key == int(ADDRESS[40:], 16) 20 | 21 | def test_create_random_account(self): 22 | account = Account.new() 23 | assert len(account.privkey) == 64 24 | assert len(account.qkc_address.recipient.hex()) == 40 25 | assert len(account.address) == 48 26 | identity = Identity.create_from_key(account.identity.key) 27 | assert account.address == Address.create_from_identity(identity).to_hex() 28 | 29 | def test_write_and_load_keystore(self): 30 | tmp_dir = "/tmp" 31 | account = Account.new() 32 | account.dump("a-super-secure-password", write=True, directory=tmp_dir) 33 | 34 | file_path = "{0}/{1}.json".format(tmp_dir, account.uuid) 35 | loaded = Account.load(file_path, password="a-super-secure-password") 36 | assert account.privkey == loaded.privkey 37 | assert account.address == loaded.address 38 | 39 | # cleanup 40 | os.remove(file_path) 41 | -------------------------------------------------------------------------------- /quarkchain/tests/test_utils.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | import random 3 | 4 | from quarkchain.utils import token_id_encode, token_id_decode, TOKEN_MAX, TOKEN_ID_MAX 5 | 6 | 7 | ENCODED_VALUES = [ 8 | ("0", 0), 9 | ("Z", 35), 10 | ("00", 36), 11 | ("0Z", 71), 12 | ("1Z", 107), 13 | ("20", 108), 14 | ("ZZ", 1331), 15 | ("QKC", 35760), 16 | ("ZZZZ", 1727603), 17 | ("00000", 1727604), 18 | (TOKEN_MAX, TOKEN_ID_MAX), 19 | # ("2V4D00153RFRF", 2**64-1), 20 | ] 21 | 22 | 23 | @pytest.mark.parametrize("name, id", ENCODED_VALUES) 24 | def test_token_id_encode(name, id): 25 | assert token_id_encode(name) == id 26 | assert name == token_id_decode(id) 27 | 28 | 29 | def test_random_token(): 30 | COUNT = 100000 31 | random.seed(2) 32 | for i in range(COUNT): 33 | id = random.randint(0, TOKEN_ID_MAX) 34 | assert id == token_id_encode(token_id_decode(id)) 35 | 36 | 37 | def test_token_id_exceptions(): 38 | with pytest.raises(AssertionError): 39 | token_id_encode("qkc") 40 | with pytest.raises(AssertionError): 41 | token_id_encode(" ") 42 | with pytest.raises(AssertionError): 43 | token_id_encode("btc") 44 | with pytest.raises(AssertionError): 45 | token_id_encode(TOKEN_MAX + "Z") 46 | with pytest.raises(AssertionError): 47 | token_id_decode(2 ** 64 - 1) 48 | with pytest.raises(AssertionError): 49 | token_id_decode(-1) 50 | with pytest.raises(AssertionError): 51 | token_id_decode(TOKEN_ID_MAX + 1) 52 | -------------------------------------------------------------------------------- /quarkchain/tools/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/quarkchain/tools/__init__.py -------------------------------------------------------------------------------- /quarkchain/tools/accounts: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env python3 2 | 3 | import argparse 4 | import pprint 5 | from utils import colorify 6 | 7 | from quarkchain.accounts import Account 8 | 9 | 10 | def print_account(a): 11 | print("Address: {0}".format(colorify("0x" + str(a.address), "blue"))) 12 | print( 13 | "Shard ID (uint32): {0}".format( 14 | colorify(str(a.qkc_address.full_shard_key), "green") 15 | ) 16 | ) 17 | print("Private Key: {0}".format(colorify(str(a.privkey), "red"))) 18 | print("UUID: {0}".format(colorify(str(a.uuid), "grey"))) 19 | 20 | 21 | def main(): 22 | parser = argparse.ArgumentParser() 23 | 24 | subparsers = parser.add_subparsers( 25 | title="quarkchain account management", description="commands to run", dest="cmd" 26 | ) 27 | 28 | parser_new = subparsers.add_parser( 29 | "new", description="create a new account", help="create a new account" 30 | ) 31 | parser_new.add_argument( 32 | "pw", type=str, help="passwd for encrypting your private key" 33 | ) 34 | parser_new.add_argument( 35 | "--key", 36 | default=None, 37 | type=str, 38 | help="private key you want to use if you already have one", 39 | ) 40 | parser_new.add_argument( 41 | "--dir", 42 | default=None, 43 | type=str, 44 | help="path of the directory for storing the keystore file", 45 | ) 46 | 47 | parser_load = subparsers.add_parser( 48 | "load", description="reads the keystore file specified and dumps the JSON" 49 | ) 50 | parser_load.add_argument("path", type=str, help="path to the keystore file") 51 | parser_load.add_argument( 52 | "pw", type=str, help="password for decrypting your private key" 53 | ) 54 | 55 | args = parser.parse_args() 56 | 57 | if args.cmd == "new": 58 | a = Account.new(key=args.key) 59 | print("Generated a new account: ") 60 | print_account(a) 61 | 62 | if args.dir: 63 | print("Writing keystore file (Version 3) to {0}".format(args.dir)) 64 | a.dump(args.pw, write=True, directory=args.dir) 65 | print("Success.") 66 | else: 67 | print("Raw keystore file (Version 3):") 68 | print(a.dump(args.pw, write=False)) 69 | elif args.cmd == "load": 70 | a = Account.load(args.path, args.pw) 71 | print("Loaded account: ") 72 | print_account(a) 73 | 74 | 75 | if __name__ == "__main__": 76 | main() 77 | -------------------------------------------------------------------------------- /quarkchain/tools/archivesnapshot.sh: -------------------------------------------------------------------------------- 1 | sshpass -p $PriKey scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null u446960@u446960.your-storagebox.de:public-data/VERSION VERSION 2 | 3 | filename=`cat VERSION` 4 | 5 | if [ $filename = "Archive-A.tar.gz" ]; then 6 | filename="Archive-B.tar.gz" 7 | else 8 | filename="Archive-A.tar.gz" 9 | fi 10 | echo $filename 11 | 12 | 13 | rm $filename 14 | curl https://s3-us-west-2.amazonaws.com/pyqkcmainnet/data/`curl https://s3-us-west-2.amazonaws.com/pyqkcmainnet/data/LATEST`.tar.gz --output $filename 15 | 16 | sshpass -p $PriKey scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null $filename u446960@u446960.your-storagebox.de:public-data/$filename 17 | 18 | echo $filename > VERSION 19 | 20 | sshpass -p $PriKey scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null VERSION u446960@u446960.your-storagebox.de:public-data/VERSION 21 | 22 | rm $filename -------------------------------------------------------------------------------- /quarkchain/tools/balance_by_height.py: -------------------------------------------------------------------------------- 1 | 2 | REDUCTION_FACTOR = 0.88 3 | 4 | ROOT_BLOCK_REWARD = 3.25 * 8 * 6 5 | ROOT_BLOCK_REDUCTION_SIZE = 525600 6 | 7 | MINOR_BLOCK_REWARD = 3.25 * 2 # split to root and miner block miners 8 | MINOR_BLOCK_REDUCTION_SIZE = 3153600 9 | 10 | #root_height = 1294545 11 | #shard_heights = [7600468, 7555507, 7562667, 7588454, 7595046, 7552602, 7584632, 7464263] 12 | root_height = 663132 13 | shard_heights = [3872082, 3846760, 3844333, 3867437, 3876030, 3846766, 3893407, 3816372] 14 | 15 | def get_root_reward(root_height): 16 | reward = 0 17 | block_reward = ROOT_BLOCK_REWARD 18 | while root_height != 0: 19 | height = root_height 20 | if height > ROOT_BLOCK_REDUCTION_SIZE: 21 | height = ROOT_BLOCK_REDUCTION_SIZE 22 | 23 | root_height -= height 24 | reward += height * block_reward 25 | block_reward = block_reward * REDUCTION_FACTOR 26 | return reward 27 | 28 | 29 | def get_shard_reward(shard_height): 30 | reward = 0 31 | block_reward = MINOR_BLOCK_REWARD 32 | while shard_height != 0: 33 | height = shard_height 34 | if height > MINOR_BLOCK_REDUCTION_SIZE: 35 | height = MINOR_BLOCK_REDUCTION_SIZE 36 | 37 | shard_height -= height 38 | reward += height * block_reward 39 | block_reward = block_reward * REDUCTION_FACTOR 40 | return reward 41 | 42 | 43 | def get_shards_reward(shard_heights): 44 | return sum([get_shard_reward(height) for height in shard_heights]) 45 | 46 | 47 | rreward = get_root_reward(root_height) 48 | sreward = get_shards_reward(shard_heights) 49 | print(rreward, sreward, rreward + sreward) 50 | -------------------------------------------------------------------------------- /quarkchain/tools/check_syncing_state.py: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env pypy3 2 | 3 | import argparse 4 | import logging 5 | import time 6 | from datetime import datetime 7 | import jsonrpcclient 8 | import psutil 9 | import numpy 10 | from decimal import Decimal 11 | 12 | TIMEOUT=10 13 | 14 | # disable jsonrpcclient verbose logging 15 | logging.getLogger("jsonrpcclient.client.request").setLevel(logging.WARNING) 16 | logging.getLogger("jsonrpcclient.client.response").setLevel(logging.WARNING) 17 | 18 | 19 | def now(): 20 | return datetime.now().strftime("%Y-%m-%d %H:%M:%S") 21 | 22 | def checkHeight(private_client, public_client, timeout=TIMEOUT): 23 | result_private = private_client.send( 24 | jsonrpcclient.Request("getRootBlockByHeight"), 25 | timeout=timeout,) 26 | result_public = public_client.send( 27 | jsonrpcclient.Request("getRootBlockByHeight"), 28 | timeout=timeout,) 29 | return { 30 | "height": int(result_private["height"], 16), 31 | "currentHeight": int(result_public["height"], 16), 32 | } 33 | 34 | 35 | 36 | def query_height(private_client, public_client, args): 37 | format = "{time:20} {syncing:>15}{height:>30}{currentHeight:>30}" 38 | print( 39 | format.format( 40 | time="Timestamp", 41 | syncing="Syncing", 42 | height="LocalRootHeight", 43 | currentHeight="CurrentRootHeight", 44 | ) 45 | ) 46 | while True: 47 | while True: 48 | try: 49 | data = checkHeight(private_client, public_client) 50 | break 51 | except Exception as e: 52 | print("Failed to get the current root height", e) 53 | time.sleep(2) 54 | 55 | syncing_state = (False if data["height"] >= data["currentHeight"] else True) 56 | 57 | print(format.format(time=now(), syncing=str(syncing_state), height=data["height"], currentHeight=data["currentHeight"])) 58 | 59 | if syncing_state is False: 60 | break 61 | time.sleep(args.interval) 62 | 63 | 64 | def main(): 65 | parser = argparse.ArgumentParser() 66 | parser.add_argument("--ip", default="localhost", type=str, help="Cluster IP") 67 | 68 | 69 | parser.add_argument("--bootstrapip", default="jrpc.testnet2.quarkchain.io", type=str, help="Bootstrap Cluster IP") 70 | 71 | parser.add_argument( 72 | "-i", "--interval", default=10, type=int, help="Query interval in second" 73 | ) 74 | 75 | args = parser.parse_args() 76 | 77 | private_endpoint = "http://{}:38391".format(args.ip) 78 | private_client = jsonrpcclient.HTTPClient(private_endpoint) 79 | 80 | public_endpoint = "http://{}:38391".format(args.bootstrapip) 81 | public_client = jsonrpcclient.HTTPClient(public_endpoint) 82 | 83 | 84 | 85 | 86 | query_height(private_client, public_client, args) 87 | 88 | 89 | if __name__ == "__main__": 90 | # query syncing state 91 | main() 92 | -------------------------------------------------------------------------------- /quarkchain/tools/config_p2p.py: -------------------------------------------------------------------------------- 1 | """ 2 | python config_p2p.py \ 3 | --privkey <64 character hex> \ 4 | --bootnodes enode://xxx@yyy:zzz,... 5 | 6 | will update PRIV_KEY and BOOT_NODES fields in P2P section. 7 | """ 8 | import argparse 9 | import json 10 | import os 11 | import re 12 | import socket 13 | 14 | FILE = "../../mainnet/singularity/cluster_config_template.json" 15 | if "QKC_CONFIG" in os.environ: 16 | FILE = os.environ["QKC_CONFIG"] 17 | 18 | 19 | def validate_bootnodes(bootnodes_str): 20 | """Expect comma-separated string like 'enode://<128 char pub key>@:'.""" 21 | if not bootnodes_str: 22 | return 23 | p = re.compile("^enode://([a-z0-9]+)@(.+):([0-9]+)$") 24 | for bootnode in bootnodes_str.split(","): 25 | res = p.match(bootnode) 26 | if not res: 27 | raise ValueError("Invalid boot nodes") 28 | pubkey, ip, port = res.group(1, 2, 3) 29 | if len(pubkey) != 128: 30 | raise ValueError("Invalid public key in boot nodes") 31 | try: 32 | socket.inet_aton(ip) 33 | except socket.error: 34 | raise ValueError("Invalid IP in boot nodes") 35 | if not port.isnumeric(): 36 | raise ValueError("Invalid port in boot nodes") 37 | 38 | 39 | def main(): 40 | parser = argparse.ArgumentParser() 41 | parser.add_argument("--privkey", type=str, help="Private key for P2P config") 42 | parser.add_argument("--bootnodes", type=str, help="List of bootnodes") 43 | parser.add_argument( 44 | "--only_discovery", help="Only for p2p discovery", action="store_true" 45 | ) 46 | args = parser.parse_args() 47 | 48 | privkey = args.privkey 49 | if privkey and (not privkey.isalnum() or len(privkey) != 64): 50 | raise ValueError("Invalid private key") 51 | 52 | validate_bootnodes(args.bootnodes) 53 | 54 | abspath = os.path.abspath(__file__) 55 | dname = os.path.dirname(abspath) 56 | os.chdir(dname) 57 | 58 | with open(FILE, "r+") as f: 59 | parsed_config = json.load(f) 60 | if "P2P" not in parsed_config: 61 | raise ValueError("P2P not found in config") 62 | p2p = parsed_config["P2P"] 63 | p2p["PRIV_KEY"] = privkey or "" 64 | p2p["BOOT_NODES"] = args.bootnodes or "" 65 | if args.only_discovery: 66 | p2p["DISCOVERY_ONLY"] = True 67 | p2p["MAX_PEERS"] = 0 68 | p2p["BOOT_NODES"] = "" # Overwrite. 69 | f.seek(0) 70 | f.truncate() 71 | f.write(json.dumps(parsed_config, indent=4)) 72 | 73 | 74 | if __name__ == "__main__": 75 | main() 76 | -------------------------------------------------------------------------------- /quarkchain/tools/config_slave.py: -------------------------------------------------------------------------------- 1 | """ 2 | python config_slave.py 127.0.0.1 38000 38006 127.0.0.2 18999 18002 3 | 4 | will generate 4 slave server configs accordingly. will be used in deployment automation to configure a cluster. 5 | usage: python config_slave.py ... 6 | """ 7 | import argparse 8 | import collections 9 | import json 10 | import os 11 | 12 | FILE = "../../testnet/2/cluster_config_template.json" 13 | if "QKC_CONFIG" in os.environ: 14 | FILE = os.environ["QKC_CONFIG"] 15 | 16 | 17 | def main(): 18 | parser = argparse.ArgumentParser() 19 | parser.add_argument( 20 | "hostports", 21 | nargs="+", 22 | metavar="hostports", 23 | help="Host and ports for slave config", 24 | ) 25 | args = parser.parse_args() 26 | 27 | abspath = os.path.abspath(__file__) 28 | dname = os.path.dirname(abspath) 29 | os.chdir(dname) 30 | 31 | ############### 32 | # parse hosts and ports to form a slave list 33 | ############### 34 | 35 | host_port_mapping = collections.defaultdict(list) 36 | last_host = None 37 | for host_or_port in args.hostports: # type: str 38 | if not host_or_port.isdigit(): # host 39 | last_host = host_or_port 40 | else: # port 41 | host_port_mapping[last_host].append(host_or_port) 42 | 43 | assert None not in host_port_mapping 44 | slave_num = sum(len(port_list) for port_list in host_port_mapping.values()) 45 | # make sure number of slaves is power of 2 46 | assert slave_num > 0 and (slave_num & (slave_num - 1) == 0) 47 | 48 | slave_servers, i = [], 0 49 | 50 | raise ValueError("CHAIN_MASK_LIST deprecated, please update the code before using") 51 | 52 | for host, port_list in host_port_mapping.items(): 53 | for port in port_list: 54 | s = { 55 | "HOST": host, 56 | "PORT": int(port), 57 | "ID": "S%d" % i, 58 | "CHAIN_MASK_LIST": [i | slave_num], 59 | } 60 | slave_servers.append(s) 61 | i += 1 62 | 63 | ############### 64 | # read config file and substitute with updated slave config 65 | ############### 66 | 67 | with open(FILE, "r+") as f: 68 | parsed_config = json.load(f) 69 | parsed_config["SLAVE_LIST"] = slave_servers 70 | f.seek(0) 71 | f.truncate() 72 | f.write(json.dumps(parsed_config, indent=4)) 73 | 74 | 75 | if __name__ == "__main__": 76 | main() 77 | -------------------------------------------------------------------------------- /quarkchain/tools/external_miner_manager.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -u; set -e 4 | 5 | type jq >/dev/null 2>&1 || { echo >&2 "Please install jq."; exit 1; } 6 | 7 | # c -> config, p -> process number, t -> threads per miner process 8 | # eg: external_miner_manager.sh -c ~/Documents/config.json -p 8 -h localhost 9 | while getopts ":c:p:t:h:" opt; do 10 | case ${opt} in 11 | c ) 12 | config=$OPTARG 13 | ;; 14 | p ) 15 | process=$OPTARG 16 | ;; 17 | h ) 18 | host=$OPTARG 19 | ;; 20 | \? ) 21 | echo "Invalid option: $OPTARG" 1>&2 22 | exit 1 23 | ;; 24 | : ) 25 | echo "Invalid option: $OPTARG requires an argument" 1>&2 26 | exit 1 27 | ;; 28 | esac 29 | done 30 | shift $((OPTIND -1)) 31 | 32 | # TODO: following full shard key encoding only works for testnet2.4 33 | shards_by_process=() 34 | for chain_id in $(seq 0 7); do 35 | shard=16#${chain_id}0001 36 | shards_by_process[$(( chain_id % $process ))]+=" $(($shard))" 37 | done 38 | 39 | miner_py_path="$( cd "$(dirname "$0")" ; pwd -P )/external_miner.py" 40 | for shards_per_process in "${shards_by_process[@]}"; do 41 | python3 $miner_py_path \ 42 | --host $host \ 43 | --config $config \ 44 | --worker 1 \ 45 | --shards $shards_per_process & 46 | done 47 | 48 | wait 49 | -------------------------------------------------------------------------------- /quarkchain/tools/newkey.py: -------------------------------------------------------------------------------- 1 | """ 2 | This is a command line tool for generating private key used in QuarkChain Network 3 | """ 4 | from quarkchain.p2p import ecies 5 | 6 | 7 | def main(): 8 | privkey = ecies.generate_privkey() 9 | print("Here is a new SECP256K1 private key, please keep it in a safe place:") 10 | print("*" * 50) 11 | print(privkey.to_bytes().hex()) 12 | print("*" * 50) 13 | print("You can pass it to --privkey when running cluster.py") 14 | print( 15 | "If you want to use the key for bootnode, here is what you want others to use (replace IP/PORT):" 16 | ) 17 | print("*" * 50) 18 | print("enode://{}@IP:PORT".format(privkey.public_key.to_bytes().hex())) 19 | print("*" * 50) 20 | 21 | 22 | if __name__ == "__main__": 23 | main() 24 | -------------------------------------------------------------------------------- /quarkchain/tools/pypy-fix-cython-warning.pth: -------------------------------------------------------------------------------- 1 | import warnings; warnings.filterwarnings("ignore", "builtins.type size changed, may indicate binary incompatibility. Expected .*, got .*") 2 | -------------------------------------------------------------------------------- /quarkchain/tools/quick_miner_stopper.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | pkill -f master.py 4 | 5 | pkill -f slave.py 6 | 7 | pkill -f external_miner.py 8 | 9 | pkill -f check_syncing_state.py 10 | 11 | screen -ls | grep -i detached | cut -d. -f1 | tr -d [:blank:] | xargs kill 12 | 13 | wait -------------------------------------------------------------------------------- /quarkchain/tools/quick_miner_tool.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | screen -dmS jobs 4 | 5 | clear 6 | 7 | echo "Step 1: Enter or generate your coinbase address!" 8 | 9 | while true; do 10 | read -p "Do you wish to set the coinbase address?(Y or N)" yn 11 | case $yn in 12 | [Yy]* ) 13 | miner_tools_path="$(pwd -P)/quarkchain/tools/miner_address.py" 14 | python3 $miner_tools_path 15 | break;; 16 | [Nn]* ) 17 | break;; 18 | * ) echo "Please answer Y or N.";; 19 | esac 20 | done 21 | 22 | 23 | 24 | 25 | 26 | echo "Step 2: Download a snapshot of the database. Your cluster only need to sync 27 | the blocks mined in the past 12 hours or less." 28 | 29 | 30 | curl https://s3-us-west-2.amazonaws.com/testnet2/data/24/`curl https://s3-us-west-2.amazonaws.com/testnet2/data/24/LATEST`.tar.gz --output data.tar.gz 31 | 32 | tar xvfz data.tar.gz 33 | 34 | miner_data_path="$(pwd -P)/quarkchain/cluster/qkc-data/" 35 | 36 | rm -rf $miner_data_path 37 | 38 | mv data $miner_data_path 39 | 40 | 41 | screen -S jobs -X screen bash 42 | 43 | screen -S jobs -p bash -X title cluster 44 | 45 | 46 | screen -S jobs -p cluster -X stuff $'python3 quarkchain/cluster/cluster.py --cluster_config "$(pwd -P)/testnet/2.4/cluster_config_template.json" 47 | ' 48 | 49 | 50 | seconds_left=20 51 | 52 | echo "Step 3: Initiate the cluster and start synchorizing blocks in the past 12 hours or less. Please wait for time: ${seconds_left} seconds……" 53 | while [ $seconds_left -gt 0 ];do 54 | echo -n "${seconds_left} seconds left" 55 | sleep 1 56 | seconds_left=$(($seconds_left - 1)) 57 | echo -ne "\r \r" 58 | done 59 | 60 | echo "Step 4: Start synchorizing blocks in the past 12 hours or less. It takes about five minutes. Be patient!" 61 | python3 quarkchain/tools/check_syncing_state.py 62 | 63 | 64 | while true; do 65 | read -p "Step 4: Do you wish to start mining now?(Y or N)" yn 66 | case $yn in 67 | [Yy]* ) 68 | screen -S jobs -X screen bash; 69 | screen -S jobs -p bash -X title miners; 70 | screen -S jobs -p miners -X stuff $'bash quarkchain/tools/external_miner_manager.sh -c "$(pwd -P)/testnet/2.4/cluster_config_template.json" -p 8 -h localhost 71 | '; 72 | break;; 73 | [Nn]* ) bash quarkchain/tools/quick_miner_stopper.sh 74 | exit;; 75 | * ) echo "Please answer Y or N.";; 76 | esac 77 | done 78 | 79 | screen -rd 80 | 81 | wait 82 | -------------------------------------------------------------------------------- /quarkchain/tools/tests/test_monitoring.py: -------------------------------------------------------------------------------- 1 | import unittest 2 | from quarkchain.tools.monitoring import crawl_recursive, crawl_bfs 3 | 4 | 5 | class TestCrawl(unittest.TestCase): 6 | def test_crawl(self): 7 | cache = {} 8 | res = {} 9 | # crawl_recursive(cache, "54.152.237.112", 38291, 38291 + 200, ip_lookup={}) 10 | # res = crawl_bfs("54.152.237.112", 38291, 38291 + 200) 11 | dfs = {k: set(v) for k, v in cache.items()} 12 | bfs = {k: set(v) for k, v in res.items()} 13 | self.assertEqual(dfs, bfs) 14 | -------------------------------------------------------------------------------- /quarkchain/tools/token_id.py: -------------------------------------------------------------------------------- 1 | import argparse 2 | 3 | from quarkchain.utils import token_id_encode, token_id_decode 4 | 5 | 6 | parser = argparse.ArgumentParser() 7 | parser.add_argument("--name", type=str, default=None, help="name to id") 8 | parser.add_argument("--id", type=int, default=None, help="id to name") 9 | 10 | 11 | def main(): 12 | args = parser.parse_args() 13 | 14 | if args.name is not None: 15 | print( 16 | "Token name %s to id: %d (%s)" 17 | % (args.name, token_id_encode(args.name), hex(token_id_encode(args.name))) 18 | ) 19 | 20 | if args.id is not None: 21 | print( 22 | "Token id %d (%s) to id: %s" 23 | % (args.id, hex(args.id), token_id_decode(args.id)) 24 | ) 25 | 26 | 27 | if __name__ == "__main__": 28 | main() 29 | -------------------------------------------------------------------------------- /quarkchain/tools/utils.py: -------------------------------------------------------------------------------- 1 | def colorify(s, color): 2 | color_map = { 3 | "grey": "\033[90m", 4 | "red": "\033[91m", 5 | "green": "\033[92m", 6 | "yellow": "\033[93m", 7 | "purple": "\033[94m", 8 | "pink": "\033[95m", 9 | "blue": "\033[96m", 10 | } 11 | 12 | return color_map[color] + s + "\033[0m" 13 | 14 | 15 | def underline(s): 16 | return "\033[4m" + s + "\033[0m" 17 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.1.3 2 | aioprocessing==1.0.1 3 | async_armor==0.0.2 4 | coincurve==7.1.0 5 | decorator==4.2.1 6 | ecdsa==0.13.3 7 | jsonrpcclient==2.5.2 8 | jsonrpcserver==3.5.4 9 | jsonrpc-async==0.6 10 | numpy==1.15.1 11 | psutil==5.6.6 12 | python-rocksdb==0.6.9 13 | requests==2.20.0 14 | aiohttp_cors==0.7.0 15 | eth-utils==1.2.0 16 | eth-keys==0.2.0b3 17 | eth-bloom==1.0.0 18 | pyethash>=0.1.27,<1.0.0 19 | py_ecc==1.4.3 20 | eth-hash[pycryptodome]==0.1.4 21 | pytest-timeout==1.3.3 22 | cachetools==3.1.1 23 | websockets==8.0.2 24 | 25 | # p2p 26 | pytest>=3.6,<3.7 27 | pytest-asyncio==0.9.0 28 | cryptography==2.3.1 29 | upnpclient==0.0.8 30 | netifaces==0.10.7 31 | rlp>=1.0.0,<2.0.0 32 | 33 | # pyethapp/accounts.py dependency 34 | pbkdf2 35 | -------------------------------------------------------------------------------- /resources/dapp/step1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step1.png -------------------------------------------------------------------------------- /resources/dapp/step2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step2.png -------------------------------------------------------------------------------- /resources/dapp/step3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step3.png -------------------------------------------------------------------------------- /resources/dapp/step4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step4.png -------------------------------------------------------------------------------- /resources/dapp/step5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step5.png -------------------------------------------------------------------------------- /resources/dapp/step6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step6.png -------------------------------------------------------------------------------- /resources/dapp/step7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step7.png -------------------------------------------------------------------------------- /resources/dapp/step8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/QuarkChain/pyquarkchain/ec3f952e81210da9ca786ff695d36fb597df2131/resources/dapp/step8.png -------------------------------------------------------------------------------- /run_cluster.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ${PYTHON:=python3} quarkchain/cluster/cluster.py --cluster_config $(realpath mainnet/singularity/cluster_config_template${QKC_CONFIG_EXT:=}.json) "$@" 4 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from setuptools import setup 4 | from setuptools.command.develop import develop 5 | 6 | install_requires = set(x.strip() for x in open("requirements.txt")) 7 | install_requires_replacements = {} 8 | install_requires = [install_requires_replacements.get(r, r) for r in install_requires] 9 | PTH = "pypy-fix-cython-warning.pth" 10 | 11 | # Utility function to read the README file. 12 | # Used for the long_description. It's nice, because now 1) we have a top level 13 | # README file and 2) it's easier to type in the README file than to put a raw 14 | # string in below ... 15 | 16 | 17 | class custom_develop(develop): 18 | @property 19 | def target(self): 20 | return os.path.join(self.install_dir, PTH) 21 | 22 | def run(self): 23 | print(self.install_dir) 24 | with open("quarkchain/tools/" + PTH) as infp: 25 | with open(self.target, "w") as outfp: 26 | outfp.write(infp.read()) 27 | develop.run(self) 28 | 29 | 30 | def read(fname): 31 | return open(os.path.join(os.path.dirname(__file__), fname)).read() 32 | 33 | 34 | setup( 35 | name="quarkchain", 36 | version="0.0", 37 | author="QuarkChain", 38 | author_email="", 39 | description=("QuarkChain"), 40 | license="MIT", 41 | keywords="QuarkChain,blockchain", 42 | url="", 43 | packages=["quarkchain"], 44 | long_description=read("README.md"), 45 | classifiers=["Development Status :: 0 - Development", "License :: MIT License"], 46 | install_requires=install_requires, 47 | python_requires=">=3.5", 48 | cmdclass={"develop": custom_develop}, 49 | ) 50 | --------------------------------------------------------------------------------