From 777fcbd12ef01f3a63b0a27317ad402aff6d611b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 21 Apr 2015 13:13:49 +0200 Subject: [PATCH 001/169] Port to LLVM 3.7 --- evmjit/libevmjit/Array.cpp | 20 ++++++++++---------- evmjit/libevmjit/Cache.cpp | 17 +++++++---------- evmjit/libevmjit/Cache.h | 4 ++-- evmjit/libevmjit/ExecutionEngine.cpp | 13 ++++++------- evmjit/libevmjit/Optimizer.cpp | 4 ++-- evmjit/libevmjit/RuntimeManager.cpp | 12 ++++++------ evmjit/libevmjit/Type.h | 5 +++-- 7 files changed, 36 insertions(+), 39 deletions(-) diff --git a/evmjit/libevmjit/Array.cpp b/evmjit/libevmjit/Array.cpp index 3266038db..b3d3cc0bb 100644 --- a/evmjit/libevmjit/Array.cpp +++ b/evmjit/libevmjit/Array.cpp @@ -47,9 +47,9 @@ llvm::Function* Array::createArrayPushFunc() auto pushBB = llvm::BasicBlock::Create(m_builder.getContext(), "Push", func); m_builder.SetInsertPoint(entryBB); - auto dataPtr = m_builder.CreateStructGEP(arrayPtr, 0, "dataPtr"); - auto sizePtr = m_builder.CreateStructGEP(arrayPtr, 1, "sizePtr"); - auto capPtr = m_builder.CreateStructGEP(arrayPtr, 2, "capPtr"); + auto dataPtr = m_builder.CreateStructGEP(getType(), arrayPtr, 0, "dataPtr"); + auto sizePtr = m_builder.CreateStructGEP(getType(), arrayPtr, 1, "sizePtr"); + auto capPtr = m_builder.CreateStructGEP(getType(), arrayPtr, 2, "capPtr"); auto data = m_builder.CreateLoad(dataPtr, "data"); auto size = m_builder.CreateLoad(sizePtr, "size"); auto cap = m_builder.CreateLoad(capPtr, "cap"); @@ -96,7 +96,7 @@ llvm::Function* Array::createArraySetFunc() InsertPointGuard guard{m_builder}; m_builder.SetInsertPoint(llvm::BasicBlock::Create(m_builder.getContext(), {}, func)); - auto dataPtr = m_builder.CreateStructGEP(arrayPtr, 0, "dataPtr"); + auto dataPtr = m_builder.CreateStructGEP(getType(), arrayPtr, 0, "dataPtr"); auto data = m_builder.CreateLoad(dataPtr, "data"); auto valuePtr = m_builder.CreateGEP(data, index, "valuePtr"); m_builder.CreateStore(value, valuePtr); @@ -118,7 +118,7 @@ llvm::Function* Array::createArrayGetFunc() InsertPointGuard guard{m_builder}; m_builder.SetInsertPoint(llvm::BasicBlock::Create(m_builder.getContext(), {}, func)); - auto dataPtr = m_builder.CreateStructGEP(arrayPtr, 0, "dataPtr"); + auto dataPtr = m_builder.CreateStructGEP(getType(), arrayPtr, 0, "dataPtr"); auto data = m_builder.CreateLoad(dataPtr, "data"); auto valuePtr = m_builder.CreateGEP(data, index, "valuePtr"); auto value = m_builder.CreateLoad(valuePtr, "value"); @@ -163,7 +163,7 @@ llvm::Function* Array::createFreeFunc() InsertPointGuard guard{m_builder}; m_builder.SetInsertPoint(llvm::BasicBlock::Create(m_builder.getContext(), {}, func)); - auto dataPtr = m_builder.CreateStructGEP(arrayPtr, 0, "dataPtr"); + auto dataPtr = m_builder.CreateStructGEP(getType(), arrayPtr, 0, "dataPtr"); auto data = m_builder.CreateLoad(dataPtr, "data"); auto mem = m_builder.CreateBitCast(data, Type::BytePtr, "mem"); m_builder.CreateCall(freeFunc, mem); @@ -199,8 +199,8 @@ llvm::Function* Array::createExtendFunc() InsertPointGuard guard{m_builder}; m_builder.SetInsertPoint(llvm::BasicBlock::Create(m_builder.getContext(), {}, func)); auto dataPtr = m_builder.CreateBitCast(arrayPtr, Type::BytePtr->getPointerTo(), "dataPtr");// TODO: Use byte* in Array - auto sizePtr = m_builder.CreateStructGEP(arrayPtr, 1, "sizePtr"); - auto capPtr = m_builder.CreateStructGEP(arrayPtr, 2, "capPtr"); + auto sizePtr = m_builder.CreateStructGEP(getType(), arrayPtr, 1, "sizePtr"); + auto capPtr = m_builder.CreateStructGEP(getType(), arrayPtr, 2, "capPtr"); auto data = m_builder.CreateLoad(dataPtr, "data"); auto size = m_builder.CreateLoad(sizePtr, "size"); auto extSize = m_builder.CreateNUWSub(newSize, size, "extSize"); @@ -246,7 +246,7 @@ Array::Array(llvm::IRBuilder<>& _builder, llvm::Value* _array) : void Array::pop(llvm::Value* _count) { - auto sizePtr = m_builder.CreateStructGEP(m_array, 1, "sizePtr"); + auto sizePtr = m_builder.CreateStructGEP(getType(), m_array, 1, "sizePtr"); auto size = m_builder.CreateLoad(sizePtr, "size"); auto newSize = m_builder.CreateNUWSub(size, _count, "newSize"); m_builder.CreateStore(newSize, sizePtr); @@ -254,7 +254,7 @@ void Array::pop(llvm::Value* _count) llvm::Value* Array::size(llvm::Value* _array) { - auto sizePtr = m_builder.CreateStructGEP(_array ? _array : m_array, 1, "sizePtr"); + auto sizePtr = m_builder.CreateStructGEP(getType(), _array ? _array : m_array, 1, "sizePtr"); return m_builder.CreateLoad(sizePtr, "array.size"); } diff --git a/evmjit/libevmjit/Cache.cpp b/evmjit/libevmjit/Cache.cpp index 47a6386e9..aa316d51d 100644 --- a/evmjit/libevmjit/Cache.cpp +++ b/evmjit/libevmjit/Cache.cpp @@ -24,7 +24,7 @@ namespace jit namespace { CacheMode g_mode; - llvm::MemoryBuffer* g_lastObject; + std::unique_ptr g_lastObject; ExecutionEngineListener* g_listener; static const size_t c_versionStampLength = 32; @@ -79,8 +79,7 @@ void Cache::preload(llvm::ExecutionEngine& _ee, std::unordered_map Cache::getObject(std::string const& id) } -void ObjectCache::notifyObjectCompiled(llvm::Module const* _module, llvm::MemoryBuffer const* _object) +void ObjectCache::notifyObjectCompiled(llvm::Module const* _module, llvm::MemoryBufferRef _object) { // Only in "on" and "write" mode if (g_mode != CacheMode::on && g_mode != CacheMode::write) @@ -154,17 +153,15 @@ void ObjectCache::notifyObjectCompiled(llvm::Module const* _module, llvm::Memory llvm::sys::path::append(cachePath, id); DLOG(cache) << id << ": write\n"; - std::string error; + std::error_code error; llvm::raw_fd_ostream cacheFile(cachePath.c_str(), error, llvm::sys::fs::F_None); - cacheFile << _object->getBuffer() << getLibVersionStamp(); + cacheFile << _object.getBuffer() << getLibVersionStamp(); } -llvm::MemoryBuffer* ObjectCache::getObject(llvm::Module const* _module) +std::unique_ptr ObjectCache::getObject(llvm::Module const* _module) { DLOG(cache) << _module->getModuleIdentifier() << ": use\n"; - auto o = g_lastObject; - g_lastObject = nullptr; - return o; + return std::move(g_lastObject); } } diff --git a/evmjit/libevmjit/Cache.h b/evmjit/libevmjit/Cache.h index f6a0a3400..6b8457f4b 100644 --- a/evmjit/libevmjit/Cache.h +++ b/evmjit/libevmjit/Cache.h @@ -32,13 +32,13 @@ class ObjectCache : public llvm::ObjectCache { public: /// notifyObjectCompiled - Provides a pointer to compiled code for Module M. - virtual void notifyObjectCompiled(llvm::Module const* _module, llvm::MemoryBuffer const* _object) final override; + virtual void notifyObjectCompiled(llvm::Module const* _module, llvm::MemoryBufferRef _object) final override; /// getObjectCopy - Returns a pointer to a newly allocated MemoryBuffer that /// contains the object which corresponds with Module M, or 0 if an object is /// not available. The caller owns both the MemoryBuffer returned by this /// and the memory it references. - virtual llvm::MemoryBuffer* getObject(llvm::Module const* _module) final override; + virtual std::unique_ptr getObject(llvm::Module const* _module) final override; }; diff --git a/evmjit/libevmjit/ExecutionEngine.cpp b/evmjit/libevmjit/ExecutionEngine.cpp index e15dad969..9bd767158 100644 --- a/evmjit/libevmjit/ExecutionEngine.cpp +++ b/evmjit/libevmjit/ExecutionEngine.cpp @@ -131,20 +131,20 @@ ReturnCode ExecutionEngine::run(RuntimeData* _data, Env* _env) llvm::InitializeNativeTargetAsmPrinter(); auto module = std::unique_ptr(new llvm::Module({}, llvm::getGlobalContext())); - llvm::EngineBuilder builder(module.get()); - builder.setEngineKind(llvm::EngineKind::JIT); - builder.setUseMCJIT(true); - builder.setOptLevel(g_optimize ? llvm::CodeGenOpt::Default : llvm::CodeGenOpt::None); + // FIXME: LLVM 3.7: test on Windows auto triple = llvm::Triple(llvm::sys::getProcessTriple()); if (triple.getOS() == llvm::Triple::OSType::Win32) triple.setObjectFormat(llvm::Triple::ObjectFormatType::ELF); // MCJIT does not support COFF format module->setTargetTriple(triple.str()); + llvm::EngineBuilder builder(std::move(module)); + builder.setEngineKind(llvm::EngineKind::JIT); + builder.setOptLevel(g_optimize ? llvm::CodeGenOpt::Default : llvm::CodeGenOpt::None); + ee.reset(builder.create()); if (!CHECK(ee)) return ReturnCode::LLVMConfigError; - module.release(); // Successfully created llvm::ExecutionEngine takes ownership of the module ee->setObjectCache(objectCache); if (preloadCache) @@ -179,8 +179,7 @@ ReturnCode ExecutionEngine::run(RuntimeData* _data, Env* _env) if (g_dump) module->dump(); - ee->addModule(module.get()); - module.release(); + ee->addModule(std::move(module)); listener->stateChanged(ExecState::CodeGen); entryFuncPtr = (EntryFuncPtr)ee->getFunctionAddress(mainFuncName); } diff --git a/evmjit/libevmjit/Optimizer.cpp b/evmjit/libevmjit/Optimizer.cpp index 84a7c3a6a..731fda5c6 100644 --- a/evmjit/libevmjit/Optimizer.cpp +++ b/evmjit/libevmjit/Optimizer.cpp @@ -1,7 +1,7 @@ #include "Optimizer.h" #include "preprocessor/llvm_includes_start.h" -#include +#include #include #include #include "preprocessor/llvm_includes_end.h" @@ -15,7 +15,7 @@ namespace jit bool optimize(llvm::Module& _module) { - auto pm = llvm::PassManager{}; + auto pm = llvm::legacy::PassManager{}; //pm.add(llvm::createFunctionInliningPass(2, 2)); // Produces invalid IR pm.add(llvm::createCFGSimplificationPass()); //pm.add(llvm::createInstructionCombiningPass()); // Produces invalid runtime results diff --git a/evmjit/libevmjit/RuntimeManager.cpp b/evmjit/libevmjit/RuntimeManager.cpp index dc7bc24a3..5c66a5a21 100644 --- a/evmjit/libevmjit/RuntimeManager.cpp +++ b/evmjit/libevmjit/RuntimeManager.cpp @@ -93,13 +93,13 @@ RuntimeManager::RuntimeManager(llvm::IRBuilder<>& _builder, code_iterator _codeB // Unpack data auto rtPtr = getRuntimePtr(); - m_dataPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(rtPtr, 0), "data"); + m_dataPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(getRuntimeType(), rtPtr, 0), "data"); assert(m_dataPtr->getType() == Type::RuntimeDataPtr); - m_gasPtr = m_builder.CreateStructGEP(m_dataPtr, 0, "gas"); + m_gasPtr = m_builder.CreateStructGEP(getRuntimeDataType(), m_dataPtr, 0, "gas"); assert(m_gasPtr->getType() == Type::Gas->getPointerTo()); - m_memPtr = m_builder.CreateStructGEP(rtPtr, 2, "mem"); + m_memPtr = m_builder.CreateStructGEP(getRuntimeType(), rtPtr, 2, "mem"); assert(m_memPtr->getType() == Array::getType()->getPointerTo()); - m_envPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(rtPtr, 1), "env"); + m_envPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(getRuntimeType(), rtPtr, 1), "env"); assert(m_envPtr->getType() == Type::EnvPtr); m_stackSize = m_builder.CreateAlloca(Type::Size, nullptr, "stackSize"); @@ -160,7 +160,7 @@ llvm::Value* RuntimeManager::getDataPtr() return m_dataPtr; auto rtPtr = getRuntimePtr(); - auto dataPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(rtPtr, 0), "data"); + auto dataPtr = m_builder.CreateLoad(m_builder.CreateStructGEP(getRuntimeType(), rtPtr, 0), "data"); assert(dataPtr->getType() == getRuntimeDataType()->getPointerTo()); return dataPtr; } @@ -173,7 +173,7 @@ llvm::Value* RuntimeManager::getEnvPtr() llvm::Value* RuntimeManager::getPtr(RuntimeData::Index _index) { - auto ptr = getBuilder().CreateStructGEP(getDataPtr(), _index); + auto ptr = getBuilder().CreateStructGEP(getRuntimeDataType(), getDataPtr(), _index); assert(getRuntimeDataType()->getElementType(_index)->getPointerTo() == ptr->getType()); return ptr; } diff --git a/evmjit/libevmjit/Type.h b/evmjit/libevmjit/Type.h index ffacc5407..fcca98d74 100644 --- a/evmjit/libevmjit/Type.h +++ b/evmjit/libevmjit/Type.h @@ -2,8 +2,9 @@ #include "preprocessor/llvm_includes_start.h" #include -#include -#include "preprocessor/llvm_includes_end.h" +#include +#include +#include "preprocessor/llvm_includes_end.h" // FIXME: LLVM 3.7: check if needed #include "Common.h" From 56c3d1858201a3956ce669b03875ebac060e9b3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 21 Apr 2015 16:23:01 +0200 Subject: [PATCH 002/169] Remove some LLVM 3.5 bugs workarounds --- evmjit/libevmjit/Arith256.cpp | 11 ---------- evmjit/libevmjit/Compiler.cpp | 8 ++----- evmjit/libevmjit/Endianness.cpp | 5 ++--- evmjit/libevmjit/ExecutionEngine.cpp | 15 +------------ evmjit/libevmjit/GasMeter.cpp | 22 +++++-------------- evmjit/libevmjit/Optimizer.cpp | 4 ++-- .../preprocessor/llvm_includes_end.h | 4 ---- .../preprocessor/llvm_includes_start.h | 8 ------- 8 files changed, 13 insertions(+), 64 deletions(-) diff --git a/evmjit/libevmjit/Arith256.cpp b/evmjit/libevmjit/Arith256.cpp index e88fda432..029eb9370 100644 --- a/evmjit/libevmjit/Arith256.cpp +++ b/evmjit/libevmjit/Arith256.cpp @@ -170,18 +170,7 @@ llvm::Function* Arith256::getDivFunc(llvm::Type* _type) auto yLz = m_builder.CreateCall2(ctlzIntr, yArg, m_builder.getInt1(true), "y.lz"); auto rLz = m_builder.CreateCall2(ctlzIntr, r0, m_builder.getInt1(true), "r.lz"); auto i0 = m_builder.CreateNUWSub(yLz, rLz, "i0"); - auto shlBy0 = m_builder.CreateICmpEQ(i0, zero); auto y0 = m_builder.CreateShl(yArg, i0); - if (_type == m_builder.getIntNTy(512)) // Workaround for shl bug for long shifts - { - const auto treshold = m_builder.getIntN(512, 128); - auto highShift = m_builder.CreateICmpUGT(i0, treshold); - auto s = m_builder.CreateNUWSub(i0, treshold); - auto yhs = m_builder.CreateShl(yArg, treshold); - yhs = m_builder.CreateShl(yhs, s); - y0 = m_builder.CreateSelect(highShift, yhs, y0); - } - y0 = m_builder.CreateSelect(shlBy0, yArg, y0, "y0"); // Workaround for LLVM bug: shl by 0 produces wrong result m_builder.CreateBr(loopBB); m_builder.SetInsertPoint(loopBB); diff --git a/evmjit/libevmjit/Compiler.cpp b/evmjit/libevmjit/Compiler.cpp index 1e1f8fe93..d5cb493ab 100644 --- a/evmjit/libevmjit/Compiler.cpp +++ b/evmjit/libevmjit/Compiler.cpp @@ -464,12 +464,8 @@ void Compiler::compileBasicBlock(BasicBlock& _basicBlock, RuntimeManager& _runti // test for word >> (k * 8 + 7) auto bitpos = m_builder.CreateAdd(k32x8, m_builder.getInt64(7), "bitpos"); auto bitposEx = m_builder.CreateZExt(bitpos, Type::Word); - auto bittester = m_builder.CreateShl(Constant::get(1), bitposEx); - auto bitresult = m_builder.CreateAnd(word, bittester); - auto bittest = m_builder.CreateICmpUGT(bitresult, Constant::get(0)); - // FIXME: The following does not work - LLVM bug, report! - //auto bitval = m_builder.CreateLShr(word, bitpos, "bitval"); - //auto bittest = m_builder.CreateTrunc(bitval, Type::Bool, "bittest"); + auto bitval = m_builder.CreateLShr(word, bitposEx, "bitval"); + auto bittest = m_builder.CreateTrunc(bitval, Type::Bool, "bittest"); auto mask_ = m_builder.CreateShl(Constant::get(1), bitposEx); auto mask = m_builder.CreateSub(mask_, Constant::get(1), "mask"); diff --git a/evmjit/libevmjit/Endianness.cpp b/evmjit/libevmjit/Endianness.cpp index d36f4b7fa..25b66c0d5 100644 --- a/evmjit/libevmjit/Endianness.cpp +++ b/evmjit/libevmjit/Endianness.cpp @@ -18,9 +18,8 @@ llvm::Value* Endianness::bswapIfLE(llvm::IRBuilder<>& _builder, llvm::Value* _wo { if (llvm::sys::IsLittleEndianHost) { - // FIXME: Disabled because of problems with BYTE - //if (auto constant = llvm::dyn_cast(_word)) - // return _builder.getInt(constant->getValue().byteSwap()); + if (auto constant = llvm::dyn_cast(_word)) + return _builder.getInt(constant->getValue().byteSwap()); // OPT: Cache func declaration? auto bswapFunc = llvm::Intrinsic::getDeclaration(_builder.GetInsertBlock()->getParent()->getParent(), llvm::Intrinsic::bswap, Type::Word); diff --git a/evmjit/libevmjit/ExecutionEngine.cpp b/evmjit/libevmjit/ExecutionEngine.cpp index 9bd767158..fba9cfd96 100644 --- a/evmjit/libevmjit/ExecutionEngine.cpp +++ b/evmjit/libevmjit/ExecutionEngine.cpp @@ -85,20 +85,7 @@ void parseOptions() { static llvm::llvm_shutdown_obj shutdownObj{}; cl::AddExtraVersionPrinter(printVersion); - //cl::ParseEnvironmentOptions("evmjit", "EVMJIT", "Ethereum EVM JIT Compiler"); - - // FIXME: LLVM workaround: - // Manually select instruction scheduler. Confirmed bad schedulers: source, list-burr, list-hybrid. - // "source" scheduler has a bug: http://llvm.org/bugs/show_bug.cgi?id=22304 - auto envLine = std::getenv("EVMJIT"); - auto commandLine = std::string{"evmjit "} + (envLine ? envLine : "") + " -pre-RA-sched=list-ilp\0"; - static const auto c_maxArgs = 20; - char const* argv[c_maxArgs] = {nullptr, }; - auto arg = std::strtok(&*commandLine.begin(), " "); - auto i = 0; - for (; i < c_maxArgs && arg; ++i, arg = std::strtok(nullptr, " ")) - argv[i] = arg; - cl::ParseCommandLineOptions(i, argv, "Ethereum EVM JIT Compiler"); + cl::ParseEnvironmentOptions("evmjit", "EVMJIT", "Ethereum EVM JIT Compiler"); } } diff --git a/evmjit/libevmjit/GasMeter.cpp b/evmjit/libevmjit/GasMeter.cpp index ffbd654e6..c0a2ed287 100644 --- a/evmjit/libevmjit/GasMeter.cpp +++ b/evmjit/libevmjit/GasMeter.cpp @@ -216,22 +216,12 @@ void GasMeter::countExp(llvm::Value* _exponent) // cost = ((256 - lz) + 7) / 8 // OPT: Can gas update be done in exp algorithm? - - auto t = llvm::APInt{256, 1}; - auto c = m_builder.CreateSelect(m_builder.CreateICmpUGE(_exponent, Constant::get(t)), m_builder.getInt64(1), m_builder.getInt64(0)); - for (auto i = 2; i <= 32; ++i) - { - t <<= 8; - c = m_builder.CreateSelect(m_builder.CreateICmpUGE(_exponent, Constant::get(t)), m_builder.getInt64(i), c); - } - - // FIXME: Does not work because of LLVM bug: https://llvm.org/bugs/show_bug.cgi?id=22304 -// auto ctlz = llvm::Intrinsic::getDeclaration(getModule(), llvm::Intrinsic::ctlz, Type::Word); -// auto lz256 = m_builder.CreateCall2(ctlz, _exponent, m_builder.getInt1(false)); -// auto lz = m_builder.CreateTrunc(lz256, Type::Gas, "lz"); -// auto sigBits = m_builder.CreateSub(m_builder.getInt64(256), lz, "sigBits"); -// auto sigBytes = m_builder.CreateUDiv(m_builder.CreateAdd(sigBits, m_builder.getInt64(7)), m_builder.getInt64(8)); - count(m_builder.CreateNUWMul(c, m_builder.getInt64(c_expByteGas))); + auto ctlz = llvm::Intrinsic::getDeclaration(getModule(), llvm::Intrinsic::ctlz, Type::Word); + auto lz256 = m_builder.CreateCall2(ctlz, _exponent, m_builder.getInt1(false)); + auto lz = m_builder.CreateTrunc(lz256, Type::Gas, "lz"); + auto sigBits = m_builder.CreateSub(m_builder.getInt64(256), lz, "sigBits"); + auto sigBytes = m_builder.CreateUDiv(m_builder.CreateAdd(sigBits, m_builder.getInt64(7)), m_builder.getInt64(8)); + count(m_builder.CreateNUWMul(sigBytes, m_builder.getInt64(c_expByteGas))); } void GasMeter::countSStore(Ext& _ext, llvm::Value* _index, llvm::Value* _newValue) diff --git a/evmjit/libevmjit/Optimizer.cpp b/evmjit/libevmjit/Optimizer.cpp index 731fda5c6..df88b4df8 100644 --- a/evmjit/libevmjit/Optimizer.cpp +++ b/evmjit/libevmjit/Optimizer.cpp @@ -16,9 +16,9 @@ namespace jit bool optimize(llvm::Module& _module) { auto pm = llvm::legacy::PassManager{}; - //pm.add(llvm::createFunctionInliningPass(2, 2)); // Produces invalid IR + //pm.add(llvm::createFunctionInliningPass(2, 2)); // Problem with APInt value bigger than 64bit pm.add(llvm::createCFGSimplificationPass()); - //pm.add(llvm::createInstructionCombiningPass()); // Produces invalid runtime results + pm.add(llvm::createInstructionCombiningPass()); pm.add(llvm::createAggressiveDCEPass()); pm.add(llvm::createLowerSwitchPass()); return pm.run(_module); diff --git a/evmjit/libevmjit/preprocessor/llvm_includes_end.h b/evmjit/libevmjit/preprocessor/llvm_includes_end.h index 2ead6dda3..643e03064 100644 --- a/evmjit/libevmjit/preprocessor/llvm_includes_end.h +++ b/evmjit/libevmjit/preprocessor/llvm_includes_end.h @@ -1,7 +1,3 @@ #if defined(_MSC_VER) #pragma warning(pop) -#elif defined(__clang__) - #pragma clang diagnostic pop -#else - #pragma GCC diagnostic pop #endif diff --git a/evmjit/libevmjit/preprocessor/llvm_includes_start.h b/evmjit/libevmjit/preprocessor/llvm_includes_start.h index 9077bf43f..9499f9835 100644 --- a/evmjit/libevmjit/preprocessor/llvm_includes_start.h +++ b/evmjit/libevmjit/preprocessor/llvm_includes_start.h @@ -1,12 +1,4 @@ #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable: 4267 4244 4800) -#elif defined(__clang__) - #pragma clang diagnostic push - #pragma clang diagnostic ignored "-Wunused-parameter" - #pragma clang diagnostic ignored "-Wconversion" -#else - #pragma GCC diagnostic push - #pragma GCC diagnostic ignored "-Wunused-parameter" - #pragma GCC diagnostic ignored "-Wconversion" #endif From f86009c9e82888e478690166373b1b6526991831 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 23 Apr 2015 12:16:07 +0200 Subject: [PATCH 003/169] Add support for building with llvm-3.7-deb Debian package --- evmjit/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/evmjit/CMakeLists.txt b/evmjit/CMakeLists.txt index 5ab394a80..35332f232 100644 --- a/evmjit/CMakeLists.txt +++ b/evmjit/CMakeLists.txt @@ -25,12 +25,12 @@ if(LLVM_DIR OR APPLE) # local LLVM build llvm_map_components_to_libnames(LLVM_LIBS core support mcjit x86asmparser x86codegen bitwriter ipo) else() # Workaround for Ubuntu broken LLVM package - message(STATUS "Using llvm-3.5-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") - execute_process(COMMAND llvm-config-3.5 --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS) + message(STATUS "Using llvm-3.7-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") + execute_process(COMMAND llvm-config-3.7 --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS) message(STATUS "LLVM include dirs: ${LLVM_INCLUDE_DIRS}") - set(LLVM_LIBS "-lLLVMBitWriter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMX86AsmParser -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore -lLLVMSupport -lz -lpthread -lffi -ltinfo -ldl -lm") + set(LLVM_LIBS "-lLLVMBitWriter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMX86AsmParser -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMMCDisassembler -lLLVMCore -lLLVMSupport -lz -lpthread -lffi -ltinfo -ldl -lm") add_definitions(-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS) - link_directories(/usr/lib/llvm-3.5/lib) + link_directories(/usr/lib/llvm-3.7/lib) endif() add_subdirectory(libevmjit) From 777b298613c3c28cdd656db3f81a86657a70144c Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 5 Jun 2015 11:28:19 +0200 Subject: [PATCH 004/169] warnings fixed --- test/libp2p/peer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/libp2p/peer.cpp b/test/libp2p/peer.cpp index d46964d21..bcb6d4085 100644 --- a/test/libp2p/peer.cpp +++ b/test/libp2p/peer.cpp @@ -80,7 +80,7 @@ BOOST_AUTO_TEST_CASE(saveNodes) unsigned const c_nodes = 6; unsigned const c_peers = c_nodes - 1; - for (int i = 0; i < c_nodes; ++i) + for (unsigned i = 0; i < c_nodes; ++i) { Host* h = new Host("Test", NetworkPreferences("127.0.0.1", 30300 + i, false)); h->setIdealPeerCount(10); @@ -95,14 +95,14 @@ BOOST_AUTO_TEST_CASE(saveNodes) for (auto const& h: hosts) host.addNode(h->id(), NodeIPEndpoint(bi::address::from_string("127.0.0.1"), h->listenPort(), h->listenPort())); - for (int i = 0; i < c_peers * 1000 && host.peerCount() < c_peers; i += c_step) + for (unsigned i = 0; i < c_peers * 1000 && host.peerCount() < c_peers; i += c_step) this_thread::sleep_for(chrono::milliseconds(c_step)); Host& host2 = *hosts.back(); for (auto const& h: hosts) host2.addNode(h->id(), NodeIPEndpoint(bi::address::from_string("127.0.0.1"), h->listenPort(), h->listenPort())); - for (int i = 0; i < c_peers * 1000 && host2.peerCount() < c_peers; i += c_step) + for (unsigned i = 0; i < c_peers * 1000 && host2.peerCount() < c_peers; i += c_step) this_thread::sleep_for(chrono::milliseconds(c_step)); BOOST_CHECK_EQUAL(host.peerCount(), c_peers); From a7f861a46be770d37a2048900448e7d41cadd2ab Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 5 Jun 2015 11:31:38 +0200 Subject: [PATCH 005/169] comment updated --- libdevcore/Log.h | 1 + 1 file changed, 1 insertion(+) diff --git a/libdevcore/Log.h b/libdevcore/Log.h index f104caccd..a4011fc0e 100644 --- a/libdevcore/Log.h +++ b/libdevcore/Log.h @@ -60,6 +60,7 @@ extern std::function g_logPost; extern std::map g_logOverride; /// Temporary changes system's verbosity for specific function. Restores the old verbosity when function returns. +/// Not thread-safe, use with caution! struct VerbosityHolder { VerbosityHolder(int _temporaryValue) : oldLogVerbosity(g_logVerbosity) { g_logVerbosity = _temporaryValue; } From 5dacb60e098aeb182819968ded8e4516cd858e33 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Wed, 10 Jun 2015 04:17:31 +0200 Subject: [PATCH 006/169] FreeBSD fix for ethash byte ordering Changes from https://github.com/ethereum/cpp-ethereum/pull/1919 . It closes https://github.com/ethereum/cpp-ethereum/issues/1918 --- endian.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/endian.h b/endian.h index 0ee402d9a..6ca6cc036 100644 --- a/endian.h +++ b/endian.h @@ -32,6 +32,9 @@ #include #define ethash_swap_u32(input_) OSSwapInt32(input_) #define ethash_swap_u64(input_) OSSwapInt64(input_) +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) +#define ethash_swap_u32(input_) bswap32(input_) +#define ethash_swap_u64(input_) bswap64(input_) #else // posix #include #define ethash_swap_u32(input_) __bswap_32(input_) From 75e39b650d43fdc1e7fa70571e0976c4e21fcf25 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 12 Jun 2015 10:05:33 +0200 Subject: [PATCH 007/169] fix expected section for ecrecover --- .../StateTestsFiller/stPreCompiledContractsFiller.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/libethereum/StateTestsFiller/stPreCompiledContractsFiller.json b/test/libethereum/StateTestsFiller/stPreCompiledContractsFiller.json index 8781e5271..1a951a432 100644 --- a/test/libethereum/StateTestsFiller/stPreCompiledContractsFiller.json +++ b/test/libethereum/StateTestsFiller/stPreCompiledContractsFiller.json @@ -140,7 +140,7 @@ "expect" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "storage" : { - "0x" : "0x3f17f1962b36e491b30a40b2405849e597ba5fb5", + "0x" : "0x00", "0x01" : "0x00", "0x02" : "0x01" } @@ -226,7 +226,7 @@ "expect" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "storage" : { - "0x" : "0x3f17f1962b36e491b30a40b2405849e597ba5fb5", + "0x" : "0x00", "0x01" : "0x00", "0x02" : "0x01" } @@ -1946,7 +1946,7 @@ "expect" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "storage" : { - "0x" : "0x3f17f1962b36e491b30a40b2405849e597ba5fb5", + "0x" : "0x00", "0x01" : "0x00", "0x02" : "0x01" } @@ -2032,7 +2032,7 @@ "expect" : { "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "storage" : { - "0x" : "0x3f17f1962b36e491b30a40b2405849e597ba5fb5", + "0x" : "0x00", "0x01" : "0x00", "0x02" : "0x01" } @@ -3645,4 +3645,4 @@ "data" : "" } } -} \ No newline at end of file +} From 4036bd2d4ea15e6b2a95f9dda90d928de2895265 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 12 Jun 2015 22:10:22 +0200 Subject: [PATCH 008/169] add blck504980 test --- .../StateTestsFiller/stSpecialTestFiller.json | 224 ++++++++++++++++++ 1 file changed, 224 insertions(+) diff --git a/test/libethereum/StateTestsFiller/stSpecialTestFiller.json b/test/libethereum/StateTestsFiller/stSpecialTestFiller.json index 8dee4af11..60181bd5c 100644 --- a/test/libethereum/StateTestsFiller/stSpecialTestFiller.json +++ b/test/libethereum/StateTestsFiller/stSpecialTestFiller.json @@ -264,5 +264,229 @@ "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", "value" : "100000" } + }, + + "block504980" : { + "env" : { + "currentCoinbase" : "1cdc8315bdb1362de8b7b2fa9ee75dc873037179", + "currentDifficulty" : "21010229025", + "currentGasLimit" : "3141592", + "currentNumber" : "504780", + "currentTimestamp" : 1, + "previousHash" : "9ff4de714e01da9f8b61992efdab9b51ca14ac42d43f4c24df1d002a1239b1e9" + }, + "pre" : { + "b03f030056db7d467d778326658bac0d1b35d8f7" : { + "balance" : "0", + "code" : "0x600061075f537c010000000000000000000000000000000000000000000000000000000060003504731e147037f0a63df228fe6e7aef730f1ea31c8ce3602052730ea65418d7bf32680f55572c943a94b59080499860405273e509e3a93beb1eba72f8cb8d25f93a85e2d54afb60605273c9ae5868651bf7b7db6e360217db49ce4e69c07e60805273142a6927cf0060133187ba8a8e74d641438f0c1c60a05273b163e767e4c1ba5ae88b2ee7594f3a3fec2bb09660c05273ba7b277319128ef4c22635534d0f61dffdaa13ab60e052739761fecf88590592cf05ce545504d376d1693ab36101005273f70bbc50f1468cecae0761ef09386a87c1c696ea6101205273a89d22f049aaa5bbfb5f1a1939fff3ae7a26ae746101405273174827f7e53e8ce13b047adcac0eb3f2cb0c3285610160526336a560bd811415610a88576004356101a052601c60445990590160009052016327138bfb601c8203526101a051600482015260206101e0602483600060a051602d5a03f1506101e05190501515610195576001600003610200526020610200f35b601c6044599059016000905201637a66d7ca601c8203526101a051600482015260206102206024836000608051602d5a03f150610220519050601c606459905901600090520163cc1c944e601c8203526101a05160048201528160248201526020610260604483600061028051602d5a03f150610260519050601c60445990590160009052016380b5e7bd601c8203526101a051600482015260206102a06024836000606051602d5a03f1506102a0519050808202601c60445990590160009052016318633576601c8203526101a051600482015260206103006024836000608051602d5a03f150610300519050600981141561036d57601c60c459905901600090520163ac44d71e601c8203526101a0516004820152856024820152846044820152836064820152826084820152602061036060a483600061016051602d5a03f15061036051905050601c6064599059016000905201637265802d601c8203526101a05160048201526000602482015260206103806044836000608051602d5a03f15061038051905050601c604459905901600090520163c5476efe601c8203526101a051600482015260206103a06024836000608051602d5a03f1506103a051905050600185016103c05260206103c0f3610a3a565b60008114156103cd57601c60c459905901600090520163ef72638a601c8203526101a051600482015285602482015284604482015283606482015282608482015260206103e060a483600060c051602d5a03f1506103e051905050610a39565b600181141561042d57601c60c459905901600090520163a63e976c601c8203526101a0516004820152856024820152846044820152836064820152826084820152602061040060a483600060e051602d5a03f15061040051905050610a38565b600281141561048d57601c60c459905901600090520163533ea0ed601c8203526101a0516004820152856024820152846044820152836064820152826084820152602061042060a483600060e051602d5a03f15061042051905050610a37565b600381141561085057601c606459905901600090520163e05dcb56601c8203526101a0516004820152856024820152600285016040816020020159905901600090528160200260400181604485600061028051602d5a03f15060408101905090509050601c6044599059016000905201633d905045601c8203526101a051600482015260206104806024836000608051602d5a03f150610480519050600481141561063357601c60c4599059016000905201630939aa8c601c8203526101a051600482015287602482015286604482015285606482015284608482015260206104e060a483600061010051602d5a03f1506104e05190506104c052601c606459905901600090520163c286273a601c8203526101a05160048201526000602482015260206105006044836000608051602d5a03f1506105005190505060016104c05114156105e55782610520526020610520f361062e565b601c604459905901600090520163aac2ffb5601c8203526101a051600482015260206105406024836000608051602d5a03f1506105405190505060018301610560526020610560f35b610804565b600081141561069457601c60c459905901600090520163546fdeb3601c8203526101a0516004820152876024820152866044820152856064820152846084820152602061058060a483600061010051602d5a03f15061058051905050610803565b6001811415610742576000601c60c459905901600090520163de9080c8601c8203526101a051600482015288602482015287604482015286606482015285608482015260206105a060a483600061010051602d5a03f1506105a0519050141561073257601c6044599059016000905201631cda01ef601c8203526101a051600482015260206105c06024836000608051602d5a03f1506105c0519050505b826105e05260206105e0f3610802565b60028114156107a357601c60c459905901600090520163384ca8dd601c8203526101a0516004820152876024820152866044820152856064820152846084820152602061060060a483600061010051602d5a03f15061060051905050610801565b600381141561080057601c60c459905901600090520163d5dc5af1601c8203526101a0516004820152876024820152866044820152856064820152846084820152602061062060a483600061010051602d5a03f150610620519050505b5b5b5b5b601c6044599059016000905201631cda01ef601c8203526101a051600482015260206106406024836000608051602d5a03f1506106405190505082610660526020610660f35050610a36565b60048114156108b157601c60c459905901600090520163f6559853601c8203526101a0516004820152856024820152846044820152836064820152826084820152602061068060a483600061012051602d5a03f15061068051905050610a35565b600581141561091257601c60c459905901600090520163d8e5473d601c8203526101a051600482015285602482015284604482015283606482015282608482015260206106a060a483600061012051602d5a03f1506106a051905050610a34565b600681141561097357601c60c459905901600090520163090507ea601c8203526101a051600482015285602482015284604482015283606482015282608482015260206106c060a483600061012051602d5a03f1506106c051905050610a33565b60078114156109d457601c60c4599059016000905201635b911842601c8203526101a051600482015285602482015284604482015283606482015282608482015260206106e060a483600061014051602d5a03f1506106e051905050610a32565b6008811415610a3157601c60c459905901600090520163abe22b84601c8203526101a0516004820152856024820152846044820152836064820152826084820152602061070060a483600061014051602d5a03f150610700519050505b5b5b5b5b5b5b5b5b5b601c604459905901600090520163aac2ffb5601c8203526101a051600482015260206107206024836000608051602d5a03f1506107205190505060018101610740526020610740f350505050505b50", + "nonce" : "0", + "storage" : { + } + }, + "142a6927cf0060133187ba8a8e74d641438f0c1c" : { + "balance" : "0", + "code" : "0x600061031f537c01000000000000000000000000000000000000000000000000000000006000350473c9ae5868651bf7b7db6e360217db49ce4e69c07e602052730ea65418d7bf32680f55572c943a94b5908049986040526327138bfb81141561038d57600435608052601c6044599059016000905201637a66d7ca601c8203526080516004820152602060e06024836000602051602d5a03f15060e051905060a052601c604459905901600090520163c60409c6601c820352608051600482015260206101206024836000602051602d5a03f150610120519050430561010052600061014052600061016052600061018052600260a051016101005112151561010a576001610140525b60006101a052610100516101c0525b606461010051016101c051121561018457601c606459905901600090520163cc1c944e601c82035260805160048201526101c051602482015260206101e06044836000604051602d5a03f1506101e05190506101a051016101a05260016101c051016101c052610119565b6005601c606459905901600090520163cc1c944e601c820352608051600482015260a051602482015260206102006044836000604051602d5a03f1506102005190501280156101d357806101db565b600a6101a051125b9050156101eb57610140516101ee565b60005b1561033657601c604459905901600090520163c5476efe601c820352608051600482015260206102406024836000602051602d5a03f15061024051905050601c6064599059016000905201637265802d601c82035260805160048201526000602482015260206102606044836000602051602d5a03f15061026051905050601c606459905901600090520163c286273a601c82035260805160048201526000602482015260206102806044836000602051602d5a03f15061028051905050601c6044599059016000905201637a66d7ca601c820352608051600482015260206102a06024836000602051602d5a03f1506102a051905060a052601c608459905901600090520163bb8e4196601c820352608051600482015260a051602482015261010051604482015260206102c06064836000604051602d5a03f1506102c051905050610343565b6001610160526001610180525b61014051156103555761016051610358565b60005b156103665761018051610369565b60005b1561037f5760016102e05260206102e0f361038c565b6000610300526020610300f35b5b50", + "nonce" : "0", + "storage" : { + } + }, + "c9ae5868651bf7b7db6e360217db49ce4e69c07e" : { + "balance" : "0", + "code" : "0x600061083f537c010000000000000000000000000000000000000000000000000000000060003504637a66d7ca8114156100665760043560405260606060599059016000905260008152604051816020015260008160400152809050205460605260206060f35b63c60409c68114156100a55760043560405260606060599059016000905260008152604051816020015260018160400152809050205460a052602060a0f35b63186335768114156100e45760043560405260606060599059016000905260008152604051816020015260028160400152809050205460e052602060e0f35b63b3903c8a8114156101bc57600435604052606060605990590160009052600081526040518160200152600581604001528090502054610120526101205180602002602001599059016000905281815260208101905090506101605260006101c0525b610120516101c051121561019f57608060805990590160009052600081526040518160200152600481604001526101c051816060015280905020546101c05160200261016051015260016101c051016101c052610147565b6101605160206040820352602060208203510260400160408203f3505b636824e0fb8114156101fd57600435604052606060605990590160009052600081526040518160200152600581604001528090502054610220526020610220f35b633db16be381141561023e57600435604052606060605990590160009052600081526040518160200152600681604001528090502054610260526020610260f35b63c33878588114156102e05760006102a0526000546102c0526102c05180602002602001599059016000905281815260208101905090506102e0525b6102c0516102a05112156102c357604060405990590160009052600181526102a051816020015280905020546102a0516020026102e051015260016102a051016102a05261027a565b6102e05160206040820352602060208203510260400160408203f3505b63175c63228114156102fa57600054610380526020610380f35b63d861f2b4811415610336576004356103a052604060405990590160009052600181526103a051816020015280905020546103c05260206103c0f35b63b0dab01f81141561044f57600435610400526024356104205260443561044052606435610460526000606060605990590160009052600081526104005181602001526001816040015280905020541415610441576104205160606060599059016000905260008152610400518160200152600081604001528090502055610440516060606059905901600090526000815261040051816020015260018160400152809050205561046051606060605990590160009052600081526104005181602001526006816040015280905020556104005160406040599059016000905260018152600054816020015280905020556001600054016000556001610520526020610520f361044e565b6000610540526020610540f35b5b63aac2ffb58114156104b95760043560405260016060606059905901600090526000815260405181602001526002816040015280905020540160606060599059016000905260008152604051816020015260028160400152809050205560016105a05260206105a0f35b637265802d811415610507576004356040526024356105c0526105c0516060606059905901600090526000815260405181602001526002816040015280905020556001610600526020610600f35b63c5476efe811415610571576004356040526001606060605990590160009052600081526040518160200152600081604001528090502054016060606059905901600090526000815260405181602001526000816040015280905020556001610660526020610660f35b63c551e31e81141561063b576004356040526024356106805260606060599059016000905260008152604051816020015260058160400152809050205461012052610680516080608059905901600090526000815260405181602001526004816040015261012051816060015280905020556001606060605990590160009052600081526040518160200152600581604001528090502054016060606059905901600090526000815260405181602001526005816040015280905020556001610720526020610720f35b633d90504581141561067c57600435604052606060605990590160009052600081526040518160200152600381604001528090502054610740526020610740f35b631cda01ef8114156106e65760043560405260016060606059905901600090526000815260405181602001526003816040015280905020540160606060599059016000905260008152604051816020015260038160400152809050205560016107c05260206107c0f35b63c286273a811415610734576004356040526024356107e0526107e0516060606059905901600090526000815260405181602001526003816040015280905020556001610820526020610820f35b50", + "nonce" : "0", + "storage" : { + "0x72a539b064c98d29a514ee55694225e05fb41fe63e5fe710e4536bd9ba3591b4" : "0x338ecfe6c523ed1184918b19584d97dd1095ecaadc49c7ba9da62b8b513026e0", + "0xbc96058eb03504ee6f5c0a9582f8720d99a6e9738b171499507facff0b2c0b5b" : "0x9db6a4f2766b51013b8d2f9038131d1bb4af725d019d111d7e26ff96c023b23f", + "0x7aeb0a0ce8882a12d853078382a2bc72f7a94af6109f167de37b36c0a7deb828" : "0x4c428400ea8a7bd7c46ba9895b508770efa4551f0d793e1beb1207da01d9962f", + "0xde72f8eed43cc2a5a3eaa51483d14b17dc92bb26c154ae184cee4b4895011edc" : "0x47ce2b6fdb72c3fabb9c74f82c1e3e522bcd42e614fd85c208ac3c4c840cea72", + "0xcae57ae3017972d63effd8eae44f5054402c3e890d154b905ed6b5b533327fa9" : "0xd2e4bf465e61993d13089b940a7c55017a5117d8e43e4115550a139e1d4b3e3a", + "0x7c8f4a98e086f64e28c75f54712b5d44bec3c29b5c70519e8880d3046a5618dc" : "0xaafc1f2601752b114d722070f75539bfec7faf49f0d48a48d27862f0c3b09903", + "0xe0e687ddf317f3d2b209ae3884148eff0f636e16827f82eded14ada8fc603009" : "0xfa7c8939f9b033162cf8d75ea69671bb8a27041bd4cdc76594e61e99333cb041", + "0x687cb2122de7bacf42b9cd380b04ff2a2ce92a0b63706a9a78263b3ce86f3313" : "0x0000000000000000000000000000000000000000000000000200000000000000", + "0xe8cda339d72a1a350b62f1e3fa52e254c395cc9fdd9f60adb21c7633fbdab531" : "0x128c4fdf4801a30eae99dd58f0f3ff5ca65f71b66a9ac0f38dd450fb24b4aaaa", + "0xb1f1aaedfb83c7755a2bffc9e2557f1723f9abe5642397963e76248c9209af57" : "0xe9be955c5fbfcd846d7425eaea05ce897786aefad99665342cbf30761b352526", + "0x252a4ec7133643fddcdb22a86c415f78b2dd251f18d1efcd6a44acf590c4ae72" : "0x9caf94b82715869e71d3cee986094ea612f0258570b7e5ef47b5d09e9515322b", + "0x491d10658c1ec762152d8ad2d890ad59111b1ee7b4bc25736046923d3534d9a5" : "0x000000000000000000000000000000000000000000000000000000000000629e", + "0x5b0e8552efd72a845e47318abbbef9dc9fcdfe0d1a06cda44494401301581511" : "0xfbc98f4017ae5c20459daadaa6bee519b6de871d3dbaa9ab3f34340fef4cb643", + "0x618355e25491dfe86175f9d9b3147e4d680aa561d98384e3621dc6a3088b0846" : "0x6b2e6d2d5deb27dffec973f23af4caf111e66d1397f467dbbedf5ab2192fb6b6", + "0xb16b117660f31197087f4d6fe50d3d4579152244956f753f9653ccf85f4b35c4" : "0x830272e3bb35226b047244cbdc46f1b6b864a280461e7a592f70e0863f4f1d33", + "0x987cb9ecfd8ce499d9d0e9e6b7da29617aa02774a34f4a8ea54442f44a1e1936" : "0x5179f98f555f1e9f1d4a335d16f41154579a53e361e9859269b6fa74ea9c7d21", + "0x605b934bd26c9ecdf7029a7dc062d3a6b87338511cff96e0c5f13de9eea3462e" : "0xf0d24f3d0eda573fc5d43e3d0680993c51293752cd6de205040d3197f412f475", + "0x5b672a107ba6fab01cbddf079042e9f6176a8e6f154584fc4df4b15674c9456e" : "0x1603da41d610854d85536b37d000e5eb7ca09786c43f50e7441c0afbff1de0a9", + "0x0000000000000000000000000000000000000000000000000000000000000000" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x0a4470e9d0419df71f6257fcdfd2c0a3bad96a23f5ab414bc10aaf1a31a536a7" : "0xb4876148229c22bd2291f1a4f5468c8c789b23639370c4d447f270ba341dbbec", + "0x84e4a80d33c5d2abd2b0a5aec0fdc5eaeed90ab31db556e404a81718ea286e39" : "0x000000000000000000000000000000000000000000000000000000000000001c", + "0x16ef4193a274568d283ff919c299729e07696d9ada48187b81d68e12e7b962de" : "0x0a103c04e7ecb9b3395f77c7b0cad28e62c85f042de4767ccc6c005e6f47f8d4", + "0xc186c4f377b7f13892ade9656acd1522aa1f8ac151ac4f62457b5073241d79fc" : "0x7289738fef00f1770eeb098db9bd486c01ac12398d79cdf935514a128c585c51", + "0xada5013122d395ba3c54772283fb069b10426056ef8ca54750cb9bb552a59e7d" : "0x00000000000000000000000000000000000000000000000000000000000f69b5", + "0xec5e7f54fa5e516e616b04f9d5a0ee433a80e09ed47d7e5269afd76c05ff251e" : "0x0000000000000000000000000000000000000000000000000000000000000014", + "0x1f1866e966f321b84535705846689749d34d5dc02994613e2931973c605d9e93" : "0xc723d0aa4a60529fe42277c8094aa19263aff36650136efc5edfd0785d457634", + "0x877305412fa2486f563c457b744e5c8b1e4d0eca73371de5e771f2abc263f4dc" : "0x7088a36f67276d475aa62127cfde9790cc802fdf3a54df49461a25eb8bf15707", + "0xcf569ee7bf3accc0f893dffd04f1a757f373efe80893eff504fb3678f688ec1d" : "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x809c325f50acf5787776e960985e72443b4330ad1e2f466557fffee16ba51d44" : "0xb940a56e64b5b661d87919b8ef03640ec077a6d72dd0b524adedaa7ddc91ff7a", + "0xf9a3bf5f2ccb903ee1a7644113b794db0260de404fb8f11203e75a7fff151618" : "0xbd94773c0d85c68240ae8dfd53d9d33cd137509bfc5d3433381299df768c8377", + "0x922a8f2fc1cbe67c8acc6a8a720983c366d71d3e2e78e3048949ebc913ea611a" : "0x50fb9f913ca102534bb0a8eb8ebf19c68dfd16ffe5e207bcc580084cd4ecd8b4", + "0xb7bd50fdf7b043411c9ac33f0af2cebc69c393eb0b91f4976946f9c7b15ad0da" : "0xfccca0e7832bae9afe799a6d6177dc3869fa6c5b5105f8df6f365de5723820ec", + "0xd8f6f90f51e657690ee28d1cc80d81bc1b89290065891fdd853d09caaaf756aa" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x41b451e8d86d28add758cbd3f48a18fd04b11a80288c1dc434a5bf2d8fb1ca64" : "0xb602498f12a8b4af3a1fca357cea6b19bcd163dfec1d845364ce1395f7c21fa7", + "0x65112936bec0f1e84fda6623fb54e12baadc8a4a208c8c4eb3ed5e79cbd7e85f" : "0xa59ac24e3e0663413d0f87516ba8fb44c6c3e14da8eaabbde80f8ee285f65934", + "0xd69b7284545a9f5275df64ce94848dc954fcb8a8b525e7ac801517c12a75af84" : "0x4202995350abae303b43e564aa79121a30b5f1aea31f69cd25e07dd3fa64dce7" + } + }, + "0ea65418d7bf32680f55572c943a94b590804998" : { + "balance" : "0", + "code" : "0x600061289f537c01000000000000000000000000000000000000000000000000000000006000350473c9ae5868651bf7b7db6e360217db49ce4e69c07e60205263c4982a8581141561012757600435606052602435608052608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460a05260a051806020026020015990590160009052818152602081019050905060e0526000610140525b60a05161014051121561010b5760a060a0599059016000905260008152606051816020015260805181604001526001816060015261014051816080015280905020546101405160200260e051015260016101405101610140526100ad565b60e05160206040820352602060208203510260400160408203f3505b63cc1c944e8114156101765760043560605260243560805260806080599059016000905260008152606051816020015260805181604001526000816060015280905020546101a05260206101a0f35b6395a405b98114156101d5576004356060526024356080526044356101e05260a060a059905901600090526000815260605181602001526080518160400152600181606001526101e05181608001528090502054610200526020610200f35b6371ebb662811415610224576004356060526024356080526080608059905901600090526000815260605181602001526080518160400152600281606001528090502054610240526020610240f35b637a57a3db811415610325576004356060526024356080526044356102805260c060c0599059016000905260008152606051816020015260805181604001526003816060015261028051816080015260008160a0015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460200280806020015990590160009052818152602081019050905060005b602083048112156102e95780840154816020028301526001810190506102c8565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63f73dc690811415610394576004356060526024356080526044356103c0526064356103e05260c060c059905901600090526000815260605181602001526080518160400152600381606001526103c05181608001526103e0518160a001528090502054610400526020610400f35b6354cc61098114156103f3576004356060526024356080526044356103c05260a060a059905901600090526000815260605181602001526080518160400152600481606001526103c05181608001528090502054610440526020610440f35b63c63ef546811415610442576004356060526024356080526080608059905901600090526000815260605181602001526080518160400152600581606001528090502054610480526020610480f35b639381779b8114156105335760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600681606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260058160600152809050205460200280806020015990590160009052818152602081019050905060005b602083048112156104f75780840154816020028301526001810190506104d6565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b634f9c6eeb8114156106245760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600781606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260058160600152809050205460200280806020015990590160009052818152602081019050905060005b602083048112156105e85780840154816020028301526001810190506105c7565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b637dc121958114156107155760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600881606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260058160600152809050205460200280806020015990590160009052818152602081019050905060005b602083048112156106d95780840154816020028301526001810190506106b8565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63fa9832d18114156108065760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600981606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460200280806020015990590160009052818152602081019050905060005b602083048112156107ca5780840154816020028301526001810190506107a9565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b632c5a40d58114156108f75760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600a81606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260058160600152809050205460200280806020015990590160009052818152602081019050905060005b602083048112156108bb57808401548160200283015260018101905061089a565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63e05dcb568114156109eb5760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600b81606001526000816080015280905020600260806080599059016000905260008152606051816020015260805181604001526000816060015280905020546020020180806020015990590160009052818152602081019050905060005b602083048112156109af57808401548160200283015260018101905061098e565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63586b5be0811415610a3a576004356060526024356080526080608059905901600090526000815260605181602001526080518160400152600c81606001528090502054610b80526020610b80f35b63eb8af5aa811415610b585760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600d81606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460806080599059016000905260008152606051816020015260805181604001526005816060015280905020540560200280806020015990590160009052818152602081019050905060005b60208304811215610b1c578084015481602002830152600181019050610afb565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b637ab6ea8a811415610c765760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600e81606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460806080599059016000905260008152606051816020015260805181604001526005816060015280905020540560200280806020015990590160009052818152602081019050905060005b60208304811215610c3a578084015481602002830152600181019050610c19565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b632b810cb9811415610d945760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152600f81606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460806080599059016000905260008152606051816020015260805181604001526005816060015280905020540560200280806020015990590160009052818152602081019050905060005b60208304811215610d58578084015481602002830152600181019050610d37565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b637fb42e46811415610e855760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152601081606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460200280806020015990590160009052818152602081019050905060005b60208304811215610e49578084015481602002830152600181019050610e28565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63734fa727811415610f765760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152601181606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460200280806020015990590160009052818152602081019050905060005b60208304811215610f3a578084015481602002830152600181019050610f19565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63c67fa8578114156110675760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152601281606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460200280806020015990590160009052818152602081019050905060005b6020830481121561102b57808401548160200283015260018101905061100a565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b635ed853e48114156111855760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152601381606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460806080599059016000905260008152606051816020015260805181604001526005816060015280905020540560200280806020015990590160009052818152602081019050905060005b60208304811215611149578084015481602002830152600181019050611128565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63b86f51258114156112a35760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152601481606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460806080599059016000905260008152606051816020015260805181604001526005816060015280905020540560200280806020015990590160009052818152602081019050905060005b60208304811215611267578084015481602002830152600181019050611246565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63bc3d7d858114156113945760043560605260243560805260a060a059905901600090526000815260605181602001526080518160400152601581606001526000816080015280905020608060805990590160009052600081526060518160200152608051816040015260008160600152809050205460200280806020015990590160009052818152602081019050905060005b60208304811215611358578084015481602002830152600181019050611337565b602083066020036101000a60000381850154168160200283015281905090509050905060206040820352602060208203510260400160408203f3505b63a2302f2f81141561148157600435606052602435611680526044356116a0526116a05160a060a0599059016000905260008152606051816020015261168051816040015260018160600152608060805990590160009052600081526060518160200152611680518160400152600081606001528090502054816080015280905020556001608060805990590160009052600081526060518160200152611680518160400152600081606001528090502054016080608059905901600090526000815260605181602001526116805181604001526000816060015280905020556001611740526020611740f35b63058ca2bc8114156114dd576004356060526024356080526044356117605261176051608060805990590160009052600081526060518160200152608051816040015260028160600152809050205560016117a05260206117a0f35b635d3b965b8114156116175736599059016000905236600482376004356060526024356080526044356102805260643560208201016117e052608435611800525060c060c0599059016000905260008152606051816020015260805181604001526003816060015261028051816080015260008160a001528090502060206117e05103516020026020810460005b8181121561158c57806020026117e05101518482015560018101905061156b565b602083066020036101000a600003816020026117e05101511684820155505050506118005160806080599059016000905260008152606051816020015260805181604001526002816060015280905020540160806080599059016000905260008152606051816020015260805181604001526002816060015280905020556001611900526020611900f35b63b0e14f0f81141561167357600435606052602435608052604435611920526119205160806080599059016000905260008152606051816020015260805181604001526005816060015280905020556001611960526020611960f35b636acccdbc8114156117395736599059016000905236600482376004356060526024356080526044356020820101611980525060a060a05990590160009052600081526060518160200152608051816040015260068160600152600081608001528090502060206119805103516020026020810460005b8181121561170b5780602002611980510151848201556001810190506116ea565b602083066020036101000a600003816020026119805101511684820155505050506001611a40526020611a40f35b63a1fa51f98114156117ff5736599059016000905236600482376004356060526024356080526044356020820101611a60525060a060a0599059016000905260008152606051816020015260805181604001526007816060015260008160800152809050206020611a605103516020026020810460005b818112156117d15780602002611a60510151848201556001810190506117b0565b602083066020036101000a60000381602002611a605101511684820155505050506001611b20526020611b20f35b63cd87f43a8114156118c55736599059016000905236600482376004356060526024356080526044356020820101611b40525060a060a0599059016000905260008152606051816020015260805181604001526008816060015260008160800152809050206020611b405103516020026020810460005b818112156118975780602002611b4051015184820155600181019050611876565b602083066020036101000a60000381602002611b405101511684820155505050506001611c00526020611c00f35b63222a866381141561198b5736599059016000905236600482376004356060526024356080526044356020820101611c20525060a060a0599059016000905260008152606051816020015260805181604001526009816060015260008160800152809050206020611c205103516020026020810460005b8181121561195d5780602002611c205101518482015560018101905061193c565b602083066020036101000a60000381602002611c205101511684820155505050506001611ce0526020611ce0f35b63b39e1faa811415611a515736599059016000905236600482376004356060526024356080526044356020820101611d00525060a060a059905901600090526000815260605181602001526080518160400152600a816060015260008160800152809050206020611d005103516020026020810460005b81811215611a235780602002611d0051015184820155600181019050611a02565b602083066020036101000a60000381602002611d005101511684820155505050506001611dc0526020611dc0f35b63e365736b811415611b175736599059016000905236600482376004356060526024356080526044356020820101611de0525060a060a059905901600090526000815260605181602001526080518160400152600b816060015260008160800152809050206020611de05103516020026020810460005b81811215611ae95780602002611de051015184820155600181019050611ac8565b602083066020036101000a60000381602002611de05101511684820155505050506001611ea0526020611ea0f35b63aad7d6e3811415611b7357600435606052602435608052604435611ec052611ec0516080608059905901600090526000815260605181602001526080518160400152600c816060015280905020556001611f00526020611f00f35b6301112b27811415611c395736599059016000905236600482376004356060526024356080526044356020820101611f20525060a060a059905901600090526000815260605181602001526080518160400152600d816060015260008160800152809050206020611f205103516020026020810460005b81811215611c0b5780602002611f2051015184820155600181019050611bea565b602083066020036101000a60000381602002611f205101511684820155505050506001611fe0526020611fe0f35b63bdbb239b811415611cff5736599059016000905236600482376004356060526024356080526044356020820101612000525060a060a059905901600090526000815260605181602001526080518160400152600e8160600152600081608001528090502060206120005103516020026020810460005b81811215611cd1578060200261200051015184820155600181019050611cb0565b602083066020036101000a6000038160200261200051015116848201555050505060016120c05260206120c0f35b6305a0cd48811415611dc557365990590160009052366004823760043560605260243560805260443560208201016120e0525060a060a059905901600090526000815260605181602001526080518160400152600f8160600152600081608001528090502060206120e05103516020026020810460005b81811215611d9757806020026120e051015184820155600181019050611d76565b602083066020036101000a600003816020026120e051015116848201555050505060016121a05260206121a0f35b63aaa1fe35811415611e8b57365990590160009052366004823760043560605260243560805260443560208201016121c0525060a060a05990590160009052600081526060518160200152608051816040015260108160600152600081608001528090502060206121c05103516020026020810460005b81811215611e5d57806020026121c051015184820155600181019050611e3c565b602083066020036101000a600003816020026121c05101511684820155505050506001612280526020612280f35b632be4935d811415611f5157365990590160009052366004823760043560605260243560805260443560208201016122a0525060a060a05990590160009052600081526060518160200152608051816040015260118160600152600081608001528090502060206122a05103516020026020810460005b81811215611f2357806020026122a051015184820155600181019050611f02565b602083066020036101000a600003816020026122a05101511684820155505050506001612360526020612360f35b6313a8350d8114156120175736599059016000905236600482376004356060526024356080526044356020820101612380525060a060a05990590160009052600081526060518160200152608051816040015260128160600152600081608001528090502060206123805103516020026020810460005b81811215611fe9578060200261238051015184820155600181019050611fc8565b602083066020036101000a600003816020026123805101511684820155505050506001612440526020612440f35b63cb540b458114156120dd5736599059016000905236600482376004356060526024356080526044356020820101612460525060a060a05990590160009052600081526060518160200152608051816040015260138160600152600081608001528090502060206124605103516020026020810460005b818112156120af57806020026124605101518482015560018101905061208e565b602083066020036101000a600003816020026124605101511684820155505050506001612520526020612520f35b63be0306278114156121a35736599059016000905236600482376004356060526024356080526044356020820101612540525060a060a05990590160009052600081526060518160200152608051816040015260148160600152600081608001528090502060206125405103516020026020810460005b81811215612175578060200261254051015184820155600181019050612154565b602083066020036101000a600003816020026125405101511684820155505050506001612600526020612600f35b6383fd77f08114156122695736599059016000905236600482376004356060526024356080526044356020820101612620525060a060a05990590160009052600081526060518160200152608051816040015260158160600152600081608001528090502060206126205103516020026020810460005b8181121561223b57806020026126205101518482015560018101905061221a565b602083066020036101000a6000038160200261262051015116848201555050505060016126e05260206126e0f35b63594622058114156122d5576004356060526024356080526044356103c052606435612700526127005160a060a059905901600090526000815260605181602001526080518160400152600481606001526103c051816080015280905020556001612740526020612740f35b63bb8e419681141561244857600435606052602435612760526044356127805260006127a0525b6080608059905901600090526000815260605181602001526001612760510381604001526000816060015280905020546127a051121561243b5760a060a05990590160009052600081526060518160200152600161276051038160400152600181606001526127a0518160800152809050205460a060a05990590160009052600081526060518160200152612780518160400152600181606001526080608059905901600090526000815260605181602001526127805181604001526000816060015280905020548160800152809050205560016080608059905901600090526000815260605181602001526127805181604001526000816060015280905020540160806080599059016000905260008152606051816020015261278051816040015260008160600152809050205560016127a051016127a0526122fc565b6001612880526020612880f35b50", + "nonce" : "0", + "storage" : { + "0xc2a26b80067fc36b8268b0d5b31afff953fa91cebea39f191e2763d6e71259b9" : "0x02a43c547fe8de2400d2a141016550e8bae058d41164247c099e787ddd40e789", + "0x12643ff300762717d27efb567b82c65560d7b43249d908504e5510863ab82aac" : "0x154cf60e137c594516a065149610b6a3989396a42581d5fd8919e711c55da225", + "0xcbd6ae6bd61bc9270ec836f1919b3268113abe076c7febfdb8cf573b199ce9a9" : "0xf402b17773c1f7534034ee58dc0d2a3421470a7a67daf4fa790dc3b420eef790", + "0x417be8bc6791807372e0222a350bb8a5d67bbc8d7595c301d8a5a8372cfdcef1" : "0xabd4971b4605a7155802f70e08298b1ceb0e4e4eaccccd348f77a77227f73a7f", + "0x065d5efdfcc0fba693dc9e467f633097ffdc97401901463ad0e28855486d1edf" : "0xb9d69098a6acfe0c6411bcaaf430f78d363a9adc32b78bc2e15ccd6e883e9784", + "0x19efb13d6576359514ace5211988a8d51379fa88ccd2b886b409f842b13d7932" : "0x00c849cc595b452d11c206d2eb8cdfa06de211e3ff19ee0e0276dc857c05d4fe", + "0xaa0dbf8241ef3ae07c254e6869e84895ba2be0779a7f261c8308a3114be1c54a" : "0x0000000000000000000000000000000000000000000000000000000000000004", + "0xa0953566119395c11186b334805fc1a16175ecac0ecc93ae0322264f0dc2e40d" : "0x10c5a00466ab7c0adae1e93537cc275ea8cf23ff509d5466a1fd6f56b0a61d1b", + "0x9fddf1db29caa5c1239edd86e9e0835cdfe41f7253ec78f62d3da8558d6f3cd7" : "0x104eef8fa35bf39f677d81855bc0b9f42317f32792e98e95e4df441deb634211", + "0xe66c0f55f66c752edf73027d45b7b1ae729ae15e1c67c362dbc6f25edf8d76ff" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xe54f074c81bfa60b5bf413934c108086298b77291560edfeead8aa1232e95236" : "0x0f40aaa24323c9e6983ccffafeebe4b426509b901e8c98b8a40d881804804e6b", + "0xdc22d3171b82817c910bbeac1f8b50c8de99f8c524f172aef3491981bd5ed4fb" : "0x94b8cba4ea090d1c392fbc94b82fb9ef9f468a15bbc537f4d051776f4d422b1d", + "0x1b37e91bf8580c7c6bcf8cdff25c7ed78180124a94af6f30c40d476a3d079ad6" : "0xaba4cd295118a482a0a62579e35e4ba5bdd76146cc9e4d96172fce8be8977ab4", + "0xbf30cdcb83ab2bd5f5eee691ffa4107b58b75ba6a5c2e6754d4c5c0437f2876c" : "0x0000000000000000000000000000000000000000000000000000000000000005", + "0x34cabe0c7e64a2caa93fd8d6a0defc07acb9d44b13430fa3ae9282fffd40dee4" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x58da0c0c256bba101ce36fad8bf838717a57e6ab850a191dc9c09da9ce56bf1b" : "0x0000000000000000000000000000000000000000000000000000000000000005", + "0x34cabe0c7e64a2caa93fd8d6a0defc07acb9d44b13430fa3ae9282fffd40dee3" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x9001f91ddaef87bc067886e874c0749998c9b58b2ec8472ca014ca8b55f88578" : "0x0fb76974eefca01f33fb38646c2d3c1536f1a763d7aff53ab7f877d4c5ea7fd0", + "0x7e95f3cc3315d289c52253baaba29b1b00c86816e6b788d50795279a8baa00db" : "0x45e9723e9232b37207ecac1c97b8647d053625a578d450f7456280b2ff8efc27", + "0xe983d899f807bbcb5881f2ddf875b2ebb5cb8a7a4e77a8c98a40aaae6a468735" : "0x6d0be832b2007ea28cda705b73922cbf9794c5a25b89bd2f28b7347ed2b96c86", + "0x34cabe0c7e64a2caa93fd8d6a0defc07acb9d44b13430fa3ae9282fffd40dee2" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xaffe808b495d13a14391ce5f27c211c36da12826969cd7841ee0d81e5b900e2e" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x69ad1d19e617936abdf05133bf268dc8ced6b518f22b249b5860967d07006487" : "0x8c803b48b383ddabd1b3afe858efb48c203229b7317dd76149dddab4253b858a", + "0xbb3bc1a2015123750df57d4ceff7e28cb847910b79b34841de905b59a8bb177c" : "0x734417eb19e1873427257f1ea1594748c16cfa866a7b7cf896e281f2ec774a40", + "0xf60fa6e25e9028a6dc6b26bbc1eadae3da157df0d1d6f6628bc33cad68a7e455" : "0x2d7d00618c059ebe40593b9497c633e1ac6e161dadbd5bb734c2663cd3e8a8e1", + "0x41e9a54b3ee0c276aa076babb161de12b0f8916b47f8f6fb85cc387cf34696dd" : "0x22f2f444ebda9d2913ffef5059b039ec9b5876aa71821991c2515bf79f64935e", + "0xd2c8cbb562fccd0c9a3d0d491b7f65cc6a89856498f933427d9d21b745b9d50e" : "0x3625a26fdb7b747501f1ee2500f98c49d9cd290383a21254587c3c49d2805321", + "0x9ed0cedd2a9a78d949f40019f53d10031aef6ed342c97e01fc03b481ee56b3cb" : "0x0000000000000000000000000000000000000000000000000000000000000004", + "0x696664a5f0ab5acd9304a377fb684f2d3fe6bb60b8a95cb2bdbb57db767e7a84" : "0x154cf60e137c594516a065149610b6a3989396a42581d5fd8919e711c55da225", + "0xdce8adbdefa929dbe60245f359446db4174c62824b42e5d4d9e7b834b4d61deb" : "0x2c9069845b2e74c577ff1cd18df6bc452805f527a9ee91fd4a059e0408b5dea6", + "0x45ceb8da6fb8936592d3bce4883f1a6a34d636f559e0a1070a5802a65ac39bd5" : "0x57a5122ff3bf737b0de0f9f08011a8648c19e43ff071fb7086234723c9383f1f", + "0xdd9493073db9e42fd955e834c89a74089f99196186ee0b2688124989be00d198" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xdd9493073db9e42fd955e834c89a74089f99196186ee0b2688124989be00d197" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x39050607fe892059a6344ab0f594f382fb0b345cab373497246dbe86fe7e14e7" : "0x2b3bca833e482737e7e47b1568e6f890f8e1666490d38fe130abd6f0ccb109cf", + "0x2bf9fd8facdd6fd9c84657f5ad7381a5aecf670cda68cb3c5829b6532c865506" : "0x53098a1d111586dbcc0d051846284f5803c63c313e7f7e6d84430435d11d4c50", + "0x7a9dcee62e3e02cc8e020f372df2efdeb835f091c1ef1dbe221072d1095aabd2" : "0x00000000000000000000000000000000000000000000002f0000000000000000", + "0xdd9493073db9e42fd955e834c89a74089f99196186ee0b2688124989be00d196" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xba8d79990898383919e437f2458b93b340072c89d963808d9e04f51858e3c5ec" : "0x41d2cac534d90a0dbd199117481a63e32cc11411dab2eaa36c91c0eec62823cf", + "0x70b3bf53996fac325eb67608a4eeb0cd0b55def6255d7ed42ad28ec07238b5d6" : "0x45e9723e9232b37207ecac1c97b8647d053625a578d450f7456280b2ff8efc27", + "0xd66f52a4e24585238ccc03443b2fdb8b2b100259bc7260f39097c7c339211ffe" : "0x1641851904381915c86b60df7e288896fb5f8ebad65d594829fb9f2b59cd1da6", + "0xfd280ac5182d5b2366122f38acfa6dc471240ffde9d5feb985ce7a2325c960e7" : "0x0000000000000000000000000000000000000000000000000000000000000003", + "0x34cabe0c7e64a2caa93fd8d6a0defc07acb9d44b13430fa3ae9282fffd40dee5" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x4aa6b934608a45c8f53a945c05ddee1814a3b9f63a048fc7ad3d47e67156f024" : "0xd03862becedada67b4825a0238f3e67495ccb595cd7d08f1bd5d3160644b9299", + "0xf043b5a1952847579f233706a8f130889a484d2da3e574fdd5859f05aaf52111" : "0x0000000000000000000000000000000000000000000000000000000000000002", + "0x1489023d18c5d10427c4aa8dc726e840eb5ae7f604a8e9243c61634fb009e4d8" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xc98339d275eef16e0562ca8521212cef61aa0f39b12e2a27502aaa97a9e5e70f" : "0x5a3de2a5c268cdb75f4b01507aa80c4e4a1bc67bcb0df265bbb00060774e5978", + "0x1489023d18c5d10427c4aa8dc726e840eb5ae7f604a8e9243c61634fb009e4d7" : "0x0000000000000000000000000000000000000000000000000000000000000005", + "0x5cb38b16db1d632086d4af695de7f5f242a6e40947067f96edd566fe2ac438ef" : "0x6d0be832b2007ea28cda705b73922cbf9794c5a25b89bd2f28b7347ed2b96c86", + "0x3379e7ae125c5c5d623d1d993c1459b61d6723b1c30d1aa026c48f6a6155b8ea" : "0x8c4183732567a99a8a718e363391e102532f9a640e42968cf2354d9acc908bb0", + "0xed7d6e2d40fbd5046412ffad1c45b63d87c6197182d6dbc66bb1e5c6e4ded5c7" : "0xaba4cd295118a482a0a62579e35e4ba5bdd76146cc9e4d96172fce8be8977ab4", + "0xdd9493073db9e42fd955e834c89a74089f99196186ee0b2688124989be00d199" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0x4b8b58f0b0e326a5907d1a810e5ff31e05b4cab45125b776db8577e7dbc46bce" : "0x00000000000000000000000000000000000000000000002f0000000000000000", + "0x3111bfd25728c0adfad0f8c1ad79cb1b91167267deca98de88f156ed25caeedc" : "0xad393086f30b49511b08fdd27ac78810b084c7cd7de6ac354f614c18ea9e7df4", + "0xd8f720c05a5526dd621d1831ae122abddd3dfecd8b63b0ba4c92fa7b2ade44ff" : "0xad393086f30b49511b08fdd27ac78810b084c7cd7de6ac354f614c18ea9e7df4", + "0x4c33460347337bfc7df08bf182988301b7b426a27a67f1c6c634f637c60e87ac" : "0xbab4ab2ad4eafe7c84ef6a8cd69157d9ce6b843793a2cd0877b8e91f63cb2d4d", + "0xf40f4cfdacb62dd799f36b580349fac1f4a4caf8dd3383cc387c35adb6574e21" : "0x00000000000000000000000000000000000000000000002f0000000000000000", + "0xb4a2b68c48ef78aeb641ee538fad51781022fd23ed9d93d211017db6a02376ce" : "0x0fbc06642245cf2fed7ed46ea0a18a7185830b6f2c4e0a4ca55246041e8bfa72", + "0x64a9621cc4ba92bf738c55010c609dfaa3972a1138c30b5adcef1ba2363b360e" : "0xd7953bfe8cb591f129fd0862a9e9c421151e2b5831560ff5215d23f751364b35", + "0x8da187157087529ee4e9c381f8e3149c56acf3bdfda29b8b9b4532f24b83f5fe" : "0x8c4183732567a99a8a718e363391e102532f9a640e42968cf2354d9acc908bb0", + "0x7e4d8c0f6d8abb4ce1ae45b254046aceedabfa9548851b8b5d3e2c0637c985fd" : "0x000000000000000000000000000000000000000000000000000000000000000b", + "0xaffe808b495d13a14391ce5f27c211c36da12826969cd7841ee0d81e5b900e2d" : "0x0000000000000000000000000000000000000000000000000000000000000001", + "0xdd9493073db9e42fd955e834c89a74089f99196186ee0b2688124989be00d19a" : "0x0000000000000000000000000000000000000000000000000000000000000001" + } + }, + "e509e3a93beb1eba72f8cb8d25f93a85e2d54afb" : { + "balance" : "0", + "code" : "0x6000610b7f537c01000000000000000000000000000000000000000000000000000000006000350473c9ae5868651bf7b7db6e360217db49ce4e69c07e6020526308d3d58781141561024557600435606052606060605990590160009052600081526060518160200152600181604001528090502054608052600060806080599059016000905260008152606051816020015260028160400152328160600152809050205414151561014e57608060805990590160009052600081526060518160200152600281604001523281606001528090502054608052682f000000000000000060a060a059905901600090526000815260605181602001526000816040015260805181606001526000816080015280905020553260a060a05990590160009052600081526060518160200152600081604001526080518160600152600181608001528090502055610238565b608051608060805990590160009052600081526060518160200152600281604001523281606001528090502055682f000000000000000060a060a059905901600090526000815260605181602001526000816040015260805181606001526000816080015280905020553260a060a059905901600090526000815260605181602001526000816040015260805181606001526001816080015280905020556001606060605990590160009052600081526060518160200152600181604001528090502054016060606059905901600090526000815260605181602001526001816040015280905020555b60016101e05260206101e0f35b6328c8b31581141561029d576004356060526024356102005260a060a0599059016000905260008152606051816020015260008160400152610200518160600152600081608001528090502054610220526020610220f35b6374af23ec8114156103865760043560605260243561026052608060805990590160009052600081526060518160200152600281604001526102605181606001528090502054610200526000610200511415610332576102605160a060a05990590160009052600081526060518160200152600081604001526102005181606001526001816080015280905020541415610335565b60005b156103475760006102c05260206102c0f35b60a060a05990590160009052600081526060518160200152600081604001526102005181606001526000816080015280905020546102e05260206102e0f35b6384d646ee8114156103dc5760043560605260243560805260a060a05990590160009052600081526060518160200152600081604001526080518160600152600181608001528090502054610320526020610320f35b63f42294278114156106f45760043561026052601c602459905901600090520163175c6322601c82035260206103a06004836000602051602d5a03f1506103a0519050610360526102605115610581576103605160020280602002602001599059016000905281815260208101905090506103c05261036051806020026020015990590160009052818152602081019050905061042052601c602459905901600090520163c3387858601c8203526103605160408160200201599059016000905281602002604001816004856000602051602d5a03f150604081019050905090506104205260006104c05260006104e0525b610360516104c051121561057c576104c051602002610420510151606052601c60645990590160009052016374af23ec601c82035260605160048201526102605160248201526020610520604483600030602d5a03f1506105205190506105005260006105005114151561056c576060516104e0516020026103c05101526105005160016104e051016020026103c051015260026104e051016104e0525b60016104c051016104c0526104ce565b6106d7565b32610260526103605160020280602002602001599059016000905281815260208101905090506103c05261036051806020026020015990590160009052818152602081019050905061042052601c602459905901600090520163c3387858601c8203526103605160408160200201599059016000905281602002604001816004856000602051602d5a03f150604081019050905090506104205260006104c05260006104e0525b610360516104c05112156106d6576104c051602002610420510151606052601c60645990590160009052016374af23ec601c820352606051600482015261026051602482015260206105c0604483600030602d5a03f1506105c0519050610500526000610500511415156106c6576060516104e0516020026103c05101526105005160016104e051016020026103c051015260026104e051016104e0525b60016104c051016104c052610628565b5b6103c05160206040820352602060208203510260400160408203f3505b6380b5e7bd81141561073557600435606052606060605990590160009052600081526060518160200152600181604001528090502054610600526020610600f35b63156f1c328114156107865760043560605260243561064052608060805990590160009052600081526060518160200152600281604001526106405181606001528090502054610660526020610660f35b63b3a24fc081141561087857365990590160009052366004823760043560208201016106c0526024356106e05250600260206106c0510351018060200260200159905901600090528181526020810190509050610700523261070051526106e051602061070051015260026104c0525b600260206106c0510351016104c05112156108385760026104c051036020026106c05101516104c05160200261070051015260016104c051016104c0526107f6565b60206107005103516020026020599059016000905260208183610700516000600287604801f15080519050905061076052610760516107c05260206107c0f35b63e346f5fc811415610a1c576004356107e0526024356108005260006104c0525b606060605990590160009052600081526107e05181602001526001816040015280905020546104c05112156109e65760a060a05990590160009052600081526107e0518160200152600081604001526104c0518160600152600181608001528090502054610840526108405160a060a0599059016000905260008152610800518160200152600081604001526104c051816060015260018160800152809050205560a060a05990590160009052600081526107e0518160200152600081604001526104c051816060015260008160800152809050205460a060a0599059016000905260008152610800518160200152600081604001526104c05181606001526000816080015280905020556104c0516080608059905901600090526000815261080051816020015260028160400152610840518160600152809050205560016104c051016104c052610899565b6104c051606060605990590160009052600081526108005181602001526001816040015280905020556001610920526020610920f35b633fb57036811415610b5457600435606052602435610940526060606059905901600090526000815260605181602001526001816040015280905020546109605261096051608060805990590160009052600081526060518160200152600281604001526109405181606001528090502055600060a060a05990590160009052600081526060518160200152600081604001526109605181606001526000816080015280905020556109405160a060a05990590160009052600081526060518160200152600081604001526109605181606001526001816080015280905020556001606060605990590160009052600081526060518160200152600181604001528090502054016060606059905901600090526000815260605181602001526001816040015280905020556001610a40526020610a40f35b6312709a33811415610beb57600435606052602435608052604435610a6052610a605160a060a059905901600090526000815260605181602001526000816040015260805181606001526000816080015280905020540160a060a059905901600090526000815260605181602001526000816040015260805181606001526000816080015280905020556001610ac0526020610ac0f35b633229cf6e811415610c8257600435606052602435608052604435610a6052610a605160a060a059905901600090526000815260605181602001526000816040015260805181606001526000816080015280905020540360a060a059905901600090526000815260605181602001526000816040015260805181606001526000816080015280905020556001610b20526020610b20f35b63a75f5c6a811415610ce557600435606052602435608052604435610a6052610a605160a060a059905901600090526000815260605181602001526000816040015260805181606001526000816080015280905020556001610b60526020610b60f35b50", + "nonce" : "0", + "storage" : { + "0xec5e7f54fa5e516e616b04f9d5a0ee433a80e09ed47d7e5269afd76c05ff251e" : "0x0000000000000000000000000000000000000000000000000000000000000002", + "0xaf1d6676be3ab502a59d91f6f5c49baffc15b2cfc65a41c4d96857c0f535adba" : "0x0000000000000000000000000000000000000000000001d60000000000000000", + "0xdf1a770f69d93d1719292f384fdb4da22c0e88aef2ba462bff16674bc7848730" : "0x0000000000000000000000001c11aa45c792e202e9ffdc2f12f99d0d209bef70", + "0x0f299dbbe3a7a5d949fe794e9a47b3106699c8110ff986eb84921c183e69e7f0" : "0x00000000000000000000000000000000000000000000002f0000000000000000", + "0x689082d076ec3c02cbe4b99f6d9833e3c4a161072fd42fb7649eee5189a67ccc" : "0x00000000000000000000000063524e3fe4791aefce1e932bbfb3fdf375bfad89", + "0x1edcd36f61cae5dc6414157dfbadf9f11ca013ac763e27f8af55feaa8a239c89" : "0x0000000000000000000000000000000000000000000000000000000000000001" + } + }, + "9761fecf88590592cf05ce545504d376d1693ab3" : { + "balance" : "0", + "code" : "0x60006105df537c010000000000000000000000000000000000000000000000000000000060003504730ea65418d7bf32680f55572c943a94b59080499860205273e509e3a93beb1eba72f8cb8d25f93a85e2d54afb60405273c9ae5868651bf7b7db6e360217db49ce4e69c07e60605273f1562e1c0d0baa3ea746442bb7f11153fcf5cfda60805263546fdeb381141561038d5760043560c05260243560e05260443561010052606435610120526084356101405260026101005101601c606459905901600090520163e05dcb56601c82035260c051600482015260e05160248201526002610100510160408160200201599059016000905281602002604001816044856000602051602d5a03f150604081019050905090506000600161010051016020028201511415610250576060601c61014c59905901600090520163e365736b601c82035260c051600482015260e0516024820152601c6084599059016000905201632f300bee601c82035260026004820152600560248201526101005160448201528460408160200201599059016000905281602002604001816064856000608051602d5a03f1506040810190509050905060208103516020026020018360448401526020820360a4840152806101088401528084019350505081600401599059016000905260648160648460006004601cf16101fc57fe5b6064810192506101088201518080858260a487015160006004600a8705601201f161022357fe5b50808401935050808303602061028082846000602051602d5a03f15061028051905090509050905061037d565b6060601c61014c59905901600090520163e365736b601c82035260c051600482015260e0516024820152601c6084599059016000905201632f300bee601c820352600160016101005101602002850151036004820152600560248201526101005160448201528460408160200201599059016000905281602002604001816064856000608051602d5a03f1506040810190509050905060208103516020026020018360448401526020820360a4840152806101088401528084019350505081600401599059016000905260648160648460006004601cf161032d57fe5b6064810192506101088201518080858260a487015160006004600a8705601201f161035457fe5b5080840193505080830360206102c082846000602051602d5a03f1506102c05190509050905090505b5060016102e05260206102e0f350505b63de9080c88114156107645760043560c05260243560e05260443561010052606435610120526084356101405260026101005101601c606459905901600090520163e05dcb56601c82035260c051600482015260e05160248201528160408160200201599059016000905281602002604001816044856000602051602d5a03f15060408101905090509050601c6064599059016000905201632c5a40d5601c82035260c051600482015260e05160248201526101405160408160200201599059016000905281602002604001816044856000602051602d5a03f1506040810190509050905061012051806020026020015990590160009052818152602081019050905060005b610120518112156104ee57601c60645990590160009052016328c8b315601c82035260c051600482015281602482015260206103606044836000604051602d5a03f15061036051905081602002830152600181019050610493565b5060a0601c61020c59905901600090520163a647a5b9601c8203528460208103516020026020018360048401526020820360a484015280610148840152808401935050508360208103516020026020018360248401526020820360c484015280610168840152808401935050508260208103516020026020018360448401526020820360e4840152806101888401528084019350505061012051606482015261010051608482015281600401599059016000905260a48160a484600060046022f16105b557fe5b60a4810192506101488201518080858260a487015160006004600a8705601201f16105dc57fe5b508084019350506101688201518080858260c487015160006004600a8705601201f161060457fe5b508084019350506101888201518080858260e487015160006004600a8705601201f161062c57fe5b5080840193505080830387604081602002015990590160009052816020026040018184866000608051602d5a03f1506040810190509050905090509050905092506060601c61014c59905901600090520163e365736b601c82035260c051600482015260e05160248201528460208103516020026020018360448401526020820360a4840152806101088401528084019350505081600401599059016000905260648160648460006004601cf16106df57fe5b6064810192506101088201518080858260a487015160006004600a8705601201f161070657fe5b5080840193505080830360206103c082846000602051602d5a03f1506103c05190509050905090505060006101005160200284015114156107525760006103e05260206103e0f361075f565b6001610400526020610400f35b505050505b63384ca8dd811415610a665760043560c05260243560e052604435610100526064356101205260843561014052601c606459905901600090520163e05dcb56601c82035260c051600482015260e05160248201526002610100510160408160200201599059016000905281602002604001816044856000602051602d5a03f15060408101905090509050601c606459905901600090520163fa9832d1601c82035260c051600482015260e05160248201526101005160408160200201599059016000905281602002604001816044856000602051602d5a03f15060408101905090509050601c608459905901600090520163aad7d6e3601c82035260c051600482015260e05160248201526060601c61014c599059016000905201635b180229601c8203528360208103516020026020018360048401526020820360648401528060c8840152808401935050508460208103516020026020018360248401526020820360848401528060e88401528084019350505061010051604482015281600401599059016000905260648160648460006004601cf161090157fe5b60648101925060c882015180808582606487015160006004600a8705601201f161092757fe5b5080840193505060e882015180808582608487015160006004600a8705601201f161094e57fe5b50808401935050808303602061044082846000608051602d5a03f150610440519050905090509050604482015260206104606064836000602051602d5a03f150610460519050506060601c61014c59905901600090520163222a8663601c82035260c051600482015260e05160248201528260208103516020026020018360448401526020820360a4840152806101088401528084019350505081600401599059016000905260648160648460006004601cf1610a0757fe5b6064810192506101088201518080858260a487015160006004600a8705601201f1610a2e57fe5b50808401935050808303602061048082846000602051602d5a03f1506104805190509050905090505060016104a05260206104a0f350505b63d5dc5af1811415610d4b5760043560c05260243560e052604435610100526064356101205260843561014052601c606459905901600090520163e05dcb56601c82035260c051600482015260e05160248201526002610100510160408160200201599059016000905281602002604001816044856000602051602d5a03f15060408101905090509050601c6064599059016000905201632c5a40d5601c82035260c051600482015260e05160248201526101405160408160200201599059016000905281602002604001816044856000602051602d5a03f150604081019050905090506080601c6101ac59905901600090520163f4ca7dc4601c82035283602081035160200260200183600484015260208203608484015280610108840152808401935050508260208103516020026020018360248401526020820360a4840152806101288401528084019350505061012051604482015261010051606482015281600401599059016000905260848160848460006004601ff1610be757fe5b60848101925061010882015180808582608487015160006004600a8705601201f1610c0e57fe5b508084019350506101288201518080858260a487015160006004600a8705601201f1610c3657fe5b5080840193505080830361014051604081602002015990590160009052816020026040018184866000608051602d5a03f1506040810190509050905090509050905090506060601c61014c59905901600090520163b39e1faa601c82035260c051600482015260e05160248201528260208103516020026020018360448401526020820360a4840152806101088401528084019350505081600401599059016000905260648160648460006004601cf1610cec57fe5b6064810192506101088201518080858260a487015160006004600a8705601201f1610d1357fe5b5080840193505080830360206104c082846000602051602d5a03f1506104c05190509050905090505060016104e05260206104e0f350505b630939aa8c81141561114c5760043560c05260243560e052604435610100526064356101205260843561014052601c606459905901600090520163e05dcb56601c82035260c051600482015260e05160248201526002610100510160408160200201599059016000905281602002604001816044856000602051602d5a03f15060408101905090509050601c6064599059016000905201637dc12195601c82035260c051600482015260e05160248201526101405160408160200201599059016000905281602002604001816044856000602051602d5a03f15060408101905090509050601c606459905901600090520163586b5be0601c82035260c051600482015260e051602482015260206105006044836000602051602d5a03f150610500519050601c606459905901600090520163eb8af5aa601c82035260c051600482015260e05160248201526101205160408160200201599059016000905281602002604001816044856000602051602d5a03f1506040810190509050905060c0601c61026c59905901600090520163232b2734601c8203528260208103516020026020018360048401526020820360c484015280610188840152808401935050508560208103516020026020018360248401526020820360e4840152806101a88401528084019350505084602081035160200260200183604484015260208203610104840152806101c8840152808401935050508360648201526101205160848201526101005160a482015281600401599059016000905260c48160c484600060046025f1610f9657fe5b60c4810192506101888201518080858260c487015160006004600a8705601201f1610fbd57fe5b508084019350506101a88201518080858260e487015160006004600a8705601201f1610fe557fe5b508084019350506101c88201518080858261010487015160006004600a8705601201f161100e57fe5b5080840193505080830361012051604081602002015990590160009052816020026040018184866000608051602d5a03f1506040810190509050905090509050905090506060601c61014c5990590160009052016301112b27601c82035260c051600482015260e05160248201528260208103516020026020018360448401526020820360a4840152806101088401528084019350505081600401599059016000905260648160648460006004601cf16110c457fe5b6064810192506101088201518080858260a487015160006004600a8705601201f16110eb57fe5b50808401935050808303602061058082846000602051602d5a03f15061058051905090509050905050600060016101005101602002850151141561113a5760006105a05260206105a0f3611147565b60016105c05260206105c0f35b505050505b50", + "nonce" : "0", + "storage" : { + } + }, + "f1562e1c0d0baa3ea746442bb7f11153fcf5cfda" : { + "balance" : "0", + "code" : "0x600061067f537c010000000000000000000000000000000000000000000000000000000060003504632f300bee8114156100ac576004356040526024356060526044356080526002608051018080602002602001599059016000905281815260208101905090506801000000000000000081526060516080516020028201526001604051036001608051016020028201528060206040820352602060208203510260400160408203f35050505b63a647a5b98114156102c85736599059016000905236600482376004356020820101610100526024356020820101610160526044356020820101610180526064356101a05260843560805250602061010051035180806020026020015990590160009052818152602081019050905060005b6101a0518112156101d557600060005b608051811215610162578060200261010051015181608051850201602002610160510151028201915060018101905061012e565b50680100000000000000008105905060005b6080518112156101c857700100000000000000000000000000000000836020026101805101518260805186020160200261016051015184020205816020028501510381602002850152600181019050610174565b505060018101905061011e565b50600060005b60805181121561020357806020028301518160200284015102820191506001810190506101db565b5068010000000000000000810590506002810560005b600b81121561024257600282680100000000000000008502058301059150600181019050610219565b5060005b60805181121561027657816801000000000000000082602002860151020581602002850152600181019050610246565b5050506001608051602002610100510151036080516020028201526001608051016020026101005101516001608051016020028201528060206040820352602060208203510260400160408203f35050505b635b18022981141561037957365990590160009052366004823760043560208201016103005260243560208201016103205260443560805250600060005b60805181121561033f57680100000000000000008160200261032051015182602002610300510151020582019150600181019050610306565b6000610320515114151561036657610320515168010000000000000000830205915061036b565b600091505b81610380526020610380f350505b63f4ca7dc481141561057157365990590160009052366004823760043560208201016103a05260243560208201016103c0526044356101a0526064356080525060206103c051035160026080510a806020026020015990590160009052818152602081019050905060005b60805181121561044d5760005b6080518112156104415768010000000000000000816020026103a0510151836020026103a051015102058160805184020160200284015101816080518402016020028401526001810190506103f1565b506001810190506103e4565b81905090508180602002602001599059016000905281815260208101905090506080516101a05102806020026020015990590160009052818152602081019050905060005b6101a05181121561051e5760005b6080518112156105125760005b608051811215610506576801000000000000000082608051830201602002870151826080518602016020026103c051015102058260805185020160200285015101826080518502016020028501526001810190506104ad565b506001810190506104a0565b50600181019050610492565b819050905060005b848112156105525780602002820151816020026103c05101510381602002840152600181019050610526565b508160206040820352602060208203510260400160408203f350505050505b63232b273481141561069d57365990590160009052366004823760043560208201016106205260243560208201016102805260443560208201016103c052606435610640526084356101a05260a435608052506000610280515112156106025760005b6080518112156106005780602002610280510151600003816020026102805101526001810190506105d4565b505b60005b6101a05181121561067f5760005b60805181121561067357680100000000000000006801000000000000000082602002610280510151610640510205826080518502016020026103c05101510205826020026106205101510182602002610620510152600181019050610613565b50600181019050610605565b6106205160206040820352602060208203510260400160408203f350505b50", + "nonce" : "0", + "storage" : { + } + }, + "1cdc8315bdb1362de8b7b2fa9ee75dc873037179" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "0000000000000000000000000000000000000001" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "0000000000000000000000000000000000000002" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "0000000000000000000000000000000000000003" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "0000000000000000000000000000000000000004" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "0000000000000000000000000000000000000000" : { + "balance" : "0x01", + "code" : "0x", + "nonce" : "0x00", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "4000000000000000000000", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "0x36a560bd00000000000000000000000000000000000000000000000000000000000f69b5", + "gasLimit" : "3000000", + "gasPrice" : "10000000000000", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "b03f030056db7d467d778326658bac0d1b35d8f7", + "value" : "0" + } } } From 0426393557eaa793fe5dfc5c6b9a7d60c5f58a5b Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 14 Jun 2015 12:37:29 +0800 Subject: [PATCH 009/169] Include hash in client ID. --- eth/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth/main.cpp b/eth/main.cpp index 259a993c9..4b23ef62a 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -685,7 +685,7 @@ int main(int argc, char** argv) VMFactory::setKind(jit ? VMKind::JIT : VMKind::Interpreter); auto netPrefs = publicIP.empty() ? NetworkPreferences(listenIP ,listenPort, upnp) : NetworkPreferences(publicIP, listenIP ,listenPort, upnp); auto nodesState = contents((dbPath.size() ? dbPath : getDataDir()) + "/network.rlp"); - std::string clientImplString = "++eth/" + clientName + "v" + dev::Version + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) + (jit ? "/JIT" : ""); + std::string clientImplString = "++eth/" + clientName + "v" + dev::Version + "-" + string(DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) + (ETH_CLEAN_REPO ? "" : "*") + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) + (jit ? "/JIT" : ""); dev::WebThreeDirect web3( clientImplString, dbPath, From fe011b3563af02f52ef83a1522935fb48eda2b69 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 14 Jun 2015 12:38:49 +0800 Subject: [PATCH 010/169] Avoid building neth unless made explicit, at least until build works again. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a2ac51a5..fd3188eae 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,7 +37,7 @@ option(ETHKEY "Build the CLI key manager component" ON) option(SOLIDITY "Build the Solidity language components" ON) option(SERPENT "Build the Serpent language components" ON) option(TOOLS "Build the tools components" ON) -option(NCURSES "Build the NCurses components" ON) +option(NCURSES "Build the NCurses components" OFF) option(GUI "Build GUI components (AlethZero, Mix)" ON) option(TESTS "Build the tests." ON) option(EVMJIT "Build just-in-time compiler for EVM code (requires LLVM)" OFF) @@ -222,7 +222,7 @@ elseif (BUNDLE STREQUAL "full") set(SOLIDITY ON) set(USENPM ON) set(GUI ON) - set(NCURSES ${DECENT_PLATFORM}) +# set(NCURSES ${DECENT_PLATFORM}) set(TOOLS ON) set(TESTS ON) set(FATDB ON) @@ -249,7 +249,7 @@ elseif (BUNDLE STREQUAL "user") set(SOLIDITY OFF) set(USENPM OFF) set(GUI ON) - set(NCURSES ${DECENT_PLATFORM}) +# set(NCURSES ${DECENT_PLATFORM}) set(TOOLS ON) set(TESTS OFF) elseif (BUNDLE STREQUAL "wallet") From 9570c72e379a8620fddc59317d6b2137ce73f42d Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Sun, 14 Jun 2015 07:36:34 +0200 Subject: [PATCH 011/169] new osx dragndrop installer --- CMakeLists.txt | 2 +- appdmg.json.in | 8 ++++---- bg.png | Bin 175517 -> 0 bytes install-folder-bg.png | Bin 0 -> 14542 bytes install-folder-bg@2x.png | Bin 0 -> 35073 bytes 5 files changed, 5 insertions(+), 5 deletions(-) delete mode 100644 bg.png create mode 100644 install-folder-bg.png create mode 100644 install-folder-bg@2x.png diff --git a/CMakeLists.txt b/CMakeLists.txt index fd3188eae..71d12353c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -458,7 +458,7 @@ if (APPLE AND GUI) -DAPP_DMG_EXE=${ETH_APP_DMG} -DAPP_DMG_FILE=appdmg.json.in -DAPP_DMG_ICON="alethzero/alethzero.icns" - -DAPP_DMG_BACKGROUND="bg.png" + -DAPP_DMG_BACKGROUND="install-folder-bg.png" -DETH_BUILD_DIR="${CMAKE_BINARY_DIR}" -DETH_MIX_APP="$" -DETH_ALETHZERO_APP="$" diff --git a/appdmg.json.in b/appdmg.json.in index 4fb9a6e33..ea49e9294 100644 --- a/appdmg.json.in +++ b/appdmg.json.in @@ -2,11 +2,11 @@ "title": "Ethereum", "icon": "appdmg_icon.icns", "background": "appdmg_background.png", - "icon-size": 80, + "icon-size": 55, "contents": [ - { "x": 600, "y": 170, "type": "link", "path": "/Applications" }, - { "x": 150, "y": 90, "type": "file", "path": "${ETH_ALETHZERO_APP}" }, - { "x": 150, "y": 260, "type": "file", "path": "${ETH_MIX_APP}" } + { "x": 242, "y": 240, "type": "link", "path": "/Applications" }, + { "x": 145, "y": 125, "type": "file", "path": "${ETH_ALETHZERO_APP}" }, + { "x": 339, "y": 125, "type": "file", "path": "${ETH_MIX_APP}" } ] } diff --git a/bg.png b/bg.png deleted file mode 100644 index 869290c2b861dd148e1ae500770f3bc47879761e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 175517 zcmZU(WmsHGvo<`qYjAf7?#_@va19Otg1fuByF>8c?(Pmj1_>72-5mz_$bQayo_(%w z>c_0L+N!Hdy6*09MR^GnL;^$r0DvMTDfSfrfO>y~Fo%bH|0@VxGynkbl+8s&6{SQ) z$rK%IP0X!~0RRnzN=;K0Y`MgkM z9}`r>5GVq|=*SQeDKNznC@2t@ar>W7vsZlu_Q%IL=H|Fm=jN1kga8*a@st#wS!Dr1 zAzze<#*u@+t*!*a+X7HFV2DHr&_~ylFktWQ<~QC1yHEi^e;&TYd^~!4x2Xaq zF`%!0i`#x9O_RNQVn~#|dyDj4g7oaeC4>|I5)^lDEe!V6{VZyb+s%!p?^cMEn!Bp7rJfp@4E9vCr5rba3$E*KMd@y;RT-THxN+E+rZPGU6jY zgexS@MnAk5>^*5OzkH+tMFm+=tK52~0c7;%FEHo1M|x4TwtkBR@SQ zkq#zVQ0{y>{G3nrCn+|Uj99KA)yOPnymSi}a;9%k?LIS1pVLw!Wy0!C7Py9M*-b6`y0spKf$ zKEhV`W3a-0CWFn^B_o3N@5x?z(tNlnAH<4-fO&w@BfHPIDh?epk-_UY16*!=fDaT@ z@_oj)X?hCKkbHYgeJZaex>&Y~UOmA;7VhB*GH|bH)3C1K>Nx6GMkx261J5diUB+g+ zedu6YBeIQHzY2xy$eSm>DDdlf3pRmS_R4d{azlAG?C-v^Be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E{oopxgcL;(to`&k_Ow1n)n0_)iHyPtE@kCCC#ghf%FR ziQBuzMRVCcbR95Ao}n98{V_Wf3B(*L-1#|NMWwR^(KkixXSB@$uLHGW&Bh zU30Op_4hw(er)qH;IHt6WNm!q-aBYcW$*2oI)QVcZy|p-ub3G}418{7?6o;5;J_+Rb_|bQB8K5Znm+_6TKrESez4T(1 j^A|`6q(cdI!LDmvB|*Yb3j;n-BzUf(@dWnRJm`M_*w*CT literal 0 HcmV?d00001 diff --git a/install-folder-bg@2x.png b/install-folder-bg@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..31aac5522ee552c079977c054adaa41f8b09886f GIT binary patch literal 35073 zcmeFZXH-*L*FOqKQ4moPIMR;@C_86-~@ZdSK+XtuG7khuT9&gVlcp(f=3Y>V*g9fcWo;XqlQiI1CkaZIA048e)b^Ep^+y$wYjW z6Q=6p;Hk2;-p@)-tx)P9Q}b}~2=L@v_3u;2cnS#@DON;DzW(&yvRAM0ZuOVVKFtt%<_&JjP@A0d za7hz!1ZDq{w8*v%@$y52&D>?&x za~pK5wSjr!9um>ayqqs@h4Eh1^q0*jcE}TPYz=BO80xj-s>Vmm$otMyiK=ESm%cxr z>WFFRAr1}ttj1m77;*c-Ab9P=UdQ&7j<&%wfzZkVF)mot=3Y;dHUBX zX|&E4Q#Ot1YX$aZ`mVxB$q+wke;O z`Fmw)it9JtK|FswxQN@%iZ_R{fcIP<@9b~HBP%e@2(c`$7uWW}UHpIS@1z|_XX(2j zDKK(;;7~49VDfUg zda%7v49(P#MIctxqijckH0A;80u42@gYgypj=#UZ8qCp58}_@Kx;HHhzLC-qu-g~k zXmtRPxqwt#Tu<9yNK->~Y0A*cto;1>bKmr$Pd#}BfuBusapvF#?@Y&Blpb8C^Peds zEx!^Jox(ldt$h*yJ7jm{55q>oiF$=pr*Gn~>tgig3v1|} zWySjM3~8Dtb*V>5(VW~$2fz-?v+}F7zB-Dah=d}D?vAO+Xh2O?nZ$^Q>a&Y42Firu z#2)g#o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Yv7BZJM@sxDD>2jCcdsG=t7L;dEdk!gfxB%NoKouKT9}SlSX`? zm8mp)JY}5FuDWC=AV?8<0>SSU6t4Xs6g9Oj8aEXU_KmQ6IfpuMf+{h;kcn_|sOD0n ziP6fpy3FW+S>R3qLE(ck#kxEF(Mhwjz1x2bU0MY=kq(@k$aU@ZNGG!}SFuxu;XC+y zO6(OT#9kXS4F4)^;?h2r-HX=2#!*IZ-rp0!cxvc)h8xkjf=4Z@)x-F$Y##wsaj|3a zBU9sldbu_^Jz(K3;`A+VxN8FBN5ufBC6s{;P}a{xdCqLg##&3D_))(`-(&xk+_y0z`el5sYZ*PPU&?iih63u)610?>l z&sRkWO~2`HA1baTz8B1t$EzWoVKux4LZ7E z;FoC?_c9X@Sf}R}vLj+!-03p+_ zh?{Qf^;|JeVhNl@hw1V^dj-aG)`+CiyNyvw9MXpA|2j$#BN&k&Z*kK5a&D&Q%8SYh zDZ~`WzKs8^AAiYu9bUAW=U`ejbI>8Pe&(%%dPisHczGCSlS+I%D8`tD|6k{tBGknn xk%iUyK0^FSz0hLOEd7yeagv1pi)bhpbufzlg|e8owuApOxoUm|bIB$0zW}ov4_*KO literal 0 HcmV?d00001 From aca7c7c01e4731341d71106d67b7f5e208dbc002 Mon Sep 17 00:00:00 2001 From: arkpar Date: Sun, 14 Jun 2015 08:28:05 +0200 Subject: [PATCH 012/169] enable syncing with rude peer --- libethereum/EthereumHost.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index 67a21d36a..e69bfa684 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -758,10 +758,6 @@ bool EthereumHost::peerShouldGrabBlocks(EthereumPeer* _peer) const bool EthereumHost::peerShouldGrabChain(EthereumPeer* _peer) const { - // Early exit if this peer has proved unreliable. - if (_peer->isRude()) - return false; - h256 c = m_chain.currentHash(); unsigned n = m_chain.number(); u256 td = m_chain.details().totalDifficulty; From 30e47e38cb98e309870bb166b56d6cf6826c91f4 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 14 Jun 2015 04:05:53 -0400 Subject: [PATCH 013/169] Slightly more aggressive 'require peer', required-peer pinning, and option to disable discovery. --- eth/main.cpp | 17 +++++++++++++++++ libp2p/Host.cpp | 7 ++++--- libp2p/Network.h | 2 ++ libp2p/NodeTable.cpp | 12 ++++++++---- libp2p/NodeTable.h | 4 +++- libp2p/Peer.cpp | 2 ++ 6 files changed, 36 insertions(+), 8 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 4b23ef62a..bc143154e 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -168,6 +168,9 @@ void help() << " --port Connect to remote port (default: 30303)." << endl << " --network-id Only connect to other hosts with this network id (default:0)." << endl << " --upnp Use UPnP for NAT (default: on)." << endl + << " --no-discovery Disable Node discovery. (experimental)" << endl + << " --pin Only connect to required (trusted) peers. (experimental)" << endl +// << " --require-peers List of required (trusted) peers. (experimental)" << endl << endl; MinerCLI::streamHelp(cout); cout @@ -304,6 +307,8 @@ int main(int argc, char** argv) unsigned short remotePort = 30303; unsigned peers = 11; bool bootstrap = false; + bool disableDiscovery = false; + bool pinning = false; unsigned networkId = 0; /// Mining params @@ -592,6 +597,16 @@ int main(int argc, char** argv) } else if (arg == "-b" || arg == "--bootstrap") bootstrap = true; + else if (arg == "--no-discovery") + if (bootstrap) + { + cerr << "-b/--bootstrap cannot be used with --no-discovery." << endl; + return -1; + } + else + disableDiscovery = true; + else if (arg == "--pin") + pinning = true; else if (arg == "-f" || arg == "--force-mining") forceMining = true; else if (arg == "-i" || arg == "--interactive") @@ -684,6 +699,8 @@ int main(int argc, char** argv) StructuredLogger::get().initialize(structuredLogging, structuredLoggingFormat, structuredLoggingURL); VMFactory::setKind(jit ? VMKind::JIT : VMKind::Interpreter); auto netPrefs = publicIP.empty() ? NetworkPreferences(listenIP ,listenPort, upnp) : NetworkPreferences(publicIP, listenIP ,listenPort, upnp); + netPrefs.discovery = !disableDiscovery; + netPrefs.pin = pinning; auto nodesState = contents((dbPath.size() ? dbPath : getDataDir()) + "/network.rlp"); std::string clientImplString = "++eth/" + clientName + "v" + dev::Version + "-" + string(DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) + (ETH_CLEAN_REPO ? "" : "*") + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) + (jit ? "/JIT" : ""); dev::WebThreeDirect web3( diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 55389ed1b..b0d246458 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -307,7 +307,8 @@ void Host::onNodeTableEvent(NodeId const& _n, NodeTableEventType const& _e) { clog(NetP2PNote) << "p2p.host.nodeTable.events.NodeEntryDropped " << _n; RecursiveGuard l(x_sessions); - m_peers.erase(_n); + if (m_peers.count(_n) && !m_peers[_n]->required) + m_peers.erase(_n); } } @@ -628,7 +629,7 @@ void Host::run(boost::system::error_code const&) { RecursiveGuard l(x_sessions); for (auto p: m_peers) - if (p.second->shouldReconnect() && !havePeerSession(p.second->id)) + if (p.second->shouldReconnect() && !havePeerSession(p.second->id) && (!m_netPrefs.pin || p.second->required)) toConnect.push_back(p.second); } @@ -679,7 +680,7 @@ void Host::startedWorking() else clog(NetP2PNote) << "p2p.start.notice id:" << id() << "TCP Listen port is invalid or unavailable."; - shared_ptr nodeTable(new NodeTable(m_ioService, m_alias, NodeIPEndpoint(bi::address::from_string(listenAddress()), listenPort(), listenPort()))); + shared_ptr nodeTable(new NodeTable(m_ioService, m_alias, NodeIPEndpoint(bi::address::from_string(listenAddress()), listenPort(), listenPort()), m_netPrefs.discovery)); nodeTable->setEventHandler(new HostNodeTableHandler(*this)); m_nodeTable = nodeTable; restoreNetwork(&m_restoreNetwork); diff --git a/libp2p/Network.h b/libp2p/Network.h index d02ce3cbe..97c631a7c 100644 --- a/libp2p/Network.h +++ b/libp2p/Network.h @@ -51,6 +51,8 @@ struct NetworkPreferences std::string publicIPAddress; std::string listenIPAddress; unsigned short listenPort = 30303; + bool discovery = true; // Discovery is activated with network. + bool pin = false; // Only connect to trusted ("required") peers. bool traverseNAT = true; }; diff --git a/libp2p/NodeTable.cpp b/libp2p/NodeTable.cpp index 6344dc263..491795274 100644 --- a/libp2p/NodeTable.cpp +++ b/libp2p/NodeTable.cpp @@ -40,14 +40,15 @@ const char* NodeTableIngress::name() { return "<connect(); - doRefreshBuckets(boost::system::error_code()); + if (!m_disabled) + { + m_socketPointer->connect(); + doRefreshBuckets(boost::system::error_code()); + } } NodeTable::~NodeTable() diff --git a/libp2p/NodeTable.h b/libp2p/NodeTable.h index 0ec13c828..bca14e5d4 100644 --- a/libp2p/NodeTable.h +++ b/libp2p/NodeTable.h @@ -130,7 +130,7 @@ public: enum NodeRelation { Unknown = 0, Known }; /// Constructor requiring host for I/O, credentials, and IP Address and port to listen on. - NodeTable(ba::io_service& _io, KeyPair const& _alias, NodeIPEndpoint const& _endpoint); + NodeTable(ba::io_service& _io, KeyPair const& _alias, NodeIPEndpoint const& _endpoint, bool _disabled = false); ~NodeTable(); /// Returns distance based on xor metric two node ids. Used by NodeEntry and NodeTable. @@ -271,6 +271,8 @@ private: boost::asio::deadline_timer m_bucketRefreshTimer; ///< Timer which schedules and enacts bucket refresh. boost::asio::deadline_timer m_evictionCheckTimer; ///< Timer for handling node evictions. + + bool m_disabled; ///< Disable discovery. }; inline std::ostream& operator<<(std::ostream& _out, NodeTable const& _nodeTable) diff --git a/libp2p/Peer.cpp b/libp2p/Peer.cpp index 6f368a4b4..a8b4a993d 100644 --- a/libp2p/Peer.cpp +++ b/libp2p/Peer.cpp @@ -38,6 +38,8 @@ bool Peer::shouldReconnect() const unsigned Peer::fallbackSeconds() const { + if (required) + return 5; switch (m_lastDisconnect) { case BadProtocol: From 0a0d36382b8e1d5fdfccfeac6b997571a8833603 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 14 Jun 2015 04:50:18 -0400 Subject: [PATCH 014/169] Fix bool. --- eth/main.cpp | 8 +------- libp2p/Network.h | 2 +- libp2p/NodeTable.cpp | 4 ++-- libp2p/NodeTable.h | 2 +- 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index bc143154e..e914bfc31 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -598,13 +598,7 @@ int main(int argc, char** argv) else if (arg == "-b" || arg == "--bootstrap") bootstrap = true; else if (arg == "--no-discovery") - if (bootstrap) - { - cerr << "-b/--bootstrap cannot be used with --no-discovery." << endl; - return -1; - } - else - disableDiscovery = true; + disableDiscovery = true; else if (arg == "--pin") pinning = true; else if (arg == "-f" || arg == "--force-mining") diff --git a/libp2p/Network.h b/libp2p/Network.h index 97c631a7c..e70dd89ea 100644 --- a/libp2p/Network.h +++ b/libp2p/Network.h @@ -51,9 +51,9 @@ struct NetworkPreferences std::string publicIPAddress; std::string listenIPAddress; unsigned short listenPort = 30303; + bool traverseNAT = true; bool discovery = true; // Discovery is activated with network. bool pin = false; // Only connect to trusted ("required") peers. - bool traverseNAT = true; }; /** diff --git a/libp2p/NodeTable.cpp b/libp2p/NodeTable.cpp index 491795274..1a0b11734 100644 --- a/libp2p/NodeTable.cpp +++ b/libp2p/NodeTable.cpp @@ -40,7 +40,7 @@ const char* NodeTableIngress::name() { return "< Date: Sun, 14 Jun 2015 06:30:20 -0400 Subject: [PATCH 015/169] ensure required peers --- libp2p/Host.cpp | 38 ++++++++++++++++++++++++-------------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index b0d246458..596182413 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -619,26 +619,36 @@ void Host::run(boost::system::error_code const&) // updated. // disconnectLatePeers(); // todo: update peerSlotsAvailable() + + list> toConnect; + unsigned reqConn = 0; + { + RecursiveGuard l(x_sessions); + for (auto const& p: m_peers) + { + bool haveSession = havePeerSession(p.second->id); + bool required = p.second->required; + if (haveSession && required) + reqConn++; + else if (!haveSession && p.second->shouldReconnect() && (!m_netPrefs.pin || required)) + toConnect.push_back(p.second); + } + } + + for (auto p: toConnect) + if (p->required && reqConn++ < m_idealPeerCount) + connect(p); + unsigned pendingCount = 0; DEV_GUARDED(x_pendingNodeConns) pendingCount = m_pendingPeerConns.size(); - int openSlots = m_idealPeerCount - peerCount() - pendingCount; - if (openSlots > 0) + int openSlots = m_idealPeerCount - peerCount() - pendingCount + reqConn; + if (openSlots > 0 && !m_netPrefs.pin) { - list> toConnect; - { - RecursiveGuard l(x_sessions); - for (auto p: m_peers) - if (p.second->shouldReconnect() && !havePeerSession(p.second->id) && (!m_netPrefs.pin || p.second->required)) - toConnect.push_back(p.second); - } - for (auto p: toConnect) - if (openSlots--) + if (!p->required && openSlots--) connect(p); - else - break; - + m_nodeTable->discover(); } From 826858496c7847ab97ceeccf0ca4b2296df3f9f6 Mon Sep 17 00:00:00 2001 From: subtly Date: Sun, 14 Jun 2015 06:42:43 -0400 Subject: [PATCH 016/169] cleanup --- libp2p/Host.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 596182413..dd1185c24 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -639,17 +639,20 @@ void Host::run(boost::system::error_code const&) if (p->required && reqConn++ < m_idealPeerCount) connect(p); - unsigned pendingCount = 0; - DEV_GUARDED(x_pendingNodeConns) - pendingCount = m_pendingPeerConns.size(); - int openSlots = m_idealPeerCount - peerCount() - pendingCount + reqConn; - if (openSlots > 0 && !m_netPrefs.pin) + if (!m_netPrefs.pin) { - for (auto p: toConnect) - if (!p->required && openSlots--) - connect(p); - - m_nodeTable->discover(); + unsigned pendingCount = 0; + DEV_GUARDED(x_pendingNodeConns) + pendingCount = m_pendingPeerConns.size(); + int openSlots = m_idealPeerCount - peerCount() - pendingCount + reqConn; + if (openSlots > 0) + { + for (auto p: toConnect) + if (!p->required && openSlots--) + connect(p); + + m_nodeTable->discover(); + } } auto runcb = [this](boost::system::error_code const& error) { run(error); }; From e923f9c4350bed0cba13286a01084fdb21cb16cc Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 15 Jun 2015 09:42:58 +0200 Subject: [PATCH 017/169] add balanceatblock and storageatblock cli interactive commands# --- eth/main.cpp | 55 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 11 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 5d70b3fe5..0c701d615 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -102,6 +102,9 @@ void interactiveHelp() << " listaccounts List the accounts on the network." << endl << " listcontracts List the contracts on the network." << endl << " balanceat
Gives the balance of the given account." << endl + << " balanceatblock
Gives the balance of the given account." << endl + << " storageat
Gives the storage of the given account." << endl + << " storageatblock
Gives the storahe of the given account at a given blocknumber." << endl << " codeat
Gives the code of the given account." << endl #endif << " setsigningkey Set the address with which to sign transactions." << endl @@ -1338,19 +1341,48 @@ int main(int argc, char** argv) cout << "balance of " << stringHash << " is: " << toString(c->balanceAt(address)) << endl; } } - // TODO implement << operator for std::unorderd_map -// else if (c && cmd == "storageat") -// { -// if (iss.peek() != -1) -// { -// string stringHash; -// iss >> stringHash; + else if (c && cmd == "balanceatblock") + { + if (iss.peek() != -1) + { + string stringHash; + unsigned blocknumber; + iss >> stringHash >> blocknumber; -// Address address = h160(fromHex(stringHash)); + Address address = h160(fromHex(stringHash)); + + cout << "balance of " << stringHash << " is: " << toString(c->balanceAt(address, blocknumber)) << endl; + } + } + else if (c && cmd == "storageat") + { + if (iss.peek() != -1) + { + string stringHash; + iss >> stringHash; -// cout << "storage at " << stringHash << " is: " << c->storageAt(address) << endl; -// } -// } + Address address = h160(fromHex(stringHash)); + + cout << "storage at " << stringHash << " is: " << endl; + for (auto s: c->storageAt(address)) + cout << toHex(s.first) << " : " << toHex(s.second) << endl; + } + } + else if (c && cmd == "storageatblock") + { + if (iss.peek() != -1) + { + string stringHash; + unsigned blocknumber; + iss >> stringHash >> blocknumber; + + Address address = h160(fromHex(stringHash)); + + cout << "storage at " << stringHash << " is: " << endl; + for (auto s: c->storageAt(address, blocknumber)) + cout << "\"0x" << toHex(s.first) << "\" : \"0x" << toHex(s.second) << "\"," << endl; + } + } else if (c && cmd == "codeat") { if (iss.peek() != -1) @@ -1364,6 +1396,7 @@ int main(int argc, char** argv) } } #endif + else if (c && cmd == "send") { if (iss.peek() != -1) From 822103e6020d3cda16405bd25c9ccba879456d3e Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 15 Jun 2015 11:36:55 +0200 Subject: [PATCH 018/169] ET won't be sad anymore --- ethminer/MinerAux.h | 1 - 1 file changed, 1 deletion(-) diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 6de3913e4..3351b90de 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -410,7 +410,6 @@ private: } catch (...) { - cout << "Error phoning home. ET is sad." << endl; } } #endif From d416e667ed2cded424d4565bc4a0ecff240356a6 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 15 Jun 2015 12:18:49 +0200 Subject: [PATCH 019/169] Fix macosx opencl warnings It seems that OpenCL macosx implementation needs a static on the function implementations if there is no corresponding declaration as can be seen by this report: https://github.com/ethereum/cpp-ethereum/issues/2172 --- libethash-cl/ethash_cl_miner_kernel.cl | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/libethash-cl/ethash_cl_miner_kernel.cl b/libethash-cl/ethash_cl_miner_kernel.cl index 2143435ed..8ea6df12d 100644 --- a/libethash-cl/ethash_cl_miner_kernel.cl +++ b/libethash-cl/ethash_cl_miner_kernel.cl @@ -36,7 +36,7 @@ __constant uint2 const Keccak_f1600_RC[24] = { (uint2)(0x80008008, 0x80000000), }; -void keccak_f1600_round(uint2* a, uint r, uint out_size) +static void keccak_f1600_round(uint2* a, uint r, uint out_size) { #if !__ENDIAN_LITTLE__ for (uint i = 0; i != 25; ++i) @@ -152,7 +152,7 @@ void keccak_f1600_round(uint2* a, uint r, uint out_size) #endif } -void keccak_f1600_no_absorb(ulong* a, uint in_size, uint out_size, uint isolate) +static void keccak_f1600_no_absorb(ulong* a, uint in_size, uint out_size, uint isolate) { for (uint i = in_size; i != 25; ++i) { @@ -194,17 +194,17 @@ void keccak_f1600_no_absorb(ulong* a, uint in_size, uint out_size, uint isolate) #define countof(x) (sizeof(x) / sizeof(x[0])) -uint fnv(uint x, uint y) +static uint fnv(uint x, uint y) { return x * FNV_PRIME ^ y; } -uint4 fnv4(uint4 x, uint4 y) +static uint4 fnv4(uint4 x, uint4 y) { return x * FNV_PRIME ^ y; } -uint fnv_reduce(uint4 v) +static uint fnv_reduce(uint4 v) { return fnv(fnv(fnv(v.x, v.y), v.z), v.w); } @@ -227,7 +227,7 @@ typedef union uint4 uint4s[128 / sizeof(uint4)]; } hash128_t; -hash64_t init_hash(__constant hash32_t const* header, ulong nonce, uint isolate) +static hash64_t init_hash(__constant hash32_t const* header, ulong nonce, uint isolate) { hash64_t init; uint const init_size = countof(init.ulongs); @@ -243,7 +243,7 @@ hash64_t init_hash(__constant hash32_t const* header, ulong nonce, uint isolate) return init; } -uint inner_loop_chunks(uint4 init, uint thread_id, __local uint* share, __global hash128_t const* g_dag, __global hash128_t const* g_dag1, __global hash128_t const* g_dag2, __global hash128_t const* g_dag3, uint isolate) +static uint inner_loop_chunks(uint4 init, uint thread_id, __local uint* share, __global hash128_t const* g_dag, __global hash128_t const* g_dag1, __global hash128_t const* g_dag2, __global hash128_t const* g_dag3, uint isolate) { uint4 mix = init; @@ -277,7 +277,7 @@ uint inner_loop_chunks(uint4 init, uint thread_id, __local uint* share, __global -uint inner_loop(uint4 init, uint thread_id, __local uint* share, __global hash128_t const* g_dag, uint isolate) +static uint inner_loop(uint4 init, uint thread_id, __local uint* share, __global hash128_t const* g_dag, uint isolate) { uint4 mix = init; @@ -311,7 +311,7 @@ uint inner_loop(uint4 init, uint thread_id, __local uint* share, __global hash12 } -hash32_t final_hash(hash64_t const* init, hash32_t const* mix, uint isolate) +static hash32_t final_hash(hash64_t const* init, hash32_t const* mix, uint isolate) { ulong state[25]; @@ -330,7 +330,7 @@ hash32_t final_hash(hash64_t const* init, hash32_t const* mix, uint isolate) return hash; } -hash32_t compute_hash_simple( +static hash32_t compute_hash_simple( __constant hash32_t const* g_header, __global hash128_t const* g_dag, ulong nonce, @@ -383,7 +383,7 @@ typedef union } compute_hash_share; -hash32_t compute_hash( +static hash32_t compute_hash( __local compute_hash_share* share, __constant hash32_t const* g_header, __global hash128_t const* g_dag, @@ -427,7 +427,7 @@ hash32_t compute_hash( } -hash32_t compute_hash_chunks( +static hash32_t compute_hash_chunks( __local compute_hash_share* share, __constant hash32_t const* g_header, __global hash128_t const* g_dag, From c1826e463412eba285157e65dcf8d9a33e38f9c2 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 15 Jun 2015 12:25:18 +0200 Subject: [PATCH 020/169] Upgrade "BadJumpDestination" to semi-recoverable "OutOfGas" exception. --- mix/MixClient.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mix/MixClient.cpp b/mix/MixClient.cpp index e2e554cb9..85f7f0a46 100644 --- a/mix/MixClient.cpp +++ b/mix/MixClient.cpp @@ -218,6 +218,8 @@ void MixClient::executeTransaction(Transaction const& _t, State& _state, bool _c BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Not enough gas")); case TransactionException::BlockGasLimitReached: BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Block gas limit reached")); + case TransactionException::BadJumpDestination: + BOOST_THROW_EXCEPTION(OutOfGas() << errinfo_comment("Solidity exception (bad jump)")); case TransactionException::OutOfStack: BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("Out of stack")); case TransactionException::StackUnderflow: @@ -225,7 +227,6 @@ void MixClient::executeTransaction(Transaction const& _t, State& _state, bool _c //these should not happen in mix case TransactionException::Unknown: case TransactionException::BadInstruction: - case TransactionException::BadJumpDestination: case TransactionException::InvalidSignature: case TransactionException::InvalidNonce: case TransactionException::BadRLP: From 9afd426e5a08c7f86dad23d95175c45d07e3c353 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 15 Jun 2015 19:14:45 +0800 Subject: [PATCH 021/169] Refactor toJson out into separate file. Implement basic admin_eth_* interfaces. --- alethzero/MainWin.cpp | 10 +- alethzero/OurWebThreeStubServer.cpp | 2 +- alethzero/OurWebThreeStubServer.h | 2 +- eth/main.cpp | 23 +- libethereum/Client.cpp | 34 +- libethereum/Client.h | 4 +- libethereum/EthereumHost.cpp | 2 +- libethereum/EthereumPeer.cpp | 10 +- libethereum/EthereumPeer.h | 3 + libethereum/Executive.h | 2 + libethereum/State.cpp | 22 +- libethereum/State.h | 12 +- libevm/ExtVMFace.h | 27 +- libp2p/Host.cpp | 19 + libp2p/Host.h | 3 + libtestutils/FixedClient.cpp | 4 +- libweb3jsonrpc/JsonHelper.cpp | 427 ++++++++++++++++++++ libweb3jsonrpc/JsonHelper.h | 104 +++++ libweb3jsonrpc/WebThreeStubServer.cpp | 242 ++++++++++- libweb3jsonrpc/WebThreeStubServer.h | 37 +- libweb3jsonrpc/WebThreeStubServerBase.cpp | 378 +---------------- libweb3jsonrpc/WebThreeStubServerBase.h | 36 +- libweb3jsonrpc/abstractwebthreestubserver.h | 12 +- libweb3jsonrpc/spec.json | 4 +- libwebthree/WebThree.cpp | 11 + libwebthree/WebThree.h | 2 + mix/MixClient.cpp | 4 +- neth/main.cpp | 3 +- test/libweb3jsonrpc/webthreestubclient.h | 4 +- 29 files changed, 993 insertions(+), 450 deletions(-) create mode 100644 libweb3jsonrpc/JsonHelper.cpp create mode 100644 libweb3jsonrpc/JsonHelper.h diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index e88086e0d..848020cbc 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -212,7 +212,7 @@ Main::Main(QWidget *parent) : m_httpConnector.reset(new jsonrpc::HttpServer(SensibleHttpPort, "", "", dev::SensibleHttpThreads)); auto w3ss = new OurWebThreeStubServer(*m_httpConnector, this); m_server.reset(w3ss); - auto sessionKey = w3ss->newSession({true}); + auto sessionKey = w3ss->newSession(SessionPermissions{{Priviledge::Admin}}); connect(&*m_server, SIGNAL(onNewId(QString)), SLOT(addNewId(QString))); m_server->setIdentities(keysAsVector(owned())); m_server->StartListening(); @@ -1922,7 +1922,7 @@ void Main::on_clearPending_triggered() void Main::on_retryUnknown_triggered() { - ethereum()->retryUnkonwn(); + ethereum()->retryUnknown(); } void Main::on_killBlockchain_triggered() @@ -1941,11 +1941,7 @@ void Main::on_net_triggered() { ui->port->setEnabled(!ui->net->isChecked()); ui->clientName->setEnabled(!ui->net->isChecked()); - string n = string("AlethZero/v") + dev::Version; - if (ui->clientName->text().size()) - n += "/" + ui->clientName->text().toStdString(); - n += "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM); - web3()->setClientVersion(n); + web3()->setClientVersion(WebThreeDirect::composeClientVersion("AlethZero", ui->clientName->text().toStdString())); if (ui->net->isChecked()) { web3()->setIdealPeerCount(ui->idealPeers->value()); diff --git a/alethzero/OurWebThreeStubServer.cpp b/alethzero/OurWebThreeStubServer.cpp index 39ab69a19..e18cb55d5 100644 --- a/alethzero/OurWebThreeStubServer.cpp +++ b/alethzero/OurWebThreeStubServer.cpp @@ -33,7 +33,7 @@ OurWebThreeStubServer::OurWebThreeStubServer( jsonrpc::AbstractServerConnector& _conn, Main* _main ): - WebThreeStubServer(_conn, *_main->web3(), make_shared(_main), _main->owned().toVector().toStdVector(), _main->keyManager()), + WebThreeStubServer(_conn, *_main->web3(), make_shared(_main), _main->owned().toVector().toStdVector(), _main->keyManager(), *static_cast(_main->ethereum()->gasPricer().get())), m_main(_main) { } diff --git a/alethzero/OurWebThreeStubServer.h b/alethzero/OurWebThreeStubServer.h index 43985b640..cc950027e 100644 --- a/alethzero/OurWebThreeStubServer.h +++ b/alethzero/OurWebThreeStubServer.h @@ -59,7 +59,7 @@ private: Main* m_main; }; -class OurWebThreeStubServer: public QObject, public WebThreeStubServer +class OurWebThreeStubServer: public QObject, public dev::WebThreeStubServer { Q_OBJECT diff --git a/eth/main.cpp b/eth/main.cpp index 4b23ef62a..382858ae7 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -685,9 +685,8 @@ int main(int argc, char** argv) VMFactory::setKind(jit ? VMKind::JIT : VMKind::Interpreter); auto netPrefs = publicIP.empty() ? NetworkPreferences(listenIP ,listenPort, upnp) : NetworkPreferences(publicIP, listenIP ,listenPort, upnp); auto nodesState = contents((dbPath.size() ? dbPath : getDataDir()) + "/network.rlp"); - std::string clientImplString = "++eth/" + clientName + "v" + dev::Version + "-" + string(DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) + (ETH_CLEAN_REPO ? "" : "*") + "/" DEV_QUOTED(ETH_BUILD_TYPE) "/" DEV_QUOTED(ETH_BUILD_PLATFORM) + (jit ? "/JIT" : ""); dev::WebThreeDirect web3( - clientImplString, + WebThreeDirect::composeClientVersion("++eth", clientName), dbPath, killChain, nodeMode == NodeMode::Full ? set{"eth"/*, "shh"*/} : set(), @@ -800,7 +799,7 @@ int main(int argc, char** argv) // std::shared_ptr gasPricer = make_shared(u256(double(ether / 1000) / etherPrice), u256(blockFees * 1000)); std::shared_ptr gasPricer = make_shared(askPrice, bidPrice); eth::Client* c = nodeMode == NodeMode::Full ? web3.ethereum() : nullptr; - StructuredLogger::starting(clientImplString, dev::Version); + StructuredLogger::starting(WebThreeDirect::composeClientVersion("++eth", clientName), dev::Version); if (c) { c->setGasPricer(gasPricer); @@ -827,12 +826,12 @@ int main(int argc, char** argv) if (jsonrpc > -1) { jsonrpcConnector = unique_ptr(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); - jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){return web3.ethereum();}, getAccountPassword, keyManager), vector(), keyManager)); + jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); jsonrpcServer->StartListening(); if (jsonAdmin.empty()) - jsonAdmin = jsonrpcServer->newSession(SessionPermissions{true}); + jsonAdmin = jsonrpcServer->newSession(SessionPermissions{{Priviledge::Admin}}); else - jsonrpcServer->addSession(jsonAdmin, SessionPermissions{true}); + jsonrpcServer->addSession(jsonAdmin, SessionPermissions{{Priviledge::Admin}}); cout << "JSONRPC Admin Session Key: " << jsonAdmin << endl; } #endif @@ -982,12 +981,12 @@ int main(int argc, char** argv) if (jsonrpc < 0) jsonrpc = SensibleHttpPort; jsonrpcConnector = unique_ptr(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); - jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager)); + jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); jsonrpcServer->StartListening(); if (jsonAdmin.empty()) - jsonAdmin = jsonrpcServer->newSession(SessionPermissions{true}); + jsonAdmin = jsonrpcServer->newSession(SessionPermissions{{Priviledge::Admin}}); else - jsonrpcServer->addSession(jsonAdmin, SessionPermissions{true}); + jsonrpcServer->addSession(jsonAdmin, SessionPermissions{{Priviledge::Admin}}); cout << "JSONRPC Admin Session Key: " << jsonAdmin << endl; } else if (cmd == "jsonstop") @@ -1083,7 +1082,7 @@ int main(int argc, char** argv) } else if (c && cmd == "retryunknown") { - c->retryUnkonwn(); + c->retryUnknown(); } else if (cmd == "peers") { @@ -1520,7 +1519,7 @@ int main(int argc, char** argv) ofstream f; f.open(filename); - dev::eth::State state =c->state(index + 1,c->blockChain().numberHash(block)); + dev::eth::State state = c->state(index + 1,c->blockChain().numberHash(block)); if (index < state.pending().size()) { Executive e(state, c->blockChain(), 0); @@ -1712,7 +1711,7 @@ int main(int argc, char** argv) while (!g_exit) this_thread::sleep_for(chrono::milliseconds(1000)); - StructuredLogger::stopping(clientImplString, dev::Version); + StructuredLogger::stopping(WebThreeDirect::composeClientVersion("++eth", clientName), dev::Version); auto netData = web3.saveNetwork(); if (!netData.empty()) writeFile((dbPath.size() ? dbPath : getDataDir()) + "/network.rlp", netData); diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 31c2e8026..2f742f658 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -879,7 +879,9 @@ State Client::asOf(h256 const& _block) const { try { - return State(m_stateDB, bc(), _block); + State ret(m_stateDB); + ret.populateFromChain(bc(), _block); + return ret; } catch (Exception& ex) { @@ -896,12 +898,36 @@ void Client::prepareForTransaction() State Client::state(unsigned _txi, h256 _block) const { - return State(m_stateDB, m_bc, _block).fromPending(_txi); + try + { + State ret(m_stateDB); + ret.populateFromChain(m_bc, _block); + return ret.fromPending(_txi); + } + catch (Exception& ex) + { + ex << errinfo_block(bc().block(_block)); + onBadBlock(ex); + return State(); + } } -eth::State Client::state(h256 _block) const +State Client::state(h256 const& _block, PopulationStatistics* o_stats) const { - return State(m_stateDB, m_bc, _block); + try + { + State ret(m_stateDB); + PopulationStatistics s = ret.populateFromChain(m_bc, _block); + if (o_stats) + swap(s, *o_stats); + return ret; + } + catch (Exception& ex) + { + ex << errinfo_block(bc().block(_block)); + onBadBlock(ex); + return State(); + } } eth::State Client::state(unsigned _txi) const diff --git a/libethereum/Client.h b/libethereum/Client.h index b70f01155..c8aad1670 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -147,7 +147,7 @@ public: // [PRIVATE API - only relevant for base clients, not available in general] dev::eth::State state(unsigned _txi, h256 _block) const; - dev::eth::State state(h256 _block) const; + dev::eth::State state(h256 const& _block, PopulationStatistics* o_stats = nullptr) const; dev::eth::State state(unsigned _txi) const; /// Get the object representing the current state of Ethereum. @@ -226,7 +226,7 @@ public: /// Kills the blockchain. Just for debug use. void killChain(); /// Retries all blocks with unknown parents. - void retryUnkonwn() { m_bq.retryAllUnknown(); } + void retryUnknown() { m_bq.retryAllUnknown(); } /// Get a report of activity. ActivityReport activityReport() { ActivityReport ret; std::swap(m_report, ret); return ret; } /// Set a JSONRPC server to which we can report bad blocks. diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index 67a21d36a..bacbecc3f 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -619,7 +619,7 @@ void EthereumHost::onPeerAborting(EthereumPeer* _peer) if (_peer->isConversing()) { _peer->setIdle(); - if (_peer->isCriticalSyncing()) +// if (_peer->isCriticalSyncing()) _peer->setRude(); continueSync(); } diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 7a30f1ad9..b876bf019 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -48,7 +48,6 @@ EthereumPeer::EthereumPeer(Session* _s, HostCapabilityFace* _h, unsigned _i, Cap EthereumPeer::~EthereumPeer() { - clog(NetMessageSummary) << "Aborting Sync :-("; abortSync(); } @@ -57,8 +56,15 @@ bool EthereumPeer::isRude() const return repMan().isRude(*session(), name()); } +unsigned EthereumPeer::askOverride() const +{ + bytes const& d = repMan().data(*session(), name()); + return d.empty() ? c_maxBlocksAsk : RLP(d).toInt(RLP::LaisezFaire); +} + void EthereumPeer::setRude() { + repMan().setData(*session(), name(), rlp(askOverride() / 2 + 1)); repMan().noteRude(*session(), name()); session()->addNote("manners", "RUDE"); } @@ -140,7 +146,7 @@ void EthereumPeer::requestHashes(h256 const& _lastHash) void EthereumPeer::requestBlocks() { setAsking(Asking::Blocks); - auto blocks = m_sub.nextFetch(isRude() ? 1 : c_maxBlocksAsk); + auto blocks = m_sub.nextFetch(askOverride()); if (blocks.size()) { RLPStream s; diff --git a/libethereum/EthereumPeer.h b/libethereum/EthereumPeer.h index a12b7a197..e9d29322f 100644 --- a/libethereum/EthereumPeer.h +++ b/libethereum/EthereumPeer.h @@ -91,6 +91,9 @@ public: private: using p2p::Capability::sealAndSend; + /// Figure out the amount of blocks we should be asking for. + unsigned askOverride() const; + /// Interpret an incoming message. virtual bool interpret(unsigned _id, RLP const& _r); diff --git a/libethereum/Executive.h b/libethereum/Executive.h index 4976ce03a..41a8d1961 100644 --- a/libethereum/Executive.h +++ b/libethereum/Executive.h @@ -53,6 +53,8 @@ public: std::string json(bool _styled = false) const; + OnOpFunc onOp() { return [&](uint64_t _steps, Instruction _inst, bigint _newMemSize, bigint _gasCost, bigint _gas, VM* _vm, ExtVMFace const* _extVM) { (*this)(_steps, _inst, _newMemSize, _gasCost, _gas, _vm, _extVM); }; } + private: bool m_showMnemonics = false; std::vector m_lastInst; diff --git a/libethereum/State.cpp b/libethereum/State.cpp index a4b784b6f..f56c12c91 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -115,21 +115,19 @@ State::State(OverlayDB const& _db, BaseState _bs, Address _coinbaseAddress): paranoia("end of normal construction.", true); } -State::State(OverlayDB const& _db, BlockChain const& _bc, h256 _h, ImportRequirements::value _ir): - m_db(_db), - m_state(&m_db), - m_blockReward(c_blockReward) +PopulationStatistics State::populateFromChain(BlockChain const& _bc, h256 const& _h, ImportRequirements::value _ir) { - auto b = _bc.block(_h); - BlockInfo bi(b); + PopulationStatistics ret; - if (!bi) + if (!_bc.isKnown(_h)) { // Might be worth throwing here. cwarn << "Invalid block given for state population: " << _h; - return; + return ret; } + auto b = _bc.block(_h); + BlockInfo bi(b); if (bi.number) { // Non-genesis: @@ -143,10 +141,10 @@ State::State(OverlayDB const& _db, BlockChain const& _bc, h256 _h, ImportRequire m_ourAddress = bi.coinbaseAddress; boost::timer t; auto vb = BlockChain::verifyBlock(b); - cnote << "verifyBlock:" << t.elapsed(); + ret.verify = t.elapsed(); t.restart(); enact(vb, _bc, _ir); - cnote << "enact:" << t.elapsed(); + ret.enact = t.elapsed(); } else { @@ -155,6 +153,8 @@ State::State(OverlayDB const& _db, BlockChain const& _bc, h256 _h, ImportRequire m_state.init(); sync(_bc, _h, bi, _ir); } + + return ret; } State::State(State const& _s): @@ -600,7 +600,7 @@ string State::vmTrace(bytesConstRef _block, BlockChain const& _bc, ImportRequire { StandardTrace st; st.setShowMnemonics(); - execute(lh, Transaction(tr.data(), CheckTransaction::Everything), Permanence::Committed, [&](uint64_t _steps, Instruction _inst, bigint _newMemSize, bigint _gasCost, bigint _gas, VM* _vm, ExtVMFace const* _extVM) { st(_steps, _inst, _newMemSize, _gasCost, _gas, _vm, _extVM); }); + execute(lh, Transaction(tr.data(), CheckTransaction::Everything), Permanence::Committed, st.onOp()); ret += (ret.empty() ? "[" : ",") + st.json(); RLPStream receiptRLP; diff --git a/libethereum/State.h b/libethereum/State.h index 771cdb6bf..3eac63d04 100644 --- a/libethereum/State.h +++ b/libethereum/State.h @@ -123,6 +123,12 @@ enum class Permanence Committed }; +struct PopulationStatistics +{ + double verify; + double enact; +}; + /** * @brief Model of the current state of the ledger. * Maintains current ledger (m_current) as a fast hash-map. This is hashed only when required (i.e. to create or verify a block). @@ -146,9 +152,6 @@ public: /// You can also set the coinbase address. explicit State(OverlayDB const& _db, BaseState _bs = BaseState::PreExisting, Address _coinbaseAddress = Address()); - /// Construct state object from arbitrary point in blockchain. - State(OverlayDB const& _db, BlockChain const& _bc, h256 _hash, ImportRequirements::value _ir = ImportRequirements::Default); - /// Copy state object. State(State const& _s); @@ -157,6 +160,9 @@ public: ~State(); + /// Construct state object from arbitrary point in blockchain. + PopulationStatistics populateFromChain(BlockChain const& _bc, h256 const& _hash, ImportRequirements::value _ir = ImportRequirements::Default); + /// Set the coinbase address for any transactions we do. /// This causes a complete reset of current block. void setAddress(Address _coinbaseAddress) { m_ourAddress = _coinbaseAddress; resetCurrent(); } diff --git a/libevm/ExtVMFace.h b/libevm/ExtVMFace.h index 357292853..f6cab376a 100644 --- a/libevm/ExtVMFace.h +++ b/libevm/ExtVMFace.h @@ -63,12 +63,16 @@ using LogEntries = std::vector; struct LocalisedLogEntry: public LogEntry { LocalisedLogEntry() {} - explicit LocalisedLogEntry(LogEntry const& _le): LogEntry(_le) {}; + explicit LocalisedLogEntry(LogEntry const& _le): LogEntry(_le) {} explicit LocalisedLogEntry( LogEntry const& _le, h256 _special - ): LogEntry(_le), special(_special) {}; + ): + LogEntry(_le), + isSpecial(true), + special(_special) + {} explicit LocalisedLogEntry( LogEntry const& _le, @@ -76,15 +80,24 @@ struct LocalisedLogEntry: public LogEntry h256 _th, unsigned _ti, unsigned _li - ): LogEntry(_le), blockHash(_bi.hash()), blockNumber((BlockNumber)_bi.number), transactionHash(_th), transactionIndex(_ti), logIndex(_li), mined(true) {}; - - h256 blockHash = h256(); + ): + LogEntry(_le), + blockHash(_bi.hash()), + blockNumber((BlockNumber)_bi.number), + transactionHash(_th), + transactionIndex(_ti), + logIndex(_li), + mined(true) + {} + + h256 blockHash; BlockNumber blockNumber = 0; - h256 transactionHash = h256(); + h256 transactionHash; unsigned transactionIndex = 0; unsigned logIndex = 0; bool mined = false; - h256 special = h256(); + bool isSpecial = false; + h256 special; }; using LocalisedLogEntries = std::vector; diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index 55389ed1b..1482719c6 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -79,6 +79,25 @@ bool ReputationManager::isRude(Session const& _s, std::string const& _sub) const return false; } +void ReputationManager::setData(Session const& _s, std::string const& _sub, bytes const& _data) +{ + DEV_WRITE_GUARDED(x_nodes) + m_nodes[make_pair(_s.id(), _s.info().clientVersion)].subs[_sub].data = _data; +} + +bytes ReputationManager::data(Session const& _s, std::string const& _sub) const +{ + DEV_READ_GUARDED(x_nodes) + { + auto nit = m_nodes.find(make_pair(_s.id(), _s.info().clientVersion)); + if (nit == m_nodes.end()) + return bytes(); + auto sit = nit->second.subs.find(_sub); + return sit == nit->second.subs.end() ? bytes() : sit->second.data; + } + return bytes(); +} + Host::Host(std::string const& _clientVersion, NetworkPreferences const& _n, bytesConstRef _restoreNetwork): Worker("p2p", 0), m_restoreNetwork(_restoreNetwork.toBytes()), diff --git a/libp2p/Host.h b/libp2p/Host.h index e9cae509c..9523d0cca 100644 --- a/libp2p/Host.h +++ b/libp2p/Host.h @@ -83,6 +83,7 @@ struct SubReputation { bool isRude = false; int utility = 0; + bytes data; }; struct Reputation @@ -97,6 +98,8 @@ public: void noteRude(Session const& _s, std::string const& _sub = std::string()); bool isRude(Session const& _s, std::string const& _sub = std::string()) const; + void setData(Session const& _s, std::string const& _sub, bytes const& _data); + bytes data(Session const& _s, std::string const& _subs) const; private: std::unordered_map, Reputation> m_nodes; ///< Nodes that were impolite while syncing. We avoid syncing from these if possible. diff --git a/libtestutils/FixedClient.cpp b/libtestutils/FixedClient.cpp index 052141039..4237415ed 100644 --- a/libtestutils/FixedClient.cpp +++ b/libtestutils/FixedClient.cpp @@ -28,5 +28,7 @@ using namespace dev::test; eth::State FixedClient::asOf(h256 const& _h) const { ReadGuard l(x_stateDB); - return State(m_state.db(), bc(), _h); + State ret(m_state.db()); + ret.populateFromChain(bc(), _h); + return ret; } diff --git a/libweb3jsonrpc/JsonHelper.cpp b/libweb3jsonrpc/JsonHelper.cpp new file mode 100644 index 000000000..0b6cd4a1d --- /dev/null +++ b/libweb3jsonrpc/JsonHelper.cpp @@ -0,0 +1,427 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file JsonHelper.cpp + * @authors: + * Gav Wood + * @date 2014 + */ + +#include "JsonHelper.h" + +#include +#include +#include +#include +#include +#include +#include +using namespace std; +using namespace dev; +using namespace eth; + +namespace dev +{ + +Json::Value toJson(unordered_map const& _storage) +{ + Json::Value res(Json::objectValue); + for (auto i: _storage) + res[toJS(i.first)] = toJS(i.second); + return res; +} + +Json::Value toJson(map const& _storage) +{ + Json::Value res(Json::objectValue); + for (auto i: _storage) + res[toJS(i.first)] = toJS(i.second); + return res; +} + +// //////////////////////////////////////////////////////////////////////////////// +// p2p +// //////////////////////////////////////////////////////////////////////////////// +namespace p2p +{ + +Json::Value toJson(p2p::PeerSessionInfo const& _p) +{ + Json::Value ret; + ret["id"] = _p.id.hex(); + ret["clientVersion"] = _p.clientVersion; + ret["host"] = _p.host; + ret["port"] = _p.port; + ret["lastPing"] = (int)chrono::duration_cast(_p.lastPing).count(); + for (auto const& i: _p.notes) + ret["notes"][i.first] = i.second; + for (auto const& i: _p.caps) + ret["caps"][i.first] = (unsigned)i.second; + return ret; +} + +} + +// //////////////////////////////////////////////////////////////////////////////// +// eth +// //////////////////////////////////////////////////////////////////////////////// + +namespace eth +{ + +Json::Value toJson(dev::eth::BlockInfo const& _bi) +{ + Json::Value res; + if (_bi) + { + res["hash"] = toJS(_bi.hash()); + res["parentHash"] = toJS(_bi.parentHash); + res["sha3Uncles"] = toJS(_bi.sha3Uncles); + res["miner"] = toJS(_bi.coinbaseAddress); + res["stateRoot"] = toJS(_bi.stateRoot); + res["transactionsRoot"] = toJS(_bi.transactionsRoot); + res["difficulty"] = toJS(_bi.difficulty); + res["number"] = toJS(_bi.number); + res["gasUsed"] = toJS(_bi.gasUsed); + res["gasLimit"] = toJS(_bi.gasLimit); + res["timestamp"] = toJS(_bi.timestamp); + res["extraData"] = toJS(_bi.extraData); + res["nonce"] = toJS(_bi.nonce); + res["logsBloom"] = toJS(_bi.logBloom); + + res["seedHash"] = toJS(_bi.seedHash()); + res["target"] = toJS(_bi.boundary()); + } + return res; +} + +Json::Value toJson(dev::eth::Transaction const& _t, std::pair _location, BlockNumber _blockNumber) +{ + Json::Value res; + if (_t) + { + res["hash"] = toJS(_t.sha3()); + res["input"] = toJS(_t.data()); + res["to"] = _t.isCreation() ? Json::Value() : toJS(_t.receiveAddress()); + res["from"] = toJS(_t.safeSender()); + res["gas"] = toJS(_t.gas()); + res["gasPrice"] = toJS(_t.gasPrice()); + res["nonce"] = toJS(_t.nonce()); + res["value"] = toJS(_t.value()); + res["blockHash"] = toJS(_location.first); + res["transactionIndex"] = toJS(_location.second); + res["blockNumber"] = toJS(_blockNumber); + } + return res; +} + +Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, Transactions const& _ts) +{ + Json::Value res = toJson(_bi); + if (_bi) + { + res["totalDifficulty"] = toJS(_bd.totalDifficulty); + res["uncles"] = Json::Value(Json::arrayValue); + for (h256 h: _us) + res["uncles"].append(toJS(h)); + res["transactions"] = Json::Value(Json::arrayValue); + for (unsigned i = 0; i < _ts.size(); i++) + res["transactions"].append(toJson(_ts[i], std::make_pair(_bi.hash(), i), (BlockNumber)_bi.number)); + } + return res; +} + +Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, TransactionHashes const& _ts) +{ + Json::Value res = toJson(_bi); + if (_bi) + { + res["totalDifficulty"] = toJS(_bd.totalDifficulty); + res["uncles"] = Json::Value(Json::arrayValue); + for (h256 h: _us) + res["uncles"].append(toJS(h)); + res["transactions"] = Json::Value(Json::arrayValue); + for (h256 const& t: _ts) + res["transactions"].append(toJS(t)); + } + return res; +} + +Json::Value toJson(dev::eth::TransactionSkeleton const& _t) +{ + Json::Value res; + res["to"] = _t.creation ? Json::Value() : toJS(_t.to); + res["from"] = toJS(_t.from); + res["gas"] = toJS(_t.gas); + res["gasPrice"] = toJS(_t.gasPrice); + res["value"] = toJS(_t.value); + res["data"] = toJS(_t.data, 32); + return res; +} + +Json::Value toJson(dev::eth::TransactionReceipt const& _t) +{ + Json::Value res; + res["stateRoot"] = toJS(_t.stateRoot()); + res["gasUsed"] = toJS(_t.gasUsed()); + res["bloom"] = toJS(_t.bloom()); + res["log"] = dev::toJson(_t.log()); + return res; +} + +Json::Value toJson(dev::eth::Transaction const& _t) +{ + Json::Value res; + res["to"] = _t.isCreation() ? Json::Value() : toJS(_t.to()); + res["from"] = toJS(_t.from()); + res["gas"] = toJS(_t.gas()); + res["gasPrice"] = toJS(_t.gasPrice()); + res["value"] = toJS(_t.value()); + res["data"] = toJS(_t.data(), 32); + res["nonce"] = toJS(_t.nonce()); + res["hash"] = toJS(_t.sha3(WithSignature)); + res["sighash"] = toJS(_t.sha3(WithoutSignature)); + res["r"] = toJS(_t.signature().r); + res["s"] = toJS(_t.signature().s); + res["v"] = toJS(_t.signature().v); + return res; +} + +Json::Value toJson(dev::eth::LocalisedLogEntry const& _e) +{ + Json::Value res; + + if (_e.isSpecial) + res = toJS(_e.special); + else + { + res = toJson(static_cast(_e)); + if (_e.mined) + { + res["type"] = "mined"; + res["blockNumber"] = _e.blockNumber; + res["blockHash"] = toJS(_e.blockHash); + res["logIndex"] = _e.logIndex; + res["transactionHash"] = toJS(_e.transactionHash); + res["transactionIndex"] = _e.transactionIndex; + } + else + { + res["type"] = "pending"; + res["blockNumber"] = Json::Value(Json::nullValue); + res["blockHash"] = Json::Value(Json::nullValue); + res["logIndex"] = Json::Value(Json::nullValue); + res["transactionHash"] = Json::Value(Json::nullValue); + res["transactionIndex"] = Json::Value(Json::nullValue); + } + } + return res; +} + +Json::Value toJson(dev::eth::LogEntry const& _e) +{ + Json::Value res; + res["data"] = toJS(_e.data); + res["address"] = toJS(_e.address); + res["topics"] = Json::Value(Json::arrayValue); + for (auto const& t: _e.topics) + res["topics"].append(toJS(t)); + return res; +} + +TransactionSkeleton toTransactionSkeleton(Json::Value const& _json) +{ + TransactionSkeleton ret; + if (!_json.isObject() || _json.empty()) + return ret; + + if (!_json["from"].empty()) + ret.from = jsToAddress(_json["from"].asString()); + if (!_json["to"].empty() && _json["to"].asString() != "0x") + ret.to = jsToAddress(_json["to"].asString()); + else + ret.creation = true; + + if (!_json["value"].empty()) + ret.value = jsToU256(_json["value"].asString()); + + if (!_json["gas"].empty()) + ret.gas = jsToU256(_json["gas"].asString()); + + if (!_json["gasPrice"].empty()) + ret.gasPrice = jsToU256(_json["gasPrice"].asString()); + + if (!_json["data"].empty()) // ethereum.js has preconstructed the data array + ret.data = jsToBytes(_json["data"].asString()); + + if (!_json["code"].empty()) + ret.data = jsToBytes(_json["code"].asString()); + return ret; +} + +dev::eth::LogFilter toLogFilter(Json::Value const& _json) +{ + dev::eth::LogFilter filter; + if (!_json.isObject() || _json.empty()) + return filter; + + // check only !empty. it should throw exceptions if input params are incorrect + if (!_json["fromBlock"].empty()) + filter.withEarliest(jsToFixed<32>(_json["fromBlock"].asString())); + if (!_json["toBlock"].empty()) + filter.withLatest(jsToFixed<32>(_json["toBlock"].asString())); + if (!_json["address"].empty()) + { + if (_json["address"].isArray()) + for (auto i : _json["address"]) + filter.address(jsToAddress(i.asString())); + else + filter.address(jsToAddress(_json["address"].asString())); + } + if (!_json["topics"].empty()) + for (unsigned i = 0; i < _json["topics"].size(); i++) + { + if (_json["topics"][i].isArray()) + { + for (auto t: _json["topics"][i]) + if (!t.isNull()) + filter.topic(i, jsToFixed<32>(t.asString())); + } + else if (!_json["topics"][i].isNull()) // if it is anything else then string, it should and will fail + filter.topic(i, jsToFixed<32>(_json["topics"][i].asString())); + } + return filter; +} + +// TODO: this should be removed once we decide to remove backward compatibility with old log filters +dev::eth::LogFilter toLogFilter(Json::Value const& _json, Interface const& _client) // commented to avoid warning. Uncomment once in use @ PoC-7. +{ + dev::eth::LogFilter filter; + if (!_json.isObject() || _json.empty()) + return filter; + + // check only !empty. it should throw exceptions if input params are incorrect + if (!_json["fromBlock"].empty()) + filter.withEarliest(_client.hashFromNumber(jsToBlockNumber(_json["fromBlock"].asString()))); + if (!_json["toBlock"].empty()) + filter.withLatest(_client.hashFromNumber(jsToBlockNumber(_json["toBlock"].asString()))); + if (!_json["address"].empty()) + { + if (_json["address"].isArray()) + for (auto i : _json["address"]) + filter.address(jsToAddress(i.asString())); + else + filter.address(jsToAddress(_json["address"].asString())); + } + if (!_json["topics"].empty()) + for (unsigned i = 0; i < _json["topics"].size(); i++) + { + if (_json["topics"][i].isArray()) + { + for (auto t: _json["topics"][i]) + if (!t.isNull()) + filter.topic(i, jsToFixed<32>(t.asString())); + } + else if (!_json["topics"][i].isNull()) // if it is anything else then string, it should and will fail + filter.topic(i, jsToFixed<32>(_json["topics"][i].asString())); + } + return filter; +} + +} + +// //////////////////////////////////////////////////////////////////////////////////// +// shh +// //////////////////////////////////////////////////////////////////////////////////// + +namespace shh +{ + +Json::Value toJson(h256 const& _h, shh::Envelope const& _e, shh::Message const& _m) +{ + Json::Value res; + res["hash"] = toJS(_h); + res["expiry"] = toJS(_e.expiry()); + res["sent"] = toJS(_e.sent()); + res["ttl"] = toJS(_e.ttl()); + res["workProved"] = toJS(_e.workProved()); + res["topics"] = Json::Value(Json::arrayValue); + for (auto const& t: _e.topic()) + res["topics"].append(toJS(t)); + res["payload"] = toJS(_m.payload()); + res["from"] = toJS(_m.from()); + res["to"] = toJS(_m.to()); + return res; +} + +shh::Message toMessage(Json::Value const& _json) +{ + shh::Message ret; + if (!_json["from"].empty()) + ret.setFrom(jsToPublic(_json["from"].asString())); + if (!_json["to"].empty()) + ret.setTo(jsToPublic(_json["to"].asString())); + if (!_json["payload"].empty()) + ret.setPayload(jsToBytes(_json["payload"].asString())); + return ret; +} + +shh::Envelope toSealed(Json::Value const& _json, shh::Message const& _m, Secret _from) +{ + unsigned ttl = 50; + unsigned workToProve = 50; + shh::BuildTopic bt; + + if (!_json["ttl"].empty()) + ttl = jsToInt(_json["ttl"].asString()); + + if (!_json["workToProve"].empty()) + workToProve = jsToInt(_json["workToProve"].asString()); + + if (!_json["topics"].empty()) + for (auto i: _json["topics"]) + { + if (i.isArray()) + { + for (auto j: i) + if (!j.isNull()) + bt.shift(jsToBytes(j.asString())); + } + else if (!i.isNull()) // if it is anything else then string, it should and will fail + bt.shift(jsToBytes(i.asString())); + } + + return _m.seal(_from, bt, ttl, workToProve); +} + +pair toWatch(Json::Value const& _json) +{ + shh::BuildTopic bt; + Public to; + + if (!_json["to"].empty()) + to = jsToPublic(_json["to"].asString()); + + if (!_json["topics"].empty()) + for (auto i: _json["topics"]) + bt.shift(jsToBytes(i.asString())); + + return make_pair(bt, to); +} + +} + +} diff --git a/libweb3jsonrpc/JsonHelper.h b/libweb3jsonrpc/JsonHelper.h new file mode 100644 index 000000000..d445ad0dc --- /dev/null +++ b/libweb3jsonrpc/JsonHelper.h @@ -0,0 +1,104 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file JsonHelper.h + * @authors: + * Gav Wood + * @date 2015 + */ +#pragma once + +#include +#include +#include +#include + +namespace dev +{ + +Json::Value toJson(std::map const& _storage); +Json::Value toJson(std::unordered_map const& _storage); + +namespace p2p +{ + +Json::Value toJson(PeerSessionInfo const& _p); + +} + +namespace eth +{ + +class Transaction; +class BlockDetails; +class Interface; +using Transactions = std::vector; +using UncleHashes = h256s; +using TransactionHashes = h256s; + +Json::Value toJson(BlockInfo const& _bi); +Json::Value toJson(Transaction const& _t, std::pair _location, BlockNumber _blockNumber); +Json::Value toJson(BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, Transactions const& _ts); +Json::Value toJson(BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, TransactionHashes const& _ts); +Json::Value toJson(TransactionSkeleton const& _t); +Json::Value toJson(Transaction const& _t); +Json::Value toJson(TransactionReceipt const& _t); +Json::Value toJson(LocalisedLogEntry const& _e); +Json::Value toJson(LogEntry const& _e); +TransactionSkeleton toTransactionSkeleton(Json::Value const& _json); +LogFilter toLogFilter(Json::Value const& _json); +LogFilter toLogFilter(Json::Value const& _json, Interface const& _client); // commented to avoid warning. Uncomment once in use @ PoC-7. + +} + +namespace shh +{ + +Json::Value toJson(h256 const& _h, Envelope const& _e, Message const& _m); +Message toMessage(Json::Value const& _json); +Envelope toSealed(Json::Value const& _json, Message const& _m, Secret _from); +std::pair toWatch(Json::Value const& _json); + +} + +template +Json::Value toJson(std::vector const& _es) +{ + Json::Value res(Json::arrayValue); + for (auto const& e: _es) + res.append(toJson(e)); + return res; +} + +template +Json::Value toJson(std::unordered_set const& _es) +{ + Json::Value res(Json::arrayValue); + for (auto const& e: _es) + res.append(toJson(e)); + return res; +} + +template +Json::Value toJson(std::set const& _es) +{ + Json::Value res(Json::arrayValue); + for (auto const& e: _es) + res.append(toJson(e)); + return res; +} + +} diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index 1bef71b59..f62fdd32a 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -21,21 +21,25 @@ * @date 2014 */ +#include "WebThreeStubServer.h" // Make sure boost/asio.hpp is included before windows.h. #include #include #include +#include #include +#include #include -#include "WebThreeStubServer.h" +#include "JsonHelper.h" using namespace std; using namespace dev; using namespace dev::eth; -WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn, WebThreeDirect& _web3, shared_ptr const& _ethAccounts, std::vector const& _shhAccounts, KeyManager& _keyMan): +WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn, WebThreeDirect& _web3, shared_ptr const& _ethAccounts, std::vector const& _shhAccounts, KeyManager& _keyMan, dev::eth::TrivialGasPricer& _gp): WebThreeStubServerBase(_conn, _ethAccounts, _shhAccounts), m_web3(_web3), - m_keyMan(_keyMan) + m_keyMan(_keyMan), + m_gp(_gp) { auto path = getDataDir() + "/.web3"; boost::filesystem::create_directories(path); @@ -57,23 +61,237 @@ bool WebThreeStubServer::eth_notePassword(string const& _password) return true; } +#define ADMIN requires(_session, Priviledge::Admin) + Json::Value WebThreeStubServer::admin_eth_blockQueueStatus(string const& _session) { + ADMIN; + Json::Value ret; + BlockQueueStatus bqs = m_web3.ethereum()->blockQueue().status(); + ret["importing"] = (int)bqs.importing; + ret["verified"] = (int)bqs.verified; + ret["verifying"] = (int)bqs.verifying; + ret["unverified"] = (int)bqs.unverified; + ret["future"] = (int)bqs.future; + ret["unknown"] = (int)bqs.unknown; + ret["bad"] = (int)bqs.bad; + return ret; +} + +bool WebThreeStubServer::admin_eth_setAskPrice(std::string const& _wei, std::string const& _session) +{ + ADMIN; + m_gp.setAsk(jsToU256(_wei)); + return true; +} + +bool WebThreeStubServer::admin_eth_setBidPrice(std::string const& _wei, std::string const& _session) +{ + ADMIN; + m_gp.setBid(jsToU256(_wei)); + return true; +} + +dev::eth::CanonBlockChain const& WebThreeStubServer::bc() const +{ + return m_web3.ethereum()->blockChain(); +} + +dev::eth::BlockQueue const& WebThreeStubServer::bq() const +{ + return m_web3.ethereum()->blockQueue(); +} + +Json::Value WebThreeStubServer::admin_eth_findBlock(std::string const& _blockHash, std::string const& _session) +{ + ADMIN; + h256 h(_blockHash); + if (bc().isKnown(h)) + return toJson(bc().info(h)); + switch(bq().blockStatus(h)) + { + case QueueStatus::Ready: + return "ready"; + case QueueStatus::Importing: + return "importing"; + case QueueStatus::UnknownParent: + return "unknown parent"; + case QueueStatus::Bad: + return "bad"; + default: + return "unknown"; + } +} + +std::string WebThreeStubServer::admin_eth_blockQueueFirstUnknown(std::string const& _session) +{ + ADMIN; + return bq().firstUnknown().hex(); +} + +bool WebThreeStubServer::admin_eth_blockQueueRetryUnknown(std::string const& _session) +{ + ADMIN; + m_web3.ethereum()->retryUnknown(); + return true; +} + +Json::Value WebThreeStubServer::admin_eth_allAccounts(std::string const& _session) +{ + ADMIN; + Json::Value ret; + u256 total = 0; + u256 pendingtotal = 0; + Address beneficiary; + for (auto const& i: m_keyMan.accountDetails()) + { + auto pending = m_web3.ethereum()->balanceAt(i.first, PendingBlock); + auto latest = m_web3.ethereum()->balanceAt(i.first, LatestBlock); + Json::Value a; + if (i.first == beneficiary) + a["beneficiary"] = true; + a["address"] = toJS(i.first); + a["balance"] = toJS(latest); + a["nicebalance"] = formatBalance(latest); + a["pending"] = toJS(pending); + a["nicepending"] = formatBalance(pending); + ret["accounts"][i.second.first] = a; + total += latest; + pendingtotal += pending; + } + ret["total"] = toJS(total); + ret["nicetotal"] = formatBalance(total); + ret["pendingtotal"] = toJS(pendingtotal); + ret["nicependingtotal"] = formatBalance(pendingtotal); + return ret; +} + +Json::Value WebThreeStubServer::admin_eth_newAccount(Json::Value const& _info, std::string const& _session) +{ + ADMIN; + if (!_info.isMember("name")) + throw jsonrpc::JsonRpcException("No member found: name"); + string name = _info["name"].asString(); + auto s = Secret::random(); + h128 uuid; + if (_info.isMember("password")) + { + string password = _info["password"].asString(); + string hint = _info["passwordHint"].asString(); + uuid = m_keyMan.import(s, name, password, hint); + } + else + uuid = m_keyMan.import(s, name); Json::Value ret; - if (isAdmin(_session)) + ret["account"] = toJS(toAddress(s)); + ret["uuid"] = toUUID(uuid); + return ret; +} + +bool WebThreeStubServer::admin_eth_setMiningBenefactor(std::string const& _uuidOrAddress, std::string const& _session) +{ + ADMIN; + (void)_uuidOrAddress; + return true; +} + +Json::Value WebThreeStubServer::admin_eth_inspect(std::string const& _address, std::string const& _session) +{ + ADMIN; + (void)_address; + return {}; +} + +bool isHex(std::string const& _s) +{ + unsigned i = (_s.size() >= 2 && _s.substr(0, 2) == "0x") ? 2 : 0; + for (; i < _s.size(); ++i) + if (fromHex(_s[i], WhenError::DontThrow) == -1) + return false; + return true; +} + +template bool isHash(std::string const& _hash) +{ + return (_hash.size() == T::size * 2 || (_hash.size() == T::size * 2 + 2 && _hash.substr(0, 2) == "0x")) && isHex(_hash); +} + +h256 WebThreeStubServer::blockHash(std::string const& _blockNumberOrHash) const +{ + if (isHash(_blockNumberOrHash)) + return h256(_blockNumberOrHash.substr(_blockNumberOrHash.size() - 64, 64)); + try { - BlockQueueStatus bqs = m_web3.ethereum()->blockQueue().status(); - ret["importing"] = (int)bqs.importing; - ret["verified"] = (int)bqs.verified; - ret["verifying"] = (int)bqs.verifying; - ret["unverified"] = (int)bqs.unverified; - ret["future"] = (int)bqs.future; - ret["unknown"] = (int)bqs.unknown; - ret["bad"] = (int)bqs.bad; + return bc().numberHash(stoul(_blockNumberOrHash)); } + catch (...) + { + throw jsonrpc::JsonRpcException("Invalid argument"); + } +} + +Json::Value WebThreeStubServer::admin_eth_reprocess(std::string const& _blockNumberOrHash, std::string const& _session) +{ + ADMIN; + Json::Value ret; + PopulationStatistics ps; + m_web3.ethereum()->state(blockHash(_blockNumberOrHash), &ps); + ret["enact"] = ps.enact; + ret["verify"] = ps.verify; + ret["total"] = ps.verify + ps.enact; + return ret; +} + +Json::Value WebThreeStubServer::admin_eth_vmTrace(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session) +{ + ADMIN; + + Json::Value ret; + + auto c = m_web3.ethereum(); + State state = c->state(_txIndex + 1, blockHash(_blockNumberOrHash)); + + if (_txIndex < 0) + throw jsonrpc::JsonRpcException("Negative index"); + + if ((unsigned)_txIndex < state.pending().size()) + { + Executive e(state, bc(), 0); + Transaction t = state.pending()[_txIndex]; + state = state.fromPending(_txIndex); + try + { + StandardTrace st; + st.setShowMnemonics(); + e.initialize(t); + if (!e.execute()) + e.go(st.onOp()); + e.finalize(); + Json::Reader().parse(st.json(), ret); + } + catch(Exception const& _e) + { + cwarn << diagnostic_information(_e); + } + } + return ret; } +Json::Value WebThreeStubServer::admin_eth_getReceiptByHashAndIndex(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session) +{ + ADMIN; + if (_txIndex < 0) + throw jsonrpc::JsonRpcException("Negative index"); + auto h = blockHash(_blockNumberOrHash); + if (!bc().isKnown(h)) + throw jsonrpc::JsonRpcException("Invalid/unknown block."); + auto rs = bc().receipts(h); + if ((unsigned)_txIndex >= rs.receipts.size()) + throw jsonrpc::JsonRpcException("Index too large."); + return toJson(rs.receipts[_txIndex]); +} + std::string WebThreeStubServer::web3_clientVersion() { return m_web3.clientVersion(); diff --git a/libweb3jsonrpc/WebThreeStubServer.h b/libweb3jsonrpc/WebThreeStubServer.h index 8bdeb6b7a..ecf8acca0 100644 --- a/libweb3jsonrpc/WebThreeStubServer.h +++ b/libweb3jsonrpc/WebThreeStubServer.h @@ -32,16 +32,19 @@ namespace dev { + class WebThreeDirect; namespace eth { class KeyManager; -} +class TrivialGasPricer; +class CanonBlockChain; +class BlockQueue; } struct SessionPermissions { - bool admin; + std::unordered_set priviledges; }; /** @@ -50,7 +53,7 @@ struct SessionPermissions class WebThreeStubServer: public dev::WebThreeStubServerBase, public dev::WebThreeStubDatabaseFace { public: - WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn, dev::WebThreeDirect& _web3, std::shared_ptr const& _ethAccounts, std::vector const& _shhAccounts, dev::eth::KeyManager& _keyMan); + WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn, dev::WebThreeDirect& _web3, std::shared_ptr const& _ethAccounts, std::vector const& _shhAccounts, dev::eth::KeyManager& _keyMan, dev::eth::TrivialGasPricer& _gp); virtual std::string web3_clientVersion() override; @@ -58,7 +61,7 @@ public: void addSession(std::string const& _session, SessionPermissions const& _p) { m_sessions[_session] = _p; } private: - bool isAdmin(std::string const& _session) const override { auto it = m_sessions.find(_session); return it != m_sessions.end() && it->second.admin; } + virtual bool hasPriviledgeLevel(std::string const& _session, Priviledge _l) const override { auto it = m_sessions.find(_session); return it != m_sessions.end() && it->second.priviledges.count(_l); } virtual dev::eth::Interface* client() override; virtual std::shared_ptr face() override; @@ -68,15 +71,37 @@ private: virtual std::string get(std::string const& _name, std::string const& _key) override; virtual void put(std::string const& _name, std::string const& _key, std::string const& _value) override; - virtual bool eth_notePassword(std::string const& _password); - virtual Json::Value admin_eth_blockQueueStatus(std::string const& _session); + virtual bool eth_notePassword(std::string const& _password) override; + virtual Json::Value admin_eth_blockQueueStatus(std::string const& _session) override; + virtual bool admin_eth_setAskPrice(std::string const& _wei, std::string const& _session) override; + virtual bool admin_eth_setBidPrice(std::string const& _wei, std::string const& _session) override; + + virtual Json::Value admin_eth_findBlock(std::string const& _blockHash, std::string const& _session) override; + virtual std::string admin_eth_blockQueueFirstUnknown(std::string const& _session) override; + virtual bool admin_eth_blockQueueRetryUnknown(std::string const& _session) override; + + virtual Json::Value admin_eth_allAccounts(std::string const& _session) override; + virtual Json::Value admin_eth_newAccount(const Json::Value& _info, std::string const& _session) override; + virtual bool admin_eth_setMiningBenefactor(std::string const& _uuidOrAddress, std::string const& _session) override; + virtual Json::Value admin_eth_inspect(std::string const& _address, std::string const& _session) override; + virtual Json::Value admin_eth_reprocess(std::string const& _blockNumberOrHash, std::string const& _session) override; + virtual Json::Value admin_eth_vmTrace(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session) override; + virtual Json::Value admin_eth_getReceiptByHashAndIndex(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session) override; private: + h256 blockHash(std::string const& _blockNumberOrHash) const; + + dev::eth::CanonBlockChain const& bc() const; + dev::eth::BlockQueue const& bq() const; + dev::WebThreeDirect& m_web3; dev::eth::KeyManager& m_keyMan; + dev::eth::TrivialGasPricer& m_gp; leveldb::ReadOptions m_readOptions; leveldb::WriteOptions m_writeOptions; leveldb::DB* m_db; std::unordered_map m_sessions; }; + +} diff --git a/libweb3jsonrpc/WebThreeStubServerBase.cpp b/libweb3jsonrpc/WebThreeStubServerBase.cpp index f88443ee5..99c7e3425 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.cpp +++ b/libweb3jsonrpc/WebThreeStubServerBase.cpp @@ -21,6 +21,8 @@ * @date 2014 */ +#include "WebThreeStubServerBase.h" + // Make sure boost/asio.hpp is included before windows.h. #include @@ -41,13 +43,13 @@ #if ETH_SERPENT || !ETH_TRUE #include #endif -#include "WebThreeStubServerBase.h" #include "AccountHolder.h" - +#include "JsonHelper.h" using namespace std; using namespace jsonrpc; using namespace dev; -using namespace dev::eth; +using namespace eth; +using namespace shh; #if ETH_DEBUG const unsigned dev::SensibleHttpThreads = 1; @@ -56,302 +58,6 @@ const unsigned dev::SensibleHttpThreads = 4; #endif const unsigned dev::SensibleHttpPort = 8545; -static Json::Value toJson(dev::eth::BlockInfo const& _bi) -{ - Json::Value res; - if (_bi) - { - res["hash"] = toJS(_bi.hash()); - res["parentHash"] = toJS(_bi.parentHash); - res["sha3Uncles"] = toJS(_bi.sha3Uncles); - res["miner"] = toJS(_bi.coinbaseAddress); - res["stateRoot"] = toJS(_bi.stateRoot); - res["transactionsRoot"] = toJS(_bi.transactionsRoot); - res["difficulty"] = toJS(_bi.difficulty); - res["number"] = toJS(_bi.number); - res["gasUsed"] = toJS(_bi.gasUsed); - res["gasLimit"] = toJS(_bi.gasLimit); - res["timestamp"] = toJS(_bi.timestamp); - res["extraData"] = toJS(_bi.extraData); - res["nonce"] = toJS(_bi.nonce); - res["logsBloom"] = toJS(_bi.logBloom); - } - return res; -} - -static Json::Value toJson(dev::eth::Transaction const& _t, std::pair _location, BlockNumber _blockNumber) -{ - Json::Value res; - if (_t) - { - res["hash"] = toJS(_t.sha3()); - res["input"] = toJS(_t.data()); - res["to"] = _t.isCreation() ? Json::Value() : toJS(_t.receiveAddress()); - res["from"] = toJS(_t.safeSender()); - res["gas"] = toJS(_t.gas()); - res["gasPrice"] = toJS(_t.gasPrice()); - res["nonce"] = toJS(_t.nonce()); - res["value"] = toJS(_t.value()); - res["blockHash"] = toJS(_location.first); - res["transactionIndex"] = toJS(_location.second); - res["blockNumber"] = toJS(_blockNumber); - } - return res; -} - -static Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, Transactions const& _ts) -{ - Json::Value res = toJson(_bi); - if (_bi) - { - res["totalDifficulty"] = toJS(_bd.totalDifficulty); - res["uncles"] = Json::Value(Json::arrayValue); - for (h256 h: _us) - res["uncles"].append(toJS(h)); - res["transactions"] = Json::Value(Json::arrayValue); - for (unsigned i = 0; i < _ts.size(); i++) - res["transactions"].append(toJson(_ts[i], std::make_pair(_bi.hash(), i), (BlockNumber)_bi.number)); - } - return res; -} - -static Json::Value toJson(dev::eth::BlockInfo const& _bi, BlockDetails const& _bd, UncleHashes const& _us, TransactionHashes const& _ts) -{ - Json::Value res = toJson(_bi); - if (_bi) - { - res["totalDifficulty"] = toJS(_bd.totalDifficulty); - res["uncles"] = Json::Value(Json::arrayValue); - for (h256 h: _us) - res["uncles"].append(toJS(h)); - res["transactions"] = Json::Value(Json::arrayValue); - for (h256 const& t: _ts) - res["transactions"].append(toJS(t)); - } - return res; -} - -static Json::Value toJson(dev::eth::TransactionSkeleton const& _t) -{ - Json::Value res; - res["to"] = _t.creation ? Json::Value() : toJS(_t.to); - res["from"] = toJS(_t.from); - res["gas"] = toJS(_t.gas); - res["gasPrice"] = toJS(_t.gasPrice); - res["value"] = toJS(_t.value); - res["data"] = toJS(_t.data, 32); - return res; -} - -static Json::Value toJson(dev::eth::Transaction const& _t) -{ - Json::Value res; - res["to"] = _t.isCreation() ? Json::Value() : toJS(_t.to()); - res["from"] = toJS(_t.from()); - res["gas"] = toJS(_t.gas()); - res["gasPrice"] = toJS(_t.gasPrice()); - res["value"] = toJS(_t.value()); - res["data"] = toJS(_t.data(), 32); - res["nonce"] = toJS(_t.nonce()); - res["hash"] = toJS(_t.sha3(WithSignature)); - res["sighash"] = toJS(_t.sha3(WithoutSignature)); - res["r"] = toJS(_t.signature().r); - res["s"] = toJS(_t.signature().s); - res["v"] = toJS(_t.signature().v); - return res; -} - -static Json::Value toJson(dev::eth::LocalisedLogEntry const& _e) -{ - Json::Value res; - if (_e.topics.size() > 0) - { - res["data"] = toJS(_e.data); - res["address"] = toJS(_e.address); - res["topics"] = Json::Value(Json::arrayValue); - for (auto const& t: _e.topics) - res["topics"].append(toJS(t)); - if (_e.mined) - { - res["type"] = "mined"; - res["blockNumber"] = _e.blockNumber; - res["blockHash"] = toJS(_e.blockHash); - res["logIndex"] = _e.logIndex; - res["transactionHash"] = toJS(_e.transactionHash); - res["transactionIndex"] = _e.transactionIndex; - } - else - { - res["type"] = "pending"; - res["blockNumber"] = Json::Value(Json::nullValue); - res["blockHash"] = Json::Value(Json::nullValue); - res["logIndex"] = Json::Value(Json::nullValue); - res["transactionHash"] = Json::Value(Json::nullValue); - res["transactionIndex"] = Json::Value(Json::nullValue); - } - } else { - res = toJS(_e.special); - } - return res; -} - -static Json::Value toJson(dev::eth::LocalisedLogEntries const& _es) -{ - Json::Value res(Json::arrayValue); - for (dev::eth::LocalisedLogEntry const& e: _es) - res.append(toJson(e)); - return res; -} - -static Json::Value toJson(map const& _storage) -{ - Json::Value res(Json::objectValue); - for (auto i: _storage) - res[toJS(i.first)] = toJS(i.second); - return res; -} - -static dev::eth::LogFilter toLogFilter(Json::Value const& _json) -{ - dev::eth::LogFilter filter; - if (!_json.isObject() || _json.empty()) - return filter; - - // check only !empty. it should throw exceptions if input params are incorrect - if (!_json["fromBlock"].empty()) - filter.withEarliest(jsToFixed<32>(_json["fromBlock"].asString())); - if (!_json["toBlock"].empty()) - filter.withLatest(jsToFixed<32>(_json["toBlock"].asString())); - if (!_json["address"].empty()) - { - if (_json["address"].isArray()) - for (auto i : _json["address"]) - filter.address(jsToAddress(i.asString())); - else - filter.address(jsToAddress(_json["address"].asString())); - } - if (!_json["topics"].empty()) - for (unsigned i = 0; i < _json["topics"].size(); i++) - { - if (_json["topics"][i].isArray()) - { - for (auto t: _json["topics"][i]) - if (!t.isNull()) - filter.topic(i, jsToFixed<32>(t.asString())); - } - else if (!_json["topics"][i].isNull()) // if it is anything else then string, it should and will fail - filter.topic(i, jsToFixed<32>(_json["topics"][i].asString())); - } - return filter; -} - -// TODO: this should be removed once we decide to remove backward compatibility with old log filters -static dev::eth::LogFilter toLogFilter(Json::Value const& _json, Interface const& _client) // commented to avoid warning. Uncomment once in use @ PoC-7. -{ - dev::eth::LogFilter filter; - if (!_json.isObject() || _json.empty()) - return filter; - - // check only !empty. it should throw exceptions if input params are incorrect - if (!_json["fromBlock"].empty()) - filter.withEarliest(_client.hashFromNumber(jsToBlockNumber(_json["fromBlock"].asString()))); - if (!_json["toBlock"].empty()) - filter.withLatest(_client.hashFromNumber(jsToBlockNumber(_json["toBlock"].asString()))); - if (!_json["address"].empty()) - { - if (_json["address"].isArray()) - for (auto i : _json["address"]) - filter.address(jsToAddress(i.asString())); - else - filter.address(jsToAddress(_json["address"].asString())); - } - if (!_json["topics"].empty()) - for (unsigned i = 0; i < _json["topics"].size(); i++) - { - if (_json["topics"][i].isArray()) - { - for (auto t: _json["topics"][i]) - if (!t.isNull()) - filter.topic(i, jsToFixed<32>(t.asString())); - } - else if (!_json["topics"][i].isNull()) // if it is anything else then string, it should and will fail - filter.topic(i, jsToFixed<32>(_json["topics"][i].asString())); - } - return filter; -} - -static shh::Message toMessage(Json::Value const& _json) -{ - shh::Message ret; - if (!_json["from"].empty()) - ret.setFrom(jsToPublic(_json["from"].asString())); - if (!_json["to"].empty()) - ret.setTo(jsToPublic(_json["to"].asString())); - if (!_json["payload"].empty()) - ret.setPayload(jsToBytes(_json["payload"].asString())); - return ret; -} - -static shh::Envelope toSealed(Json::Value const& _json, shh::Message const& _m, Secret _from) -{ - unsigned ttl = 50; - unsigned workToProve = 50; - shh::BuildTopic bt; - - if (!_json["ttl"].empty()) - ttl = jsToInt(_json["ttl"].asString()); - - if (!_json["workToProve"].empty()) - workToProve = jsToInt(_json["workToProve"].asString()); - - if (!_json["topics"].empty()) - for (auto i: _json["topics"]) - { - if (i.isArray()) - { - for (auto j: i) - if (!j.isNull()) - bt.shift(jsToBytes(j.asString())); - } - else if (!i.isNull()) // if it is anything else then string, it should and will fail - bt.shift(jsToBytes(i.asString())); - } - - return _m.seal(_from, bt, ttl, workToProve); -} - -static pair toWatch(Json::Value const& _json) -{ - shh::BuildTopic bt; - Public to; - - if (!_json["to"].empty()) - to = jsToPublic(_json["to"].asString()); - - if (!_json["topics"].empty()) - for (auto i: _json["topics"]) - bt.shift(jsToBytes(i.asString())); - - return make_pair(bt, to); -} - -static Json::Value toJson(h256 const& _h, shh::Envelope const& _e, shh::Message const& _m) -{ - Json::Value res; - res["hash"] = toJS(_h); - res["expiry"] = toJS(_e.expiry()); - res["sent"] = toJS(_e.sent()); - res["ttl"] = toJS(_e.ttl()); - res["workProved"] = toJS(_e.workProved()); - res["topics"] = Json::Value(Json::arrayValue); - for (auto const& t: _e.topic()) - res["topics"].append(toJS(t)); - res["payload"] = toJS(_m.payload()); - res["from"] = toJS(_m.from()); - res["to"] = toJS(_m.to()); - return res; -} - WebThreeStubServerBase::WebThreeStubServerBase(AbstractServerConnector& _conn, std::shared_ptr const& _ethAccounts, vector const& _sshAccounts): AbstractWebThreeStubServer(_conn), m_ethAccounts(_ethAccounts) @@ -468,7 +174,6 @@ string WebThreeStubServerBase::eth_getBlockTransactionCountByHash(string const& } } - string WebThreeStubServerBase::eth_getBlockTransactionCountByNumber(string const& _blockNumber) { try @@ -517,42 +222,12 @@ string WebThreeStubServerBase::eth_getCode(string const& _address, string const& } } -static TransactionSkeleton toTransaction(Json::Value const& _json) -{ - TransactionSkeleton ret; - if (!_json.isObject() || _json.empty()) - return ret; - - if (!_json["from"].empty()) - ret.from = jsToAddress(_json["from"].asString()); - if (!_json["to"].empty() && _json["to"].asString() != "0x") - ret.to = jsToAddress(_json["to"].asString()); - else - ret.creation = true; - - if (!_json["value"].empty()) - ret.value = jsToU256(_json["value"].asString()); - - if (!_json["gas"].empty()) - ret.gas = jsToU256(_json["gas"].asString()); - - if (!_json["gasPrice"].empty()) - ret.gasPrice = jsToU256(_json["gasPrice"].asString()); - - if (!_json["data"].empty()) // ethereum.js has preconstructed the data array - ret.data = jsToBytes(_json["data"].asString()); - - if (!_json["code"].empty()) - ret.data = jsToBytes(_json["code"].asString()); - return ret; -} - string WebThreeStubServerBase::eth_sendTransaction(Json::Value const& _json) { try { string ret; - TransactionSkeleton t = toTransaction(_json); + TransactionSkeleton t = toTransactionSkeleton(_json); if (!t.from) t.from = m_ethAccounts->defaultTransactAccount(); @@ -578,7 +253,7 @@ string WebThreeStubServerBase::eth_signTransaction(Json::Value const& _json) try { string ret; - TransactionSkeleton t = toTransaction(_json); + TransactionSkeleton t = toTransactionSkeleton(_json); if (!t.from) t.from = m_ethAccounts->defaultTransactAccount(); @@ -627,7 +302,7 @@ string WebThreeStubServerBase::eth_call(Json::Value const& _json, string const& { try { - TransactionSkeleton t = toTransaction(_json); + TransactionSkeleton t = toTransactionSkeleton(_json); if (!t.from) t.from = m_ethAccounts->defaultTransactAccount(); // if (!m_accounts->isRealAccount(t.from)) @@ -798,34 +473,32 @@ string WebThreeStubServerBase::eth_compileSerpent(string const& _source) return res; } +#define ADMIN requires(_session, Priviledge::Admin) + bool WebThreeStubServerBase::admin_web3_setVerbosity(int _v, string const& _session) { - if (!isAdmin(_session)) - return false; + ADMIN; g_logVerbosity = _v; return true; } bool WebThreeStubServerBase::admin_net_start(std::string const& _session) { - if (!isAdmin(_session)) - return false; + ADMIN; network()->startNetwork(); return true; } bool WebThreeStubServerBase::admin_net_stop(std::string const& _session) { - if (!isAdmin(_session)) - return false; + ADMIN; network()->stopNetwork(); return true; } bool WebThreeStubServerBase::admin_net_connect(std::string const& _node, std::string const& _session) { - if (!isAdmin(_session)) - return false; + ADMIN; p2p::NodeId id; bi::tcp::endpoint ep; if (_node.substr(0, 8) == "enode://" && _node.find('@') == 136) @@ -839,25 +512,9 @@ bool WebThreeStubServerBase::admin_net_connect(std::string const& _node, std::st return true; } -Json::Value toJson(p2p::PeerSessionInfo const& _p) -{ - Json::Value ret; - ret["id"] = _p.id.hex(); - ret["clientVersion"] = _p.clientVersion; - ret["host"] = _p.host; - ret["port"] = _p.port; - ret["lastPing"] = (int)chrono::duration_cast(_p.lastPing).count(); - for (auto const& i: _p.notes) - ret["notes"][i.first] = i.second; - for (auto const& i: _p.caps) - ret["caps"][i.first] = (unsigned)i.second; - return ret; -} - Json::Value WebThreeStubServerBase::admin_net_peers(std::string const& _session) { - if (!isAdmin(_session)) - return false; + ADMIN; Json::Value ret; for (p2p::PeerSessionInfo const& i: network()->peers()) ret.append(toJson(i)); @@ -866,8 +523,7 @@ Json::Value WebThreeStubServerBase::admin_net_peers(std::string const& _session) bool WebThreeStubServerBase::admin_eth_setMining(bool _on, std::string const& _session) { - if (!isAdmin(_session)) - return false; + ADMIN; if (_on) client()->startMining(); else @@ -970,8 +626,6 @@ bool WebThreeStubServerBase::eth_uninstallFilter(string const& _filterId) { BOOST_THROW_EXCEPTION(JsonRpcException(Errors::ERROR_RPC_INVALID_PARAMS)); } - - } Json::Value WebThreeStubServerBase::eth_getFilterChanges(string const& _filterId) diff --git a/libweb3jsonrpc/WebThreeStubServerBase.h b/libweb3jsonrpc/WebThreeStubServerBase.h index aaf0a6096..d3e16d0f4 100644 --- a/libweb3jsonrpc/WebThreeStubServerBase.h +++ b/libweb3jsonrpc/WebThreeStubServerBase.h @@ -26,6 +26,7 @@ #include #include #include +#include #include #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-parameter" @@ -58,6 +59,26 @@ public: virtual void put(std::string const& _name, std::string const& _key, std::string const& _value) = 0; }; +enum class Priviledge +{ + Admin +}; + +} + +namespace std +{ + +template<> struct hash +{ + size_t operator()(dev::Priviledge _value) const { return (size_t)_value; } +}; + +} + +namespace dev +{ + /** * @brief JSON-RPC api implementation * @todo split these up according to subprotocol (eth, shh, db, p2p, web3) and make it /very/ clear about how to add other subprotocols. @@ -147,25 +168,28 @@ public: virtual Json::Value admin_eth_blockQueueStatus(std::string const& _session) { (void)_session; return Json::Value(); } virtual bool admin_eth_setAskPrice(std::string const& _wei, std::string const& _session) { (void)_wei; (void)_session; return false; } virtual bool admin_eth_setBidPrice(std::string const& _wei, std::string const& _session) { (void)_wei; (void)_session; return false; } - virtual bool admin_eth_setReferencePrice(std::string const& _wei, std::string const& _session) { (void)_wei; (void)_session; return false; } - virtual bool admin_eth_setPriority(int _percent, std::string const& _session) { (void)_percent; (void)_session; return false; } virtual Json::Value admin_eth_findBlock(std::string const& _blockHash, std::string const& _session) { (void)_blockHash; (void)_session; return Json::Value(); } virtual std::string admin_eth_blockQueueFirstUnknown(std::string const& _session) { (void)_session; return ""; } virtual bool admin_eth_blockQueueRetryUnknown(std::string const& _session) { (void)_session; return false; } virtual Json::Value admin_eth_allAccounts(std::string const& _session) { (void)_session; return Json::Value(); } virtual Json::Value admin_eth_newAccount(const Json::Value& _info, std::string const& _session) { (void)_info; (void)_session; return Json::Value(); } - virtual bool admin_eth_setSigningKey(std::string const& _uuidOrAddress, std::string const& _session) { (void)_uuidOrAddress; (void)_session; return false; } virtual bool admin_eth_setMiningBenefactor(std::string const& _uuidOrAddress, std::string const& _session) { (void)_uuidOrAddress; (void)_session; return false; } virtual Json::Value admin_eth_inspect(std::string const& _address, std::string const& _session) { (void)_address; (void)_session; return Json::Value(); } virtual Json::Value admin_eth_reprocess(std::string const& _blockNumberOrHash, std::string const& _session) { (void)_blockNumberOrHash; (void)_session; return Json::Value(); } - virtual Json::Value admin_eth_vmTrace(std::string const& _blockNumberOrHash, std::string const& _txIndex, std::string const& _session) { (void)_blockNumberOrHash; (void)_txIndex; (void)_session; return Json::Value(); } - virtual Json::Value admin_eth_getReceiptByHashAndIndex(std::string const& _blockNumberOrHash, std::string const& _txIndex, std::string const& _session) { (void)_blockNumberOrHash; (void)_txIndex; (void)_session; return Json::Value(); } + virtual Json::Value admin_eth_vmTrace(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session) { (void)_blockNumberOrHash; (void)_txIndex; (void)_session; return Json::Value(); } + virtual Json::Value admin_eth_getReceiptByHashAndIndex(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session) { (void)_blockNumberOrHash; (void)_txIndex; (void)_session; return Json::Value(); } + + // TODO REMOVE + virtual bool admin_eth_setReferencePrice(std::string const& _wei, std::string const& _session) { (void)_wei; (void)_session; return false; } + virtual bool admin_eth_setPriority(int _percent, std::string const& _session) { (void)_percent; (void)_session; return false; } + virtual bool admin_eth_setSigningKey(std::string const& _uuidOrAddress, std::string const& _session) { (void)_uuidOrAddress; (void)_session; return false; } void setIdentities(std::vector const& _ids); std::map const& ids() const { return m_shhIds; } protected: - virtual bool isAdmin(std::string const& _session) const { (void)_session; return false; } + void requires(std::string const& _session, Priviledge _l) const { if (!hasPriviledgeLevel(_session, _l)) throw jsonrpc::JsonRpcException("Invalid priviledges"); } + virtual bool hasPriviledgeLevel(std::string const& _session, Priviledge _l) const { (void)_session; (void)_l; return false; } virtual dev::eth::Interface* client() = 0; virtual std::shared_ptr face() = 0; diff --git a/libweb3jsonrpc/abstractwebthreestubserver.h b/libweb3jsonrpc/abstractwebthreestubserver.h index 6b94c31da..82864a61a 100644 --- a/libweb3jsonrpc/abstractwebthreestubserver.h +++ b/libweb3jsonrpc/abstractwebthreestubserver.h @@ -96,8 +96,8 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServerbindAndAddMethod(jsonrpc::Procedure("admin_eth_setMiningBenefactor", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_BOOLEAN, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::admin_eth_setMiningBenefactorI); this->bindAndAddMethod(jsonrpc::Procedure("admin_eth_inspect", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::admin_eth_inspectI); this->bindAndAddMethod(jsonrpc::Procedure("admin_eth_reprocess", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::admin_eth_reprocessI); - this->bindAndAddMethod(jsonrpc::Procedure("admin_eth_vmTrace", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::admin_eth_vmTraceI); - this->bindAndAddMethod(jsonrpc::Procedure("admin_eth_getReceiptByHashAndIndex", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_STRING,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::admin_eth_getReceiptByHashAndIndexI); + this->bindAndAddMethod(jsonrpc::Procedure("admin_eth_vmTrace", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::admin_eth_vmTraceI); + this->bindAndAddMethod(jsonrpc::Procedure("admin_eth_getReceiptByHashAndIndex", jsonrpc::PARAMS_BY_POSITION, jsonrpc::JSON_OBJECT, "param1",jsonrpc::JSON_STRING,"param2",jsonrpc::JSON_INTEGER,"param3",jsonrpc::JSON_STRING, NULL), &AbstractWebThreeStubServer::admin_eth_getReceiptByHashAndIndexI); } inline virtual void web3_sha3I(const Json::Value &request, Json::Value &response) @@ -455,11 +455,11 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServeradmin_eth_vmTrace(request[0u].asString(), request[1u].asString(), request[2u].asString()); + response = this->admin_eth_vmTrace(request[0u].asString(), request[1u].asInt(), request[2u].asString()); } inline virtual void admin_eth_getReceiptByHashAndIndexI(const Json::Value &request, Json::Value &response) { - response = this->admin_eth_getReceiptByHashAndIndex(request[0u].asString(), request[1u].asString(), request[2u].asString()); + response = this->admin_eth_getReceiptByHashAndIndex(request[0u].asString(), request[1u].asInt(), request[2u].asString()); } virtual std::string web3_sha3(const std::string& param1) = 0; virtual std::string web3_clientVersion() = 0; @@ -545,8 +545,8 @@ class AbstractWebThreeStubServer : public jsonrpc::AbstractServer #include #include +#include "BuildInfo.h" using namespace std; using namespace dev; using namespace dev::p2p; @@ -72,6 +73,16 @@ WebThreeDirect::~WebThreeDirect() m_ethereum.reset(); } +std::string WebThreeDirect::composeClientVersion(std::string const& _client, std::string const& _clientName) +{ +#if ETH_EVMJIT + char const* jit = "-JIT"; +#else + char const* jit = ""; +#endif + return _client + "v" + dev::Version + "-" + string(DEV_QUOTED(ETH_COMMIT_HASH)).substr(0, 8) + (ETH_CLEAN_REPO ? "" : "*") + "/" + _clientName + "/" DEV_QUOTED(ETH_BUILD_TYPE) "-" DEV_QUOTED(ETH_BUILD_PLATFORM) + jit; +} + p2p::NetworkPreferences const& WebThreeDirect::networkPreferences() const { return m_net.networkPreferences(); diff --git a/libwebthree/WebThree.h b/libwebthree/WebThree.h index ece83abb8..6eefa6a4b 100644 --- a/libwebthree/WebThree.h +++ b/libwebthree/WebThree.h @@ -129,6 +129,8 @@ public: // Misc stuff: + static std::string composeClientVersion(std::string const& _client, std::string const& _name); + std::string const& clientVersion() const { return m_clientVersion; } void setClientVersion(std::string const& _name) { m_clientVersion = _name; } diff --git a/mix/MixClient.cpp b/mix/MixClient.cpp index e2e554cb9..4f5eff8b6 100644 --- a/mix/MixClient.cpp +++ b/mix/MixClient.cpp @@ -296,7 +296,9 @@ ExecutionResult MixClient::execution(unsigned _index) const State MixClient::asOf(h256 const& _block) const { ReadGuard l(x_state); - return State(m_stateDB, bc(), _block); + State ret(m_stateDB); + ret.populateFromChain(bc(), _block); + return ret; } void MixClient::submitTransaction(Secret _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice, bool _gasAuto) diff --git a/neth/main.cpp b/neth/main.cpp index a6e661d2e..a55c3d559 100644 --- a/neth/main.cpp +++ b/neth/main.cpp @@ -577,10 +577,11 @@ int main(int argc, char** argv) #if ETH_JSONRPC || !ETH_TRUE shared_ptr jsonrpcServer; unique_ptr jsonrpcConnector; + KeyManager km; if (jsonrpc > -1) { jsonrpcConnector = unique_ptr(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); - jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, vector({us})), vector({us}))); + jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, vector({us})), vector({us})), km); jsonrpcServer->setIdentities({us}); jsonrpcServer->StartListening(); } diff --git a/test/libweb3jsonrpc/webthreestubclient.h b/test/libweb3jsonrpc/webthreestubclient.h index 5c74e5a46..175f1958c 100644 --- a/test/libweb3jsonrpc/webthreestubclient.h +++ b/test/libweb3jsonrpc/webthreestubclient.h @@ -884,7 +884,7 @@ class WebThreeStubClient : public jsonrpc::Client else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value admin_eth_vmTrace(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + Json::Value admin_eth_vmTrace(const std::string& param1, int param2, const std::string& param3) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); @@ -896,7 +896,7 @@ class WebThreeStubClient : public jsonrpc::Client else throw jsonrpc::JsonRpcException(jsonrpc::Errors::ERROR_CLIENT_INVALID_RESPONSE, result.toStyledString()); } - Json::Value admin_eth_getReceiptByHashAndIndex(const std::string& param1, const std::string& param2, const std::string& param3) throw (jsonrpc::JsonRpcException) + Json::Value admin_eth_getReceiptByHashAndIndex(const std::string& param1, int param2, const std::string& param3) throw (jsonrpc::JsonRpcException) { Json::Value p; p.append(param1); From c77ab101c46cb637eabfcafa4c3840ae9bae2fd3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 15 Jun 2015 19:26:34 +0800 Subject: [PATCH 022/169] inspect in admin interface. --- libweb3jsonrpc/WebThreeStubServer.cpp | 38 ++++++++++++++++----------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index f62fdd32a..adef51033 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -35,6 +35,20 @@ using namespace std; using namespace dev; using namespace dev::eth; +bool isHex(std::string const& _s) +{ + unsigned i = (_s.size() >= 2 && _s.substr(0, 2) == "0x") ? 2 : 0; + for (; i < _s.size(); ++i) + if (fromHex(_s[i], WhenError::DontThrow) == -1) + return false; + return true; +} + +template bool isHash(std::string const& _hash) +{ + return (_hash.size() == T::size * 2 || (_hash.size() == T::size * 2 + 2 && _hash.substr(0, 2) == "0x")) && isHex(_hash); +} + WebThreeStubServer::WebThreeStubServer(jsonrpc::AbstractServerConnector& _conn, WebThreeDirect& _web3, shared_ptr const& _ethAccounts, std::vector const& _shhAccounts, KeyManager& _keyMan, dev::eth::TrivialGasPricer& _gp): WebThreeStubServerBase(_conn, _ethAccounts, _shhAccounts), m_web3(_web3), @@ -198,22 +212,16 @@ bool WebThreeStubServer::admin_eth_setMiningBenefactor(std::string const& _uuidO Json::Value WebThreeStubServer::admin_eth_inspect(std::string const& _address, std::string const& _session) { ADMIN; - (void)_address; - return {}; -} + if (!isHash
(_address)) + throw jsonrpc::JsonRpcException("Invalid address given."); -bool isHex(std::string const& _s) -{ - unsigned i = (_s.size() >= 2 && _s.substr(0, 2) == "0x") ? 2 : 0; - for (; i < _s.size(); ++i) - if (fromHex(_s[i], WhenError::DontThrow) == -1) - return false; - return true; -} - -template bool isHash(std::string const& _hash) -{ - return (_hash.size() == T::size * 2 || (_hash.size() == T::size * 2 + 2 && _hash.substr(0, 2) == "0x")) && isHex(_hash); + Json::Value ret; + auto h = Address(fromHex(_address)); + ret["storage"] = toJson(m_web3.ethereum()->storageAt(h, PendingBlock)); + ret["balance"] = toJS(m_web3.ethereum()->balanceAt(h, PendingBlock)); + ret["nonce"] = toJS(m_web3.ethereum()->countAt(h, PendingBlock)); + ret["code"] = toJS(m_web3.ethereum()->codeAt(h, PendingBlock)); + return ret; } h256 WebThreeStubServer::blockHash(std::string const& _blockNumberOrHash) const From 45858c0a7838ee1b620eb4fd9210e1e0b84b6b4d Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Mon, 15 Jun 2015 13:28:58 +0200 Subject: [PATCH 023/169] OpenCL in MacosX does not like static variables Should fix #2172 --- libethash-cl/ethash_cl_miner.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index 6c2f8269a..b160cdd94 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -429,7 +429,8 @@ void ethash_cl_miner::search(uint8_t const* header, uint64_t target, search_hook }; queue pending; - static uint32_t const c_zero = 0; + // this can't be a static because in MacOSX OpenCL implementation a segfault occurs when a static is passed to OpenCL functions + uint32_t const c_zero = 0; // update header constant buffer m_queue.enqueueWriteBuffer(m_header, false, 0, 32, header); From 8357930b25e5e4914d84eba507b7d94885ff5966 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 15 Jun 2015 14:07:59 +0200 Subject: [PATCH 024/169] Do not increase Windows stack size. --- cmake/EthCompilerSettings.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 53535a489..b48dae8f8 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -43,8 +43,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") # warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification # warning LNK4099: pdb was not found with lib - # stack size 16MB - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099,4075 /STACK:33554432") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /ignore:4099,4075") # windows likes static if (NOT ETH_STATIC) From 7a276c2eee24b1953e3c9a64806be23401a65de8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Wed, 10 Jun 2015 18:01:37 +0200 Subject: [PATCH 025/169] Disable some warnings in LLVM headers for GCC/clang compilers. --- evmjit/libevmjit/preprocessor/llvm_includes_end.h | 4 ++++ evmjit/libevmjit/preprocessor/llvm_includes_start.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/evmjit/libevmjit/preprocessor/llvm_includes_end.h b/evmjit/libevmjit/preprocessor/llvm_includes_end.h index 643e03064..2ead6dda3 100644 --- a/evmjit/libevmjit/preprocessor/llvm_includes_end.h +++ b/evmjit/libevmjit/preprocessor/llvm_includes_end.h @@ -1,3 +1,7 @@ #if defined(_MSC_VER) #pragma warning(pop) +#elif defined(__clang__) + #pragma clang diagnostic pop +#else + #pragma GCC diagnostic pop #endif diff --git a/evmjit/libevmjit/preprocessor/llvm_includes_start.h b/evmjit/libevmjit/preprocessor/llvm_includes_start.h index 9499f9835..9077bf43f 100644 --- a/evmjit/libevmjit/preprocessor/llvm_includes_start.h +++ b/evmjit/libevmjit/preprocessor/llvm_includes_start.h @@ -1,4 +1,12 @@ #if defined(_MSC_VER) #pragma warning(push) #pragma warning(disable: 4267 4244 4800) +#elif defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wunused-parameter" + #pragma clang diagnostic ignored "-Wconversion" +#else + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wunused-parameter" + #pragma GCC diagnostic ignored "-Wconversion" #endif From 3ed12d4851c5a0737de01f41f54a7cec2efe7abd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 21 May 2015 14:28:19 +0200 Subject: [PATCH 026/169] Remove LLVM cmake files workaround. --- evmjit/CMakeLists.txt | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/evmjit/CMakeLists.txt b/evmjit/CMakeLists.txt index 4343ddc31..fa9b08f48 100644 --- a/evmjit/CMakeLists.txt +++ b/evmjit/CMakeLists.txt @@ -16,22 +16,11 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") endif() # LLVM -if(LLVM_DIR OR APPLE) # local LLVM build - find_package(LLVM REQUIRED CONFIG) - message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") - message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") - add_definitions(${LLVM_DEFINITIONS}) - # TODO: bitwriter is needed only for evmcc - llvm_map_components_to_libnames(LLVM_LIBS core support mcjit x86asmparser x86codegen bitwriter ipo) -else() - # Workaround for Ubuntu broken LLVM package - message(STATUS "Using llvm-3.7-dev package from Ubuntu. If does not work, build LLVM and set -DLLVM_DIR=llvm-build/share/llvm/cmake") - execute_process(COMMAND llvm-config-3.7 --includedir OUTPUT_VARIABLE LLVM_INCLUDE_DIRS) - message(STATUS "LLVM include dirs: ${LLVM_INCLUDE_DIRS}") - set(LLVM_LIBS "-lLLVMBitWriter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMX86AsmParser -lLLVMX86Desc -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMMC -lLLVMMCDisassembler -lLLVMCore -lLLVMSupport -lz -lpthread -lffi -ltinfo -ldl -lm") - add_definitions(-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS) - link_directories(/usr/lib/llvm-3.7/lib) -endif() +find_package(LLVM REQUIRED CONFIG) +message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") +message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") +add_definitions(${LLVM_DEFINITIONS}) +llvm_map_components_to_libnames(LLVM_LIBS core support mcjit x86asmparser x86codegen ipo) get_filename_component(EVMJIT_INCLUDE_DIR include ABSOLUTE) From a52d85c38d738ae65ffd771d1b162ea5467fea86 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 15 Jun 2015 14:31:01 +0200 Subject: [PATCH 027/169] fix block number in test --- test/libethereum/StateTestsFiller/stSpecialTestFiller.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libethereum/StateTestsFiller/stSpecialTestFiller.json b/test/libethereum/StateTestsFiller/stSpecialTestFiller.json index 60181bd5c..fb7a7aa8f 100644 --- a/test/libethereum/StateTestsFiller/stSpecialTestFiller.json +++ b/test/libethereum/StateTestsFiller/stSpecialTestFiller.json @@ -271,7 +271,7 @@ "currentCoinbase" : "1cdc8315bdb1362de8b7b2fa9ee75dc873037179", "currentDifficulty" : "21010229025", "currentGasLimit" : "3141592", - "currentNumber" : "504780", + "currentNumber" : "504980", "currentTimestamp" : 1, "previousHash" : "9ff4de714e01da9f8b61992efdab9b51ca14ac42d43f4c24df1d002a1239b1e9" }, From 7d09d87d16d29e0306056d12414defdf0f9fc7fe Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 9 Jun 2015 14:26:08 +0200 Subject: [PATCH 028/169] Distinction between storage pointer and storage ref and type checking for conversion between storage and memory. --- libsolidity/AST.cpp | 38 +++-- libsolidity/AST.h | 80 +++++---- libsolidity/Compiler.cpp | 45 +++-- libsolidity/Compiler.h | 5 +- libsolidity/ExpressionCompiler.cpp | 29 +++- libsolidity/InterfaceHandler.cpp | 2 +- libsolidity/LValue.cpp | 6 +- libsolidity/NameAndTypeResolver.cpp | 14 +- libsolidity/Types.cpp | 156 +++++++++++++----- libsolidity/Types.h | 103 ++++++++---- .../SolidityNameAndTypeResolution.cpp | 87 ++++++++++ 11 files changed, 414 insertions(+), 151 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index 5be23b7c8..dbeec858e 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -488,7 +488,7 @@ string FunctionDefinition::externalSignature() const bool VariableDeclaration::isLValue() const { // External function parameters and constant declared variables are Read-Only - return !isExternalFunctionParameter() && !m_isConstant; + return !isExternalCallableParameter() && !m_isConstant; } void VariableDeclaration::checkTypeRequirements() @@ -516,39 +516,41 @@ void VariableDeclaration::checkTypeRequirements() BOOST_THROW_EXCEPTION(createTypeError("Assignment necessary for type detection.")); m_value->checkTypeRequirements(nullptr); - TypePointer type = m_value->getType(); - if (type->getCategory() == Type::Category::IntegerConstant) - { - auto intType = dynamic_pointer_cast(type)->getIntegerType(); - if (!intType) - BOOST_THROW_EXCEPTION(m_value->createTypeError("Invalid integer constant " + type->toString() + ".")); - type = intType; - } + TypePointer const& type = m_value->getType(); + if ( + type->getCategory() == Type::Category::IntegerConstant && + !dynamic_pointer_cast(type)->getIntegerType() + ) + BOOST_THROW_EXCEPTION(m_value->createTypeError("Invalid integer constant " + type->toString() + ".")); else if (type->getCategory() == Type::Category::Void) BOOST_THROW_EXCEPTION(createTypeError("Variable cannot have void type.")); - m_type = type; + m_type = type->mobileType(); } if (m_isStateVariable && getVisibility() >= Visibility::Public && !FunctionType(*this).externalType()) BOOST_THROW_EXCEPTION(createTypeError("Internal type is not allowed for public state variables.")); } -bool VariableDeclaration::isFunctionParameter() const +bool VariableDeclaration::isCallableParameter() const { - auto const* function = dynamic_cast(getScope()); - if (!function) + auto const* callable = dynamic_cast(getScope()); + if (!callable) return false; - for (auto const& variable: function->getParameters() + function->getReturnParameters()) + for (auto const& variable: callable->getParameters()) if (variable.get() == this) return true; + if (callable->getReturnParameterList()) + for (auto const& variable: callable->getReturnParameterList()->getParameters()) + if (variable.get() == this) + return true; return false; } -bool VariableDeclaration::isExternalFunctionParameter() const +bool VariableDeclaration::isExternalCallableParameter() const { - auto const* function = dynamic_cast(getScope()); - if (!function || function->getVisibility() != Declaration::Visibility::External) + auto const* callable = dynamic_cast(getScope()); + if (!callable || callable->getVisibility() != Declaration::Visibility::External) return false; - for (auto const& variable: function->getParameters()) + for (auto const& variable: callable->getParameters()) if (variable.get() == this) return true; return false; diff --git a/libsolidity/AST.h b/libsolidity/AST.h index b3984840f..5f1c1281c 100644 --- a/libsolidity/AST.h +++ b/libsolidity/AST.h @@ -406,13 +406,43 @@ private: std::vector> m_parameters; }; -class FunctionDefinition: public Declaration, public VariableScope, public Documented, public ImplementationOptional +/** + * Base class for all nodes that define function-like objects, i.e. FunctionDefinition, + * EventDefinition and ModifierDefinition. + */ +class CallableDeclaration: public Declaration, public VariableScope +{ +public: + CallableDeclaration( + SourceLocation const& _location, + ASTPointer const& _name, + Declaration::Visibility _visibility, + ASTPointer const& _parameters, + ASTPointer const& _returnParameters = ASTPointer() + ): + Declaration(_location, _name, _visibility), + m_parameters(_parameters), + m_returnParameters(_returnParameters) + { + } + + std::vector> const& getParameters() const { return m_parameters->getParameters(); } + ParameterList const& getParameterList() const { return *m_parameters; } + ASTPointer const& getReturnParameterList() const { return m_returnParameters; } + +protected: + ASTPointer m_parameters; + ASTPointer m_returnParameters; +}; + +class FunctionDefinition: public CallableDeclaration, public Documented, public ImplementationOptional { public: FunctionDefinition( SourceLocation const& _location, ASTPointer const& _name, - Declaration::Visibility _visibility, bool _isConstructor, + Declaration::Visibility _visibility, + bool _isConstructor, ASTPointer const& _documentation, ASTPointer const& _parameters, bool _isDeclaredConst, @@ -420,14 +450,12 @@ public: ASTPointer const& _returnParameters, ASTPointer const& _body ): - Declaration(_location, _name, _visibility), + CallableDeclaration(_location, _name, _visibility, _parameters, _returnParameters), Documented(_documentation), ImplementationOptional(_body != nullptr), m_isConstructor(_isConstructor), - m_parameters(_parameters), m_isDeclaredConst(_isDeclaredConst), m_functionModifiers(_modifiers), - m_returnParameters(_returnParameters), m_body(_body) {} @@ -437,10 +465,7 @@ public: bool isConstructor() const { return m_isConstructor; } bool isDeclaredConst() const { return m_isDeclaredConst; } std::vector> const& getModifiers() const { return m_functionModifiers; } - std::vector> const& getParameters() const { return m_parameters->getParameters(); } - ParameterList const& getParameterList() const { return *m_parameters; } std::vector> const& getReturnParameters() const { return m_returnParameters->getParameters(); } - ASTPointer const& getReturnParameterList() const { return m_returnParameters; } Block const& getBody() const { return *m_body; } virtual bool isVisibleInContract() const override @@ -460,10 +485,8 @@ public: private: bool m_isConstructor; - ASTPointer m_parameters; bool m_isDeclaredConst; std::vector> m_functionModifiers; - ASTPointer m_returnParameters; ASTPointer m_body; }; @@ -512,9 +535,9 @@ public: void checkTypeRequirements(); bool isLocalVariable() const { return !!dynamic_cast(getScope()); } /// @returns true if this variable is a parameter or return parameter of a function. - bool isFunctionParameter() const; + bool isCallableParameter() const; /// @returns true if this variable is a parameter (not return parameter) of an external function. - bool isExternalFunctionParameter() const; + bool isExternalCallableParameter() const; bool isStateVariable() const { return m_isStateVariable; } bool isIndexed() const { return m_isIndexed; } bool isConstant() const { return m_isConstant; } @@ -537,22 +560,24 @@ private: /** * Definition of a function modifier. */ -class ModifierDefinition: public Declaration, public VariableScope, public Documented +class ModifierDefinition: public CallableDeclaration, public Documented { public: ModifierDefinition(SourceLocation const& _location, - ASTPointer const& _name, - ASTPointer const& _documentation, - ASTPointer const& _parameters, - ASTPointer const& _body): - Declaration(_location, _name), Documented(_documentation), - m_parameters(_parameters), m_body(_body) {} + ASTPointer const& _name, + ASTPointer const& _documentation, + ASTPointer const& _parameters, + ASTPointer const& _body + ): + CallableDeclaration(_location, _name, Visibility::Default, _parameters), + Documented(_documentation), + m_body(_body) + { + } virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; - std::vector> const& getParameters() const { return m_parameters->getParameters(); } - ParameterList const& getParameterList() const { return *m_parameters; } Block const& getBody() const { return *m_body; } virtual TypePointer getType(ContractDefinition const* = nullptr) const override; @@ -560,7 +585,6 @@ public: void checkTypeRequirements(); private: - ASTPointer m_parameters; ASTPointer m_body; }; @@ -591,7 +615,7 @@ private: /** * Definition of a (loggable) event. */ -class EventDefinition: public Declaration, public VariableScope, public Documented +class EventDefinition: public CallableDeclaration, public Documented { public: EventDefinition( @@ -601,16 +625,15 @@ public: ASTPointer const& _parameters, bool _anonymous = false ): - Declaration(_location, _name), + CallableDeclaration(_location, _name, Visibility::Default, _parameters), Documented(_documentation), - m_parameters(_parameters), - m_anonymous(_anonymous){} + m_anonymous(_anonymous) + { + } virtual void accept(ASTVisitor& _visitor) override; virtual void accept(ASTConstVisitor& _visitor) const override; - std::vector> const& getParameters() const { return m_parameters->getParameters(); } - ParameterList const& getParameterList() const { return *m_parameters; } bool isAnonymous() const { return m_anonymous; } virtual TypePointer getType(ContractDefinition const* = nullptr) const override @@ -621,7 +644,6 @@ public: void checkTypeRequirements(); private: - ASTPointer m_parameters; bool m_anonymous = false; }; diff --git a/libsolidity/Compiler.cpp b/libsolidity/Compiler.cpp index b2b8bfa4c..b55ae7d36 100644 --- a/libsolidity/Compiler.cpp +++ b/libsolidity/Compiler.cpp @@ -170,11 +170,17 @@ void Compiler::appendConstructor(FunctionDefinition const& _constructor) if (argumentSize > 0) { - m_context << u256(argumentSize); + CompilerUtils(m_context).fetchFreeMemoryPointer(); + m_context << u256(argumentSize) << eth::Instruction::DUP1; m_context.appendProgramSize(); - m_context << u256(CompilerUtils::dataStartOffset); // copy it to byte four as expected for ABI calls - m_context << eth::Instruction::CODECOPY; - appendCalldataUnpacker(FunctionType(_constructor).getParameterTypes(), true); + m_context << eth::Instruction::DUP4 << eth::Instruction::CODECOPY; + m_context << eth::Instruction::ADD; + CompilerUtils(m_context).storeFreeMemoryPointer(); + appendCalldataUnpacker( + FunctionType(_constructor).getParameterTypes(), + true, + CompilerUtils::freeMemoryPointer + 0x20 + ); } _constructor.accept(*this); } @@ -232,26 +238,35 @@ void Compiler::appendFunctionSelector(ContractDefinition const& _contract) } } -void Compiler::appendCalldataUnpacker(TypePointers const& _typeParameters, bool _fromMemory) +void Compiler::appendCalldataUnpacker( + TypePointers const& _typeParameters, + bool _fromMemory, + u256 _startOffset +) { // We do not check the calldata size, everything is zero-paddedd - m_context << u256(CompilerUtils::dataStartOffset); + if (_startOffset == u256(-1)) + _startOffset = u256(CompilerUtils::dataStartOffset); + + m_context << _startOffset; for (TypePointer const& type: _typeParameters) { - if (type->getCategory() == Type::Category::Array) + switch (type->getCategory()) + { + case Type::Category::Array: { auto const& arrayType = dynamic_cast(*type); if (arrayType.location() == ReferenceType::Location::CallData) { + solAssert(!_fromMemory, ""); if (type->isDynamicallySized()) { // put on stack: data_pointer length CompilerUtils(m_context).loadFromMemoryDynamic(IntegerType(256), !_fromMemory); // stack: data_offset next_pointer //@todo once we support nested arrays, this offset needs to be dynamic. - m_context << eth::Instruction::SWAP1 << u256(CompilerUtils::dataStartOffset); - m_context << eth::Instruction::ADD; + m_context << eth::Instruction::SWAP1 << _startOffset << eth::Instruction::ADD; // stack: next_pointer data_pointer // retrieve length CompilerUtils(m_context).loadFromMemoryDynamic(IntegerType(256), !_fromMemory, true); @@ -268,13 +283,15 @@ void Compiler::appendCalldataUnpacker(TypePointers const& _typeParameters, bool else { solAssert(arrayType.location() == ReferenceType::Location::Memory, ""); - CompilerUtils(m_context).fetchFreeMemoryPointer(); - CompilerUtils(m_context).storeInMemoryDynamic(*type); - CompilerUtils(m_context).storeFreeMemoryPointer(); + // compute data pointer + m_context << eth::Instruction::DUP1 << _startOffset << eth::Instruction::ADD; + if (!_fromMemory) + solAssert(false, "Not yet implemented."); + m_context << eth::Instruction::SWAP1 << u256(0x20) << eth::Instruction::ADD; } + break; } - else - { + default: solAssert(!type->isDynamicallySized(), "Unknown dynamically sized type: " + type->toString()); CompilerUtils(m_context).loadFromMemoryDynamic(*type, !_fromMemory, true); } diff --git a/libsolidity/Compiler.h b/libsolidity/Compiler.h index 670c74673..589efbff2 100644 --- a/libsolidity/Compiler.h +++ b/libsolidity/Compiler.h @@ -73,7 +73,10 @@ private: void appendFunctionSelector(ContractDefinition const& _contract); /// Creates code that unpacks the arguments for the given function represented by a vector of TypePointers. /// From memory if @a _fromMemory is true, otherwise from call data. - void appendCalldataUnpacker(TypePointers const& _typeParameters, bool _fromMemory = false); + /// Expects source offset on the stack. + void appendCalldataUnpacker(TypePointers const& _typeParameters, + bool _fromMemory = false, + u256 _startOffset = u256(-1)); void appendReturnValuePacker(TypePointers const& _typeParameters); void registerStateVariables(ContractDefinition const& _contract); diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index d9b6da14e..811ee60ec 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -204,7 +204,7 @@ void ExpressionCompiler::appendTypeConversion(Type const& _typeOnStack, Type con } else if (targetTypeCategory == Type::Category::Enum) // just clean - appendTypeConversion(_typeOnStack, *_typeOnStack.getRealType(), true); + appendTypeConversion(_typeOnStack, *_typeOnStack.mobileType(), true); else { solAssert(targetTypeCategory == Type::Category::Integer || targetTypeCategory == Type::Category::Contract, ""); @@ -232,6 +232,25 @@ void ExpressionCompiler::appendTypeConversion(Type const& _typeOnStack, Type con } } break; + case Type::Category::Array: + //@TODO + break; + case Type::Category::Struct: + { + solAssert(targetTypeCategory == stackTypeCategory, ""); + auto& targetType = dynamic_cast(_targetType); + auto& stackType = dynamic_cast(_typeOnStack); + solAssert( + targetType.location() == ReferenceType::Location::Storage && + stackType.location() == ReferenceType::Location::Storage, + "Non-storage structs not yet implemented." + ); + solAssert( + targetType.isPointer(), + "Type conversion to non-pointer struct requested." + ); + break; + } default: // All other types should not be convertible to non-equal types. solAssert(_typeOnStack == _targetType, "Invalid type conversion requested."); @@ -771,7 +790,7 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) TypeType const& type = dynamic_cast(*_memberAccess.getExpression().getType()); solAssert( !type.getMembers().membersByName(_memberAccess.getMemberName()).empty(), - "Invalid member access to " + type.toString() + "Invalid member access to " + type.toString(false) ); if (dynamic_cast(type.getActualType().get())) @@ -1101,7 +1120,7 @@ void ExpressionCompiler::appendExternalFunctionCall( bool manualFunctionId = (funKind == FunctionKind::Bare || funKind == FunctionKind::BareCallCode) && !_arguments.empty() && - _arguments.front()->getType()->getRealType()->getCalldataEncodedSize(false) == + _arguments.front()->getType()->mobileType()->getCalldataEncodedSize(false) == CompilerUtils::dataStartOffset; if (manualFunctionId) { @@ -1225,7 +1244,7 @@ void ExpressionCompiler::encodeToMemory( TypePointers targetTypes = _targetTypes.empty() ? _givenTypes : _targetTypes; solAssert(targetTypes.size() == _givenTypes.size(), ""); for (TypePointer& t: targetTypes) - t = t->getRealType()->externalType(); + t = t->mobileType()->externalType(); // Stack during operation: // ... ... @@ -1325,7 +1344,7 @@ void ExpressionCompiler::appendExpressionCopyToMemory(Type const& _expectedType, appendTypeMoveToMemory(_expectedType); } else - appendTypeMoveToMemory(*_expression.getType()->getRealType()); + appendTypeMoveToMemory(*_expression.getType()->mobileType()); } void ExpressionCompiler::setLValueFromDeclaration(Declaration const& _declaration, Expression const& _expression) diff --git a/libsolidity/InterfaceHandler.cpp b/libsolidity/InterfaceHandler.cpp index a9d54cdc6..23b7ff82f 100644 --- a/libsolidity/InterfaceHandler.cpp +++ b/libsolidity/InterfaceHandler.cpp @@ -96,7 +96,7 @@ unique_ptr InterfaceHandler::getABIInterface(ContractDefinition const& _ { Json::Value input; input["name"] = p->getName(); - input["type"] = p->getType()->toString(); + input["type"] = p->getType()->toString(true); input["indexed"] = p->isIndexed(); params.append(input); } diff --git a/libsolidity/LValue.cpp b/libsolidity/LValue.cpp index b684e55a1..1acf0a3e8 100644 --- a/libsolidity/LValue.cpp +++ b/libsolidity/LValue.cpp @@ -198,7 +198,11 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc // stack layout: source_ref source_offset target_ref target_offset // note that we have structs, so offsets should be zero and are ignored auto const& structType = dynamic_cast(m_dataType); - solAssert(structType == _sourceType, "Struct assignment with conversion."); + solAssert( + structType.structDefinition() == + dynamic_cast(_sourceType).structDefinition(), + "Struct assignment with conversion." + ); for (auto const& member: structType.getMembers()) { // assign each member that is not a mapping diff --git a/libsolidity/NameAndTypeResolver.cpp b/libsolidity/NameAndTypeResolver.cpp index 22232014f..e60797967 100644 --- a/libsolidity/NameAndTypeResolver.cpp +++ b/libsolidity/NameAndTypeResolver.cpp @@ -431,7 +431,7 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable) // They default to memory for function parameters and storage for local variables. if (auto ref = dynamic_cast(type.get())) { - if (_variable.isExternalFunctionParameter()) + if (_variable.isExternalCallableParameter()) { // force location of external function parameters (not return) to calldata if (loc != Location::Default) @@ -439,9 +439,9 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable) "Location has to be calldata for external functions " "(remove the \"memory\" or \"storage\" keyword)." )); - type = ref->copyForLocation(ReferenceType::Location::CallData); + type = ref->copyForLocation(ReferenceType::Location::CallData, true); } - else if (_variable.isFunctionParameter() && _variable.getScope()->isPublic()) + else if (_variable.isCallableParameter() && _variable.getScope()->isPublic()) { // force locations of public or external function (return) parameters to memory if (loc == VariableDeclaration::Location::Storage) @@ -449,16 +449,18 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable) "Location has to be memory for publicly visible functions " "(remove the \"storage\" keyword)." )); - type = ref->copyForLocation(ReferenceType::Location::Memory); + type = ref->copyForLocation(ReferenceType::Location::Memory, true); } else { if (loc == Location::Default) - loc = _variable.isFunctionParameter() ? Location::Memory : Location::Storage; + loc = _variable.isCallableParameter() ? Location::Memory : Location::Storage; + bool isPointer = !_variable.isStateVariable(); type = ref->copyForLocation( loc == Location::Memory ? ReferenceType::Location::Memory : - ReferenceType::Location::Storage + ReferenceType::Location::Storage, + isPointer ); } } diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index 6f16f5193..65acba844 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -179,6 +179,8 @@ TypePointer Type::fromMapping(ElementaryTypeName& _keyType, TypeName& _valueType TypePointer valueType = _valueType.toType(); if (!valueType) BOOST_THROW_EXCEPTION(_valueType.createTypeError("Invalid type name.")); + // Convert value type to storage reference. + valueType = ReferenceType::copyForLocationIfReference(ReferenceType::Location::Storage, valueType); return make_shared(keyType, valueType); } @@ -288,7 +290,7 @@ bool IntegerType::operator==(Type const& _other) const return other.m_bits == m_bits && other.m_modifier == m_modifier; } -string IntegerType::toString() const +string IntegerType::toString(bool) const { if (isAddress()) return "address"; @@ -488,7 +490,7 @@ bool IntegerConstantType::operator==(Type const& _other) const return m_value == dynamic_cast(_other).m_value; } -string IntegerConstantType::toString() const +string IntegerConstantType::toString(bool) const { return "int_const " + m_value.str(); } @@ -508,10 +510,10 @@ u256 IntegerConstantType::literalValue(Literal const*) const return value; } -TypePointer IntegerConstantType::getRealType() const +TypePointer IntegerConstantType::mobileType() const { auto intType = getIntegerType(); - solAssert(!!intType, "getRealType called with invalid integer constant " + toString()); + solAssert(!!intType, "mobileType called with invalid integer constant " + toString(false)); return intType; } @@ -668,21 +670,65 @@ TypePointer ContractType::unaryOperatorResult(Token::Value _operator) const return _operator == Token::Delete ? make_shared() : TypePointer(); } +TypePointer ReferenceType::copyForLocationIfReference(Location _location, TypePointer const& _type) +{ + if (auto type = dynamic_cast(_type.get())) + return type->copyForLocation(_location, false); + return _type; +} + +TypePointer ReferenceType::copyForLocationIfReference(TypePointer const& _type) const +{ + return copyForLocationIfReference(m_location, _type); +} + +string ReferenceType::stringForReferencePart() const +{ + switch (m_location) + { + case Location::Storage: + return string("storage ") + (m_isPointer ? "pointer" : "ref"); + case Location::CallData: + return "calldata"; + case Location::Memory: + return "memory"; + } +} + bool ArrayType::isImplicitlyConvertibleTo(const Type& _convertTo) const { if (_convertTo.getCategory() != getCategory()) return false; auto& convertTo = dynamic_cast(_convertTo); - // let us not allow assignment to memory arrays for now - if (convertTo.location() != Location::Storage) - return false; if (convertTo.isByteArray() != isByteArray() || convertTo.isString() != isString()) return false; - if (!getBaseType()->isImplicitlyConvertibleTo(*convertTo.getBaseType())) + // memory/calldata to storage can be converted, but only to a direct storage reference + if (convertTo.location() == Location::Storage && location() != Location::Storage && convertTo.isPointer()) return false; - if (convertTo.isDynamicallySized()) + if (convertTo.location() == Location::CallData && location() != convertTo.location()) + return false; + if (convertTo.location() == Location::Storage && !convertTo.isPointer()) + { + // Less restrictive conversion, since we need to copy anyway. + if (!getBaseType()->isImplicitlyConvertibleTo(*convertTo.getBaseType())) + return false; + if (convertTo.isDynamicallySized()) + return true; + return !isDynamicallySized() && convertTo.getLength() >= getLength(); + } + else + { + // Require that the base type is the same, not only convertible. + // This disallows assignment of nested arrays from storage to memory for now. + if (*getBaseType() != *convertTo.getBaseType()) + return false; + if (isDynamicallySized() != convertTo.isDynamicallySized()) + return false; + // We also require that the size is the same. + if (!isDynamicallySized() && getLength() != convertTo.getLength()) + return false; return true; - return !isDynamicallySized() && convertTo.getLength() >= getLength(); + } } TypePointer ArrayType::unaryOperatorResult(Token::Value _operator) const @@ -698,7 +744,7 @@ bool ArrayType::operator==(Type const& _other) const return false; ArrayType const& other = dynamic_cast(_other); if ( - other.m_location != m_location || + !ReferenceType::operator==(other) || other.isByteArray() != isByteArray() || other.isString() != isString() || other.isDynamicallySized() != isDynamicallySized() @@ -751,16 +797,23 @@ unsigned ArrayType::getSizeOnStack() const return 1; } -string ArrayType::toString() const +string ArrayType::toString(bool _short) const { + string ret; if (isString()) - return "string"; + ret = "string"; else if (isByteArray()) - return "bytes"; - string ret = getBaseType()->toString() + "["; - if (!isDynamicallySized()) - ret += getLength().str(); - return ret + "]"; + ret = "bytes"; + else + { + ret = getBaseType()->toString(_short) + "["; + if (!isDynamicallySized()) + ret += getLength().str(); + ret += "]"; + } + if (!_short) + ret += " " + stringForReferencePart(); + return ret; } TypePointer ArrayType::externalType() const @@ -778,14 +831,12 @@ TypePointer ArrayType::externalType() const return std::make_shared(Location::CallData, m_baseType->externalType(), m_length); } -TypePointer ArrayType::copyForLocation(ReferenceType::Location _location) const +TypePointer ArrayType::copyForLocation(ReferenceType::Location _location, bool _isPointer) const { auto copy = make_shared(_location); + copy->m_isPointer = _isPointer; copy->m_arrayKind = m_arrayKind; - if (auto ref = dynamic_cast(m_baseType.get())) - copy->m_baseType = ref->copyForLocation(_location); - else - copy->m_baseType = m_baseType; + copy->m_baseType = copy->copyForLocationIfReference(m_baseType); copy->m_hasDynamicLength = m_hasDynamicLength; copy->m_length = m_length; return copy; @@ -801,7 +852,7 @@ bool ContractType::operator==(Type const& _other) const return other.m_contract == m_contract && other.m_super == m_super; } -string ContractType::toString() const +string ContractType::toString(bool) const { return "contract " + string(m_super ? "super " : "") + m_contract.getName(); } @@ -890,6 +941,19 @@ vector> ContractType::getState return variablesAndOffsets; } +bool StructType::isImplicitlyConvertibleTo(const Type& _convertTo) const +{ + if (_convertTo.getCategory() != getCategory()) + return false; + auto& convertTo = dynamic_cast(_convertTo); + // memory/calldata to storage can be converted, but only to a direct storage reference + if (convertTo.location() == Location::Storage && location() != Location::Storage && convertTo.isPointer()) + return false; + if (convertTo.location() == Location::CallData && location() != convertTo.location()) + return false; + return this->m_struct == convertTo.m_struct; +} + TypePointer StructType::unaryOperatorResult(Token::Value _operator) const { return _operator == Token::Delete ? make_shared() : TypePointer(); @@ -900,7 +964,7 @@ bool StructType::operator==(Type const& _other) const if (_other.getCategory() != getCategory()) return false; StructType const& other = dynamic_cast(_other); - return other.m_struct == m_struct; + return ReferenceType::operator==(other) && other.m_struct == m_struct; } u256 StructType::getStorageSize() const @@ -916,9 +980,12 @@ bool StructType::canLiveOutsideStorage() const return true; } -string StructType::toString() const +string StructType::toString(bool _short) const { - return string("struct ") + m_struct.getName(); + string ret = "struct " + m_struct.getName(); + if (!_short) + ret += " " + stringForReferencePart(); + return ret; } MemberList const& StructType::getMembers() const @@ -928,16 +995,23 @@ MemberList const& StructType::getMembers() const { MemberList::MemberMap members; for (ASTPointer const& variable: m_struct.getMembers()) - members.push_back(MemberList::Member(variable->getName(), variable->getType(), variable.get())); + { + members.push_back(MemberList::Member( + variable->getName(), + copyForLocationIfReference(variable->getType()), + variable.get()) + ); + } m_members.reset(new MemberList(members)); } return *m_members; } -TypePointer StructType::copyForLocation(ReferenceType::Location _location) const +TypePointer StructType::copyForLocation(ReferenceType::Location _location, bool _isPointer) const { auto copy = make_shared(m_struct); copy->m_location = _location; + copy->m_isPointer = _isPointer; return copy; } @@ -970,7 +1044,7 @@ unsigned EnumType::getStorageBytes() const return dev::bytesRequired(elements - 1); } -string EnumType::toString() const +string EnumType::toString(bool) const { return string("enum ") + m_enum.getName(); } @@ -1114,14 +1188,14 @@ bool FunctionType::operator==(Type const& _other) const return true; } -string FunctionType::toString() const +string FunctionType::toString(bool _short) const { string name = "function ("; for (auto it = m_parameterTypes.begin(); it != m_parameterTypes.end(); ++it) - name += (*it)->toString() + (it + 1 == m_parameterTypes.end() ? "" : ","); + name += (*it)->toString(_short) + (it + 1 == m_parameterTypes.end() ? "" : ","); name += ") returns ("; for (auto it = m_returnParameterTypes.begin(); it != m_returnParameterTypes.end(); ++it) - name += (*it)->toString() + (it + 1 == m_returnParameterTypes.end() ? "" : ","); + name += (*it)->toString(_short) + (it + 1 == m_returnParameterTypes.end() ? "" : ","); return name + ")"; } @@ -1289,7 +1363,7 @@ string FunctionType::externalSignature(std::string const& _name) const for (auto it = externalParameterTypes.cbegin(); it != externalParameterTypes.cend(); ++it) { solAssert(!!(*it), "Parameter should have external type"); - ret += (*it)->toString() + (it + 1 == externalParameterTypes.cend() ? "" : ","); + ret += (*it)->toString(true) + (it + 1 == externalParameterTypes.cend() ? "" : ","); } return ret + ")"; @@ -1327,7 +1401,7 @@ vector const FunctionType::getParameterTypeNames() const { vector names; for (TypePointer const& t: m_parameterTypes) - names.push_back(t->toString()); + names.push_back(t->toString(true)); return names; } @@ -1336,7 +1410,7 @@ vector const FunctionType::getReturnParameterTypeNames() const { vector names; for (TypePointer const& t: m_returnParameterTypes) - names.push_back(t->toString()); + names.push_back(t->toString(true)); return names; } @@ -1358,9 +1432,9 @@ bool MappingType::operator==(Type const& _other) const return *other.m_keyType == *m_keyType && *other.m_valueType == *m_valueType; } -string MappingType::toString() const +string MappingType::toString(bool _short) const { - return "mapping(" + getKeyType()->toString() + " => " + getValueType()->toString() + ")"; + return "mapping(" + getKeyType()->toString(_short) + " => " + getValueType()->toString(_short) + ")"; } u256 VoidType::getStorageSize() const @@ -1445,11 +1519,11 @@ bool ModifierType::operator==(Type const& _other) const return true; } -string ModifierType::toString() const +string ModifierType::toString(bool _short) const { string name = "modifier ("; for (auto it = m_parameterTypes.begin(); it != m_parameterTypes.end(); ++it) - name += (*it)->toString() + (it + 1 == m_parameterTypes.end() ? "" : ","); + name += (*it)->toString(_short) + (it + 1 == m_parameterTypes.end() ? "" : ","); return name + ")"; } @@ -1496,7 +1570,7 @@ bool MagicType::operator==(Type const& _other) const return other.m_kind == m_kind; } -string MagicType::toString() const +string MagicType::toString(bool) const { switch (m_kind) { diff --git a/libsolidity/Types.h b/libsolidity/Types.h index 17d30ea6c..0f86ac95f 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -198,19 +198,24 @@ public: /// i.e. it behaves differently in lvalue context and in value context. virtual bool isValueType() const { return false; } virtual unsigned getSizeOnStack() const { return 1; } - /// @returns the real type of some types, like e.g: IntegerConstant - virtual TypePointer getRealType() const { return shared_from_this(); } + /// @returns the mobile (in contrast to static) type corresponding to the given type. + /// This returns the corresponding integer type for IntegerConstantTypes and the pointer type + /// for storage reference types. + virtual TypePointer mobileType() const { return shared_from_this(); } /// Returns the list of all members of this type. Default implementation: no members. virtual MemberList const& getMembers() const { return EmptyMemberList; } /// Convenience method, returns the type of the given named member or an empty pointer if no such member exists. TypePointer getMemberType(std::string const& _name) const { return getMembers().getMemberType(_name); } - virtual std::string toString() const = 0; + virtual std::string toString(bool _short) const = 0; + std::string toString() const { return toString(false); } virtual u256 literalValue(Literal const*) const { - BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Literal value requested " - "for type without literals.")); + BOOST_THROW_EXCEPTION( + InternalCompilerError() << + errinfo_comment("Literal value requested for type without literals.") + ); } /// @returns a type suitable for outside of Solidity, i.e. for contract types it returns address. @@ -249,7 +254,7 @@ public: virtual MemberList const& getMembers() const override { return isAddress() ? AddressMemberList : EmptyMemberList; } - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual TypePointer externalType() const override { return shared_from_this(); } @@ -287,9 +292,9 @@ public: virtual bool canLiveOutsideStorage() const override { return false; } virtual unsigned getSizeOnStack() const override { return 1; } - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual u256 literalValue(Literal const* _literal) const override; - virtual TypePointer getRealType() const override; + virtual TypePointer mobileType() const override; /// @returns the smallest integer type that can hold the value or an empty pointer if not possible. std::shared_ptr getIntegerType() const; @@ -322,7 +327,7 @@ public: virtual unsigned getStorageBytes() const override { return m_bytes; } virtual bool isValueType() const override { return true; } - virtual std::string toString() const override { return "bytes" + dev::toString(m_bytes); } + virtual std::string toString(bool) const override { return "bytes" + dev::toString(m_bytes); } virtual u256 literalValue(Literal const* _literal) const override; virtual TypePointer externalType() const override { return shared_from_this(); } @@ -348,27 +353,51 @@ public: virtual unsigned getStorageBytes() const override { return 1; } virtual bool isValueType() const override { return true; } - virtual std::string toString() const override { return "bool"; } + virtual std::string toString(bool) const override { return "bool"; } virtual u256 literalValue(Literal const* _literal) const override; virtual TypePointer externalType() const override { return shared_from_this(); } }; /** - * Trait used by types which are not value types and can be stored either in storage, memory + * Base class used by types which are not value types and can be stored either in storage, memory * or calldata. This is currently used by arrays and structs. */ -class ReferenceType +class ReferenceType: public Type { public: enum class Location { Storage, CallData, Memory }; explicit ReferenceType(Location _location): m_location(_location) {} Location location() const { return m_location; } - /// @returns a copy of this type with location (recursively) changed to @a _location. - virtual TypePointer copyForLocation(Location _location) const = 0; + /// @returns a copy of this type with location (recursively) changed to @a _location, + /// whereas isPointer is only shallowly changed - the deep copy is always a bound reference. + virtual TypePointer copyForLocation(Location _location, bool _isPointer) const = 0; + + virtual TypePointer mobileType() const override { return copyForLocation(m_location, true); } + + /// Storage references can be pointers or bound references. In general, local variables are of + /// pointer type, state variables are bound references. Assignments to pointers or deleting + /// them will not modify storage (that will only change the pointer). Assignment from + /// non-storage objects to a variable of storage pointer type is not possible. + bool isPointer() const { return m_isPointer; } + + bool operator==(ReferenceType const& _other) const + { + return location() == _other.location() && isPointer() == _other.isPointer(); + } + + /// @returns a copy of @a _type having the same location as this (and is not a pointer type) + /// if _type is a reference type and an unmodified copy of _type otherwise. + /// This function is mostly useful to modify inner types appropriately. + static TypePointer copyForLocationIfReference(Location _location, TypePointer const& _type); protected: + TypePointer copyForLocationIfReference(TypePointer const& _type) const; + /// @returns a human-readable description of the reference part of the type. + std::string stringForReferencePart() const; + Location m_location = Location::Storage; + bool m_isPointer = true; }; /** @@ -378,10 +407,9 @@ protected: * one slot). Dynamically sized arrays (including byte arrays) start with their size as a uint and * thus start on their own slot. */ -class ArrayType: public Type, public ReferenceType +class ArrayType: public ReferenceType { public: - virtual Category getCategory() const override { return Category::Array; } /// Constructor for a byte array ("bytes") and string. @@ -389,16 +417,18 @@ public: ReferenceType(_location), m_arrayKind(_isString ? ArrayKind::String : ArrayKind::Bytes), m_baseType(std::make_shared(1)) - {} + { + } /// Constructor for a dynamically sized array type ("type[]") - ArrayType(Location _location, const TypePointer &_baseType): + ArrayType(Location _location, TypePointer const& _baseType): ReferenceType(_location), - m_baseType(_baseType) - {} + m_baseType(copyForLocationIfReference(_baseType)) + { + } /// Constructor for a fixed-size array type ("type[20]") - ArrayType(Location _location, const TypePointer &_baseType, u256 const& _length): + ArrayType(Location _location, TypePointer const& _baseType, u256 const& _length): ReferenceType(_location), - m_baseType(_baseType), + m_baseType(copyForLocationIfReference(_baseType)), m_hasDynamicLength(false), m_length(_length) {} @@ -410,7 +440,7 @@ public: virtual bool isDynamicallySized() const override { return m_hasDynamicLength; } virtual u256 getStorageSize() const override; virtual unsigned getSizeOnStack() const override; - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual MemberList const& getMembers() const override { return isString() ? EmptyMemberList : s_arrayTypeMemberList; @@ -424,7 +454,7 @@ public: TypePointer const& getBaseType() const { solAssert(!!m_baseType, ""); return m_baseType;} u256 const& getLength() const { return m_length; } - TypePointer copyForLocation(Location _location) const override; + TypePointer copyForLocation(Location _location, bool _isPointer) const override; private: /// String is interpreted as a subtype of Bytes. @@ -460,7 +490,7 @@ public: virtual unsigned getStorageBytes() const override { return 20; } virtual bool canLiveOutsideStorage() const override { return true; } virtual bool isValueType() const override { return true; } - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual MemberList const& getMembers() const override; virtual TypePointer externalType() const override @@ -497,26 +527,29 @@ private: /** * The type of a struct instance, there is one distinct type per struct definition. */ -class StructType: public Type, public ReferenceType +class StructType: public ReferenceType { public: virtual Category getCategory() const override { return Category::Struct; } explicit StructType(StructDefinition const& _struct): //@todo only storage until we have non-storage structs ReferenceType(Location::Storage), m_struct(_struct) {} + virtual bool isImplicitlyConvertibleTo(const Type& _convertTo) const override; virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; virtual bool operator==(Type const& _other) const override; virtual u256 getStorageSize() const override; virtual bool canLiveOutsideStorage() const override; virtual unsigned getSizeOnStack() const override { return 2; } - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual MemberList const& getMembers() const override; - TypePointer copyForLocation(Location _location) const override; + TypePointer copyForLocation(Location _location, bool _isPointer) const override; std::pair const& getStorageOffsetsOfMember(std::string const& _name) const; + StructDefinition const& structDefinition() const { return m_struct; } + private: StructDefinition const& m_struct; /// List of member types, will be lazy-initialized because of recursive references. @@ -540,7 +573,7 @@ public: virtual unsigned getSizeOnStack() const override { return 1; } virtual unsigned getStorageBytes() const override; virtual bool canLiveOutsideStorage() const override { return true; } - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual bool isValueType() const override { return true; } virtual bool isExplicitlyConvertibleTo(Type const& _convertTo) const override; @@ -649,7 +682,7 @@ public: std::vector const getReturnParameterTypeNames() const; virtual bool operator==(Type const& _other) const override; - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual bool canBeStored() const override { return false; } virtual u256 getStorageSize() const override; virtual bool canLiveOutsideStorage() const override { return false; } @@ -721,7 +754,7 @@ public: m_keyType(_keyType), m_valueType(_valueType) {} virtual bool operator==(Type const& _other) const override; - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; virtual unsigned getSizeOnStack() const override { return 2; } virtual bool canLiveOutsideStorage() const override { return false; } @@ -744,7 +777,7 @@ public: VoidType() {} virtual TypePointer binaryOperatorResult(Token::Value, TypePointer const&) const override { return TypePointer(); } - virtual std::string toString() const override { return "void"; } + virtual std::string toString(bool) const override { return "void"; } virtual bool canBeStored() const override { return false; } virtual u256 getStorageSize() const override; virtual bool canLiveOutsideStorage() const override { return false; } @@ -769,7 +802,7 @@ public: virtual u256 getStorageSize() const override; virtual bool canLiveOutsideStorage() const override { return false; } virtual unsigned getSizeOnStack() const override { return 0; } - virtual std::string toString() const override { return "type(" + m_actualType->toString() + ")"; } + virtual std::string toString(bool _short) const override { return "type(" + m_actualType->toString(_short) + ")"; } virtual MemberList const& getMembers() const override; private: @@ -796,7 +829,7 @@ public: virtual bool canLiveOutsideStorage() const override { return false; } virtual unsigned getSizeOnStack() const override { return 0; } virtual bool operator==(Type const& _other) const override; - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; private: TypePointers m_parameterTypes; @@ -826,7 +859,7 @@ public: virtual unsigned getSizeOnStack() const override { return 0; } virtual MemberList const& getMembers() const override { return m_members; } - virtual std::string toString() const override; + virtual std::string toString(bool _short) const override; private: Kind m_kind; diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index 3948a4a23..fced12848 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -1889,6 +1889,93 @@ BOOST_AUTO_TEST_CASE(storage_location_local_variables) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode)); } +BOOST_AUTO_TEST_CASE(assignment_mem_to_local_storage_variable) +{ + char const* sourceCode = R"( + contract C { + uint[] data; + function f(uint[] x) { + var dataRef = data; + dataRef = x; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + +BOOST_AUTO_TEST_CASE(storage_assign_to_different_local_variable) +{ + char const* sourceCode = R"( + contract C { + uint[] data; + uint8[] otherData; + function f() { + uint8[] storage x = otherData; + uint[] storage y = data; + y = x; + // note that data = otherData works + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + +BOOST_AUTO_TEST_CASE(assignment_mem_storage_variable_directly) +{ + char const* sourceCode = R"( + contract C { + uint[] data; + function f(uint[] x) { + data = x; + } + } + )"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode)); +} + +BOOST_AUTO_TEST_CASE(function_argument_mem_to_storage) +{ + char const* sourceCode = R"( + contract C { + function f(uint[] storage x) private { + } + function g(uint[] x) { + f(x); + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + +BOOST_AUTO_TEST_CASE(function_argument_storage_to_mem) +{ + char const* sourceCode = R"( + contract C { + function f(uint[] storage x) private { + g(x); + } + function g(uint[] x) { + } + } + )"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(sourceCode)); +} + +BOOST_AUTO_TEST_CASE(mem_array_assignment_changes_base_type) +{ + // Such an assignment is possible in storage, but not in memory + // (because it would incur an otherwise unnecessary copy). + // This requirement might be lifted, though. + char const* sourceCode = R"( + contract C { + function f(uint8[] memory x) private { + uint[] memory y = x; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError); +} + BOOST_AUTO_TEST_SUITE_END() } From 1e6b82606e00b04d92c6e5f411026dedadaf7a1e Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 12 Jun 2015 10:48:47 +0200 Subject: [PATCH 029/169] Pleased gcc. --- libsolidity/Types.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index 65acba844..bedd2e7b0 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -693,6 +693,8 @@ string ReferenceType::stringForReferencePart() const case Location::Memory: return "memory"; } + solAssert(false, ""); + return ""; } bool ArrayType::isImplicitlyConvertibleTo(const Type& _convertTo) const From 02c958973439a59404b92f38de36c9e66aa93055 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 15 Jun 2015 14:39:34 +0200 Subject: [PATCH 030/169] Style. --- libsolidity/AST.h | 3 ++- libsolidity/Compiler.h | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/libsolidity/AST.h b/libsolidity/AST.h index 5f1c1281c..ff0d708f5 100644 --- a/libsolidity/AST.h +++ b/libsolidity/AST.h @@ -563,7 +563,8 @@ private: class ModifierDefinition: public CallableDeclaration, public Documented { public: - ModifierDefinition(SourceLocation const& _location, + ModifierDefinition( + SourceLocation const& _location, ASTPointer const& _name, ASTPointer const& _documentation, ASTPointer const& _parameters, diff --git a/libsolidity/Compiler.h b/libsolidity/Compiler.h index 589efbff2..60ca00e83 100644 --- a/libsolidity/Compiler.h +++ b/libsolidity/Compiler.h @@ -74,9 +74,11 @@ private: /// Creates code that unpacks the arguments for the given function represented by a vector of TypePointers. /// From memory if @a _fromMemory is true, otherwise from call data. /// Expects source offset on the stack. - void appendCalldataUnpacker(TypePointers const& _typeParameters, + void appendCalldataUnpacker( + TypePointers const& _typeParameters, bool _fromMemory = false, - u256 _startOffset = u256(-1)); + u256 _startOffset = u256(-1) + ); void appendReturnValuePacker(TypePointers const& _typeParameters); void registerStateVariables(ContractDefinition const& _contract); From 4b5a036a6ba9b14ebc914819f6699477d2cf13b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 15 Jun 2015 14:43:15 +0200 Subject: [PATCH 031/169] Suppress LLVM compile warnings. --- evmjit/libevmjit/Cache.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/evmjit/libevmjit/Cache.h b/evmjit/libevmjit/Cache.h index 6b8457f4b..1d5927705 100644 --- a/evmjit/libevmjit/Cache.h +++ b/evmjit/libevmjit/Cache.h @@ -3,7 +3,9 @@ #include #include +#include "preprocessor/llvm_includes_start.h" #include +#include "preprocessor/llvm_includes_end.h" namespace llvm { From 6ac83389927b7e869b880dfafdf4f7b1b814f1b1 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 15 Jun 2015 21:17:26 +0800 Subject: [PATCH 032/169] Extra debug notice. --- libethcore/Ethash.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/libethcore/Ethash.cpp b/libethcore/Ethash.cpp index 2c743f33b..f27e8e4db 100644 --- a/libethcore/Ethash.cpp +++ b/libethcore/Ethash.cpp @@ -108,7 +108,10 @@ bool Ethash::verify(BlockInfo const& _header) bool pre = preVerify(_header); #if !ETH_DEBUG if (!pre) + { + cdebug << "Fail on preVerify"; return false; + } #endif auto result = EthashAux::eval(_header); From 239dfc1293e5dd09ce2d9143849231ed972f8e88 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 15 Jun 2015 21:17:35 +0800 Subject: [PATCH 033/169] Switch to warning. --- libethcore/Ethash.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethcore/Ethash.cpp b/libethcore/Ethash.cpp index f27e8e4db..ebf8c5615 100644 --- a/libethcore/Ethash.cpp +++ b/libethcore/Ethash.cpp @@ -109,7 +109,7 @@ bool Ethash::verify(BlockInfo const& _header) #if !ETH_DEBUG if (!pre) { - cdebug << "Fail on preVerify"; + cwarn << "Fail on preVerify"; return false; } #endif From 4fd0d70c471cabe73f4ee269841d53bdff44dd5f Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Mon, 15 Jun 2015 16:14:23 +0200 Subject: [PATCH 034/169] FixedHash::bloom() refactored --- libdevcore/FixedHash.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index 2d1822b2c..ca80d745c 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -158,16 +158,17 @@ public: template inline FixedHash& shiftBloom(FixedHash const& _h) { - return (*this |= _h.template bloom()); + return (*this |= _h.template bloomPart()); } template inline bool containsBloom(FixedHash const& _h) { - return contains(_h.template bloom()); + return contains(_h.template bloomPart()); } - template inline FixedHash bloom() const + template inline FixedHash bloomPart() const { + static_assert((M & (M - 1)) == 0, "M must be power-of-two"); static const unsigned c_bloomBits = M * 8; unsigned mask = c_bloomBits - 1; unsigned bloomBytes = (dev::toLog2(c_bloomBits) + 7) / 8; From 402dc016408ac87fb53118e63f95196a4319efbf Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 15 Jun 2015 16:31:41 +0300 Subject: [PATCH 035/169] Coverage info --- cmake/EthCompilerSettings.cmake | 7 ++++ getcoverage.sh | 33 +++++++++++++++++++ ...reCompiledContractsTransactionFiller.json} | 0 test/libethereum/state.cpp | 4 +-- 4 files changed, 42 insertions(+), 2 deletions(-) create mode 100755 getcoverage.sh rename test/libethereum/StateTestsFiller/{stPrecompiledContractsTransactionFiller.json => stPreCompiledContractsTransactionFiller.json} (100%) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 53535a489..4009b22a6 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -64,6 +64,13 @@ if (PROFILING AND (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_C set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lprofiler") endif () +if (PROFILING AND (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU"))) + set(CMAKE_CXX_FLAGS "-g --coverage ${CMAKE_CXX_FLAGS}") + set(CMAKE_C_FLAGS "-g --coverage ${CMAKE_C_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "--coverage ${CMAKE_SHARED_LINKER_FLAGS} -lprofiler") + set(CMAKE_EXE_LINKER_FLAGS "--coverage ${CMAKE_EXE_LINKER_FLAGS} -lprofiler") +endif () + if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")) option(USE_LD_GOLD "Use GNU gold linker" ON) if (USE_LD_GOLD) diff --git a/getcoverage.sh b/getcoverage.sh new file mode 100755 index 000000000..a04ab78fe --- /dev/null +++ b/getcoverage.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +CPP_ETHEREUM_PATH=$(pwd) + +if [ ! -d "$CPP_ETHEREUM_PATH/build/test" ]; then + echo "You need to compile and build ethereum with cmake -DPROFILING option to the build dir!" + exit; +fi + +if which lcov >/dev/null; then + if which genhtml >/dev/null; then + echo Running testeth... + $($CPP_ETHEREUM_PATH/build/test/testeth) + echo Prepearing coverage info... + else + echo genhtml not found + exit; + fi +else + echo lcov not found + exit; +fi + +OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage" + +TESTETH=$CPP_ETHEREUM_PATH/build/test/CMakeFiles/testeth.dir +lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/coverage.info +genhtml $OUTPUT_DIR/coverage.info --output-directory $OUTPUT_DIR/testeth + +echo "Coverage info should be located at: $CPP_ETHEREUM_PATH/build/test/coverage/testeth" +echo "Opening index..." + +xdg-open $CPP_ETHEREUM_PATH/build/test/coverage/testeth/index.html diff --git a/test/libethereum/StateTestsFiller/stPrecompiledContractsTransactionFiller.json b/test/libethereum/StateTestsFiller/stPreCompiledContractsTransactionFiller.json similarity index 100% rename from test/libethereum/StateTestsFiller/stPrecompiledContractsTransactionFiller.json rename to test/libethereum/StateTestsFiller/stPreCompiledContractsTransactionFiller.json diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index 5eb3c76c3..632e7982b 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -129,9 +129,9 @@ BOOST_AUTO_TEST_CASE(stPreCompiledContracts) dev::test::executeTests("stPreCompiledContracts", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); } -BOOST_AUTO_TEST_CASE(stPrecompiledContractsTransaction) +BOOST_AUTO_TEST_CASE(stPreCompiledContractsTransaction) { - dev::test::executeTests("stPrecompiledContractsTransaction", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); + dev::test::executeTests("stPreCompiledContractsTransaction", "/StateTests",dev::test::getFolder(__FILE__) + "/StateTestsFiller", dev::test::doStateTests); } BOOST_AUTO_TEST_CASE(stLogTests) From 1959b140f9a628ec48fae59f195392465b0415fa Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 15 Jun 2015 18:27:00 +0300 Subject: [PATCH 036/169] Coverage script --- getcoverage.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/getcoverage.sh b/getcoverage.sh index a04ab78fe..4c01bad46 100755 --- a/getcoverage.sh +++ b/getcoverage.sh @@ -7,8 +7,12 @@ if [ ! -d "$CPP_ETHEREUM_PATH/build/test" ]; then exit; fi +OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage" +TESTETH=$CPP_ETHEREUM_PATH/build #/test/CMakeFiles/testeth.dir + if which lcov >/dev/null; then if which genhtml >/dev/null; then + lcov --directory $TESTETH --zerocounters echo Running testeth... $($CPP_ETHEREUM_PATH/build/test/testeth) echo Prepearing coverage info... @@ -21,13 +25,15 @@ else exit; fi -OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage" - -TESTETH=$CPP_ETHEREUM_PATH/build/test/CMakeFiles/testeth.dir -lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/coverage.info -genhtml $OUTPUT_DIR/coverage.info --output-directory $OUTPUT_DIR/testeth +echo Cleaning previous report... +rm -r $OUTPUT_DIR/testeth +rm $OUTPUT_DIR/full_coverage.info +rm $OUTPUT_DIR/testeth_coverage.info +lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/full_coverage.info +lcov --extract $OUTPUT_DIR/full_coverage.info *cpp-ethereum/* --output-file $OUTPUT_DIR/testeth_coverage.info +genhtml $OUTPUT_DIR/testeth_coverage.info --output-directory $OUTPUT_DIR/testeth echo "Coverage info should be located at: $CPP_ETHEREUM_PATH/build/test/coverage/testeth" echo "Opening index..." -xdg-open $CPP_ETHEREUM_PATH/build/test/coverage/testeth/index.html +xdg-open $CPP_ETHEREUM_PATH/build/test/coverage/testeth/index.html & From dba9faa41a0c6a4d77e7bd53797b24a5bd15e728 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Mon, 15 Jun 2015 23:46:54 +0800 Subject: [PATCH 037/169] Don't compile neth. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71d12353c..729f95ed6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -430,9 +430,9 @@ if (TOOLS) endif() -if (NCURSES) - add_subdirectory(neth) -endif () +#if (NCURSES) +# add_subdirectory(neth) +#endif () if (GUI) From 1c2a9cd088d4e072e064a05aece206159137d471 Mon Sep 17 00:00:00 2001 From: arkpar Date: Mon, 15 Jun 2015 19:01:16 +0200 Subject: [PATCH 038/169] fixed syncing stalling issues --- libethereum/EthereumHost.cpp | 38 ++++++++++++++++++++++++------------ libethereum/EthereumPeer.cpp | 1 + 2 files changed, 27 insertions(+), 12 deletions(-) diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index e69bfa684..b10e74f22 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -292,8 +292,8 @@ void EthereumHost::onPeerStatus(EthereumPeer* _peer) else _peer->m_expectedHashes = estimatedHashes; continueSync(_peer); + DEV_INVARIANT_CHECK; } - DEV_INVARIANT_CHECK; } unsigned EthereumHost::estimateHashes() @@ -313,6 +313,7 @@ unsigned EthereumHost::estimateHashes() void EthereumHost::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) { RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; if (_peer->m_syncHashNumber > 0) _peer->m_syncHashNumber += _hashes.size(); @@ -322,7 +323,6 @@ void EthereumHost::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) void EthereumHost::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes, bool _complete) { - DEV_INVARIANT_CHECK; if (_hashes.empty()) { _peer->m_hashSub.doneFetch(); @@ -454,7 +454,8 @@ void EthereumHost::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) unsigned unknown = 0; unsigned got = 0; unsigned repeated = 0; - h256 lastUnknown; + u256 maxDifficulty = 0; + h256 maxUnknown; for (unsigned i = 0; i < itemCount; ++i) { @@ -483,9 +484,17 @@ void EthereumHost::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) break; case ImportResult::UnknownParent: - lastUnknown = h; + { unknown++; + BlockInfo bi; + bi.populateFromHeader(_r[i][0]); + if (bi.difficulty > maxDifficulty) + { + maxDifficulty = bi.difficulty; + maxUnknown = h; + } break; + } default:; } @@ -501,8 +510,10 @@ void EthereumHost::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) if (m_state == SyncState::NewBlocks && unknown > 0) { - _peer->m_latestHash = lastUnknown; - resetSyncTo(lastUnknown); + _peer->m_latestHash = maxUnknown; + _peer->m_totalDifficulty = maxDifficulty; + if (peerShouldGrabChain(_peer)) + resetSyncTo(maxUnknown); } continueSync(_peer); @@ -528,7 +539,7 @@ void EthereumHost::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) { RecursiveGuard l(x_sync); DEV_INVARIANT_CHECK; - if ((isSyncing() || _peer->isConversing()) && m_state != SyncState::NewBlocks) + if ((isSyncing() || _peer->isConversing())) { clog(NetMessageSummary) << "Ignoring new blocks since we're already downloading."; return; @@ -565,11 +576,14 @@ void EthereumHost::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) u256 difficulty = _r[1].toInt(); if (m_syncingTotalDifficulty < difficulty) { - clog(NetMessageSummary) << "Received block with no known parent. Resyncing..."; _peer->m_latestHash = h; _peer->m_totalDifficulty = difficulty; - resetSyncTo(h);; - sync = true; + if (peerShouldGrabChain(_peer)) + { + clog(NetMessageSummary) << "Received block with no known parent. Resyncing..."; + resetSyncTo(h);; + sync = true; + } } } break; @@ -580,7 +594,7 @@ void EthereumHost::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) _peer->m_knownBlocks.insert(h); if (sync) - continueSync(); + continueSync(_peer); } DEV_INVARIANT_CHECK; } @@ -623,6 +637,7 @@ void EthereumHost::onPeerAborting(EthereumPeer* _peer) _peer->setRude(); continueSync(); } + DEV_INVARIANT_CHECK; } void EthereumHost::continueSync() @@ -811,6 +826,5 @@ bool EthereumHost::invariants() const return false; if (needBlocks() && (m_syncingLatestHash || !m_hashes.empty())) return false; - return true; } diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 7a30f1ad9..583932d48 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -100,6 +100,7 @@ void EthereumPeer::requestStatus() { assert(m_asking == Asking::Nothing); setAsking(Asking::State); + m_requireTransactions = true; RLPStream s; bool latest = m_peerCapabilityVersion == host()->protocolVersion(); prep(s, StatusPacket, latest ? 6 : 5) From b6ca0d7856818d4ec43e4a1e21fceb8b5d7a5838 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 15 Jun 2015 20:07:11 +0300 Subject: [PATCH 039/169] Coerage Script --- getcoverage.sh | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/getcoverage.sh b/getcoverage.sh index 4c01bad46..446d584e6 100755 --- a/getcoverage.sh +++ b/getcoverage.sh @@ -2,38 +2,44 @@ CPP_ETHEREUM_PATH=$(pwd) -if [ ! -d "$CPP_ETHEREUM_PATH/build/test" ]; then - echo "You need to compile and build ethereum with cmake -DPROFILING option to the build dir!" - exit; +which $CPP_ETHEREUM_PATH/build/test/testeth >/dev/null 2>&1 +if [ $? != 0 ] +then + echo "You need to compile and build ethereum with cmake -DPROFILING option to the build dir!" + exit; fi OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage" TESTETH=$CPP_ETHEREUM_PATH/build #/test/CMakeFiles/testeth.dir if which lcov >/dev/null; then - if which genhtml >/dev/null; then + if which genhtml >/dev/null; then lcov --directory $TESTETH --zerocounters echo Running testeth... - $($CPP_ETHEREUM_PATH/build/test/testeth) + $($CPP_ETHEREUM_PATH/build/test/testeth --all) + $($CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit --all) + $($CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit --all) echo Prepearing coverage info... - else + else echo genhtml not found exit; - fi + fi else - echo lcov not found - exit; + echo lcov not found + exit; +fi + +if [ -d "$OUTPUT_DIR" ]; then + echo Cleaning previous report... + rm -r $OUTPUT_DIR fi -echo Cleaning previous report... -rm -r $OUTPUT_DIR/testeth -rm $OUTPUT_DIR/full_coverage.info -rm $OUTPUT_DIR/testeth_coverage.info +mkdir $OUTPUT_DIR lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/full_coverage.info lcov --extract $OUTPUT_DIR/full_coverage.info *cpp-ethereum/* --output-file $OUTPUT_DIR/testeth_coverage.info genhtml $OUTPUT_DIR/testeth_coverage.info --output-directory $OUTPUT_DIR/testeth -echo "Coverage info should be located at: $CPP_ETHEREUM_PATH/build/test/coverage/testeth" +echo "Coverage info should be located at: $OUTPUT_DIR/testeth" echo "Opening index..." -xdg-open $CPP_ETHEREUM_PATH/build/test/coverage/testeth/index.html & +xdg-open $OUTPUT_DIR/testeth/index.html & From e0c101ca3b0a850221c8f2786647c3f259899829 Mon Sep 17 00:00:00 2001 From: chriseth Date: Mon, 15 Jun 2015 12:10:41 +0200 Subject: [PATCH 040/169] Copying between memory and memory. Also fixed some encoding and padding issues with older copying code. --- libsolidity/Compiler.cpp | 36 +- libsolidity/CompilerUtils.cpp | 383 +++++++++++++++++- libsolidity/CompilerUtils.h | 32 ++ libsolidity/ExpressionCompiler.cpp | 341 +++------------- libsolidity/ExpressionCompiler.h | 35 +- test/libsolidity/Assembly.cpp | 2 +- test/libsolidity/SolidityEndToEndTest.cpp | 27 +- test/libsolidity/solidityExecutionFramework.h | 6 +- 8 files changed, 521 insertions(+), 341 deletions(-) diff --git a/libsolidity/Compiler.cpp b/libsolidity/Compiler.cpp index b55ae7d36..82e98dfff 100644 --- a/libsolidity/Compiler.cpp +++ b/libsolidity/Compiler.cpp @@ -30,9 +30,8 @@ #include using namespace std; - -namespace dev { -namespace solidity { +using namespace dev; +using namespace dev::solidity; /** * Simple helper class to ensure that the stack height is the same at certain places in the code. @@ -301,24 +300,18 @@ void Compiler::appendCalldataUnpacker( void Compiler::appendReturnValuePacker(TypePointers const& _typeParameters) { - unsigned dataOffset = 0; - unsigned stackDepth = 0; - for (TypePointer const& type: _typeParameters) - stackDepth += type->getSizeOnStack(); - - for (TypePointer const& type: _typeParameters) - { - CompilerUtils(m_context).copyToStackTop(stackDepth, type->getSizeOnStack()); - ExpressionCompiler(m_context, m_optimize).appendTypeConversion(*type, *type, true); - bool const c_padToWords = true; - dataOffset += CompilerUtils(m_context).storeInMemory(dataOffset, *type, c_padToWords); - stackDepth -= type->getSizeOnStack(); - } - // note that the stack is not cleaned up here - if (dataOffset == 0) + CompilerUtils utils(m_context); + if (_typeParameters.empty()) m_context << eth::Instruction::STOP; else - m_context << u256(dataOffset) << u256(0) << eth::Instruction::RETURN; + { + utils.fetchFreeMemoryPointer(); + //@todo optimization: if we return a single memory array, there should be enough space before + // its data to add the needed parts and we avoid a memory copy. + utils.encodeToMemory(_typeParameters, _typeParameters); + utils.toSizeAfterFreeMemoryPointer(); + m_context << eth::Instruction::RETURN; + } } void Compiler::registerStateVariables(ContractDefinition const& _contract) @@ -634,8 +627,5 @@ void Compiler::compileExpression(Expression const& _expression, TypePointer cons ExpressionCompiler expressionCompiler(m_context, m_optimize); expressionCompiler.compile(_expression); if (_targetType) - expressionCompiler.appendTypeConversion(*_expression.getType(), *_targetType); -} - -} + CompilerUtils(m_context).convertType(*_expression.getType(), *_targetType); } diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index 7a96db928..6110fdf71 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -23,6 +23,8 @@ #include #include #include +#include +#include using namespace std; @@ -33,6 +35,7 @@ namespace solidity const unsigned CompilerUtils::dataStartOffset = 4; const size_t CompilerUtils::freeMemoryPointer = 64; +const unsigned CompilerUtils::identityContractAddress = 4; void CompilerUtils::initialiseFreeMemoryPointer() { @@ -83,8 +86,7 @@ void CompilerUtils::loadFromMemoryDynamic( if (_keepUpdatedMemoryOffset) { // update memory counter - for (unsigned i = 0; i < _type.getSizeOnStack(); ++i) - m_context << eth::swapInstruction(1 + i); + moveToStackTop(_type.getSizeOnStack()); m_context << u256(numBytes) << eth::Instruction::ADD; } } @@ -114,9 +116,74 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound << eth::Instruction::DUP3 << eth::Instruction::ADD << eth::Instruction::SWAP2 << eth::Instruction::POP << eth::Instruction::POP; } + else if (type.location() == ReferenceType::Location::Memory) + { + // memcpy using the built-in contract + ArrayUtils(m_context).retrieveLength(type); + if (type.isDynamicallySized()) + { + // change pointer to data part + m_context << eth::Instruction::SWAP1 << u256(32) << eth::Instruction::ADD; + m_context << eth::Instruction::SWAP1; + } + // stack: + // stack for call: outsize target size source value contract gas + m_context << eth::Instruction::DUP1 << eth::Instruction::DUP4; + m_context << eth::Instruction::DUP2 << eth::Instruction::DUP5; + m_context << u256(0) << u256(identityContractAddress); + //@TODO do not use ::CALL if less than 32 bytes? + //@todo in production, we should not have to pair c_callNewAccountGas. + m_context << u256(eth::c_callGas + 10 + eth::c_callNewAccountGas) << eth::Instruction::GAS; + m_context << eth::Instruction::SUB << eth::Instruction::CALL; + m_context << eth::Instruction::POP; // ignore return value + + m_context << eth::Instruction::SWAP1 << eth::Instruction::POP; + // stack: + + if (_padToWordBoundaries && (type.isDynamicallySized() || (type.getLength()) % 32 != 0)) + { + // stack: + m_context << eth::Instruction::SWAP1 << eth::Instruction::DUP2 << eth::Instruction::ADD; + // stack: + m_context << eth::Instruction::SWAP1 << u256(31) << eth::Instruction::AND; + // stack: + eth::AssemblyItem skip = m_context.newTag(); + if (type.isDynamicallySized()) + { + m_context << eth::Instruction::DUP1 << eth::Instruction::ISZERO; + m_context.appendConditionalJumpTo(skip); + } + // round off, load from there. + // stack + m_context << eth::Instruction::DUP1 << eth::Instruction::DUP3; + m_context << eth::Instruction::SUB; + // stack: target+length remainder + m_context << eth::Instruction::DUP1 << eth::Instruction::MLOAD; + // Now we AND it with ~(2**(8 * (32 - remainder)) - 1) + m_context << u256(1); + m_context << eth::Instruction::DUP4 << u256(32) << eth::Instruction::SUB; + // stack: ... 1 <32 - remainder> + m_context << u256(0x100) << eth::Instruction::EXP << eth::Instruction::SUB; + m_context << eth::Instruction::NOT << eth::Instruction::AND; + // stack: target+length remainder target+length-remainder + m_context << eth::Instruction::DUP2 << eth::Instruction::MSTORE; + // stack: target+length remainder target+length-remainder + m_context << u256(32) << eth::Instruction::ADD; + // stack: target+length remainder + m_context << eth::Instruction::SWAP2 << eth::Instruction::POP; + + if (type.isDynamicallySized()) + m_context << skip.tag(); + // stack + m_context << eth::Instruction::POP; + } + else + // stack: + m_context << eth::Instruction::ADD; + } else { - solAssert(type.location() == ReferenceType::Location::Storage, "Memory arrays not yet implemented."); + solAssert(type.location() == ReferenceType::Location::Storage, ""); m_context << eth::Instruction::POP; // remove offset, arrays always start new slot m_context << eth::Instruction::DUP1 << eth::Instruction::SLOAD; // stack here: memory_offset storage_offset length_bytes @@ -144,6 +211,17 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound // check for loop condition << eth::Instruction::DUP1 << eth::Instruction::DUP4 << eth::Instruction::GT; m_context.appendConditionalJumpTo(loopStart); + // stack here: memory_end_offset storage_data_offset memory_offset + if (_padToWordBoundaries) + { + // memory_end_offset - start is the actual length (we want to compute the ceil of). + // memory_offset - start is its next multiple of 32, but it might be off by 32. + // so we compute: memory_end_offset += (memory_offset - memory_end_offest) & 31 + m_context << eth::Instruction::DUP3 << eth::Instruction::SWAP1 << eth::Instruction::SUB; + m_context << u256(31) << eth::Instruction::AND; + m_context << eth::Instruction::DUP3 << eth::Instruction::ADD; + m_context << eth::Instruction::SWAP2; + } m_context << loopEnd << eth::Instruction::POP << eth::Instruction::POP; } } @@ -159,6 +237,288 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound } } +void CompilerUtils::encodeToMemory( + TypePointers const& _givenTypes, + TypePointers const& _targetTypes, + bool _padToWordBoundaries, + bool _copyDynamicDataInPlace +) +{ + // stack: ... + TypePointers targetTypes = _targetTypes.empty() ? _givenTypes : _targetTypes; + solAssert(targetTypes.size() == _givenTypes.size(), ""); + for (TypePointer& t: targetTypes) + t = t->mobileType()->externalType(); + + // Stack during operation: + // ... ... + // The values dyn_head_i are added during the first loop and they point to the head part + // of the ith dynamic parameter, which is filled once the dynamic parts are processed. + + // store memory start pointer + m_context << eth::Instruction::DUP1; + + unsigned argSize = CompilerUtils::getSizeOnStack(_givenTypes); + unsigned stackPos = 0; // advances through the argument values + unsigned dynPointers = 0; // number of dynamic head pointers on the stack + for (size_t i = 0; i < _givenTypes.size(); ++i) + { + TypePointer targetType = targetTypes[i]; + solAssert(!!targetType, "Externalable type expected."); + if (targetType->isDynamicallySized() && !_copyDynamicDataInPlace) + { + // leave end_of_mem as dyn head pointer + m_context << eth::Instruction::DUP1 << u256(32) << eth::Instruction::ADD; + dynPointers++; + } + else + { + copyToStackTop(argSize - stackPos + dynPointers + 2, _givenTypes[i]->getSizeOnStack()); + if (targetType->isValueType()) + convertType(*_givenTypes[i], *targetType, true); + solAssert(!!targetType, "Externalable type expected."); + storeInMemoryDynamic(*targetType, _padToWordBoundaries); + } + stackPos += _givenTypes[i]->getSizeOnStack(); + } + + // now copy the dynamic part + // Stack: ... ... + stackPos = 0; + unsigned thisDynPointer = 0; + for (size_t i = 0; i < _givenTypes.size(); ++i) + { + TypePointer targetType = targetTypes[i]; + solAssert(!!targetType, "Externalable type expected."); + if (targetType->isDynamicallySized() && !_copyDynamicDataInPlace) + { + solAssert(_givenTypes[i]->getCategory() == Type::Category::Array, "Unknown dynamic type."); + auto const& arrayType = dynamic_cast(*_givenTypes[i]); + // copy tail pointer (=mem_end - mem_start) to memory + m_context << eth::dupInstruction(2 + dynPointers) << eth::Instruction::DUP2; + m_context << eth::Instruction::SUB; + m_context << eth::dupInstruction(2 + dynPointers - thisDynPointer); + m_context << eth::Instruction::MSTORE; + // now copy the array + copyToStackTop(argSize - stackPos + dynPointers + 2, arrayType.getSizeOnStack()); + // stack: ... + // copy length to memory + m_context << eth::dupInstruction(1 + arrayType.getSizeOnStack()); + if (arrayType.location() == ReferenceType::Location::CallData) + m_context << eth::Instruction::DUP2; // length is on stack + else if (arrayType.location() == ReferenceType::Location::Storage) + m_context << eth::Instruction::DUP3 << eth::Instruction::SLOAD; + else + { + solAssert(arrayType.location() == ReferenceType::Location::Memory, ""); + m_context << eth::Instruction::DUP2 << eth::Instruction::MLOAD; + } + // stack: ... + storeInMemoryDynamic(IntegerType(256), true); + // stack: ... + // copy the new memory pointer + m_context << eth::swapInstruction(arrayType.getSizeOnStack() + 1) << eth::Instruction::POP; + // stack: ... + // copy data part + storeInMemoryDynamic(arrayType, true); + // stack: ... + + thisDynPointer++; + } + stackPos += _givenTypes[i]->getSizeOnStack(); + } + + // remove unneeded stack elements (and retain memory pointer) + m_context << eth::swapInstruction(argSize + dynPointers + 1); + popStackSlots(argSize + dynPointers + 1); +} + +void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetType, bool _cleanupNeeded) +{ + // For a type extension, we need to remove all higher-order bits that we might have ignored in + // previous operations. + // @todo: store in the AST whether the operand might have "dirty" higher order bits + + if (_typeOnStack == _targetType && !_cleanupNeeded) + return; + Type::Category stackTypeCategory = _typeOnStack.getCategory(); + Type::Category targetTypeCategory = _targetType.getCategory(); + + switch (stackTypeCategory) + { + case Type::Category::FixedBytes: + { + FixedBytesType const& typeOnStack = dynamic_cast(_typeOnStack); + if (targetTypeCategory == Type::Category::Integer) + { + // conversion from bytes to integer. no need to clean the high bit + // only to shift right because of opposite alignment + IntegerType const& targetIntegerType = dynamic_cast(_targetType); + m_context << (u256(1) << (256 - typeOnStack.getNumBytes() * 8)) << eth::Instruction::SWAP1 << eth::Instruction::DIV; + if (targetIntegerType.getNumBits() < typeOnStack.getNumBytes() * 8) + convertType(IntegerType(typeOnStack.getNumBytes() * 8), _targetType, _cleanupNeeded); + } + else + { + // clear lower-order bytes for conversion to shorter bytes - we always clean + solAssert(targetTypeCategory == Type::Category::FixedBytes, "Invalid type conversion requested."); + FixedBytesType const& targetType = dynamic_cast(_targetType); + if (targetType.getNumBytes() < typeOnStack.getNumBytes()) + { + if (targetType.getNumBytes() == 0) + m_context << eth::Instruction::DUP1 << eth::Instruction::XOR; + else + m_context << (u256(1) << (256 - targetType.getNumBytes() * 8)) + << eth::Instruction::DUP1 << eth::Instruction::SWAP2 + << eth::Instruction::DIV << eth::Instruction::MUL; + } + } + } + break; + case Type::Category::Enum: + solAssert(targetTypeCategory == Type::Category::Integer || targetTypeCategory == Type::Category::Enum, ""); + break; + case Type::Category::Integer: + case Type::Category::Contract: + case Type::Category::IntegerConstant: + if (targetTypeCategory == Type::Category::FixedBytes) + { + solAssert(stackTypeCategory == Type::Category::Integer || stackTypeCategory == Type::Category::IntegerConstant, + "Invalid conversion to FixedBytesType requested."); + // conversion from bytes to string. no need to clean the high bit + // only to shift left because of opposite alignment + FixedBytesType const& targetBytesType = dynamic_cast(_targetType); + if (auto typeOnStack = dynamic_cast(&_typeOnStack)) + if (targetBytesType.getNumBytes() * 8 > typeOnStack->getNumBits()) + cleanHigherOrderBits(*typeOnStack); + m_context << (u256(1) << (256 - targetBytesType.getNumBytes() * 8)) << eth::Instruction::MUL; + } + else if (targetTypeCategory == Type::Category::Enum) + // just clean + convertType(_typeOnStack, *_typeOnStack.mobileType(), true); + else + { + solAssert(targetTypeCategory == Type::Category::Integer || targetTypeCategory == Type::Category::Contract, ""); + IntegerType addressType(0, IntegerType::Modifier::Address); + IntegerType const& targetType = targetTypeCategory == Type::Category::Integer + ? dynamic_cast(_targetType) : addressType; + if (stackTypeCategory == Type::Category::IntegerConstant) + { + IntegerConstantType const& constType = dynamic_cast(_typeOnStack); + // We know that the stack is clean, we only have to clean for a narrowing conversion + // where cleanup is forced. + if (targetType.getNumBits() < constType.getIntegerType()->getNumBits() && _cleanupNeeded) + cleanHigherOrderBits(targetType); + } + else + { + IntegerType const& typeOnStack = stackTypeCategory == Type::Category::Integer + ? dynamic_cast(_typeOnStack) : addressType; + // Widening: clean up according to source type width + // Non-widening and force: clean up according to target type bits + if (targetType.getNumBits() > typeOnStack.getNumBits()) + cleanHigherOrderBits(typeOnStack); + else if (_cleanupNeeded) + cleanHigherOrderBits(targetType); + } + } + break; + case Type::Category::Array: + { + solAssert(targetTypeCategory == stackTypeCategory, ""); + ArrayType const& typeOnStack = dynamic_cast(_typeOnStack); + ArrayType const& targetType = dynamic_cast(_targetType); + switch (targetType.location()) + { + case ReferenceType::Location::Storage: + // Other cases are done explicitly in LValue::storeValue, and only possible by assignment. + solAssert( + targetType.isPointer() && + typeOnStack.location() == ReferenceType::Location::Storage, + "Invalid conversion to storage type." + ); + break; + case ReferenceType::Location::Memory: + { + // Copy the array to a free position in memory, unless it is already in memory. + if (typeOnStack.location() != ReferenceType::Location::Memory) + { + // stack: (variably sized) + unsigned stackSize = typeOnStack.getSizeOnStack(); + fetchFreeMemoryPointer(); + moveIntoStack(stackSize); + // stack: (variably sized) + if (targetType.isDynamicallySized()) + { + bool fromStorage = (typeOnStack.location() == ReferenceType::Location::Storage); + // store length + if (fromStorage) + { + stackSize--; + // remove storage offset, as requested by ArrayUtils::retrieveLength + m_context << eth::Instruction::POP; + } + ArrayUtils(m_context).retrieveLength(typeOnStack); + // Stack: + m_context << eth::dupInstruction(2 + stackSize) << eth::Instruction::MSTORE; + m_context << eth::dupInstruction(1 + stackSize) << u256(0x20); + m_context << eth::Instruction::ADD; + moveIntoStack(stackSize); + if (fromStorage) + { + m_context << u256(0); + stackSize++; + } + } + else + { + m_context << eth::dupInstruction(1 + stackSize); + moveIntoStack(stackSize); + } + // Stack: + // Store data part. + storeInMemoryDynamic(typeOnStack); + // Stack + storeFreeMemoryPointer(); + } + else if (typeOnStack.location() == ReferenceType::Location::CallData) + { + // Stack: + //@todo + solAssert(false, "Not yet implemented."); + } + // nothing to do for memory to memory + break; + } + default: + solAssert(false, "Invalid type conversion requested."); + } + break; + } + case Type::Category::Struct: + { + //@todo we can probably use some of the code for arrays here. + solAssert(targetTypeCategory == stackTypeCategory, ""); + auto& targetType = dynamic_cast(_targetType); + auto& stackType = dynamic_cast(_typeOnStack); + solAssert( + targetType.location() == ReferenceType::Location::Storage && + stackType.location() == ReferenceType::Location::Storage, + "Non-storage structs not yet implemented." + ); + solAssert( + targetType.isPointer(), + "Type conversion to non-pointer struct requested." + ); + break; + } + default: + // All other types should not be convertible to non-equal types. + solAssert(_typeOnStack == _targetType, "Invalid type conversion requested."); + break; + } +} + void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) { unsigned const stackPosition = m_context.baseToCurrentStackOffset(m_context.getBaseStackOffsetOfVariable(_variable)); @@ -189,6 +549,13 @@ void CompilerUtils::moveToStackTop(unsigned _stackDepth) m_context << eth::swapInstruction(1 + i); } +void CompilerUtils::moveIntoStack(unsigned _stackDepth) +{ + solAssert(_stackDepth <= 16, "Stack too deep, try removing local variables."); + for (unsigned i = _stackDepth; i > 0; --i) + m_context << eth::swapInstruction(i); +} + void CompilerUtils::popStackElement(Type const& _type) { popStackSlots(_type.getSizeOnStack()); @@ -238,6 +605,16 @@ unsigned CompilerUtils::loadFromMemoryHelper(Type const& _type, bool _fromCallda return numBytes; } +void CompilerUtils::cleanHigherOrderBits(IntegerType const& _typeOnStack) +{ + if (_typeOnStack.getNumBits() == 256) + return; + else if (_typeOnStack.isSigned()) + m_context << u256(_typeOnStack.getNumBits() / 8 - 1) << eth::Instruction::SIGNEXTEND; + else + m_context << ((u256(1) << _typeOnStack.getNumBits()) - 1) << eth::Instruction::AND; +} + unsigned CompilerUtils::prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) const { unsigned numBytes = _type.getCalldataEncodedSize(_padToWordBoundaries); diff --git a/libsolidity/CompilerUtils.h b/libsolidity/CompilerUtils.h index 27c46ba11..32dc93a2c 100644 --- a/libsolidity/CompilerUtils.h +++ b/libsolidity/CompilerUtils.h @@ -81,6 +81,30 @@ public: /// Stack post: (memory_offset+length) void storeInMemoryDynamic(Type const& _type, bool _padToWordBoundaries = true); + /// Copies values (of types @a _givenTypes) given on the stack to a location in memory given + /// at the stack top, encoding them according to the ABI as the given types @a _targetTypes. + /// Removes the values from the stack and leaves the updated memory pointer. + /// Stack pre: ... + /// Stack post: + /// Does not touch the memory-free pointer. + /// @param _padToWordBoundaries if false, all values are concatenated without padding. + /// @param _copyDynamicDataInPlace if true, dynamic types is stored (without length) + /// together with fixed-length data. + /// @note the locations of target reference types are ignored, because it will always be + /// memory. + void encodeToMemory( + TypePointers const& _givenTypes = {}, + TypePointers const& _targetTypes = {}, + bool _padToWordBoundaries = true, + bool _copyDynamicDataInPlace = false + ); + + /// Appends code for an implicit or explicit type conversion. For now this comprises only erasing + /// higher-order bits (@see appendHighBitCleanup) when widening integer. + /// If @a _cleanupNeeded, high order bits cleanup is also done if no type conversion would be + /// necessary. + void convertType(Type const& _typeOnStack, Type const& _targetType, bool _cleanupNeeded = false); + /// Moves the value that is at the top of the stack to a stack variable. void moveToStackVariable(VariableDeclaration const& _variable); /// Copies an item that occupies @a _itemSize stack slots from a stack depth of @a _stackDepth @@ -88,6 +112,8 @@ public: void copyToStackTop(unsigned _stackDepth, unsigned _itemSize); /// Moves a single stack element (with _stackDepth items on top of it) to the top of the stack. void moveToStackTop(unsigned _stackDepth); + /// Moves a single stack element past @a _stackDepth other stack elements + void moveIntoStack(unsigned _stackDepth); /// Removes the current value from the top of the stack. void popStackElement(Type const& _type); /// Removes element from the top of the stack _amount times. @@ -110,6 +136,12 @@ public: static const size_t freeMemoryPointer; private: + /// Address of the precompiled identity contract. + static const unsigned identityContractAddress; + + //// Appends code that cleans higher-order bits for integer types. + void cleanHigherOrderBits(IntegerType const& _typeOnStack); + /// Prepares the given type for storing in memory by shifting it if necessary. unsigned prepareMemoryStore(Type const& _type, bool _padToWordBoundaries) const; /// Loads type from memory assuming memory offset is on stack top. diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index 811ee60ec..d5ffd35b4 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -51,7 +51,7 @@ void ExpressionCompiler::appendStateVariableInitialization(VariableDeclaration c solAssert(!!_varDecl.getValue()->getType(), "Type information not available."); CompilerContext::LocationSetter locationSetter(m_context, _varDecl); _varDecl.getValue()->accept(*this); - appendTypeConversion(*_varDecl.getValue()->getType(), *_varDecl.getType(), true); + utils().convertType(*_varDecl.getValue()->getType(), *_varDecl.getType(), true); StorageItem(m_context, _varDecl).storeValue(*_varDecl.getType(), _varDecl.getLocation(), true); } @@ -77,10 +77,10 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& // pop offset m_context << eth::Instruction::POP; // move storage offset to memory. - CompilerUtils(m_context).storeInMemory(32); + utils().storeInMemory(32); // move key to memory. - CompilerUtils(m_context).copyToStackTop(paramTypes.size() - i, 1); - CompilerUtils(m_context).storeInMemory(0); + utils().copyToStackTop(paramTypes.size() - i, 1); + utils().storeInMemory(0); m_context << u256(64) << u256(0) << eth::Instruction::SHA3; // push offset m_context << u256(0); @@ -90,7 +90,7 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& { // pop offset m_context << eth::Instruction::POP; - CompilerUtils(m_context).copyToStackTop(paramTypes.size() - i + 1, 1); + utils().copyToStackTop(paramTypes.size() - i + 1, 1); ArrayUtils(m_context).accessIndex(*arrayType); returnType = arrayType->getBaseType(); } @@ -105,7 +105,7 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& m_context << eth::swapInstruction(paramTypes.size()); m_context << eth::Instruction::POP; m_context << eth::swapInstruction(paramTypes.size()); - CompilerUtils(m_context).popStackSlots(paramTypes.size() - 1); + utils().popStackSlots(paramTypes.size() - 1); } unsigned retSizeOnStack = 0; solAssert(accessorType.getReturnParameterTypes().size() >= 1, ""); @@ -142,128 +142,14 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& m_context.appendJump(eth::AssemblyItem::JumpType::OutOfFunction); } -void ExpressionCompiler::appendTypeConversion(Type const& _typeOnStack, Type const& _targetType, bool _cleanupNeeded) -{ - // For a type extension, we need to remove all higher-order bits that we might have ignored in - // previous operations. - // @todo: store in the AST whether the operand might have "dirty" higher order bits - - if (_typeOnStack == _targetType && !_cleanupNeeded) - return; - Type::Category stackTypeCategory = _typeOnStack.getCategory(); - Type::Category targetTypeCategory = _targetType.getCategory(); - - switch (stackTypeCategory) - { - case Type::Category::FixedBytes: - { - FixedBytesType const& typeOnStack = dynamic_cast(_typeOnStack); - if (targetTypeCategory == Type::Category::Integer) - { - // conversion from bytes to integer. no need to clean the high bit - // only to shift right because of opposite alignment - IntegerType const& targetIntegerType = dynamic_cast(_targetType); - m_context << (u256(1) << (256 - typeOnStack.getNumBytes() * 8)) << eth::Instruction::SWAP1 << eth::Instruction::DIV; - if (targetIntegerType.getNumBits() < typeOnStack.getNumBytes() * 8) - appendTypeConversion(IntegerType(typeOnStack.getNumBytes() * 8), _targetType, _cleanupNeeded); - } - else - { - // clear lower-order bytes for conversion to shorter bytes - we always clean - solAssert(targetTypeCategory == Type::Category::FixedBytes, "Invalid type conversion requested."); - FixedBytesType const& targetType = dynamic_cast(_targetType); - if (targetType.getNumBytes() < typeOnStack.getNumBytes()) - { - if (targetType.getNumBytes() == 0) - m_context << eth::Instruction::DUP1 << eth::Instruction::XOR; - else - m_context << (u256(1) << (256 - targetType.getNumBytes() * 8)) - << eth::Instruction::DUP1 << eth::Instruction::SWAP2 - << eth::Instruction::DIV << eth::Instruction::MUL; - } - } - } - break; - case Type::Category::Enum: - solAssert(targetTypeCategory == Type::Category::Integer || targetTypeCategory == Type::Category::Enum, ""); - break; - case Type::Category::Integer: - case Type::Category::Contract: - case Type::Category::IntegerConstant: - if (targetTypeCategory == Type::Category::FixedBytes) - { - solAssert(stackTypeCategory == Type::Category::Integer || stackTypeCategory == Type::Category::IntegerConstant, - "Invalid conversion to FixedBytesType requested."); - // conversion from bytes to string. no need to clean the high bit - // only to shift left because of opposite alignment - FixedBytesType const& targetBytesType = dynamic_cast(_targetType); - if (auto typeOnStack = dynamic_cast(&_typeOnStack)) - if (targetBytesType.getNumBytes() * 8 > typeOnStack->getNumBits()) - appendHighBitsCleanup(*typeOnStack); - m_context << (u256(1) << (256 - targetBytesType.getNumBytes() * 8)) << eth::Instruction::MUL; - } - else if (targetTypeCategory == Type::Category::Enum) - // just clean - appendTypeConversion(_typeOnStack, *_typeOnStack.mobileType(), true); - else - { - solAssert(targetTypeCategory == Type::Category::Integer || targetTypeCategory == Type::Category::Contract, ""); - IntegerType addressType(0, IntegerType::Modifier::Address); - IntegerType const& targetType = targetTypeCategory == Type::Category::Integer - ? dynamic_cast(_targetType) : addressType; - if (stackTypeCategory == Type::Category::IntegerConstant) - { - IntegerConstantType const& constType = dynamic_cast(_typeOnStack); - // We know that the stack is clean, we only have to clean for a narrowing conversion - // where cleanup is forced. - if (targetType.getNumBits() < constType.getIntegerType()->getNumBits() && _cleanupNeeded) - appendHighBitsCleanup(targetType); - } - else - { - IntegerType const& typeOnStack = stackTypeCategory == Type::Category::Integer - ? dynamic_cast(_typeOnStack) : addressType; - // Widening: clean up according to source type width - // Non-widening and force: clean up according to target type bits - if (targetType.getNumBits() > typeOnStack.getNumBits()) - appendHighBitsCleanup(typeOnStack); - else if (_cleanupNeeded) - appendHighBitsCleanup(targetType); - } - } - break; - case Type::Category::Array: - //@TODO - break; - case Type::Category::Struct: - { - solAssert(targetTypeCategory == stackTypeCategory, ""); - auto& targetType = dynamic_cast(_targetType); - auto& stackType = dynamic_cast(_typeOnStack); - solAssert( - targetType.location() == ReferenceType::Location::Storage && - stackType.location() == ReferenceType::Location::Storage, - "Non-storage structs not yet implemented." - ); - solAssert( - targetType.isPointer(), - "Type conversion to non-pointer struct requested." - ); - break; - } - default: - // All other types should not be convertible to non-equal types. - solAssert(_typeOnStack == _targetType, "Invalid type conversion requested."); - break; - } -} - bool ExpressionCompiler::visit(Assignment const& _assignment) { CompilerContext::LocationSetter locationSetter(m_context, _assignment); _assignment.getRightHandSide().accept(*this); if (_assignment.getType()->isValueType()) - appendTypeConversion(*_assignment.getRightHandSide().getType(), *_assignment.getType()); + utils().convertType(*_assignment.getRightHandSide().getType(), *_assignment.getType()); + // We need this conversion mostly in the case of compound assignments. For non-value types + // the conversion is done in LValue::storeValue. _assignment.getLeftHandSide().accept(*this); solAssert(!!m_currentLValue, "LValue not retrieved."); @@ -275,8 +161,8 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) unsigned itemSize = _assignment.getType()->getSizeOnStack(); if (lvalueSize > 0) { - CompilerUtils(m_context).copyToStackTop(lvalueSize + itemSize, itemSize); - CompilerUtils(m_context).copyToStackTop(itemSize + lvalueSize, lvalueSize); + utils().copyToStackTop(lvalueSize + itemSize, itemSize); + utils().copyToStackTop(itemSize + lvalueSize, lvalueSize); // value lvalue_ref value lvalue_ref } m_currentLValue->retrieveValue(_assignment.getLocation(), true); @@ -391,16 +277,16 @@ bool ExpressionCompiler::visit(BinaryOperation const& _binaryOperation) if (swap) { leftExpression.accept(*this); - appendTypeConversion(*leftExpression.getType(), commonType, cleanupNeeded); + utils().convertType(*leftExpression.getType(), commonType, cleanupNeeded); rightExpression.accept(*this); - appendTypeConversion(*rightExpression.getType(), commonType, cleanupNeeded); + utils().convertType(*rightExpression.getType(), commonType, cleanupNeeded); } else { rightExpression.accept(*this); - appendTypeConversion(*rightExpression.getType(), commonType, cleanupNeeded); + utils().convertType(*rightExpression.getType(), commonType, cleanupNeeded); leftExpression.accept(*this); - appendTypeConversion(*leftExpression.getType(), commonType, cleanupNeeded); + utils().convertType(*leftExpression.getType(), commonType, cleanupNeeded); } if (Token::isCompareOp(c_op)) appendCompareOperatorCode(c_op, commonType); @@ -423,7 +309,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) solAssert(_functionCall.getNames().empty(), ""); Expression const& firstArgument = *_functionCall.getArguments().front(); firstArgument.accept(*this); - appendTypeConversion(*firstArgument.getType(), *_functionCall.getType()); + utils().convertType(*firstArgument.getType(), *_functionCall.getType()); } else { @@ -461,7 +347,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) for (unsigned i = 0; i < arguments.size(); ++i) { arguments[i]->accept(*this); - appendTypeConversion(*arguments[i]->getType(), *function.getParameterTypes()[i]); + utils().convertType(*arguments[i]->getType(), *function.getParameterTypes()[i]); } _functionCall.getExpression().accept(*this); @@ -475,7 +361,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) // @todo for now, the return value of a function is its first return value, so remove // all others for (unsigned i = 1; i < function.getReturnParameterTypes().size(); ++i) - CompilerUtils(m_context).popStackElement(*function.getReturnParameterTypes()[i]); + utils().popStackElement(*function.getReturnParameterTypes()[i]); break; } case Location::External: @@ -500,7 +386,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) *function.getReturnParameterTypes().front()).getContractDefinition(); // copy the contract's code into memory bytes const& bytecode = m_context.getCompiledContract(contract); - CompilerUtils(m_context).fetchFreeMemoryPointer(); + utils().fetchFreeMemoryPointer(); m_context << u256(bytecode.size()) << eth::Instruction::DUP1; //@todo could be done by actually appending the Assembly, but then we probably need to compile // multiple times. Will revisit once external fuctions are inlined. @@ -508,10 +394,10 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) m_context << eth::Instruction::DUP4 << eth::Instruction::CODECOPY; m_context << eth::Instruction::ADD; - encodeToMemory(argumentTypes, function.getParameterTypes()); + utils().encodeToMemory(argumentTypes, function.getParameterTypes()); // now on stack: memory_end_ptr // need: size, offset, endowment - CompilerUtils(m_context).toSizeAfterFreeMemoryPointer(); + utils().toSizeAfterFreeMemoryPointer(); if (function.valueSet()) m_context << eth::dupInstruction(3); else @@ -527,7 +413,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) _functionCall.getExpression().accept(*this); arguments.front()->accept(*this); - appendTypeConversion(*arguments.front()->getType(), IntegerType(256), true); + utils().convertType(*arguments.front()->getType(), IntegerType(256), true); // Note that function is not the original function, but the ".gas" function. // Its values of gasSet and valueSet is equal to the original function's though. unsigned stackDepth = (function.gasSet() ? 1 : 0) + (function.valueSet() ? 1 : 0); @@ -550,7 +436,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) _functionCall.getExpression().accept(*this); m_context << u256(0); // do not send gas (there still is the stipend) arguments.front()->accept(*this); - appendTypeConversion(*arguments.front()->getType(), + utils().convertType(*arguments.front()->getType(), *function.getParameterTypes().front(), true); appendExternalFunctionCall( FunctionType( @@ -568,7 +454,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) break; case Location::Suicide: arguments.front()->accept(*this); - appendTypeConversion(*arguments.front()->getType(), *function.getParameterTypes().front(), true); + utils().convertType(*arguments.front()->getType(), *function.getParameterTypes().front(), true); m_context << eth::Instruction::SUICIDE; break; case Location::SHA3: @@ -579,9 +465,9 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) arg->accept(*this); argumentTypes.push_back(arg->getType()); } - CompilerUtils(m_context).fetchFreeMemoryPointer(); - encodeToMemory(argumentTypes, TypePointers(), function.padArguments(), true); - CompilerUtils(m_context).toSizeAfterFreeMemoryPointer(); + utils().fetchFreeMemoryPointer(); + utils().encodeToMemory(argumentTypes, TypePointers(), function.padArguments(), true); + utils().toSizeAfterFreeMemoryPointer(); m_context << eth::Instruction::SHA3; break; } @@ -595,16 +481,16 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) for (unsigned arg = logNumber; arg > 0; --arg) { arguments[arg]->accept(*this); - appendTypeConversion(*arguments[arg]->getType(), *function.getParameterTypes()[arg], true); + utils().convertType(*arguments[arg]->getType(), *function.getParameterTypes()[arg], true); } arguments.front()->accept(*this); - CompilerUtils(m_context).fetchFreeMemoryPointer(); - encodeToMemory( + utils().fetchFreeMemoryPointer(); + utils().encodeToMemory( {arguments.front()->getType()}, {function.getParameterTypes().front()}, false, true); - CompilerUtils(m_context).toSizeAfterFreeMemoryPointer(); + utils().toSizeAfterFreeMemoryPointer(); m_context << eth::logInstruction(logNumber); break; } @@ -619,7 +505,7 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) { ++numIndexed; arguments[arg - 1]->accept(*this); - appendTypeConversion( + utils().convertType( *arguments[arg - 1]->getType(), *function.getParameterTypes()[arg - 1], true @@ -642,17 +528,17 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) nonIndexedArgTypes.push_back(arguments[arg]->getType()); nonIndexedParamTypes.push_back(function.getParameterTypes()[arg]); } - CompilerUtils(m_context).fetchFreeMemoryPointer(); - encodeToMemory(nonIndexedArgTypes, nonIndexedParamTypes); + utils().fetchFreeMemoryPointer(); + utils().encodeToMemory(nonIndexedArgTypes, nonIndexedParamTypes); // need: topic1 ... topicn memsize memstart - CompilerUtils(m_context).toSizeAfterFreeMemoryPointer(); + utils().toSizeAfterFreeMemoryPointer(); m_context << eth::logInstruction(numIndexed); break; } case Location::BlockHash: { arguments[0]->accept(*this); - appendTypeConversion(*arguments[0]->getType(), *function.getParameterTypes()[0], true); + utils().convertType(*arguments[0]->getType(), *function.getParameterTypes()[0], true); m_context << eth::Instruction::BLOCKHASH; break; } @@ -713,7 +599,7 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) identifier = FunctionType(*function).externalIdentifier(); else solAssert(false, "Contract member is neither variable nor function."); - appendTypeConversion(type, IntegerType(0, IntegerType::Modifier::Address), true); + utils().convertType(type, IntegerType(0, IntegerType::Modifier::Address), true); m_context << identifier; } else @@ -726,12 +612,12 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) case Type::Category::Integer: if (member == "balance") { - appendTypeConversion(*_memberAccess.getExpression().getType(), + utils().convertType(*_memberAccess.getExpression().getType(), IntegerType(0, IntegerType::Modifier::Address), true); m_context << eth::Instruction::BALANCE; } else if ((set{"send", "call", "callcode"}).count(member)) - appendTypeConversion(*_memberAccess.getExpression().getType(), + utils().convertType(*_memberAccess.getExpression().getType(), IntegerType(0, IntegerType::Modifier::Address), true); else BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to integer.")); @@ -809,7 +695,7 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) auto const& type = dynamic_cast(*_memberAccess.getExpression().getType()); if (!type.isDynamicallySized()) { - CompilerUtils(m_context).popStackElement(type); + utils().popStackElement(type); m_context << type.getLength(); } else @@ -850,7 +736,7 @@ bool ExpressionCompiler::visit(IndexAccess const& _indexAccess) appendExpressionCopyToMemory(keyType, *_indexAccess.getIndexExpression()); m_context << eth::Instruction::SWAP1; solAssert(CompilerUtils::freeMemoryPointer >= 0x40, ""); - appendTypeMoveToMemory(IntegerType(256)); + utils().storeInMemoryDynamic(IntegerType(256)); m_context << u256(0) << eth::Instruction::SHA3; m_context << u256(0); setLValueToStorageItem(_indexAccess); @@ -1071,16 +957,6 @@ void ExpressionCompiler::appendShiftOperatorCode(Token::Value _operator) } } -void ExpressionCompiler::appendHighBitsCleanup(IntegerType const& _typeOnStack) -{ - if (_typeOnStack.getNumBits() == 256) - return; - else if (_typeOnStack.isSigned()) - m_context << u256(_typeOnStack.getNumBits() / 8 - 1) << eth::Instruction::SIGNEXTEND; - else - m_context << ((u256(1) << _typeOnStack.getNumBits()) - 1) << eth::Instruction::AND; -} - void ExpressionCompiler::appendExternalFunctionCall( FunctionType const& _functionType, vector> const& _arguments @@ -1127,7 +1003,7 @@ void ExpressionCompiler::appendExternalFunctionCall( // If we have a BareCall or BareCallCode and the first type has exactly 4 bytes, use it as // function identifier. _arguments.front()->accept(*this); - appendTypeConversion( + utils().convertType( *_arguments.front()->getType(), IntegerType(8 * CompilerUtils::dataStartOffset), true @@ -1144,16 +1020,16 @@ void ExpressionCompiler::appendExternalFunctionCall( } // Copy function identifier to memory. - CompilerUtils(m_context).fetchFreeMemoryPointer(); + utils().fetchFreeMemoryPointer(); if (!_functionType.isBareCall() || manualFunctionId) { m_context << eth::dupInstruction(2 + gasValueSize + CompilerUtils::getSizeOnStack(argumentTypes)); - appendTypeMoveToMemory(IntegerType(8 * CompilerUtils::dataStartOffset), false); + utils().storeInMemoryDynamic(IntegerType(8 * CompilerUtils::dataStartOffset), false); } // If the function takes arbitrary parameters, copy dynamic length data in place. // Move argumenst to memory, will not update the free memory pointer (but will update the memory // pointer on the stack). - encodeToMemory( + utils().encodeToMemory( argumentTypes, _functionType.getParameterTypes(), _functionType.padArguments(), @@ -1171,7 +1047,7 @@ void ExpressionCompiler::appendExternalFunctionCall( // Output data will replace input data. // put on stack: m_context << u256(retSize); - CompilerUtils(m_context).fetchFreeMemoryPointer(); + utils().fetchFreeMemoryPointer(); m_context << eth::Instruction::DUP1 << eth::Instruction::DUP4 << eth::Instruction::SUB; m_context << eth::Instruction::DUP2; @@ -1212,7 +1088,7 @@ void ExpressionCompiler::appendExternalFunctionCall( m_context.appendConditionalJumpTo(m_context.errorTag()); } - CompilerUtils(m_context).popStackSlots(remainsSize); + utils().popStackSlots(remainsSize); if (returnSuccessCondition) { @@ -1221,118 +1097,16 @@ void ExpressionCompiler::appendExternalFunctionCall( else if (funKind == FunctionKind::RIPEMD160) { // fix: built-in contract returns right-aligned data - CompilerUtils(m_context).fetchFreeMemoryPointer(); - CompilerUtils(m_context).loadFromMemoryDynamic(IntegerType(160), false, true, false); - appendTypeConversion(IntegerType(160), FixedBytesType(20)); + utils().fetchFreeMemoryPointer(); + utils().loadFromMemoryDynamic(IntegerType(160), false, true, false); + utils().convertType(IntegerType(160), FixedBytesType(20)); } else if (firstReturnType) { //@todo manually update free memory pointer if we accept returning memory-stored objects - CompilerUtils(m_context).fetchFreeMemoryPointer(); - CompilerUtils(m_context).loadFromMemoryDynamic(*firstReturnType, false, true, false); - } -} - -void ExpressionCompiler::encodeToMemory( - TypePointers const& _givenTypes, - TypePointers const& _targetTypes, - bool _padToWordBoundaries, - bool _copyDynamicDataInPlace -) -{ - // stack: ... - TypePointers targetTypes = _targetTypes.empty() ? _givenTypes : _targetTypes; - solAssert(targetTypes.size() == _givenTypes.size(), ""); - for (TypePointer& t: targetTypes) - t = t->mobileType()->externalType(); - - // Stack during operation: - // ... ... - // The values dyn_head_i are added during the first loop and they point to the head part - // of the ith dynamic parameter, which is filled once the dynamic parts are processed. - - // store memory start pointer - m_context << eth::Instruction::DUP1; - - unsigned argSize = CompilerUtils::getSizeOnStack(_givenTypes); - unsigned stackPos = 0; // advances through the argument values - unsigned dynPointers = 0; // number of dynamic head pointers on the stack - for (size_t i = 0; i < _givenTypes.size(); ++i) - { - TypePointer targetType = targetTypes[i]; - solAssert(!!targetType, "Externalable type expected."); - if (targetType->isDynamicallySized() && !_copyDynamicDataInPlace) - { - // leave end_of_mem as dyn head pointer - m_context << eth::Instruction::DUP1 << u256(32) << eth::Instruction::ADD; - dynPointers++; - } - else - { - CompilerUtils(m_context).copyToStackTop( - argSize - stackPos + dynPointers + 2, - _givenTypes[i]->getSizeOnStack() - ); - if (targetType->isValueType()) - appendTypeConversion(*_givenTypes[i], *targetType, true); - solAssert(!!targetType, "Externalable type expected."); - appendTypeMoveToMemory(*targetType, _padToWordBoundaries); - } - stackPos += _givenTypes[i]->getSizeOnStack(); + utils().fetchFreeMemoryPointer(); + utils().loadFromMemoryDynamic(*firstReturnType, false, true, false); } - - // now copy the dynamic part - // Stack: ... ... - stackPos = 0; - unsigned thisDynPointer = 0; - for (size_t i = 0; i < _givenTypes.size(); ++i) - { - TypePointer targetType = targetTypes[i]; - solAssert(!!targetType, "Externalable type expected."); - if (targetType->isDynamicallySized() && !_copyDynamicDataInPlace) - { - solAssert(_givenTypes[i]->getCategory() == Type::Category::Array, "Unknown dynamic type."); - auto const& arrayType = dynamic_cast(*_givenTypes[i]); - // copy tail pointer (=mem_end - mem_start) to memory - m_context << eth::dupInstruction(2 + dynPointers) << eth::Instruction::DUP2; - m_context << eth::Instruction::SUB; - m_context << eth::dupInstruction(2 + dynPointers - thisDynPointer); - m_context << eth::Instruction::MSTORE; - // now copy the array - CompilerUtils(m_context).copyToStackTop( - argSize - stackPos + dynPointers + 2, - arrayType.getSizeOnStack() - ); - // copy length to memory - m_context << eth::dupInstruction(1 + arrayType.getSizeOnStack()); - if (arrayType.location() == ReferenceType::Location::CallData) - m_context << eth::Instruction::DUP2; // length is on stack - else if (arrayType.location() == ReferenceType::Location::Storage) - m_context << eth::Instruction::DUP3 << eth::Instruction::SLOAD; - else - { - solAssert(arrayType.location() == ReferenceType::Location::Memory, ""); - m_context << eth::Instruction::DUP2 << eth::Instruction::MLOAD; - } - appendTypeMoveToMemory(IntegerType(256), true); - // copy the new memory pointer - m_context << eth::swapInstruction(arrayType.getSizeOnStack() + 1) << eth::Instruction::POP; - // copy data part - appendTypeMoveToMemory(arrayType, true); - - thisDynPointer++; - } - stackPos += _givenTypes[i]->getSizeOnStack(); - } - - // remove unneeded stack elements (and retain memory pointer) - m_context << eth::swapInstruction(argSize + dynPointers + 1); - CompilerUtils(m_context).popStackSlots(argSize + dynPointers + 1); -} - -void ExpressionCompiler::appendTypeMoveToMemory(Type const& _type, bool _padToWordBoundaries) -{ - CompilerUtils(m_context).storeInMemoryDynamic(_type, _padToWordBoundaries); } void ExpressionCompiler::appendExpressionCopyToMemory(Type const& _expectedType, Expression const& _expression) @@ -1340,11 +1114,11 @@ void ExpressionCompiler::appendExpressionCopyToMemory(Type const& _expectedType, _expression.accept(*this); if (_expectedType.isValueType()) { - appendTypeConversion(*_expression.getType(), _expectedType, true); - appendTypeMoveToMemory(_expectedType); + utils().convertType(*_expression.getType(), _expectedType, true); + utils().storeInMemoryDynamic(_expectedType); } else - appendTypeMoveToMemory(*_expression.getType()->mobileType()); + utils().storeInMemoryDynamic(*_expression.getType()->mobileType()); } void ExpressionCompiler::setLValueFromDeclaration(Declaration const& _declaration, Expression const& _expression) @@ -1364,5 +1138,10 @@ void ExpressionCompiler::setLValueToStorageItem(Expression const& _expression) setLValue(_expression, *_expression.getType()); } +CompilerUtils ExpressionCompiler::utils() +{ + return CompilerUtils(m_context); +} + } } diff --git a/libsolidity/ExpressionCompiler.h b/libsolidity/ExpressionCompiler.h index 90994dfdb..642560c64 100644 --- a/libsolidity/ExpressionCompiler.h +++ b/libsolidity/ExpressionCompiler.h @@ -26,9 +26,9 @@ #include #include #include -#include #include #include +#include namespace dev { namespace eth @@ -39,6 +39,7 @@ namespace solidity { // forward declarations class CompilerContext; +class CompilerUtils; class Type; class IntegerType; class ArrayType; @@ -66,12 +67,6 @@ public: /// Appends code for a State Variable accessor function void appendStateVariableAccessor(VariableDeclaration const& _varDecl); - /// Appends an implicit or explicit type conversion. For now this comprises only erasing - /// higher-order bits (@see appendHighBitCleanup) when widening integer. - /// If @a _cleanupNeeded, high order bits cleanup is also done if no type conversion would be - /// necessary. - void appendTypeConversion(Type const& _typeOnStack, Type const& _targetType, bool _cleanupNeeded = false); - private: virtual bool visit(Assignment const& _assignment) override; virtual bool visit(UnaryOperation const& _unaryOperation) override; @@ -94,33 +89,11 @@ private: void appendShiftOperatorCode(Token::Value _operator); /// @} - //// Appends code that cleans higher-order bits for integer types. - void appendHighBitsCleanup(IntegerType const& _typeOnStack); - /// Appends code to call a function of the given type with the given arguments. void appendExternalFunctionCall( FunctionType const& _functionType, std::vector> const& _arguments ); - /// Copies values (of types @a _givenTypes) given on the stack to a location in memory given - /// at the stack top, encoding them according to the ABI as the given types @a _targetTypes. - /// Removes the values from the stack and leaves the updated memory pointer. - /// Stack pre: ... - /// Stack post: - /// Does not touch the memory-free pointer. - /// @param _padToWordBoundaries if false, all values are concatenated without padding. - /// @param _copyDynamicDataInPlace if true, dynamic types is stored (without length) - /// together with fixed-length data. - void encodeToMemory( - TypePointers const& _givenTypes = {}, - TypePointers const& _targetTypes = {}, - bool _padToWordBoundaries = true, - bool _copyDynamicDataInPlace = false - ); - /// Appends code that moves a stack element of the given type to memory. The memory offset is - /// expected below the stack element and is updated by this call. - /// For arrays, this only copies the data part. - void appendTypeMoveToMemory(Type const& _type, bool _padToWordBoundaries = true); /// Appends code that evaluates a single expression and moves the result to memory. The memory offset is /// expected to be on the stack and is updated by this call. void appendExpressionCopyToMemory(Type const& _expectedType, Expression const& _expression); @@ -137,9 +110,13 @@ private: template void setLValue(Expression const& _expression, _Arguments const&... _arguments); + /// @returns the CompilerUtils object containing the current context. + CompilerUtils utils(); + bool m_optimize; CompilerContext& m_context; std::unique_ptr m_currentLValue; + }; template diff --git a/test/libsolidity/Assembly.cpp b/test/libsolidity/Assembly.cpp index fd4bbcf6d..8d316a977 100644 --- a/test/libsolidity/Assembly.cpp +++ b/test/libsolidity/Assembly.cpp @@ -106,7 +106,7 @@ BOOST_AUTO_TEST_CASE(location_test) AssemblyItems items = compileContract(sourceCode); vector locations = vector(17, SourceLocation(2, 75, n)) + - vector(14, SourceLocation(20, 72, n)) + + vector(26, SourceLocation(20, 72, n)) + vector{SourceLocation(42, 51, n), SourceLocation(65, 67, n)} + vector(4, SourceLocation(58, 67, n)) + vector(3, SourceLocation(20, 72, n)); diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f12abd48e..f4d875e77 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -2420,7 +2420,7 @@ BOOST_AUTO_TEST_CASE(event_really_lots_of_data_from_storage) callContractFunction("deposit()"); BOOST_REQUIRE_EQUAL(m_logs.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].address, m_contractAddress); - BOOST_CHECK(m_logs[0].data == encodeArgs(10, 0x60, 15, 3) + asBytes("ABC")); + BOOST_CHECK(m_logs[0].data == encodeArgs(10, 0x60, 15, 3, string("ABC"))); BOOST_REQUIRE_EQUAL(m_logs[0].topics.size(), 1); BOOST_CHECK_EQUAL(m_logs[0].topics[0], dev::sha3(string("Deposit(uint256,bytes,uint256)"))); } @@ -4232,6 +4232,31 @@ BOOST_AUTO_TEST_CASE(reusing_memory) BOOST_REQUIRE(callContractFunction("f(uint256)", 0x34) == encodeArgs(dev::sha3(dev::toBigEndian(u256(0x34))))); } +BOOST_AUTO_TEST_CASE(return_string) +{ + char const* sourceCode = R"( + contract Main { + string public s; + function set(string _s) external { + s = _s; + } + function get1() returns (string r) { + return s; + } +// function get2() returns (string r) { +// r = s; +// } + } + )"; + compileAndRun(sourceCode, 0, "Main"); + string s("Julia"); + bytes args = encodeArgs(u256(0x20), u256(s.length()), s); + BOOST_REQUIRE(callContractFunction("set(string)", asString(args)) == encodeArgs()); + BOOST_CHECK(callContractFunction("get1()") == args); +// BOOST_CHECK(callContractFunction("get2()") == args); +// BOOST_CHECK(callContractFunction("s()") == args); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/solidityExecutionFramework.h b/test/libsolidity/solidityExecutionFramework.h index 44590b1c8..4ba229815 100644 --- a/test/libsolidity/solidityExecutionFramework.h +++ b/test/libsolidity/solidityExecutionFramework.h @@ -174,11 +174,11 @@ protected: BOOST_REQUIRE(m_state.addressHasCode(m_contractAddress)); BOOST_REQUIRE(!executive.call(m_contractAddress, m_sender, _value, m_gasPrice, &_data, m_gas)); } - BOOST_REQUIRE(executive.go()); + BOOST_REQUIRE(executive.go(/* DEBUG eth::Executive::simpleTrace() */)); m_state.noteSending(m_sender); executive.finalize(); - m_gasUsed = executive.gasUsed(); - m_output = std::move(res.output); // FIXME: Looks like Framework needs ExecutiveResult embedded + m_gasUsed = res.gasUsed; + m_output = std::move(res.output); m_logs = executive.logs(); } From be45d62b6144c5ee8f0061bb5e0065ca93cbf33e Mon Sep 17 00:00:00 2001 From: Dimitry Date: Mon, 15 Jun 2015 21:08:22 +0300 Subject: [PATCH 041/169] Code Coverage: bash syntax --- getcoverage.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/getcoverage.sh b/getcoverage.sh index 446d584e6..ac50bf94b 100755 --- a/getcoverage.sh +++ b/getcoverage.sh @@ -16,9 +16,9 @@ if which lcov >/dev/null; then if which genhtml >/dev/null; then lcov --directory $TESTETH --zerocounters echo Running testeth... - $($CPP_ETHEREUM_PATH/build/test/testeth --all) - $($CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit --all) - $($CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit --all) + $CPP_ETHEREUM_PATH/build/test/testeth -t --all + $CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit --all + $CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit --all echo Prepearing coverage info... else echo genhtml not found From 5c2018d1bc9611fbbce7660b6923313c4c21ed0f Mon Sep 17 00:00:00 2001 From: gluk256 Date: Mon, 15 Jun 2015 20:19:52 +0200 Subject: [PATCH 042/169] Update FixedHash.h --- libdevcore/FixedHash.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdevcore/FixedHash.h b/libdevcore/FixedHash.h index ca80d745c..922a6ec30 100644 --- a/libdevcore/FixedHash.h +++ b/libdevcore/FixedHash.h @@ -168,7 +168,7 @@ public: template inline FixedHash bloomPart() const { - static_assert((M & (M - 1)) == 0, "M must be power-of-two"); + static_assert((M & (M - 1)) == 0, "M must be power-of-two"); static const unsigned c_bloomBits = M * 8; unsigned mask = c_bloomBits - 1; unsigned bloomBytes = (dev::toLog2(c_bloomBits) + 7) / 8; From 2c37204a69d8d73c5f561d327f2781264fafe9ab Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2015 17:35:50 +0200 Subject: [PATCH 043/169] KeyManager refactoring to increase readability. --- alethzero/MainWin.cpp | 46 ++++--- alethzero/MainWin.h | 2 +- alethzero/OurWebThreeStubServer.cpp | 2 +- alethzero/Transact.cpp | 7 +- eth/main.cpp | 8 +- ethkey/KeyAux.h | 8 +- libdevcore/CommonData.h | 9 +- libethcore/KeyManager.cpp | 169 +++++++++++++++----------- libethcore/KeyManager.h | 66 ++++++---- libweb3jsonrpc/AccountHolder.cpp | 2 +- libweb3jsonrpc/AccountHolder.h | 1 - libweb3jsonrpc/WebThreeStubServer.cpp | 12 +- 12 files changed, 194 insertions(+), 138 deletions(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 848020cbc..297ad0eda 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -235,7 +235,7 @@ Main::Main(QWidget *parent) : // ui->webView->page()->settings()->setAttribute(QWebEngineSettings::DeveloperExtrasEnabled, true); // QWebEngineInspector* inspector = new QWebEngineInspector(); // inspector->setPage(page); - setBeneficiary(*m_keyManager.accounts().begin()); + setBeneficiary(m_keyManager.accounts().front()); ethereum()->setDefault(LatestBlock); @@ -430,9 +430,9 @@ void Main::installBalancesWatch() // TODO: Update for new currencies reg. for (unsigned i = 0; i < ethereum()->stateAt(coinsAddr, PendingBlock); ++i) altCoins.push_back(right160(ethereum()->stateAt(coinsAddr, i + 1))); - for (auto const& i: m_keyManager.accounts()) + for (auto const& address: m_keyManager.accounts()) for (auto c: altCoins) - tf.address(c).topic(0, h256(i, h256::AlignRight)); + tf.address(c).topic(0, h256(address, h256::AlignRight)); uninstallWatch(m_balancesFilter); m_balancesFilter = installWatch(tf, [=](LocalisedLogEntries const&){ onBalancesChange(); }); @@ -501,7 +501,7 @@ void Main::load(QString _s) void Main::on_newTransaction_triggered() { - m_transact->setEnvironment(m_keyManager.accounts(), ethereum(), &m_natSpecDB); + m_transact->setEnvironment(m_keyManager.accountsHash(), ethereum(), &m_natSpecDB); m_transact->show(); } @@ -735,18 +735,17 @@ void Main::writeSettings() s.setValue("windowState", saveState()); } -Secret Main::retrieveSecret(Address const& _a) const +Secret Main::retrieveSecret(Address const& _address) const { - auto info = m_keyManager.accountDetails()[_a]; while (true) { - Secret s = m_keyManager.secret(_a, [&](){ + Secret s = m_keyManager.secret(_address, [&](){ QDialog d; Ui_GetPassword gp; gp.setupUi(&d); d.setWindowTitle("Unlock Account"); - gp.label->setText(QString("Enter the password for the account %2 (%1).").arg(QString::fromStdString(_a.abridged())).arg(QString::fromStdString(info.first))); - gp.entry->setPlaceholderText("Hint: " + QString::fromStdString(info.second)); + gp.label->setText(QString("Enter the password for the account %2 (%1).").arg(QString::fromStdString(_address.abridged())).arg(QString::fromStdString(m_keyManager.accountName(_address)))); + gp.entry->setPlaceholderText("Hint: " + QString::fromStdString(m_keyManager.passwordHint(_address))); return d.exec() == QDialog::Accepted ? gp.entry->text().toStdString() : string(); }); if (s || QMessageBox::warning(nullptr, "Unlock Account", "The password you gave is incorrect for this key.", QMessageBox::Retry, QMessageBox::Cancel) == QMessageBox::Cancel) @@ -770,7 +769,7 @@ void Main::readSettings(bool _skipGeometry) for (unsigned i = 0; i < b.size() / sizeof(Secret); ++i) { memcpy(&k, b.data() + i * sizeof(Secret), sizeof(Secret)); - if (!m_keyManager.accounts().count(KeyPair(k).address())) + if (!m_keyManager.hasAccount(KeyPair(k).address())) m_keyManager.import(k, "Imported (UNSAFE) key."); } } @@ -858,7 +857,7 @@ void Main::on_importKey_triggered() if (b.size() == 32) { auto k = KeyPair(h256(b)); - if (!m_keyManager.accounts().count(k.address())) + if (!m_keyManager.hasAccount(k.address())) { QString s = QInputDialog::getText(this, "Import Account Key", "Enter this account's name"); if (QMessageBox::question(this, "Additional Security?", "Would you like to use additional security for this key? This lets you protect it with a different password to other keys, but also means you must re-enter the key's password every time you wish to use the account.", QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) @@ -939,7 +938,7 @@ void Main::on_claimPresale_triggered() } cnote << k.address(); - if (!m_keyManager.accounts().count(k.address())) + if (!m_keyManager.hasAccount(k.address())) ethereum()->submitTransaction(k.sec(), ethereum()->balanceAt(k.address()) - gasPrice() * c_txGas, m_beneficiary, {}, c_txGas, gasPrice()); else QMessageBox::warning(this, "Already Have Key", "Could not import the secret key: we already own this account."); @@ -1110,13 +1109,13 @@ void Main::refreshBalances() // cdebug << n << addr << denom << sha3(h256(n).asBytes()); altCoins[addr] = make_tuple(fromRaw(n), 0, denom); }*/ - for (pair> const& i: m_keyManager.accountDetails()) + for (auto const& address: m_keyManager.accounts()) { - u256 b = ethereum()->balanceAt(i.first); - QListWidgetItem* li = new QListWidgetItem(QString("%4 %2: %1 [%3]").arg(formatBalance(b).c_str()).arg(QString::fromStdString(render(i.first))).arg((unsigned)ethereum()->countAt(i.first)).arg(QString::fromStdString(i.second.first)), ui->ourAccounts); - li->setData(Qt::UserRole, QByteArray((char const*)i.first.data(), Address::size)); + u256 b = ethereum()->balanceAt(address); + QListWidgetItem* li = new QListWidgetItem(QString("%4 %2: %1 [%3]").arg(formatBalance(b).c_str()).arg(QString::fromStdString(render(address))).arg((unsigned)ethereum()->countAt(address)).arg(QString::fromStdString(m_keyManager.accountName(address))), ui->ourAccounts); + li->setData(Qt::UserRole, QByteArray((char const*)address.data(), Address::size)); li->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable); - li->setCheckState(m_beneficiary == i.first ? Qt::Checked : Qt::Unchecked); + li->setCheckState(m_beneficiary == address ? Qt::Checked : Qt::Unchecked); totalBalance += b; // for (auto& c: altCoins) @@ -2094,9 +2093,8 @@ void Main::on_killAccount_triggered() { auto hba = ui->ourAccounts->currentItem()->data(Qt::UserRole).toByteArray(); Address h((byte const*)hba.data(), Address::ConstructFromPointer); - auto k = m_keyManager.accountDetails()[h]; - QString s = QInputDialog::getText(this, QString::fromStdString("Kill Account " + k.first + "?!"), - QString::fromStdString("Account " + k.first + " (" + render(h) + ") has " + formatBalance(ethereum()->balanceAt(h)) + " in it.\r\nIt, and any contract that this account can access, will be lost forever if you continue. Do NOT continue unless you know what you are doing.\n" + QString s = QInputDialog::getText(this, QString::fromStdString("Kill Account " + m_keyManager.accountName(h) + "?!"), + QString::fromStdString("Account " + m_keyManager.accountName(h) + " (" + render(h) + ") has " + formatBalance(ethereum()->balanceAt(h)) + " in it.\r\nIt, and any contract that this account can access, will be lost forever if you continue. Do NOT continue unless you know what you are doing.\n" "Are you sure you want to continue? \r\n If so, type 'YES' to confirm."), QLineEdit::Normal, "NO"); if (s != "YES") @@ -2104,10 +2102,10 @@ void Main::on_killAccount_triggered() m_keyManager.kill(h); if (m_keyManager.accounts().empty()) m_keyManager.import(Secret::random(), "Default account"); - m_beneficiary = *m_keyManager.accounts().begin(); + m_beneficiary = m_keyManager.accounts().front(); keysChanged(); if (m_beneficiary == h) - setBeneficiary(*m_keyManager.accounts().begin()); + setBeneficiary(m_keyManager.accounts().front()); } } @@ -2128,7 +2126,7 @@ void Main::on_reencryptKey_triggered() return; try { auto pw = [&](){ - auto p = QInputDialog::getText(this, "Re-Encrypt Key", "Enter the original password for this key.\nHint: " + QString::fromStdString(m_keyManager.hint(a)), QLineEdit::Password, QString()).toStdString(); + auto p = QInputDialog::getText(this, "Re-Encrypt Key", "Enter the original password for this key.\nHint: " + QString::fromStdString(m_keyManager.passwordHint(a)), QLineEdit::Password, QString()).toStdString(); if (p.empty()) throw PasswordUnknown(); return p; @@ -2151,7 +2149,7 @@ void Main::on_reencryptAll_triggered() try { for (Address const& a: m_keyManager.accounts()) while (!m_keyManager.recode(a, SemanticPassword::Existing, [&](){ - auto p = QInputDialog::getText(nullptr, "Re-Encrypt Key", QString("Enter the original password for key %1.\nHint: %2").arg(QString::fromStdString(pretty(a))).arg(QString::fromStdString(m_keyManager.hint(a))), QLineEdit::Password, QString()).toStdString(); + auto p = QInputDialog::getText(nullptr, "Re-Encrypt Key", QString("Enter the original password for key %1.\nHint: %2").arg(QString::fromStdString(pretty(a))).arg(QString::fromStdString(m_keyManager.passwordHint(a))), QLineEdit::Password, QString()).toStdString(); if (p.empty()) throw PasswordUnknown(); return p; diff --git a/alethzero/MainWin.h b/alethzero/MainWin.h index efff89d2b..f8a6fa6c7 100644 --- a/alethzero/MainWin.h +++ b/alethzero/MainWin.h @@ -96,7 +96,7 @@ public: dev::eth::KeyManager& keyManager() override { return m_keyManager; } bool doConfirm(); - dev::Secret retrieveSecret(dev::Address const& _a) const override; + dev::Secret retrieveSecret(dev::Address const& _address) const override; public slots: void load(QString _file); diff --git a/alethzero/OurWebThreeStubServer.cpp b/alethzero/OurWebThreeStubServer.cpp index e18cb55d5..aaeffa16b 100644 --- a/alethzero/OurWebThreeStubServer.cpp +++ b/alethzero/OurWebThreeStubServer.cpp @@ -136,7 +136,7 @@ void OurAccountHolder::doValidations() AddressHash OurAccountHolder::realAccounts() const { - return m_main->keyManager().accounts(); + return m_main->keyManager().accountsHash(); } bool OurAccountHolder::validateTransaction(TransactionSkeleton const& _t, bool _toProxy) diff --git a/alethzero/Transact.cpp b/alethzero/Transact.cpp index fd466e475..7a26f56f2 100644 --- a/alethzero/Transact.cpp +++ b/alethzero/Transact.cpp @@ -77,11 +77,10 @@ void Transact::setEnvironment(AddressHash const& _accounts, dev::eth::Client* _e auto old = ui->from->currentIndex(); ui->from->clear(); - for (auto const& i: m_accounts) + for (auto const& address: m_accounts) { - auto d = m_context->keyManager().accountDetails()[i]; - u256 b = ethereum()->balanceAt(i, PendingBlock); - QString s = QString("%4 %2: %1").arg(formatBalance(b).c_str()).arg(QString::fromStdString(m_context->render(i))).arg(QString::fromStdString(d.first)); + u256 b = ethereum()->balanceAt(address, PendingBlock); + QString s = QString("%4 %2: %1").arg(formatBalance(b).c_str()).arg(QString::fromStdString(m_context->render(address))).arg(QString::fromStdString(m_context->keyManager().accountName(address))); ui->from->addItem(s); } if (old > -1 && old < ui->from->count()) diff --git a/eth/main.cpp b/eth/main.cpp index 382858ae7..a7d9d7c00 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -678,7 +678,7 @@ int main(int argc, char** argv) return ret; }; auto getAccountPassword = [&](Address const& a){ - return getPassword("Enter password for address " + keyManager.accountDetails()[a].first + " (" + a.abridged() + "; hint:" + keyManager.accountDetails()[a].second + "): "); + return getPassword("Enter password for address " + keyManager.accountName(a) + " (" + a.abridged() + "; hint:" + keyManager.passwordHint(a) + "): "); }; StructuredLogger::get().initialize(structuredLogging, structuredLoggingFormat, structuredLoggingURL); @@ -1122,10 +1122,10 @@ int main(int argc, char** argv) { cout << "Accounts:" << endl; u256 total = 0; - for (auto const& i: keyManager.accountDetails()) + for (auto const& address: keyManager.accounts()) { - auto b = c->balanceAt(i.first); - cout << ((i.first == signingKey) ? "SIGNING " : " ") << ((i.first == beneficiary) ? "COINBASE " : " ") << i.second.first << " (" << i.first << "): " << formatBalance(b) << " = " << b << " wei" << endl; + auto b = c->balanceAt(address); + cout << ((address == signingKey) ? "SIGNING " : " ") << ((address == beneficiary) ? "COINBASE " : " ") << keyManager.accountName(address) << " (" << address << "): " << formatBalance(b) << " = " << b << " wei" << endl; total += b; } cout << "Total: " << formatBalance(total) << " = " << total << " wei" << endl; diff --git a/ethkey/KeyAux.h b/ethkey/KeyAux.h index d2ec13b2a..b7b10ce21 100644 --- a/ethkey/KeyAux.h +++ b/ethkey/KeyAux.h @@ -44,7 +44,7 @@ class BadArgument: public Exception {}; string getAccountPassword(KeyManager& keyManager, Address const& a) { - return getPassword("Enter password for address " + keyManager.accountDetails()[a].first + " (" + a.abridged() + "; hint:" + keyManager.accountDetails()[a].second + "): "); + return getPassword("Enter password for address " + keyManager.accountName(a) + " (" + a.abridged() + "; hint:" + keyManager.passwordHint(a) + "): "); } string createPassword(std::string const& _prompt) @@ -359,20 +359,18 @@ public: nonIcap.push_back(u); else { - std::pair info = wallet.accountDetails()[a]; cout << toUUID(u) << " " << a.abridged(); cout << " " << ICAP(a).encoded(); - cout << " " << info.first << endl; + cout << " " << wallet.accountName(a) << endl; } else bare.push_back(u); for (auto const& u: nonIcap) if (Address a = wallet.address(u)) { - std::pair info = wallet.accountDetails()[a]; cout << toUUID(u) << " " << a.abridged(); cout << " (Not ICAP) "; - cout << " " << info.first << endl; + cout << " " << wallet.accountName(a) << endl; } for (auto const& u: bare) cout << toUUID(u) << " (Bare)" << endl; diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index ddc00e09f..780e8f6f5 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -258,7 +259,7 @@ template std::set& operator+=(std::set& _a, U const& _b return _a; } -/// Insert the contents of a container into an unordered_st +/// Insert the contents of a container into an unordered_set template std::unordered_set& operator+=(std::unordered_set& _a, U const& _b) { for (auto const& i: _b) @@ -280,6 +281,12 @@ template std::set operator+(std::set _a, U const& _b) return _a += _b; } +/// Insert the contents of a container into an unordered_set +template std::unordered_set operator+(std::unordered_set _a, U const& _b) +{ + return _a += _b; +} + /// Concatenate the contents of a container onto a vector template std::vector operator+(std::vector _a, U const& _b) { diff --git a/libethcore/KeyManager.cpp b/libethcore/KeyManager.cpp index 4430a588e..602c60b4a 100644 --- a/libethcore/KeyManager.cpp +++ b/libethcore/KeyManager.cpp @@ -31,7 +31,7 @@ using namespace dev; using namespace eth; namespace fs = boost::filesystem; -KeyManager::KeyManager(std::string const& _keysFile, std::string const& _secretsPath): +KeyManager::KeyManager(string const& _keysFile, string const& _secretsPath): m_keysFile(_keysFile), m_store(_secretsPath) {} @@ -43,13 +43,13 @@ bool KeyManager::exists() const return !contents(m_keysFile + ".salt").empty() && !contents(m_keysFile).empty(); } -void KeyManager::create(std::string const& _pass) +void KeyManager::create(string const& _pass) { - m_password = asString(h256::random().asBytes()); + m_defaultPasswordDeprecated = asString(h256::random().asBytes()); write(_pass, m_keysFile); } -bool KeyManager::recode(Address const& _address, std::string const& _newPass, std::string const& _hint, std::function const& _pass, KDF _kdf) +bool KeyManager::recode(Address const& _address, string const& _newPass, string const& _hint, function const& _pass, KDF _kdf) { noteHint(_newPass, _hint); h128 u = uuid(_address); @@ -61,10 +61,10 @@ bool KeyManager::recode(Address const& _address, std::string const& _newPass, st return true; } -bool KeyManager::recode(Address const& _address, SemanticPassword _newPass, std::function const& _pass, KDF _kdf) +bool KeyManager::recode(Address const& _address, SemanticPassword _newPass, function const& _pass, KDF _kdf) { h128 u = uuid(_address); - std::string p; + string p; if (_newPass == SemanticPassword::Existing) p = getPassword(u, _pass); else if (_newPass == SemanticPassword::Master) @@ -75,41 +75,47 @@ bool KeyManager::recode(Address const& _address, SemanticPassword _newPass, std: return recode(_address, p, string(), _pass, _kdf); } -bool KeyManager::load(std::string const& _pass) +bool KeyManager::load(string const& _pass) { - try { + try + { bytes salt = contents(m_keysFile + ".salt"); bytes encKeys = contents(m_keysFile); - m_key = h128(pbkdf2(_pass, salt, 262144, 16)); - bytes bs = decryptSymNoAuth(m_key, h128(), &encKeys); + m_keysFileKey = h128(pbkdf2(_pass, salt, 262144, 16)); + bytes bs = decryptSymNoAuth(m_keysFileKey, h128(), &encKeys); RLP s(bs); - unsigned version = (unsigned)s[0]; + unsigned version = unsigned(s[0]); if (version == 1) { for (auto const& i: s[1]) { - m_keyInfo[m_addrLookup[(Address)i[0]] = (h128)i[1]] = KeyInfo((h256)i[2], (std::string)i[3]); -// cdebug << toString((Address)i[0]) << toString((h128)i[1]) << toString((h256)i[2]) << (std::string)i[3]; + h128 uuid(i[1]); + Address addr(i[0]); + m_addrLookup[addr] = uuid; + m_keyInfo[uuid] = KeyInfo(h256(i[2]), string(i[3])); +// cdebug << toString(addr) << toString(uuid) << toString((h256)i[2]) << (string)i[3]; } for (auto const& i: s[2]) - m_passwordInfo[(h256)i[0]] = (std::string)i[1]; - m_password = (string)s[3]; + m_passwordHint[h256(i[0])] = string(i[1]); + m_defaultPasswordDeprecated = string(s[3]); } // cdebug << hashPassword(m_password) << toHex(m_password); - m_cachedPasswords[hashPassword(m_password)] = m_password; + cachePassword(m_defaultPasswordDeprecated); // cdebug << hashPassword(asString(m_key.ref())) << m_key.hex(); - m_cachedPasswords[hashPassword(asString(m_key.ref()))] = asString(m_key.ref()); + cachePassword(asString(m_keysFileKey.ref())); // cdebug << hashPassword(_pass) << _pass; - m_cachedPasswords[m_master = hashPassword(_pass)] = _pass; + m_master = hashPassword(_pass); + cachePassword(_pass); return true; } - catch (...) { + catch (...) + { return false; } } -Secret KeyManager::secret(Address const& _address, function const& _pass) const +Secret KeyManager::secret(Address const& _address, function const& _pass) const { auto it = m_addrLookup.find(_address); if (it == m_addrLookup.end()) @@ -117,12 +123,12 @@ Secret KeyManager::secret(Address const& _address, function const return secret(it->second, _pass); } -Secret KeyManager::secret(h128 const& _uuid, function const& _pass) const +Secret KeyManager::secret(h128 const& _uuid, function const& _pass) const { return Secret(m_store.secret(_uuid, [&](){ return getPassword(_uuid, _pass); })); } -std::string KeyManager::getPassword(h128 const& _uuid, function const& _pass) const +string KeyManager::getPassword(h128 const& _uuid, function const& _pass) const { auto kit = m_keyInfo.find(_uuid); h256 ph; @@ -131,19 +137,19 @@ std::string KeyManager::getPassword(h128 const& _uuid, function c return getPassword(ph, _pass); } -std::string KeyManager::getPassword(h256 const& _passHash, function const& _pass) const +string KeyManager::getPassword(h256 const& _passHash, function const& _pass) const { auto it = m_cachedPasswords.find(_passHash); if (it != m_cachedPasswords.end()) return it->second; - for (unsigned i = 0; i< 10; ++i) + for (unsigned i = 0; i < 10; ++i) { - std::string p = _pass(); + string p = _pass(); if (p.empty()) break; - if (hashPassword(p) == _passHash || _passHash == UnknownPassword) + if (_passHash == UnknownPassword || hashPassword(p) == _passHash) { - m_cachedPasswords[hashPassword(p)] = p; + cachePassword(p); return p; } } @@ -166,20 +172,20 @@ Address KeyManager::address(h128 const& _uuid) const return Address(); } -h128 KeyManager::import(Secret const& _s, string const& _info, std::string const& _pass, string const& _passInfo) +h128 KeyManager::import(Secret const& _s, string const& _accountName, string const& _pass, string const& _passwordHint) { Address addr = KeyPair(_s).address(); auto passHash = hashPassword(_pass); - m_cachedPasswords[passHash] = _pass; - m_passwordInfo[passHash] = _passInfo; + cachePassword(_pass); + m_passwordHint[passHash] = _passwordHint; auto uuid = m_store.importSecret(_s.asBytes(), _pass); - m_keyInfo[uuid] = KeyInfo{passHash, _info}; + m_keyInfo[uuid] = KeyInfo{passHash, _accountName}; m_addrLookup[addr] = uuid; write(m_keysFile); return uuid; } -void KeyManager::importExisting(h128 const& _uuid, std::string const& _info, std::string const& _pass, std::string const& _passInfo) +void KeyManager::importExisting(h128 const& _uuid, string const& _info, string const& _pass, string const& _passwordHint) { bytes key = m_store.secret(_uuid, [&](){ return _pass; }); if (key.empty()) @@ -187,17 +193,17 @@ void KeyManager::importExisting(h128 const& _uuid, std::string const& _info, std Address a = KeyPair(Secret(key)).address(); auto passHash = hashPassword(_pass); if (!m_cachedPasswords.count(passHash)) - m_cachedPasswords[passHash] = _pass; - importExisting(_uuid, _info, a, passHash, _passInfo); + cachePassword(_pass); + importExisting(_uuid, _info, a, passHash, _passwordHint); } -void KeyManager::importExisting(h128 const& _uuid, std::string const& _info, Address const& _address, h256 const& _passHash, std::string const& _passInfo) +void KeyManager::importExisting(h128 const& _uuid, string const& _accountName, Address const& _address, h256 const& _passHash, string const& _passwordHint) { - if (!m_passwordInfo.count(_passHash)) - m_passwordInfo[_passHash] = _passInfo; + if (!m_passwordHint.count(_passHash)) + m_passwordHint[_passHash] = _passwordHint; m_addrLookup[_address] = _uuid; m_keyInfo[_uuid].passHash = _passHash; - m_keyInfo[_uuid].info = _info; + m_keyInfo[_uuid].accountName = _accountName; write(m_keysFile); } @@ -209,67 +215,92 @@ void KeyManager::kill(Address const& _a) m_store.kill(id); } -AddressHash KeyManager::accounts() const +Addresses KeyManager::accounts() const { - AddressHash ret; + Addresses ret; + ret.reserve(m_addrLookup.size()); for (auto const& i: m_addrLookup) if (m_keyInfo.count(i.second) > 0) - ret.insert(i.first); + ret.push_back(i.first); return ret; } -std::unordered_map> KeyManager::accountDetails() const +bool KeyManager::hasAccount(const Address& _address) const { - std::unordered_map> ret; - for (auto const& i: m_addrLookup) - if (m_keyInfo.count(i.second) > 0) - ret[i.first] = make_pair(m_keyInfo.count(i.second) ? m_keyInfo.at(i.second).info : "", m_keyInfo.count(i.second) && m_passwordInfo.count(m_keyInfo.at(i.second).passHash) ? m_passwordInfo.at(m_keyInfo.at(i.second).passHash) : ""); - return ret; + return m_addrLookup.count(_address) && m_keyInfo.count(m_addrLookup.at(_address)); +} + +string const& KeyManager::accountName(Address const& _address) const +{ + try + { + return m_keyInfo.at(m_addrLookup.at(_address)).accountName; + } + catch (...) + { + return EmptyString; + } +} + +string const& KeyManager::passwordHint(Address const& _address) const +{ + try + { + return m_passwordHint.at(m_keyInfo.at(m_addrLookup.at(_address)).passHash); + } + catch (...) + { + return EmptyString; + } } -h256 KeyManager::hashPassword(std::string const& _pass) const +h256 KeyManager::hashPassword(string const& _pass) const { // TODO SECURITY: store this a bit more securely; Scrypt perhaps? - return h256(pbkdf2(_pass, asBytes(m_password), 262144, 32)); + return h256(pbkdf2(_pass, asBytes(m_defaultPasswordDeprecated), 262144, 32)); +} + +void KeyManager::cachePassword(string const& _password) const +{ + m_cachedPasswords[hashPassword(_password)] = _password; } -bool KeyManager::write(std::string const& _keysFile) const +bool KeyManager::write(string const& _keysFile) const { - if (!m_key) + if (!m_keysFileKey) return false; - write(m_key, _keysFile); + write(m_keysFileKey, _keysFile); return true; } -void KeyManager::write(std::string const& _pass, std::string const& _keysFile) const +void KeyManager::write(string const& _pass, string const& _keysFile) const { bytes salt = h256::random().asBytes(); writeFile(_keysFile + ".salt", salt); auto key = h128(pbkdf2(_pass, salt, 262144, 16)); - m_cachedPasswords[hashPassword(_pass)] = _pass; + cachePassword(_pass); m_master = hashPassword(_pass); write(key, _keysFile); } -void KeyManager::write(h128 const& _key, std::string const& _keysFile) const +void KeyManager::write(h128 const& _key, string const& _keysFile) const { RLPStream s(4); - s << 1; - s.appendList(m_addrLookup.size()); - for (auto const& i: m_addrLookup) - if (m_keyInfo.count(i.second)) - { - auto ki = m_keyInfo.at(i.second); - s.appendList(4) << i.first << i.second << ki.passHash << ki.info; - } - s.appendList(m_passwordInfo.size()); - for (auto const& i: m_passwordInfo) + s << 1; // version + s.appendList(accounts().size()); + for (auto const& address: accounts()) + { + h128 id = uuid(address); + auto const& ki = m_keyInfo.at(id); + s.appendList(4) << address << id << ki.passHash << ki.accountName; + } + s.appendList(m_passwordHint.size()); + for (auto const& i: m_passwordHint) s.appendList(2) << i.first << i.second; - s.append(m_password); + s.append(m_defaultPasswordDeprecated); writeFile(_keysFile, encryptSymNoAuth(_key, h128(), &s.out())); - m_key = _key; - m_cachedPasswords[hashPassword(defaultPassword())] = defaultPassword(); - + m_keysFileKey = _key; + cachePassword(defaultPassword()); } diff --git a/libethcore/KeyManager.h b/libethcore/KeyManager.h index 62263c3c5..d9bb6457c 100644 --- a/libethcore/KeyManager.h +++ b/libethcore/KeyManager.h @@ -23,8 +23,9 @@ #include #include -#include #include +#include +#include namespace dev { @@ -35,14 +36,15 @@ class PasswordUnknown: public Exception {}; struct KeyInfo { KeyInfo() = default; - KeyInfo(h256 const& _passHash, std::string const& _info): passHash(_passHash), info(_info) {} + KeyInfo(h256 const& _passHash, std::string const& _accountName): passHash(_passHash), accountName(_accountName) {} - h256 passHash; ///< Hash of the password or h256() if unknown. - std::string info; ///< Name of the key, or JSON key info if begins with '{'. + h256 passHash; ///< Hash of the password or h256() / UnknownPassword if unknown. + std::string accountName; ///< Name of the key, or JSON key info if begins with '{'. }; -static const h256 UnknownPassword; -static const auto DontKnowThrow = [](){ throw PasswordUnknown(); return std::string(); }; +static h256 const UnknownPassword; +/// Password query function that never returns a password. +static auto const DontKnowThrow = [](){ throw PasswordUnknown(); return std::string(); }; enum class SemanticPassword { @@ -53,12 +55,15 @@ enum class SemanticPassword // TODO: This one is specifically for Ethereum, but we can make it generic in due course. // TODO: hidden-partition style key-store. /** - * @brief High-level manager of keys for Ethereum. + * @brief High-level manager of password-encrypted keys for Ethereum. * Usage: * * Call exists() to check whether there is already a database. If so, get the master password from * the user and call load() with it. If not, get a new master password from the user (get them to type * it twice and keep some hint around!) and call create() with it. + * + * Uses a "key file" (and a corresponding .salt file) that contains encrypted information about the keys and + * a directory called "secrets path" that contains a file for each key. */ class KeyManager { @@ -75,25 +80,37 @@ public: void save(std::string const& _pass) const { write(_pass, m_keysFile); } void notePassword(std::string const& _pass) { m_cachedPasswords[hashPassword(_pass)] = _pass; } - void noteHint(std::string const& _pass, std::string const& _hint) { if (!_hint.empty()) m_passwordInfo[hashPassword(_pass)] = _hint; } + void noteHint(std::string const& _pass, std::string const& _hint) { if (!_hint.empty()) m_passwordHint[hashPassword(_pass)] = _hint; } bool haveHint(std::string const& _pass) const { auto h = hashPassword(_pass); return m_cachedPasswords.count(h) && !m_cachedPasswords.at(h).empty(); } - AddressHash accounts() const; - std::unordered_map> accountDetails() const; - std::string const& hint(Address const& _a) const { try { return m_passwordInfo.at(m_keyInfo.at(m_addrLookup.at(_a)).passHash); } catch (...) { return EmptyString; } } - + /// @returns the list of account addresses. + Addresses accounts() const; + /// @returns a hashset of all account addresses. + AddressHash accountsHash() const { return AddressHash() + accounts(); } + bool hasAccount(Address const& _address) const; + /// @returns the human-readable name or json-encoded info of the account for the given address. + std::string const& accountName(Address const& _address) const; + /// @returns the password hint for the account for the given address; + std::string const& passwordHint(Address const& _address) const; + + /// @returns the uuid of the key for the address @a _a or the empty hash on error. h128 uuid(Address const& _a) const; + /// @returns the address corresponding to the key with uuid @a _uuid or the zero address on error. Address address(h128 const& _uuid) const; - h128 import(Secret const& _s, std::string const& _info, std::string const& _pass, std::string const& _passInfo); - h128 import(Secret const& _s, std::string const& _info) { return import(_s, _info, defaultPassword(), std::string()); } + h128 import(Secret const& _s, std::string const& _accountName, std::string const& _pass, std::string const& _passwordHint); + h128 import(Secret const& _s, std::string const& _accountName) { return import(_s, _accountName, defaultPassword(), std::string()); } SecretStore& store() { return m_store; } - void importExisting(h128 const& _uuid, std::string const& _info, std::string const& _pass, std::string const& _passInfo); - void importExisting(h128 const& _uuid, std::string const& _info) { importExisting(_uuid, _info, defaultPassword(), std::string()); } - void importExisting(h128 const& _uuid, std::string const& _info, Address const& _addr, h256 const& _passHash = h256(), std::string const& _passInfo = std::string()); + void importExisting(h128 const& _uuid, std::string const& _accountName, std::string const& _pass, std::string const& _passwordHint); + void importExisting(h128 const& _uuid, std::string const& _accountName) { importExisting(_uuid, _accountName, defaultPassword(), std::string()); } + void importExisting(h128 const& _uuid, std::string const& _accountName, Address const& _addr, h256 const& _passHash = h256(), std::string const& _passwordHint = std::string()); + /// @returns the secret key associated with an address provided the password query + /// function @a _pass or the zero-secret key on error. Secret secret(Address const& _address, std::function const& _pass = DontKnowThrow) const; + /// @returns the secret key associated with the uuid of a key provided the password query + /// function @a _pass or the zero-secret key on error. Secret secret(h128 const& _uuid, std::function const& _pass = DontKnowThrow) const; bool recode(Address const& _address, SemanticPassword _newPass, std::function const& _pass = DontKnowThrow, KDF _kdf = KDF::Scrypt); @@ -110,6 +127,9 @@ private: std::string defaultPassword(std::function const& _pass = DontKnowThrow) const { return getPassword(m_master, _pass); } h256 hashPassword(std::string const& _pass) const; + /// Stores the password by its hash in the password cache. + void cachePassword(std::string const& _password) const; + // Only use if previously loaded ok. // @returns false if wasn't previously loaded ok. bool write() const { return write(m_keysFile); } @@ -118,11 +138,15 @@ private: void write(h128 const& _key, std::string const& _keysFile) const; // Ethereum keys. + + /// Mapping address -> key uuid. std::unordered_map m_addrLookup; + /// Mapping key uuid -> key info. std::unordered_map m_keyInfo; - std::unordered_map m_passwordInfo; + /// Mapping password hash -> password hint. + std::unordered_map m_passwordHint; - // Passwords that we're storing. + // Passwords that we're storing. Mapping password hash -> password. mutable std::unordered_map m_cachedPasswords; // DEPRECATED. @@ -130,10 +154,10 @@ private: // Now the default password is based off the key of the keys file directly, so this is redundant // except for the fact that people have existing keys stored with it. Leave for now until/unless // we have an upgrade strategy. - std::string m_password; + std::string m_defaultPasswordDeprecated; mutable std::string m_keysFile; - mutable h128 m_key; + mutable h128 m_keysFileKey; mutable h256 m_master; SecretStore m_store; }; diff --git a/libweb3jsonrpc/AccountHolder.cpp b/libweb3jsonrpc/AccountHolder.cpp index abd0a1adf..3250eae6b 100644 --- a/libweb3jsonrpc/AccountHolder.cpp +++ b/libweb3jsonrpc/AccountHolder.cpp @@ -103,7 +103,7 @@ void AccountHolder::clearQueue(int _id) AddressHash SimpleAccountHolder::realAccounts() const { - return m_keyManager.accounts(); + return m_keyManager.accountsHash(); } void SimpleAccountHolder::authenticate(dev::eth::TransactionSkeleton const& _t) diff --git a/libweb3jsonrpc/AccountHolder.h b/libweb3jsonrpc/AccountHolder.h index 10b036226..559f8509a 100644 --- a/libweb3jsonrpc/AccountHolder.h +++ b/libweb3jsonrpc/AccountHolder.h @@ -48,7 +48,6 @@ class AccountHolder public: explicit AccountHolder(std::function const& _client): m_client(_client) {} - // easiest to return keyManager.addresses(); virtual AddressHash realAccounts() const = 0; // use m_web3's submitTransaction // or use AccountHolder::queueTransaction(_t) to accept diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index adef51033..f0e532c5c 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -157,19 +157,19 @@ Json::Value WebThreeStubServer::admin_eth_allAccounts(std::string const& _sessio u256 total = 0; u256 pendingtotal = 0; Address beneficiary; - for (auto const& i: m_keyMan.accountDetails()) + for (auto const& address: m_keyMan.accounts()) { - auto pending = m_web3.ethereum()->balanceAt(i.first, PendingBlock); - auto latest = m_web3.ethereum()->balanceAt(i.first, LatestBlock); + auto pending = m_web3.ethereum()->balanceAt(address, PendingBlock); + auto latest = m_web3.ethereum()->balanceAt(address, LatestBlock); Json::Value a; - if (i.first == beneficiary) + if (address == beneficiary) a["beneficiary"] = true; - a["address"] = toJS(i.first); + a["address"] = toJS(address); a["balance"] = toJS(latest); a["nicebalance"] = formatBalance(latest); a["pending"] = toJS(pending); a["nicepending"] = formatBalance(pending); - ret["accounts"][i.second.first] = a; + ret["accounts"][m_keyMan.accountName(address)] = a; total += latest; pendingtotal += pending; } From b381bc6f489b76b9986161f14fea0948a67b8769 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Tue, 16 Jun 2015 01:26:11 +0300 Subject: [PATCH 044/169] Script Coverage --- getcoverage.sh | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/getcoverage.sh b/getcoverage.sh index ac50bf94b..8d34d733c 100755 --- a/getcoverage.sh +++ b/getcoverage.sh @@ -10,35 +10,37 @@ then fi OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage" -TESTETH=$CPP_ETHEREUM_PATH/build #/test/CMakeFiles/testeth.dir +TESTETH=$CPP_ETHEREUM_PATH/build if which lcov >/dev/null; then if which genhtml >/dev/null; then - lcov --directory $TESTETH --zerocounters - echo Running testeth... - $CPP_ETHEREUM_PATH/build/test/testeth -t --all - $CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit --all - $CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit --all - echo Prepearing coverage info... + echo Cleaning previous report... + if [ -d "$OUTPUT_DIR" ]; then + rm -r $OUTPUT_DIR + fi + mkdir $OUTPUT_DIR + lcov --directory $TESTETH --zerocounters + lcov --capture --initial --directory $TESTETH --output-file $OUTPUT_DIR/coverage_base.info + + echo Running testeth... + $CPP_ETHEREUM_PATH/build/test/testeth --all + $CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit --all + $CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit --all + + echo Prepearing coverage info... + lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/coverage_test.info + lcov --add-tracefile $OUTPUT_DIR/coverage_base.info --add-tracefile $OUTPUT_DIR/coverage_test.info --output-file $OUTPUT_DIR/coverage_all.info + lcov --extract $OUTPUT_DIR/coverage_all.info *cpp-ethereum/* --output-file $OUTPUT_DIR/coverage_export.info + genhtml $OUTPUT_DIR/coverage_export.info --output-directory $OUTPUT_DIR/testeth else - echo genhtml not found - exit; + echo genhtml not found + exit; fi else echo lcov not found exit; fi -if [ -d "$OUTPUT_DIR" ]; then - echo Cleaning previous report... - rm -r $OUTPUT_DIR -fi - -mkdir $OUTPUT_DIR -lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/full_coverage.info -lcov --extract $OUTPUT_DIR/full_coverage.info *cpp-ethereum/* --output-file $OUTPUT_DIR/testeth_coverage.info -genhtml $OUTPUT_DIR/testeth_coverage.info --output-directory $OUTPUT_DIR/testeth - echo "Coverage info should be located at: $OUTPUT_DIR/testeth" echo "Opening index..." From efd1ff7bb5f43cb56d420b1da84250b56937d7a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 15 Jun 2015 14:43:42 +0200 Subject: [PATCH 045/169] Update llvm::IRBuilder::CreateCall to new API version. Buildbot bump. --- evmjit/libevmjit/Arith256.cpp | 4 ++-- evmjit/libevmjit/Compiler.cpp | 2 +- evmjit/libevmjit/GasMeter.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/evmjit/libevmjit/Arith256.cpp b/evmjit/libevmjit/Arith256.cpp index 029eb9370..95ca2aee5 100644 --- a/evmjit/libevmjit/Arith256.cpp +++ b/evmjit/libevmjit/Arith256.cpp @@ -167,8 +167,8 @@ llvm::Function* Arith256::getDivFunc(llvm::Type* _type) m_builder.SetInsertPoint(mainBB); auto ctlzIntr = llvm::Intrinsic::getDeclaration(getModule(), llvm::Intrinsic::ctlz, _type); // both y and r are non-zero - auto yLz = m_builder.CreateCall2(ctlzIntr, yArg, m_builder.getInt1(true), "y.lz"); - auto rLz = m_builder.CreateCall2(ctlzIntr, r0, m_builder.getInt1(true), "r.lz"); + auto yLz = m_builder.CreateCall(ctlzIntr, {yArg, m_builder.getInt1(true)}, "y.lz"); + auto rLz = m_builder.CreateCall(ctlzIntr, {r0, m_builder.getInt1(true)}, "r.lz"); auto i0 = m_builder.CreateNUWSub(yLz, rLz, "i0"); auto y0 = m_builder.CreateShl(yArg, i0); m_builder.CreateBr(loopBB); diff --git a/evmjit/libevmjit/Compiler.cpp b/evmjit/libevmjit/Compiler.cpp index d5cb493ab..e49979294 100644 --- a/evmjit/libevmjit/Compiler.cpp +++ b/evmjit/libevmjit/Compiler.cpp @@ -148,7 +148,7 @@ std::unique_ptr Compiler::compile(code_iterator _begin, code_itera auto fp = m_builder.CreateCall(frameaddress, m_builder.getInt32(0), "fp"); m_builder.CreateStore(fp, jmpBufWords); auto stacksave = llvm::Intrinsic::getDeclaration(module.get(), llvm::Intrinsic::stacksave); - auto sp = m_builder.CreateCall(stacksave, "sp"); + auto sp = m_builder.CreateCall(stacksave, {}, "sp"); auto jmpBufSp = m_builder.CreateConstInBoundsGEP1_64(jmpBufWords, 2, "jmpBuf.sp"); m_builder.CreateStore(sp, jmpBufSp); auto setjmp = llvm::Intrinsic::getDeclaration(module.get(), llvm::Intrinsic::eh_sjlj_setjmp); diff --git a/evmjit/libevmjit/GasMeter.cpp b/evmjit/libevmjit/GasMeter.cpp index c0a2ed287..4cd053316 100644 --- a/evmjit/libevmjit/GasMeter.cpp +++ b/evmjit/libevmjit/GasMeter.cpp @@ -217,7 +217,7 @@ void GasMeter::countExp(llvm::Value* _exponent) // OPT: Can gas update be done in exp algorithm? auto ctlz = llvm::Intrinsic::getDeclaration(getModule(), llvm::Intrinsic::ctlz, Type::Word); - auto lz256 = m_builder.CreateCall2(ctlz, _exponent, m_builder.getInt1(false)); + auto lz256 = m_builder.CreateCall(ctlz, {_exponent, m_builder.getInt1(false)}); auto lz = m_builder.CreateTrunc(lz256, Type::Gas, "lz"); auto sigBits = m_builder.CreateSub(m_builder.getInt64(256), lz, "sigBits"); auto sigBytes = m_builder.CreateUDiv(m_builder.CreateAdd(sigBits, m_builder.getInt64(7)), m_builder.getInt64(8)); From 9ae15d5474d245ace0dc590bf9c24a2ebf5a55b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 16 Jun 2015 09:18:53 +0200 Subject: [PATCH 046/169] Set required LLVM version to 3.7. --- evmjit/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/evmjit/CMakeLists.txt b/evmjit/CMakeLists.txt index fa9b08f48..5da512c99 100644 --- a/evmjit/CMakeLists.txt +++ b/evmjit/CMakeLists.txt @@ -16,7 +16,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") endif() # LLVM -find_package(LLVM REQUIRED CONFIG) +find_package(LLVM 3.7 REQUIRED CONFIG) message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") add_definitions(${LLVM_DEFINITIONS}) From 623a24ff9903f132ac218f1dd97f8659041f44b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 16 Jun 2015 10:38:10 +0200 Subject: [PATCH 047/169] Set code hash in FakeExtVM. --- test/libevm/vm.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/test/libevm/vm.cpp b/test/libevm/vm.cpp index 5bbab2e1c..ea9339f05 100644 --- a/test/libevm/vm.cpp +++ b/test/libevm/vm.cpp @@ -323,6 +323,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) fev.thisTxCode = get<3>(fev.addresses.at(fev.myAddress)); fev.code = fev.thisTxCode; } + fev.codeHash = sha3(fev.code); bytes output; bool vmExceptionOccured = false; From bab25a2bd736f8e348fce72eb671e8285e526771 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2015 11:28:35 +0200 Subject: [PATCH 048/169] Style. --- libsolidity/CompilerUtils.cpp | 36 ++++++++++++++++-------------- libsolidity/ExpressionCompiler.cpp | 20 ++++++++++++----- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index 6110fdf71..349877a29 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -110,11 +110,11 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound if (type.location() == ReferenceType::Location::CallData) { // stack: target source_offset source_len - m_context << eth::Instruction::DUP1 << eth::Instruction::DUP3 << eth::Instruction::DUP5 + m_context << eth::Instruction::DUP1 << eth::Instruction::DUP3 << eth::Instruction::DUP5; // stack: target source_offset source_len source_len source_offset target - << eth::Instruction::CALLDATACOPY - << eth::Instruction::DUP3 << eth::Instruction::ADD - << eth::Instruction::SWAP2 << eth::Instruction::POP << eth::Instruction::POP; + m_context << eth::Instruction::CALLDATACOPY; + m_context << eth::Instruction::DUP3 << eth::Instruction::ADD; + m_context << eth::Instruction::SWAP2 << eth::Instruction::POP << eth::Instruction::POP; } else if (type.location() == ReferenceType::Location::Memory) { @@ -200,16 +200,16 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound // stack here: memory_end_offset storage_data_offset memory_offset eth::AssemblyItem loopStart = m_context.newTag(); - m_context << loopStart - // load and store - << eth::Instruction::DUP2 << eth::Instruction::SLOAD - << eth::Instruction::DUP2 << eth::Instruction::MSTORE - // increment storage_data_offset by 1 - << eth::Instruction::SWAP1 << u256(1) << eth::Instruction::ADD - // increment memory offset by 32 - << eth::Instruction::SWAP1 << u256(32) << eth::Instruction::ADD - // check for loop condition - << eth::Instruction::DUP1 << eth::Instruction::DUP4 << eth::Instruction::GT; + m_context << loopStart; + // load and store + m_context << eth::Instruction::DUP2 << eth::Instruction::SLOAD; + m_context << eth::Instruction::DUP2 << eth::Instruction::MSTORE; + // increment storage_data_offset by 1 + m_context << eth::Instruction::SWAP1 << u256(1) << eth::Instruction::ADD; + // increment memory offset by 32 + m_context << eth::Instruction::SWAP1 << u256(32) << eth::Instruction::ADD; + // check for loop condition + m_context << eth::Instruction::DUP1 << eth::Instruction::DUP4 << eth::Instruction::GT; m_context.appendConditionalJumpTo(loopStart); // stack here: memory_end_offset storage_data_offset memory_offset if (_padToWordBoundaries) @@ -368,9 +368,11 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp if (targetType.getNumBytes() == 0) m_context << eth::Instruction::DUP1 << eth::Instruction::XOR; else - m_context << (u256(1) << (256 - targetType.getNumBytes() * 8)) - << eth::Instruction::DUP1 << eth::Instruction::SWAP2 - << eth::Instruction::DIV << eth::Instruction::MUL; + { + m_context << (u256(1) << (256 - targetType.getNumBytes() * 8)); + m_context << eth::Instruction::DUP1 << eth::Instruction::SWAP2; + m_context << eth::Instruction::DIV << eth::Instruction::MUL; + } } } } diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index d5ffd35b4..12274c7ab 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -436,8 +436,10 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall) _functionCall.getExpression().accept(*this); m_context << u256(0); // do not send gas (there still is the stipend) arguments.front()->accept(*this); - utils().convertType(*arguments.front()->getType(), - *function.getParameterTypes().front(), true); + utils().convertType( + *arguments.front()->getType(), + *function.getParameterTypes().front(), true + ); appendExternalFunctionCall( FunctionType( TypePointers{}, @@ -612,13 +614,19 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) case Type::Category::Integer: if (member == "balance") { - utils().convertType(*_memberAccess.getExpression().getType(), - IntegerType(0, IntegerType::Modifier::Address), true); + utils().convertType( + *_memberAccess.getExpression().getType(), + IntegerType(0, IntegerType::Modifier::Address), + true + ); m_context << eth::Instruction::BALANCE; } else if ((set{"send", "call", "callcode"}).count(member)) - utils().convertType(*_memberAccess.getExpression().getType(), - IntegerType(0, IntegerType::Modifier::Address), true); + utils().convertType( + *_memberAccess.getExpression().getType(), + IntegerType(0, IntegerType::Modifier::Address), + true + ); else BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Invalid member access to integer.")); break; From e23d6f68d7d8f334ddd03852568e9a5b6b71f1ef Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 16 Jun 2015 11:33:57 +0200 Subject: [PATCH 049/169] add ability to have invalid Pow in BlockChaintests --- test/libethereum/blockchain.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 2c4a0b498..50e10bb8a 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -581,6 +581,12 @@ mArray importUncles(mObject const& _blObj, vector& _vBiUncles, vector } updatePoW(uncleBlockFromFields); + if (overwrite == "nonce" || overwrite == "mixHash") + { + uncleBlockFromFields.nonce = overwrite == "nonce" ? Nonce(uncleHeaderObj["nonce"].get_str()) : uncleBlockFromFields.nonce; + uncleBlockFromFields.mixHash = overwrite == "mixHash" ? h256(uncleHeaderObj["mixHash"].get_str()) : uncleBlockFromFields.mixHash; + } + writeBlockHeaderToJson(uncleHeaderObj, uncleBlockFromFields); aUncleList.push_back(uncleHeaderObj); @@ -677,16 +683,18 @@ void overwriteBlockHeader(BlockInfo& _header, mObject& _blObj) tmp.timestamp = toInt(ho["timestamp"]); if (ho.count("extraData")) tmp.extraData = importByteArray(ho["extraData"].get_str()); - if (ho.count("mixHash")) - tmp.mixHash = h256(ho["mixHash"].get_str()); - tmp.noteDirty(); // find new valid nonce if (tmp != _header) - { mine(tmp); - _header = tmp; - } + + if (ho.count("mixHash")) + tmp.mixHash = h256(ho["mixHash"].get_str()); + if (ho.count("nonce")) + tmp.nonce = Nonce(ho["nonce"].get_str()); + + tmp.noteDirty(); + _header = tmp; } else { From a6bb3d4302f694a6821743d24b0a480c2556115a Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 16 Jun 2015 11:34:31 +0200 Subject: [PATCH 050/169] add invalid PoW in blockheader tests --- .../bcInvalidHeaderTestFiller.json | 118 ++++++++++++++++++ 1 file changed, 118 insertions(+) diff --git a/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json b/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json index a800f86bf..83e541da1 100644 --- a/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json +++ b/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json @@ -176,6 +176,124 @@ ] }, + "wrongMixHash" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "3141592", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "mixHash" : "0xbad81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + + "wrongNonce" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "3141592", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "nonce" : "0x0102030405060708" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + "wrongDifficulty" : { "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", From a3823da2babeb618217d9edc4022c270161953a8 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 16 Jun 2015 11:35:03 +0200 Subject: [PATCH 051/169] add invalid PoW in uncle blockheader tests --- .../bcUncleHeaderValiditiyFiller.json | 210 ++++++++++++++++++ 1 file changed, 210 insertions(+) diff --git a/test/libethereum/BlockTestsFiller/bcUncleHeaderValiditiyFiller.json b/test/libethereum/BlockTestsFiller/bcUncleHeaderValiditiyFiller.json index ee36e230d..498486fdf 100644 --- a/test/libethereum/BlockTestsFiller/bcUncleHeaderValiditiyFiller.json +++ b/test/libethereum/BlockTestsFiller/bcUncleHeaderValiditiyFiller.json @@ -418,6 +418,216 @@ ] }, + "wrongMixHash" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "231072", + "extraData" : "0x42", + "gasLimit" : "3141592", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "314159", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "314159", + "gasPrice" : "1", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "314159", + "gasPrice" : "1", + "nonce" : "2", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + { + "overwriteAndRedoPoW" : "mixHash", + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "acde5374fce5edbc8e2a8697c15331677e6ebf0b", + "difficulty" : "230847", + "extraData" : "0x", + "gasLimit" : "3141593", + "gasUsed" : "150000", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "bad7f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "18a524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "142813170", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ] + }, + + "nonceWrong" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "231072", + "extraData" : "0x42", + "gasLimit" : "3141592", + "gasUsed" : "0", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "30" + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "nonce" : "3" + }, + "acde5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "1312500000000000000" + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "10000000000000", + "nonce" : "0", + "code" : "", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "314159", + "gasPrice" : "1", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "314159", + "gasPrice" : "1", + "nonce" : "1", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + ] + }, + { + "transactions" : [ + { + "data" : "", + "gasLimit" : "314159", + "gasPrice" : "1", + "nonce" : "2", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "10" + } + ], + "uncleHeaders" : [ + { + "overwriteAndRedoPoW" : "nonce", + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "acde5374fce5edbc8e2a8697c15331677e6ebf0b", + "difficulty" : "230847", + "extraData" : "0x", + "gasLimit" : "3141593", + "gasUsed" : "150000", + "hash" : "9de9879b6a81d1b6c4993c63c90a3c9d1e775f14572694778e828bc64972ae04", + "mixHash" : "b557f905d29ed0fca99d65d0adcce698dee97cf72a13c7cd8d7a7826b8eee770", + "nonce" : "bad524c1790fa83b", + "number" : "2", + "parentHash" : "6134fc6b5d99ee03c4aab1592640f6f9dcbc850668d75d631aee34989b938fae", + "receiptTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "ff640b30d613c35dad43e3693329e1b1ee6350f989cf46a288025a1cbfdab9cd", + "timestamp" : "142813170", + "transactionsTrie" : "56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + } + ] + } + ] + }, + "gasLimitTooHigh" : { "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", From 4bb4a8aa609e952db39cc833963b5958582900b3 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Tue, 16 Jun 2015 12:05:15 +0200 Subject: [PATCH 052/169] Add cmake command for OpenCL kernel code The OpenCL kernel gets parsed and copied into a byte array accessible by a specific header during the cmake configuration step. We are now adding a special command "make clbin2h" which would generate this header byte array on demand --- libethash-cl/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libethash-cl/CMakeLists.txt b/libethash-cl/CMakeLists.txt index fdc2dad07..6533bf794 100644 --- a/libethash-cl/CMakeLists.txt +++ b/libethash-cl/CMakeLists.txt @@ -5,6 +5,16 @@ bin2h(SOURCE_FILE ethash_cl_miner_kernel.cl VARIABLE_NAME ethash_cl_miner_kernel HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h) +# Add a custom command so that the user can regenerate the header file containing the kernel +# code's bytearray by running "make clbin2h" + add_custom_target(clbin2h) + add_custom_command(TARGET clbin2h + PRE_BUILD + COMMAND ${CMAKE_COMMAND} -DBIN2H_SOURCE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/ethash_cl_miner_kernel.cl" + -DBIN2H_VARIABLE_NAME=ethash_cl_miner_kernel + -DBIN2H_HEADER_FILE="${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h" + -P "${CMAKE_CURRENT_SOURCE_DIR}/bin2h.cmake") + aux_source_directory(. SRC_LIST) file(GLOB HEADERS "*.h") From 1bc547dc480f573d9d78b3700697143b4dc42113 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 16 Jun 2015 12:10:48 +0200 Subject: [PATCH 053/169] check nonce --- libethereum/BlockChain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index bd6996a45..195f65f1d 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -1072,7 +1072,7 @@ VerifiedBlockRef BlockChain::verifyBlock(bytes const& _block, function Date: Tue, 16 Jun 2015 12:58:52 +0200 Subject: [PATCH 054/169] - array validation in QML - compliant with multi dim/dynamic array --- mix/ContractCallDataEncoder.cpp | 116 +++++++++++++++++++++++--------- mix/ContractCallDataEncoder.h | 5 +- mix/qml/js/InputValidator.js | 113 +++++++++++++++++++++++++++---- 3 files changed, 187 insertions(+), 47 deletions(-) diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index 07ab8dd73..08e764955 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -20,15 +20,19 @@ * Ethereum IDE client. */ -#include +#include #include #include +#include +#include +#include #include #include #include "QVariableDeclaration.h" #include "QVariableDefinition.h" #include "QFunctionDefinition.h" #include "ContractCallDataEncoder.h" +using namespace std; using namespace dev; using namespace dev::solidity; using namespace dev::mix; @@ -38,13 +42,18 @@ bytes ContractCallDataEncoder::encodedData() bytes r(m_encodedData); size_t headerSize = m_encodedData.size() & ~0x1fUL; //ignore any prefix that is not 32-byte aligned //apply offsets - for (auto const& p: m_offsetMap) + for (auto const& p: m_dynamicOffsetMap) + { + vector_ref offsetRef(m_dynamicData.data() + p.first, 32); + toBigEndian>(p.second + headerSize, offsetRef); //add header size minus signature hash + } + for (auto const& p: m_staticOffsetMap) { vector_ref offsetRef(r.data() + p.first, 32); toBigEndian>(p.second + headerSize, offsetRef); //add header size minus signature hash } - - r.insert(r.end(), m_dynamicData.begin(), m_dynamicData.end()); + if (m_dynamicData.size() > 0) + r.insert(r.end(), m_dynamicData.begin(), m_dynamicData.end()); return r; } @@ -54,54 +63,95 @@ void ContractCallDataEncoder::encode(QFunctionDefinition const* _function) m_encodedData.insert(m_encodedData.end(), hash.begin(), hash.end()); } +void ContractCallDataEncoder::encodeArray(QJsonArray const& _array, QList _dim, SolidityType const& _type, bytes& _content) +{ + size_t offsetStart = _content.size(); + if (_dim[0] == -1) + { + bytes count = bytes(32); + toBigEndian((u256)_array.size(), count); + _content += count; //reserved space for count + } + _dim.pop_front(); + + int k = 0; + for (QJsonValue const& c: _array) + { + if (c.isArray()) + { + if (_dim[0] == -1) + { + m_dynamicOffsetMap.push_back(std::make_pair(m_dynamicData.size() + offsetStart + 32 + k * 32, + m_dynamicData.size() + _content.size())); + } + encodeArray(c.toArray(), _dim, _type, _content); + } + else + { + // encode single item + if (c.isDouble()) + encodeSingleItem(QString::number(c.toDouble()), _type, _content); + else if (c.isString()) + encodeSingleItem(c.toString(), _type, _content); + } + k++; + } +} + void ContractCallDataEncoder::encode(QVariant const& _data, SolidityType const& _type) { - u256 count = 1; QStringList strList; + vector dim; if (_type.array) { - if (_data.type() == QVariant::String) - strList = _data.toString().split(",", QString::SkipEmptyParts); //TODO: proper parsing - else - strList = _data.toStringList(); - count = strList.count(); + QList dim = extractDimension(_type. name); + bytes content; + QJsonDocument jsonResponse = QJsonDocument::fromJson(_data.toString().toUtf8()); + QJsonArray jsonObject = jsonResponse.array(); + size_t size = m_encodedData.size(); + if (dim[0] == -1) + { + m_encodedData += bytes(32); // reserve space for offset + m_staticOffsetMap.push_back(std::make_pair(size, m_dynamicData.size())); + } + encodeArray(jsonObject, dim, _type, content); + if (!_type.dynamicSize) + m_encodedData.insert(m_encodedData.end(), content.begin(), content.end()); + else + m_dynamicData.insert(m_dynamicData.end(), content.begin(), content.end()); } - else - strList.append(_data.toString()); - - if (_type.dynamicSize) + else if (_type.dynamicSize && _type.type == SolidityType::Type::Bytes) { bytes empty(32); size_t sizePos = m_dynamicData.size(); m_dynamicData += empty; //reserve space for count - if (_type.type == SolidityType::Type::Bytes) - count = encodeSingleItem(_data.toString(), _type, m_dynamicData); - else - { - count = strList.count(); - for (auto const& item: strList) - encodeSingleItem(item, _type, m_dynamicData); - } + u256 count = encodeSingleItem(_data.toString(), _type, m_dynamicData); vector_ref sizeRef(m_dynamicData.data() + sizePos, 32); toBigEndian(count, sizeRef); - m_offsetMap.push_back(std::make_pair(m_encodedData.size(), sizePos)); + m_staticOffsetMap.push_back(std::make_pair(m_encodedData.size(), sizePos)); m_encodedData += empty; //reserve space for offset } else + encodeSingleItem(_data.toString(), _type, m_encodedData); +} + +QList ContractCallDataEncoder::extractDimension(QString const& _type) +{ + QList dim; + QRegExp dimExtract("(\\[[^\\]]*\\])"); + int pos = dimExtract.indexIn(_type); + while (pos != -1) { - if (_type.array) - count = _type.count; - int c = static_cast(count); - if (strList.size() > c) - strList.erase(strList.begin() + c, strList.end()); + QString d = dimExtract.cap(0); + pos += d.length(); + pos = dimExtract.indexIn(_type, pos); + if (d == "[]") + dim.push_front(-1); else - while (strList.size() < c) - strList.append(QString()); - - for (auto const& item: strList) - encodeSingleItem(item, _type, m_encodedData); + dim.push_front(d.replace("[", "").replace("]", "").toInt()); } + return dim; } unsigned ContractCallDataEncoder::encodeSingleItem(QString const& _data, SolidityType const& _type, bytes& _dest) diff --git a/mix/ContractCallDataEncoder.h b/mix/ContractCallDataEncoder.h index 2707845ae..629e46b0d 100644 --- a/mix/ContractCallDataEncoder.h +++ b/mix/ContractCallDataEncoder.h @@ -69,11 +69,14 @@ private: QString toString(bool _b); QString toString(dev::bytes const& _b); bool asString(dev::bytes const& _b, QString& _str); + QList extractDimension(QString const& _type); + void encodeArray(QJsonArray const& _array, QList _dim, SolidityType const& _type, bytes& _content); private: bytes m_encodedData; bytes m_dynamicData; - std::vector> m_offsetMap; + std::vector> m_dynamicOffsetMap; + std::vector> m_staticOffsetMap; }; } diff --git a/mix/qml/js/InputValidator.js b/mix/qml/js/InputValidator.js index 37185b898..8a8ef1715 100644 --- a/mix/qml/js/InputValidator.js +++ b/mix/qml/js/InputValidator.js @@ -1,27 +1,20 @@ Qt.include("QEtherHelper.js") var nbRegEx = new RegExp('^[0-9]+$'); +var arrayRegEx = new RegExp('\\[[^\\]]*\\]', "g"); +var capturenbRegEx = new RegExp("[0-9]+"); + function validate(model, values) { var inError = []; for (var k in model) { + init() if (values[model[k].name]) { var type = model[k].type.name; - var res; - if (isContractType(type)) - res = validateAddress(type, values[model[k].name]); - else if (type.indexOf("int") !== -1) - res = validateInt(type, values[model[k].name]); - else if (type.indexOf("bytes") !== -1) - res = validateBytes(type, values[model[k].name]); - else if (type.indexOf("bool") !== -1) - res = validateBool(type, values[model[k].name]); - else if (type.indexOf("address") !== -1) - res = validateAddress(type, values[model[k].name]); - else - res.valid = true; + var value = values[model[k].name]; + var res = check(type, value) if (!res.valid) inError.push({ type: type, value: values, message: res.message }); } @@ -29,6 +22,100 @@ function validate(model, values) return inError; } +function init() +{ + nbRegEx = new RegExp('^[0-9]+$'); + arrayRegEx = new RegExp('\\[[^\\]]*\\]', "g"); + capturenbRegEx = new RegExp("[0-9]+"); +} + +function check(type, value) +{ + var res = { valid: true, message : "" } + if (isContractType(type)) + res = validateAddress(type, value); + else if (isArray(type)) + res = validateArray(type, value); + else if (type.indexOf("int") !== -1) + res = validateInt(type, value); + else if (type.indexOf("bytes") !== -1) + res = validateBytes(type, value); + else if (type.indexOf("bool") !== -1) + res = validateBool(type, value); + else if (type.indexOf("address") !== -1) + res = validateAddress(type, value); + else + { + res.valid = true + res.message = "" + } + return res; +} + +function isArray(_type) +{ + if (!arrayRegEx.test(_type)) + return false + else + return (_type.indexOf("int") !== -1 || _type.indexOf("bytes") !== -1 || _type.indexOf("bool") !== -1 || _type.indexOf("adress") !== -1) +} + +function checkArrayRecursively(_type, _dim, _array) +{ + if (_array instanceof Array) + { + if (_dim.length === 0) + return { valid: false, message: "Your input contains too many dimensions" } + var size = -1 + var infinite = false + if (_dim === "[]") + infinite = true + else + size = parseInt(capturenbRegEx.exec(_dim[0])) + if (_array.length > size && !infinite) + return { valid: false, message: "Array size does not correspond. Should be " + _dim[0] } + if (_array.length > 0) + { + var _newdim = _dim.slice(0) + _newdim.splice(0, 1) + for (var i = 0; i < _array.length; i++) + { + var ret = checkArrayRecursively(_type, _newdim, _array[i]) + if (!ret.valid) + return ret + } + } + return { valid: true, message: "" } + } + else + { + if (_dim.length > 0) + return { valid: false, message: "Your input contains too few dimensions" } + if (typeof(_array) === "number") + _array = '' + _array + '' + return check(_type, _array) + } +} + +function validateArray(_type, _value) +{ + try + { + _value = JSON.parse(_value) + } + catch (e) + { + return { valid: false, message: "Input must be JSON formatted like [1,5,3,9] or [[4,9],[4,9],[4,9],[4,9]]" } + } + var dim = _type.match(arrayRegEx) + dim.reverse(); + for (var k = 0; k < dim.length; k++) + { + _type = _type.replace(dim[k], "") + } + return checkArrayRecursively(_type, dim, _value) +} + function isContractType(_type) { for (var k in Object.keys(codeModel.contracts)) From c19fb34c9ab4de7cc43c5f43be5ea141ccf19a09 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Tue, 16 Jun 2015 13:29:16 +0200 Subject: [PATCH 055/169] quick_difficulty_check difficulty argument clarification The argument passed into ethash_quick_check_difficulty is not the actual difficulty but it's 2^256 divided by the difficulty. --- internal.c | 4 ++-- internal.h | 21 +++++++++++++++------ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/internal.c b/internal.c index b28a59e43..338aa5ecd 100644 --- a/internal.c +++ b/internal.c @@ -284,13 +284,13 @@ bool ethash_quick_check_difficulty( ethash_h256_t const* header_hash, uint64_t const nonce, ethash_h256_t const* mix_hash, - ethash_h256_t const* difficulty + ethash_h256_t const* boundary ) { ethash_h256_t return_hash; ethash_quick_hash(&return_hash, header_hash, nonce, mix_hash); - return ethash_check_difficulty(&return_hash, difficulty); + return ethash_check_difficulty(&return_hash, boundary); } ethash_light_t ethash_light_new_internal(uint64_t cache_size, ethash_h256_t const* seed) diff --git a/internal.h b/internal.h index 4e2b695ac..26c395ad6 100644 --- a/internal.h +++ b/internal.h @@ -46,27 +46,36 @@ static inline void ethash_h256_reset(ethash_h256_t* hash) memset(hash, 0, 32); } -// Returns if hash is less than or equal to difficulty +// Returns if hash is less than or equal to boundary (2^256/difficulty) static inline bool ethash_check_difficulty( ethash_h256_t const* hash, - ethash_h256_t const* difficulty + ethash_h256_t const* boundary ) { - // Difficulty is big endian + // Boundary is big endian for (int i = 0; i < 32; i++) { - if (ethash_h256_get(hash, i) == ethash_h256_get(difficulty, i)) { + if (ethash_h256_get(hash, i) == ethash_h256_get(boundary, i)) { continue; } - return ethash_h256_get(hash, i) < ethash_h256_get(difficulty, i); + return ethash_h256_get(hash, i) < ethash_h256_get(boundary, i); } return true; } +/** + * Difficulty quick check for POW preverification + * + * @param header_hash The hash of the header + * @param nonce The block's nonce + * @param mix_hash The mix digest hash + * @param boundary The boundary is defined as (2^256 / difficulty) + * @return true for succesful pre-verification and false otherwise + */ bool ethash_quick_check_difficulty( ethash_h256_t const* header_hash, uint64_t const nonce, ethash_h256_t const* mix_hash, - ethash_h256_t const* difficulty + ethash_h256_t const* boundary ); struct ethash_light { From e486ce32f16999a842af42627dcec2c076fc1820 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 16 Jun 2015 13:33:36 +0200 Subject: [PATCH 056/169] add diff is zero test --- .../bcInvalidHeaderTestFiller.json | 59 +++++++++++++++++++ test/libethereum/blockchain.cpp | 2 +- 2 files changed, 60 insertions(+), 1 deletion(-) diff --git a/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json b/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json index 83e541da1..3084db0d7 100644 --- a/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json +++ b/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json @@ -353,6 +353,65 @@ ] }, + "DifficultyIsZero" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "0x8888f1f195afa192cfee860698584c030f4c9db1", + "difficulty" : "131072", + "extraData" : "0x42", + "gasLimit" : "3141592", + "gasUsed" : "0", + "mixHash" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "stateRoot" : "0xf99eb1626cfa6db435c0836235942d7ccaa935f1ae247d3f1c21e495685f903a", + "timestamp" : "0x54c98c81", + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" + }, + "expect" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100" + } + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "100000000000", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "100", + "nonce" : "0", + "code" : "{ (MSTORE 0 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) (LOG1 0 32 0) }", + "storage": {} + } + }, + "blocks" : [ + { + "blockHeader" : { + "difficulty" : "0" + }, + "transactions" : [ + { + "data" : "", + "gasLimit" : "50000", + "gasPrice" : "10", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "5000" + } + ], + "uncleHeaders" : [ + ] + } + ] + }, + "DifferentExtraData1025" : { "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 50e10bb8a..2dc30c6ba 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -685,7 +685,7 @@ void overwriteBlockHeader(BlockInfo& _header, mObject& _blObj) tmp.extraData = importByteArray(ho["extraData"].get_str()); // find new valid nonce - if (tmp != _header) + if (tmp != _header && tmp.difficulty) mine(tmp); if (ho.count("mixHash")) From 0ea695c699c21affeca39cf33ae488a120400eda Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 16 Jun 2015 13:41:05 +0200 Subject: [PATCH 057/169] fix for #2194 #2145 --- mix/ContractCallDataEncoder.cpp | 13 +++++++++---- mix/ContractCallDataEncoder.h | 1 + mix/qml/js/ProjectModel.js | 9 ++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index 08e764955..bc3322145 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -248,12 +248,15 @@ dev::bytes ContractCallDataEncoder::decodeBytes(dev::bytes const& _rawValue) } QString ContractCallDataEncoder::toString(dev::bytes const& _b) +{ + return QString::fromStdString(dev::toJS(_b)); +} + +QString ContractCallDataEncoder::toChar(dev::bytes const& _b) { QString str; - if (asString(_b, str)) - return "\"" + str + "\" " + QString::fromStdString(dev::toJS(_b)); - else - return QString::fromStdString(dev::toJS(_b)); + asString(_b, str); + return str; } @@ -269,6 +272,8 @@ QVariant ContractCallDataEncoder::decode(SolidityType const& _type, bytes const& return QVariant::fromValue(toString(decodeBool(rawParam))); else if (type == QSolidityType::Type::Bytes || type == QSolidityType::Type::Hash) return QVariant::fromValue(toString(decodeBytes(rawParam))); + else if (type == QSolidityType::Type::String) + return QVariant::fromValue(toChar(decodeBytes(rawParam))); else if (type == QSolidityType::Type::Struct) return QVariant::fromValue(QString("struct")); //TODO else if (type == QSolidityType::Type::Address) diff --git a/mix/ContractCallDataEncoder.h b/mix/ContractCallDataEncoder.h index 629e46b0d..bec048c50 100644 --- a/mix/ContractCallDataEncoder.h +++ b/mix/ContractCallDataEncoder.h @@ -71,6 +71,7 @@ private: bool asString(dev::bytes const& _b, QString& _str); QList extractDimension(QString const& _type); void encodeArray(QJsonArray const& _array, QList _dim, SolidityType const& _type, bytes& _content); + QString toChar(dev::bytes const& _b); private: bytes m_encodedData; diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 6fce7686d..f9c7a611c 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -252,8 +252,10 @@ function doCreateProject(title, path) { files: [ contractsFile, indexFile ] }; //TODO: copy from template - fileIo.writeFile(dirPath + indexFile, htmlTemplate); - fileIo.writeFile(dirPath + contractsFile, contractTemplate); + if (!fileIo.fileExists(dirPath + indexFile)) + fileIo.writeFile(dirPath + indexFile, htmlTemplate); + if (!fileIo.fileExists(dirPath + contractsFile)) + fileIo.writeFile(dirPath + contractsFile, contractTemplate); newProject(projectData); var json = JSON.stringify(projectData, null, "\t"); fileIo.writeFile(projectFile, json); @@ -340,7 +342,8 @@ function newContract() { function createAndAddFile(name, extension, content) { var fileName = generateFileName(name, extension); var filePath = projectPath + fileName; - fileIo.writeFile(filePath, content); + if (!fileIo.fileExists(filePath)) + fileIo.writeFile(filePath, content); var id = addFile(fileName); saveProjectFile(); documentAdded(id); From be2ed88d2f6bc265906fee8a4f9589d92bb7d686 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Tue, 16 Jun 2015 15:25:29 +0300 Subject: [PATCH 058/169] Coverage script --- getcoverage.sh | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/getcoverage.sh b/getcoverage.sh index 8d34d733c..196629170 100755 --- a/getcoverage.sh +++ b/getcoverage.sh @@ -1,17 +1,33 @@ #!/bin/bash CPP_ETHEREUM_PATH=$(pwd) - -which $CPP_ETHEREUM_PATH/build/test/testeth >/dev/null 2>&1 +BUILD_DIR=$CPP_ETHEREUM_PATH/build +TEST_MODE="" + +for i in "$@" +do +case $i in + -builddir) + shift + ((i++)) + BUILD_DIR=${!i} + shift + ;; + --all) + TEST_MODE="--all" + shift + ;; +esac +done + +which $BUILD_DIR/test/testeth >/dev/null 2>&1 if [ $? != 0 ] then echo "You need to compile and build ethereum with cmake -DPROFILING option to the build dir!" exit; fi -OUTPUT_DIR="$CPP_ETHEREUM_PATH/build/test/coverage" -TESTETH=$CPP_ETHEREUM_PATH/build - +OUTPUT_DIR=$BUILD_DIR/test/coverage if which lcov >/dev/null; then if which genhtml >/dev/null; then echo Cleaning previous report... @@ -19,16 +35,16 @@ if which lcov >/dev/null; then rm -r $OUTPUT_DIR fi mkdir $OUTPUT_DIR - lcov --directory $TESTETH --zerocounters - lcov --capture --initial --directory $TESTETH --output-file $OUTPUT_DIR/coverage_base.info + lcov --directory $BUILD_DIR --zerocounters + lcov --capture --initial --directory $BUILD_DIR --output-file $OUTPUT_DIR/coverage_base.info echo Running testeth... - $CPP_ETHEREUM_PATH/build/test/testeth --all - $CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit --all - $CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit --all + $CPP_ETHEREUM_PATH/build/test/testeth $TEST_MODE + $CPP_ETHEREUM_PATH/build/test/testeth -t StateTests --jit $TEST_MODE + $CPP_ETHEREUM_PATH/build/test/testeth -t VMTests --jit $TEST_MODE echo Prepearing coverage info... - lcov --capture --directory $TESTETH --output-file $OUTPUT_DIR/coverage_test.info + lcov --capture --directory $BUILD_DIR --output-file $OUTPUT_DIR/coverage_test.info lcov --add-tracefile $OUTPUT_DIR/coverage_base.info --add-tracefile $OUTPUT_DIR/coverage_test.info --output-file $OUTPUT_DIR/coverage_all.info lcov --extract $OUTPUT_DIR/coverage_all.info *cpp-ethereum/* --output-file $OUTPUT_DIR/coverage_export.info genhtml $OUTPUT_DIR/coverage_export.info --output-directory $OUTPUT_DIR/testeth From 93003a12242d56d8025785d1c213151e9e755e62 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2015 14:58:03 +0200 Subject: [PATCH 059/169] Some changes in libdevcore. --- ethkey/KeyAux.h | 12 +++---- libdevcore/Common.h | 21 ++++++----- libdevcore/CommonData.cpp | 4 +-- libdevcore/CommonData.h | 5 --- libdevcore/CommonIO.cpp | 58 +++++++++---------------------- libdevcore/CommonIO.h | 6 +++- liblll/CodeFragment.cpp | 2 +- libtestutils/Common.cpp | 2 +- lllc/main.cpp | 2 +- solc/CommandLineInterface.cpp | 2 +- test/TestHelper.cpp | 2 +- test/libdevcore/rlp.cpp | 2 +- test/libdevcrypto/SecretStore.cpp | 2 +- test/libdevcrypto/hexPrefix.cpp | 2 +- test/libdevcrypto/trie.cpp | 6 ++-- test/libethcore/dagger.cpp | 2 +- test/libethereum/genesis.cpp | 2 +- 17 files changed, 55 insertions(+), 77 deletions(-) diff --git a/ethkey/KeyAux.h b/ethkey/KeyAux.h index d2ec13b2a..e4310df30 100644 --- a/ethkey/KeyAux.h +++ b/ethkey/KeyAux.h @@ -221,26 +221,26 @@ public: break; } case OperationMode::ImportBare: - for (string const& i: m_inputs) + for (string const& input: m_inputs) { h128 u; bytes b; - b = fromHex(i); + b = fromHex(input); if (b.size() != 32) { - std::string s = contentsString(i); + std::string s = contentsString(input); b = fromHex(s); if (b.size() != 32) - u = store.importKey(i); + u = store.importKey(input); } if (!u && b.size() == 32) u = store.importSecret(b, lockPassword(toAddress(Secret(b)).abridged())); if (!u) { - cerr << "Cannot import " << i << " not a file or secret." << endl; + cerr << "Cannot import " << input << " not a file or secret." << endl; continue; } - cout << "Successfully imported " << i << " as " << toUUID(u); + cout << "Successfully imported " << input << " as " << toUUID(u); } break; case OperationMode::InspectBare: diff --git a/libdevcore/Common.h b/libdevcore/Common.h index 1ee83c794..c6ed25223 100644 --- a/libdevcore/Common.h +++ b/libdevcore/Common.h @@ -113,25 +113,27 @@ static const u256 Invalid256 = ~(u256)0; static const bytes NullBytes; static const std::map EmptyMapU256U256; +/// Interprets @a _u as a two's complement signed number and returns the resulting s256. inline s256 u2s(u256 _u) { - static const bigint c_end = (bigint)1 << 256; - static const u256 c_send = (u256)1 << 255; - if (_u < c_send) - return (s256)_u; - else - return (s256)-(c_end - _u); + static const bigint c_end = bigint(1) << 256; + if (boost::multiprecision::bit_test(_u, 255)) + return s256(-(c_end - _u)); + else + return s256(_u); } +/// @returns the two's complement signed representation of the signed number _u. inline u256 s2u(s256 _u) { - static const bigint c_end = (bigint)1 << 256; + static const bigint c_end = bigint(1) << 256; if (_u >= 0) - return (u256)_u; + return u256(_u); else - return (u256)(c_end + _u); + return u256(c_end + _u); } +/// @returns the smallest n >= 0 such that (1 << n) >= _x inline unsigned int toLog2(u256 _x) { unsigned ret; @@ -139,6 +141,7 @@ inline unsigned int toLog2(u256 _x) return ret; } +/// @returns the absolute distance between _a and _b. template inline N diff(N const& _a, N const& _b) { diff --git a/libdevcore/CommonData.cpp b/libdevcore/CommonData.cpp index 2d6333f26..ef178965f 100644 --- a/libdevcore/CommonData.cpp +++ b/libdevcore/CommonData.cpp @@ -93,7 +93,7 @@ bytes dev::fromHex(std::string const& _s, WhenError _throw) if (h != -1) ret.push_back(h); else if (_throw == WhenError::Throw) - throw BadHexCharacter(); + BOOST_THROW_EXCEPTION(BadHexCharacter()); else return bytes(); } @@ -104,7 +104,7 @@ bytes dev::fromHex(std::string const& _s, WhenError _throw) if (h != -1 && l != -1) ret.push_back((byte)(h * 16 + l)); else if (_throw == WhenError::Throw) - throw BadHexCharacter(); + BOOST_THROW_EXCEPTION(BadHexCharacter()); else return bytes(); } diff --git a/libdevcore/CommonData.h b/libdevcore/CommonData.h index ddc00e09f..f4d3cf65d 100644 --- a/libdevcore/CommonData.h +++ b/libdevcore/CommonData.h @@ -68,11 +68,6 @@ int fromHex(char _i, WhenError _throw); /// If _throw = ThrowType::DontThrow, it replaces bad hex characters with 0's, otherwise it will throw an exception. bytes fromHex(std::string const& _s, WhenError _throw = WhenError::DontThrow); -#if 0 -std::string toBase58(bytesConstRef _data); -bytes fromBase58(std::string const& _s); -#endif - /// Converts byte array to a string containing the same (binary) data. Unless /// the byte array happens to contain ASCII data, this won't be printable. inline std::string asString(bytes const& _b) diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index 9538ca55f..03b22bfc5 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -64,59 +64,35 @@ string dev::memDump(bytes const& _bytes, unsigned _width, bool _html) return ret.str(); } -// Don't forget to delete[] later. -bytesRef dev::contentsNew(std::string const& _file, bytesRef _dest) +template +inline _T contentsGeneric(std::string const& _file) { + _T ret; + size_t const c_elementSize = sizeof(typename _T::value_type); std::ifstream is(_file, std::ifstream::binary); if (!is) - return bytesRef(); + return ret; + // get length of file: - is.seekg (0, is.end); + is.seekg(0, is.end); streamoff length = is.tellg(); - if (length == 0) // return early, MSVC does not like reading 0 bytes - return bytesRef(); - if (!_dest.empty() && _dest.size() != (unsigned)length) - return bytesRef(); - is.seekg (0, is.beg); - bytesRef ret = _dest.empty() ? bytesRef(new byte[length], length) : _dest; - is.read((char*)ret.data(), length); - is.close(); + if (length == 0) + return ret; // do not read empty file (MSVC does not like it) + is.seekg(0, is.beg); + + ret.resize((length + c_elementSize - 1) / c_elementSize); + is.read(const_cast(reinterpret_cast(ret.data())), length); return ret; } -bytes dev::contents(std::string const& _file) +bytes dev::contents(string const& _file) { - std::ifstream is(_file, std::ifstream::binary); - if (!is) - return bytes(); - // get length of file: - is.seekg (0, is.end); - streamoff length = is.tellg(); - if (length == 0) // return early, MSVC does not like reading 0 bytes - return bytes(); - is.seekg (0, is.beg); - bytes ret(length); - is.read((char*)ret.data(), length); - is.close(); - return ret; + return contentsGeneric(_file); } -string dev::contentsString(std::string const& _file) +string dev::contentsString(string const& _file) { - std::ifstream is(_file, std::ifstream::binary); - if (!is) - return string(); - // get length of file: - is.seekg (0, is.end); - streamoff length = is.tellg(); - if (length == 0) // return early, MSVC does not like reading 0 bytes - return string(); - is.seekg (0, is.beg); - string ret; - ret.resize(length); - is.read((char*)ret.data(), length); - is.close(); - return ret; + return contentsGeneric(_file); } void dev::writeFile(std::string const& _file, bytesConstRef _data) diff --git a/libdevcore/CommonIO.h b/libdevcore/CommonIO.h index 46a8b80bc..c8aa830ff 100644 --- a/libdevcore/CommonIO.h +++ b/libdevcore/CommonIO.h @@ -42,10 +42,14 @@ namespace dev { +/// Requests the user to enter a password on the console. std::string getPassword(std::string const& _prompt); -/// Retrieve and returns the contents of the given file. If the file doesn't exist or isn't readable, returns an empty bytes. +/// Retrieve and returns the contents of the given file. +/// If the file doesn't exist or isn't readable, returns an empty container / bytes. bytes contents(std::string const& _file); +/// Retrieve and returns the contents of the given file as a std::string. +/// If the file doesn't exist or isn't readable, returns an empty container / bytes. std::string contentsString(std::string const& _file); /// Retrieve and returns the allocated contents of the given file; if @_dest is given, don't allocate, use it directly. /// If the file doesn't exist or isn't readable, returns bytesRef(). Don't forget to delete [] the returned value's data when finished. diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index 1e7766434..b50e316d3 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -196,7 +196,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) { if (_t.size() != 2) error(); - m_asm.append(CodeFragment::compile(asString(contents(firstAsString())), _s).m_asm); + m_asm.append(CodeFragment::compile(contentsString(firstAsString()), _s).m_asm); } else if (us == "SET") { diff --git a/libtestutils/Common.cpp b/libtestutils/Common.cpp index cff21d464..8f23685c1 100644 --- a/libtestutils/Common.cpp +++ b/libtestutils/Common.cpp @@ -59,7 +59,7 @@ Json::Value dev::test::loadJsonFromFile(std::string const& _path) { Json::Reader reader; Json::Value result; - string s = asString(dev::contents(_path)); + string s = dev::contentsString(_path); if (!s.length()) ctest << "Contents of " + _path + " is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"; else diff --git a/lllc/main.cpp b/lllc/main.cpp index 1a44ee950..e1a61f49a 100644 --- a/lllc/main.cpp +++ b/lllc/main.cpp @@ -95,7 +95,7 @@ int main(int argc, char** argv) } } else - src = asString(contents(infile)); + src = contentsString(infile); vector errors; if (src.empty()) diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index e65c602ab..ec2a90033 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -401,7 +401,7 @@ bool CommandLineInterface::processInput() continue; } - m_sourceCodes[infile] = asString(dev::contents(infile)); + m_sourceCodes[infile] = dev::contentsString(infile); } m_compiler.reset(new CompilerStack(m_args["add-std"].as())); diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 733ccb6d0..bca0528ff 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -598,7 +598,7 @@ void userDefinedTest(std::function doTests) { cnote << "Testing user defined test: " << filename; json_spirit::mValue v; - string s = asString(contents(filename)); + string s = contentsString(filename); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + filename + " is empty. "); json_spirit::read_string(s, v); json_spirit::mObject oSingleTest; diff --git a/test/libdevcore/rlp.cpp b/test/libdevcore/rlp.cpp index 41362d569..86780cfa6 100644 --- a/test/libdevcore/rlp.cpp +++ b/test/libdevcore/rlp.cpp @@ -67,7 +67,7 @@ namespace dev string testPath = getTestPath(); testPath += "/BasicTests"; - string s = asString(contents(testPath + "/rlptest.json")); + string s = contentsString(testPath + "/rlptest.json"); BOOST_REQUIRE_MESSAGE( s.length() > 0, "Contents of 'rlptest.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); diff --git a/test/libdevcrypto/SecretStore.cpp b/test/libdevcrypto/SecretStore.cpp index 1f927db5d..43c201edc 100644 --- a/test/libdevcrypto/SecretStore.cpp +++ b/test/libdevcrypto/SecretStore.cpp @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(basic_tests) cnote << "Testing Key Store..."; js::mValue v; - string s = asString(contents(testPath + "/basic_tests.json")); + string s = contentsString(testPath + "/basic_tests.json"); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'KeyStoreTests/basic_tests.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); for (auto& i: v.get_obj()) diff --git a/test/libdevcrypto/hexPrefix.cpp b/test/libdevcrypto/hexPrefix.cpp index 53e0d3dbd..4d89ec594 100644 --- a/test/libdevcrypto/hexPrefix.cpp +++ b/test/libdevcrypto/hexPrefix.cpp @@ -45,7 +45,7 @@ BOOST_AUTO_TEST_CASE(hexPrefix_test) cnote << "Testing Hex-Prefix-Encode..."; js::mValue v; - string s = asString(contents(testPath + "/hexencodetest.json")); + string s = contentsString(testPath + "/hexencodetest.json"); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Content from 'hexencodetest.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); for (auto& i: v.get_obj()) diff --git a/test/libdevcrypto/trie.cpp b/test/libdevcrypto/trie.cpp index b5d8662dc..daa3cc181 100644 --- a/test/libdevcrypto/trie.cpp +++ b/test/libdevcrypto/trie.cpp @@ -82,7 +82,7 @@ BOOST_AUTO_TEST_CASE(hex_encoded_securetrie_test) cnote << "Testing Secure Trie..."; js::mValue v; - string s = asString(contents(testPath + "/hex_encoded_securetrie_test.json")); + string s = contentsString(testPath + "/hex_encoded_securetrie_test.json"); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'hex_encoded_securetrie_test.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); for (auto& i: v.get_obj()) @@ -149,7 +149,7 @@ BOOST_AUTO_TEST_CASE(trie_test_anyorder) cnote << "Testing Trie..."; js::mValue v; - string s = asString(contents(testPath + "/trieanyorder.json")); + string s = contentsString(testPath + "/trieanyorder.json"); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'trieanyorder.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); for (auto& i: v.get_obj()) @@ -216,7 +216,7 @@ BOOST_AUTO_TEST_CASE(trie_tests_ordered) cnote << "Testing Trie..."; js::mValue v; - string s = asString(contents(testPath + "/trietest.json")); + string s = contentsString(testPath + "/trietest.json"); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'trietest.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); diff --git a/test/libethcore/dagger.cpp b/test/libethcore/dagger.cpp index 59770373d..1743882e5 100644 --- a/test/libethcore/dagger.cpp +++ b/test/libethcore/dagger.cpp @@ -47,7 +47,7 @@ BOOST_AUTO_TEST_CASE(basic_test) cnote << "Testing Proof of Work..."; js::mValue v; - string s = asString(contents(testPath + "/ethash_tests.json")); + string s = contentsString(testPath + "/ethash_tests.json"); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'ethash_tests.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); for (auto& i: v.get_obj()) diff --git a/test/libethereum/genesis.cpp b/test/libethereum/genesis.cpp index 4633a0617..02ff4517a 100644 --- a/test/libethereum/genesis.cpp +++ b/test/libethereum/genesis.cpp @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(genesis_tests) cnote << "Testing Genesis block..."; js::mValue v; - string s = asString(contents(testPath + "/genesishashestest.json")); + string s = contentsString(testPath + "/genesishashestest.json"); BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of 'genesishashestest.json' is empty. Have you cloned the 'tests' repo branch develop?"); js::read_string(s, v); From c925b2936b428f0354bae9ccf1dc88bdb57f15c1 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Thu, 11 Jun 2015 10:23:04 +0200 Subject: [PATCH 060/169] Bloom Filter introduced --- libwhisper/BloomFilter.cpp | 71 +++++++++++++++++ libwhisper/BloomFilter.h | 73 ++++++++++++++++++ test/libwhisper/bloomFilter.cpp | 133 ++++++++++++++++++++++++++++++++ 3 files changed, 277 insertions(+) create mode 100644 libwhisper/BloomFilter.cpp create mode 100644 libwhisper/BloomFilter.h create mode 100644 test/libwhisper/bloomFilter.cpp diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp new file mode 100644 index 000000000..5631688ae --- /dev/null +++ b/libwhisper/BloomFilter.cpp @@ -0,0 +1,71 @@ +/* +This file is part of cpp-ethereum. + +cpp-ethereum is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +cpp-ethereum is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with cpp-ethereum. If not, see . +*/ +/** @file BloomFilter.cpp +* @author Vladislav Gluhovsky +* @date June 2015 +*/ + +#include "BloomFilter.h" + +using namespace std; +using namespace dev; +using namespace dev::shh; + +bool BloomFilter::matches(AbridgedTopic const& _t) const +{ + static unsigned const c_PerfectMatch = ~unsigned(0); + unsigned topic = AbridgedTopic::Arith(_t).convert_to(); + unsigned matchingBits = m_filter & topic; + matchingBits |= ~topic; + return (c_PerfectMatch == matchingBits); +} + +void SharedBloomFilter::add(AbridgedTopic const& _t) +{ + unsigned const topic = AbridgedTopic::Arith(_t).convert_to(); + m_filter |= topic; + + unsigned nextBit = 1; + for (unsigned i = 0; i < ArrSize; ++i, nextBit <<= 1) + if (topic & nextBit) + if (m_refCounter[i] != numeric_limits::max()) + m_refCounter[i]++; + //else: overflow + + // in order to encounter overflow, you have to set 65536 filters simultaneously. + // we assume, it will never happen. +} + +void SharedBloomFilter::remove(AbridgedTopic const& _t) +{ + unsigned const topic = AbridgedTopic::Arith(_t).convert_to(); + + unsigned nextBit = 1; + for (unsigned i = 0; i < ArrSize; ++i, nextBit <<= 1) + if (topic & nextBit) + { + if (m_refCounter[i]) + m_refCounter[i]--; + + if (!m_refCounter[i]) + m_filter &= ~nextBit; + } +} + + + + diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h new file mode 100644 index 000000000..22242ac77 --- /dev/null +++ b/libwhisper/BloomFilter.h @@ -0,0 +1,73 @@ +/* +This file is part of cpp-ethereum. + +cpp-ethereum is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +cpp-ethereum is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with cpp-ethereum. If not, see . +*/ +/** @file BloomFilter.h +* @author Vladislav Gluhovsky +* @date June 2015 +*/ + +#pragma once + +#include "Common.h" + +namespace dev +{ +namespace shh +{ + +class BloomFilter +{ +public: + virtual ~BloomFilter() {} + BloomFilter(): m_filter(0) {} + BloomFilter(unsigned _i): m_filter(_i) {} + BloomFilter(AbridgedTopic const& _t): m_filter(AbridgedTopic::Arith(_t).convert_to()) {} + + bool matches(AbridgedTopic const& _t) const; + virtual void add(AbridgedTopic const& _t) { m_filter |= AbridgedTopic::Arith(_t).convert_to(); } + virtual void remove(AbridgedTopic const& ) {} // not implemented in this class, use derived class instead. + +protected: + unsigned m_filter; +}; + +class SharedBloomFilter: public BloomFilter +{ +public: + virtual ~SharedBloomFilter() {} + SharedBloomFilter() { init(); } + SharedBloomFilter(unsigned _i): BloomFilter(_i) { init(); } + SharedBloomFilter(AbridgedTopic const& _t): BloomFilter(_t) { init(); } + + void add(AbridgedTopic const& _t) override; + void remove(AbridgedTopic const& _t) override; + +protected: + void init() { for (unsigned i = 0; i < ArrSize; ++i) m_refCounter[i] = 0; } + +private: + enum { ArrSize = 8 * AbridgedTopic::size }; + unsigned short m_refCounter[ArrSize]; +}; + +} +} + + + + + + diff --git a/test/libwhisper/bloomFilter.cpp b/test/libwhisper/bloomFilter.cpp new file mode 100644 index 000000000..0a299d53c --- /dev/null +++ b/test/libwhisper/bloomFilter.cpp @@ -0,0 +1,133 @@ +/* +This file is part of cpp-ethereum. + +cpp-ethereum is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +cpp-ethereum is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with cpp-ethereum. If not, see . +*/ +/** @file whisperMessage.cpp +* @author Vladislav Gluhovsky +* @date June 2015 +*/ + +#include +#include + +using namespace std; +using namespace dev; +using namespace dev::shh; + +BOOST_AUTO_TEST_SUITE(bloomFilter) + +BOOST_AUTO_TEST_CASE(match) +{ + VerbosityHolder setTemporaryLevel(10); + cnote << "Testing Bloom Filter matching..."; + + SharedBloomFilter f; + unsigned b00000001 = 0x01; + unsigned b00010000 = 0x10; + unsigned b00011000 = 0x18; + unsigned b00110000 = 0x30; + unsigned b00110010 = 0x32; + unsigned b00111000 = 0x38; + unsigned b00000110 = 0x06; + unsigned b00110110 = 0x36; + unsigned b00110111 = 0x37; + + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); + f.add(AbridgedTopic(b00000001)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00010000))); + f.add(AbridgedTopic(b00010000)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); + f.add(AbridgedTopic(b00011000)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110000))); + f.add(AbridgedTopic(b00110000)); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00111000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110010))); + f.add(AbridgedTopic(b00110010)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000110))); + f.add(AbridgedTopic(b00000110)); + + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110111))); + + f.remove(AbridgedTopic(b00000001)); + f.remove(AbridgedTopic(b00000001)); + f.remove(AbridgedTopic(b00000001)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00011000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00111000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); + + f.remove(AbridgedTopic(b00010000)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00011000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00111000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); + + f.remove(AbridgedTopic(b00111000)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); + + f.add(AbridgedTopic(b00000001)); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00000001))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00110111))); + + f.remove(AbridgedTopic(b00110111)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); + BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110010))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000110))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110110))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); + + f.remove(AbridgedTopic(b00110111)); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00010000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110010))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000110))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110110))); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); +} + +BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file From 013ba9966af6cec4f0dd13a9e8982d8c1ad2134c Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 12 Jun 2015 16:31:25 +0200 Subject: [PATCH 061/169] Bloom Filter, first version --- libwhisper/BloomFilter.cpp | 7 ++++--- libwhisper/BloomFilter.h | 7 ++++++- libwhisper/Common.cpp | 22 +++++++++++++++++++++- libwhisper/Common.h | 15 +++------------ libwhisper/WhisperHost.cpp | 4 ++++ libwhisper/WhisperHost.h | 4 +++- test/libwhisper/bloomFilter.cpp | 8 ++++++++ 7 files changed, 49 insertions(+), 18 deletions(-) diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp index 5631688ae..4e1631025 100644 --- a/libwhisper/BloomFilter.cpp +++ b/libwhisper/BloomFilter.cpp @@ -27,11 +27,11 @@ using namespace dev::shh; bool BloomFilter::matches(AbridgedTopic const& _t) const { - static unsigned const c_PerfectMatch = ~unsigned(0); + static unsigned const c_match = ~unsigned(0); unsigned topic = AbridgedTopic::Arith(_t).convert_to(); unsigned matchingBits = m_filter & topic; matchingBits |= ~topic; - return (c_PerfectMatch == matchingBits); + return (c_match == matchingBits); } void SharedBloomFilter::add(AbridgedTopic const& _t) @@ -46,7 +46,8 @@ void SharedBloomFilter::add(AbridgedTopic const& _t) m_refCounter[i]++; //else: overflow - // in order to encounter overflow, you have to set 65536 filters simultaneously. + // in order to encounter overflow, you have to set at least 65536 filters simultaneously. + // even then, the problem will only arise after at least 65536 filters will be be removed. // we assume, it will never happen. } diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index 22242ac77..d663c994e 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -36,9 +36,14 @@ public: BloomFilter(unsigned _i): m_filter(_i) {} BloomFilter(AbridgedTopic const& _t): m_filter(AbridgedTopic::Arith(_t).convert_to()) {} + unsigned getUnsigned() const { return m_filter; } + AbridgedTopic getAbridgedTopic() const { return AbridgedTopic(m_filter); } + bool matches(AbridgedTopic const& _t) const; + virtual void add(Topic const& _t) { add(abridge(_t)); } + virtual void add(Topics const& _topics) { for (Topic t : _topics) add(abridge(t)); } virtual void add(AbridgedTopic const& _t) { m_filter |= AbridgedTopic::Arith(_t).convert_to(); } - virtual void remove(AbridgedTopic const& ) {} // not implemented in this class, use derived class instead. + virtual void remove(AbridgedTopic const&) {} // not implemented in this class, use derived class instead. protected: unsigned m_filter; diff --git a/libwhisper/Common.cpp b/libwhisper/Common.cpp index 526072842..92fd997c5 100644 --- a/libwhisper/Common.cpp +++ b/libwhisper/Common.cpp @@ -20,9 +20,9 @@ */ #include "Common.h" - #include #include "Message.h" + using namespace std; using namespace dev; using namespace dev::p2p; @@ -84,6 +84,26 @@ bool TopicFilter::matches(Envelope const& _e) const return false; } +TopicFilter::TopicFilter(RLP const& _r) +{ + for (RLP i: _r) + { + m_topicMasks.push_back(TopicMask()); + for (RLP j: i) + m_topicMasks.back().push_back(j.toPair, FixedHash<4>>()); + } +} + +AbridgedTopic TopicFilter::exportBloomFilter() const +{ + AbridgedTopic ret; + for (TopicMask const& t: m_topicMasks) + for (auto i: t) + ret |= i.first; + + return ret; +} + TopicMask BuildTopicMask::toTopicMask() const { TopicMask ret; diff --git a/libwhisper/Common.h b/libwhisper/Common.h index b575166b4..eb624893a 100644 --- a/libwhisper/Common.h +++ b/libwhisper/Common.h @@ -48,7 +48,6 @@ using h256Set = dev::h256Set; class WhisperHost; class WhisperPeer; class Whisper; - class Envelope; enum WhisperPacket @@ -91,7 +90,7 @@ protected: h256s m_parts; }; -using TopicMask = std::vector>; +using TopicMask = std::vector>; // where pair::first is the actual abridged topic hash, pair::second is a constant (probably redundunt) using TopicMasks = std::vector; class TopicFilter @@ -101,20 +100,12 @@ public: TopicFilter(Topics const& _m) { m_topicMasks.push_back(TopicMask()); for (auto const& h: _m) m_topicMasks.back().push_back(std::make_pair(abridge(h), h ? ~AbridgedTopic() : AbridgedTopic())); } TopicFilter(TopicMask const& _m): m_topicMasks(1, _m) {} TopicFilter(TopicMasks const& _m): m_topicMasks(_m) {} - TopicFilter(RLP const& _r)//: m_topicMasks(_r.toVector>()) - { - for (RLP i: _r) - { - m_topicMasks.push_back(TopicMask()); - for (RLP j: i) - m_topicMasks.back().push_back(j.toPair, FixedHash<4>>()); - } - } + TopicFilter(RLP const& _r); void streamRLP(RLPStream& _s) const { _s << m_topicMasks; } h256 sha3() const; - bool matches(Envelope const& _m) const; + AbridgedTopic exportBloomFilter() const; private: TopicMasks m_topicMasks; diff --git a/libwhisper/WhisperHost.cpp b/libwhisper/WhisperHost.cpp index 366bb92e4..962abd829 100644 --- a/libwhisper/WhisperHost.cpp +++ b/libwhisper/WhisperHost.cpp @@ -113,6 +113,7 @@ unsigned WhisperHost::installWatch(shh::Topics const& _t) if (!m_filters.count(h)) m_filters.insert(make_pair(h, f)); + m_bloom.add(f.filter.exportBloomFilter()); return installWatchOnId(h); } @@ -151,8 +152,11 @@ void WhisperHost::uninstallWatch(unsigned _i) auto fit = m_filters.find(id); if (fit != m_filters.end()) + { + m_bloom.remove(fit->second.filter.exportBloomFilter()); if (!--fit->second.refCount) m_filters.erase(fit); + } } void WhisperHost::doWork() diff --git a/libwhisper/WhisperHost.h b/libwhisper/WhisperHost.h index 87563d9e8..f66036f89 100644 --- a/libwhisper/WhisperHost.h +++ b/libwhisper/WhisperHost.h @@ -34,6 +34,7 @@ #include "Common.h" #include "WhisperPeer.h" #include "Interface.h" +#include "BloomFilter.h" namespace dev { @@ -60,7 +61,7 @@ public: virtual void uninstallWatch(unsigned _watchId) override; virtual h256s peekWatch(unsigned _watchId) const override { dev::Guard l(m_filterLock); try { return m_watches.at(_watchId).changes; } catch (...) { return h256s(); } } virtual h256s checkWatch(unsigned _watchId) override { cleanup(); dev::Guard l(m_filterLock); h256s ret; try { ret = m_watches.at(_watchId).changes; m_watches.at(_watchId).changes.clear(); } catch (...) {} return ret; } - virtual h256s watchMessages(unsigned _watchId) override; + virtual h256s watchMessages(unsigned _watchId) override; /// returns IDs of messages, which match specific watch criteria virtual Envelope envelope(h256 _m) const override { try { dev::ReadGuard l(x_messages); return m_messages.at(_m); } catch (...) { return Envelope(); } } @@ -86,6 +87,7 @@ private: mutable dev::Mutex m_filterLock; std::map m_filters; std::map m_watches; + SharedBloomFilter m_bloom; }; } diff --git a/test/libwhisper/bloomFilter.cpp b/test/libwhisper/bloomFilter.cpp index 0a299d53c..f58bf8503 100644 --- a/test/libwhisper/bloomFilter.cpp +++ b/test/libwhisper/bloomFilter.cpp @@ -44,6 +44,14 @@ BOOST_AUTO_TEST_CASE(match) unsigned b00110110 = 0x36; unsigned b00110111 = 0x37; + AbridgedTopic x(b00111000); + SharedBloomFilter f1(b00111000); + SharedBloomFilter f2(x); + BOOST_REQUIRE_EQUAL(x, f1.getAbridgedTopic()); + BOOST_REQUIRE_EQUAL(x, f2.getAbridgedTopic()); + BOOST_REQUIRE_EQUAL(b00111000, f1.getUnsigned()); + BOOST_REQUIRE_EQUAL(b00111000, f2.getUnsigned()); + BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); f.add(AbridgedTopic(b00000001)); BOOST_REQUIRE(!f.matches(AbridgedTopic(b00010000))); From f7605136578e5fe8ac7b671f1cc41dfcfa2a898a Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 12 Jun 2015 16:55:41 +0200 Subject: [PATCH 062/169] a minor refactoring --- test/libwhisper/whisperTopic.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/test/libwhisper/whisperTopic.cpp b/test/libwhisper/whisperTopic.cpp index ba487a92e..b5f5cd7d3 100644 --- a/test/libwhisper/whisperTopic.cpp +++ b/test/libwhisper/whisperTopic.cpp @@ -41,8 +41,7 @@ BOOST_FIXTURE_TEST_SUITE(whisper, P2PFixture) BOOST_AUTO_TEST_CASE(topic) { cnote << "Testing Whisper..."; - auto oldLogVerbosity = g_logVerbosity; - g_logVerbosity = 0; + VerbosityHolder setTemporaryLevel(0); Host host1("Test", NetworkPreferences("127.0.0.1", 30303, false)); host1.setIdealPeerCount(1); @@ -99,16 +98,13 @@ BOOST_AUTO_TEST_CASE(topic) } listener.join(); - g_logVerbosity = oldLogVerbosity; - BOOST_REQUIRE_EQUAL(result, 1 + 9 + 25 + 49 + 81); } BOOST_AUTO_TEST_CASE(forwarding) { cnote << "Testing Whisper forwarding..."; - auto oldLogVerbosity = g_logVerbosity; - g_logVerbosity = 0; + VerbosityHolder setTemporaryLevel(0); // Host must be configured not to share peers. Host host1("Listner", NetworkPreferences("127.0.0.1", 30303, false)); @@ -202,16 +198,13 @@ BOOST_AUTO_TEST_CASE(forwarding) listener.join(); done = true; forwarder.join(); - g_logVerbosity = oldLogVerbosity; - BOOST_REQUIRE_EQUAL(result, 1); } BOOST_AUTO_TEST_CASE(asyncforwarding) { cnote << "Testing Whisper async forwarding..."; - auto oldLogVerbosity = g_logVerbosity; - g_logVerbosity = 2; + VerbosityHolder setTemporaryLevel(2); unsigned result = 0; bool done = false; @@ -294,8 +287,6 @@ BOOST_AUTO_TEST_CASE(asyncforwarding) done = true; forwarder.join(); - g_logVerbosity = oldLogVerbosity; - BOOST_REQUIRE_EQUAL(result, 1); } From 255f81e2cc3a71aa78b7c2f11688a158f6fa3bbf Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Tue, 16 Jun 2015 15:30:20 +0200 Subject: [PATCH 063/169] Bloom Filter initial version reviewed --- libwhisper/BloomFilter.cpp | 49 +++---- libwhisper/BloomFilter.h | 48 ++---- libwhisper/WhisperHost.h | 2 +- test/libwhisper/bloomFilter.cpp | 249 +++++++++++++++++++------------- 4 files changed, 184 insertions(+), 164 deletions(-) diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp index 4e1631025..1b6ea7f74 100644 --- a/libwhisper/BloomFilter.cpp +++ b/libwhisper/BloomFilter.cpp @@ -25,48 +25,45 @@ using namespace std; using namespace dev; using namespace dev::shh; -bool BloomFilter::matches(AbridgedTopic const& _t) const -{ - static unsigned const c_match = ~unsigned(0); - unsigned topic = AbridgedTopic::Arith(_t).convert_to(); - unsigned matchingBits = m_filter & topic; - matchingBits |= ~topic; - return (c_match == matchingBits); -} +static unsigned const c_mask[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; -void SharedBloomFilter::add(AbridgedTopic const& _t) +void TopicBloomFilter::add(AbridgedTopic const& _h) { - unsigned const topic = AbridgedTopic::Arith(_t).convert_to(); - m_filter |= topic; - - unsigned nextBit = 1; - for (unsigned i = 0; i < ArrSize; ++i, nextBit <<= 1) - if (topic & nextBit) - if (m_refCounter[i] != numeric_limits::max()) + *this |= _h; + unsigned count = 0; + for (unsigned i = 0; i < CounterSize; ++i) + if (isBitSet(_h, i)) + { + if (m_refCounter[i] != numeric_limits::max()) m_refCounter[i]++; //else: overflow - // in order to encounter overflow, you have to set at least 65536 filters simultaneously. - // even then, the problem will only arise after at least 65536 filters will be be removed. - // we assume, it will never happen. + // in order to encounter overflow, you have to set at least 65536 filters simultaneously. + // even then, the problem will only arise after at least 65536 filters will be be removed. + // we assume, it will never happen. + } } -void SharedBloomFilter::remove(AbridgedTopic const& _t) +void TopicBloomFilter::remove(AbridgedTopic const& _h) { - unsigned const topic = AbridgedTopic::Arith(_t).convert_to(); - - unsigned nextBit = 1; - for (unsigned i = 0; i < ArrSize; ++i, nextBit <<= 1) - if (topic & nextBit) + unsigned count = 0; + for (unsigned i = 0; i < CounterSize; ++i) + if (isBitSet(_h, i)) { if (m_refCounter[i]) m_refCounter[i]--; if (!m_refCounter[i]) - m_filter &= ~nextBit; + (*this)[i/8] &= ~c_mask[i%8]; } } +bool TopicBloomFilter::isBitSet(AbridgedTopic const& _h, unsigned _index) +{ + unsigned iByte = _index / 8; + unsigned iBit = _index % 8; + return (_h[iByte] & c_mask[iBit]) != 0; +} diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index d663c994e..89529146a 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -28,44 +28,26 @@ namespace dev namespace shh { -class BloomFilter +class TopicBloomFilter: public AbridgedTopic { public: - virtual ~BloomFilter() {} - BloomFilter(): m_filter(0) {} - BloomFilter(unsigned _i): m_filter(_i) {} - BloomFilter(AbridgedTopic const& _t): m_filter(AbridgedTopic::Arith(_t).convert_to()) {} - - unsigned getUnsigned() const { return m_filter; } - AbridgedTopic getAbridgedTopic() const { return AbridgedTopic(m_filter); } - - bool matches(AbridgedTopic const& _t) const; - virtual void add(Topic const& _t) { add(abridge(_t)); } - virtual void add(Topics const& _topics) { for (Topic t : _topics) add(abridge(t)); } - virtual void add(AbridgedTopic const& _t) { m_filter |= AbridgedTopic::Arith(_t).convert_to(); } - virtual void remove(AbridgedTopic const&) {} // not implemented in this class, use derived class instead. - -protected: - unsigned m_filter; -}; - -class SharedBloomFilter: public BloomFilter -{ -public: - virtual ~SharedBloomFilter() {} - SharedBloomFilter() { init(); } - SharedBloomFilter(unsigned _i): BloomFilter(_i) { init(); } - SharedBloomFilter(AbridgedTopic const& _t): BloomFilter(_t) { init(); } - - void add(AbridgedTopic const& _t) override; - void remove(AbridgedTopic const& _t) override; + TopicBloomFilter() { init(); } + TopicBloomFilter(AbridgedTopic const& _h): AbridgedTopic(_h) { init(); } -protected: - void init() { for (unsigned i = 0; i < ArrSize; ++i) m_refCounter[i] = 0; } + void addBloom(AbridgedTopic const& _h) { add(_h.template bloom()); } + void removeBloom(AbridgedTopic const& _h) { remove(_h.template bloom()); } + void add(AbridgedTopic const& _h); + void remove(AbridgedTopic const& _h); + bool containsBloom(AbridgedTopic const& _h) const { return contains(_h.template bloom()); } + enum { BitsPerBloom = 3 }; + private: - enum { ArrSize = 8 * AbridgedTopic::size }; - unsigned short m_refCounter[ArrSize]; + void init() { for (unsigned i = 0; i < CounterSize; ++i) m_refCounter[i] = 0; } + static bool isBitSet(AbridgedTopic const& _h, unsigned _index); + + enum { CounterSize = 8 * AbridgedTopic::size }; + std::array m_refCounter; }; } diff --git a/libwhisper/WhisperHost.h b/libwhisper/WhisperHost.h index f66036f89..46c41f3a2 100644 --- a/libwhisper/WhisperHost.h +++ b/libwhisper/WhisperHost.h @@ -87,7 +87,7 @@ private: mutable dev::Mutex m_filterLock; std::map m_filters; std::map m_watches; - SharedBloomFilter m_bloom; + TopicBloomFilter m_bloom; }; } diff --git a/test/libwhisper/bloomFilter.cpp b/test/libwhisper/bloomFilter.cpp index f58bf8503..d7a4c76ef 100644 --- a/test/libwhisper/bloomFilter.cpp +++ b/test/libwhisper/bloomFilter.cpp @@ -20,122 +20,163 @@ along with cpp-ethereum. If not, see . */ #include +#include #include using namespace std; using namespace dev; using namespace dev::shh; +void testAddNonExisting(TopicBloomFilter& _f, AbridgedTopic const& _h) +{ + BOOST_REQUIRE(!_f.contains(_h)); + _f.add(_h); + BOOST_REQUIRE(_f.contains(_h)); +} + +void testRemoveExisting(TopicBloomFilter& _f, AbridgedTopic const& _h) +{ + BOOST_REQUIRE(_f.contains(_h)); + _f.remove(_h); + BOOST_REQUIRE(!_f.contains(_h)); +} + +void testAddNonExistingBloom(TopicBloomFilter& _f, AbridgedTopic const& _h) +{ + BOOST_REQUIRE(!_f.containsBloom(_h)); + _f.addBloom(_h); + BOOST_REQUIRE(_f.containsBloom(_h)); +} + +void testRemoveExistingBloom(TopicBloomFilter& _f, AbridgedTopic const& _h) +{ + BOOST_REQUIRE(_f.containsBloom(_h)); + _f.removeBloom(_h); + BOOST_REQUIRE(!_f.containsBloom(_h)); +} + BOOST_AUTO_TEST_SUITE(bloomFilter) -BOOST_AUTO_TEST_CASE(match) +BOOST_AUTO_TEST_CASE(bloomFilterRandom) { VerbosityHolder setTemporaryLevel(10); cnote << "Testing Bloom Filter matching..."; - SharedBloomFilter f; - unsigned b00000001 = 0x01; - unsigned b00010000 = 0x10; - unsigned b00011000 = 0x18; - unsigned b00110000 = 0x30; - unsigned b00110010 = 0x32; - unsigned b00111000 = 0x38; - unsigned b00000110 = 0x06; - unsigned b00110110 = 0x36; - unsigned b00110111 = 0x37; - - AbridgedTopic x(b00111000); - SharedBloomFilter f1(b00111000); - SharedBloomFilter f2(x); - BOOST_REQUIRE_EQUAL(x, f1.getAbridgedTopic()); - BOOST_REQUIRE_EQUAL(x, f2.getAbridgedTopic()); - BOOST_REQUIRE_EQUAL(b00111000, f1.getUnsigned()); - BOOST_REQUIRE_EQUAL(b00111000, f2.getUnsigned()); - - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); - f.add(AbridgedTopic(b00000001)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00010000))); - f.add(AbridgedTopic(b00010000)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); - f.add(AbridgedTopic(b00011000)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110000))); - f.add(AbridgedTopic(b00110000)); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00111000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110010))); - f.add(AbridgedTopic(b00110010)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000110))); - f.add(AbridgedTopic(b00000110)); - - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110111))); - - f.remove(AbridgedTopic(b00000001)); - f.remove(AbridgedTopic(b00000001)); - f.remove(AbridgedTopic(b00000001)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00011000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00111000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); - - f.remove(AbridgedTopic(b00010000)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00011000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00111000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); - - f.remove(AbridgedTopic(b00111000)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); - - f.add(AbridgedTopic(b00000001)); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00000001))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110010))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00000110))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110110))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00110111))); - - f.remove(AbridgedTopic(b00110111)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); - BOOST_REQUIRE(f.matches(AbridgedTopic(b00010000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110010))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000110))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110110))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); - - f.remove(AbridgedTopic(b00110111)); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000001))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00010000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00011000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110010))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00111000))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00000110))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110110))); - BOOST_REQUIRE(!f.matches(AbridgedTopic(b00110111))); + TopicBloomFilter f; + vector vec; + Topic x(0xDEADBEEF); + int const c_rounds = 4; + + for (int i = 0; i < c_rounds; ++i, x = sha3(x)) + vec.push_back(abridge(x)); + + for (int i = 0; i < c_rounds; ++i) + testAddNonExisting(f, vec[i]); + + for (int i = 0; i < c_rounds; ++i) + testRemoveExisting(f, vec[i]); + + for (int i = 0; i < c_rounds; ++i) + testAddNonExistingBloom(f, vec[i]); + + for (int i = 0; i < c_rounds; ++i) + testRemoveExistingBloom(f, vec[i]); +} + +BOOST_AUTO_TEST_CASE(bloomFilterRaw) +{ + VerbosityHolder setTemporaryLevel(10); + cnote << "Testing Raw Bloom matching..."; + + TopicBloomFilter f; + + AbridgedTopic b00000001(0x01); + AbridgedTopic b00010000(0x10); + AbridgedTopic b00011000(0x18); + AbridgedTopic b00110000(0x30); + AbridgedTopic b00110010(0x32); + AbridgedTopic b00111000(0x38); + AbridgedTopic b00000110(0x06); + AbridgedTopic b00110110(0x36); + AbridgedTopic b00110111(0x37); + + testAddNonExisting(f, b00000001); + testAddNonExisting(f, b00010000); + testAddNonExisting(f, b00011000); + testAddNonExisting(f, b00110000); + BOOST_REQUIRE(f.contains(b00111000)); + testAddNonExisting(f, b00110010); + testAddNonExisting(f, b00000110); + BOOST_REQUIRE(f.contains(b00110110)); + BOOST_REQUIRE(f.contains(b00110111)); + + f.remove(b00000001); + f.remove(b00000001); + f.remove(b00000001); + BOOST_REQUIRE(!f.contains(b00000001)); + BOOST_REQUIRE(f.contains(b00010000)); + BOOST_REQUIRE(f.contains(b00011000)); + BOOST_REQUIRE(f.contains(b00110000)); + BOOST_REQUIRE(f.contains(b00110010)); + BOOST_REQUIRE(f.contains(b00111000)); + BOOST_REQUIRE(f.contains(b00000110)); + BOOST_REQUIRE(f.contains(b00110110)); + BOOST_REQUIRE(!f.contains(b00110111)); + + f.remove(b00010000); + BOOST_REQUIRE(!f.contains(b00000001)); + BOOST_REQUIRE(f.contains(b00010000)); + BOOST_REQUIRE(f.contains(b00011000)); + BOOST_REQUIRE(f.contains(b00110000)); + BOOST_REQUIRE(f.contains(b00110010)); + BOOST_REQUIRE(f.contains(b00111000)); + BOOST_REQUIRE(f.contains(b00000110)); + BOOST_REQUIRE(f.contains(b00110110)); + BOOST_REQUIRE(!f.contains(b00110111)); + + f.remove(b00111000); + BOOST_REQUIRE(!f.contains(b00000001)); + BOOST_REQUIRE(f.contains(b00010000)); + BOOST_REQUIRE(!f.contains(b00011000)); + BOOST_REQUIRE(f.contains(b00110000)); + BOOST_REQUIRE(f.contains(b00110010)); + BOOST_REQUIRE(!f.contains(b00111000)); + BOOST_REQUIRE(f.contains(b00000110)); + BOOST_REQUIRE(f.contains(b00110110)); + BOOST_REQUIRE(!f.contains(b00110111)); + + f.add(b00000001); + BOOST_REQUIRE(f.contains(b00000001)); + BOOST_REQUIRE(f.contains(b00010000)); + BOOST_REQUIRE(!f.contains(b00011000)); + BOOST_REQUIRE(f.contains(b00110000)); + BOOST_REQUIRE(f.contains(b00110010)); + BOOST_REQUIRE(!f.contains(b00111000)); + BOOST_REQUIRE(f.contains(b00000110)); + BOOST_REQUIRE(f.contains(b00110110)); + BOOST_REQUIRE(f.contains(b00110111)); + + f.remove(b00110111); + BOOST_REQUIRE(!f.contains(b00000001)); + BOOST_REQUIRE(f.contains(b00010000)); + BOOST_REQUIRE(!f.contains(b00011000)); + BOOST_REQUIRE(!f.contains(b00110000)); + BOOST_REQUIRE(!f.contains(b00110010)); + BOOST_REQUIRE(!f.contains(b00111000)); + BOOST_REQUIRE(!f.contains(b00000110)); + BOOST_REQUIRE(!f.contains(b00110110)); + BOOST_REQUIRE(!f.contains(b00110111)); + + f.remove(b00110111); + BOOST_REQUIRE(!f.contains(b00000001)); + BOOST_REQUIRE(!f.contains(b00010000)); + BOOST_REQUIRE(!f.contains(b00011000)); + BOOST_REQUIRE(!f.contains(b00110000)); + BOOST_REQUIRE(!f.contains(b00110010)); + BOOST_REQUIRE(!f.contains(b00111000)); + BOOST_REQUIRE(!f.contains(b00000110)); + BOOST_REQUIRE(!f.contains(b00110110)); + BOOST_REQUIRE(!f.contains(b00110111)); } BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file From 267b24bea683467ab89035adecb953cd548c4dcb Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Tue, 16 Jun 2015 21:35:57 +0800 Subject: [PATCH 064/169] Support changing miner in eth. --- eth/main.cpp | 2 ++ libweb3jsonrpc/WebThreeStubServer.cpp | 11 ++++++++++- libweb3jsonrpc/WebThreeStubServer.h | 5 ++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 382858ae7..32862edf1 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -827,6 +827,7 @@ int main(int argc, char** argv) { jsonrpcConnector = unique_ptr(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); + jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; }); jsonrpcServer->StartListening(); if (jsonAdmin.empty()) jsonAdmin = jsonrpcServer->newSession(SessionPermissions{{Priviledge::Admin}}); @@ -982,6 +983,7 @@ int main(int argc, char** argv) jsonrpc = SensibleHttpPort; jsonrpcConnector = unique_ptr(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); + jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; }); jsonrpcServer->StartListening(); if (jsonAdmin.empty()) jsonAdmin = jsonrpcServer->newSession(SessionPermissions{{Priviledge::Admin}}); diff --git a/libweb3jsonrpc/WebThreeStubServer.cpp b/libweb3jsonrpc/WebThreeStubServer.cpp index adef51033..a6ea52eda 100644 --- a/libweb3jsonrpc/WebThreeStubServer.cpp +++ b/libweb3jsonrpc/WebThreeStubServer.cpp @@ -205,7 +205,16 @@ Json::Value WebThreeStubServer::admin_eth_newAccount(Json::Value const& _info, s bool WebThreeStubServer::admin_eth_setMiningBenefactor(std::string const& _uuidOrAddress, std::string const& _session) { ADMIN; - (void)_uuidOrAddress; + Address a; + h128 uuid = fromUUID(_uuidOrAddress); + if (uuid) + a = m_keyMan.address(uuid); + else if (isHash
(_uuidOrAddress)) + a = Address(_uuidOrAddress); + else + throw jsonrpc::JsonRpcException("Invalid UUID or address"); + if (m_setMiningBenefactor) + m_setMiningBenefactor(a); return true; } diff --git a/libweb3jsonrpc/WebThreeStubServer.h b/libweb3jsonrpc/WebThreeStubServer.h index ecf8acca0..290bf456c 100644 --- a/libweb3jsonrpc/WebThreeStubServer.h +++ b/libweb3jsonrpc/WebThreeStubServer.h @@ -60,6 +60,8 @@ public: std::string newSession(SessionPermissions const& _p); void addSession(std::string const& _session, SessionPermissions const& _p) { m_sessions[_session] = _p; } + virtual void setMiningBenefactorChanger(std::function const& _f) { m_setMiningBenefactor = _f; } + private: virtual bool hasPriviledgeLevel(std::string const& _session, Priviledge _l) const override { auto it = m_sessions.find(_session); return it != m_sessions.end() && it->second.priviledges.count(_l); } @@ -80,9 +82,9 @@ private: virtual std::string admin_eth_blockQueueFirstUnknown(std::string const& _session) override; virtual bool admin_eth_blockQueueRetryUnknown(std::string const& _session) override; + virtual bool admin_eth_setMiningBenefactor(std::string const& _uuidOrAddress, std::string const& _session) override; virtual Json::Value admin_eth_allAccounts(std::string const& _session) override; virtual Json::Value admin_eth_newAccount(const Json::Value& _info, std::string const& _session) override; - virtual bool admin_eth_setMiningBenefactor(std::string const& _uuidOrAddress, std::string const& _session) override; virtual Json::Value admin_eth_inspect(std::string const& _address, std::string const& _session) override; virtual Json::Value admin_eth_reprocess(std::string const& _blockNumberOrHash, std::string const& _session) override; virtual Json::Value admin_eth_vmTrace(std::string const& _blockNumberOrHash, int _txIndex, std::string const& _session) override; @@ -101,6 +103,7 @@ private: leveldb::WriteOptions m_writeOptions; leveldb::DB* m_db; + std::function m_setMiningBenefactor; std::unordered_map m_sessions; }; From 4c854e8e9750847cc39c717cf9df8b4a7d79c861 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Tue, 16 Jun 2015 15:54:07 +0200 Subject: [PATCH 065/169] rebased on the latest develop --- libwhisper/BloomFilter.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index 89529146a..188e69f59 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -34,11 +34,11 @@ public: TopicBloomFilter() { init(); } TopicBloomFilter(AbridgedTopic const& _h): AbridgedTopic(_h) { init(); } - void addBloom(AbridgedTopic const& _h) { add(_h.template bloom()); } - void removeBloom(AbridgedTopic const& _h) { remove(_h.template bloom()); } + void addBloom(AbridgedTopic const& _h) { add(_h.template bloomPart()); } + void removeBloom(AbridgedTopic const& _h) { remove(_h.template bloomPart()); } void add(AbridgedTopic const& _h); void remove(AbridgedTopic const& _h); - bool containsBloom(AbridgedTopic const& _h) const { return contains(_h.template bloom()); } + bool containsBloom(AbridgedTopic const& _h) const { return contains(_h.template bloomPart()); } enum { BitsPerBloom = 3 }; From 5848faeb49112d15b963ccab0132ad1c9b24aa30 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2015 16:08:40 +0200 Subject: [PATCH 066/169] Some documentation and checks for vector_ref. --- libdevcore/vector_ref.h | 25 ++++++++++++++++++++++--- libevmasm/Assembly.cpp | 10 ---------- libevmasm/AssemblyItem.cpp | 7 ------- libevmasm/AssemblyItem.h | 9 ++++++--- 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h index b04d449b3..98c6adb21 100644 --- a/libdevcore/vector_ref.h +++ b/libdevcore/vector_ref.h @@ -9,6 +9,9 @@ namespace dev { +/** + * A modifiable reference to an existing object or vector in memory. + */ template class vector_ref { @@ -17,34 +20,50 @@ public: using element_type = _T; using mutable_value_type = typename std::conditional::value, typename std::remove_const<_T>::type, _T>::type; + static_assert(std::is_pod::value, "vector_ref can only be used with PODs due to its low-level treatment of data."); + vector_ref(): m_data(nullptr), m_count(0) {} + /// Creates a new vector_ref to point to @a _count elements starting at @a _data. vector_ref(_T* _data, size_t _count): m_data(_data), m_count(_count) {} + /// Creates a new vector_ref pointing to the data part of a string (given as pointer). vector_ref(typename std::conditional::value, std::string const*, std::string*>::type _data): m_data(reinterpret_cast<_T*>(_data->data())), m_count(_data->size() / sizeof(_T)) {} + /// Creates a new vector_ref pointing to the data part of a vector (given as pointer). vector_ref(typename std::conditional::value, std::vector::type> const*, std::vector<_T>*>::type _data): m_data(_data->data()), m_count(_data->size()) {} - vector_ref(typename std::conditional::value, std::string const&, std::string&>::type _data): m_data((_T*)_data.data()), m_count(_data.size() / sizeof(_T)) {} + /// Creates a new vector_ref pointing to the data part of a string (given as reference). + vector_ref(typename std::conditional::value, std::string const&, std::string&>::type _data): m_data(reinterpret_cast<_T*>(_data.data())), m_count(_data.size() / sizeof(_T)) {} #ifdef STORAGE_LEVELDB_INCLUDE_DB_H_ vector_ref(leveldb::Slice const& _s): m_data(reinterpret_cast<_T*>(_s.data())), m_count(_s.size() / sizeof(_T)) {} #endif explicit operator bool() const { return m_data && m_count; } - bool contentsEqual(std::vector const& _c) const { return _c.size() == m_count && !memcmp(_c.data(), m_data, m_count); } + bool contentsEqual(std::vector const& _c) const { if (!m_data || m_count == 0) return _c.empty(); else return _c.size() == m_count && !memcmp(_c.data(), m_data, m_count * sizeof(_T)); } std::vector toVector() const { return std::vector(m_data, m_data + m_count); } std::vector toBytes() const { return std::vector(reinterpret_cast(m_data), reinterpret_cast(m_data) + m_count * sizeof(_T)); } std::string toString() const { return std::string((char const*)m_data, ((char const*)m_data) + m_count * sizeof(_T)); } + template explicit operator vector_ref<_T2>() const { assert(m_count * sizeof(_T) / sizeof(_T2) * sizeof(_T2) / sizeof(_T) == m_count); return vector_ref<_T2>(reinterpret_cast<_T2*>(m_data), m_count * sizeof(_T) / sizeof(_T2)); } operator vector_ref<_T const>() const { return vector_ref<_T const>(m_data, m_count); } _T* data() const { return m_data; } + /// @returns the number of elements referenced (not necessarily number of bytes). size_t count() const { return m_count; } + /// @returns the number of elements referenced (not necessarily number of bytes). size_t size() const { return m_count; } bool empty() const { return !m_count; } - vector_ref<_T> next() const { return vector_ref<_T>(m_data + m_count, m_count); } + /// @returns a new vector_ref pointing at the next chunk of @a size() elements. + vector_ref<_T> next() const { if (!m_data) return *this; else return vector_ref<_T>(m_data + m_count, m_count); } + /// @returns a new vector_ref which is a shifted and shortened view of the original data. + /// If this goes out of bounds in any way, returns an empty vector_ref. + /// If @a _count is ~size_t(0), extends the view to the end of the data. vector_ref<_T> cropped(size_t _begin, size_t _count) const { if (m_data && _begin + _count <= m_count) return vector_ref<_T>(m_data + _begin, _count == ~size_t(0) ? m_count - _begin : _count); else return vector_ref<_T>(); } + /// @returns a new vector_ref which is a shifted view of the original data (not going beyond it). vector_ref<_T> cropped(size_t _begin) const { if (m_data && _begin <= m_count) return vector_ref<_T>(m_data + _begin, m_count - _begin); else return vector_ref<_T>(); } void retarget(_T* _d, size_t _s) { m_data = _d; m_count = _s; } void retarget(std::vector<_T> const& _t) { m_data = _t.data(); m_count = _t.size(); } template bool overlapsWith(vector_ref _t) const { void const* f1 = data(); void const* t1 = data() + size(); void const* f2 = _t.data(); void const* t2 = _t.data() + _t.size(); return f1 < t2 && t1 > f2; } + /// Copies the contents of this vector_ref to the contents of @a _t, up to the max size of @a _t. void copyTo(vector_ref::type> _t) const { if (overlapsWith(_t)) memmove(_t.data(), m_data, std::min(_t.size(), m_count) * sizeof(_T)); else memcpy(_t.data(), m_data, std::min(_t.size(), m_count) * sizeof(_T)); } + /// Copies the contents of this vector_ref to the contents of @a _t, and zeros further trailing elements in @a _t. void populate(vector_ref::type> _t) const { copyTo(_t); memset(_t.data() + m_count, 0, std::max(_t.size(), m_count) - m_count); } _T* begin() { return m_data; } diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 3557fc0ee..34ee05966 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -292,16 +292,6 @@ void Assembly::injectStart(AssemblyItem const& _i) m_items.insert(m_items.begin(), _i); } -inline bool matches(AssemblyItemsConstRef _a, AssemblyItemsConstRef _b) -{ - if (_a.size() != _b.size()) - return false; - for (unsigned i = 0; i < _a.size(); ++i) - if (!_a[i].match(_b[i])) - return false; - return true; -} - struct OptimiserChannel: public LogChannel { static const char* name() { return "OPT"; } static const int verbosity = 12; }; #define copt dev::LogOutputStream() diff --git a/libevmasm/AssemblyItem.cpp b/libevmasm/AssemblyItem.cpp index a4485a144..a0c5e19a6 100644 --- a/libevmasm/AssemblyItem.cpp +++ b/libevmasm/AssemblyItem.cpp @@ -126,10 +126,3 @@ ostream& dev::eth::operator<<(ostream& _out, AssemblyItem const& _item) } return _out; } - -ostream& dev::eth::operator<<(ostream& _out, AssemblyItemsConstRef _i) -{ - for (AssemblyItem const& i: _i) - _out << i; - return _out; -} diff --git a/libevmasm/AssemblyItem.h b/libevmasm/AssemblyItem.h index 9eca0a7d1..3fa9bb203 100644 --- a/libevmasm/AssemblyItem.h +++ b/libevmasm/AssemblyItem.h @@ -98,11 +98,14 @@ private: }; using AssemblyItems = std::vector; -using AssemblyItemsConstRef = vector_ref; std::ostream& operator<<(std::ostream& _out, AssemblyItem const& _item); -std::ostream& operator<<(std::ostream& _out, AssemblyItemsConstRef _i); -inline std::ostream& operator<<(std::ostream& _out, AssemblyItems const& _i) { return operator<<(_out, AssemblyItemsConstRef(&_i)); } +inline std::ostream& operator<<(std::ostream& _out, AssemblyItems const& _items) +{ + for (AssemblyItem const& item: _items) + _out << item; + return _out; +} } } From b046146d48e80d7a0e678060d696403f05d15a9a Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Tue, 16 Jun 2015 16:17:29 +0200 Subject: [PATCH 067/169] unused variable removed --- libwhisper/BloomFilter.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp index 1b6ea7f74..e02b6e1d0 100644 --- a/libwhisper/BloomFilter.cpp +++ b/libwhisper/BloomFilter.cpp @@ -30,7 +30,6 @@ static unsigned const c_mask[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; void TopicBloomFilter::add(AbridgedTopic const& _h) { *this |= _h; - unsigned count = 0; for (unsigned i = 0; i < CounterSize; ++i) if (isBitSet(_h, i)) { @@ -46,7 +45,6 @@ void TopicBloomFilter::add(AbridgedTopic const& _h) void TopicBloomFilter::remove(AbridgedTopic const& _h) { - unsigned count = 0; for (unsigned i = 0; i < CounterSize; ++i) if (isBitSet(_h, i)) { From 63ad9620416f2d593db6e2b730fd5e2dfabf6355 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 16 Jun 2015 16:35:50 +0200 Subject: [PATCH 068/169] fix #2194 --- mix/ContractCallDataEncoder.cpp | 16 +++++++++++----- mix/qml/QStringTypeView.qml | 15 +++++++++++++-- mix/qml/js/InputValidator.js | 10 +++++++++- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index 8f5f3ecc7..e67ce9cea 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -80,10 +80,7 @@ void ContractCallDataEncoder::encodeArray(QJsonArray const& _array, QList _ if (c.isArray()) { if (_dim[0] == -1) - { - m_dynamicOffsetMap.push_back(std::make_pair(m_dynamicData.size() + offsetStart + 32 + k * 32, - m_dynamicData.size() + _content.size())); - } + m_dynamicOffsetMap.push_back(std::make_pair(m_dynamicData.size() + offsetStart + 32 + k * 32, m_dynamicData.size() + _content.size())); encodeArray(c.toArray(), _dim, _type, _content); } else @@ -183,6 +180,11 @@ unsigned ContractCallDataEncoder::encodeSingleItem(QString const& _data, Solidit catch (std::exception const&) { // manage input as a string. + QRegExp strExtract("\"(.*)\""); //check if contains both string and hex value, keep the string. + int i = strExtract.indexIn(src); + if (i != -1) + src = strExtract.cap(0); + src = src.replace("\"", ""); result = encodeStringParam(src, alignSize); } } @@ -249,7 +251,11 @@ dev::bytes ContractCallDataEncoder::decodeBytes(dev::bytes const& _rawValue) QString ContractCallDataEncoder::toString(dev::bytes const& _b) { - return QString::fromStdString(dev::toJS(_b)); + QString str; + if (asString(_b, str)) + return "\"" + str + "\" " + QString::fromStdString(dev::toJS(_b)); + else + return QString::fromStdString(dev::toJS(_b)); } QString ContractCallDataEncoder::toChar(dev::bytes const& _b) diff --git a/mix/qml/QStringTypeView.qml b/mix/qml/QStringTypeView.qml index 080c49282..101863421 100644 --- a/mix/qml/QStringTypeView.qml +++ b/mix/qml/QStringTypeView.qml @@ -2,11 +2,15 @@ import QtQuick 2.0 Item { - property alias value: textinput.text + property string value property alias readOnly: textinput.readOnly id: editRoot height: 20 width: readOnly ? textinput.implicitWidth : 150 + onValueChanged: + { + textinput.text = value + } SourceSansProBold { @@ -18,12 +22,19 @@ Item radius: 4 TextInput { id: textinput - text: value clip: true anchors.fill: parent wrapMode: Text.WrapAnywhere font.family: boldFont.name selectByMouse: true + onTextChanged: { + var stringRegEx = new RegExp('"^\\"*', "g") + var str = stringRegEx.exec(text) + if (str && str.length > 0) + value = str[0] + else + value = text + } } } } diff --git a/mix/qml/js/InputValidator.js b/mix/qml/js/InputValidator.js index 8a8ef1715..aa3b90150 100644 --- a/mix/qml/js/InputValidator.js +++ b/mix/qml/js/InputValidator.js @@ -187,7 +187,15 @@ function validateAddress(_type, _value) function validateBytes(_type, _value) { var ret = { valid: true, message: "" } - if (_value.length > parseInt(_type.replace("bytes", "")) ) + if (_value.indexOf("\"") === 0 && _value.indexOf("0x") !== -1) + { + //this is a different fomatting + var stringRegEx = new RegExp('".*"', "g"); + var matches = _value.match(stringRegEx); + if (matches.length === 1) + _value = matches[0] + } + if (_type !== "bytes" && _value.length > parseInt(_type.replace("bytes", "")) ) { ret.valid = false; ret.message = _type + " should not contains more than " + _type.replace("bytes", "") + " characters"; From af4d1b027ca349b8e14e48c3da131ed2600ffc20 Mon Sep 17 00:00:00 2001 From: yann300 Date: Tue, 16 Jun 2015 16:59:02 +0200 Subject: [PATCH 069/169] bux fixes --- mix/qml/js/InputValidator.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mix/qml/js/InputValidator.js b/mix/qml/js/InputValidator.js index aa3b90150..46b23274d 100644 --- a/mix/qml/js/InputValidator.js +++ b/mix/qml/js/InputValidator.js @@ -110,9 +110,8 @@ function validateArray(_type, _value) var dim = _type.match(arrayRegEx) dim.reverse(); for (var k = 0; k < dim.length; k++) - { _type = _type.replace(dim[k], "") - } + _type = _type.replace(/calldata/g, "") return checkArrayRecursively(_type, dim, _value) } From c75c72a99443acca133c8f35efc3332f79f46bde Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2015 17:20:41 +0200 Subject: [PATCH 070/169] Type conversion specialities for storage references. --- libsolidity/CompilerUtils.cpp | 9 ++++++--- libsolidity/ExpressionCompiler.cpp | 23 +++++++++++------------ libsolidity/Types.h | 3 +++ test/libsolidity/SolidityEndToEndTest.cpp | 10 +++++----- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index 349877a29..d4e705a3c 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -274,10 +274,13 @@ void CompilerUtils::encodeToMemory( else { copyToStackTop(argSize - stackPos + dynPointers + 2, _givenTypes[i]->getSizeOnStack()); - if (targetType->isValueType()) - convertType(*_givenTypes[i], *targetType, true); solAssert(!!targetType, "Externalable type expected."); - storeInMemoryDynamic(*targetType, _padToWordBoundaries); + TypePointer type = targetType; + if (_givenTypes[i]->isInStorage()) + type = _givenTypes[i]; // delay conversion + else + convertType(*_givenTypes[i], *targetType, true); + storeInMemoryDynamic(*type, _padToWordBoundaries); } stackPos += _givenTypes[i]->getSizeOnStack(); } diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index 12274c7ab..c98d76f3f 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -146,10 +146,13 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) { CompilerContext::LocationSetter locationSetter(m_context, _assignment); _assignment.getRightHandSide().accept(*this); - if (_assignment.getType()->isValueType()) - utils().convertType(*_assignment.getRightHandSide().getType(), *_assignment.getType()); - // We need this conversion mostly in the case of compound assignments. For non-value types - // the conversion is done in LValue::storeValue. + TypePointer type = _assignment.getRightHandSide().getType(); + if (!_assignment.getType()->isInStorage()) + { + utils().convertType(*type, *_assignment.getType()); + type = _assignment.getType(); + } + _assignment.getLeftHandSide().accept(*this); solAssert(!!m_currentLValue, "LValue not retrieved."); @@ -175,7 +178,7 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) m_context << eth::swapInstruction(itemSize + lvalueSize) << eth::Instruction::POP; } } - m_currentLValue->storeValue(*_assignment.getRightHandSide().getType(), _assignment.getLocation()); + m_currentLValue->storeValue(*type, _assignment.getLocation()); m_currentLValue.reset(); return false; } @@ -1119,14 +1122,10 @@ void ExpressionCompiler::appendExternalFunctionCall( void ExpressionCompiler::appendExpressionCopyToMemory(Type const& _expectedType, Expression const& _expression) { + solAssert(_expectedType.isValueType(), "Not implemented for non-value types."); _expression.accept(*this); - if (_expectedType.isValueType()) - { - utils().convertType(*_expression.getType(), _expectedType, true); - utils().storeInMemoryDynamic(_expectedType); - } - else - utils().storeInMemoryDynamic(*_expression.getType()->mobileType()); + utils().convertType(*_expression.getType(), _expectedType, true); + utils().storeInMemoryDynamic(_expectedType); } void ExpressionCompiler::setLValueFromDeclaration(Declaration const& _declaration, Expression const& _expression) diff --git a/libsolidity/Types.h b/libsolidity/Types.h index 0f86ac95f..70f7807c8 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -202,6 +202,8 @@ public: /// This returns the corresponding integer type for IntegerConstantTypes and the pointer type /// for storage reference types. virtual TypePointer mobileType() const { return shared_from_this(); } + /// @returns true if this type is a storage pointer or reference. + virtual bool isInStorage() const { return false; } /// Returns the list of all members of this type. Default implementation: no members. virtual MemberList const& getMembers() const { return EmptyMemberList; } @@ -374,6 +376,7 @@ public: virtual TypePointer copyForLocation(Location _location, bool _isPointer) const = 0; virtual TypePointer mobileType() const override { return copyForLocation(m_location, true); } + virtual bool isInStorage() const override { return m_location == Location::Storage; } /// Storage references can be pointers or bound references. In general, local variables are of /// pointer type, state variables are bound references. Assignments to pointers or deleting diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f4d875e77..109481edc 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4243,9 +4243,9 @@ BOOST_AUTO_TEST_CASE(return_string) function get1() returns (string r) { return s; } -// function get2() returns (string r) { -// r = s; -// } + function get2() returns (string r) { + r = s; + } } )"; compileAndRun(sourceCode, 0, "Main"); @@ -4253,8 +4253,8 @@ BOOST_AUTO_TEST_CASE(return_string) bytes args = encodeArgs(u256(0x20), u256(s.length()), s); BOOST_REQUIRE(callContractFunction("set(string)", asString(args)) == encodeArgs()); BOOST_CHECK(callContractFunction("get1()") == args); -// BOOST_CHECK(callContractFunction("get2()") == args); -// BOOST_CHECK(callContractFunction("s()") == args); + BOOST_CHECK(callContractFunction("get2()") == args); + BOOST_CHECK(callContractFunction("s()") == args); } BOOST_AUTO_TEST_SUITE_END() From c449a648b4174f9aa8955ffcdfb939e83bd6d35e Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Tue, 16 Jun 2015 23:17:59 +0200 Subject: [PATCH 071/169] naming conventions changed --- libwhisper/BloomFilter.cpp | 4 ++-- libwhisper/BloomFilter.h | 12 +++++++----- libwhisper/Common.cpp | 5 +++-- libwhisper/Common.h | 2 +- libwhisper/WhisperHost.cpp | 4 ++-- test/libwhisper/bloomFilter.cpp | 28 ++++++++++++++-------------- 6 files changed, 29 insertions(+), 26 deletions(-) diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp index e02b6e1d0..c189ee912 100644 --- a/libwhisper/BloomFilter.cpp +++ b/libwhisper/BloomFilter.cpp @@ -27,7 +27,7 @@ using namespace dev::shh; static unsigned const c_mask[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; -void TopicBloomFilter::add(AbridgedTopic const& _h) +void TopicBloomFilter::addRaw(AbridgedTopic const& _h) { *this |= _h; for (unsigned i = 0; i < CounterSize; ++i) @@ -43,7 +43,7 @@ void TopicBloomFilter::add(AbridgedTopic const& _h) } } -void TopicBloomFilter::remove(AbridgedTopic const& _h) +void TopicBloomFilter::removeRaw(AbridgedTopic const& _h) { for (unsigned i = 0; i < CounterSize; ++i) if (isBitSet(_h, i)) diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index 188e69f59..0ca460805 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -34,19 +34,21 @@ public: TopicBloomFilter() { init(); } TopicBloomFilter(AbridgedTopic const& _h): AbridgedTopic(_h) { init(); } - void addBloom(AbridgedTopic const& _h) { add(_h.template bloomPart()); } - void removeBloom(AbridgedTopic const& _h) { remove(_h.template bloomPart()); } - void add(AbridgedTopic const& _h); - void remove(AbridgedTopic const& _h); + void addBloom(AbridgedTopic const& _h) { addRaw(_h.template bloomPart()); } + void removeBloom(AbridgedTopic const& _h) { removeRaw(_h.template bloomPart()); } bool containsBloom(AbridgedTopic const& _h) const { return contains(_h.template bloomPart()); } + void addRaw(AbridgedTopic const& _h); + void removeRaw(AbridgedTopic const& _h); + bool containsRaw(AbridgedTopic const& _h) const { return contains(_h); } + enum { BitsPerBloom = 3 }; private: void init() { for (unsigned i = 0; i < CounterSize; ++i) m_refCounter[i] = 0; } static bool isBitSet(AbridgedTopic const& _h, unsigned _index); - enum { CounterSize = 8 * AbridgedTopic::size }; + enum { CounterSize = 8 * TopicBloomFilter::size }; std::array m_refCounter; }; diff --git a/libwhisper/Common.cpp b/libwhisper/Common.cpp index 92fd997c5..5dc267fcf 100644 --- a/libwhisper/Common.cpp +++ b/libwhisper/Common.cpp @@ -22,6 +22,7 @@ #include "Common.h" #include #include "Message.h" +#include "BloomFilter.h" using namespace std; using namespace dev; @@ -94,12 +95,12 @@ TopicFilter::TopicFilter(RLP const& _r) } } -AbridgedTopic TopicFilter::exportBloomFilter() const +AbridgedTopic TopicFilter::exportBloom() const { AbridgedTopic ret; for (TopicMask const& t: m_topicMasks) for (auto i: t) - ret |= i.first; + ret |= i.first.template bloomPart(); return ret; } diff --git a/libwhisper/Common.h b/libwhisper/Common.h index eb624893a..07c5b3317 100644 --- a/libwhisper/Common.h +++ b/libwhisper/Common.h @@ -105,7 +105,7 @@ public: void streamRLP(RLPStream& _s) const { _s << m_topicMasks; } h256 sha3() const; bool matches(Envelope const& _m) const; - AbridgedTopic exportBloomFilter() const; + AbridgedTopic exportBloom() const; private: TopicMasks m_topicMasks; diff --git a/libwhisper/WhisperHost.cpp b/libwhisper/WhisperHost.cpp index 962abd829..d6759df6f 100644 --- a/libwhisper/WhisperHost.cpp +++ b/libwhisper/WhisperHost.cpp @@ -113,7 +113,7 @@ unsigned WhisperHost::installWatch(shh::Topics const& _t) if (!m_filters.count(h)) m_filters.insert(make_pair(h, f)); - m_bloom.add(f.filter.exportBloomFilter()); + m_bloom.addRaw(f.filter.exportBloom()); return installWatchOnId(h); } @@ -153,7 +153,7 @@ void WhisperHost::uninstallWatch(unsigned _i) auto fit = m_filters.find(id); if (fit != m_filters.end()) { - m_bloom.remove(fit->second.filter.exportBloomFilter()); + m_bloom.removeRaw(fit->second.filter.exportBloom()); if (!--fit->second.refCount) m_filters.erase(fit); } diff --git a/test/libwhisper/bloomFilter.cpp b/test/libwhisper/bloomFilter.cpp index d7a4c76ef..adf76c429 100644 --- a/test/libwhisper/bloomFilter.cpp +++ b/test/libwhisper/bloomFilter.cpp @@ -29,16 +29,16 @@ using namespace dev::shh; void testAddNonExisting(TopicBloomFilter& _f, AbridgedTopic const& _h) { - BOOST_REQUIRE(!_f.contains(_h)); - _f.add(_h); - BOOST_REQUIRE(_f.contains(_h)); + BOOST_REQUIRE(!_f.containsRaw(_h)); + _f.addRaw(_h); + BOOST_REQUIRE(_f.containsRaw(_h)); } void testRemoveExisting(TopicBloomFilter& _f, AbridgedTopic const& _h) { - BOOST_REQUIRE(_f.contains(_h)); - _f.remove(_h); - BOOST_REQUIRE(!_f.contains(_h)); + BOOST_REQUIRE(_f.containsRaw(_h)); + _f.removeRaw(_h); + BOOST_REQUIRE(!_f.containsRaw(_h)); } void testAddNonExistingBloom(TopicBloomFilter& _f, AbridgedTopic const& _h) @@ -110,9 +110,9 @@ BOOST_AUTO_TEST_CASE(bloomFilterRaw) BOOST_REQUIRE(f.contains(b00110110)); BOOST_REQUIRE(f.contains(b00110111)); - f.remove(b00000001); - f.remove(b00000001); - f.remove(b00000001); + f.removeRaw(b00000001); + f.removeRaw(b00000001); + f.removeRaw(b00000001); BOOST_REQUIRE(!f.contains(b00000001)); BOOST_REQUIRE(f.contains(b00010000)); BOOST_REQUIRE(f.contains(b00011000)); @@ -123,7 +123,7 @@ BOOST_AUTO_TEST_CASE(bloomFilterRaw) BOOST_REQUIRE(f.contains(b00110110)); BOOST_REQUIRE(!f.contains(b00110111)); - f.remove(b00010000); + f.removeRaw(b00010000); BOOST_REQUIRE(!f.contains(b00000001)); BOOST_REQUIRE(f.contains(b00010000)); BOOST_REQUIRE(f.contains(b00011000)); @@ -134,7 +134,7 @@ BOOST_AUTO_TEST_CASE(bloomFilterRaw) BOOST_REQUIRE(f.contains(b00110110)); BOOST_REQUIRE(!f.contains(b00110111)); - f.remove(b00111000); + f.removeRaw(b00111000); BOOST_REQUIRE(!f.contains(b00000001)); BOOST_REQUIRE(f.contains(b00010000)); BOOST_REQUIRE(!f.contains(b00011000)); @@ -145,7 +145,7 @@ BOOST_AUTO_TEST_CASE(bloomFilterRaw) BOOST_REQUIRE(f.contains(b00110110)); BOOST_REQUIRE(!f.contains(b00110111)); - f.add(b00000001); + f.addRaw(b00000001); BOOST_REQUIRE(f.contains(b00000001)); BOOST_REQUIRE(f.contains(b00010000)); BOOST_REQUIRE(!f.contains(b00011000)); @@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE(bloomFilterRaw) BOOST_REQUIRE(f.contains(b00110110)); BOOST_REQUIRE(f.contains(b00110111)); - f.remove(b00110111); + f.removeRaw(b00110111); BOOST_REQUIRE(!f.contains(b00000001)); BOOST_REQUIRE(f.contains(b00010000)); BOOST_REQUIRE(!f.contains(b00011000)); @@ -167,7 +167,7 @@ BOOST_AUTO_TEST_CASE(bloomFilterRaw) BOOST_REQUIRE(!f.contains(b00110110)); BOOST_REQUIRE(!f.contains(b00110111)); - f.remove(b00110111); + f.removeRaw(b00110111); BOOST_REQUIRE(!f.contains(b00000001)); BOOST_REQUIRE(!f.contains(b00010000)); BOOST_REQUIRE(!f.contains(b00011000)); From 2ad9a6d265ad2ab7b4d4ae97a3226082d50b3396 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 10:06:00 +0200 Subject: [PATCH 072/169] reverted to old pv61 sync code --- libethcore/Common.h | 3 +- libethereum/BlockChain.cpp | 2 +- libethereum/BlockChainSync.cpp | 701 +++++++++++++++++++++++++++++++++ libethereum/BlockChainSync.h | 146 +++++++ libethereum/BlockQueue.cpp | 3 +- libethereum/CommonNet.h | 6 +- libethereum/EthereumHost.cpp | 578 +++------------------------ libethereum/EthereumHost.h | 64 +-- libethereum/EthereumPeer.cpp | 11 +- libethereum/EthereumPeer.h | 16 +- 10 files changed, 941 insertions(+), 589 deletions(-) create mode 100644 libethereum/BlockChainSync.cpp create mode 100644 libethereum/BlockChainSync.h diff --git a/libethcore/Common.h b/libethcore/Common.h index 6f23cb0e8..77ec9fa3b 100644 --- a/libethcore/Common.h +++ b/libethcore/Common.h @@ -100,7 +100,8 @@ enum class ImportResult { Success = 0, UnknownParent, - FutureTime, + FutureTimeKnown, + FutureTimeUnkwnown, AlreadyInChain, AlreadyKnown, Malformed, diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index bd6996a45..b667ba03f 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -372,7 +372,7 @@ pair BlockChain::attemptImport(bytes const& _block, O } catch (FutureTime&) { - return make_pair(ImportResult::FutureTime, make_pair(h256s(), h256s())); + return make_pair(ImportResult::FutureTimeKnown, make_pair(h256s(), h256s())); } catch (Exception& ex) { diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp new file mode 100644 index 000000000..ed43e0786 --- /dev/null +++ b/libethereum/BlockChainSync.cpp @@ -0,0 +1,701 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file EthereumHost.cpp + * @author Gav Wood + * @date 2014 + */ + +#include "BlockChainSync.h" + +#include +#include +#include +#include +#include +#include +#include +#include "BlockChain.h" +#include "TransactionQueue.h" +#include "BlockQueue.h" +#include "EthereumPeer.h" +#include "EthereumHost.h" +#include "DownloadMan.h" +using namespace std; +using namespace dev; +using namespace dev::eth; +using namespace p2p; + + +unsigned const c_chainReorgSize = 30000; + + +BlockChainSync::BlockChainSync(EthereumHost& _host): + m_host(_host) +{ +} + +BlockChainSync::~BlockChainSync() +{ + abortSync(); +} + +DownloadMan const& BlockChainSync::downloadMan() const +{ + return host().downloadMan(); +} + +DownloadMan& BlockChainSync::downloadMan() +{ + return host().downloadMan(); +} + +void BlockChainSync::abortSync() +{ + host().foreachPeer([this](EthereumPeer* _p) { onPeerAborting(_p); return true; }); + downloadMan().resetToChain(h256s()); +} + +void BlockChainSync::onPeerStatus(EthereumPeer*) +{ + +} + +unsigned BlockChainSync::estimateHashes() +{ + BlockInfo block = host().chain().info(); + time_t lastBlockTime = (block.hash() == host().chain().genesisHash()) ? 1428192000 : (time_t)block.timestamp; + time_t now = time(0); + unsigned blockCount = c_chainReorgSize; + if (lastBlockTime > now) + clog(NetWarn) << "Clock skew? Latest block is in the future"; + else + blockCount += (now - lastBlockTime) / (unsigned)c_durationLimit; + clog(NetAllDetail) << "Estimated hashes: " << blockCount; + return blockCount; +} + +PV60Sync::PV60Sync(EthereumHost& _host): + BlockChainSync(_host) +{ +} + +SyncStatus PV60Sync::status() const +{ + RecursiveGuard l(x_sync); + SyncStatus res; + res.state = m_state; + if (m_state == SyncState::Hashes) + { + res.hashesTotal = m_estimatedHashes; + res.hashesReceived = static_cast(m_syncingNeededBlocks.size()); + res.hashesEstimated = true; + } + else if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks || m_state == SyncState::Waiting) + { + res.blocksTotal = downloadMan().chainSize(); + res.blocksReceived = downloadMan().blocksGot().size(); + } + return res; +} + +void PV60Sync::setState(EthereumPeer* _peer, SyncState _s, bool _isSyncing, bool _needHelp) +{ + bool changedState = (m_state != _s); + m_state = _s; + + if (_isSyncing != (m_syncer == _peer) || (_isSyncing && changedState)) + changeSyncer(_isSyncing ? _peer : nullptr, _needHelp); + else if (_s == SyncState::Idle) + changeSyncer(nullptr, _needHelp); + + assert(!!m_syncer || _s == SyncState::Idle); + + if (!_isSyncing) + { + m_syncingLatestHash = h256(); + m_syncingTotalDifficulty = 0; + m_syncingNeededBlocks.clear(); + } +} + +void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _needHelp) +{ + clog(NetMessageSummary) << "Transition!" << EthereumHost::stateName(_s) << "from" << EthereumHost::stateName(m_state) << ", " << (isSyncing(_peer) ? "syncing" : "holding") << (needsSyncing(_peer) ? "& needed" : ""); + + //DEV_INVARIANT_CHECK; + if (m_state == SyncState::Idle && _s != SyncState::Idle) + _peer->m_requireTransactions = true; + + RLPStream s; + if (_s == SyncState::Hashes) + { + if (m_state == SyncState::Idle) + { + if (isSyncing(_peer)) + clog(NetWarn) << "Bad state: not asking for Hashes, yet syncing!"; + + m_syncingLatestHash = _peer->m_latestHash; + m_syncingTotalDifficulty = _peer->m_totalDifficulty; + setState(_peer, _s, true); + _peer->requestHashes(m_syncingLatestHash); + DEV_INVARIANT_CHECK; + return; + } + else if (m_state == SyncState::Hashes) + { + if (!isSyncing(_peer)) + clog(NetWarn) << "Bad state: asking for Hashes yet not syncing!"; + + setState(_peer, _s, true); + _peer->requestHashes(m_syncingLastReceivedHash); + DEV_INVARIANT_CHECK; + return; + } + } + else if (_s == SyncState::Blocks) + { + if (m_state == SyncState::Hashes) + { + if (!isSyncing(_peer)) + { + clog(NetWarn) << "Bad state: asking for Hashes yet not syncing!"; + return; + } + if (shouldGrabBlocks(_peer)) + { + clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash << ", was" << host().latestBlockSent() << "]"; + downloadMan().resetToChain(m_syncingNeededBlocks); + } + else + { + clog(NetNote) << "Difficulty of hashchain not HIGHER. Ignoring."; + m_syncingLatestHash = h256(); + setState(_peer, SyncState::Idle, false); + return; + } + assert (isSyncing(_peer)); + } + // run through into... + if (m_state == SyncState::Idle || m_state == SyncState::Hashes || m_state == SyncState::Blocks) + { + // Looks like it's the best yet for total difficulty. Set to download. + setState(_peer, SyncState::Blocks, isSyncing(_peer), _needHelp); // will kick off other peers to help if available. + requestBlocks(_peer); + DEV_INVARIANT_CHECK; + return; + } + } + else if (_s == SyncState::NewBlocks) + { + if (m_state != SyncState::Idle && m_state != SyncState::NewBlocks) + clog(NetWarn) << "Bad state: Asking new blocks while syncing!"; + else + { + setState(_peer, SyncState::NewBlocks, true, _needHelp); + requestBlocks(_peer); + DEV_INVARIANT_CHECK; + return; + } + } + else if (_s == SyncState::Idle) + { + host().foreachPeer([this](EthereumPeer* _p) { _p->setIdle(); return true; }); + if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) + { + clog(NetNote) << "Finishing blocks fetch..."; + + // a bit overkill given that the other nodes may yet have the needed blocks, but better to be safe than sorry. + if (isSyncing(_peer)) + noteDoneBlocks(_peer, _force); + + // NOTE: need to notify of giving up on chain-hashes, too, altering state as necessary. + _peer->m_sub.doneFetch(); + _peer->setIdle(); + setState(_peer, SyncState::Idle, false); + } + else if (m_state == SyncState::Hashes) + { + clog(NetNote) << "Finishing hashes fetch..."; + setState(_peer, SyncState::Idle, false); + } + // Otherwise it's fine. We don't care if it's Nothing->Nothing. + DEV_INVARIANT_CHECK; + return; + } + + clog(NetWarn) << "Invalid state transition:" << EthereumHost::stateName(_s) << "from" << EthereumHost::stateName(m_state) << ", " << (isSyncing(_peer) ? "syncing" : "holding") << (needsSyncing(_peer) ? "& needed" : ""); +} + +void PV60Sync::requestBlocks(EthereumPeer* _peer) +{ + _peer->requestBlocks(); + if (_peer->m_asking != Asking::Blocks) //nothing to download + { + noteDoneBlocks(_peer, false); + if (downloadMan().isComplete()) + transition(_peer, SyncState::Idle); + return; + } +} + +void PV60Sync::setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td) +{ + _peer->m_latestHash = _latestHash; + _peer->m_totalDifficulty = _td; + + if (_peer->m_latestHash) + noteNeedsSyncing(_peer); + + _peer->session()->addNote("sync", string(isSyncing(_peer) ? "ongoing" : "holding") + (needsSyncing(_peer) ? " & needed" : "")); +} + +bool PV60Sync::isSyncing(EthereumPeer* _peer) const +{ + return m_syncer == _peer; +} + +bool PV60Sync::shouldGrabBlocks(EthereumPeer* _peer) const +{ + auto td = _peer->m_totalDifficulty; + auto lh = _peer->m_latestHash; + auto ctd = host().chain().details().totalDifficulty; + + if (m_syncingNeededBlocks.empty()) + return false; + + clog(NetNote) << "Should grab blocks? " << td << "vs" << ctd << ";" << m_syncingNeededBlocks.size() << " blocks, ends" << m_syncingNeededBlocks.back(); + + if (td < ctd || (td == ctd && host().chain().currentHash() == lh)) + return false; + + return true; +} + +void PV60Sync::attemptSync(EthereumPeer* _peer) +{ + if (m_state != SyncState::Idle) + { + clog(NetAllDetail) << "Can't sync with this peer - outstanding asks."; + return; + } + + // if already done this, then ignore. + if (!needsSyncing(_peer)) + { + clog(NetAllDetail) << "Already synced with this peer."; + return; + } + + h256 c = host().chain().currentHash(); + unsigned n = host().chain().number(); + u256 td = host().chain().details().totalDifficulty; + + clog(NetAllDetail) << "Attempt chain-grab? Latest:" << c << ", number:" << n << ", TD:" << td << " versus " << _peer->m_totalDifficulty; + if (td >= _peer->m_totalDifficulty) + { + clog(NetAllDetail) << "No. Our chain is better."; + resetNeedsSyncing(_peer); + transition(_peer, SyncState::Idle); + } + else + { + clog(NetAllDetail) << "Yes. Their chain is better."; + m_estimatedHashes = _peer->m_expectedHashes - c_chainReorgSize; + transition(_peer, SyncState::Hashes); + } +} + +void PV60Sync::noteNeedsSyncing(EthereumPeer* _peer) +{ + // if already downloading hash-chain, ignore. + if (isSyncing()) + { + clog(NetAllDetail) << "Sync in progress: Just set to help out."; + if (m_state == SyncState::Blocks) + _peer->requestBlocks(); + } + else + // otherwise check to see if we should be downloading... + attemptSync(_peer); +} + +void PV60Sync::changeSyncer(EthereumPeer* _syncer, bool _needHelp) +{ + if (_syncer) + clog(NetAllDetail) << "Changing syncer to" << _syncer->session()->socketId(); + else + clog(NetAllDetail) << "Clearing syncer."; + + m_syncer = _syncer; + if (isSyncing()) + { + if (_needHelp && (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks)) + host().foreachPeer([&](EthereumPeer* _p) + { + clog(NetNote) << "Getting help with downloading blocks"; + if (_p != _syncer && _p->m_asking == Asking::Nothing) + transition(_p, m_state); + return true; + }); + } + else + { + // start grabbing next hash chain if there is one. + host().foreachPeer([this](EthereumPeer* _p) + { + attemptSync(_p); + return !isSyncing(); + }); + if (!isSyncing()) + { + if (m_state != SyncState::Idle) + setState(_syncer, SyncState::Idle); + clog(NetNote) << "No more peers to sync with."; + } + } + assert(!!m_syncer || m_state == SyncState::Idle); +} + +void PV60Sync::noteDoneBlocks(EthereumPeer* _peer, bool _clemency) +{ + resetNeedsSyncing(_peer); + if (downloadMan().isComplete()) + { + // Done our chain-get. + clog(NetNote) << "Chain download complete."; + // 1/100th for each useful block hash. + _peer->addRating(downloadMan().chainSize() / 100); + downloadMan().reset(); + } + else if (isSyncing(_peer)) + { + if (_clemency) + clog(NetNote) << "Chain download failed. Aborted while incomplete."; + else + { + // Done our chain-get. + clog(NetWarn) << "Chain download failed. Peer with blocks didn't have them all. This peer is bad and should be punished."; + clog(NetWarn) << downloadMan().remaining(); + clog(NetWarn) << "WOULD BAN."; +// m_banned.insert(_peer->session()->id()); // We know who you are! +// _peer->disable("Peer sent hashes but was unable to provide the blocks."); + } + downloadMan().reset(); + } + _peer->m_sub.doneFetch(); +} + +void PV60Sync::onPeerStatus(EthereumPeer* _peer) +{ + RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; + if (_peer->m_genesisHash != host().chain().genesisHash()) + _peer->disable("Invalid genesis hash"); + else if (_peer->m_protocolVersion != host().protocolVersion() && _peer->m_protocolVersion != EthereumHost::c_oldProtocolVersion) + _peer->disable("Invalid protocol version."); + else if (_peer->m_networkId != host().networkId()) + _peer->disable("Invalid network identifier."); + else if (_peer->session()->info().clientVersion.find("/v0.7.0/") != string::npos) + _peer->disable("Blacklisted client version."); + else if (host().isBanned(_peer->session()->id())) + _peer->disable("Peer banned for previous bad behaviour."); + else + { + unsigned estimatedHashes = estimateHashes(); + _peer->m_expectedHashes = estimatedHashes; + setNeedsSyncing(_peer, _peer->m_latestHash, _peer->m_totalDifficulty); + } + DEV_INVARIANT_CHECK; +} + +void PV60Sync::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) +{ + RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; + unsigned itemCount = _r.itemCount(); + clog(NetMessageSummary) << "Blocks (" << dec << itemCount << "entries)" << (itemCount ? "" : ": NoMoreBlocks"); + + _peer->setIdle(); + if (m_state != SyncState::Blocks && m_state != SyncState::NewBlocks) + clog(NetWarn) << "Unexpected Blocks received!"; + + if (itemCount == 0) + { + // Got to this peer's latest block - just give up. + noteDoneBlocks(_peer, false); + if (downloadMan().isComplete()) + transition(_peer, SyncState::Idle); + return; + } + + unsigned success = 0; + unsigned future = 0; + unsigned unknown = 0; + unsigned got = 0; + unsigned repeated = 0; + u256 maxDifficulty = 0; + h256 maxUnknown; + + for (unsigned i = 0; i < itemCount; ++i) + { + auto h = BlockInfo::headerHash(_r[i].data()); + if (_peer->m_sub.noteBlock(h)) + { + _peer->addRating(10); + switch (host().bq().import(_r[i].data(), host().chain())) + { + case ImportResult::Success: + success++; + break; + + case ImportResult::Malformed: + case ImportResult::BadChain: + _peer->disable("Malformed block received."); + return; + + case ImportResult::FutureTimeKnown: + future++; + break; + case ImportResult::AlreadyInChain: + case ImportResult::AlreadyKnown: + got++; + break; + + case ImportResult::FutureTimeUnkwnown: + future++; //Fall through + + case ImportResult::UnknownParent: + { + unknown++; + if (m_state == SyncState::NewBlocks) + { + BlockInfo bi; + bi.populateFromHeader(_r[i][0]); + if (bi.difficulty > maxDifficulty) + { + maxDifficulty = bi.difficulty; + maxUnknown = h; + } + } + break; + } + + default:; + } + } + else + { + _peer->addRating(0); // -1? + repeated++; + } + } + + clog(NetMessageSummary) << dec << success << "imported OK," << unknown << "with unknown parents," << future << "with future timestamps," << got << " already known," << repeated << " repeats received."; + + if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) + { + if (downloadMan().isComplete()) + transition(_peer, SyncState::Idle); + else if (!got) + transition(_peer, m_state); + else + noteDoneBlocks(_peer, false); + } + DEV_INVARIANT_CHECK; +} + +void PV60Sync::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) +{ + RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; + _peer->setIdle(); + if (!isSyncing(_peer)) + { + clog(NetMessageSummary) << "Ignoring hashes synce not syncing"; + return; + } + if (_hashes.size() == 0) + { + transition(_peer, SyncState::Blocks); + return; + } + unsigned knowns = 0; + unsigned unknowns = 0; + for (unsigned i = 0; i < _hashes.size(); ++i) + { + auto h = _hashes[i]; + auto status = host().bq().blockStatus(h); + if (status == QueueStatus::Importing || status == QueueStatus::Ready || host().chain().isKnown(h)) + { + clog(NetMessageSummary) << "block hash ready:" << h << ". Start blocks download..."; + assert (isSyncing(_peer)); + transition(_peer, SyncState::Blocks); + return; + } + else if (status == QueueStatus::Bad) + { + cwarn << "block hash bad!" << h << ". Bailing..."; + transition(_peer, SyncState::Idle); + return; + } + else if (status == QueueStatus::Unknown) + { + unknowns++; + m_syncingNeededBlocks.push_back(h); + } + else + knowns++; + m_syncingLastReceivedHash = h; + } + clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns; now at" << m_syncingLastReceivedHash; + if (m_syncingNeededBlocks.size() > _peer->m_expectedHashes) + { + _peer->disable("Too many hashes"); + m_syncingNeededBlocks.clear(); + m_syncingLatestHash = h256(); + transition(_peer, SyncState::Idle); + return; + } + // run through - ask for more. + transition(_peer, SyncState::Hashes); + DEV_INVARIANT_CHECK; +} + + +void PV60Sync::abortSync(EthereumPeer* _peer) +{ + if (isSyncing(_peer)) + { + host().foreachPeer([this](EthereumPeer* _p) { _p->setIdle(); return true; }); + transition(_peer, SyncState::Idle, true); + } + DEV_INVARIANT_CHECK; +} + +void PV60Sync::onPeerAborting(EthereumPeer* _peer) +{ + abortSync(_peer); + DEV_INVARIANT_CHECK; +} + +void PV60Sync::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) +{ + DEV_INVARIANT_CHECK; + RecursiveGuard l(x_sync); + auto h = BlockInfo::headerHash(_r[0].data()); + clog(NetMessageSummary) << "NewBlock: " << h; + + if (_r.itemCount() != 2) + _peer->disable("NewBlock without 2 data fields."); + else + { + switch (host().bq().import(_r[0].data(), host().chain())) + { + case ImportResult::Success: + _peer->addRating(100); + break; + case ImportResult::FutureTimeKnown: + //TODO: Rating dependent on how far in future it is. + break; + + case ImportResult::Malformed: + case ImportResult::BadChain: + _peer->disable("Malformed block received."); + return; + + case ImportResult::AlreadyInChain: + case ImportResult::AlreadyKnown: + break; + + case ImportResult::FutureTimeUnkwnown: + case ImportResult::UnknownParent: + clog(NetMessageSummary) << "Received block with no known parent. Resyncing..."; + setNeedsSyncing(_peer, h, _r[1].toInt()); + break; + default:; + } + + DEV_GUARDED(_peer->x_knownBlocks) + _peer->m_knownBlocks.insert(h); + } + DEV_INVARIANT_CHECK; +} + +void PV60Sync::onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) +{ + RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; + if (isSyncing()) + { + clog(NetMessageSummary) << "Ignoring since we're already downloading."; + return; + } + unsigned knowns = 0; + unsigned unknowns = 0; + for (auto h: _hashes) + { + _peer->addRating(1); + DEV_GUARDED(_peer->x_knownBlocks) + _peer->m_knownBlocks.insert(h); + auto status = host().bq().blockStatus(h); + if (status == QueueStatus::Importing || status == QueueStatus::Ready || host().chain().isKnown(h)) + knowns++; + else if (status == QueueStatus::Bad) + { + cwarn << "block hash bad!" << h << ". Bailing..."; + return; + } + else if (status == QueueStatus::Unknown) + { + unknowns++; + m_syncingNeededBlocks.push_back(h); + } + else + knowns++; + } + clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns"; + if (unknowns > 0) + { + clog(NetNote) << "Not syncing and new block hash discovered: syncing without help."; + downloadMan().resetToChain(m_syncingNeededBlocks); + transition(_peer, SyncState::NewBlocks, false, false); + } + DEV_INVARIANT_CHECK; +} + +bool PV60Sync::invariants() const +{ + if (m_state == SyncState::Idle && !!m_syncer) + return false; + if (m_state != SyncState::Idle && !m_syncer) + return false; + if (m_state == SyncState::Hashes) + { + bool hashes = false; + host().foreachPeer([&](EthereumPeer* _p) { if (_p->m_asking == Asking::Hashes) hashes = true; return !hashes; }); + if (!hashes) + return false; + } + if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) + { + bool blocks = false; + host().foreachPeer([&](EthereumPeer* _p) { if (_p->m_asking == Asking::Blocks) blocks = true; return !blocks; }); + if (!blocks) + return false; + } + return true; +} diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h new file mode 100644 index 000000000..2c3f61de6 --- /dev/null +++ b/libethereum/BlockChainSync.h @@ -0,0 +1,146 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file EthereumHost.h + * @author Gav Wood + * @date 2014 + */ + +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include "CommonNet.h" +#include "EthereumPeer.h" //TODO: forward decl +#include "DownloadMan.h" + + +namespace dev +{ + +class RLPStream; + +namespace eth +{ + +class EthereumHost; +class BlockQueue; + +/** + * @brief BlockChain synchronization strategy class + * @doWork Syncs to peers and sends new blocks and transactions. + */ +class BlockChainSync: public HasInvariants +{ +public: + BlockChainSync(EthereumHost& _host); + + /// Will block on network process events. + virtual ~BlockChainSync(); + void abortSync(); + + DownloadMan const& downloadMan() const; + DownloadMan& downloadMan(); + virtual bool isSyncing() const = 0; + virtual void onPeerStatus(EthereumPeer* _peer); ///< Called by peer to report status + virtual void onPeerBlocks(EthereumPeer* _peer, RLP const& _r) = 0; ///< Called by peer once it has new blocks during syn + virtual void onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) = 0; ///< Called by peer once it has new blocks + virtual void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) = 0; ///< Called by peer once it has new hashes + virtual void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) = 0; ///< Called by peer once it has another sequential block of hashes during sync + virtual void onPeerAborting(EthereumPeer* _peer) = 0; ///< Called by peer when it is disconnecting + virtual SyncStatus status() const = 0; + + static char const* stateName(SyncState _s) { return s_stateNames[static_cast(_s)]; } + +private: + static char const* const s_stateNames[static_cast(SyncState::Size)]; + + void setState(SyncState _s); + + bool invariants() const override = 0; + + EthereumHost& m_host; + Handler m_bqRoomAvailable; + HashDownloadMan m_hashMan; + +protected: + + EthereumHost& host() { return m_host; } + EthereumHost const& host() const { return m_host; } + unsigned estimateHashes(); + + mutable RecursiveMutex x_sync; + SyncState m_state = SyncState::Idle; ///< Current sync state + SyncState m_lastActiveState = SyncState::Idle; ///< Saved state before entering waiting queue mode + unsigned m_estimatedHashes = 0; ///< Number of estimated hashes for the last peer over PV60. Used for status reporting only. +}; + +class PV60Sync: public BlockChainSync +{ +public: + + PV60Sync(EthereumHost& _host); + + bool isSyncing() const override { return !!m_syncer; } + void onPeerStatus(EthereumPeer* _peer) override; ///< Called by peer to report status + void onPeerBlocks(EthereumPeer* _peer, RLP const& _r) override; ///< Called by peer once it has new blocks during syn + void onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) override; ///< Called by peer once it has new blocks + void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) override; ///< Called by peer once it has new hashes + void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) override; ///< Called by peer once it has another sequential block of hashes during sync + void onPeerAborting(EthereumPeer* _peer) override; ///< Called by peer when it is disconnecting + SyncStatus status() const override; + + void transition(EthereumPeer* _peer, SyncState _s, bool _force = false, bool _needHelp = true); + void resetNeedsSyncing(EthereumPeer* _peer) { setNeedsSyncing(_peer, h256(), 0); } + bool needsSyncing(EthereumPeer* _peer) const { return !!_peer->m_latestHash; } + + void setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td); + bool shouldGrabBlocks(EthereumPeer* _peer) const; + void attemptSync(EthereumPeer* _peer); + void setState(EthereumPeer* _peer, SyncState _s, bool _isSyncing = false, bool _needHelp = false); + bool isSyncing(EthereumPeer* _peer) const; + void noteNeedsSyncing(EthereumPeer* _who); + void changeSyncer(EthereumPeer* _syncer, bool _needHelp); + void noteDoneBlocks(EthereumPeer* _who, bool _clemency); + void abortSync(EthereumPeer* _peer); + void requestBlocks(EthereumPeer* _peer); + + +private: + bool invariants() const override; + + h256s m_knownHashes; ///< List of block hashes we need to download. + + h256s m_syncingNeededBlocks; ///< The blocks that we should download from this peer. + h256 m_syncingLastReceivedHash; ///< Hash most recently received from peer. + h256 m_syncingLatestHash; ///< Peer's latest block's hash, as of the current sync. + u256 m_syncingTotalDifficulty; ///< Peer's latest block's total difficulty, as of the current sync. + EthereumPeer* m_syncer = nullptr; // TODO: switch to weak_ptr + +}; +} +} diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index f142be62e..c8bbfc119 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -229,7 +229,8 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo cblockq << "OK - queued for future [" << bi.timestamp << "vs" << time(0) << "] - will wait until" << buf; m_unknownSize += _block.size(); m_unknownCount++; - return ImportResult::FutureTime; + bool unknown = !m_readySet.count(bi.parentHash) && !m_drainingSet.count(bi.parentHash) && !_bc.isKnown(bi.parentHash); + return unknown ? ImportResult::FutureTimeUnkwnown : ImportResult::FutureTimeKnown; } else { diff --git a/libethereum/CommonNet.h b/libethereum/CommonNet.h index b960c8f3f..35a27ff5e 100644 --- a/libethereum/CommonNet.h +++ b/libethereum/CommonNet.h @@ -80,10 +80,8 @@ enum class Asking enum class SyncState { Idle, ///< Initial chain sync complete. Waiting for new packets - WaitingQueue, ///< Block downloading paused. Waiting for block queue to process blocks and free space - HashesNegotiate, ///< Waiting for first hashes to arrive - HashesSingle, ///< Locked on and downloading hashes from a single peer - HashesParallel, ///< Downloading hashes from multiple peers over + Waiting, ///< Block downloading paused. Waiting for block queue to process blocks and free space + Hashes, ///< Downloading hashes from multiple peers over Blocks, ///< Downloading blocks NewBlocks, ///< Downloading blocks learned from NewHashes packet diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index e69bfa684..8b8a7c305 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -33,6 +33,8 @@ #include "BlockQueue.h" #include "EthereumPeer.h" #include "DownloadMan.h" +#include "BlockChainSync.h" + using namespace std; using namespace dev; using namespace dev::eth; @@ -41,7 +43,7 @@ using namespace p2p; unsigned const EthereumHost::c_oldProtocolVersion = 60; //TODO: remove this once v61+ is common unsigned const c_chainReorgSize = 30000; -char const* const EthereumHost::s_stateNames[static_cast(SyncState::Size)] = {"Idle", "WaitingQueue", "HashesNegotiate", "HashesSingle", "HashesParallel", "Blocks", "NewBlocks" }; +char const* const EthereumHost::s_stateNames[static_cast(SyncState::Size)] = {"Idle", "Waiting", "Hashes", "Blocks", "NewBlocks" }; EthereumHost::EthereumHost(BlockChain const& _ch, TransactionQueue& _tq, BlockQueue& _bq, u256 _networkId): HostCapability(), @@ -51,15 +53,12 @@ EthereumHost::EthereumHost(BlockChain const& _ch, TransactionQueue& _tq, BlockQu m_bq (_bq), m_networkId (_networkId) { - setState(SyncState::HashesNegotiate); m_latestBlockSent = _ch.currentHash(); - m_hashMan.reset(m_chain.number() + 1); - m_bqRoomAvailable = m_bq.onRoomAvailable([this](){ m_continueSync = true; }); } EthereumHost::~EthereumHost() { - foreachPeer([](EthereumPeer* _p) { _p->abortSync(); }); + //foreachPeer([](EthereumPeer* _p) { _p->abortSync(); }); } bool EthereumHost::ensureInitialised() @@ -79,31 +78,13 @@ bool EthereumHost::ensureInitialised() void EthereumHost::reset() { - foreachPeer([](EthereumPeer* _p) { _p->abortSync(); }); - m_man.resetToChain(h256s()); - m_hashMan.reset(m_chain.number() + 1); - setState(SyncState::HashesNegotiate); - m_syncingLatestHash = h256(); - m_syncingTotalDifficulty = 0; + Guard l(x_sync); + if (m_sync) + m_sync->abortSync(); + m_sync.reset(); + m_latestBlockSent = h256(); m_transactionsSent.clear(); - m_hashes.clear(); -} - -void EthereumHost::resetSyncTo(h256 const& _h) -{ - setState(SyncState::HashesNegotiate); - m_syncingLatestHash = _h; -} - - -void EthereumHost::setState(SyncState _s) -{ - if (m_state != _s) - { - clog(NetAllDetail) << "SyncState changed from " << stateName(m_state) << " to " << stateName(_s); - m_state = _s; - } } void EthereumHost::doWork() @@ -125,14 +106,7 @@ void EthereumHost::doWork() } } - if (m_continueSync) - { - m_continueSync = false; - RecursiveGuard l(x_sync); - continueSync(); - } - - foreachPeer([](EthereumPeer* _p) { _p->tick(); }); + foreachPeer([](EthereumPeer* _p) { _p->tick(); return true; }); // return netChange; // TODO: Figure out what to do with netChange. @@ -174,24 +148,28 @@ void EthereumHost::maintainTransactions() cnote << "Sent" << n << "transactions to " << _p->session()->info().clientVersion; } _p->m_requireTransactions = false; + return true; }); } -void EthereumHost::foreachPeer(std::function const& _f) const +void EthereumHost::foreachPeer(std::function const& _f) const { foreachPeerPtr([&](std::shared_ptr _p) { if (_p) - _f(_p.get()); + return _f(_p.get()); + return true; }); } -void EthereumHost::foreachPeerPtr(std::function)> const& _f) const +void EthereumHost::foreachPeerPtr(std::function)> const& _f) const { for (auto s: peerSessions()) - _f(s.first->cap()); + if (!_f(s.first->cap())) + return; for (auto s: peerSessions(c_oldProtocolVersion)) //TODO: remove once v61+ is common - _f(s.first->cap(c_oldProtocolVersion)); + if (!_f(s.first->cap(c_oldProtocolVersion))) + return; } tuple>, vector>, vector>> EthereumHost::randomSelection(unsigned _percent, std::function const& _allow) @@ -263,326 +241,50 @@ void EthereumHost::maintainBlocks(h256 const& _currentHash) } } -void EthereumHost::onPeerStatus(EthereumPeer* _peer) +BlockChainSync& EthereumHost::sync() { - RecursiveGuard l(x_sync); - DEV_INVARIANT_CHECK; - if (_peer->m_genesisHash != m_chain.genesisHash()) - _peer->disable("Invalid genesis hash"); - else if (_peer->m_protocolVersion != protocolVersion() && _peer->m_protocolVersion != c_oldProtocolVersion) - _peer->disable("Invalid protocol version."); - else if (_peer->m_networkId != networkId()) - _peer->disable("Invalid network identifier."); - else if (_peer->session()->info().clientVersion.find("/v0.7.0/") != string::npos) - _peer->disable("Blacklisted client version."); - else if (isBanned(_peer->session()->id())) - _peer->disable("Peer banned for previous bad behaviour."); - else + if (m_sync) + return *m_sync; // We only chose sync strategy once + + bool pv61 = false; + foreachPeer([&](EthereumPeer* _p) { - unsigned estimatedHashes = estimateHashes(); - if (_peer->m_protocolVersion == protocolVersion()) - { - if (_peer->m_latestBlockNumber > m_chain.number()) - _peer->m_expectedHashes = (unsigned)_peer->m_latestBlockNumber - m_chain.number(); - if (_peer->m_expectedHashes > estimatedHashes) - _peer->disable("Too many hashes"); - else if (needHashes() && m_hashMan.chainSize() < _peer->m_expectedHashes) - m_hashMan.resetToRange(m_chain.number() + 1, _peer->m_expectedHashes); - } - else - _peer->m_expectedHashes = estimatedHashes; - continueSync(_peer); - } - DEV_INVARIANT_CHECK; + if (_p->m_protocolVersion == protocolVersion()) + pv61 = true; + return !pv61; + }); + m_sync.reset(pv61 ? new PV60Sync(*this) : new PV60Sync(*this)); + return *m_sync; } -unsigned EthereumHost::estimateHashes() +void EthereumHost::onPeerStatus(EthereumPeer* _peer) { - BlockInfo block = m_chain.info(); - time_t lastBlockTime = (block.hash() == m_chain.genesisHash()) ? 1428192000 : (time_t)block.timestamp; - time_t now = time(0); - unsigned blockCount = c_chainReorgSize; - if (lastBlockTime > now) - clog(NetWarn) << "Clock skew? Latest block is in the future"; - else - blockCount += (now - lastBlockTime) / (unsigned)c_durationLimit; - clog(NetAllDetail) << "Estimated hashes: " << blockCount; - return blockCount; + Guard l(x_sync); + sync().onPeerStatus(_peer); } void EthereumHost::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) { - RecursiveGuard l(x_sync); - if (_peer->m_syncHashNumber > 0) - _peer->m_syncHashNumber += _hashes.size(); - - _peer->setAsking(Asking::Nothing); - onPeerHashes(_peer, _hashes, false); -} - -void EthereumHost::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes, bool _complete) -{ - DEV_INVARIANT_CHECK; - if (_hashes.empty()) - { - _peer->m_hashSub.doneFetch(); - continueSync(); - return; - } - - bool syncByNumber = _peer->m_syncHashNumber; - if (!syncByNumber && !_complete && _peer->m_syncHash != m_syncingLatestHash) - { - // Obsolete hashes, discard - continueSync(_peer); - return; - } - - unsigned knowns = 0; - unsigned unknowns = 0; - h256s neededBlocks; - unsigned firstNumber = _peer->m_syncHashNumber - _hashes.size(); - for (unsigned i = 0; i < _hashes.size(); ++i) - { - _peer->addRating(1); - auto h = _hashes[i]; - auto status = m_bq.blockStatus(h); - if (status == QueueStatus::Importing || status == QueueStatus::Ready || m_chain.isKnown(h)) - { - clog(NetMessageSummary) << "Block hash already known:" << h; - if (!syncByNumber) - { - m_hashes += neededBlocks; - clog(NetMessageSummary) << "Start blocks download..."; - onPeerDoneHashes(_peer, true); - return; - } - } - else if (status == QueueStatus::Bad) - { - cwarn << "block hash bad!" << h << ". Bailing..."; - _peer->setIdle(); - return; - } - else if (status == QueueStatus::Unknown) - { - unknowns++; - neededBlocks.push_back(h); - } - else - knowns++; - - if (!syncByNumber) - m_syncingLatestHash = h; - else - _peer->m_hashSub.noteHash(firstNumber + i, 1); - } - if (syncByNumber) - { - m_man.appendToChain(neededBlocks); // Append to download manager immediatelly - clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns"; - } - else - { - m_hashes += neededBlocks; // Append to local list - clog(NetMessageSummary) << knowns << "knowns," << unknowns << "unknowns; now at" << m_syncingLatestHash; - } - if (_complete) - { - clog(NetMessageSummary) << "Start new blocks download..."; - m_syncingLatestHash = h256(); - setState(SyncState::NewBlocks); - m_man.resetToChain(m_hashes); - m_hashes.clear(); - m_hashMan.reset(m_chain.number() + 1); - continueSync(_peer); - } - else if (syncByNumber && m_hashMan.isComplete()) - { - // Done our chain-get. - clog(NetNote) << "Hashes download complete."; - onPeerDoneHashes(_peer, false); - } - else if (m_hashes.size() > _peer->m_expectedHashes) - { - _peer->disable("Too many hashes"); - m_hashes.clear(); - m_syncingLatestHash = h256(); - setState(SyncState::HashesNegotiate); - continueSync(); ///Try with some other peer, keep the chain - } - else - continueSync(_peer); /// Grab next hashes - DEV_INVARIANT_CHECK; -} - -void EthereumHost::onPeerDoneHashes(EthereumPeer* _peer, bool _localChain) -{ - assert(_peer->m_asking == Asking::Nothing); - m_syncingLatestHash = h256(); - setState(SyncState::Blocks); - if (_peer->m_protocolVersion != protocolVersion() || _localChain) - { - m_man.resetToChain(m_hashes); - _peer->addRating(m_man.chainSize() / 100); //TODO: what about other peers? - } - m_hashMan.reset(m_chain.number() + 1); - m_hashes.clear(); - continueSync(); + Guard l(x_sync); + sync().onPeerHashes(_peer, _hashes); } void EthereumHost::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) { - RecursiveGuard l(x_sync); - DEV_INVARIANT_CHECK; - _peer->setAsking(Asking::Nothing); - unsigned itemCount = _r.itemCount(); - clog(NetMessageSummary) << "Blocks (" << dec << itemCount << "entries)" << (itemCount ? "" : ": NoMoreBlocks"); - - if (itemCount == 0) - { - // Got to this peer's latest block - just give up. - clog(NetNote) << "Finishing blocks fetch..."; - // NOTE: need to notify of giving up on chain-hashes, too, altering state as necessary. - _peer->m_sub.doneFetch(); - _peer->setIdle(); - return; - } - - unsigned success = 0; - unsigned future = 0; - unsigned unknown = 0; - unsigned got = 0; - unsigned repeated = 0; - h256 lastUnknown; - - for (unsigned i = 0; i < itemCount; ++i) - { - auto h = BlockInfo::headerHash(_r[i].data()); - if (_peer->m_sub.noteBlock(h)) - { - _peer->addRating(10); - switch (m_bq.import(_r[i].data(), m_chain)) - { - case ImportResult::Success: - success++; - break; - - case ImportResult::Malformed: - case ImportResult::BadChain: - _peer->disable("Malformed block received."); - return; - - case ImportResult::FutureTime: - future++; - break; - - case ImportResult::AlreadyInChain: - case ImportResult::AlreadyKnown: - got++; - break; - - case ImportResult::UnknownParent: - lastUnknown = h; - unknown++; - break; - - default:; - } - } - else - { - _peer->addRating(0); // -1? - repeated++; - } - } - - clog(NetMessageSummary) << dec << success << "imported OK," << unknown << "with unknown parents," << future << "with future timestamps," << got << " already known," << repeated << " repeats received."; - - if (m_state == SyncState::NewBlocks && unknown > 0) - { - _peer->m_latestHash = lastUnknown; - resetSyncTo(lastUnknown); - } - - continueSync(_peer); - DEV_INVARIANT_CHECK; + Guard l(x_sync); + sync().onPeerBlocks(_peer, _r); } void EthereumHost::onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) { - RecursiveGuard l(x_sync); - DEV_INVARIANT_CHECK; - if (isSyncing() || _peer->isConversing()) - { - clog(NetMessageSummary) << "Ignoring new hashes since we're already downloading."; - return; - } - clog(NetNote) << "New block hash discovered: syncing without help."; - _peer->m_syncHashNumber = 0; - onPeerHashes(_peer, _hashes, true); - DEV_INVARIANT_CHECK; + Guard l(x_sync); + sync().onPeerNewHashes(_peer, _hashes); } void EthereumHost::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) { - RecursiveGuard l(x_sync); - DEV_INVARIANT_CHECK; - if ((isSyncing() || _peer->isConversing()) && m_state != SyncState::NewBlocks) - { - clog(NetMessageSummary) << "Ignoring new blocks since we're already downloading."; - return; - } - auto h = BlockInfo::headerHash(_r[0].data()); - clog(NetMessageSummary) << "NewBlock: " << h; - - if (_r.itemCount() != 2) - _peer->disable("NewBlock without 2 data fields."); - else - { - bool sync = false; - switch (m_bq.import(_r[0].data(), m_chain)) - { - case ImportResult::Success: - _peer->addRating(100); - break; - case ImportResult::FutureTime: - //TODO: Rating dependent on how far in future it is. - break; - - case ImportResult::Malformed: - case ImportResult::BadChain: - _peer->disable("Malformed block received."); - return; - - case ImportResult::AlreadyInChain: - case ImportResult::AlreadyKnown: - break; - - case ImportResult::UnknownParent: - if (h) - { - u256 difficulty = _r[1].toInt(); - if (m_syncingTotalDifficulty < difficulty) - { - clog(NetMessageSummary) << "Received block with no known parent. Resyncing..."; - _peer->m_latestHash = h; - _peer->m_totalDifficulty = difficulty; - resetSyncTo(h);; - sync = true; - } - } - break; - default:; - } - - DEV_GUARDED(_peer->x_knownBlocks) - _peer->m_knownBlocks.insert(h); - - if (sync) - continueSync(); - } - DEV_INVARIANT_CHECK; + Guard l(x_sync); + sync().onPeerNewBlock(_peer, _r); } void EthereumHost::onPeerTransactions(EthereumPeer* _peer, RLP const& _r) @@ -615,202 +317,28 @@ void EthereumHost::onPeerTransactions(EthereumPeer* _peer, RLP const& _r) void EthereumHost::onPeerAborting(EthereumPeer* _peer) { - RecursiveGuard l(x_sync); - if (_peer->isConversing()) - { - _peer->setIdle(); - if (_peer->isCriticalSyncing()) - _peer->setRude(); - continueSync(); - } -} - -void EthereumHost::continueSync() -{ - if (m_state == SyncState::WaitingQueue) - setState(m_lastActiveState); - clog(NetAllDetail) << "Continuing sync for all peers"; - foreachPeer([&](EthereumPeer* _p) - { - if (_p->m_asking == Asking::Nothing) - continueSync(_p); - }); -} - -void EthereumHost::continueSync(EthereumPeer* _peer) -{ - DEV_INVARIANT_CHECK; - assert(_peer->m_asking == Asking::Nothing); - bool otherPeerV60Sync = false; - bool otherPeerV61Sync = false; - if (needHashes()) - { - if (!peerShouldGrabChain(_peer)) - { - _peer->setIdle(); - return; - } - - foreachPeer([&](EthereumPeer* _p) - { - if (_p != _peer && _p->m_asking == Asking::Hashes) - { - if (_p->m_protocolVersion != protocolVersion()) - otherPeerV60Sync = true; // Already have a peer downloading hash chain with old protocol, do nothing - else - otherPeerV61Sync = true; // Already have a peer downloading hash chain with V61+ protocol, join if supported - } - }); - if (otherPeerV60Sync && !m_hashes.empty()) - { - /// Downloading from other peer with v60 protocol, nothing else we can do - _peer->setIdle(); - return; - } - if (otherPeerV61Sync && _peer->m_protocolVersion != protocolVersion()) - { - /// Downloading from other peer with v61+ protocol which this peer does not support, - _peer->setIdle(); - return; - } - if (_peer->m_protocolVersion == protocolVersion() && !m_hashMan.isComplete()) - { - setState(SyncState::HashesParallel); - _peer->requestHashes(); /// v61+ and not catching up to a particular hash - } - else - { - // Restart/continue sync in single peer mode - if (!m_syncingLatestHash) - { - m_syncingLatestHash =_peer->m_latestHash; - m_syncingTotalDifficulty = _peer->m_totalDifficulty; - } - if (_peer->m_totalDifficulty >= m_syncingTotalDifficulty) - { - _peer->requestHashes(m_syncingLatestHash); - setState(SyncState::HashesSingle); - m_estimatedHashes = _peer->m_expectedHashes - (_peer->m_protocolVersion == protocolVersion() ? 0 : c_chainReorgSize); - } - else - _peer->setIdle(); - } - } - else if (needBlocks()) - { - if (m_man.isComplete()) - { - // Done our chain-get. - setState(SyncState::Idle); - clog(NetNote) << "Chain download complete."; - // 1/100th for each useful block hash. - _peer->addRating(m_man.chainSize() / 100); //TODO: what about other peers? - m_man.reset(); - _peer->setIdle(); - return; - } - else if (peerCanHelp(_peer)) - { - // Check block queue status - if (m_bq.unknownFull()) - { - clog(NetWarn) << "Too many unknown blocks, restarting sync"; - m_bq.clear(); - reset(); - continueSync(); - } - else if (m_bq.knownFull()) - { - clog(NetAllDetail) << "Waiting for block queue before downloading blocks"; - m_lastActiveState = m_state; - setState(SyncState::WaitingQueue); - _peer->setIdle(); - } - else - _peer->requestBlocks(); - } - } - else - _peer->setIdle(); - DEV_INVARIANT_CHECK; -} - -bool EthereumHost::peerCanHelp(EthereumPeer* _peer) const -{ - (void)_peer; - return true; -} - -bool EthereumHost::peerShouldGrabBlocks(EthereumPeer* _peer) const -{ - // this is only good for deciding whether to go ahead and grab a particular peer's hash chain, - // yet it's being used in determining whether to allow a peer help with downloading an existing - // chain of blocks. - auto td = _peer->m_totalDifficulty; - auto lh = m_syncingLatestHash; - auto ctd = m_chain.details().totalDifficulty; - - clog(NetAllDetail) << "Should grab blocks? " << td << "vs" << ctd; - if (td < ctd || (td == ctd && m_chain.currentHash() == lh)) - return false; - return true; -} - -bool EthereumHost::peerShouldGrabChain(EthereumPeer* _peer) const -{ - h256 c = m_chain.currentHash(); - unsigned n = m_chain.number(); - u256 td = m_chain.details().totalDifficulty; - - clog(NetAllDetail) << "Attempt chain-grab? Latest:" << c << ", number:" << n << ", TD:" << td << " versus " << _peer->m_totalDifficulty; - if (td >= _peer->m_totalDifficulty) - { - clog(NetAllDetail) << "No. Our chain is better."; - return false; - } - else - { - clog(NetAllDetail) << "Yes. Their chain is better."; - return true; - } + Guard l(x_sync); + if (m_sync) + m_sync->onPeerAborting(_peer); } bool EthereumHost::isSyncing() const { - return m_state != SyncState::Idle; + Guard l(x_sync); + if (!m_sync) + return false; + return m_sync->isSyncing(); } SyncStatus EthereumHost::status() const { - RecursiveGuard l(x_sync); - SyncStatus res; - res.state = m_state; - if (m_state == SyncState::HashesParallel) - { - res.hashesReceived = m_hashMan.hashesGot().size(); - res.hashesTotal = m_hashMan.chainSize(); - } - else if (m_state == SyncState::HashesSingle) - { - res.hashesTotal = m_estimatedHashes; - res.hashesReceived = static_cast(m_hashes.size()); - res.hashesEstimated = true; - } - else if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks || m_state == SyncState::WaitingQueue) - { - res.blocksTotal = m_man.chainSize(); - res.blocksReceived = m_man.blocksGot().size(); - } - return res; + Guard l(x_sync); + if (!m_sync) + return SyncStatus(); + return m_sync->status(); } - bool EthereumHost::invariants() const { - if (m_state == SyncState::HashesNegotiate && !m_hashes.empty()) - return false; - if (needBlocks() && (m_syncingLatestHash || !m_hashes.empty())) - return false; - return true; } diff --git a/libethereum/EthereumHost.h b/libethereum/EthereumHost.h index 098d893ee..aed35c192 100644 --- a/libethereum/EthereumHost.h +++ b/libethereum/EthereumHost.h @@ -48,6 +48,7 @@ namespace eth class TransactionQueue; class BlockQueue; +class BlockChainSync; /** * @brief The EthereumHost class @@ -57,7 +58,6 @@ class BlockQueue; class EthereumHost: public p2p::HostCapability, Worker, HasInvariants { public: - /// Start server, but don't listen. EthereumHost(BlockChain const& _ch, TransactionQueue& _tq, BlockQueue& _bq, u256 _networkId); @@ -71,50 +71,42 @@ public: void reset(); DownloadMan const& downloadMan() const { return m_man; } + DownloadMan& downloadMan() { return m_man; } bool isSyncing() const; bool isBanned(p2p::NodeId const& _id) const { return !!m_banned.count(_id); } void noteNewTransactions() { m_newTransactions = true; } void noteNewBlocks() { m_newBlocks = true; } - void onPeerStatus(EthereumPeer* _peer); ///< Called by peer to report status - void onPeerBlocks(EthereumPeer* _peer, RLP const& _r); ///< Called by peer once it has new blocks during syn - void onPeerNewBlock(EthereumPeer* _peer, RLP const& _r); ///< Called by peer once it has new blocks - void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes); ///< Called by peer once it has new hashes - void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes); ///< Called by peer once it has another sequential block of hashes during sync - void onPeerTransactions(EthereumPeer* _peer, RLP const& _r); ///< Called by peer when it has new transactions - void onPeerAborting(EthereumPeer* _peer); ///< Called by peer when it is disconnecting - - DownloadMan& downloadMan() { return m_man; } - HashDownloadMan& hashDownloadMan() { return m_hashMan; } - BlockChain const& chain() { return m_chain; } + BlockChain const& chain() const { return m_chain; } + BlockQueue& bq() { return m_bq; } SyncStatus status() const; + h256 latestBlockSent() { return m_latestBlockSent; } static char const* stateName(SyncState _s) { return s_stateNames[static_cast(_s)]; } static unsigned const c_oldProtocolVersion; + void foreachPeerPtr(std::function)> const& _f) const; + void foreachPeer(std::function const& _f) const; + + void onPeerStatus(EthereumPeer* _peer); + void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes); + void onPeerBlocks(EthereumPeer* _peer, RLP const& _r); + void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes); + void onPeerNewBlock(EthereumPeer* _peer, RLP const& _r); + void onPeerTransactions(EthereumPeer* _peer, RLP const& _r); + void onPeerAborting(EthereumPeer* _peer); private: static char const* const s_stateNames[static_cast(SyncState::Size)]; std::tuple>, std::vector>, std::vector>> randomSelection(unsigned _percent = 25, std::function const& _allow = [](EthereumPeer const*){ return true; }); - void foreachPeerPtr(std::function)> const& _f) const; - void foreachPeer(std::function const& _f) const; - void resetSyncTo(h256 const& _h); - bool needHashes() const { return m_state == SyncState::HashesNegotiate || m_state == SyncState::HashesSingle || m_state == SyncState::HashesParallel; } - bool needBlocks() const { return m_state == SyncState::Blocks || m_state == SyncState::NewBlocks; } - /// Sync with the BlockChain. It might contain one of our mined blocks, we might have new candidates from the network. void doWork(); void maintainTransactions(); void maintainBlocks(h256 const& _currentBlock); - /// Get a bunch of needed blocks. - /// Removes them from our list of needed blocks. - /// @returns empty if there's no more blocks left to fetch, otherwise the blocks to fetch. - h256Hash neededBlocks(h256Hash const& _exclude); - /// Check to see if the network peer-state initialisation has happened. bool isInitialised() const { return (bool)m_latestBlockSent; } @@ -124,29 +116,16 @@ private: virtual void onStarting() { startWorking(); } virtual void onStopping() { stopWorking(); } - void continueSync(); /// Find something to do for all peers - void continueSync(EthereumPeer* _peer); /// Find some work to do for a peer - void onPeerDoneHashes(EthereumPeer* _peer, bool _new); /// Called when done downloading hashes from peer - void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes, bool _complete); - bool peerShouldGrabBlocks(EthereumPeer* _peer) const; - bool peerShouldGrabChain(EthereumPeer* _peer) const; - bool peerCanHelp(EthereumPeer* _peer) const; - unsigned estimateHashes(); - void estimatePeerHashes(EthereumPeer* _peer); - void setState(SyncState _s); + BlockChainSync& sync(); bool invariants() const override; BlockChain const& m_chain; TransactionQueue& m_tq; ///< Maintains a list of incoming transactions not yet in a block on the blockchain. BlockQueue& m_bq; ///< Maintains a list of incoming blocks not yet on the blockchain (to be imported). - Handler m_bqRoomAvailable; u256 m_networkId; - DownloadMan m_man; - HashDownloadMan m_hashMan; - h256 m_latestBlockSent; h256Hash m_transactionsSent; @@ -155,14 +134,9 @@ private: bool m_newTransactions = false; bool m_newBlocks = false; - mutable RecursiveMutex x_sync; - SyncState m_state = SyncState::Idle; ///< Current sync state - SyncState m_lastActiveState = SyncState::Idle; ///< Saved state before entering waiting queue mode - h256 m_syncingLatestHash; ///< Latest block's hash, as of the current sync. - u256 m_syncingTotalDifficulty; ///< Latest block's total difficulty, as of the current sync. - h256s m_hashes; ///< List of hashes with unknown block numbers. Used for PV60 chain downloading and catching up to a particular unknown - unsigned m_estimatedHashes = 0; ///< Number of estimated hashes for the last peer over PV60. Used for status reporting only. - bool m_continueSync = false; ///< True when the block queue has processed a block; we should restart grabbing blocks. + mutable Mutex x_sync; + DownloadMan m_man; + std::unique_ptr m_sync; }; } diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 7a30f1ad9..8aca62b9a 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -30,6 +30,8 @@ #include "EthereumHost.h" #include "TransactionQueue.h" #include "BlockQueue.h" +#include "BlockChainSync.h" + using namespace std; using namespace dev; using namespace dev::eth; @@ -38,7 +40,6 @@ using namespace p2p; EthereumPeer::EthereumPeer(Session* _s, HostCapabilityFace* _h, unsigned _i, CapDesc const& _cap): Capability(_s, _h, _i), m_sub(host()->downloadMan()), - m_hashSub(host()->hashDownloadMan()), m_peerCapabilityVersion(_cap.second) { session()->addNote("manners", isRude() ? "RUDE" : "nice"); @@ -91,8 +92,6 @@ string toString(Asking _a) void EthereumPeer::setIdle() { - m_sub.doneFetch(); - m_hashSub.doneFetch(); setAsking(Asking::Nothing); } @@ -113,14 +112,14 @@ void EthereumPeer::requestStatus() sealAndSend(s); } -void EthereumPeer::requestHashes() +void EthereumPeer::requestHashes(u256 _number, unsigned _count) { assert(m_asking == Asking::Nothing); - m_syncHashNumber = m_hashSub.nextFetch(c_maxHashesAsk); + m_syncHashNumber = _number; m_syncHash = h256(); setAsking(Asking::Hashes); RLPStream s; - prep(s, GetBlockHashesByNumberPacket, 2) << m_syncHashNumber << c_maxHashesAsk; + prep(s, GetBlockHashesByNumberPacket, 2) << m_syncHashNumber << _count; clog(NetMessageDetail) << "Requesting block hashes for numbers " << m_syncHashNumber << "-" << m_syncHashNumber + c_maxHashesAsk - 1; sealAndSend(s); } diff --git a/libethereum/EthereumPeer.h b/libethereum/EthereumPeer.h index a12b7a197..2ffbe9101 100644 --- a/libethereum/EthereumPeer.h +++ b/libethereum/EthereumPeer.h @@ -50,6 +50,9 @@ namespace eth class EthereumPeer: public p2p::Capability { friend class EthereumHost; //TODO: remove this + friend class BlockChainSync; //TODO: remove this + friend class PV60Sync; //TODO: remove this + friend class PV61Sync; //TODO: remove this public: /// Basic constructor. @@ -73,8 +76,8 @@ public: /// Abort sync and reset fetch void setIdle(); - /// Request hashes. Uses hash download manager to get hash number. v61+ protocol version only - void requestHashes(); + /// Request hashes by number. v61+ protocol version only + void requestHashes(u256 _number, unsigned _count); /// Request hashes for given parent hash. void requestHashes(h256 const& _lastHash); @@ -135,18 +138,19 @@ private: h256 m_genesisHash; ///< Peer's genesis hash u256 m_latestBlockNumber; ///< Number of the latest block this peer has + /// This is built as we ask for hashes. Once no more hashes are given, we present this to the /// host who initialises the DownloadMan and m_sub becomes active for us to begin asking for blocks. + h256 m_syncingLastReceivedHash; ///< Hash most recently received from peer. + h256 m_syncingLatestHash; ///< Peer's latest block's hash, as of the current sync. + u256 m_syncingTotalDifficulty; ///< Peer's latest block's total difficulty, as of the current sync. unsigned m_expectedHashes = 0; ///< Estimated upper bound of hashes to expect from this peer. - unsigned m_syncHashNumber = 0; ///< Number of latest hash we sync to (PV61+) + u256 m_syncHashNumber = 0; ///< Number of latest hash we sync to (PV61+) h256 m_syncHash; ///< Latest hash we sync to (PV60) /// Once we're asking for blocks, this becomes in use. DownloadSub m_sub; - /// Once we're asking for hashes, this becomes in use. - HashDownloadSub m_hashSub; - u256 m_peerCapabilityVersion; ///< Protocol version this peer supports received as capability /// Have we received a GetTransactions packet that we haven't yet answered? bool m_requireTransactions = false; From 07b811ebfa47c680a8b15e8631985e65c8e9e3b3 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 17 Jun 2015 11:45:36 +0200 Subject: [PATCH 073/169] basic AES tests --- libdevcrypto/AES.h | 2 + test/libdevcrypto/AES.cpp | 92 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 94 insertions(+) create mode 100644 test/libdevcrypto/AES.cpp diff --git a/libdevcrypto/AES.h b/libdevcrypto/AES.h index 32d1880dc..6aaed6fad 100644 --- a/libdevcrypto/AES.h +++ b/libdevcrypto/AES.h @@ -75,6 +75,8 @@ public: /// Adjust mac interval. Next mac will be xored with value. void adjustInterval(unsigned _interval) { m_macInterval = _interval; } + + unsigned getMacInterval() { return m_macInterval;} private: AuthenticatedStream(AuthenticatedStream const&) = delete; diff --git a/test/libdevcrypto/AES.cpp b/test/libdevcrypto/AES.cpp new file mode 100644 index 000000000..5742b882e --- /dev/null +++ b/test/libdevcrypto/AES.cpp @@ -0,0 +1,92 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file MemTrie.h + * @author Christoph Jentzsch + * @date 2015 + */ + +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace dev; + +BOOST_AUTO_TEST_SUITE(AES) + +BOOST_AUTO_TEST_CASE(AesDecrypt) +{ + cout << "AesDecrypt" << endl; + bytes seed = fromHex("2dbaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621"); + KeyPair kp(sha3(aesDecrypt(&seed, "test"))); + BOOST_CHECK(Address("07746f871de684297923f933279555dda418f8a2") == kp.address()); +} + +BOOST_AUTO_TEST_CASE(AesDecryptWrongSeed) +{ + cout << "AesDecryptWrongSeed" << endl; + bytes seed = fromHex("badaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621"); + KeyPair kp(sha3(aesDecrypt(&seed, "test"))); + BOOST_CHECK(Address("07746f871de684297923f933279555dda418f8a2") != kp.address()); +} + +BOOST_AUTO_TEST_CASE(AesDecryptWrongPassword) +{ + cout << "AesDecryptWrongPassword" << endl; + bytes seed = fromHex("2dbaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621"); + KeyPair kp(sha3(aesDecrypt(&seed, "badtest"))); + BOOST_CHECK(Address("07746f871de684297923f933279555dda418f8a2") != kp.address()); +} + +BOOST_AUTO_TEST_CASE(AesDecryptFailInvalidSeed) +{ + cout << "AesDecryptFailInvalidSeed" << endl; + bytes seed = fromHex("xdbaead416c20cfd00c2fc9f1788ff9f965a2000799c96a624767cb0e1e90d2d7191efdd92349226742fdc73d1d87e2d597536c4641098b9a89836c94f58a2ab4c525c27c4cb848b3e22ea245b2bc5c8c7beaa900b0c479253fc96fce7ffc621"); + BOOST_CHECK(bytes() == aesDecrypt(&seed, "test")); +} + +BOOST_AUTO_TEST_CASE(AesDecryptFailInvalidSeedSize) +{ + cout << "AesDecryptFailInvalidSeedSize" << endl; + bytes seed = fromHex("000102030405060708090a0b0c0d0e0f"); + BOOST_CHECK(bytes() == aesDecrypt(&seed, "test")); +} + +BOOST_AUTO_TEST_CASE(AesDecryptFailInvalidSeed2) +{ + cout << "AesDecryptFailInvalidSeed2" << endl; + bytes seed = fromHex("000102030405060708090a0b0c0d0e0f000102030405060708090a0b0c0d0e0f"); + BOOST_CHECK(bytes() == aesDecrypt(&seed, "test")); +} +BOOST_AUTO_TEST_CASE(AuthenticatedStreamConstructor) +{ + cout << "AuthenticatedStreamConstructor" << endl; + + Secret const sec("test"); + crypto::aes::AuthenticatedStream as(crypto::aes::Encrypt, sec, 0); + BOOST_CHECK(as.getMacInterval() == 0); + as.adjustInterval(1); + BOOST_CHECK(as.getMacInterval() == 1); + crypto::aes::AuthenticatedStream as_mac(crypto::aes::Encrypt, h128(), h128(), 42); + BOOST_CHECK(as_mac.getMacInterval() == 42); +} + +BOOST_AUTO_TEST_SUITE_END() + From d420a1c025389fee00559ac5573758451f79fa74 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 17 Jun 2015 11:48:35 +0200 Subject: [PATCH 074/169] style --- test/libethereum/blockchain.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 2dc30c6ba..de28d30ff 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -581,11 +581,9 @@ mArray importUncles(mObject const& _blObj, vector& _vBiUncles, vector } updatePoW(uncleBlockFromFields); - if (overwrite == "nonce" || overwrite == "mixHash") - { - uncleBlockFromFields.nonce = overwrite == "nonce" ? Nonce(uncleHeaderObj["nonce"].get_str()) : uncleBlockFromFields.nonce; - uncleBlockFromFields.mixHash = overwrite == "mixHash" ? h256(uncleHeaderObj["mixHash"].get_str()) : uncleBlockFromFields.mixHash; - } + + uncleBlockFromFields.nonce = overwrite == "nonce" ? Nonce(uncleHeaderObj["nonce"].get_str()) : uncleBlockFromFields.nonce; + uncleBlockFromFields.mixHash = overwrite == "mixHash" ? h256(uncleHeaderObj["mixHash"].get_str()) : uncleBlockFromFields.mixHash; writeBlockHeaderToJson(uncleHeaderObj, uncleBlockFromFields); From 83cc17f240c02eab9bf4cbf4436e6ab356c11693 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 17 Jun 2015 12:22:04 +0200 Subject: [PATCH 075/169] update file name in description --- test/libdevcrypto/AES.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libdevcrypto/AES.cpp b/test/libdevcrypto/AES.cpp index 5742b882e..071f1509c 100644 --- a/test/libdevcrypto/AES.cpp +++ b/test/libdevcrypto/AES.cpp @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file MemTrie.h +/** @file AES.cpp * @author Christoph Jentzsch * @date 2015 */ From a2e06448e3db239d4dbca9d338fc8b7bd3c451ee Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 17 Jun 2015 13:00:44 +0200 Subject: [PATCH 076/169] small changes --- mix/ContractCallDataEncoder.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index e67ce9cea..1b713b82b 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -45,12 +45,12 @@ bytes ContractCallDataEncoder::encodedData() for (auto const& p: m_dynamicOffsetMap) { vector_ref offsetRef(m_dynamicData.data() + p.first, 32); - toBigEndian>(p.second + headerSize, offsetRef); //add header size minus signature hash + toBigEndian(p.second + headerSize, offsetRef); //add header size minus signature hash } for (auto const& p: m_staticOffsetMap) { vector_ref offsetRef(r.data() + p.first, 32); - toBigEndian>(p.second + headerSize, offsetRef); //add header size minus signature hash + toBigEndian(p.second + headerSize, offsetRef); //add header size minus signature hash } if (m_dynamicData.size() > 0) r.insert(r.end(), m_dynamicData.begin(), m_dynamicData.end()); From 8198665eca2d338c7484b5cfeef9e976fc830b28 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Wed, 17 Jun 2015 13:10:10 +0200 Subject: [PATCH 077/169] minor improvements --- libwhisper/BloomFilter.cpp | 9 +++------ libwhisper/Common.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp index c189ee912..cff69c664 100644 --- a/libwhisper/BloomFilter.cpp +++ b/libwhisper/BloomFilter.cpp @@ -35,11 +35,8 @@ void TopicBloomFilter::addRaw(AbridgedTopic const& _h) { if (m_refCounter[i] != numeric_limits::max()) m_refCounter[i]++; - //else: overflow - - // in order to encounter overflow, you have to set at least 65536 filters simultaneously. - // even then, the problem will only arise after at least 65536 filters will be be removed. - // we assume, it will never happen. + else + BOOST_THROW_EXCEPTION(Overflow()); } } @@ -52,7 +49,7 @@ void TopicBloomFilter::removeRaw(AbridgedTopic const& _h) m_refCounter[i]--; if (!m_refCounter[i]) - (*this)[i/8] &= ~c_mask[i%8]; + (*this)[i / 8] &= ~c_mask[i % 8]; } } diff --git a/libwhisper/Common.cpp b/libwhisper/Common.cpp index 5dc267fcf..7f5b8ed06 100644 --- a/libwhisper/Common.cpp +++ b/libwhisper/Common.cpp @@ -38,7 +38,7 @@ AbridgedTopics dev::shh::abridge(Topics const& _topics) { AbridgedTopics ret; ret.reserve(_topics.size()); - for (auto const& t : _topics) + for (auto const& t: _topics) ret.push_back(abridge(t)); return ret; } @@ -87,10 +87,10 @@ bool TopicFilter::matches(Envelope const& _e) const TopicFilter::TopicFilter(RLP const& _r) { - for (RLP i: _r) + for (RLP const& i: _r) { m_topicMasks.push_back(TopicMask()); - for (RLP j: i) + for (RLP const& j: i) m_topicMasks.back().push_back(j.toPair, FixedHash<4>>()); } } @@ -99,7 +99,7 @@ AbridgedTopic TopicFilter::exportBloom() const { AbridgedTopic ret; for (TopicMask const& t: m_topicMasks) - for (auto i: t) + for (auto const& i: t) ret |= i.first.template bloomPart(); return ret; From 52bc8a6c5ca8e70061feaa060e85269322f30aeb Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 17 Jun 2015 14:05:40 +0200 Subject: [PATCH 078/169] small changes --- mix/ContractCallDataEncoder.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index 1b713b82b..a1aae3f79 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -98,7 +98,6 @@ void ContractCallDataEncoder::encodeArray(QJsonArray const& _array, QList _ void ContractCallDataEncoder::encode(QVariant const& _data, SolidityType const& _type) { QStringList strList; - vector dim; if (_type.array) { QList dim = extractDimension(_type. name); From 536bd36185323109524f84ddf5d333e786c05cfb Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jun 2015 12:01:39 +0200 Subject: [PATCH 079/169] Accessors for strings. --- libsolidity/AST.cpp | 10 +-- libsolidity/ArrayUtils.cpp | 56 ++++++++-------- libsolidity/Compiler.cpp | 40 ++++++++---- libsolidity/CompilerUtils.cpp | 57 +++++++++++------ libsolidity/CompilerUtils.h | 5 +- libsolidity/ExpressionCompiler.cpp | 34 ++++++---- libsolidity/NameAndTypeResolver.cpp | 8 +-- libsolidity/Types.cpp | 62 ++++++++++-------- libsolidity/Types.h | 35 +++++----- test/libsolidity/SolidityEndToEndTest.cpp | 78 +++++++++++++++++++++++ test/libsolidity/SolidityTypes.cpp | 14 ++-- 11 files changed, 267 insertions(+), 132 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index dbeec858e..6d6a13cff 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -919,7 +919,7 @@ void MemberAccess::checkTypeRequirements(TypePointers const* _argumentTypes) { auto const& arrayType(dynamic_cast(type)); m_isLValue = (*m_memberName == "length" && - arrayType.location() != ReferenceType::Location::CallData && arrayType.isDynamicallySized()); + arrayType.location() != DataLocation::CallData && arrayType.isDynamicallySized()); } else m_isLValue = false; @@ -942,7 +942,7 @@ void IndexAccess::checkTypeRequirements(TypePointers const*) m_type = make_shared(1); else m_type = type.getBaseType(); - m_isLValue = type.location() != ReferenceType::Location::CallData; + m_isLValue = type.location() != DataLocation::CallData; break; } case Type::Category::Mapping: @@ -959,7 +959,7 @@ void IndexAccess::checkTypeRequirements(TypePointers const*) { TypeType const& type = dynamic_cast(*m_base->getType()); if (!m_index) - m_type = make_shared(make_shared(ReferenceType::Location::Memory, type.getActualType())); + m_type = make_shared(make_shared(DataLocation::Memory, type.getActualType())); else { m_index->checkTypeRequirements(nullptr); @@ -967,7 +967,9 @@ void IndexAccess::checkTypeRequirements(TypePointers const*) if (!length) BOOST_THROW_EXCEPTION(m_index->createTypeError("Integer constant expected.")); m_type = make_shared(make_shared( - ReferenceType::Location::Memory, type.getActualType(), length->literalValue(nullptr))); + DataLocation::Memory, type.getActualType(), + length->literalValue(nullptr) + )); } break; } diff --git a/libsolidity/ArrayUtils.cpp b/libsolidity/ArrayUtils.cpp index b770b815c..43ffff0b6 100644 --- a/libsolidity/ArrayUtils.cpp +++ b/libsolidity/ArrayUtils.cpp @@ -38,10 +38,10 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons // need to leave "target_ref target_byte_off" on the stack at the end // stack layout: [source_ref] [source_byte_off] [source length] target_ref target_byte_off (top) - solAssert(_targetType.location() == ReferenceType::Location::Storage, ""); + solAssert(_targetType.location() == DataLocation::Storage, ""); solAssert( - _sourceType.location() == ReferenceType::Location::CallData || - _sourceType.location() == ReferenceType::Location::Storage, + _sourceType.location() == DataLocation::CallData || + _sourceType.location() == DataLocation::Storage, "Given array location not implemented." ); @@ -51,7 +51,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons // TODO unroll loop for small sizes - bool sourceIsStorage = _sourceType.location() == ReferenceType::Location::Storage; + bool sourceIsStorage = _sourceType.location() == DataLocation::Storage; bool directCopy = sourceIsStorage && sourceBaseType->isValueType() && *sourceBaseType == *targetBaseType; bool haveByteOffsetSource = !directCopy && sourceIsStorage && sourceBaseType->getStorageBytes() <= 16; bool haveByteOffsetTarget = !directCopy && targetBaseType->getStorageBytes() <= 16; @@ -69,7 +69,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons m_context << eth::Instruction::POP; // stack: target_ref source_ref [source_length] // retrieve source length - if (_sourceType.location() != ReferenceType::Location::CallData || !_sourceType.isDynamicallySized()) + if (_sourceType.location() != DataLocation::CallData || !_sourceType.isDynamicallySized()) retrieveLength(_sourceType); // otherwise, length is already there // stack: target_ref source_ref source_length m_context << eth::Instruction::DUP3; @@ -82,7 +82,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons if (sourceBaseType->getCategory() == Type::Category::Mapping) { solAssert(targetBaseType->getCategory() == Type::Category::Mapping, ""); - solAssert(_sourceType.location() == ReferenceType::Location::Storage, ""); + solAssert(_sourceType.location() == DataLocation::Storage, ""); // nothing to copy m_context << eth::Instruction::POP << eth::Instruction::POP @@ -106,7 +106,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons eth::AssemblyItem copyLoopEndWithoutByteOffset = m_context.newTag(); m_context.appendConditionalJumpTo(copyLoopEndWithoutByteOffset); - if (_sourceType.location() == ReferenceType::Location::Storage && _sourceType.isDynamicallySized()) + if (_sourceType.location() == DataLocation::Storage && _sourceType.isDynamicallySized()) CompilerUtils(m_context).computeHashStatic(); // stack: target_ref target_data_end source_length target_data_pos source_data_pos m_context << eth::Instruction::SWAP2; @@ -155,7 +155,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons // checking is easier. // stack: target_ref target_data_end source_data_pos target_data_pos source_data_end [target_byte_offset] [source_byte_offset] m_context << eth::dupInstruction(3 + byteOffsetSize); - if (_sourceType.location() == ReferenceType::Location::Storage) + if (_sourceType.location() == DataLocation::Storage) { if (haveByteOffsetSource) m_context << eth::Instruction::DUP2; @@ -231,7 +231,7 @@ void ArrayUtils::copyArrayToStorage(ArrayType const& _targetType, ArrayType cons void ArrayUtils::clearArray(ArrayType const& _type) const { unsigned stackHeightStart = m_context.getStackHeight(); - solAssert(_type.location() == ReferenceType::Location::Storage, ""); + solAssert(_type.location() == DataLocation::Storage, ""); if (_type.getBaseType()->getStorageBytes() < 32) { solAssert(_type.getBaseType()->isValueType(), "Invalid storage size for non-value type."); @@ -286,7 +286,7 @@ void ArrayUtils::clearArray(ArrayType const& _type) const void ArrayUtils::clearDynamicArray(ArrayType const& _type) const { - solAssert(_type.location() == ReferenceType::Location::Storage, ""); + solAssert(_type.location() == DataLocation::Storage, ""); solAssert(_type.isDynamicallySized(), ""); unsigned stackHeightStart = m_context.getStackHeight(); @@ -314,7 +314,7 @@ void ArrayUtils::clearDynamicArray(ArrayType const& _type) const void ArrayUtils::resizeDynamicArray(const ArrayType& _type) const { - solAssert(_type.location() == ReferenceType::Location::Storage, ""); + solAssert(_type.location() == DataLocation::Storage, ""); solAssert(_type.isDynamicallySized(), ""); if (!_type.isByteArray() && _type.getBaseType()->getStorageBytes() < 32) solAssert(_type.getBaseType()->isValueType(), "Invalid storage size for non-value type."); @@ -399,7 +399,7 @@ void ArrayUtils::clearStorageLoop(Type const& _type) const void ArrayUtils::convertLengthToSize(ArrayType const& _arrayType, bool _pad) const { - if (_arrayType.location() == ReferenceType::Location::Storage) + if (_arrayType.location() == DataLocation::Storage) { if (_arrayType.getBaseType()->getStorageSize() <= 1) { @@ -437,13 +437,13 @@ void ArrayUtils::retrieveLength(ArrayType const& _arrayType) const m_context << eth::Instruction::DUP1; switch (_arrayType.location()) { - case ReferenceType::Location::CallData: + case DataLocation::CallData: // length is stored on the stack break; - case ReferenceType::Location::Memory: + case DataLocation::Memory: m_context << eth::Instruction::MLOAD; break; - case ReferenceType::Location::Storage: + case DataLocation::Storage: m_context << eth::Instruction::SLOAD; break; } @@ -452,16 +452,16 @@ void ArrayUtils::retrieveLength(ArrayType const& _arrayType) const void ArrayUtils::accessIndex(ArrayType const& _arrayType) const { - ReferenceType::Location location = _arrayType.location(); + DataLocation location = _arrayType.location(); eth::Instruction load = - location == ReferenceType::Location::Storage ? eth::Instruction::SLOAD : - location == ReferenceType::Location::Memory ? eth::Instruction::MLOAD : + location == DataLocation::Storage ? eth::Instruction::SLOAD : + location == DataLocation::Memory ? eth::Instruction::MLOAD : eth::Instruction::CALLDATALOAD; // retrieve length if (!_arrayType.isDynamicallySized()) m_context << _arrayType.getLength(); - else if (location == ReferenceType::Location::CallData) + else if (location == DataLocation::CallData) // length is stored on the stack m_context << eth::Instruction::SWAP1; else @@ -476,20 +476,20 @@ void ArrayUtils::accessIndex(ArrayType const& _arrayType) const m_context << eth::Instruction::SWAP1; if (_arrayType.isDynamicallySized()) { - if (location == ReferenceType::Location::Storage) + if (location == DataLocation::Storage) CompilerUtils(m_context).computeHashStatic(); - else if (location == ReferenceType::Location::Memory) + else if (location == DataLocation::Memory) m_context << u256(32) << eth::Instruction::ADD; } // stack: switch (location) { - case ReferenceType::Location::CallData: + case DataLocation::CallData: if (!_arrayType.isByteArray()) - m_context - << eth::Instruction::SWAP1 - << _arrayType.getBaseType()->getCalldataEncodedSize() - << eth::Instruction::MUL; + { + m_context << eth::Instruction::SWAP1; + m_context << _arrayType.getBaseType()->getCalldataEncodedSize() << eth::Instruction::MUL; + } m_context << eth::Instruction::ADD; if (_arrayType.getBaseType()->isValueType()) CompilerUtils(m_context).loadFromMemoryDynamic( @@ -499,7 +499,7 @@ void ArrayUtils::accessIndex(ArrayType const& _arrayType) const false ); break; - case ReferenceType::Location::Storage: + case DataLocation::Storage: m_context << eth::Instruction::SWAP1; if (_arrayType.getBaseType()->getStorageBytes() <= 16) { @@ -527,7 +527,7 @@ void ArrayUtils::accessIndex(ArrayType const& _arrayType) const m_context << eth::Instruction::ADD << u256(0); } break; - case ReferenceType::Location::Memory: + case DataLocation::Memory: solAssert(false, "Memory lvalues not yet implemented."); } } diff --git a/libsolidity/Compiler.cpp b/libsolidity/Compiler.cpp index 82e98dfff..0b88ed8ae 100644 --- a/libsolidity/Compiler.cpp +++ b/libsolidity/Compiler.cpp @@ -245,21 +245,35 @@ void Compiler::appendCalldataUnpacker( { // We do not check the calldata size, everything is zero-paddedd + //@todo this does not yet support nested arrays + if (_startOffset == u256(-1)) _startOffset = u256(CompilerUtils::dataStartOffset); m_context << _startOffset; for (TypePointer const& type: _typeParameters) { + // stack: v1 v2 ... v(k-1) mem_offset switch (type->getCategory()) { case Type::Category::Array: { auto const& arrayType = dynamic_cast(*type); - if (arrayType.location() == ReferenceType::Location::CallData) + solAssert(arrayType.location() != DataLocation::Storage, ""); + solAssert(!arrayType.getBaseType()->isDynamicallySized(), "Nested arrays not yet implemented."); + if (_fromMemory) + { + solAssert(arrayType.location() == DataLocation::Memory, ""); + // compute data pointer + //@todo once we support nested arrays, this offset needs to be dynamic. + m_context << eth::Instruction::DUP1 << _startOffset << eth::Instruction::ADD; + m_context << eth::Instruction::SWAP1 << u256(0x20) << eth::Instruction::ADD; + } + else { - solAssert(!_fromMemory, ""); - if (type->isDynamicallySized()) + // first load from calldata and potentially convert to memory if arrayType is memory + TypePointer calldataType = arrayType.copyForLocation(DataLocation::CallData, false); + if (calldataType->isDynamicallySized()) { // put on stack: data_pointer length CompilerUtils(m_context).loadFromMemoryDynamic(IntegerType(256), !_fromMemory); @@ -276,17 +290,17 @@ void Compiler::appendCalldataUnpacker( { // leave the pointer on the stack m_context << eth::Instruction::DUP1; - m_context << u256(type->getCalldataEncodedSize()) << eth::Instruction::ADD; + m_context << u256(calldataType->getCalldataEncodedSize()) << eth::Instruction::ADD; + } + if (arrayType.location() == DataLocation::Memory) + { + // copy to memory + // move calldata type up again + CompilerUtils(m_context).moveIntoStack(calldataType->getSizeOnStack()); + CompilerUtils(m_context).convertType(*calldataType, arrayType); + // fetch next pointer again + CompilerUtils(m_context).moveToStackTop(arrayType.getSizeOnStack()); } - } - else - { - solAssert(arrayType.location() == ReferenceType::Location::Memory, ""); - // compute data pointer - m_context << eth::Instruction::DUP1 << _startOffset << eth::Instruction::ADD; - if (!_fromMemory) - solAssert(false, "Not yet implemented."); - m_context << eth::Instruction::SWAP1 << u256(0x20) << eth::Instruction::ADD; } break; } diff --git a/libsolidity/CompilerUtils.cpp b/libsolidity/CompilerUtils.cpp index d4e705a3c..4d57dc926 100644 --- a/libsolidity/CompilerUtils.cpp +++ b/libsolidity/CompilerUtils.cpp @@ -107,16 +107,18 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound auto const& type = dynamic_cast(_type); solAssert(type.isByteArray(), "Non byte arrays not yet implemented here."); - if (type.location() == ReferenceType::Location::CallData) + if (type.location() == DataLocation::CallData) { + if (!type.isDynamicallySized()) + m_context << type.getLength(); // stack: target source_offset source_len m_context << eth::Instruction::DUP1 << eth::Instruction::DUP3 << eth::Instruction::DUP5; - // stack: target source_offset source_len source_len source_offset target + // stack: target source_offset source_len source_len source_offset target m_context << eth::Instruction::CALLDATACOPY; m_context << eth::Instruction::DUP3 << eth::Instruction::ADD; m_context << eth::Instruction::SWAP2 << eth::Instruction::POP << eth::Instruction::POP; } - else if (type.location() == ReferenceType::Location::Memory) + else if (type.location() == DataLocation::Memory) { // memcpy using the built-in contract ArrayUtils(m_context).retrieveLength(type); @@ -183,7 +185,7 @@ void CompilerUtils::storeInMemoryDynamic(Type const& _type, bool _padToWordBound } else { - solAssert(type.location() == ReferenceType::Location::Storage, ""); + solAssert(type.location() == DataLocation::Storage, ""); m_context << eth::Instruction::POP; // remove offset, arrays always start new slot m_context << eth::Instruction::DUP1 << eth::Instruction::SLOAD; // stack here: memory_offset storage_offset length_bytes @@ -276,7 +278,10 @@ void CompilerUtils::encodeToMemory( copyToStackTop(argSize - stackPos + dynPointers + 2, _givenTypes[i]->getSizeOnStack()); solAssert(!!targetType, "Externalable type expected."); TypePointer type = targetType; - if (_givenTypes[i]->isInStorage()) + if ( + _givenTypes[i]->dataStoredIn(DataLocation::Storage) || + _givenTypes[i]->dataStoredIn(DataLocation::CallData) + ) type = _givenTypes[i]; // delay conversion else convertType(*_givenTypes[i], *targetType, true); @@ -307,13 +312,13 @@ void CompilerUtils::encodeToMemory( // stack: ... // copy length to memory m_context << eth::dupInstruction(1 + arrayType.getSizeOnStack()); - if (arrayType.location() == ReferenceType::Location::CallData) + if (arrayType.location() == DataLocation::CallData) m_context << eth::Instruction::DUP2; // length is on stack - else if (arrayType.location() == ReferenceType::Location::Storage) + else if (arrayType.location() == DataLocation::Storage) m_context << eth::Instruction::DUP3 << eth::Instruction::SLOAD; else { - solAssert(arrayType.location() == ReferenceType::Location::Memory, ""); + solAssert(arrayType.location() == DataLocation::Memory, ""); m_context << eth::Instruction::DUP2 << eth::Instruction::MLOAD; } // stack: ... @@ -435,18 +440,18 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp ArrayType const& targetType = dynamic_cast(_targetType); switch (targetType.location()) { - case ReferenceType::Location::Storage: + case DataLocation::Storage: // Other cases are done explicitly in LValue::storeValue, and only possible by assignment. solAssert( targetType.isPointer() && - typeOnStack.location() == ReferenceType::Location::Storage, + typeOnStack.location() == DataLocation::Storage, "Invalid conversion to storage type." ); break; - case ReferenceType::Location::Memory: + case DataLocation::Memory: { // Copy the array to a free position in memory, unless it is already in memory. - if (typeOnStack.location() != ReferenceType::Location::Memory) + if (typeOnStack.location() != DataLocation::Memory) { // stack: (variably sized) unsigned stackSize = typeOnStack.getSizeOnStack(); @@ -455,7 +460,7 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp // stack: (variably sized) if (targetType.isDynamicallySized()) { - bool fromStorage = (typeOnStack.location() == ReferenceType::Location::Storage); + bool fromStorage = (typeOnStack.location() == DataLocation::Storage); // store length if (fromStorage) { @@ -486,11 +491,25 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp // Stack storeFreeMemoryPointer(); } - else if (typeOnStack.location() == ReferenceType::Location::CallData) + else if (typeOnStack.location() == DataLocation::CallData) { - // Stack: - //@todo - solAssert(false, "Not yet implemented."); + // Stack: [] + // length is present if dynamically sized + fetchFreeMemoryPointer(); + moveIntoStack(typeOnStack.getSizeOnStack()); + // stack: memptr calldataoffset [] + if (typeOnStack.isDynamicallySized()) + { + solAssert(targetType.isDynamicallySized(), ""); + m_context << eth::Instruction::DUP3 << eth::Instruction::DUP2; + storeInMemoryDynamic(IntegerType(256)); + moveIntoStack(typeOnStack.getSizeOnStack()); + } + else + m_context << eth::Instruction::DUP2 << eth::Instruction::SWAP1; + // stack: mem_ptr mem_data_ptr calldataoffset [] + storeInMemoryDynamic(typeOnStack); + storeFreeMemoryPointer(); } // nothing to do for memory to memory break; @@ -507,8 +526,8 @@ void CompilerUtils::convertType(Type const& _typeOnStack, Type const& _targetTyp auto& targetType = dynamic_cast(_targetType); auto& stackType = dynamic_cast(_typeOnStack); solAssert( - targetType.location() == ReferenceType::Location::Storage && - stackType.location() == ReferenceType::Location::Storage, + targetType.location() == DataLocation::Storage && + stackType.location() == DataLocation::Storage, "Non-storage structs not yet implemented." ); solAssert( diff --git a/libsolidity/CompilerUtils.h b/libsolidity/CompilerUtils.h index 32dc93a2c..a880f9ee4 100644 --- a/libsolidity/CompilerUtils.h +++ b/libsolidity/CompilerUtils.h @@ -99,8 +99,9 @@ public: bool _copyDynamicDataInPlace = false ); - /// Appends code for an implicit or explicit type conversion. For now this comprises only erasing - /// higher-order bits (@see appendHighBitCleanup) when widening integer. + /// Appends code for an implicit or explicit type conversion. This includes erasing higher + /// order bits (@see appendHighBitCleanup) when widening integer but also copy to memory + /// if a reference type is converted from calldata or storage to memory. /// If @a _cleanupNeeded, high order bits cleanup is also done if no type conversion would be /// necessary. void convertType(Type const& _typeOnStack, Type const& _targetType, bool _cleanupNeeded = false); diff --git a/libsolidity/ExpressionCompiler.cpp b/libsolidity/ExpressionCompiler.cpp index c98d76f3f..bfb945d8f 100644 --- a/libsolidity/ExpressionCompiler.cpp +++ b/libsolidity/ExpressionCompiler.cpp @@ -109,34 +109,40 @@ void ExpressionCompiler::appendStateVariableAccessor(VariableDeclaration const& } unsigned retSizeOnStack = 0; solAssert(accessorType.getReturnParameterTypes().size() >= 1, ""); + auto const& returnTypes = accessorType.getReturnParameterTypes(); if (StructType const* structType = dynamic_cast(returnType.get())) { // remove offset m_context << eth::Instruction::POP; auto const& names = accessorType.getReturnParameterNames(); - auto const& types = accessorType.getReturnParameterTypes(); // struct for (size_t i = 0; i < names.size(); ++i) { - if (types[i]->getCategory() == Type::Category::Mapping || types[i]->getCategory() == Type::Category::Array) + if (returnTypes[i]->getCategory() == Type::Category::Mapping) continue; + if (auto arrayType = dynamic_cast(returnTypes[i].get())) + if (!arrayType->isByteArray()) + continue; pair const& offsets = structType->getStorageOffsetsOfMember(names[i]); m_context << eth::Instruction::DUP1 << u256(offsets.first) << eth::Instruction::ADD << u256(offsets.second); - StorageItem(m_context, *types[i]).retrieveValue(SourceLocation(), true); - solAssert(types[i]->getSizeOnStack() == 1, "Returning struct elements with stack size != 1 is not yet implemented."); - m_context << eth::Instruction::SWAP1; - retSizeOnStack += types[i]->getSizeOnStack(); + TypePointer memberType = structType->getMemberType(names[i]); + StorageItem(m_context, *memberType).retrieveValue(SourceLocation(), true); + utils().convertType(*memberType, *returnTypes[i]); + utils().moveToStackTop(returnTypes[i]->getSizeOnStack()); + retSizeOnStack += returnTypes[i]->getSizeOnStack(); } // remove slot m_context << eth::Instruction::POP; } else { - // simple value - solAssert(accessorType.getReturnParameterTypes().size() == 1, ""); + // simple value or array + solAssert(returnTypes.size() == 1, ""); StorageItem(m_context, *returnType).retrieveValue(SourceLocation(), true); - retSizeOnStack = returnType->getSizeOnStack(); + utils().convertType(*returnType, *returnTypes.front()); + retSizeOnStack = returnTypes.front()->getSizeOnStack(); } + solAssert(retSizeOnStack == utils().getSizeOnStack(returnTypes), ""); solAssert(retSizeOnStack <= 15, "Stack is too deep."); m_context << eth::dupInstruction(retSizeOnStack + 1); m_context.appendJump(eth::AssemblyItem::JumpType::OutOfFunction); @@ -147,7 +153,7 @@ bool ExpressionCompiler::visit(Assignment const& _assignment) CompilerContext::LocationSetter locationSetter(m_context, _assignment); _assignment.getRightHandSide().accept(*this); TypePointer type = _assignment.getRightHandSide().getType(); - if (!_assignment.getType()->isInStorage()) + if (!_assignment.getType()->dataStoredIn(DataLocation::Storage)) { utils().convertType(*type, *_assignment.getType()); type = _assignment.getType(); @@ -712,10 +718,10 @@ void ExpressionCompiler::endVisit(MemberAccess const& _memberAccess) else switch (type.location()) { - case ReferenceType::Location::CallData: + case DataLocation::CallData: m_context << eth::Instruction::SWAP1 << eth::Instruction::POP; break; - case ReferenceType::Location::Storage: + case DataLocation::Storage: setLValue(_memberAccess, type); break; default: @@ -758,13 +764,13 @@ bool ExpressionCompiler::visit(IndexAccess const& _indexAccess) solAssert(_indexAccess.getIndexExpression(), "Index expression expected."); // remove storage byte offset - if (arrayType.location() == ReferenceType::Location::Storage) + if (arrayType.location() == DataLocation::Storage) m_context << eth::Instruction::POP; _indexAccess.getIndexExpression()->accept(*this); // stack layout: [] ArrayUtils(m_context).accessIndex(arrayType); - if (arrayType.location() == ReferenceType::Location::Storage) + if (arrayType.location() == DataLocation::Storage) { if (arrayType.isByteArray()) { diff --git a/libsolidity/NameAndTypeResolver.cpp b/libsolidity/NameAndTypeResolver.cpp index e60797967..87f9da7ee 100644 --- a/libsolidity/NameAndTypeResolver.cpp +++ b/libsolidity/NameAndTypeResolver.cpp @@ -439,7 +439,7 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable) "Location has to be calldata for external functions " "(remove the \"memory\" or \"storage\" keyword)." )); - type = ref->copyForLocation(ReferenceType::Location::CallData, true); + type = ref->copyForLocation(DataLocation::CallData, true); } else if (_variable.isCallableParameter() && _variable.getScope()->isPublic()) { @@ -449,7 +449,7 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable) "Location has to be memory for publicly visible functions " "(remove the \"storage\" keyword)." )); - type = ref->copyForLocation(ReferenceType::Location::Memory, true); + type = ref->copyForLocation(DataLocation::Memory, true); } else { @@ -458,8 +458,8 @@ void ReferencesResolver::endVisit(VariableDeclaration& _variable) bool isPointer = !_variable.isStateVariable(); type = ref->copyForLocation( loc == Location::Memory ? - ReferenceType::Location::Memory : - ReferenceType::Location::Storage, + DataLocation::Memory : + DataLocation::Storage, isPointer ); } diff --git a/libsolidity/Types.cpp b/libsolidity/Types.cpp index bedd2e7b0..b90b88846 100644 --- a/libsolidity/Types.cpp +++ b/libsolidity/Types.cpp @@ -144,12 +144,13 @@ TypePointer Type::fromElementaryTypeName(Token::Value _typeToken) else if (_typeToken == Token::Bool) return make_shared(); else if (_typeToken == Token::Bytes) - return make_shared(ReferenceType::Location::Storage); + return make_shared(DataLocation::Storage); else if (_typeToken == Token::String) - return make_shared(ReferenceType::Location::Storage, true); + return make_shared(DataLocation::Storage, true); else - BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Unable to convert elementary typename " + - std::string(Token::toString(_typeToken)) + " to type.")); + BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment( + "Unable to convert elementary typename " + std::string(Token::toString(_typeToken)) + " to type." + )); } TypePointer Type::fromElementaryTypeName(string const& _name) @@ -180,7 +181,7 @@ TypePointer Type::fromMapping(ElementaryTypeName& _keyType, TypeName& _valueType if (!valueType) BOOST_THROW_EXCEPTION(_valueType.createTypeError("Invalid type name.")); // Convert value type to storage reference. - valueType = ReferenceType::copyForLocationIfReference(ReferenceType::Location::Storage, valueType); + valueType = ReferenceType::copyForLocationIfReference(DataLocation::Storage, valueType); return make_shared(keyType, valueType); } @@ -198,10 +199,10 @@ TypePointer Type::fromArrayTypeName(TypeName& _baseTypeName, Expression* _length auto const* length = dynamic_cast(_length->getType().get()); if (!length) BOOST_THROW_EXCEPTION(_length->createTypeError("Invalid array length.")); - return make_shared(ReferenceType::Location::Storage, baseType, length->literalValue(nullptr)); + return make_shared(DataLocation::Storage, baseType, length->literalValue(nullptr)); } else - return make_shared(ReferenceType::Location::Storage, baseType); + return make_shared(DataLocation::Storage, baseType); } TypePointer Type::forLiteral(Literal const& _literal) @@ -670,7 +671,7 @@ TypePointer ContractType::unaryOperatorResult(Token::Value _operator) const return _operator == Token::Delete ? make_shared() : TypePointer(); } -TypePointer ReferenceType::copyForLocationIfReference(Location _location, TypePointer const& _type) +TypePointer ReferenceType::copyForLocationIfReference(DataLocation _location, TypePointer const& _type) { if (auto type = dynamic_cast(_type.get())) return type->copyForLocation(_location, false); @@ -686,11 +687,11 @@ string ReferenceType::stringForReferencePart() const { switch (m_location) { - case Location::Storage: + case DataLocation::Storage: return string("storage ") + (m_isPointer ? "pointer" : "ref"); - case Location::CallData: + case DataLocation::CallData: return "calldata"; - case Location::Memory: + case DataLocation::Memory: return "memory"; } solAssert(false, ""); @@ -705,11 +706,11 @@ bool ArrayType::isImplicitlyConvertibleTo(const Type& _convertTo) const if (convertTo.isByteArray() != isByteArray() || convertTo.isString() != isString()) return false; // memory/calldata to storage can be converted, but only to a direct storage reference - if (convertTo.location() == Location::Storage && location() != Location::Storage && convertTo.isPointer()) + if (convertTo.location() == DataLocation::Storage && location() != DataLocation::Storage && convertTo.isPointer()) return false; - if (convertTo.location() == Location::CallData && location() != convertTo.location()) + if (convertTo.location() == DataLocation::CallData && location() != convertTo.location()) return false; - if (convertTo.location() == Location::Storage && !convertTo.isPointer()) + if (convertTo.location() == DataLocation::Storage && !convertTo.isPointer()) { // Less restrictive conversion, since we need to copy anyway. if (!getBaseType()->isImplicitlyConvertibleTo(*convertTo.getBaseType())) @@ -788,10 +789,10 @@ u256 ArrayType::getStorageSize() const unsigned ArrayType::getSizeOnStack() const { - if (m_location == Location::CallData) + if (m_location == DataLocation::CallData) // offset [length] (stack top) return 1 + (isDynamicallySized() ? 1 : 0); - else if (m_location == Location::Storage) + else if (m_location == DataLocation::Storage) // storage_key storage_offset return 2; else @@ -828,12 +829,12 @@ TypePointer ArrayType::externalType() const return TypePointer(); if (isDynamicallySized()) - return std::make_shared(Location::CallData, m_baseType->externalType()); + return std::make_shared(DataLocation::CallData, m_baseType->externalType()); else - return std::make_shared(Location::CallData, m_baseType->externalType(), m_length); + return std::make_shared(DataLocation::CallData, m_baseType->externalType(), m_length); } -TypePointer ArrayType::copyForLocation(ReferenceType::Location _location, bool _isPointer) const +TypePointer ArrayType::copyForLocation(DataLocation _location, bool _isPointer) const { auto copy = make_shared(_location); copy->m_isPointer = _isPointer; @@ -949,9 +950,9 @@ bool StructType::isImplicitlyConvertibleTo(const Type& _convertTo) const return false; auto& convertTo = dynamic_cast(_convertTo); // memory/calldata to storage can be converted, but only to a direct storage reference - if (convertTo.location() == Location::Storage && location() != Location::Storage && convertTo.isPointer()) + if (convertTo.location() == DataLocation::Storage && location() != DataLocation::Storage && convertTo.isPointer()) return false; - if (convertTo.location() == Location::CallData && location() != convertTo.location()) + if (convertTo.location() == DataLocation::CallData && location() != convertTo.location()) return false; return this->m_struct == convertTo.m_struct; } @@ -1009,7 +1010,7 @@ MemberList const& StructType::getMembers() const return *m_members; } -TypePointer StructType::copyForLocation(ReferenceType::Location _location, bool _isPointer) const +TypePointer StructType::copyForLocation(DataLocation _location, bool _isPointer) const { auto copy = make_shared(m_struct); copy->m_location = _location; @@ -1115,6 +1116,9 @@ FunctionType::FunctionType(VariableDeclaration const& _varDecl): } else if (auto arrayType = dynamic_cast(returnType.get())) { + if (arrayType->isByteArray()) + // Return byte arrays as as whole. + break; returnType = arrayType->getBaseType(); paramNames.push_back(""); paramTypes.push_back(make_shared(256)); @@ -1128,15 +1132,21 @@ FunctionType::FunctionType(VariableDeclaration const& _varDecl): if (auto structType = dynamic_cast(returnType.get())) { for (auto const& member: structType->getMembers()) - if (member.type->getCategory() != Category::Mapping && member.type->getCategory() != Category::Array) + if (member.type->getCategory() != Category::Mapping) { - retParamNames.push_back(member.name); + if (auto arrayType = dynamic_cast(member.type.get())) + if (!arrayType->isByteArray()) + continue; retParams.push_back(member.type); + retParamNames.push_back(member.name); } } else { - retParams.push_back(returnType); + retParams.push_back(ReferenceType::copyForLocationIfReference( + DataLocation::Memory, + returnType + )); retParamNames.push_back(""); } @@ -1549,7 +1559,7 @@ MagicType::MagicType(MagicType::Kind _kind): {"sender", make_shared(0, IntegerType::Modifier::Address)}, {"gas", make_shared(256)}, {"value", make_shared(256)}, - {"data", make_shared(ReferenceType::Location::CallData)}, + {"data", make_shared(DataLocation::CallData)}, {"sig", make_shared(4)} }); break; diff --git a/libsolidity/Types.h b/libsolidity/Types.h index 70f7807c8..cca5dde71 100644 --- a/libsolidity/Types.h +++ b/libsolidity/Types.h @@ -44,6 +44,8 @@ using FunctionTypePointer = std::shared_ptr; using TypePointers = std::vector; +enum class DataLocation { Storage, CallData, Memory }; + /** * Helper class to compute storage offsets of members of structs and contracts. */ @@ -202,8 +204,9 @@ public: /// This returns the corresponding integer type for IntegerConstantTypes and the pointer type /// for storage reference types. virtual TypePointer mobileType() const { return shared_from_this(); } - /// @returns true if this type is a storage pointer or reference. - virtual bool isInStorage() const { return false; } + /// @returns true if this is a non-value type and the data of this type is stored at the + /// given location. + virtual bool dataStoredIn(DataLocation) const { return false; } /// Returns the list of all members of this type. Default implementation: no members. virtual MemberList const& getMembers() const { return EmptyMemberList; } @@ -367,16 +370,15 @@ public: class ReferenceType: public Type { public: - enum class Location { Storage, CallData, Memory }; - explicit ReferenceType(Location _location): m_location(_location) {} - Location location() const { return m_location; } + explicit ReferenceType(DataLocation _location): m_location(_location) {} + DataLocation location() const { return m_location; } /// @returns a copy of this type with location (recursively) changed to @a _location, /// whereas isPointer is only shallowly changed - the deep copy is always a bound reference. - virtual TypePointer copyForLocation(Location _location, bool _isPointer) const = 0; + virtual TypePointer copyForLocation(DataLocation _location, bool _isPointer) const = 0; virtual TypePointer mobileType() const override { return copyForLocation(m_location, true); } - virtual bool isInStorage() const override { return m_location == Location::Storage; } + virtual bool dataStoredIn(DataLocation _location) const override { return m_location == _location; } /// Storage references can be pointers or bound references. In general, local variables are of /// pointer type, state variables are bound references. Assignments to pointers or deleting @@ -392,14 +394,14 @@ public: /// @returns a copy of @a _type having the same location as this (and is not a pointer type) /// if _type is a reference type and an unmodified copy of _type otherwise. /// This function is mostly useful to modify inner types appropriately. - static TypePointer copyForLocationIfReference(Location _location, TypePointer const& _type); + static TypePointer copyForLocationIfReference(DataLocation _location, TypePointer const& _type); protected: TypePointer copyForLocationIfReference(TypePointer const& _type) const; /// @returns a human-readable description of the reference part of the type. std::string stringForReferencePart() const; - Location m_location = Location::Storage; + DataLocation m_location = DataLocation::Storage; bool m_isPointer = true; }; @@ -416,20 +418,20 @@ public: virtual Category getCategory() const override { return Category::Array; } /// Constructor for a byte array ("bytes") and string. - explicit ArrayType(Location _location, bool _isString = false): + explicit ArrayType(DataLocation _location, bool _isString = false): ReferenceType(_location), m_arrayKind(_isString ? ArrayKind::String : ArrayKind::Bytes), m_baseType(std::make_shared(1)) { } /// Constructor for a dynamically sized array type ("type[]") - ArrayType(Location _location, TypePointer const& _baseType): + ArrayType(DataLocation _location, TypePointer const& _baseType): ReferenceType(_location), m_baseType(copyForLocationIfReference(_baseType)) { } /// Constructor for a fixed-size array type ("type[20]") - ArrayType(Location _location, TypePointer const& _baseType, u256 const& _length): + ArrayType(DataLocation _location, TypePointer const& _baseType, u256 const& _length): ReferenceType(_location), m_baseType(copyForLocationIfReference(_baseType)), m_hasDynamicLength(false), @@ -457,7 +459,7 @@ public: TypePointer const& getBaseType() const { solAssert(!!m_baseType, ""); return m_baseType;} u256 const& getLength() const { return m_length; } - TypePointer copyForLocation(Location _location, bool _isPointer) const override; + TypePointer copyForLocation(DataLocation _location, bool _isPointer) const override; private: /// String is interpreted as a subtype of Bytes. @@ -536,7 +538,7 @@ public: virtual Category getCategory() const override { return Category::Struct; } explicit StructType(StructDefinition const& _struct): //@todo only storage until we have non-storage structs - ReferenceType(Location::Storage), m_struct(_struct) {} + ReferenceType(DataLocation::Storage), m_struct(_struct) {} virtual bool isImplicitlyConvertibleTo(const Type& _convertTo) const override; virtual TypePointer unaryOperatorResult(Token::Value _operator) const override; virtual bool operator==(Type const& _other) const override; @@ -547,7 +549,7 @@ public: virtual MemberList const& getMembers() const override; - TypePointer copyForLocation(Location _location, bool _isPointer) const override; + TypePointer copyForLocation(DataLocation _location, bool _isPointer) const override; std::pair const& getStorageOffsetsOfMember(std::string const& _name) const; @@ -639,8 +641,11 @@ public: FunctionTypePointer externalFunctionType() const; virtual TypePointer externalType() const override { return externalFunctionType(); } + /// Creates the type of a function. explicit FunctionType(FunctionDefinition const& _function, bool _isInternal = true); + /// Creates the accessor function type of a state variable. explicit FunctionType(VariableDeclaration const& _varDecl); + /// Creates the function type of an event. explicit FunctionType(EventDefinition const& _event); FunctionType( strings const& _parameterTypes, diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 109481edc..106242813 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4257,6 +4257,84 @@ BOOST_AUTO_TEST_CASE(return_string) BOOST_CHECK(callContractFunction("s()") == args); } +BOOST_AUTO_TEST_CASE(return_multiple_strings_of_various_sizes) +{ + char const* sourceCode = R"( + contract Main { + string public s1; + string public s2; + function set(string _s1, uint x, string _s2) external returns (uint) { + s1 = _s1; + s2 = _s2; + return x; + } + function get() returns (string r1, string r2) { + r1 = s1; + r2 = s2; + } + } + )"; + compileAndRun(sourceCode, 0, "Main"); + string s1( + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" + "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz" + ); + string s2( + "ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ" + "ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ" + "ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ" + "ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ" + "ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ" + ); + vector lengthes{0, 30, 32, 63, 64, 65, 210, 300}; + for (auto l1: lengthes) + for (auto l2: lengthes) + { + bytes dyn1 = encodeArgs(u256(l1), s1.substr(0, l1)); + bytes dyn2 = encodeArgs(u256(l2), s2.substr(0, l2)); + bytes args = encodeArgs(u256(0x60), u256(l1), u256(0x60 + dyn1.size())) + dyn1 + dyn2; + BOOST_REQUIRE( + callContractFunction("set(string,uint256,string)", asString(args)) == + encodeArgs(u256(l1)) + ); + bytes result = encodeArgs(u256(0x40), u256(0x40 + dyn1.size())) + dyn1 + dyn2; + BOOST_CHECK(callContractFunction("get()") == result); + BOOST_CHECK(callContractFunction("s1()") == encodeArgs(0x20) + dyn1); + BOOST_CHECK(callContractFunction("s2()") == encodeArgs(0x20) + dyn2); + } +} + +BOOST_AUTO_TEST_CASE(accessor_involving_strings) +{ + char const* sourceCode = R"( + contract Main { + struct stringData { string a; uint b; string c; } + mapping(uint => stringData[]) public data; + function set(uint x, uint y, string a, uint b, string c) external returns (bool) { + data[x].length = y + 1; + data[x][y].a = a; + data[x][y].b = b; + data[x][y].c = c; + return true; + } + } + )"; + compileAndRun(sourceCode, 0, "Main"); + string s1("abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"); + string s2("ABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZABCDEFGHIJKLMNOPQRSTUVXYZ"); + bytes s1Data = encodeArgs(u256(s1.length()), s1); + bytes s2Data = encodeArgs(u256(s2.length()), s2); + u256 b = 765; + u256 x = 7; + u256 y = 123; + bytes args = encodeArgs(x, y, u256(0xa0), b, u256(0xa0 + s1Data.size()), s1Data, s2Data); + bytes result = encodeArgs(u256(0x60), b, u256(0x60 + s1Data.size()), s1Data, s2Data); + BOOST_REQUIRE(callContractFunction("set(uint256,uint256,string,uint256,string)", asString(args)) == encodeArgs(true)); + BOOST_REQUIRE(callContractFunction("data(uint256,uint256)", x, y) == result); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/SolidityTypes.cpp b/test/libsolidity/SolidityTypes.cpp index 718798a5a..7892de673 100644 --- a/test/libsolidity/SolidityTypes.cpp +++ b/test/libsolidity/SolidityTypes.cpp @@ -77,13 +77,13 @@ BOOST_AUTO_TEST_CASE(storage_layout_mapping) BOOST_AUTO_TEST_CASE(storage_layout_arrays) { - BOOST_CHECK(ArrayType(ReferenceType::Location::Storage, make_shared(1), 32).getStorageSize() == 1); - BOOST_CHECK(ArrayType(ReferenceType::Location::Storage, make_shared(1), 33).getStorageSize() == 2); - BOOST_CHECK(ArrayType(ReferenceType::Location::Storage, make_shared(2), 31).getStorageSize() == 2); - BOOST_CHECK(ArrayType(ReferenceType::Location::Storage, make_shared(7), 8).getStorageSize() == 2); - BOOST_CHECK(ArrayType(ReferenceType::Location::Storage, make_shared(7), 9).getStorageSize() == 3); - BOOST_CHECK(ArrayType(ReferenceType::Location::Storage, make_shared(31), 9).getStorageSize() == 9); - BOOST_CHECK(ArrayType(ReferenceType::Location::Storage, make_shared(32), 9).getStorageSize() == 9); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared(1), 32).getStorageSize() == 1); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared(1), 33).getStorageSize() == 2); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared(2), 31).getStorageSize() == 2); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared(7), 8).getStorageSize() == 2); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared(7), 9).getStorageSize() == 3); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared(31), 9).getStorageSize() == 9); + BOOST_CHECK(ArrayType(DataLocation::Storage, make_shared(32), 9).getStorageSize() == 9); } BOOST_AUTO_TEST_SUITE_END() From 3264250b5de65b0db8a041826bbd8e38a11bb1a9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jun 2015 14:35:55 +0200 Subject: [PATCH 080/169] Removed spaces between code and comment. --- libethcore/KeyManager.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libethcore/KeyManager.h b/libethcore/KeyManager.h index d9bb6457c..a2b5a4e07 100644 --- a/libethcore/KeyManager.h +++ b/libethcore/KeyManager.h @@ -38,8 +38,10 @@ struct KeyInfo KeyInfo() = default; KeyInfo(h256 const& _passHash, std::string const& _accountName): passHash(_passHash), accountName(_accountName) {} - h256 passHash; ///< Hash of the password or h256() / UnknownPassword if unknown. - std::string accountName; ///< Name of the key, or JSON key info if begins with '{'. + /// Hash of the password or h256() / UnknownPassword if unknown. + h256 passHash; + /// Name of the key, or JSON key info if begins with '{'. + std::string accountName; }; static h256 const UnknownPassword; From 06770736bd662c26bb04abe0d5a0b5e14d0a44d4 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Wed, 17 Jun 2015 15:32:27 +0200 Subject: [PATCH 081/169] style 2 --- test/libethereum/blockchain.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index de28d30ff..4dc1993a9 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -582,8 +582,11 @@ mArray importUncles(mObject const& _blObj, vector& _vBiUncles, vector updatePoW(uncleBlockFromFields); - uncleBlockFromFields.nonce = overwrite == "nonce" ? Nonce(uncleHeaderObj["nonce"].get_str()) : uncleBlockFromFields.nonce; - uncleBlockFromFields.mixHash = overwrite == "mixHash" ? h256(uncleHeaderObj["mixHash"].get_str()) : uncleBlockFromFields.mixHash; + if (overwrite == "nonce") + uncleBlockFromFields.nonce = Nonce(uncleHeaderObj["nonce"].get_str()); + + if (overwrite == "mixHash") + uncleBlockFromFields.mixHash = h256(uncleHeaderObj["mixHash"].get_str()); writeBlockHeaderToJson(uncleHeaderObj, uncleBlockFromFields); From 3660c4433695436b26118d78aee750952e1bf2fb Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 3 Jun 2015 17:21:29 +0300 Subject: [PATCH 082/169] FuzzTests: Boost Macro --- test/TestHelper.h | 16 +++ test/fuzzTesting/CMakeLists.txt | 5 + test/fuzzTesting/createRandomTest.cpp | 143 ++++++++++++++++++++++++++ test/libethereum/transaction.cpp | 43 ++++---- 4 files changed, 186 insertions(+), 21 deletions(-) create mode 100644 test/fuzzTesting/createRandomTest.cpp diff --git a/test/TestHelper.h b/test/TestHelper.h index 8f0c73bf3..eaeed619a 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -31,6 +31,19 @@ #include #include +#define DONTUSE_BOOST_MACROS +#ifdef DONTUSE_BOOST_MACROS + #define TBOOST_THROW_EXCEPTION(arg) throw; + #define TBOOST_REQUIRE(arg) if(arg == false) throw; + #define TBOOST_CHECK_MESSAGE(arg1, arg2) if(arg1 == false) throw; + #define TBOOST_WARN_MESSAGE(arg1, arg2) throw; +#else + #define TBOOST_THROW_EXCEPTION(arg) BOOST_THROW_EXCEPTION(arg) + #define TBOOST_REQUIRE(arg) BOOST_REQUIRE(arg) + #define TBOOST_CHECK_MESSAGE(arg1, arg2) BOOST_CHECK_MESSAGE(arg1, arg2) + #define TBOOST_WARN_MESSAGE(arg1, arg2) BOOST_WARN_MESSAGE(arg1, arg2) +#endif + namespace dev { namespace eth @@ -163,6 +176,9 @@ eth::LastHashes lastHashes(u256 _currentBlockNumber); json_spirit::mObject fillJsonWithState(eth::State _state); json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn); +//Fill Test Functions +void doTransactionTests(json_spirit::mValue& _v, bool _fillin); + template void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) { diff --git a/test/fuzzTesting/CMakeLists.txt b/test/fuzzTesting/CMakeLists.txt index 371d6504d..4024b7956 100644 --- a/test/fuzzTesting/CMakeLists.txt +++ b/test/fuzzTesting/CMakeLists.txt @@ -8,6 +8,7 @@ include_directories(${Boost_INCLUDE_DIRS}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) +add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp") add_executable(createRandomVMTest "./createRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp") add_executable(createRandomStateTest "./createRandomStateTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp") add_executable(checkRandomVMTest "./checkRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp" ) @@ -32,3 +33,7 @@ target_link_libraries(checkRandomStateTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES target_link_libraries(checkRandomStateTest ethereum) target_link_libraries(checkRandomStateTest ethcore) target_link_libraries(checkRandomStateTest testutils) +target_link_libraries(createRandomTest ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +target_link_libraries(createRandomTest ethereum) +target_link_libraries(createRandomTest ethcore) +target_link_libraries(createRandomTest testutils) diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp new file mode 100644 index 000000000..92fd21b76 --- /dev/null +++ b/test/fuzzTesting/createRandomTest.cpp @@ -0,0 +1,143 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file createRandomTest.cpp + * @author Dimitry Khokhlov + * @date 2015 + */ + +#include +#include + +#include +#include + + +extern std::string const c_testExampleTransactionTest; +std::vector getTypes(); +void parseTestWithTypes(std::string& test); +void randomTransactionTest(); +void randomBlockChainTest(); + +int main(int argc, char *argv[]) +{ + std::string testSuite; + for (auto i = 0; i < argc; ++i) + { + auto arg = std::string{argv[i]}; + dev::test::Options& options = const_cast(dev::test::Options::get()); + if (arg == "--fulloutput") + options.fulloutput = true; + if (arg == "-t" && i + 1 < argc) + { + testSuite = argv[i + 1]; + if (testSuite != "BlockChainTests" && testSuite != "TransactionTests") + testSuite = ""; + } + } + + if (testSuite == "") + std::cout << "Error! Test suite not supported! (Usage -t TestSuite)"; + else + if (testSuite == "BlockChainTests") + randomBlockChainTest(); + else + if (testSuite == "TransactionTests") + randomTransactionTest(); + + return 0; +} + +void randomTransactionTest() +{ + std::string newTest = c_testExampleTransactionTest; + parseTestWithTypes(newTest); + json_spirit::mValue v; + json_spirit::read_string(newTest, v); + dev::test::doTransactionTests(v, true); + std::cout << json_spirit::write_string(v, true); +} + +void randomBlockChainTest() +{ + +} + +/// Parse Test string replacing keywords to fuzzed values +void parseTestWithTypes(std::string& test) +{ + std::vector types = getTypes(); + for (unsigned i = 0; i < types.size(); i++) + { + std::size_t pos = test.find(types.at(i)); + while (pos != std::string::npos) + { + if (types.at(i) == "[CODE]") + test.replace(pos, 6, "0x"+dev::test::RandomCode::generate(10)); + else + if (types.at(i) == "[HEX]") + test.replace(pos, 5, dev::test::RandomCode::randomUniIntHex()); + else + if (types.at(i) == "[HASH20]") + test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(20)); + else + if (types.at(i) == "[0xHASH32]") + test.replace(pos, 10, "0x" + dev::test::RandomCode::rndByteSequence(32)); + else + if (types.at(i) == "[V]") + { + int random = dev::test::RandomCode::randomUniInt() % 100; + if (random < 30) + test.replace(pos, 3, "28"); + else + if (random < 60) + test.replace(pos, 3, "29"); + else + test.replace(pos, 3, "0x" + dev::test::RandomCode::rndByteSequence(1)); + } + + pos = test.find(types.at(i)); + } + } +} + +std::vector getTypes() +{ + return {"[CODE]", "[HEX]", "[HASH20]", "[0xHASH32]", "[V]"}; +} + + +std::string const c_testExampleTransactionTest = R"( +{ +"TransactionTest" : { + "transaction" : + { + "data" : "[CODE]", + "gasLimit" : "[HEX]", + "gasPrice" : "[HEX]", + "nonce" : "[HEX]", + "to" : "[HASH20]", + "value" : "[HEX]", + "v" : "[V]", + "r" : "[0xHASH32]", + "s" : "[0xHASH32]" + } + } +} +)"; + + + diff --git a/test/libethereum/transaction.cpp b/test/libethereum/transaction.cpp index 017e51ded..ad20331b3 100644 --- a/test/libethereum/transaction.cpp +++ b/test/libethereum/transaction.cpp @@ -21,6 +21,7 @@ */ #include "../TestHelper.h" +#include "test/fuzzTesting/fuzzHelper.h" using namespace std; using namespace json_spirit; @@ -38,7 +39,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) if (_fillin) { - BOOST_REQUIRE(o.count("transaction") > 0); + TBOOST_REQUIRE((o.count("transaction") > 0)); mObject tObj = o["transaction"].get_obj(); //Construct Rlp of the given transaction @@ -49,7 +50,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) { Transaction txFromFields(rlpStream.out(), CheckTransaction::Everything); if (!txFromFields.signature().isValid()) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); + TBOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); o["sender"] = toString(txFromFields.sender()); o["transaction"] = ImportTest::makeAllFieldsHex(tObj); @@ -63,9 +64,9 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) { bool expectInValid = (o["expect"].get_str() == "invalid"); if (Options::get().checkState) - BOOST_CHECK_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!"); + {TBOOST_CHECK_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!");} else - BOOST_WARN_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!"); + {TBOOST_WARN_MESSAGE(expectInValid, "Check state: Transaction '" << i.first << "' is expected to be valid!");} o.erase(o.find("expect")); } @@ -76,16 +77,16 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) { bool expectValid = (o["expect"].get_str() == "valid"); if (Options::get().checkState) - BOOST_CHECK_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!"); + {TBOOST_CHECK_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!");} else - BOOST_WARN_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!"); + {TBOOST_WARN_MESSAGE(expectValid, "Check state: Transaction '" << i.first << "' is expected to be invalid!");} o.erase(o.find("expect")); } } else { - BOOST_REQUIRE(o.count("rlp") > 0); + TBOOST_REQUIRE((o.count("rlp") > 0)); Transaction txFromRlp; try { @@ -93,39 +94,39 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) RLP rlp(stream); txFromRlp = Transaction(rlp.data(), CheckTransaction::Everything); if (!txFromRlp.signature().isValid()) - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); + TBOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); } catch(Exception const& _e) { cnote << i.first; cnote << "Transaction Exception: " << diagnostic_information(_e); - BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transaction object should not be defined because the RLP is invalid!"); + TBOOST_CHECK_MESSAGE((o.count("transaction") == 0), "A transaction object should not be defined because the RLP is invalid!"); continue; } catch(...) { - BOOST_CHECK_MESSAGE(o.count("transaction") == 0, "A transaction object should not be defined because the RLP is invalid!"); + TBOOST_CHECK_MESSAGE((o.count("transaction") == 0), "A transaction object should not be defined because the RLP is invalid!"); continue; } - BOOST_REQUIRE(o.count("transaction") > 0); + TBOOST_REQUIRE((o.count("transaction") > 0)); mObject tObj = o["transaction"].get_obj(); Transaction txFromFields(createRLPStreamFromTransactionFields(tObj).out(), CheckTransaction::Everything); //Check the fields restored from RLP to original fields - BOOST_CHECK_MESSAGE(txFromFields.data() == txFromRlp.data(), "Data in given RLP not matching the Transaction data!"); - BOOST_CHECK_MESSAGE(txFromFields.value() == txFromRlp.value(), "Value in given RLP not matching the Transaction value!"); - BOOST_CHECK_MESSAGE(txFromFields.gasPrice() == txFromRlp.gasPrice(), "GasPrice in given RLP not matching the Transaction gasPrice!"); - BOOST_CHECK_MESSAGE(txFromFields.gas() == txFromRlp.gas(),"Gas in given RLP not matching the Transaction gas!"); - BOOST_CHECK_MESSAGE(txFromFields.nonce() == txFromRlp.nonce(),"Nonce in given RLP not matching the Transaction nonce!"); - BOOST_CHECK_MESSAGE(txFromFields.receiveAddress() == txFromRlp.receiveAddress(), "Receive address in given RLP not matching the Transaction 'to' address!"); - BOOST_CHECK_MESSAGE(txFromFields.sender() == txFromRlp.sender(), "Transaction sender address in given RLP not matching the Transaction 'vrs' signature!"); - BOOST_CHECK_MESSAGE(txFromFields == txFromRlp, "However, txFromFields != txFromRlp!"); - BOOST_REQUIRE (o.count("sender") > 0); + TBOOST_CHECK_MESSAGE((txFromFields.data() == txFromRlp.data()), "Data in given RLP not matching the Transaction data!"); + TBOOST_CHECK_MESSAGE((txFromFields.value() == txFromRlp.value()), "Value in given RLP not matching the Transaction value!"); + TBOOST_CHECK_MESSAGE((txFromFields.gasPrice() == txFromRlp.gasPrice()), "GasPrice in given RLP not matching the Transaction gasPrice!"); + TBOOST_CHECK_MESSAGE((txFromFields.gas() == txFromRlp.gas()),"Gas in given RLP not matching the Transaction gas!"); + TBOOST_CHECK_MESSAGE((txFromFields.nonce() == txFromRlp.nonce()),"Nonce in given RLP not matching the Transaction nonce!"); + TBOOST_CHECK_MESSAGE((txFromFields.receiveAddress() == txFromRlp.receiveAddress()), "Receive address in given RLP not matching the Transaction 'to' address!"); + TBOOST_CHECK_MESSAGE((txFromFields.sender() == txFromRlp.sender()), "Transaction sender address in given RLP not matching the Transaction 'vrs' signature!"); + TBOOST_CHECK_MESSAGE((txFromFields == txFromRlp), "However, txFromFields != txFromRlp!"); + TBOOST_REQUIRE ((o.count("sender") > 0)); Address addressReaded = Address(o["sender"].get_str()); - BOOST_CHECK_MESSAGE(txFromFields.sender() == addressReaded || txFromRlp.sender() == addressReaded, "Signature address of sender does not match given sender address!"); + TBOOST_CHECK_MESSAGE((txFromFields.sender() == addressReaded || txFromRlp.sender() == addressReaded), "Signature address of sender does not match given sender address!"); } }//for }//doTransactionTests From ec0e65d339f9f7d219a6b29b5c6a72c2ab6d922a Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 3 Jun 2015 19:36:41 +0300 Subject: [PATCH 083/169] Random code: Exceptions and outut --- test/TestHelper.h | 8 ++++---- test/fuzzTesting/createRandomTest.cpp | 25 +++++++++++++++++++++---- 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/test/TestHelper.h b/test/TestHelper.h index eaeed619a..649d4adf1 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -33,10 +33,10 @@ #define DONTUSE_BOOST_MACROS #ifdef DONTUSE_BOOST_MACROS - #define TBOOST_THROW_EXCEPTION(arg) throw; - #define TBOOST_REQUIRE(arg) if(arg == false) throw; - #define TBOOST_CHECK_MESSAGE(arg1, arg2) if(arg1 == false) throw; - #define TBOOST_WARN_MESSAGE(arg1, arg2) throw; + #define TBOOST_THROW_EXCEPTION(arg) throw dev::Exception(); + #define TBOOST_REQUIRE(arg) if(arg == false) throw dev::Exception(); + #define TBOOST_CHECK_MESSAGE(arg1, arg2) if(arg1 == false) throw dev::Exception(); + #define TBOOST_WARN_MESSAGE(arg1, arg2) throw dev::Exception(); #else #define TBOOST_THROW_EXCEPTION(arg) BOOST_THROW_EXCEPTION(arg) #define TBOOST_REQUIRE(arg) BOOST_REQUIRE(arg) diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index 92fd21b76..2177902d6 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -63,11 +63,28 @@ int main(int argc, char *argv[]) void randomTransactionTest() { - std::string newTest = c_testExampleTransactionTest; - parseTestWithTypes(newTest); + //redirect all output to the stream + std::ostringstream strCout; + std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); + std::cout.rdbuf( strCout.rdbuf() ); + std::cerr.rdbuf( strCout.rdbuf() ); + json_spirit::mValue v; - json_spirit::read_string(newTest, v); - dev::test::doTransactionTests(v, true); + try + { + std::string newTest = c_testExampleTransactionTest; + parseTestWithTypes(newTest); + json_spirit::read_string(newTest, v); + dev::test::doTransactionTests(v, true); + } + catch(...) + { + std::cerr << "Test fill exception!"; + } + + //restroe output + std::cout.rdbuf(oldCoutStreamBuf); + std::cerr.rdbuf(oldCoutStreamBuf); std::cout << json_spirit::write_string(v, true); } From b72edc27d039445b5ea2603b6ff8d94d4aa4d495 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 5 Jun 2015 15:35:21 +0300 Subject: [PATCH 084/169] createRandomTest: State test --- test/TestHelper.cpp | 14 +-- test/TestHelper.h | 1 + test/fuzzTesting/CMakeLists.txt | 2 +- test/fuzzTesting/createRandomTest.cpp | 119 ++++++++++++++++++++------ test/fuzzTesting/fuzzHelper.cpp | 7 +- test/fuzzTesting/fuzzHelper.h | 6 +- test/libethereum/state.cpp | 14 +-- 7 files changed, 118 insertions(+), 45 deletions(-) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index bca0528ff..0e43d278b 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -178,7 +178,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state, stateOptio { stateOptions.m_bHasBalance = true; if (bigint(o["balance"].get_str()) >= c_max256plus1) - BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'balance' is equal or greater than 2**256") ); + TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'balance' is equal or greater than 2**256") ); balance = toInt(o["balance"]); } @@ -186,7 +186,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state, stateOptio { stateOptions.m_bHasNonce = true; if (bigint(o["nonce"].get_str()) >= c_max256plus1) - BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'nonce' is equal or greater than 2**256") ); + TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'nonce' is equal or greater than 2**256") ); nonce = toInt(o["nonce"]); } @@ -230,7 +230,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state) { //check that every parameter was declared in state object if (!stateOptionMap.second.isAllSet()) - BOOST_THROW_EXCEPTION(MissingFields() << errinfo_comment("Import State: Missing state fields!")); + TBOOST_THROW_EXCEPTION(MissingFields() << errinfo_comment("Import State: Missing state fields!")); } } @@ -246,13 +246,13 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) assert(_o.count("data") > 0); if (bigint(_o["nonce"].get_str()) >= c_max256plus1) - BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); + TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); if (bigint(_o["gasPrice"].get_str()) >= c_max256plus1) - BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); + TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); if (bigint(_o["gasLimit"].get_str()) >= c_max256plus1) - BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); + TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); if (bigint(_o["value"].get_str()) >= c_max256plus1) - BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") ); + TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") ); m_transaction = _o["to"].get_str().empty() ? Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str())) : diff --git a/test/TestHelper.h b/test/TestHelper.h index 649d4adf1..df74c2dc3 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -178,6 +178,7 @@ json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn); //Fill Test Functions void doTransactionTests(json_spirit::mValue& _v, bool _fillin); +void doStateTests(json_spirit::mValue& v, bool _fillin); template void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) diff --git a/test/fuzzTesting/CMakeLists.txt b/test/fuzzTesting/CMakeLists.txt index 4024b7956..f25a2b31e 100644 --- a/test/fuzzTesting/CMakeLists.txt +++ b/test/fuzzTesting/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories(${Boost_INCLUDE_DIRS}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) -add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp") +add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp" "../libethereum/state.cpp") add_executable(createRandomVMTest "./createRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp") add_executable(createRandomStateTest "./createRandomStateTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp") add_executable(checkRandomVMTest "./checkRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp" ) diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index 2177902d6..373207f44 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -25,12 +25,16 @@ #include #include - +//String Variables +extern std::string const c_testExampleStateTest; extern std::string const c_testExampleTransactionTest; + +//Main Test functinos +void fillRandomTest(std::function doTests, std::string const& testString); + +//Helper Functions std::vector getTypes(); void parseTestWithTypes(std::string& test); -void randomTransactionTest(); -void randomBlockChainTest(); int main(int argc, char *argv[]) { @@ -44,7 +48,7 @@ int main(int argc, char *argv[]) if (arg == "-t" && i + 1 < argc) { testSuite = argv[i + 1]; - if (testSuite != "BlockChainTests" && testSuite != "TransactionTests") + if (testSuite != "BlockChainTests" && testSuite != "TransactionTests" && testSuite != "StateTests") testSuite = ""; } } @@ -53,15 +57,18 @@ int main(int argc, char *argv[]) std::cout << "Error! Test suite not supported! (Usage -t TestSuite)"; else if (testSuite == "BlockChainTests") - randomBlockChainTest(); + fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); else if (testSuite == "TransactionTests") - randomTransactionTest(); + fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); + else + if (testSuite == "StateTests") + fillRandomTest(dev::test::doStateTests, c_testExampleStateTest); return 0; } -void randomTransactionTest() +void fillRandomTest(std::function doTests, std::string const& testString) { //redirect all output to the stream std::ostringstream strCout; @@ -72,10 +79,10 @@ void randomTransactionTest() json_spirit::mValue v; try { - std::string newTest = c_testExampleTransactionTest; + std::string newTest = testString; parseTestWithTypes(newTest); json_spirit::read_string(newTest, v); - dev::test::doTransactionTests(v, true); + doTests(v, true); } catch(...) { @@ -88,55 +95,67 @@ void randomTransactionTest() std::cout << json_spirit::write_string(v, true); } -void randomBlockChainTest() -{ - -} - /// Parse Test string replacing keywords to fuzzed values -void parseTestWithTypes(std::string& test) +void parseTestWithTypes(std::string& _test) { + dev::test::RandomCodeOptions options; + options.setWeight(dev::eth::Instruction::STOP, 10); //default 50 + options.setWeight(dev::eth::Instruction::SSTORE, 70); + options.setWeight(dev::eth::Instruction::CALL, 75); + options.addAddress(dev::Address("0xffffffffffffffffffffffffffffffffffffffff")); + options.addAddress(dev::Address("0x1000000000000000000000000000000000000000")); + options.addAddress(dev::Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87")); + options.addAddress(dev::Address("0x945304eb96065b2a98b57a48a06ae28d285a71b5")); + options.addAddress(dev::Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")); + options.addAddress(dev::Address("0x0000000000000000000000000000000000000001")); + options.addAddress(dev::Address("0x0000000000000000000000000000000000000002")); + options.addAddress(dev::Address("0x0000000000000000000000000000000000000003")); + options.addAddress(dev::Address("0x0000000000000000000000000000000000000004")); + options.smartCodeProbability = 35; + std::vector types = getTypes(); for (unsigned i = 0; i < types.size(); i++) { - std::size_t pos = test.find(types.at(i)); + std::size_t pos = _test.find(types.at(i)); while (pos != std::string::npos) { if (types.at(i) == "[CODE]") - test.replace(pos, 6, "0x"+dev::test::RandomCode::generate(10)); + _test.replace(pos, 6, "0x"+dev::test::RandomCode::generate(10, options)); else if (types.at(i) == "[HEX]") - test.replace(pos, 5, dev::test::RandomCode::randomUniIntHex()); + _test.replace(pos, 5, dev::test::RandomCode::randomUniIntHex()); else if (types.at(i) == "[HASH20]") - test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(20)); + _test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(20)); else if (types.at(i) == "[0xHASH32]") - test.replace(pos, 10, "0x" + dev::test::RandomCode::rndByteSequence(32)); + _test.replace(pos, 10, "0x" + dev::test::RandomCode::rndByteSequence(32)); + else + if (types.at(i) == "[HASH32]") + _test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(32)); else if (types.at(i) == "[V]") { int random = dev::test::RandomCode::randomUniInt() % 100; if (random < 30) - test.replace(pos, 3, "28"); + _test.replace(pos, 3, "28"); else if (random < 60) - test.replace(pos, 3, "29"); + _test.replace(pos, 3, "29"); else - test.replace(pos, 3, "0x" + dev::test::RandomCode::rndByteSequence(1)); + _test.replace(pos, 3, "0x" + dev::test::RandomCode::rndByteSequence(1)); } - pos = test.find(types.at(i)); + pos = _test.find(types.at(i)); } } } std::vector getTypes() { - return {"[CODE]", "[HEX]", "[HASH20]", "[0xHASH32]", "[V]"}; + return {"[CODE]", "[HEX]", "[HASH20]", "[HASH32]", "[0xHASH32]", "[V]"}; } - std::string const c_testExampleTransactionTest = R"( { "TransactionTest" : { @@ -156,5 +175,49 @@ std::string const c_testExampleTransactionTest = R"( } )"; - - +std::string const c_testExampleStateTest = R"( +{ + "randomStatetest" : { + "env" : { + "currentCoinbase" : "[HASH20]", + "currentDifficulty" : "[HEX]", + "currentGasLimit" : "[HEX]", + "currentNumber" : "[HEX]", + "currentTimestamp" : "[HEX]", + "previousHash" : "[HASH32]" + }, + "pre" : { + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "[HEX]", + "code" : "[CODE]", + "nonce" : "[V]", + "storage" : { + } + }, + "945304eb96065b2a98b57a48a06ae28d285a71b5" : { + "balance" : "[HEX]", + "code" : "[CODE]", + "nonce" : "[V]", + "storage" : { + } + }, + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "[HEX]", + "code" : "0x", + "nonce" : "0", + "storage" : { + } + } + }, + "transaction" : { + "data" : "[CODE]", + "gasLimit" : "[HEX]", + "gasPrice" : "[V]", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "[HEX]" + } + } +} +)"; diff --git a/test/fuzzTesting/fuzzHelper.cpp b/test/fuzzTesting/fuzzHelper.cpp index 3b6cf19c9..1f09ca9fa 100644 --- a/test/fuzzTesting/fuzzHelper.cpp +++ b/test/fuzzTesting/fuzzHelper.cpp @@ -35,10 +35,12 @@ boost::random::mt19937 RandomCode::gen; boostIntDistrib RandomCode::opCodeDist = boostIntDistrib (0, 255); boostIntDistrib RandomCode::opLengDist = boostIntDistrib (1, 32); boostIntDistrib RandomCode::uniIntDist = boostIntDistrib (0, 0x7fffffff); +boostUint64Distrib RandomCode::uInt64Dist = boostUint64Distrib (0, std::numeric_limits::max()); boostIntGenerator RandomCode::randOpCodeGen = boostIntGenerator(gen, opCodeDist); boostIntGenerator RandomCode::randOpLengGen = boostIntGenerator(gen, opLengDist); boostIntGenerator RandomCode::randUniIntGen = boostIntGenerator(gen, uniIntDist); +boostUInt64Generator RandomCode::randUInt64Gen = boostUInt64Generator(gen, uInt64Dist); std::string RandomCode::rndByteSequence(int _length, SizeStrictness _sizeType) { @@ -92,7 +94,10 @@ std::string RandomCode::generate(int _maxOpNumber, RandomCodeOptions _options) std::string RandomCode::randomUniIntHex() { refreshSeed(); - return "0x" + toCompactHex((int)randUniIntGen()); + int rand = randUniIntGen() % 100; + if (rand < 50) + return "0x" + toCompactHex((u256)randUniIntGen()); + return "0x" + toCompactHex((u256)randUInt64Gen()); } int RandomCode::randomUniInt() diff --git a/test/fuzzTesting/fuzzHelper.h b/test/fuzzTesting/fuzzHelper.h index 371e40fbf..6a46bbeaf 100644 --- a/test/fuzzTesting/fuzzHelper.h +++ b/test/fuzzTesting/fuzzHelper.h @@ -37,9 +37,11 @@ namespace test typedef boost::random::uniform_int_distribution<> boostIntDistrib; typedef boost::random::discrete_distribution<> boostDescreteDistrib; +typedef boost::uniform_int boostUint64Distrib; typedef boost::random::variate_generator boostIntGenerator; typedef boost::random::variate_generator boostWeightGenerator; +typedef boost::random::variate_generator boostUInt64Generator; struct RandomCodeOptions { @@ -73,7 +75,7 @@ public: /// Generate random byte string of a given length static std::string rndByteSequence(int _length = 1, SizeStrictness _sizeType = SizeStrictness::Strict); - /// Generate random uniForm Int with reasonable value 0..0x7fffffff + /// Generate random int64 static std::string randomUniIntHex(); static int randomUniInt(); @@ -87,10 +89,12 @@ private: static boostIntDistrib opCodeDist; ///< 0..255 opcodes static boostIntDistrib opLengDist; ///< 1..32 byte string static boostIntDistrib uniIntDist; ///< 0..0x7fffffff + static boostUint64Distrib uInt64Dist; ///< 0..2**64 static boostIntGenerator randUniIntGen; ///< Generate random UniformInt from uniIntDist static boostIntGenerator randOpCodeGen; ///< Generate random value from opCodeDist static boostIntGenerator randOpLengGen; ///< Generate random length from opLengDist + static boostUInt64Generator randUInt64Gen; ///< Generate random uInt64 }; } diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index 632e7982b..492bfb746 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -51,9 +51,9 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) } std::cout << " " << i.first << std::endl; - BOOST_REQUIRE(o.count("env") > 0); - BOOST_REQUIRE(o.count("pre") > 0); - BOOST_REQUIRE(o.count("transaction") > 0); + TBOOST_REQUIRE((o.count("env") > 0)); + TBOOST_REQUIRE((o.count("pre") > 0)); + TBOOST_REQUIRE((o.count("transaction") > 0)); ImportTest importer(o, _fillin); @@ -80,13 +80,13 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) #if ETH_FATDB importer.exportTest(output, theState); #else - BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("You can not fill tests when FATDB is switched off")); + TBOOST_THROW_EXCEPTION(Exception() << errinfo_comment("You can not fill tests when FATDB is switched off")); #endif } else { - BOOST_REQUIRE(o.count("post") > 0); - BOOST_REQUIRE(o.count("out") > 0); + TBOOST_REQUIRE((o.count("post") > 0)); + TBOOST_REQUIRE((o.count("out") > 0)); // check output checkOutput(output, o); @@ -101,7 +101,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) auto resultAddrs = theState.addresses(); checkAddresses(expectedAddrs, resultAddrs); #endif - BOOST_CHECK_MESSAGE(theState.rootHash() == h256(o["postStateRoot"].get_str()), "wrong post state root"); + TBOOST_CHECK_MESSAGE((theState.rootHash() == h256(o["postStateRoot"].get_str())), "wrong post state root"); } } } From 76a72769f408df1cb3c10a37b3fc200191d19d11 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Fri, 5 Jun 2015 21:43:41 +0300 Subject: [PATCH 085/169] FuzzTesting: VMTests + TransactionTests support --- test/TestHelper.cpp | 33 ++++--- test/TestHelper.h | 13 ++- test/fuzzTesting/CMakeLists.txt | 3 +- test/fuzzTesting/createRandomTest.cpp | 126 ++++++++++++++++++++++++-- test/libevm/vm.cpp | 26 +++--- 5 files changed, 162 insertions(+), 39 deletions(-) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 0e43d278b..743b16273 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -285,9 +285,9 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta #define CHECK(a,b) \ { \ if (_throw == WhenError::Throw) \ - BOOST_CHECK_MESSAGE(a,b); \ + {TBOOST_CHECK_MESSAGE(a,b);}\ else \ - BOOST_WARN_MESSAGE(a,b); \ + {TBOOST_WARN_MESSAGE(a,b);} \ } for (auto const& a: _stateExpect.addresses()) @@ -304,35 +304,35 @@ void ImportTest::checkExpectedState(State const& _stateExpect, State const& _sta } catch(std::out_of_range const&) { - BOOST_ERROR("expectedStateOptions map does not match expectedState in checkExpectedState!"); + TBOOST_ERROR("expectedStateOptions map does not match expectedState in checkExpectedState!"); break; } } if (addressOptions.m_bHasBalance) - CHECK(_stateExpect.balance(a.first) == _statePost.balance(a.first), + CHECK((_stateExpect.balance(a.first) == _statePost.balance(a.first)), "Check State: " << a.first << ": incorrect balance " << _statePost.balance(a.first) << ", expected " << _stateExpect.balance(a.first)); if (addressOptions.m_bHasNonce) - CHECK(_stateExpect.transactionsFrom(a.first) == _statePost.transactionsFrom(a.first), + CHECK((_stateExpect.transactionsFrom(a.first) == _statePost.transactionsFrom(a.first)), "Check State: " << a.first << ": incorrect nonce " << _statePost.transactionsFrom(a.first) << ", expected " << _stateExpect.transactionsFrom(a.first)); if (addressOptions.m_bHasStorage) { unordered_map stateStorage = _statePost.storage(a.first); for (auto const& s: _stateExpect.storage(a.first)) - CHECK(stateStorage[s.first] == s.second, + CHECK((stateStorage[s.first] == s.second), "Check State: " << a.first << ": incorrect storage [" << s.first << "] = " << toHex(stateStorage[s.first]) << ", expected [" << s.first << "] = " << toHex(s.second)); //Check for unexpected storage values stateStorage = _stateExpect.storage(a.first); for (auto const& s: _statePost.storage(a.first)) - CHECK(stateStorage[s.first] == s.second, + CHECK((stateStorage[s.first] == s.second), "Check State: " << a.first << ": incorrect storage [" << s.first << "] = " << toHex(s.second) << ", expected [" << s.first << "] = " << toHex(stateStorage[s.first])); } if (addressOptions.m_bHasCode) - CHECK(_stateExpect.code(a.first) == _statePost.code(a.first), + CHECK((_stateExpect.code(a.first) == _statePost.code(a.first)), "Check State: " << a.first << ": incorrect code '" << toHex(_statePost.code(a.first)) << "', expected '" << toHex(_stateExpect.code(a.first)) << "'"); } } @@ -518,18 +518,17 @@ void checkOutput(bytes const& _output, json_spirit::mObject& _o) int j = 0; if (_o["out"].get_str().find("#") == 0) - BOOST_CHECK((u256)_output.size() == toInt(_o["out"].get_str().substr(1))); - + {TBOOST_CHECK(((u256)_output.size() == toInt(_o["out"].get_str().substr(1))));} else if (_o["out"].type() == json_spirit::array_type) for (auto const& d: _o["out"].get_array()) { - BOOST_CHECK_MESSAGE(_output[j] == toInt(d), "Output byte [" << j << "] different!"); + TBOOST_CHECK_MESSAGE((_output[j] == toInt(d)), "Output byte [" << j << "] different!"); ++j; } else if (_o["out"].get_str().find("0x") == 0) - BOOST_CHECK(_output == fromHex(_o["out"].get_str().substr(2))); + {TBOOST_CHECK((_output == fromHex(_o["out"].get_str().substr(2))));} else - BOOST_CHECK(_output == fromHex(_o["out"].get_str())); + TBOOST_CHECK((_output == fromHex(_o["out"].get_str()))); } void checkStorage(map _expectedStore, map _resultStore, Address _expectedAddr) @@ -557,13 +556,13 @@ void checkStorage(map _expectedStore, map _resultStore, void checkLog(LogEntries _resultLogs, LogEntries _expectedLogs) { - BOOST_REQUIRE_EQUAL(_resultLogs.size(), _expectedLogs.size()); + TBOOST_REQUIRE_EQUAL(_resultLogs.size(), _expectedLogs.size()); for (size_t i = 0; i < _resultLogs.size(); ++i) { - BOOST_CHECK_EQUAL(_resultLogs[i].address, _expectedLogs[i].address); - BOOST_CHECK_EQUAL(_resultLogs[i].topics, _expectedLogs[i].topics); - BOOST_CHECK(_resultLogs[i].data == _expectedLogs[i].data); + TBOOST_CHECK_EQUAL(_resultLogs[i].address, _expectedLogs[i].address); + TBOOST_CHECK_EQUAL(_resultLogs[i].topics, _expectedLogs[i].topics); + TBOOST_CHECK((_resultLogs[i].data == _expectedLogs[i].data)); } } diff --git a/test/TestHelper.h b/test/TestHelper.h index df74c2dc3..b1ad923a7 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -35,13 +35,21 @@ #ifdef DONTUSE_BOOST_MACROS #define TBOOST_THROW_EXCEPTION(arg) throw dev::Exception(); #define TBOOST_REQUIRE(arg) if(arg == false) throw dev::Exception(); + #define TBOOST_REQUIRE_EQUAL(arg1, arg2) if(arg1 != arg2) throw dev::Exception(); + #define TBOOST_CHECK_EQUAL(arg1, arg2) if(arg1 != arg2) throw dev::Exception(); + #define TBOOST_CHECK(arg) if(arg == false) throw dev::Exception(); #define TBOOST_CHECK_MESSAGE(arg1, arg2) if(arg1 == false) throw dev::Exception(); #define TBOOST_WARN_MESSAGE(arg1, arg2) throw dev::Exception(); + #define TBOOST_ERROR(arg) throw dev::Exception(); #else #define TBOOST_THROW_EXCEPTION(arg) BOOST_THROW_EXCEPTION(arg) #define TBOOST_REQUIRE(arg) BOOST_REQUIRE(arg) + #define TBOOST_REQUIRE_EQUAL(arg1, arg2) BOOST_REQUIRE_EQUAL(arg1, arg2) + #define TBOOST_CHECK(arg) BOOOST_CHECK(arg) + #define TBOOST_CHECK_EQUAL(arg1, arg2) BOOST_CHECK_EQUAL(arg1, arg2) #define TBOOST_CHECK_MESSAGE(arg1, arg2) BOOST_CHECK_MESSAGE(arg1, arg2) #define TBOOST_WARN_MESSAGE(arg1, arg2) BOOST_WARN_MESSAGE(arg1, arg2) + #define TBOOST_ERROR(arg) BOOST_ERROR(arg) #endif namespace dev @@ -179,6 +187,7 @@ json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn); //Fill Test Functions void doTransactionTests(json_spirit::mValue& _v, bool _fillin); void doStateTests(json_spirit::mValue& v, bool _fillin); +void doVMTests(json_spirit::mValue& v, bool _fillin); template void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) @@ -188,9 +197,9 @@ void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) auto& resultAddr = resultPair.first; auto expectedAddrIt = _expectedAddrs.find(resultAddr); if (expectedAddrIt == _expectedAddrs.end()) - BOOST_ERROR("Missing result address " << resultAddr); + TBOOST_ERROR("Missing result address " << resultAddr); } - BOOST_CHECK(_expectedAddrs == _resultAddrs); + TBOOST_CHECK((_expectedAddrs == _resultAddrs)); } class Options diff --git a/test/fuzzTesting/CMakeLists.txt b/test/fuzzTesting/CMakeLists.txt index f25a2b31e..9cdc7eb60 100644 --- a/test/fuzzTesting/CMakeLists.txt +++ b/test/fuzzTesting/CMakeLists.txt @@ -8,7 +8,8 @@ include_directories(${Boost_INCLUDE_DIRS}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) -add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp" "../libethereum/state.cpp") +add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp" "../libethereum/state.cpp" "../libevm/vm.cpp") + add_executable(createRandomVMTest "./createRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp") add_executable(createRandomStateTest "./createRandomStateTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp") add_executable(checkRandomVMTest "./checkRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp" ) diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index 373207f44..a42ead3ef 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -19,18 +19,23 @@ * @date 2015 */ +///This file require #define DONTUSE_BOOST_MACROS compile flag to run! + #include #include #include #include +#include //String Variables extern std::string const c_testExampleStateTest; extern std::string const c_testExampleTransactionTest; +extern std::string const c_testExampleVMTest; //Main Test functinos void fillRandomTest(std::function doTests, std::string const& testString); +int checkRandomTest(std::function doTests, json_spirit::mValue& value); //Helper Functions std::vector getTypes(); @@ -39,35 +44,111 @@ void parseTestWithTypes(std::string& test); int main(int argc, char *argv[]) { std::string testSuite; + json_spirit::mValue testValue; + bool checktest = false; for (auto i = 0; i < argc; ++i) { auto arg = std::string{argv[i]}; dev::test::Options& options = const_cast(dev::test::Options::get()); if (arg == "--fulloutput") options.fulloutput = true; + else if (arg == "-t" && i + 1 < argc) { testSuite = argv[i + 1]; - if (testSuite != "BlockChainTests" && testSuite != "TransactionTests" && testSuite != "StateTests") + if (testSuite != "BlockChainTests" && testSuite != "TransactionTests" && testSuite != "StateTests" && testSuite != "VMTests") testSuite = ""; } + else + if (arg == "-checktest" && i + 1 < argc) + { + std::string s; + for (int j = i+1; j < argc; ++j) + s += argv[j]; + if (asserts(s.length() > 0)) + { + std::cout << "Error! Content of argument is empty! (Usage -checktest textstream) \n"; + return 1; + } + read_string(s, testValue); + checktest = true; + } } if (testSuite == "") + { std::cout << "Error! Test suite not supported! (Usage -t TestSuite)"; + return 1; + } else if (testSuite == "BlockChainTests") - fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); + { + if (checktest) + return checkRandomTest(dev::test::doTransactionTests, testValue); + else + fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); + } else if (testSuite == "TransactionTests") - fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); + { + if (checktest) + return checkRandomTest(dev::test::doTransactionTests, testValue); + else + fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); + } else if (testSuite == "StateTests") - fillRandomTest(dev::test::doStateTests, c_testExampleStateTest); + { + if (checktest) + return checkRandomTest(dev::test::doStateTests, testValue); + else + fillRandomTest(dev::test::doStateTests, c_testExampleStateTest); + } + else + if (testSuite == "VMTests") + { + if (checktest) + { + dev::eth::VMFactory::setKind(dev::eth::VMKind::JIT); + return checkRandomTest(dev::test::doVMTests, testValue); + } + else + fillRandomTest(dev::test::doVMTests, c_testExampleVMTest); + } return 0; } +int checkRandomTest(std::function doTests, json_spirit::mValue& value) +{ + bool ret = 0; + try + { + //redirect all output to the stream + std::ostringstream strCout; + std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); + std::cout.rdbuf( strCout.rdbuf() ); + std::cerr.rdbuf( strCout.rdbuf() ); + + doTests(value, false); + + //restroe output + std::cout.rdbuf(oldCoutStreamBuf); + std::cerr.rdbuf(oldCoutStreamBuf); + } + catch (dev::Exception const& _e) + { + std::cout << "Failed test with Exception: " << diagnostic_information(_e) << std::endl; + ret = 1; + } + catch (std::exception const& _e) + { + std::cout << "Failed test with Exception: " << _e.what() << std::endl; + ret = 1; + } + return ret; +} + void fillRandomTest(std::function doTests, std::string const& testString) { //redirect all output to the stream @@ -107,6 +188,7 @@ void parseTestWithTypes(std::string& _test) options.addAddress(dev::Address("0x095e7baea6a6c7c4c2dfeb977efac326af552d87")); options.addAddress(dev::Address("0x945304eb96065b2a98b57a48a06ae28d285a71b5")); options.addAddress(dev::Address("0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b")); + options.addAddress(dev::Address("0x0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6")); options.addAddress(dev::Address("0x0000000000000000000000000000000000000001")); options.addAddress(dev::Address("0x0000000000000000000000000000000000000002")); options.addAddress(dev::Address("0x0000000000000000000000000000000000000003")); @@ -138,10 +220,10 @@ void parseTestWithTypes(std::string& _test) { int random = dev::test::RandomCode::randomUniInt() % 100; if (random < 30) - _test.replace(pos, 3, "28"); + _test.replace(pos, 3, "0x1c"); else if (random < 60) - _test.replace(pos, 3, "29"); + _test.replace(pos, 3, "0x1d"); else _test.replace(pos, 3, "0x" + dev::test::RandomCode::rndByteSequence(1)); } @@ -221,3 +303,35 @@ std::string const c_testExampleStateTest = R"( } } )"; + +std::string const c_testExampleVMTest = R"( +{ + "randomVMTest": { + "env" : { + "previousHash" : "[HASH32]", + "currentNumber" : "[HEX]", + "currentGasLimit" : "[HEX]", + "currentDifficulty" : "[HEX]", + "currentTimestamp" : "[HEX]", + "currentCoinbase" : "[HASH20]" + }, + "pre" : { + "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6" : { + "balance" : "[HEX]", + "nonce" : "[HEX]", + "code" : "[CODE]", + "storage": {} + } + }, + "exec" : { + "address" : "0f572e5295c57f15886f9b263e2f6d2d6c7b5ec6", + "origin" : "[HASH20]", + "caller" : "[HASH20]", + "value" : "[HEX]", + "data" : "[CODE]", + "gasPrice" : "[V]", + "gas" : "[HEX]" + } + } +} +)"; diff --git a/test/libevm/vm.cpp b/test/libevm/vm.cpp index ea9339f05..25ed8113b 100644 --- a/test/libevm/vm.cpp +++ b/test/libevm/vm.cpp @@ -306,9 +306,9 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) } std::cout << " " << i.first << "\n"; - BOOST_REQUIRE(o.count("env") > 0); - BOOST_REQUIRE(o.count("pre") > 0); - BOOST_REQUIRE(o.count("exec") > 0); + TBOOST_REQUIRE((o.count("env") > 0)); + TBOOST_REQUIRE((o.count("pre") > 0)); + TBOOST_REQUIRE((o.count("exec") > 0)); FakeExtVM fev; fev.importEnv(o["env"].get_obj()); @@ -344,12 +344,12 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) catch (Exception const& _e) { cnote << "VM did throw an exception: " << diagnostic_information(_e); - BOOST_ERROR("Failed VM Test with Exception: " << _e.what()); + TBOOST_ERROR("Failed VM Test with Exception: " << _e.what()); } catch (std::exception const& _e) { cnote << "VM did throw an exception: " << _e.what(); - BOOST_ERROR("Failed VM Test with Exception: " << _e.what()); + TBOOST_ERROR("Failed VM Test with Exception: " << _e.what()); } // delete null entries in storage for the sake of comparison @@ -410,13 +410,13 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) { if (o.count("post") > 0) // No exceptions expected { - BOOST_CHECK(!vmExceptionOccured); + TBOOST_CHECK(!vmExceptionOccured); - BOOST_REQUIRE(o.count("post") > 0); - BOOST_REQUIRE(o.count("callcreates") > 0); - BOOST_REQUIRE(o.count("out") > 0); - BOOST_REQUIRE(o.count("gas") > 0); - BOOST_REQUIRE(o.count("logs") > 0); + TBOOST_REQUIRE((o.count("post") > 0)); + TBOOST_REQUIRE((o.count("callcreates") > 0)); + TBOOST_REQUIRE((o.count("out") > 0)); + TBOOST_REQUIRE((o.count("gas") > 0)); + TBOOST_REQUIRE((o.count("logs") > 0)); dev::test::FakeExtVM test; test.importState(o["post"].get_obj()); @@ -425,7 +425,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) checkOutput(output, o); - BOOST_CHECK_EQUAL(toInt(o["gas"]), fev.gas); + TBOOST_CHECK_EQUAL(toInt(o["gas"]), fev.gas); State postState, expectState; mObject mPostState = fev.exportState(); @@ -435,7 +435,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) checkAddresses, bytes> > >(test.addresses, fev.addresses); - checkCallCreates(test.callcreates, fev.callcreates); + checkCallCreates(fev.callcreates, test.callcreates); checkLog(fev.sub.logs, test.sub.logs); } From 5a0f9900677742447e448ab4c7f8112425e262b8 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Tue, 9 Jun 2015 18:52:18 +0300 Subject: [PATCH 086/169] Fuzz Tests update --- test/TestHelper.h | 2 +- test/fuzzTesting/fuzzHelper.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/TestHelper.h b/test/TestHelper.h index b1ad923a7..c97d4c017 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -45,7 +45,7 @@ #define TBOOST_THROW_EXCEPTION(arg) BOOST_THROW_EXCEPTION(arg) #define TBOOST_REQUIRE(arg) BOOST_REQUIRE(arg) #define TBOOST_REQUIRE_EQUAL(arg1, arg2) BOOST_REQUIRE_EQUAL(arg1, arg2) - #define TBOOST_CHECK(arg) BOOOST_CHECK(arg) + #define TBOOST_CHECK(arg) BOOST_CHECK(arg) #define TBOOST_CHECK_EQUAL(arg1, arg2) BOOST_CHECK_EQUAL(arg1, arg2) #define TBOOST_CHECK_MESSAGE(arg1, arg2) BOOST_CHECK_MESSAGE(arg1, arg2) #define TBOOST_WARN_MESSAGE(arg1, arg2) BOOST_WARN_MESSAGE(arg1, arg2) diff --git a/test/fuzzTesting/fuzzHelper.cpp b/test/fuzzTesting/fuzzHelper.cpp index 1f09ca9fa..60d93caf0 100644 --- a/test/fuzzTesting/fuzzHelper.cpp +++ b/test/fuzzTesting/fuzzHelper.cpp @@ -50,7 +50,7 @@ std::string RandomCode::rndByteSequence(int _length, SizeStrictness _sizeType) for (auto i = 0; i < _length; i++) { uint8_t byte = randOpCodeGen(); - hash += toCompactHex(byte); + hash += toCompactHex(byte, HexPrefix::DontAdd, 1); } return hash; } From 7db380d341e3edfa6db009362659f9a10f0f51eb Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 17 Jun 2015 17:01:25 +0300 Subject: [PATCH 087/169] FuzzTests: blocktests (before merge) --- test/TestHelper.h | 1 + test/fuzzTesting/CMakeLists.txt | 2 +- test/fuzzTesting/createRandomTest.cpp | 93 +++++++++++++++---- test/fuzzTesting/fuzzHelper.cpp | 8 +- test/fuzzTesting/fuzzHelper.h | 2 +- test/libethereum/blockchain.cpp | 128 +++++++++++++------------- 6 files changed, 149 insertions(+), 85 deletions(-) diff --git a/test/TestHelper.h b/test/TestHelper.h index c97d4c017..42f85a82c 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -188,6 +188,7 @@ json_spirit::mObject fillJsonWithTransaction(eth::Transaction _txn); void doTransactionTests(json_spirit::mValue& _v, bool _fillin); void doStateTests(json_spirit::mValue& v, bool _fillin); void doVMTests(json_spirit::mValue& v, bool _fillin); +void doBlockchainTests(json_spirit::mValue& _v, bool _fillin); template void checkAddresses(mapType& _expectedAddrs, mapType& _resultAddrs) diff --git a/test/fuzzTesting/CMakeLists.txt b/test/fuzzTesting/CMakeLists.txt index 9cdc7eb60..9bd2b5540 100644 --- a/test/fuzzTesting/CMakeLists.txt +++ b/test/fuzzTesting/CMakeLists.txt @@ -8,7 +8,7 @@ include_directories(${Boost_INCLUDE_DIRS}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) -add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp" "../libethereum/state.cpp" "../libevm/vm.cpp") +add_executable(createRandomTest "./createRandomTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp" "../libethereum/transaction.cpp" "../libethereum/state.cpp" "../libevm/vm.cpp" "../libethereum/blockchain.cpp") add_executable(createRandomVMTest "./createRandomVMTest.cpp" "../libevm/vm.cpp" "../TestHelper.cpp" "../Stats.cpp") add_executable(createRandomStateTest "./createRandomStateTest.cpp" "../TestHelper.cpp" "../Stats.cpp" "fuzzHelper.cpp") diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index a42ead3ef..34f90533f 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -27,11 +27,13 @@ #include #include #include +#include //String Variables extern std::string const c_testExampleStateTest; extern std::string const c_testExampleTransactionTest; extern std::string const c_testExampleVMTest; +extern std::string const c_testExampleBlockchainTest; //Main Test functinos void fillRandomTest(std::function doTests, std::string const& testString); @@ -44,7 +46,7 @@ void parseTestWithTypes(std::string& test); int main(int argc, char *argv[]) { std::string testSuite; - json_spirit::mValue testValue; + json_spirit::mValue testmValue; bool checktest = false; for (auto i = 0; i < argc; ++i) { @@ -70,7 +72,7 @@ int main(int argc, char *argv[]) std::cout << "Error! Content of argument is empty! (Usage -checktest textstream) \n"; return 1; } - read_string(s, testValue); + read_string(s, testmValue); checktest = true; } } @@ -84,15 +86,15 @@ int main(int argc, char *argv[]) if (testSuite == "BlockChainTests") { if (checktest) - return checkRandomTest(dev::test::doTransactionTests, testValue); + return checkRandomTest(dev::test::doBlockchainTests, testmValue); else - fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); + fillRandomTest(dev::test::doBlockchainTests, c_testExampleBlockchainTest); } else if (testSuite == "TransactionTests") { if (checktest) - return checkRandomTest(dev::test::doTransactionTests, testValue); + return checkRandomTest(dev::test::doTransactionTests, testmValue); else fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); } @@ -100,7 +102,7 @@ int main(int argc, char *argv[]) if (testSuite == "StateTests") { if (checktest) - return checkRandomTest(dev::test::doStateTests, testValue); + return checkRandomTest(dev::test::doStateTests, testmValue); else fillRandomTest(dev::test::doStateTests, c_testExampleStateTest); } @@ -110,7 +112,7 @@ int main(int argc, char *argv[]) if (checktest) { dev::eth::VMFactory::setKind(dev::eth::VMKind::JIT); - return checkRandomTest(dev::test::doVMTests, testValue); + return checkRandomTest(dev::test::doVMTests, testmValue); } else fillRandomTest(dev::test::doVMTests, c_testExampleVMTest); @@ -152,16 +154,17 @@ int checkRandomTest(std::function doTests, jso void fillRandomTest(std::function doTests, std::string const& testString) { //redirect all output to the stream - std::ostringstream strCout; - std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); - std::cout.rdbuf( strCout.rdbuf() ); - std::cerr.rdbuf( strCout.rdbuf() ); + //std::ostringstream strCout; + //std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); + //std::cout.rdbuf( strCout.rdbuf() ); + //std::cerr.rdbuf( strCout.rdbuf() ); json_spirit::mValue v; try { std::string newTest = testString; parseTestWithTypes(newTest); + std::cout << newTest; json_spirit::read_string(newTest, v); doTests(v, true); } @@ -171,8 +174,8 @@ void fillRandomTest(std::function doTests, std } //restroe output - std::cout.rdbuf(oldCoutStreamBuf); - std::cerr.rdbuf(oldCoutStreamBuf); + //std::cout.rdbuf(oldCoutStreamBuf); + //std::cerr.rdbuf(oldCoutStreamBuf); std::cout << json_spirit::write_string(v, true); } @@ -207,6 +210,9 @@ void parseTestWithTypes(std::string& _test) if (types.at(i) == "[HEX]") _test.replace(pos, 5, dev::test::RandomCode::randomUniIntHex()); else + if (types.at(i) == "[GASLIMIT]") + _test.replace(pos, 10, dev::test::RandomCode::randomUniIntHex(dev::u256("3000000000"))); + else if (types.at(i) == "[HASH20]") _test.replace(pos, 8, dev::test::RandomCode::rndByteSequence(20)); else @@ -235,7 +241,7 @@ void parseTestWithTypes(std::string& _test) std::vector getTypes() { - return {"[CODE]", "[HEX]", "[HASH20]", "[HASH32]", "[0xHASH32]", "[V]"}; + return {"[CODE]", "[HEX]", "[HASH20]", "[HASH32]", "[0xHASH32]", "[V]", "[GASLIMIT]"}; } std::string const c_testExampleTransactionTest = R"( @@ -263,7 +269,7 @@ std::string const c_testExampleStateTest = R"( "env" : { "currentCoinbase" : "[HASH20]", "currentDifficulty" : "[HEX]", - "currentGasLimit" : "[HEX]", + "currentGasLimit" : "[GASLIMIT]", "currentNumber" : "[HEX]", "currentTimestamp" : "[HEX]", "previousHash" : "[HASH32]" @@ -310,7 +316,7 @@ std::string const c_testExampleVMTest = R"( "env" : { "previousHash" : "[HASH32]", "currentNumber" : "[HEX]", - "currentGasLimit" : "[HEX]", + "currentGasLimit" : "[GASLIMIT]", "currentDifficulty" : "[HEX]", "currentTimestamp" : "[HEX]", "currentCoinbase" : "[HASH20]" @@ -335,3 +341,58 @@ std::string const c_testExampleVMTest = R"( } } )"; + +std::string const c_testExampleBlockchainTest = R"( +{ + "blockTest" : { + "genesisBlockHeader" : { + "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "coinbase" : "[HASH20]", + "difficulty" : "131072", + "extraData" : "[CODE]", + "gasLimit" : "3141592", + "gasUsed" : "0", + "mixHash" : "[0xHASH32]", + "nonce" : "0x0102030405060708", + "number" : "0", + "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000", + "receiptTrie" : "[0xHASH32]", + "stateRoot" : "[0xHASH32]", + "timestamp" : "[HEX]", + "transactionsTrie" : "[0xHASH32]", + "uncleHash" : "[0xHASH32]" + }, + "pre" : { + "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { + "balance" : "[HEX]", + "nonce" : "0", + "code" : "", + "storage": {} + }, + "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { + "balance" : "[HEX]", + "nonce" : "[HEX]", + "code" : "[CODE]", + "storage": {} + } + }, + "blocks" : [ + { + "transactions" : [ + { + "data" : "[CODE]", + "gasLimit" : "[HEX]", + "gasPrice" : "[V]", + "nonce" : "0", + "secretKey" : "45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8", + "to" : "095e7baea6a6c7c4c2dfeb977efac326af552d87", + "value" : "[V]" + } + ], + "uncleHeaders" : [ + ] + } + ] + } +} +)"; diff --git a/test/fuzzTesting/fuzzHelper.cpp b/test/fuzzTesting/fuzzHelper.cpp index 60d93caf0..8e03bd767 100644 --- a/test/fuzzTesting/fuzzHelper.cpp +++ b/test/fuzzTesting/fuzzHelper.cpp @@ -91,13 +91,15 @@ std::string RandomCode::generate(int _maxOpNumber, RandomCodeOptions _options) return code; } -std::string RandomCode::randomUniIntHex() +std::string RandomCode::randomUniIntHex(u256 _maxVal) { + if (_maxVal == 0) + _maxVal = std::numeric_limits::max(); refreshSeed(); int rand = randUniIntGen() % 100; if (rand < 50) - return "0x" + toCompactHex((u256)randUniIntGen()); - return "0x" + toCompactHex((u256)randUInt64Gen()); + return "0x" + toCompactHex((u256)randUniIntGen() % _maxVal); + return "0x" + toCompactHex((u256)randUInt64Gen() % _maxVal); } int RandomCode::randomUniInt() diff --git a/test/fuzzTesting/fuzzHelper.h b/test/fuzzTesting/fuzzHelper.h index 6a46bbeaf..309037e3d 100644 --- a/test/fuzzTesting/fuzzHelper.h +++ b/test/fuzzTesting/fuzzHelper.h @@ -76,7 +76,7 @@ public: static std::string rndByteSequence(int _length = 1, SizeStrictness _sizeType = SizeStrictness::Strict); /// Generate random int64 - static std::string randomUniIntHex(); + static std::string randomUniIntHex(u256 _maxVal = 0); static int randomUniInt(); private: diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 2c4a0b498..88c39442b 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -59,10 +59,10 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } cerr << i.first << endl; - BOOST_REQUIRE(o.count("genesisBlockHeader")); + TBOOST_REQUIRE(o.count("genesisBlockHeader")); BlockInfo biGenesisBlock = constructBlock(o["genesisBlockHeader"].get_obj()); - BOOST_REQUIRE(o.count("pre")); + TBOOST_REQUIRE(o.count("pre")); ImportTest importer(o["pre"].get_obj()); TransientDirectory td_stateDB_tmp; State trueState(OverlayDB(State::openDB(td_stateDB_tmp.path())), BaseState::Empty, biGenesisBlock.coinbaseAddress); @@ -77,7 +77,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (_fillin) biGenesisBlock.stateRoot = trueState.rootHash(); else - BOOST_CHECK_MESSAGE(biGenesisBlock.stateRoot == trueState.rootHash(), "root hash does not match"); + TBOOST_CHECK_MESSAGE((biGenesisBlock.stateRoot == trueState.rootHash()), "root hash does not match"); if (_fillin) { @@ -99,7 +99,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (_fillin) { - BOOST_REQUIRE(o.count("blocks")); + TBOOST_REQUIRE(o.count("blocks")); mArray blArray; blockSet genesis; @@ -145,7 +145,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) // get txs TransactionQueue txs; ZeroGasPricer gp; - BOOST_REQUIRE(blObj.count("transactions")); + TBOOST_REQUIRE(blObj.count("transactions")); for (auto const& txObj: blObj["transactions"].get_array()) { mObject tx = txObj.get_obj(); @@ -337,29 +337,29 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) catch (Exception const& _e) { cnote << "state sync or block import did throw an exception: " << diagnostic_information(_e); - BOOST_CHECK(blObj.count("blockHeader") == 0); - BOOST_CHECK(blObj.count("transactions") == 0); - BOOST_CHECK(blObj.count("uncleHeaders") == 0); + TBOOST_CHECK((blObj.count("blockHeader") == 0)); + TBOOST_CHECK((blObj.count("transactions") == 0)); + TBOOST_CHECK((blObj.count("uncleHeaders") == 0)); continue; } catch (std::exception const& _e) { cnote << "state sync or block import did throw an exception: " << _e.what(); - BOOST_CHECK(blObj.count("blockHeader") == 0); - BOOST_CHECK(blObj.count("transactions") == 0); - BOOST_CHECK(blObj.count("uncleHeaders") == 0); + TBOOST_CHECK((blObj.count("blockHeader") == 0)); + TBOOST_CHECK((blObj.count("transactions") == 0)); + TBOOST_CHECK((blObj.count("uncleHeaders") == 0)); continue; } catch (...) { cnote << "state sync or block import did throw an exception\n"; - BOOST_CHECK(blObj.count("blockHeader") == 0); - BOOST_CHECK(blObj.count("transactions") == 0); - BOOST_CHECK(blObj.count("uncleHeaders") == 0); + TBOOST_CHECK((blObj.count("blockHeader") == 0)); + TBOOST_CHECK((blObj.count("transactions") == 0)); + TBOOST_CHECK((blObj.count("uncleHeaders") == 0)); continue; } - BOOST_REQUIRE(blObj.count("blockHeader")); + TBOOST_REQUIRE(blObj.count("blockHeader")); mObject tObj = blObj["blockHeader"].get_obj(); BlockInfo blockHeaderFromFields; @@ -372,24 +372,24 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) if (importedAndBest) { //Check the fields restored from RLP to original fields - BOOST_CHECK_MESSAGE(blockHeaderFromFields.headerHash(WithNonce) == blockFromRlp.headerHash(WithNonce), "hash in given RLP not matching the block hash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.parentHash == blockFromRlp.parentHash, "parentHash in given RLP not matching the block parentHash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.sha3Uncles == blockFromRlp.sha3Uncles, "sha3Uncles in given RLP not matching the block sha3Uncles!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.coinbaseAddress == blockFromRlp.coinbaseAddress,"coinbaseAddress in given RLP not matching the block coinbaseAddress!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.stateRoot == blockFromRlp.stateRoot, "stateRoot in given RLP not matching the block stateRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.transactionsRoot == blockFromRlp.transactionsRoot, "transactionsRoot in given RLP not matching the block transactionsRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.receiptsRoot == blockFromRlp.receiptsRoot, "receiptsRoot in given RLP not matching the block receiptsRoot!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.logBloom == blockFromRlp.logBloom, "logBloom in given RLP not matching the block logBloom!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.difficulty == blockFromRlp.difficulty, "difficulty in given RLP not matching the block difficulty!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.number == blockFromRlp.number, "number in given RLP not matching the block number!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasLimit == blockFromRlp.gasLimit,"gasLimit in given RLP not matching the block gasLimit!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed, "gasUsed in given RLP not matching the block gasUsed!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.timestamp == blockFromRlp.timestamp, "timestamp in given RLP not matching the block timestamp!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.extraData == blockFromRlp.extraData, "extraData in given RLP not matching the block extraData!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.mixHash == blockFromRlp.mixHash, "mixHash in given RLP not matching the block mixHash!"); - BOOST_CHECK_MESSAGE(blockHeaderFromFields.nonce == blockFromRlp.nonce, "nonce in given RLP not matching the block nonce!"); - - BOOST_CHECK_MESSAGE(blockHeaderFromFields == blockFromRlp, "However, blockHeaderFromFields != blockFromRlp!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.headerHash(WithNonce) == blockFromRlp.headerHash(WithNonce)), "hash in given RLP not matching the block hash!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.parentHash == blockFromRlp.parentHash), "parentHash in given RLP not matching the block parentHash!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.sha3Uncles == blockFromRlp.sha3Uncles), "sha3Uncles in given RLP not matching the block sha3Uncles!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.coinbaseAddress == blockFromRlp.coinbaseAddress),"coinbaseAddress in given RLP not matching the block coinbaseAddress!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.stateRoot == blockFromRlp.stateRoot), "stateRoot in given RLP not matching the block stateRoot!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.transactionsRoot == blockFromRlp.transactionsRoot), "transactionsRoot in given RLP not matching the block transactionsRoot!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.receiptsRoot == blockFromRlp.receiptsRoot), "receiptsRoot in given RLP not matching the block receiptsRoot!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.logBloom == blockFromRlp.logBloom), "logBloom in given RLP not matching the block logBloom!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.difficulty == blockFromRlp.difficulty), "difficulty in given RLP not matching the block difficulty!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.number == blockFromRlp.number), "number in given RLP not matching the block number!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.gasLimit == blockFromRlp.gasLimit),"gasLimit in given RLP not matching the block gasLimit!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.gasUsed == blockFromRlp.gasUsed), "gasUsed in given RLP not matching the block gasUsed!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.timestamp == blockFromRlp.timestamp), "timestamp in given RLP not matching the block timestamp!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.extraData == blockFromRlp.extraData), "extraData in given RLP not matching the block extraData!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.mixHash == blockFromRlp.mixHash), "mixHash in given RLP not matching the block mixHash!"); + TBOOST_CHECK_MESSAGE((blockHeaderFromFields.nonce == blockFromRlp.nonce), "nonce in given RLP not matching the block nonce!"); + + TBOOST_CHECK_MESSAGE((blockHeaderFromFields == blockFromRlp), "However, blockHeaderFromFields != blockFromRlp!"); //Check transaction list @@ -399,15 +399,15 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) { mObject tx = txObj.get_obj(); - BOOST_REQUIRE(tx.count("nonce")); - BOOST_REQUIRE(tx.count("gasPrice")); - BOOST_REQUIRE(tx.count("gasLimit")); - BOOST_REQUIRE(tx.count("to")); - BOOST_REQUIRE(tx.count("value")); - BOOST_REQUIRE(tx.count("v")); - BOOST_REQUIRE(tx.count("r")); - BOOST_REQUIRE(tx.count("s")); - BOOST_REQUIRE(tx.count("data")); + TBOOST_REQUIRE(tx.count("nonce")); + TBOOST_REQUIRE(tx.count("gasPrice")); + TBOOST_REQUIRE(tx.count("gasLimit")); + TBOOST_REQUIRE(tx.count("to")); + TBOOST_REQUIRE(tx.count("value")); + TBOOST_REQUIRE(tx.count("v")); + TBOOST_REQUIRE(tx.count("r")); + TBOOST_REQUIRE(tx.count("s")); + TBOOST_REQUIRE(tx.count("data")); try { @@ -416,7 +416,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } catch (Exception const& _e) { - BOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e)); + TBOOST_ERROR("Failed transaction constructor with Exception: " << diagnostic_information(_e)); } catch (exception const& _e) { @@ -432,22 +432,22 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) txsFromRlp.push_back(tx); } - BOOST_CHECK_MESSAGE(txsFromRlp.size() == txsFromField.size(), "transaction list size does not match"); + TBOOST_CHECK_MESSAGE((txsFromRlp.size() == txsFromField.size()), "transaction list size does not match"); for (size_t i = 0; i < txsFromField.size(); ++i) { - BOOST_CHECK_MESSAGE(txsFromField[i].data() == txsFromRlp[i].data(), "transaction data in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].gas() == txsFromRlp[i].gas(), "transaction gasLimit in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].gasPrice() == txsFromRlp[i].gasPrice(), "transaction gasPrice in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].nonce() == txsFromRlp[i].nonce(), "transaction nonce in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().r == txsFromRlp[i].signature().r, "transaction r in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().s == txsFromRlp[i].signature().s, "transaction s in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].signature().v == txsFromRlp[i].signature().v, "transaction v in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].receiveAddress() == txsFromRlp[i].receiveAddress(), "transaction receiveAddress in rlp and in field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].value() == txsFromRlp[i].value(), "transaction receiveAddress in rlp and in field do not match"); - - BOOST_CHECK_MESSAGE(txsFromField[i] == txsFromRlp[i], "transactions from rlp and transaction from field do not match"); - BOOST_CHECK_MESSAGE(txsFromField[i].rlp() == txsFromRlp[i].rlp(), "transactions rlp do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].data() == txsFromRlp[i].data()), "transaction data in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].gas() == txsFromRlp[i].gas()), "transaction gasLimit in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].gasPrice() == txsFromRlp[i].gasPrice()), "transaction gasPrice in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].nonce() == txsFromRlp[i].nonce()), "transaction nonce in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].signature().r == txsFromRlp[i].signature().r), "transaction r in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].signature().s == txsFromRlp[i].signature().s), "transaction s in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].signature().v == txsFromRlp[i].signature().v), "transaction v in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].receiveAddress() == txsFromRlp[i].receiveAddress()), "transaction receiveAddress in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].value() == txsFromRlp[i].value()), "transaction receiveAddress in rlp and in field do not match"); + + TBOOST_CHECK_MESSAGE((txsFromField[i] == txsFromRlp[i]), "transactions from rlp and transaction from field do not match"); + TBOOST_CHECK_MESSAGE((txsFromField[i].rlp() == txsFromRlp[i].rlp()), "transactions rlp do not match"); } // check uncle list @@ -458,7 +458,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) for (auto const& uBlHeaderObj: blObj["uncleHeaders"].get_array()) { mObject uBlH = uBlHeaderObj.get_obj(); - BOOST_REQUIRE(uBlH.size() == 16); + TBOOST_REQUIRE((uBlH.size() == 16)); bytes uncleRLP = createBlockRLPFromFields(uBlH); const RLP c_uRLP(uncleRLP); BlockInfo uncleBlockHeader; @@ -468,7 +468,7 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) } catch(...) { - BOOST_ERROR("invalid uncle header"); + TBOOST_ERROR("invalid uncle header"); } uBlHsFromField.push_back(uncleBlockHeader); } @@ -482,15 +482,15 @@ void doBlockchainTests(json_spirit::mValue& _v, bool _fillin) uBlHsFromRlp.push_back(uBl); } - BOOST_REQUIRE_EQUAL(uBlHsFromField.size(), uBlHsFromRlp.size()); + TBOOST_REQUIRE_EQUAL(uBlHsFromField.size(), uBlHsFromRlp.size()); for (size_t i = 0; i < uBlHsFromField.size(); ++i) - BOOST_CHECK_MESSAGE(uBlHsFromField[i] == uBlHsFromRlp[i], "block header in rlp and in field do not match"); + TBOOST_CHECK_MESSAGE((uBlHsFromField[i] == uBlHsFromRlp[i]), "block header in rlp and in field do not match"); }//importedAndBest }//all blocks - BOOST_REQUIRE(o.count("lastblockhash") > 0); - BOOST_CHECK_MESSAGE(toString(trueBc.info().hash()) == o["lastblockhash"].get_str(), + TBOOST_REQUIRE((o.count("lastblockhash") > 0)); + TBOOST_CHECK_MESSAGE((toString(trueBc.info().hash()) == o["lastblockhash"].get_str()), "Boost check: " + i.first + " lastblockhash does not match " + toString(trueBc.info().hash()) + " expected: " + o["lastblockhash"].get_str()); } } @@ -713,11 +713,11 @@ BlockInfo constructBlock(mObject& _o) } catch (std::exception const& _e) { - BOOST_ERROR("Failed block population with Exception: " << _e.what()); + TBOOST_ERROR("Failed block population with Exception: " << _e.what()); } catch(...) { - BOOST_ERROR("block population did throw an unknown exception\n"); + TBOOST_ERROR("block population did throw an unknown exception\n"); } return ret; } From cbe3f80d6f28a1af1a8c8fed52a9d2d492153e4e Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 17 Jun 2015 16:23:28 +0200 Subject: [PATCH 088/169] - bug fix with encoding bytes and string. - bug fix when using String type QML control - bytes parameter: stop trying to get ASCII value (as String as been reimported) --- mix/ContractCallDataEncoder.cpp | 36 +++++++++++++-------------------- mix/QVariableDeclaration.h | 1 + mix/qml/QIntTypeView.qml | 3 --- mix/qml/QStringTypeView.qml | 33 +++++++++++++----------------- mix/qml/StructView.qml | 2 +- mix/qml/js/InputValidator.js | 19 ++++------------- 6 files changed, 34 insertions(+), 60 deletions(-) diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index a1aae3f79..3c635b8b0 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -97,37 +97,34 @@ void ContractCallDataEncoder::encodeArray(QJsonArray const& _array, QList _ void ContractCallDataEncoder::encode(QVariant const& _data, SolidityType const& _type) { - QStringList strList; - if (_type.array) + if (_type.dynamicSize && (_type.type == SolidityType::Type::Bytes || _type.type == SolidityType::Type::String)) + { + bytes empty(32); + size_t sizePos = m_dynamicData.size(); + m_dynamicData += empty; //reserve space for count + u256 count = encodeSingleItem(_data.toString(), _type, m_dynamicData); + vector_ref sizeRef(m_dynamicData.data() + sizePos, 32); + toBigEndian(count, sizeRef); + m_staticOffsetMap.push_back(std::make_pair(m_encodedData.size(), sizePos)); + m_encodedData += empty; //reserve space for offset + } + else if (_type.array) { QList dim = extractDimension(_type. name); bytes content; - QJsonDocument jsonResponse = QJsonDocument::fromJson(_data.toString().toUtf8()); - QJsonArray jsonObject = jsonResponse.array(); size_t size = m_encodedData.size(); - if (dim[0] == -1) + if (dim.front() == -1) { m_encodedData += bytes(32); // reserve space for offset m_staticOffsetMap.push_back(std::make_pair(size, m_dynamicData.size())); } - encodeArray(jsonObject, dim, _type, content); + encodeArray(_data.toJsonArray(), dim, _type, content); if (!_type.dynamicSize) m_encodedData.insert(m_encodedData.end(), content.begin(), content.end()); else m_dynamicData.insert(m_dynamicData.end(), content.begin(), content.end()); } - else if (_type.dynamicSize && _type.type == SolidityType::Type::Bytes) - { - bytes empty(32); - size_t sizePos = m_dynamicData.size(); - m_dynamicData += empty; //reserve space for count - u256 count = encodeSingleItem(_data.toString(), _type, m_dynamicData); - vector_ref sizeRef(m_dynamicData.data() + sizePos, 32); - toBigEndian(count, sizeRef); - m_staticOffsetMap.push_back(std::make_pair(m_encodedData.size(), sizePos)); - m_encodedData += empty; //reserve space for offset - } else encodeSingleItem(_data.toString(), _type, m_encodedData); } @@ -179,11 +176,6 @@ unsigned ContractCallDataEncoder::encodeSingleItem(QString const& _data, Solidit catch (std::exception const&) { // manage input as a string. - QRegExp strExtract("\"(.*)\""); //check if contains both string and hex value, keep the string. - int i = strExtract.indexIn(src); - if (i != -1) - src = strExtract.cap(0); - src = src.replace("\"", ""); result = encodeStringParam(src, alignSize); } } diff --git a/mix/QVariableDeclaration.h b/mix/QVariableDeclaration.h index 85c719987..583847b44 100644 --- a/mix/QVariableDeclaration.h +++ b/mix/QVariableDeclaration.h @@ -60,6 +60,7 @@ public: Bool, Address, Bytes, + String, Enum, Struct }; diff --git a/mix/qml/QIntTypeView.qml b/mix/qml/QIntTypeView.qml index c42e65654..ec54d6409 100644 --- a/mix/qml/QIntTypeView.qml +++ b/mix/qml/QIntTypeView.qml @@ -33,6 +33,3 @@ Item } } } - - - diff --git a/mix/qml/QStringTypeView.qml b/mix/qml/QStringTypeView.qml index 101863421..c42e65654 100644 --- a/mix/qml/QStringTypeView.qml +++ b/mix/qml/QStringTypeView.qml @@ -2,38 +2,33 @@ import QtQuick 2.0 Item { - property string value + property alias value: textinput.text property alias readOnly: textinput.readOnly id: editRoot - height: 20 width: readOnly ? textinput.implicitWidth : 150 - onValueChanged: - { - textinput.text = value - } - SourceSansProBold - { - id: boldFont + DebuggerPaneStyle { + id: dbgStyle } Rectangle { anchors.fill: parent radius: 4 TextInput { + anchors.verticalCenter: parent.verticalCenter id: textinput + font.family: dbgStyle.general.basicFont clip: true - anchors.fill: parent - wrapMode: Text.WrapAnywhere - font.family: boldFont.name selectByMouse: true - onTextChanged: { - var stringRegEx = new RegExp('"^\\"*', "g") - var str = stringRegEx.exec(text) - if (str && str.length > 0) - value = str[0] - else - value = text + text: value + anchors.fill: parent + font.pointSize: dbgStyle.general.basicFontSize + color: dbgStyle.general.basicColor + MouseArea { + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: textinput.forceActiveFocus() } } } diff --git a/mix/qml/StructView.qml b/mix/qml/StructView.qml index 880f22057..6b9edc755 100644 --- a/mix/qml/StructView.qml +++ b/mix/qml/StructView.qml @@ -72,7 +72,7 @@ Column return Qt.createComponent("qrc:/qml/QIntTypeView.qml"); else if (t === QSolidityType.Bool) return Qt.createComponent("qrc:/qml/QBoolTypeView.qml"); - else if (t === QSolidityType.Bytes) + else if (t === QSolidityType.Bytes || t === QSolidityType.String) return Qt.createComponent("qrc:/qml/QStringTypeView.qml"); else if (t === QSolidityType.Hash) return Qt.createComponent("qrc:/qml/QHashTypeView.qml"); diff --git a/mix/qml/js/InputValidator.js b/mix/qml/js/InputValidator.js index 46b23274d..7190ae291 100644 --- a/mix/qml/js/InputValidator.js +++ b/mix/qml/js/InputValidator.js @@ -1,8 +1,8 @@ Qt.include("QEtherHelper.js") -var nbRegEx = new RegExp('^[0-9]+$'); -var arrayRegEx = new RegExp('\\[[^\\]]*\\]', "g"); -var capturenbRegEx = new RegExp("[0-9]+"); +var nbRegEx; +var arrayRegEx; +var capturenbRegEx; function validate(model, values) { @@ -54,10 +54,7 @@ function check(type, value) function isArray(_type) { - if (!arrayRegEx.test(_type)) - return false - else - return (_type.indexOf("int") !== -1 || _type.indexOf("bytes") !== -1 || _type.indexOf("bool") !== -1 || _type.indexOf("adress") !== -1) + return arrayRegEx.test(_type); } function checkArrayRecursively(_type, _dim, _array) @@ -186,14 +183,6 @@ function validateAddress(_type, _value) function validateBytes(_type, _value) { var ret = { valid: true, message: "" } - if (_value.indexOf("\"") === 0 && _value.indexOf("0x") !== -1) - { - //this is a different fomatting - var stringRegEx = new RegExp('".*"', "g"); - var matches = _value.match(stringRegEx); - if (matches.length === 1) - _value = matches[0] - } if (_type !== "bytes" && _value.length > parseInt(_type.replace("bytes", "")) ) { ret.valid = false; From eac6ed820b573628d715f846cfe725498c8c1bc4 Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 17 Jun 2015 16:45:47 +0200 Subject: [PATCH 089/169] hide extractDimension from .h --- mix/ContractCallDataEncoder.cpp | 39 +++++++++++++++++---------------- mix/ContractCallDataEncoder.h | 1 - 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index 3c635b8b0..62cc39a04 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -37,6 +37,24 @@ using namespace dev; using namespace dev::solidity; using namespace dev::mix; +static QList extractDimension(QString const& _type) +{ + QList dim; + QRegExp dimExtract("(\\[[^\\]]*\\])"); + int pos = dimExtract.indexIn(_type); + while (pos != -1) + { + QString d = dimExtract.cap(0); + pos += d.length(); + pos = dimExtract.indexIn(_type, pos); + if (d == "[]") + dim.push_front(-1); + else + dim.push_front(d.replace("[", "").replace("]", "").toInt()); + } + return dim; +} + bytes ContractCallDataEncoder::encodedData() { bytes r(m_encodedData); @@ -118,7 +136,8 @@ void ContractCallDataEncoder::encode(QVariant const& _data, SolidityType const& m_encodedData += bytes(32); // reserve space for offset m_staticOffsetMap.push_back(std::make_pair(size, m_dynamicData.size())); } - encodeArray(_data.toJsonArray(), dim, _type, content); + QJsonDocument jsonDoc = QJsonDocument::fromJson(_data.toString().toUtf8()); + encodeArray(jsonDoc.array(), dim, _type, content); if (!_type.dynamicSize) m_encodedData.insert(m_encodedData.end(), content.begin(), content.end()); @@ -129,24 +148,6 @@ void ContractCallDataEncoder::encode(QVariant const& _data, SolidityType const& encodeSingleItem(_data.toString(), _type, m_encodedData); } -QList ContractCallDataEncoder::extractDimension(QString const& _type) -{ - QList dim; - QRegExp dimExtract("(\\[[^\\]]*\\])"); - int pos = dimExtract.indexIn(_type); - while (pos != -1) - { - QString d = dimExtract.cap(0); - pos += d.length(); - pos = dimExtract.indexIn(_type, pos); - if (d == "[]") - dim.push_front(-1); - else - dim.push_front(d.replace("[", "").replace("]", "").toInt()); - } - return dim; -} - unsigned ContractCallDataEncoder::encodeSingleItem(QString const& _data, SolidityType const& _type, bytes& _dest) { if (_type.type == SolidityType::Type::Struct) diff --git a/mix/ContractCallDataEncoder.h b/mix/ContractCallDataEncoder.h index 867e75751..e29cb92e0 100644 --- a/mix/ContractCallDataEncoder.h +++ b/mix/ContractCallDataEncoder.h @@ -71,7 +71,6 @@ private: QString toString(bool _b); QString toString(dev::bytes const& _b); bool asString(dev::bytes const& _b, QString& _str); - QList extractDimension(QString const& _type); void encodeArray(QJsonArray const& _array, QList _dim, SolidityType const& _type, bytes& _content); QString toChar(dev::bytes const& _b); From e617bfb0f7b2854acb00ae90afb3f1a223502210 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jun 2015 17:15:30 +0200 Subject: [PATCH 090/169] Corrected typo about max peer count. --- libp2p/Host.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index a0d8e1297..feb116c4a 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -391,7 +391,7 @@ void Host::runAcceptor() { if (peerCount() > 9 * m_idealPeerCount) { - clog(NetConnect) << "Dropping incoming connect due to maximum peer count (2 * ideal peer count): " << socket->remoteEndpoint(); + clog(NetConnect) << "Dropping incoming connect due to maximum peer count (9 * ideal peer count): " << socket->remoteEndpoint(); socket->close(); if (ec.value() < 1) runAcceptor(); From 2b16073d5b11a004309003cc5dcb12238c5f5fd4 Mon Sep 17 00:00:00 2001 From: Dimitry Date: Wed, 17 Jun 2015 18:31:14 +0300 Subject: [PATCH 091/169] FuzzTests: simple block test + NOBOOST flag --- CMakeLists.txt | 5 +++++ test/TestHelper.h | 3 +-- test/fuzzTesting/createRandomTest.cpp | 23 +++++++++++------------ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 729f95ed6..904badcf2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ option(FATDB "Build with ability to list entries in the Trie. Doubles DB size, s option(USENPM "Use npm to recompile ethereum.js if it was changed" OFF) option(PROFILING "Build in support for profiling" OFF) + set(BUNDLE "none" CACHE STRING "Predefined bundle of software to build (none, full, user, tests, minimal).") option(MINER "Build the CLI miner component" ON) option(ETHKEY "Build the CLI key manager component" ON) @@ -40,6 +41,7 @@ option(TOOLS "Build the tools components" ON) option(NCURSES "Build the NCurses components" OFF) option(GUI "Build GUI components (AlethZero, Mix)" ON) option(TESTS "Build the tests." ON) +option(NOBOOST "No use of boost macros in test functions" OFF) option(EVMJIT "Build just-in-time compiler for EVM code (requires LLVM)" OFF) option(ETHASHCL "Build in support for GPU mining via OpenCL" OFF) option(JSCONSOLE "Build in javascript console" OFF) @@ -82,6 +84,7 @@ function(configureProject) add_definitions(-DETH_CURL) endif() + add_definitions(-DNOBOOST) add_definitions(-DETH_TRUE) endfunction() @@ -195,6 +198,7 @@ eth_format_option(PROFILING) eth_format_option(SOLIDITY) eth_format_option(GUI) eth_format_option(TESTS) +eth_format_option(NOBOOST) eth_format_option(TOOLS) eth_format_option(ETHASHCL) eth_format_option(JSCONSOLE) @@ -316,6 +320,7 @@ message("-- SERPENT Build Serpent language components ${SERPENT} message("-- GUI Build GUI components ${GUI}") message("-- NCURSES Build NCurses components ${NCURSES}") message("-- TESTS Build tests ${TESTS}") +message("-- NOBOOST No BOOST macros in test functions ${NOBOOST}") message("-- ETHASHCL Build OpenCL components (experimental!) ${ETHASHCL}") message("-- JSCONSOLE Build with javascript console ${JSCONSOLE}") message("-- EVMJIT Build LLVM-based JIT EVM (experimental!) ${EVMJIT}") diff --git a/test/TestHelper.h b/test/TestHelper.h index 42f85a82c..df33c00d8 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -31,8 +31,7 @@ #include #include -#define DONTUSE_BOOST_MACROS -#ifdef DONTUSE_BOOST_MACROS +#ifdef NOBOOST #define TBOOST_THROW_EXCEPTION(arg) throw dev::Exception(); #define TBOOST_REQUIRE(arg) if(arg == false) throw dev::Exception(); #define TBOOST_REQUIRE_EQUAL(arg1, arg2) if(arg1 != arg2) throw dev::Exception(); diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index 34f90533f..e21f22eea 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -154,17 +154,16 @@ int checkRandomTest(std::function doTests, jso void fillRandomTest(std::function doTests, std::string const& testString) { //redirect all output to the stream - //std::ostringstream strCout; - //std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); - //std::cout.rdbuf( strCout.rdbuf() ); - //std::cerr.rdbuf( strCout.rdbuf() ); + std::ostringstream strCout; + std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); + std::cout.rdbuf( strCout.rdbuf() ); + std::cerr.rdbuf( strCout.rdbuf() ); json_spirit::mValue v; try { std::string newTest = testString; parseTestWithTypes(newTest); - std::cout << newTest; json_spirit::read_string(newTest, v); doTests(v, true); } @@ -174,8 +173,8 @@ void fillRandomTest(std::function doTests, std } //restroe output - //std::cout.rdbuf(oldCoutStreamBuf); - //std::cerr.rdbuf(oldCoutStreamBuf); + std::cout.rdbuf(oldCoutStreamBuf); + std::cerr.rdbuf(oldCoutStreamBuf); std::cout << json_spirit::write_string(v, true); } @@ -246,7 +245,7 @@ std::vector getTypes() std::string const c_testExampleTransactionTest = R"( { -"TransactionTest" : { + "randomTransactionTest" : { "transaction" : { "data" : "[CODE]", @@ -344,7 +343,7 @@ std::string const c_testExampleVMTest = R"( std::string const c_testExampleBlockchainTest = R"( { - "blockTest" : { + "randomBlockTest" : { "genesisBlockHeader" : { "bloom" : "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "coinbase" : "[HASH20]", @@ -359,8 +358,8 @@ std::string const c_testExampleBlockchainTest = R"( "receiptTrie" : "[0xHASH32]", "stateRoot" : "[0xHASH32]", "timestamp" : "[HEX]", - "transactionsTrie" : "[0xHASH32]", - "uncleHash" : "[0xHASH32]" + "transactionsTrie" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncleHash" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347" }, "pre" : { "a94f5374fce5edbc8e2a8697c15331677e6ebf0b" : { @@ -371,7 +370,7 @@ std::string const c_testExampleBlockchainTest = R"( }, "095e7baea6a6c7c4c2dfeb977efac326af552d87" : { "balance" : "[HEX]", - "nonce" : "[HEX]", + "nonce" : "0", "code" : "[CODE]", "storage": {} } From 8ec447166fee8970eb8ce05813710a59890b8d0e Mon Sep 17 00:00:00 2001 From: yann300 Date: Wed, 17 Jun 2015 17:45:04 +0200 Subject: [PATCH 092/169] Scenario Panel: UI changes --- mix/qml/Block.qml | 43 +++-- mix/qml/BlockChain.qml | 46 +++--- mix/qml/ScenarioButton.qml | 41 ++++- mix/qml/ScenarioExecution.qml | 13 +- mix/qml/ScenarioLoader.qml | 290 ++++++++++++++++++++-------------- 5 files changed, 279 insertions(+), 154 deletions(-) diff --git a/mix/qml/Block.qml b/mix/qml/Block.qml index 6fb274ccd..46689e0f2 100644 --- a/mix/qml/Block.qml +++ b/mix/qml/Block.qml @@ -21,6 +21,7 @@ ColumnLayout property int openedTr: 0 property int blockIndex property variant scenario + property string labelColor: "#414141" function calculateHeight() { @@ -41,18 +42,17 @@ ColumnLayout height = calculateHeight() } - - RowLayout { Layout.preferredHeight: trHeight Layout.preferredWidth: blockWidth id: rowHeader + Rectangle { - color: "#DEDCDC" Layout.preferredWidth: blockWidth Layout.preferredHeight: trHeight + color: "#DEDCDC" radius: 4 anchors.left: parent.left anchors.leftMargin: statusWidth + 5 @@ -60,12 +60,32 @@ ColumnLayout anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: horizontalMargin + color: "#adadad" text: { - if (status === "mined") + if (number === -2) + return qsTr("STARTING PARAMETERS") + else if (status === "mined") return qsTr("BLOCK") + " " + number else - return qsTr("BLOCK") + " pending" + return qsTr("PENDING TRANSACTIONS") + } + } + + Label + { + text: qsTr("EDIT") + color: "#1397da" + anchors.verticalCenter: parent.verticalCenter + anchors.right: parent.right + anchors.rightMargin: 14 + MouseArea + { + anchors.fill: parent + onClicked: + { + // load edit block panel + } } } } @@ -75,7 +95,6 @@ ColumnLayout { id: transactionRepeater model: transactions - RowLayout { id: rowTransaction @@ -99,7 +118,7 @@ ColumnLayout var p = log.param.get(i) logsText.text += p.name + " = " + p.value + " - indexed:" + p.indexed + "\n" } - else{ + else { logsText.text += "From : " + log.address + "\n" } } @@ -112,18 +131,18 @@ ColumnLayout { id: trSaveStatus Layout.preferredWidth: statusWidth - Layout.preferredHeight: trHeight + Layout.preferredHeight: parent.height color: "transparent" anchors.top: parent.top property bool saveStatus Image { + anchors.top: parent.top + anchors.topMargin: -7 id: saveStatusImage source: "qrc:/qml/img/recyclediscard@2x.png" width: statusWidth fillMode: Image.PreserveAspectFit - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter } Component.onCompleted: @@ -177,6 +196,7 @@ ColumnLayout Layout.preferredWidth: fromWidth elide: Text.ElideRight maximumLineCount: 1 + color: labelColor text: { if (index >= 0) return transactions.get(index).sender @@ -195,6 +215,7 @@ ColumnLayout return "" } elide: Text.ElideRight + color: labelColor maximumLineCount: 1 Layout.preferredWidth: toWidth } @@ -217,6 +238,7 @@ ColumnLayout id: returnValue elide: Text.ElideRight maximumLineCount: 1 + color: labelColor Layout.preferredWidth: valueWidth text: { if (index >= 0 && transactions.get(index).returned) @@ -237,6 +259,7 @@ ColumnLayout id: logs anchors.left: parent.left anchors.leftMargin: 10 + color: labelColor text: { if (index >= 0 && transactions.get(index).logs && transactions.get(index).logs.count) return transactions.get(index).logs.count diff --git a/mix/qml/BlockChain.qml b/mix/qml/BlockChain.qml index d3fad6fda..f6a56fb4f 100644 --- a/mix/qml/BlockChain.qml +++ b/mix/qml/BlockChain.qml @@ -20,7 +20,7 @@ ColumnLayout { signal chainChanged onChainChanged: { - reBuildNeeded.start() + rebuild.startBlinking() } onWidthChanged: @@ -55,12 +55,12 @@ ColumnLayout { previousWidth = width } - property int statusWidth: 30 + property int statusWidth: 40 property int fromWidth: 100 property int toWidth: 100 property int valueWidth: 200 - property int logsWidth: 50 - property int debugActionWidth: 50 + property int logsWidth: 40 + property int debugActionWidth: 40 property int horizontalMargin: 10 property int cellSpacing: 10 @@ -68,12 +68,12 @@ ColumnLayout { { id: header spacing: 0 - Layout.preferredHeight: 25 + Layout.preferredHeight: 30 Image { id: debugImage source: "qrc:/qml/img/recycleicon@2x.png" Layout.preferredWidth: statusWidth - Layout.preferredHeight: 25 + Layout.preferredHeight: parent.height fillMode: Image.PreserveAspectFit } Rectangle @@ -126,6 +126,19 @@ ColumnLayout { id: blockChainLayout width: parent.width spacing: 10 + + Block + { + scenario: blockChainPanel.model + Layout.preferredWidth: blockChainScrollView.width + Layout.preferredHeight: 60 + blockIndex: -1 + transactions: [] + status: "" + number: -2 + trHeight: 60 + } + Repeater // List of blocks { id: blockChainRepeater @@ -229,7 +242,7 @@ ColumnLayout { { if (ensureNotFuturetime.running) return; - reBuildNeeded.stop() + stopBlinking() var retBlocks = []; var bAdded = 0; for (var j = 0; j < model.blocks.length; j++) @@ -282,23 +295,8 @@ ColumnLayout { Layout.preferredHeight: 30 buttonShortcut: "" sourceImg: "qrc:/qml/img/recycleicon@2x.png" - Timer - { - id: reBuildNeeded - repeat: true - interval: 1000 - running: false - onTriggered: { - if (!parent.fillColor || parent.fillColor === "white") - parent.fillColor = "orange" - else - parent.fillColor = "white" - } - onRunningChanged: { - if (!running) - parent.fillColor = "white" - } - } + + } ScenarioButton { diff --git a/mix/qml/ScenarioButton.qml b/mix/qml/ScenarioButton.qml index 4dd7bc53f..7f8b5d202 100644 --- a/mix/qml/ScenarioButton.qml +++ b/mix/qml/ScenarioButton.qml @@ -11,13 +11,52 @@ Rectangle { property string fillColor signal clicked + function startBlinking() + { + blinkTimer.start() + } + + function stopBlinking() + { + blinkTimer.stop() + } + Rectangle { id: contentRectangle anchors.fill: parent border.color: "#cccccc" border.width: 1 radius: 4 - color: parent.fillColor ? parent.fillColor : "white" + color: "white" + property variant colorGradient: ["#FFFFFF", "#FFFEFC", "#FFFDF9", "#FFFCF7", "#FFFBF4", "#FFFAF2", "#FFF9EF", "#FFF8EC", "#FFF7EA", "#FFF6E7", "#FFF5E5", "#FFF5E2", "#FFF4E0", "#FFF3DD", "#FFF2DA", "#FFF1D8", "#FFF0D5", "#FFEFD3", "#FFEED0", "#FFEDCE", "#FFECCB", "#FFEBC8", "#FFEBC6", "#FFEAC3", "#FFE9C1", "#FFE8BE", "#FFE7BC", "#FFE6B9", "#FFE5B6", "#FFE4B4", "#FFE3B1", "#FFE2AF", "#FFE1AC", "#FFE1AA", "#FFE0A7", "#FFDFA4", "#FFDEA2", "#FFDD9F", "#FFDC9D", "#FFDB9A", "#FFDA97", "#FFD995", "#FFD892", "#FFD790", "#FFD78D", "#FFD68B", "#FFD588", "#FFD485", "#FFD383", "#FFD280", "#FFD17E", "#FFD07B", "#FFCF79", "#FFCE76", "#FFCD73", "#FFCD71", "#FFCC6E", "#FFCB6C", "#FFCA69", "#FFC967", "#FFC864", "#FFC761", "#FFC65F", "#FFC55C", "#FFC45A", "#FFC357", "#FFC355", "#FFC252", "#FFC14F", "#FFC04D", "#FFBF4A", "#FFBE48", "#FFBD45", "#FFBC42", "#FFBB40", "#FFBA3D", "#FFB93B", "#FFB938", "#FFB836", "#FFB733", "#FFB630", "#FFB52E", "#FFB42B", "#FFB329", "#FFB226", "#FFB124", "#FFB021", "#FFAF1E", "#FFAF1C", "#FFAE19", "#FFAD17", "#FFAC14", "#FFAB12", "#FFAA0F", "#FFA90C", "#FFA80A", "#FFA707", "#FFA605", "#FFA502", "#FFA500"] + + Timer + { + id: blinkTimer + repeat: true + interval: 40 + running: false + property int index: 0 + property int direction: 1 + onTriggered: { + index = index + direction + parent.color = parent.colorGradient[index] + if (index >= parent.colorGradient.length - 1) + direction = -1 + else if (index <= 0) + direction = 1 + } + onRunningChanged: { + if (!running) + { + parent.color = "white" + index = 0 + direction = 1 + } + } + } + + Image { id: debugImage anchors { diff --git a/mix/qml/ScenarioExecution.qml b/mix/qml/ScenarioExecution.qml index bc872bff7..85f1990c8 100644 --- a/mix/qml/ScenarioExecution.qml +++ b/mix/qml/ScenarioExecution.qml @@ -28,14 +28,23 @@ Rectangle { spacing: 10 ScenarioLoader { - height: 70 + height: 100 width: parent.width id: loader } + Connections + { + target: blockChain + onChainChanged: + { + loader.needSaveOrReload() + } + } + Rectangle { - width: parent.width + width: parent.parent.width height: 1 color: "#cccccc" } diff --git a/mix/qml/ScenarioLoader.qml b/mix/qml/ScenarioLoader.qml index 93f4f059b..dd67a6f0a 100644 --- a/mix/qml/ScenarioLoader.qml +++ b/mix/qml/ScenarioLoader.qml @@ -10,8 +10,9 @@ import "js/Debugger.js" as Debugger import "js/ErrorLocationFormater.js" as ErrorLocationFormater import "." -RowLayout +ColumnLayout { + id: blockChainSelector signal restored(variant scenario) signal saved(variant scenario) signal duplicated(variant scenario) @@ -22,154 +23,209 @@ RowLayout scenarioList.load() } - id: blockChainSelector - - Dialog { - id: newStateWin - modality: Qt.ApplicationModal - title: qsTr("New Project"); - - width: 320 - height: 120 + function needSaveOrReload() + { + editStatus.visible = true + } - visible: false + //anchors.margins: 10 + //width: parent.width + Rectangle + { + Layout.fillWidth: true + Layout.preferredHeight: 30 + color: "transparent" + Rectangle + { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + color: "transparent" + Text + { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + id: scenarioName + } - contentItem: Rectangle { - anchors.fill: parent - anchors.margins: 10 - RowLayout { + TextInput + { + id: scenarioNameEdit + visible: false anchors.verticalCenter: parent.verticalCenter - Text { - text: qsTr("Name:") + anchors.horizontalCenter: parent.horizontalCenter + Keys.onEnterPressed: + { + save() } - Rectangle + function edit() { - Layout.preferredWidth: 250 - Layout.preferredHeight: parent.height - border.width: 1 - border.color: "#cccccc" - TextInput - { - anchors.fill: parent - id: stateName - } + editIconRect.anchors.left = scenarioNameEdit.right + editStatus.parent.anchors.left = scenarioNameEdit.right + scenarioNameEdit.forceActiveFocus() + } + + function save() + { + editIconRect.anchors.left = scenarioName.right + editStatus.parent.anchors.left = scenarioName.right + scenarioName.text = scenarioNameEdit.text + scenarioName.visible = true + scenarioNameEdit.visible = false + projectModel.stateListModel.getState(scenarioList.currentIndex).title = scenarioName.text + projectModel.saveProjectFile() + saved(state) } } - RowLayout + + Connections { - anchors.bottom: parent.bottom - anchors.right: parent.right; - function acceptAndClose() + target: blockChainSelector + onLoaded: { - var item = projectModel.stateListModel.createDefaultState(); - item.title = stateName.text - projectModel.stateListModel.appendState(item) - projectModel.stateListModel.save() - close() - scenarioList.currentIndex = projectModel.stateListModel.count - 1 + scenarioName.text = scenario.title + scenarioNameEdit.text = scenario.title } + } - function close() - { - newStateWin.close() - stateName.text = "" + Rectangle + { + anchors.left: scenarioName.right + anchors.top: scenarioName.top + anchors.leftMargin: 2 + Layout.preferredWidth: 20 + Text { + id: editStatus + text: "*" + visible: false } + } - Button { - id: okButton; - enabled: stateName.text !== "" - text: qsTr("OK"); - onClicked: { - parent.acceptAndClose(); + Rectangle + { + id: editIconRect + anchors.left: scenarioName.right + anchors.leftMargin: 15 + Image { + source: "qrc:/qml/img/edit.png" + width: 10 + fillMode: Image.PreserveAspectFit + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + MouseArea + { + anchors.fill: parent + onClicked: + { + scenarioName.visible = !scenarioName.visible + scenarioNameEdit.visible = !scenarioNameEdit.visible + if (!scenarioNameEdit.visible) + scenarioNameEdit.save() + else + scenarioNameEdit.edit() + + } } } - Button { - text: qsTr("Cancel"); - onClicked: parent.close(); - } } } } - ComboBox + RowLayout { - id: scenarioList - model: projectModel.stateListModel - textRole: "title" - onCurrentIndexChanged: - { - restoreScenario.restore() - } + Layout.fillWidth: true + Layout.preferredHeight: 50 + spacing: 0 - function load() + Row { - var state = projectModel.stateListModel.getState(currentIndex) - loaded(state) - } - } + Layout.preferredWidth: 100 * 5 + Layout.preferredHeight: 50 + spacing: 0 - Row - { - Layout.preferredWidth: 100 * 4 - Layout.preferredHeight: 30 - spacing: 0 - ScenarioButton { - id: restoreScenario - width: 100 - height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/restoreicon@2x.png" - onClicked: { - restore() - } - text: qsTr("Restore") - function restore() + ComboBox { - var state = projectModel.stateListModel.reloadStateFromFromProject(scenarioList.currentIndex) - restored(state) - loaded(state) + id: scenarioList + model: projectModel.stateListModel + textRole: "title" + height: 30 + onCurrentIndexChanged: + { + restoreScenario.restore() + } + + function load() + { + var state = projectModel.stateListModel.getState(currentIndex) + loaded(state) + } + } + + ScenarioButton { + id: restoreScenario + width: 100 + height: 30 + buttonShortcut: "" + sourceImg: "qrc:/qml/img/restoreicon@2x.png" + onClicked: { + restore() + } + text: qsTr("Restore") + function restore() + { + var state = projectModel.stateListModel.reloadStateFromFromProject(scenarioList.currentIndex) + if (state) + { + editStatus.visible = false + restored(state) + loaded(state) + } + } } - } - ScenarioButton { - id: saveScenario - text: qsTr("Save") - onClicked: { - projectModel.saveProjectFile() - saved(state) + ScenarioButton { + id: saveScenario + text: qsTr("Save") + onClicked: { + projectModel.saveProjectFile() + saved(state) + } + width: 100 + height: 30 + buttonShortcut: "" + sourceImg: "qrc:/qml/img/saveicon@2x.png" } - width: 100 - height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/saveicon@2x.png" - } - ScenarioButton - { - id: duplicateScenario - text: qsTr("Duplicate") - onClicked: { - projectModel.stateListModel.duplicateState(scenarioList.currentIndex) - duplicated(state) + ScenarioButton + { + id: duplicateScenario + text: qsTr("Duplicate") + onClicked: { + projectModel.stateListModel.duplicateState(scenarioList.currentIndex) + duplicated(state) + } + width: 100 + height: 30 + buttonShortcut: "" + sourceImg: "qrc:/qml/img/duplicateicon@2x.png" } - width: 100 - height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/duplicateicon@2x.png" - } - ScenarioButton { - id: addScenario - width: 100 - height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/plus.png" - onClicked: { - newStateWin.open() + ScenarioButton { + id: addScenario + width: 100 + height: 30 + buttonShortcut: "" + sourceImg: "qrc:/qml/img/plus.png" + onClicked: { + var item = projectModel.stateListModel.createDefaultState(); + item.title = qsTr("New Scenario") + projectModel.stateListModel.appendState(item) + projectModel.stateListModel.save() + scenarioList.currentIndex = projectModel.stateListModel.count - 1 + scenarioNameEdit.edit() + } + text: qsTr("New") } - text: qsTr("New") } } - } From 5390c358b725a457a54e8c77c714d7f9d159906f Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Wed, 17 Jun 2015 17:57:37 +0200 Subject: [PATCH 093/169] OpenCL bin2h script correction - The script to turn the source into a bytearray header is no longer a function but is instead the body of a script so that it's callable as an external cmake command - Spaces -> Tabs in the touched cmake files --- libethash-cl/CMakeLists.txt | 27 +++++----- libethash-cl/bin2h.cmake | 100 +++++++++++++++++------------------- 2 files changed, 62 insertions(+), 65 deletions(-) diff --git a/libethash-cl/CMakeLists.txt b/libethash-cl/CMakeLists.txt index 6533bf794..6da254cfb 100644 --- a/libethash-cl/CMakeLists.txt +++ b/libethash-cl/CMakeLists.txt @@ -1,22 +1,23 @@ set(EXECUTABLE ethash-cl) -include(bin2h.cmake) -bin2h(SOURCE_FILE ethash_cl_miner_kernel.cl - VARIABLE_NAME ethash_cl_miner_kernel - HEADER_FILE ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h) - -# Add a custom command so that the user can regenerate the header file containing the kernel -# code's bytearray by running "make clbin2h" - add_custom_target(clbin2h) - add_custom_command(TARGET clbin2h - PRE_BUILD - COMMAND ${CMAKE_COMMAND} -DBIN2H_SOURCE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/ethash_cl_miner_kernel.cl" +# A custom command and target to turn the OpenCL kernel into a byte array header +# The normal build depends on it properly and if the kernel file is changed, then +# a rebuild of libethash-cl should be triggered +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h + COMMAND ${CMAKE_COMMAND} ARGS + -DBIN2H_SOURCE_FILE="${CMAKE_CURRENT_SOURCE_DIR}/ethash_cl_miner_kernel.cl" -DBIN2H_VARIABLE_NAME=ethash_cl_miner_kernel -DBIN2H_HEADER_FILE="${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h" - -P "${CMAKE_CURRENT_SOURCE_DIR}/bin2h.cmake") + -P "${CMAKE_CURRENT_SOURCE_DIR}/bin2h.cmake" + COMMENT "Generating OpenCL Kernel Byte Array" + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ethash_cl_miner_kernel.cl +) +add_custom_target(clbin2h DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h ${CMAKE_CURRENT_SOURCE_DIR}/ethash_cl_miner_kernel.cl) aux_source_directory(. SRC_LIST) -file(GLOB HEADERS "*.h") +file(GLOB OUR_HEADERS "*.h") +set(HEADERS ${OUR_HEADERS} ${CMAKE_CURRENT_BINARY_DIR}/ethash_cl_miner_kernel.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${OpenCL_INCLUDE_DIRS}) diff --git a/libethash-cl/bin2h.cmake b/libethash-cl/bin2h.cmake index 90ca9cc5b..27ab4eefa 100644 --- a/libethash-cl/bin2h.cmake +++ b/libethash-cl/bin2h.cmake @@ -6,31 +6,31 @@ include(CMakeParseArguments) # VARIABLE - The name of the CMake variable holding the string. # AT_COLUMN - The column position at which string will be wrapped. function(WRAP_STRING) - set(oneValueArgs VARIABLE AT_COLUMN) - cmake_parse_arguments(WRAP_STRING "${options}" "${oneValueArgs}" "" ${ARGN}) + set(oneValueArgs VARIABLE AT_COLUMN) + cmake_parse_arguments(WRAP_STRING "${options}" "${oneValueArgs}" "" ${ARGN}) - string(LENGTH ${${WRAP_STRING_VARIABLE}} stringLength) - math(EXPR offset "0") + string(LENGTH ${${WRAP_STRING_VARIABLE}} stringLength) + math(EXPR offset "0") - while(stringLength GREATER 0) + while(stringLength GREATER 0) - if(stringLength GREATER ${WRAP_STRING_AT_COLUMN}) - math(EXPR length "${WRAP_STRING_AT_COLUMN}") - else() - math(EXPR length "${stringLength}") - endif() + if(stringLength GREATER ${WRAP_STRING_AT_COLUMN}) + math(EXPR length "${WRAP_STRING_AT_COLUMN}") + else() + math(EXPR length "${stringLength}") + endif() - string(SUBSTRING ${${WRAP_STRING_VARIABLE}} ${offset} ${length} line) - set(lines "${lines}\n${line}") + string(SUBSTRING ${${WRAP_STRING_VARIABLE}} ${offset} ${length} line) + set(lines "${lines}\n${line}") - math(EXPR stringLength "${stringLength} - ${length}") - math(EXPR offset "${offset} + ${length}") - endwhile() + math(EXPR stringLength "${stringLength} - ${length}") + math(EXPR offset "${offset} + ${length}") + endwhile() - set(${WRAP_STRING_VARIABLE} "${lines}" PARENT_SCOPE) + set(${WRAP_STRING_VARIABLE} "${lines}" PARENT_SCOPE) endfunction() -# Function to embed contents of a file as byte array in C/C++ header file(.h). The header file +# Script to embed contents of a file as byte array in C/C++ header file(.h). The header file # will contain a byte array and integer variable holding the size of the array. # Parameters # SOURCE_FILE - The path of source file whose contents will be embedded in the header file. @@ -42,45 +42,41 @@ endfunction() # useful if the source file is a text file and we want to use the file contents # as string. But the size variable holds size of the byte array without this # null byte. -# Usage: -# bin2h(SOURCE_FILE "Logo.png" HEADER_FILE "Logo.h" VARIABLE_NAME "LOGO_PNG") -function(BIN2H) - set(options APPEND NULL_TERMINATE) - set(oneValueArgs SOURCE_FILE VARIABLE_NAME HEADER_FILE) - cmake_parse_arguments(BIN2H "${options}" "${oneValueArgs}" "" ${ARGN}) +set(options APPEND NULL_TERMINATE) +set(oneValueArgs SOURCE_FILE VARIABLE_NAME HEADER_FILE) +# cmake_parse_arguments(BIN2H "${options}" "${oneValueArgs}" "" ${ARGN}) - # reads source file contents as hex string - file(READ ${BIN2H_SOURCE_FILE} hexString HEX) - string(LENGTH ${hexString} hexStringLength) +# reads source file contents as hex string +file(READ ${BIN2H_SOURCE_FILE} hexString HEX) +string(LENGTH ${hexString} hexStringLength) - # appends null byte if asked - if(BIN2H_NULL_TERMINATE) - set(hexString "${hexString}00") - endif() +# appends null byte if asked +if(BIN2H_NULL_TERMINATE) + set(hexString "${hexString}00") +endif() - # wraps the hex string into multiple lines at column 32(i.e. 16 bytes per line) - wrap_string(VARIABLE hexString AT_COLUMN 32) - math(EXPR arraySize "${hexStringLength} / 2") +# wraps the hex string into multiple lines at column 32(i.e. 16 bytes per line) +wrap_string(VARIABLE hexString AT_COLUMN 32) +math(EXPR arraySize "${hexStringLength} / 2") - # adds '0x' prefix and comma suffix before and after every byte respectively - string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1, " arrayValues ${hexString}) - # removes trailing comma - string(REGEX REPLACE ", $" "" arrayValues ${arrayValues}) +# adds '0x' prefix and comma suffix before and after every byte respectively +string(REGEX REPLACE "([0-9a-f][0-9a-f])" "0x\\1, " arrayValues ${hexString}) +# removes trailing comma +string(REGEX REPLACE ", $" "" arrayValues ${arrayValues}) - # converts the variable name into proper C identifier - IF (${CMAKE_VERSION} GREATER 2.8.10) # fix for legacy cmake - string(MAKE_C_IDENTIFIER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) - ENDIF() - string(TOUPPER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) +# converts the variable name into proper C identifier +IF (${CMAKE_VERSION} GREATER 2.8.10) # fix for legacy cmake + string(MAKE_C_IDENTIFIER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) +ENDIF() +string(TOUPPER "${BIN2H_VARIABLE_NAME}" BIN2H_VARIABLE_NAME) - # declares byte array and the length variables - set(arrayDefinition "const unsigned char ${BIN2H_VARIABLE_NAME}[] = { ${arrayValues} };") - set(arraySizeDefinition "const size_t ${BIN2H_VARIABLE_NAME}_SIZE = ${arraySize};") +# declares byte array and the length variables +set(arrayDefinition "const unsigned char ${BIN2H_VARIABLE_NAME}[] = { ${arrayValues} };") +set(arraySizeDefinition "const size_t ${BIN2H_VARIABLE_NAME}_SIZE = ${arraySize};") - set(declarations "${arrayDefinition}\n\n${arraySizeDefinition}\n\n") - if(BIN2H_APPEND) - file(APPEND ${BIN2H_HEADER_FILE} "${declarations}") - else() - file(WRITE ${BIN2H_HEADER_FILE} "${declarations}") - endif() -endfunction() +set(declarations "${arrayDefinition}\n\n${arraySizeDefinition}\n\n") +if(BIN2H_APPEND) + file(APPEND ${BIN2H_HEADER_FILE} "${declarations}") +else() + file(WRITE ${BIN2H_HEADER_FILE} "${declarations}") +endif() From faafba12fa4d8696e57760b9367ac80d3d23e94f Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jun 2015 18:51:29 +0200 Subject: [PATCH 094/169] Storage array reference test. --- test/libsolidity/SolidityEndToEndTest.cpp | 53 +++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index f4d875e77..66a8f8820 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4257,6 +4257,59 @@ BOOST_AUTO_TEST_CASE(return_string) // BOOST_CHECK(callContractFunction("s()") == args); } +BOOST_AUTO_TEST_CASE(storage_array_ref) +{ + char const* sourceCode = R"( + contract BinarySearch { + /// Finds the position of _value in the sorted list _data. + /// Note that "internal" is important here, because storage references only work for internal or private functions + function find(uint[] storage _data, uint _value) internal returns (uint o_position) { + return find(_data, 0, _data.length, _value); + } + function find(uint[] storage _data, uint _begin, uint _len, uint _value) private returns (uint o_position) { + if (_len == 0 || (_len == 1 && _data[_begin] != _value)) + return uint(-1); // failure + uint halfLen = _len / 2; + uint v = _data[_begin + halfLen]; + if (_value < v) + return find(_data, _begin, halfLen, _value); + else if (_value > v) + return find(_data, _begin + halfLen + 1, halfLen - 1, _value); + else + return _begin + halfLen; + } + } + + contract Store is BinarySearch { + uint[] data; + function add(uint v) { + data.length++; + data[data.length - 1] = v; + } + function find(uint v) returns (uint) { + return find(data, v); + } + } + )"; + compileAndRun(sourceCode, 0, "Store"); + BOOST_REQUIRE(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(-1))); + BOOST_REQUIRE(callContractFunction("add(uint256)", u256(7)) == encodeArgs()); + BOOST_REQUIRE(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(0))); + BOOST_CHECK(callContractFunction("add(uint256)", u256(11)) == encodeArgs()); + BOOST_CHECK(callContractFunction("add(uint256)", u256(17)) == encodeArgs()); + BOOST_CHECK(callContractFunction("add(uint256)", u256(27)) == encodeArgs()); + BOOST_CHECK(callContractFunction("add(uint256)", u256(31)) == encodeArgs()); + BOOST_CHECK(callContractFunction("add(uint256)", u256(32)) == encodeArgs()); + BOOST_CHECK(callContractFunction("add(uint256)", u256(66)) == encodeArgs()); + BOOST_CHECK(callContractFunction("add(uint256)", u256(177)) == encodeArgs()); + BOOST_CHECK(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(0))); + BOOST_CHECK(callContractFunction("find(uint256)", u256(27)) == encodeArgs(u256(3))); + BOOST_CHECK(callContractFunction("find(uint256)", u256(32)) == encodeArgs(u256(5))); + BOOST_CHECK(callContractFunction("find(uint256)", u256(176)) == encodeArgs(u256(-1))); + BOOST_CHECK(callContractFunction("find(uint256)", u256(0)) == encodeArgs(u256(-1))); + BOOST_CHECK(callContractFunction("find(uint256)", u256(400)) == encodeArgs(u256(-1))); +} + BOOST_AUTO_TEST_SUITE_END() } From 18127c1b4e5df7546b7c18c968c83ee231438006 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 21:23:05 +0200 Subject: [PATCH 095/169] continue syncing refactoring --- libethereum/BlockChainSync.cpp | 510 +++++++++++++++++++-------------- libethereum/BlockChainSync.h | 153 +++++++--- libethereum/BlockQueue.cpp | 31 +- libethereum/BlockQueue.h | 4 + libethereum/EthereumHost.cpp | 5 + libethereum/EthereumHost.h | 1 + libethereum/EthereumPeer.h | 5 +- 7 files changed, 443 insertions(+), 266 deletions(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index ed43e0786..64de5f590 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file EthereumHost.cpp +/** @file BlockChainSync.cpp * @author Gav Wood * @date 2014 */ @@ -22,30 +22,32 @@ #include "BlockChainSync.h" #include -#include #include #include #include #include #include #include "BlockChain.h" -#include "TransactionQueue.h" #include "BlockQueue.h" #include "EthereumPeer.h" #include "EthereumHost.h" #include "DownloadMan.h" + using namespace std; using namespace dev; using namespace dev::eth; using namespace p2p; - unsigned const c_chainReorgSize = 30000; - BlockChainSync::BlockChainSync(EthereumHost& _host): m_host(_host) { + m_bqRoomAvailable = host().bq().onRoomAvailable([this]() + { + RecursiveGuard l(x_sync); + continueSync(); + }); } BlockChainSync::~BlockChainSync() @@ -69,9 +71,27 @@ void BlockChainSync::abortSync() downloadMan().resetToChain(h256s()); } -void BlockChainSync::onPeerStatus(EthereumPeer*) +void BlockChainSync::onPeerStatus(EthereumPeer* _peer) { - + RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; + if (_peer->m_genesisHash != host().chain().genesisHash()) + _peer->disable("Invalid genesis hash"); + else if (_peer->m_protocolVersion != host().protocolVersion() && _peer->m_protocolVersion != EthereumHost::c_oldProtocolVersion) + _peer->disable("Invalid protocol version."); + else if (_peer->m_networkId != host().networkId()) + _peer->disable("Invalid network identifier."); + else if (_peer->session()->info().clientVersion.find("/v0.7.0/") != string::npos) + _peer->disable("Blacklisted client version."); + else if (host().isBanned(_peer->session()->id())) + _peer->disable("Peer banned for previous bad behaviour."); + else + { + unsigned estimatedHashes = estimateHashes(); + _peer->m_expectedHashes = estimatedHashes; + onNewPeer(_peer); + } + DEV_INVARIANT_CHECK; } unsigned BlockChainSync::estimateHashes() @@ -88,9 +108,183 @@ unsigned BlockChainSync::estimateHashes() return blockCount; } +void BlockChainSync::requestBlocks(EthereumPeer* _peer) +{ + if (host().bq().knownFull()) + { + clog(NetAllDetail) << "Waiting for block queue before downloading blocks"; + m_lastActiveState = m_state; + pauseSync(); + _peer->setIdle(); + return; + } + _peer->requestBlocks(); + if (_peer->m_asking != Asking::Blocks) //nothing to download + { + peerDoneBlocks(_peer); + if (downloadMan().isComplete()) + completeSync(); + return; + } +} + +void BlockChainSync::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) +{ + RecursiveGuard l(x_sync); + DEV_INVARIANT_CHECK; + unsigned itemCount = _r.itemCount(); + clog(NetMessageSummary) << "Blocks (" << dec << itemCount << "entries)" << (itemCount ? "" : ": NoMoreBlocks"); + + _peer->setIdle(); + if (m_state != SyncState::Blocks && m_state != SyncState::NewBlocks) + clog(NetWarn) << "Unexpected Blocks received!"; + if (m_state == SyncState::Waiting) + { + clog(NetAllDetail) << "Ignored blocks while waiting"; + return; + } + + if (itemCount == 0) + { + // Got to this peer's latest block - just give up. + peerDoneBlocks(_peer); + if (downloadMan().isComplete()) + completeSync(); + return; + } + + unsigned success = 0; + unsigned future = 0; + unsigned unknown = 0; + unsigned got = 0; + unsigned repeated = 0; + u256 maxUnknownNumber = 0; + h256 maxUnknown; + + for (unsigned i = 0; i < itemCount; ++i) + { + auto h = BlockInfo::headerHash(_r[i].data()); + if (_peer->m_sub.noteBlock(h)) + { + _peer->addRating(10); + switch (host().bq().import(_r[i].data(), host().chain())) + { + case ImportResult::Success: + success++; + break; + + case ImportResult::Malformed: + case ImportResult::BadChain: + _peer->disable("Malformed block received."); + return; + + case ImportResult::FutureTimeKnown: + future++; + break; + case ImportResult::AlreadyInChain: + case ImportResult::AlreadyKnown: + got++; + break; + + case ImportResult::FutureTimeUnkwnown: + future++; //Fall through + + case ImportResult::UnknownParent: + { + unknown++; + if (m_state == SyncState::NewBlocks) + { + BlockInfo bi; + bi.populateFromHeader(_r[i][0]); + if (bi.number > maxUnknownNumber) + { + maxUnknownNumber = bi.number; + maxUnknown = h; + } + } + break; + } + + default:; + } + } + else + { + _peer->addRating(0); // -1? + repeated++; + } + } + + clog(NetMessageSummary) << dec << success << "imported OK," << unknown << "with unknown parents," << future << "with future timestamps," << got << " already known," << repeated << " repeats received."; + + if (host().bq().unknownFull()) + { + clog(NetWarn) << "Too many unknown blocks, restarting sync"; + restartSync(); + return; + } + + if (m_state == SyncState::NewBlocks && unknown > 0) + resetSyncFor(_peer, maxUnknown, std::numeric_limits::max()); //TODO: proper total difficuty + else if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) + { + if (downloadMan().isComplete()) + completeSync(); + else if (!got) + requestBlocks(_peer); + else + peerDoneBlocks(_peer); + } + DEV_INVARIANT_CHECK; +} + +void BlockChainSync::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) +{ + DEV_INVARIANT_CHECK; + RecursiveGuard l(x_sync); + auto h = BlockInfo::headerHash(_r[0].data()); + clog(NetMessageSummary) << "NewBlock: " << h; + + if (_r.itemCount() != 2) + _peer->disable("NewBlock without 2 data fields."); + else + { + switch (host().bq().import(_r[0].data(), host().chain())) + { + case ImportResult::Success: + _peer->addRating(100); + break; + case ImportResult::FutureTimeKnown: + //TODO: Rating dependent on how far in future it is. + break; + + case ImportResult::Malformed: + case ImportResult::BadChain: + _peer->disable("Malformed block received."); + return; + + case ImportResult::AlreadyInChain: + case ImportResult::AlreadyKnown: + break; + + case ImportResult::FutureTimeUnkwnown: + case ImportResult::UnknownParent: + clog(NetMessageSummary) << "Received block with no known parent. Resyncing..."; + resetSyncFor(_peer, h, _r[1].toInt()); + break; + default:; + } + + DEV_GUARDED(_peer->x_knownBlocks) + _peer->m_knownBlocks.insert(h); + } + DEV_INVARIANT_CHECK; +} + PV60Sync::PV60Sync(EthereumHost& _host): BlockChainSync(_host) { + resetSync(); } SyncStatus PV60Sync::status() const @@ -123,13 +317,44 @@ void PV60Sync::setState(EthereumPeer* _peer, SyncState _s, bool _isSyncing, bool changeSyncer(nullptr, _needHelp); assert(!!m_syncer || _s == SyncState::Idle); +} - if (!_isSyncing) - { - m_syncingLatestHash = h256(); - m_syncingTotalDifficulty = 0; - m_syncingNeededBlocks.clear(); - } +void PV60Sync::resetSync() +{ + m_syncingLatestHash = h256(); + m_syncingLastReceivedHash = h256(); + m_syncingTotalDifficulty = 0; + m_syncingNeededBlocks.clear(); +} + +void PV60Sync::restartSync() +{ + resetSync(); + host().bq().clear(); + if (isSyncing()) + transition(m_syncer, SyncState::Idle); +} + +void PV60Sync::completeSync() +{ + if (isSyncing()) + transition(m_syncer, SyncState::Idle); +} + +void PV60Sync::pauseSync() +{ + if (isSyncing()) + setState(m_syncer, SyncState::Waiting, true); +} + +void PV60Sync::continueSync() +{ + transition(m_syncer, SyncState::Blocks); +} + +void PV60Sync::onNewPeer(EthereumPeer* _peer) +{ + setNeedsSyncing(_peer, _peer->m_latestHash, _peer->m_totalDifficulty); } void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _needHelp) @@ -151,7 +376,7 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ m_syncingLatestHash = _peer->m_latestHash; m_syncingTotalDifficulty = _peer->m_totalDifficulty; setState(_peer, _s, true); - _peer->requestHashes(m_syncingLatestHash); + _peer->requestHashes(m_syncingLastReceivedHash ? m_syncingLastReceivedHash : m_syncingLatestHash); DEV_INVARIANT_CHECK; return; } @@ -175,22 +400,23 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ clog(NetWarn) << "Bad state: asking for Hashes yet not syncing!"; return; } - if (shouldGrabBlocks(_peer)) + if (shouldGrabBlocks()) { clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash << ", was" << host().latestBlockSent() << "]"; downloadMan().resetToChain(m_syncingNeededBlocks); + resetSync(); } else { clog(NetNote) << "Difficulty of hashchain not HIGHER. Ignoring."; - m_syncingLatestHash = h256(); + resetSync(); setState(_peer, SyncState::Idle, false); return; } assert (isSyncing(_peer)); } // run through into... - if (m_state == SyncState::Idle || m_state == SyncState::Hashes || m_state == SyncState::Blocks) + if (m_state == SyncState::Idle || m_state == SyncState::Hashes || m_state == SyncState::Blocks || m_state == SyncState::Waiting) { // Looks like it's the best yet for total difficulty. Set to download. setState(_peer, SyncState::Blocks, isSyncing(_peer), _needHelp); // will kick off other peers to help if available. @@ -201,7 +427,7 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ } else if (_s == SyncState::NewBlocks) { - if (m_state != SyncState::Idle && m_state != SyncState::NewBlocks) + if (m_state != SyncState::Idle && m_state != SyncState::NewBlocks && m_state != SyncState::Waiting) clog(NetWarn) << "Bad state: Asking new blocks while syncing!"; else { @@ -211,6 +437,16 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ return; } } + else if (_s == SyncState::Waiting) + { + if (m_state != SyncState::Blocks && m_state != SyncState::NewBlocks && m_state != SyncState::Hashes && m_state != SyncState::Waiting) + clog(NetWarn) << "Bad state: Entering waiting state while not downloading blocks!"; + else + { + setState(_peer, SyncState::Waiting, isSyncing(_peer), _needHelp); + return; + } + } else if (_s == SyncState::Idle) { host().foreachPeer([this](EthereumPeer* _p) { _p->setIdle(); return true; }); @@ -240,16 +476,9 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ clog(NetWarn) << "Invalid state transition:" << EthereumHost::stateName(_s) << "from" << EthereumHost::stateName(m_state) << ", " << (isSyncing(_peer) ? "syncing" : "holding") << (needsSyncing(_peer) ? "& needed" : ""); } -void PV60Sync::requestBlocks(EthereumPeer* _peer) +void PV60Sync::resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) { - _peer->requestBlocks(); - if (_peer->m_asking != Asking::Blocks) //nothing to download - { - noteDoneBlocks(_peer, false); - if (downloadMan().isComplete()) - transition(_peer, SyncState::Idle); - return; - } + setNeedsSyncing(_peer, _latestHash, _td); } void PV60Sync::setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td) @@ -263,16 +492,21 @@ void PV60Sync::setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td) _peer->session()->addNote("sync", string(isSyncing(_peer) ? "ongoing" : "holding") + (needsSyncing(_peer) ? " & needed" : "")); } +bool PV60Sync::needsSyncing(EthereumPeer* _peer) const +{ + return !!_peer->m_latestHash; +} + bool PV60Sync::isSyncing(EthereumPeer* _peer) const { return m_syncer == _peer; } -bool PV60Sync::shouldGrabBlocks(EthereumPeer* _peer) const +bool PV60Sync::shouldGrabBlocks() const { - auto td = _peer->m_totalDifficulty; - auto lh = _peer->m_latestHash; - auto ctd = host().chain().details().totalDifficulty; + auto td = m_syncingTotalDifficulty; + auto lh = m_syncingLatestHash; + auto ctd = host().chain().details().totalDifficulty; if (m_syncingNeededBlocks.empty()) return false; @@ -300,11 +534,12 @@ void PV60Sync::attemptSync(EthereumPeer* _peer) return; } - h256 c = host().chain().currentHash(); unsigned n = host().chain().number(); u256 td = host().chain().details().totalDifficulty; + if (host().bq().isActive()) + td += host().bq().difficulty(); - clog(NetAllDetail) << "Attempt chain-grab? Latest:" << c << ", number:" << n << ", TD:" << td << " versus " << _peer->m_totalDifficulty; + clog(NetAllDetail) << "Attempt chain-grab? Latest:" << (m_syncingLastReceivedHash ? m_syncingLastReceivedHash : m_syncingLatestHash) << ", number:" << n << ", TD:" << td << " versus " << _peer->m_totalDifficulty; if (td >= _peer->m_totalDifficulty) { clog(NetAllDetail) << "No. Our chain is better."; @@ -326,7 +561,7 @@ void PV60Sync::noteNeedsSyncing(EthereumPeer* _peer) { clog(NetAllDetail) << "Sync in progress: Just set to help out."; if (m_state == SyncState::Blocks) - _peer->requestBlocks(); + requestBlocks(_peer); } else // otherwise check to see if we should be downloading... @@ -370,6 +605,11 @@ void PV60Sync::changeSyncer(EthereumPeer* _syncer, bool _needHelp) assert(!!m_syncer || m_state == SyncState::Idle); } +void PV60Sync::peerDoneBlocks(EthereumPeer* _peer) +{ + noteDoneBlocks(_peer, false); +} + void PV60Sync::noteDoneBlocks(EthereumPeer* _peer, bool _clemency) { resetNeedsSyncing(_peer); @@ -399,125 +639,6 @@ void PV60Sync::noteDoneBlocks(EthereumPeer* _peer, bool _clemency) _peer->m_sub.doneFetch(); } -void PV60Sync::onPeerStatus(EthereumPeer* _peer) -{ - RecursiveGuard l(x_sync); - DEV_INVARIANT_CHECK; - if (_peer->m_genesisHash != host().chain().genesisHash()) - _peer->disable("Invalid genesis hash"); - else if (_peer->m_protocolVersion != host().protocolVersion() && _peer->m_protocolVersion != EthereumHost::c_oldProtocolVersion) - _peer->disable("Invalid protocol version."); - else if (_peer->m_networkId != host().networkId()) - _peer->disable("Invalid network identifier."); - else if (_peer->session()->info().clientVersion.find("/v0.7.0/") != string::npos) - _peer->disable("Blacklisted client version."); - else if (host().isBanned(_peer->session()->id())) - _peer->disable("Peer banned for previous bad behaviour."); - else - { - unsigned estimatedHashes = estimateHashes(); - _peer->m_expectedHashes = estimatedHashes; - setNeedsSyncing(_peer, _peer->m_latestHash, _peer->m_totalDifficulty); - } - DEV_INVARIANT_CHECK; -} - -void PV60Sync::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) -{ - RecursiveGuard l(x_sync); - DEV_INVARIANT_CHECK; - unsigned itemCount = _r.itemCount(); - clog(NetMessageSummary) << "Blocks (" << dec << itemCount << "entries)" << (itemCount ? "" : ": NoMoreBlocks"); - - _peer->setIdle(); - if (m_state != SyncState::Blocks && m_state != SyncState::NewBlocks) - clog(NetWarn) << "Unexpected Blocks received!"; - - if (itemCount == 0) - { - // Got to this peer's latest block - just give up. - noteDoneBlocks(_peer, false); - if (downloadMan().isComplete()) - transition(_peer, SyncState::Idle); - return; - } - - unsigned success = 0; - unsigned future = 0; - unsigned unknown = 0; - unsigned got = 0; - unsigned repeated = 0; - u256 maxDifficulty = 0; - h256 maxUnknown; - - for (unsigned i = 0; i < itemCount; ++i) - { - auto h = BlockInfo::headerHash(_r[i].data()); - if (_peer->m_sub.noteBlock(h)) - { - _peer->addRating(10); - switch (host().bq().import(_r[i].data(), host().chain())) - { - case ImportResult::Success: - success++; - break; - - case ImportResult::Malformed: - case ImportResult::BadChain: - _peer->disable("Malformed block received."); - return; - - case ImportResult::FutureTimeKnown: - future++; - break; - case ImportResult::AlreadyInChain: - case ImportResult::AlreadyKnown: - got++; - break; - - case ImportResult::FutureTimeUnkwnown: - future++; //Fall through - - case ImportResult::UnknownParent: - { - unknown++; - if (m_state == SyncState::NewBlocks) - { - BlockInfo bi; - bi.populateFromHeader(_r[i][0]); - if (bi.difficulty > maxDifficulty) - { - maxDifficulty = bi.difficulty; - maxUnknown = h; - } - } - break; - } - - default:; - } - } - else - { - _peer->addRating(0); // -1? - repeated++; - } - } - - clog(NetMessageSummary) << dec << success << "imported OK," << unknown << "with unknown parents," << future << "with future timestamps," << got << " already known," << repeated << " repeats received."; - - if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) - { - if (downloadMan().isComplete()) - transition(_peer, SyncState::Idle); - else if (!got) - transition(_peer, m_state); - else - noteDoneBlocks(_peer, false); - } - DEV_INVARIANT_CHECK; -} - void PV60Sync::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) { RecursiveGuard l(x_sync); @@ -565,9 +686,7 @@ void PV60Sync::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) if (m_syncingNeededBlocks.size() > _peer->m_expectedHashes) { _peer->disable("Too many hashes"); - m_syncingNeededBlocks.clear(); - m_syncingLatestHash = h256(); - transition(_peer, SyncState::Idle); + restartSync(); return; } // run through - ask for more. @@ -575,66 +694,6 @@ void PV60Sync::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) DEV_INVARIANT_CHECK; } - -void PV60Sync::abortSync(EthereumPeer* _peer) -{ - if (isSyncing(_peer)) - { - host().foreachPeer([this](EthereumPeer* _p) { _p->setIdle(); return true; }); - transition(_peer, SyncState::Idle, true); - } - DEV_INVARIANT_CHECK; -} - -void PV60Sync::onPeerAborting(EthereumPeer* _peer) -{ - abortSync(_peer); - DEV_INVARIANT_CHECK; -} - -void PV60Sync::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) -{ - DEV_INVARIANT_CHECK; - RecursiveGuard l(x_sync); - auto h = BlockInfo::headerHash(_r[0].data()); - clog(NetMessageSummary) << "NewBlock: " << h; - - if (_r.itemCount() != 2) - _peer->disable("NewBlock without 2 data fields."); - else - { - switch (host().bq().import(_r[0].data(), host().chain())) - { - case ImportResult::Success: - _peer->addRating(100); - break; - case ImportResult::FutureTimeKnown: - //TODO: Rating dependent on how far in future it is. - break; - - case ImportResult::Malformed: - case ImportResult::BadChain: - _peer->disable("Malformed block received."); - return; - - case ImportResult::AlreadyInChain: - case ImportResult::AlreadyKnown: - break; - - case ImportResult::FutureTimeUnkwnown: - case ImportResult::UnknownParent: - clog(NetMessageSummary) << "Received block with no known parent. Resyncing..."; - setNeedsSyncing(_peer, h, _r[1].toInt()); - break; - default:; - } - - DEV_GUARDED(_peer->x_knownBlocks) - _peer->m_knownBlocks.insert(h); - } - DEV_INVARIANT_CHECK; -} - void PV60Sync::onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) { RecursiveGuard l(x_sync); @@ -672,11 +731,28 @@ void PV60Sync::onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) { clog(NetNote) << "Not syncing and new block hash discovered: syncing without help."; downloadMan().resetToChain(m_syncingNeededBlocks); + resetSync(); transition(_peer, SyncState::NewBlocks, false, false); } DEV_INVARIANT_CHECK; } +void PV60Sync::abortSync(EthereumPeer* _peer) +{ + if (isSyncing(_peer)) + { + host().foreachPeer([this](EthereumPeer* _p) { _p->setIdle(); return true; }); + transition(_peer, SyncState::Idle, true); + } + DEV_INVARIANT_CHECK; +} + +void PV60Sync::onPeerAborting(EthereumPeer* _peer) +{ + abortSync(_peer); + DEV_INVARIANT_CHECK; +} + bool PV60Sync::invariants() const { if (m_state == SyncState::Idle && !!m_syncer) @@ -696,6 +772,8 @@ bool PV60Sync::invariants() const host().foreachPeer([&](EthereumPeer* _p) { if (_p->m_asking == Asking::Blocks) blocks = true; return !blocks; }); if (!blocks) return false; + if (downloadMan().isComplete()) + return false; } return true; } diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h index 2c3f61de6..1337c5c90 100644 --- a/libethereum/BlockChainSync.h +++ b/libethereum/BlockChainSync.h @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with cpp-ethereum. If not, see . */ -/** @file EthereumHost.h +/** @file BlockChainSync.h * @author Gav Wood * @date 2014 */ @@ -22,23 +22,14 @@ #pragma once #include -#include -#include -#include -#include -#include -#include #include -#include #include #include #include #include "CommonNet.h" -#include "EthereumPeer.h" //TODO: forward decl #include "DownloadMan.h" - namespace dev { @@ -49,98 +40,174 @@ namespace eth class EthereumHost; class BlockQueue; +class EthereumPeer; /** - * @brief BlockChain synchronization strategy class - * @doWork Syncs to peers and sends new blocks and transactions. + * @brief Base BlockChain synchronization strategy class. + * Syncs to peers and keeps up to date. Base class handles blocks downloading but does not contain any details on state transfer logic. */ class BlockChainSync: public HasInvariants { public: BlockChainSync(EthereumHost& _host); - - /// Will block on network process events. virtual ~BlockChainSync(); - void abortSync(); + void abortSync(); ///< Abort all sync activity DownloadMan const& downloadMan() const; DownloadMan& downloadMan(); + + /// @returns true is Sync is in progress virtual bool isSyncing() const = 0; - virtual void onPeerStatus(EthereumPeer* _peer); ///< Called by peer to report status - virtual void onPeerBlocks(EthereumPeer* _peer, RLP const& _r) = 0; ///< Called by peer once it has new blocks during syn - virtual void onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) = 0; ///< Called by peer once it has new blocks - virtual void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) = 0; ///< Called by peer once it has new hashes - virtual void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) = 0; ///< Called by peer once it has another sequential block of hashes during sync - virtual void onPeerAborting(EthereumPeer* _peer) = 0; ///< Called by peer when it is disconnecting + + /// Called by peer to report status + virtual void onPeerStatus(EthereumPeer* _peer); + + /// Called by peer once it has new blocks during syn + virtual void onPeerBlocks(EthereumPeer* _peer, RLP const& _r); + + /// Called by peer once it has new blocks + virtual void onPeerNewBlock(EthereumPeer* _peer, RLP const& _r); + + /// Called by peer once it has new hashes + virtual void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) = 0; + + /// Called by peer once it has another sequential block of hashes during sync + virtual void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) = 0; + + /// Called by peer when it is disconnecting + virtual void onPeerAborting(EthereumPeer* _peer) = 0; + + /// @returns Synchonization status virtual SyncStatus status() const = 0; static char const* stateName(SyncState _s) { return s_stateNames[static_cast(_s)]; } -private: - static char const* const s_stateNames[static_cast(SyncState::Size)]; +protected: + //To be implemented in derived classes: + /// New valid peer appears + virtual void onNewPeer(EthereumPeer* _peer) = 0; - void setState(SyncState _s); + /// Peer done downloading blocks + virtual void peerDoneBlocks(EthereumPeer* _peer) = 0; - bool invariants() const override = 0; + /// Resume downloading after witing state + virtual void continueSync() = 0; - EthereumHost& m_host; - Handler m_bqRoomAvailable; - HashDownloadMan m_hashMan; + /// Restart sync + virtual void restartSync() = 0; -protected: + /// Called after all blocks have been donloaded + virtual void completeSync() = 0; + + /// Enter waiting state + virtual void pauseSync() = 0; + + /// Restart sync for given peer + virtual void resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) = 0; EthereumHost& host() { return m_host; } EthereumHost const& host() const { return m_host; } + + /// Estimates max number of hashes peers can give us. unsigned estimateHashes(); + /// Request blocks from peer if needed + void requestBlocks(EthereumPeer* _peer); + +private: + static char const* const s_stateNames[static_cast(SyncState::Size)]; + bool invariants() const override = 0; + EthereumHost& m_host; + HashDownloadMan m_hashMan; + +protected: + Handler m_bqRoomAvailable; mutable RecursiveMutex x_sync; SyncState m_state = SyncState::Idle; ///< Current sync state SyncState m_lastActiveState = SyncState::Idle; ///< Saved state before entering waiting queue mode unsigned m_estimatedHashes = 0; ///< Number of estimated hashes for the last peer over PV60. Used for status reporting only. }; + +/** + * @brief Syncrhonization over PV60. Selects a single peer and tries to downloading hashes from it. After hash downaload is complete + * Syncs to peers and keeps up to date + */ class PV60Sync: public BlockChainSync { public: - PV60Sync(EthereumHost& _host); + /// @returns true is Sync is in progress bool isSyncing() const override { return !!m_syncer; } - void onPeerStatus(EthereumPeer* _peer) override; ///< Called by peer to report status - void onPeerBlocks(EthereumPeer* _peer, RLP const& _r) override; ///< Called by peer once it has new blocks during syn - void onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) override; ///< Called by peer once it has new blocks - void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) override; ///< Called by peer once it has new hashes - void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) override; ///< Called by peer once it has another sequential block of hashes during sync - void onPeerAborting(EthereumPeer* _peer) override; ///< Called by peer when it is disconnecting + + /// Called by peer once it has new hashes + void onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) override; + + /// Called by peer once it has another sequential block of hashes during sync + void onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) override; + + /// Called by peer when it is disconnecting + void onPeerAborting(EthereumPeer* _peer) override; + + /// @returns Sync status SyncStatus status() const override; + void onNewPeer(EthereumPeer* _peer) override; + void continueSync() override; + void peerDoneBlocks(EthereumPeer* _peer) override; + void restartSync() override; + void completeSync() override; + void pauseSync() override; + void resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) override; + +private: + /// Transition sync state in a particular direction. @param _peer Peer that is responsible for state tranfer void transition(EthereumPeer* _peer, SyncState _s, bool _force = false, bool _needHelp = true); + + /// Reset peer syncing requirements state. void resetNeedsSyncing(EthereumPeer* _peer) { setNeedsSyncing(_peer, h256(), 0); } - bool needsSyncing(EthereumPeer* _peer) const { return !!_peer->m_latestHash; } + /// Update peer syncing requirements state. void setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td); - bool shouldGrabBlocks(EthereumPeer* _peer) const; + + /// Do we presently need syncing with this peer? + bool needsSyncing(EthereumPeer* _peer) const; + + /// Check whether the session should bother grabbing blocks. + bool shouldGrabBlocks() const; + + /// Attempt to begin syncing with the peer; first check the peer has a more difficlult chain to download, then start asking for hashes, then move to blocks void attemptSync(EthereumPeer* _peer); + + /// Update our syncing state void setState(EthereumPeer* _peer, SyncState _s, bool _isSyncing = false, bool _needHelp = false); + + /// Check if peer is main syncer bool isSyncing(EthereumPeer* _peer) const; + + /// Check if we need (re-)syncing with the peer. void noteNeedsSyncing(EthereumPeer* _who); + + /// Set main syncing peer void changeSyncer(EthereumPeer* _syncer, bool _needHelp); + + /// Called when peer done downloading blocks void noteDoneBlocks(EthereumPeer* _who, bool _clemency); + + /// Abort syncing for peer void abortSync(EthereumPeer* _peer); - void requestBlocks(EthereumPeer* _peer); + /// Reset hash chain syncing + void resetSync(); -private: bool invariants() const override; - h256s m_knownHashes; ///< List of block hashes we need to download. - h256s m_syncingNeededBlocks; ///< The blocks that we should download from this peer. h256 m_syncingLastReceivedHash; ///< Hash most recently received from peer. h256 m_syncingLatestHash; ///< Peer's latest block's hash, as of the current sync. u256 m_syncingTotalDifficulty; ///< Peer's latest block's total difficulty, as of the current sync. EthereumPeer* m_syncer = nullptr; // TODO: switch to weak_ptr - }; } } diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index c8bbfc119..921e505fd 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -37,7 +37,7 @@ const char* BlockQueueChannel::name() { return EthOrange "[]>"; } const char* BlockQueueChannel::name() { return EthOrange "▣┅▶"; } #endif -size_t const c_maxKnownCount = 100000; +size_t const c_maxKnownCount = 10000; size_t const c_maxKnownSize = 128 * 1024 * 1024; size_t const c_maxUnknownCount = 100000; size_t const c_maxUnknownSize = 512 * 1024 * 1024; // Block size can be ~50kb @@ -81,6 +81,8 @@ void BlockQueue::clear() m_unknownCount = 0; m_knownSize = 0; m_knownCount = 0; + m_difficulty = 0; + m_drainingDifficulty = 0; } void BlockQueue::verifierBody() @@ -194,7 +196,6 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo // VERIFY: populates from the block and checks the block is internally coherent. BlockInfo bi; - try { // TODO: quick verify @@ -229,6 +230,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo cblockq << "OK - queued for future [" << bi.timestamp << "vs" << time(0) << "] - will wait until" << buf; m_unknownSize += _block.size(); m_unknownCount++; + m_difficulty += bi.difficulty; bool unknown = !m_readySet.count(bi.parentHash) && !m_drainingSet.count(bi.parentHash) && !_bc.isKnown(bi.parentHash); return unknown ? ImportResult::FutureTimeUnkwnown : ImportResult::FutureTimeKnown; } @@ -249,6 +251,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo m_unknown.insert(make_pair(bi.parentHash, make_pair(h, _block.toBytes()))); m_unknownSet.insert(h); m_unknownSize += _block.size(); + m_difficulty += bi.difficulty; m_unknownCount++; return ImportResult::UnknownParent; @@ -262,6 +265,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo m_moreToVerify.notify_one(); m_readySet.insert(h); m_knownSize += _block.size(); + m_difficulty += bi.difficulty; m_knownCount++; noteReady_WITH_LOCK(h); @@ -351,13 +355,16 @@ bool BlockQueue::doneDrain(h256s const& _bad) WriteGuard l(m_lock); DEV_INVARIANT_CHECK; m_drainingSet.clear(); + m_difficulty -= m_drainingDifficulty; + m_drainingDifficulty = 0; if (_bad.size()) { // at least one of them was bad. m_knownBad += _bad; for (h256 const& b : _bad) updateBad(b); - } return !m_readySet.empty(); + } + return !m_readySet.empty(); } void BlockQueue::tick(BlockChain const& _bc) @@ -434,6 +441,7 @@ void BlockQueue::drain(VerifiedBlocks& o_out, unsigned _max) if (m_drainingSet.empty()) { bool wasFull = knownFull(); + m_drainingDifficulty = 0; DEV_GUARDED(m_verification) { o_out.resize(min(_max, m_verified.size())); @@ -446,6 +454,7 @@ void BlockQueue::drain(VerifiedBlocks& o_out, unsigned _max) // TODO: @optimise use map rather than vector & set. auto h = bs.verified.info.hash(); m_drainingSet.insert(h); + m_drainingDifficulty += bs.verified.info.difficulty; m_readySet.erase(h); m_knownSize -= bs.verified.block.size(); m_knownCount--; @@ -525,3 +534,19 @@ std::ostream& dev::eth::operator<<(std::ostream& _out, BlockQueueStatus const& _ return _out; } + +u256 BlockQueue::difficulty() const +{ + UpgradableGuard l(m_lock); + return m_difficulty; +} + +bool BlockQueue::isActive() const +{ + UpgradableGuard l(m_lock); + if (m_readySet.empty() && m_drainingSet.empty()) + DEV_GUARDED(m_verification) + if (m_verified.empty() && m_verifying.empty() && m_unverified.empty()) + return false; + return true; +} diff --git a/libethereum/BlockQueue.h b/libethereum/BlockQueue.h index 8f079aa66..106c08534 100644 --- a/libethereum/BlockQueue.h +++ b/libethereum/BlockQueue.h @@ -117,6 +117,8 @@ public: bool knownFull() const; bool unknownFull() const; + u256 difficulty() const; // Total difficulty of queueud blocks + bool isActive() const; private: struct UnverifiedBlock @@ -158,6 +160,8 @@ private: std::atomic m_knownSize; ///< Tracks total size in bytes of all known blocks; std::atomic m_unknownCount; ///< Tracks total count of unknown blocks. Used to avoid additional syncing std::atomic m_knownCount; ///< Tracks total count of known blocks. Used to avoid additional syncing + u256 m_difficulty; ///< Total difficulty of blocks in the queue + u256 m_drainingDifficulty; ///< Total difficulty of blocks in draining }; std::ostream& operator<<(std::ostream& _out, BlockQueueStatus const& _s); diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index 8b8a7c305..64250ca90 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -289,6 +289,11 @@ void EthereumHost::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) void EthereumHost::onPeerTransactions(EthereumPeer* _peer, RLP const& _r) { + if (_peer->isCriticalSyncing()) + { + clog(NetAllDetail) << "Ignoring transaction from peer we are syncing with"; + return; + } unsigned itemCount = _r.itemCount(); clog(NetAllDetail) << "Transactions (" << dec << itemCount << "entries)"; Guard l(_peer->x_knownTransactions); diff --git a/libethereum/EthereumHost.h b/libethereum/EthereumHost.h index aed35c192..7dfba1b0d 100644 --- a/libethereum/EthereumHost.h +++ b/libethereum/EthereumHost.h @@ -80,6 +80,7 @@ public: BlockChain const& chain() const { return m_chain; } BlockQueue& bq() { return m_bq; } + BlockQueue const& bq() const { return m_bq; } SyncStatus status() const; h256 latestBlockSent() { return m_latestBlockSent; } static char const* stateName(SyncState _s) { return s_stateNames[static_cast(_s)]; } diff --git a/libethereum/EthereumPeer.h b/libethereum/EthereumPeer.h index 2ffbe9101..6993f9b1a 100644 --- a/libethereum/EthereumPeer.h +++ b/libethereum/EthereumPeer.h @@ -141,11 +141,8 @@ private: /// This is built as we ask for hashes. Once no more hashes are given, we present this to the /// host who initialises the DownloadMan and m_sub becomes active for us to begin asking for blocks. - h256 m_syncingLastReceivedHash; ///< Hash most recently received from peer. - h256 m_syncingLatestHash; ///< Peer's latest block's hash, as of the current sync. - u256 m_syncingTotalDifficulty; ///< Peer's latest block's total difficulty, as of the current sync. unsigned m_expectedHashes = 0; ///< Estimated upper bound of hashes to expect from this peer. - u256 m_syncHashNumber = 0; ///< Number of latest hash we sync to (PV61+) + u256 m_syncHashNumber = 0; ///< Number of latest hash we sync to (PV61+) h256 m_syncHash; ///< Latest hash we sync to (PV60) /// Once we're asking for blocks, this becomes in use. From d0cf2e94c8eb00961eb73d3fa108f3bb4d22d0c2 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 21:59:06 +0200 Subject: [PATCH 096/169] fixed syncing to unknown new block --- libethereum/BlockChainSync.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index 64de5f590..c8c81c37f 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -225,8 +225,11 @@ void BlockChainSync::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) } if (m_state == SyncState::NewBlocks && unknown > 0) + { + completeSync(); resetSyncFor(_peer, maxUnknown, std::numeric_limits::max()); //TODO: proper total difficuty - else if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) + } + if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) { if (downloadMan().isComplete()) completeSync(); From 18da764363f88e891466b5db2afac76961462584 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 22:04:20 +0200 Subject: [PATCH 097/169] restored queue limit --- libethereum/BlockQueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index 921e505fd..4555ecb2b 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -37,7 +37,7 @@ const char* BlockQueueChannel::name() { return EthOrange "[]>"; } const char* BlockQueueChannel::name() { return EthOrange "▣┅▶"; } #endif -size_t const c_maxKnownCount = 10000; +size_t const c_maxKnownCount = 100000; size_t const c_maxKnownSize = 128 * 1024 * 1024; size_t const c_maxUnknownCount = 100000; size_t const c_maxUnknownSize = 512 * 1024 * 1024; // Block size can be ~50kb From c0de6de5dba36a35280ee6f133f5049965615d57 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 17 Jun 2015 22:49:57 +0200 Subject: [PATCH 098/169] Fixed nodes format string. --- alethzero/MainWin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/alethzero/MainWin.cpp b/alethzero/MainWin.cpp index 848020cbc..e0d7311c4 100644 --- a/alethzero/MainWin.cpp +++ b/alethzero/MainWin.cpp @@ -1158,7 +1158,7 @@ void Main::refreshNetwork() auto ns = web3()->nodes(); for (p2p::Peer const& i: ns) - ui->nodes->insertItem(sessions.count(i.id) ? 0 : ui->nodes->count(), QString("[%1 %3] %2 - ( =%5s | /%4s%6 ) - *%7 $%8") + ui->nodes->insertItem(sessions.count(i.id) ? 0 : ui->nodes->count(), QString("[%1 %3] %2 - ( %4 ) - *%5") .arg(QString::fromStdString(i.id.abridged())) .arg(QString::fromStdString(i.endpoint.address.to_string())) .arg(i.id == web3()->id() ? "self" : sessions.count(i.id) ? sessions[i.id] : "disconnected") From 2fe2b202b8039d18fbb5bdfcc25ca7dbe895243c Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 23:21:07 +0200 Subject: [PATCH 099/169] fixed deadlock on resume --- libethereum/BlockChainSync.cpp | 1 - libethereum/BlockQueue.cpp | 52 ++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index c8c81c37f..bd0b10c7c 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -364,7 +364,6 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ { clog(NetMessageSummary) << "Transition!" << EthereumHost::stateName(_s) << "from" << EthereumHost::stateName(m_state) << ", " << (isSyncing(_peer) ? "syncing" : "holding") << (needsSyncing(_peer) ? "& needed" : ""); - //DEV_INVARIANT_CHECK; if (m_state == SyncState::Idle && _s != SyncState::Idle) _peer->m_requireTransactions = true; diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index 4555ecb2b..254bf3300 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -37,7 +37,7 @@ const char* BlockQueueChannel::name() { return EthOrange "[]>"; } const char* BlockQueueChannel::name() { return EthOrange "▣┅▶"; } #endif -size_t const c_maxKnownCount = 100000; +size_t const c_maxKnownCount = 10000; size_t const c_maxKnownSize = 128 * 1024 * 1024; size_t const c_maxUnknownCount = 100000; size_t const c_maxUnknownSize = 512 * 1024 * 1024; // Block size can be ~50kb @@ -196,6 +196,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo // VERIFY: populates from the block and checks the block is internally coherent. BlockInfo bi; + try { // TODO: quick verify @@ -435,34 +436,35 @@ bool BlockQueue::unknownFull() const void BlockQueue::drain(VerifiedBlocks& o_out, unsigned _max) { - WriteGuard l(m_lock); - DEV_INVARIANT_CHECK; - - if (m_drainingSet.empty()) + bool wasFull = false; + DEV_WRITE_GUARDED(m_lock) { - bool wasFull = knownFull(); - m_drainingDifficulty = 0; - DEV_GUARDED(m_verification) - { - o_out.resize(min(_max, m_verified.size())); - for (unsigned i = 0; i < o_out.size(); ++i) - swap(o_out[i], m_verified[i]); - m_verified.erase(m_verified.begin(), advanced(m_verified.begin(), o_out.size())); - } - for (auto const& bs: o_out) + DEV_INVARIANT_CHECK; + wasFull = knownFull(); + if (m_drainingSet.empty()) { - // TODO: @optimise use map rather than vector & set. - auto h = bs.verified.info.hash(); - m_drainingSet.insert(h); - m_drainingDifficulty += bs.verified.info.difficulty; - m_readySet.erase(h); - m_knownSize -= bs.verified.block.size(); - m_knownCount--; + m_drainingDifficulty = 0; + DEV_GUARDED(m_verification) + { + o_out.resize(min(_max, m_verified.size())); + for (unsigned i = 0; i < o_out.size(); ++i) + swap(o_out[i], m_verified[i]); + m_verified.erase(m_verified.begin(), advanced(m_verified.begin(), o_out.size())); + } + for (auto const& bs: o_out) + { + // TODO: @optimise use map rather than vector & set. + auto h = bs.verified.info.hash(); + m_drainingSet.insert(h); + m_drainingDifficulty += bs.verified.info.difficulty; + m_readySet.erase(h); + m_knownSize -= bs.verified.block.size(); + m_knownCount--; + } } - if (wasFull && !knownFull()) - m_onRoomAvailable(); } - + if (wasFull && !knownFull()) + m_onRoomAvailable(); } bool BlockQueue::invariants() const From 4918b7e9dd1f055006806cdb9f284b111d41c31b Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 23:22:49 +0200 Subject: [PATCH 100/169] restore limit --- libethereum/BlockQueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index 254bf3300..f23c7ba52 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -37,7 +37,7 @@ const char* BlockQueueChannel::name() { return EthOrange "[]>"; } const char* BlockQueueChannel::name() { return EthOrange "▣┅▶"; } #endif -size_t const c_maxKnownCount = 10000; +size_t const c_maxKnownCount = 100000; size_t const c_maxKnownSize = 128 * 1024 * 1024; size_t const c_maxUnknownCount = 100000; size_t const c_maxUnknownSize = 512 * 1024 * 1024; // Block size can be ~50kb From 2110876e2e7831d832d55877e7e41e7792954543 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 23:27:42 +0200 Subject: [PATCH 101/169] typo fixed --- libethcore/Common.h | 2 +- libethereum/BlockChainSync.cpp | 4 ++-- libethereum/BlockQueue.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libethcore/Common.h b/libethcore/Common.h index 77ec9fa3b..060860a95 100644 --- a/libethcore/Common.h +++ b/libethcore/Common.h @@ -101,7 +101,7 @@ enum class ImportResult Success = 0, UnknownParent, FutureTimeKnown, - FutureTimeUnkwnown, + FutureTimeUnknown, AlreadyInChain, AlreadyKnown, Malformed, diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index bd0b10c7c..bcc7f72f3 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -186,7 +186,7 @@ void BlockChainSync::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) got++; break; - case ImportResult::FutureTimeUnkwnown: + case ImportResult::FutureTimeUnknown: future++; //Fall through case ImportResult::UnknownParent: @@ -270,7 +270,7 @@ void BlockChainSync::onPeerNewBlock(EthereumPeer* _peer, RLP const& _r) case ImportResult::AlreadyKnown: break; - case ImportResult::FutureTimeUnkwnown: + case ImportResult::FutureTimeUnknown: case ImportResult::UnknownParent: clog(NetMessageSummary) << "Received block with no known parent. Resyncing..."; resetSyncFor(_peer, h, _r[1].toInt()); diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index f23c7ba52..394549076 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -233,7 +233,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo m_unknownCount++; m_difficulty += bi.difficulty; bool unknown = !m_readySet.count(bi.parentHash) && !m_drainingSet.count(bi.parentHash) && !_bc.isKnown(bi.parentHash); - return unknown ? ImportResult::FutureTimeUnkwnown : ImportResult::FutureTimeKnown; + return unknown ? ImportResult::FutureTimeUnknown : ImportResult::FutureTimeKnown; } else { From 4b2dfe48ea422751b517369b4c26a7838fe897d5 Mon Sep 17 00:00:00 2001 From: arkpar Date: Wed, 17 Jun 2015 23:32:21 +0200 Subject: [PATCH 102/169] fixed eth build --- eth/main.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eth/main.cpp b/eth/main.cpp index 43d865346..e1eec1cac 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -764,7 +764,8 @@ int main(int argc, char** argv) case ImportResult::Success: good++; break; case ImportResult::AlreadyKnown: alreadyHave++; break; case ImportResult::UnknownParent: unknownParent++; break; - case ImportResult::FutureTime: futureTime++; break; + case ImportResult::FutureTimeUnknown: unknownParent++; futureTime++; break; + case ImportResult::FutureTimeKnown: futureTime++; break; default: bad++; break; } } From 4e48ba1d4a1bf801626cac5e7e03672fae05079b Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Thu, 18 Jun 2015 00:44:20 +0200 Subject: [PATCH 103/169] false positive test introduced --- test/libwhisper/bloomFilter.cpp | 58 +++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/test/libwhisper/bloomFilter.cpp b/test/libwhisper/bloomFilter.cpp index adf76c429..799c4caf6 100644 --- a/test/libwhisper/bloomFilter.cpp +++ b/test/libwhisper/bloomFilter.cpp @@ -55,8 +55,66 @@ void testRemoveExistingBloom(TopicBloomFilter& _f, AbridgedTopic const& _h) BOOST_REQUIRE(!_f.containsBloom(_h)); } +int calculateExpected(TopicBloomFilter const& f, int const n) +{ + int const m = f.size * 8; // number of bits in the bloom + int const k = f.BitsPerBloom; // number of hash functions (e.g. bits set to 1 in every bloom) + + double singleBitSet = 1.0 / m; // probability of any bit being set after inserting a single bit + double singleBitNotSet = (1.0 - singleBitSet); + + double singleNot = 1; // single bit not set after inserting N elements in the bloom filter + for (int i = 0; i < k * n; ++i) + singleNot *= singleBitNotSet; + + double single = 1.0 - singleNot; // probability of a single bit being set after inserting N elements in the bloom filter + + double kBitsSet = 1; // probability of K bits being set after inserting N elements in the bloom filter + for (int i = 0; i < k; ++i) + kBitsSet *= single; + + return static_cast(kBitsSet * 100 + 0.5); // in percents, rounded up +} + +void testFalsePositiveRate(TopicBloomFilter const& f, int const inserted, Topic& x) +{ + int const c_sampleSize = 1000; + int falsePositive = 0; + + for (int i = 0; i < c_sampleSize; ++i) + { + x = sha3(x); + AbridgedTopic a(x); + if (f.containsBloom(a)) + ++falsePositive; + } + + falsePositive /= (c_sampleSize / 100); // in percents + int expected = calculateExpected(f, inserted); + int allowed = expected + (expected / 5); // allow deviations ~20% + + //cnote << "Inserted: " << inserted << ", False Positive Rate: " << falsePositive << ", Expected: " << expected; + BOOST_REQUIRE(falsePositive <= allowed); +} + BOOST_AUTO_TEST_SUITE(bloomFilter) +BOOST_AUTO_TEST_CASE(falsePositiveRate) +{ + VerbosityHolder setTemporaryLevel(10); + cnote << "Testing Bloom Filter False Positive Rate..."; + + TopicBloomFilter f; + Topic x(0xABCDEF); // deterministic pseudorandom value + + for (int i = 1; i < 21; ++i) + { + x = sha3(x); + f.addBloom(AbridgedTopic(x)); + testFalsePositiveRate(f, i, x); + } +} + BOOST_AUTO_TEST_CASE(bloomFilterRandom) { VerbosityHolder setTemporaryLevel(10); From 3169341b656ae561322a51108d45df6a9aecd543 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 18 Jun 2015 08:00:16 +0200 Subject: [PATCH 104/169] add network flag --- test/TestHelper.cpp | 5 ++++- test/TestHelper.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 743b16273..4e1ad92b4 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -754,6 +754,8 @@ Options::Options() checkState = true; else if (arg == "--wallet") wallet = true; + else if (arg == "--network") + network = true; else if (arg == "--all") { performance = true; @@ -761,7 +763,8 @@ Options::Options() memory = true; inputLimits = true; bigData = true; - wallet= true; + wallet = true; + network = true; } else if (arg == "--singletest" && i + 1 < argc) { diff --git a/test/TestHelper.h b/test/TestHelper.h index df33c00d8..ab52a550c 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -223,6 +223,7 @@ public: bool inputLimits = false; bool bigData = false; bool wallet = false; + bool network = false; /// @} /// Get reference to options From 00d8627d3512115a12fe616ee81845854b8c597b Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 18 Jun 2015 08:00:46 +0200 Subject: [PATCH 105/169] make network tests optional --- test/libp2p/peer.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/libp2p/peer.cpp b/test/libp2p/peer.cpp index bcb6d4085..5fea9225e 100644 --- a/test/libp2p/peer.cpp +++ b/test/libp2p/peer.cpp @@ -24,6 +24,8 @@ #include #include #include +#include + using namespace std; using namespace dev; using namespace dev::p2p; @@ -38,6 +40,9 @@ BOOST_FIXTURE_TEST_SUITE(p2p, P2PFixture) BOOST_AUTO_TEST_CASE(host) { + if (!test::Options::get().network) + return; + VerbosityHolder sentinel(10); NetworkPreferences host1prefs("127.0.0.1", 30301, false); @@ -64,6 +69,9 @@ BOOST_AUTO_TEST_CASE(host) BOOST_AUTO_TEST_CASE(networkConfig) { + if (!test::Options::get().network) + return; + Host save("Test", NetworkPreferences(false)); bytes store(save.saveNetwork()); @@ -73,6 +81,9 @@ BOOST_AUTO_TEST_CASE(networkConfig) BOOST_AUTO_TEST_CASE(saveNodes) { + if (!test::Options::get().network) + return; + VerbosityHolder reduceVerbosity(2); std::list hosts; From 3302539a11a646912ecbacec8db49450d30d6d1b Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 18 Jun 2015 10:05:41 +0200 Subject: [PATCH 106/169] OpenCL: Always try single chunk DAG upload - Removed the `--force-single-chunk` option - Always attempt to create a single chunk DAG buffer in the GPU. If that fails then and only then switch to multiple chunks. This change is motivated by the fact that many GPUs appear to be able to actually allocate a lot more than what CL_DEVICE_MAX_MEM_ALLOC_SIZE returns which proves that the results of querying the CL API on this basically can't be trusted. --- ethminer/MinerAux.h | 11 ++---- libethash-cl/ethash_cl_miner.cpp | 61 ++++++++++++++------------------ libethash-cl/ethash_cl_miner.h | 3 -- libethcore/Ethash.cpp | 3 +- libethcore/Ethash.h | 3 +- 5 files changed, 31 insertions(+), 50 deletions(-) diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index 3351b90de..a609754dd 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -134,8 +134,6 @@ public: m_clAllowCPU = true; else if (arg == "--cl-extragpu-mem" && i + 1 < argc) m_extraGPUMemory = 1000000 * stol(argv[++i]); - else if (arg == "--force-single-chunk") - m_forceSingleChunk = true; else if (arg == "--phone-home" && i + 1 < argc) { string m = argv[++i]; @@ -273,7 +271,6 @@ public: m_openclDevice, m_clAllowCPU, m_extraGPUMemory, - m_forceSingleChunk, m_currentBlock )) { @@ -318,10 +315,9 @@ public: << " --opencl-device When mining using -G/--opencl use OpenCL device n (default: 0)." << endl << " -t, --mining-threads Limit number of CPU/GPU miners to n (default: use everything available on selected platform)" << endl << " --allow-opencl-cpu Allows CPU to be considered as an OpenCL device if the OpenCL platform supports it." << endl - << " --list-devices List the detected OpenCL devices and exit." < m_currentBlock; // default value is 350MB of GPU memory for other stuff (windows system rendering, e.t.c.) unsigned m_extraGPUMemory = 350000000; diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index b160cdd94..2fc6102fb 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -140,12 +140,10 @@ unsigned ethash_cl_miner::getNumDevices(unsigned _platformId) bool ethash_cl_miner::configureGPU( bool _allowCPU, unsigned _extraGPUMemory, - bool _forceSingleChunk, boost::optional _currentBlock ) { s_allowCPU = _allowCPU; - s_forceSingleChunk = _forceSingleChunk; s_extraRequiredGPUMem = _extraGPUMemory; // by default let's only consider the DAG of the first epoch uint64_t dagSize = _currentBlock ? ethash_get_datasize(*_currentBlock) : 1073739904U; @@ -174,7 +172,6 @@ bool ethash_cl_miner::configureGPU( } bool ethash_cl_miner::s_allowCPU = false; -bool ethash_cl_miner::s_forceSingleChunk = false; unsigned ethash_cl_miner::s_extraRequiredGPUMem; bool ethash_cl_miner::searchForAllDevices(function _callback) @@ -288,23 +285,6 @@ bool ethash_cl_miner::init( string device_version = device.getInfo(); ETHCL_LOG("Using device: " << device.getInfo().c_str() << "(" << device_version.c_str() << ")"); - // configure chunk number depending on max allocateable memory - cl_ulong result; - device.getInfo(CL_DEVICE_MAX_MEM_ALLOC_SIZE, &result); - if (s_forceSingleChunk || result >= _dagSize) - { - m_dagChunksNum = 1; - ETHCL_LOG( - ((result <= _dagSize && s_forceSingleChunk) ? "Forcing single chunk. Good luck!\n" : "") << - "Using 1 big chunk. Max OpenCL allocateable memory is " << result - ); - } - else - { - m_dagChunksNum = 4; - ETHCL_LOG("Using 4 chunks. Max OpenCL allocateable memory is " << result); - } - if (strncmp("OpenCL 1.0", device_version.c_str(), 10) == 0) { ETHCL_LOG("OpenCL 1.0 is not supported."); @@ -346,26 +326,23 @@ bool ethash_cl_miner::init( ETHCL_LOG(program.getBuildInfo(device).c_str()); return false; } - if (m_dagChunksNum == 1) - { - ETHCL_LOG("Loading single big chunk kernels"); - m_hash_kernel = cl::Kernel(program, "ethash_hash"); - m_search_kernel = cl::Kernel(program, "ethash_search"); - } - else - { - ETHCL_LOG("Loading chunk kernels"); - m_hash_kernel = cl::Kernel(program, "ethash_hash_chunks"); - m_search_kernel = cl::Kernel(program, "ethash_search_chunks"); - } // create buffer for dag - if (m_dagChunksNum == 1) + try { - ETHCL_LOG("Creating one big buffer"); + m_dagChunksNum = 1; m_dagChunks.push_back(cl::Buffer(m_context, CL_MEM_READ_ONLY, _dagSize)); + ETHCL_LOG("Created one big buffer for the DAG"); } - else + catch (...) + { + cl_ulong result; + device.getInfo(CL_DEVICE_MAX_MEM_ALLOC_SIZE, &result); + ETHCL_LOG( + "Failed to allocate 1 big chunk. Max allocateable memory is " + << result << ". Trying to allocate 4 chunks." + ); + m_dagChunksNum = 4; for (unsigned i = 0; i < m_dagChunksNum; i++) { // TODO Note: If we ever change to _dagChunksNum other than 4, then the size would need recalculation @@ -376,6 +353,20 @@ bool ethash_cl_miner::init( (i == 3) ? (_dagSize - 3 * ((_dagSize >> 9) << 7)) : (_dagSize >> 9) << 7 )); } + } + + if (m_dagChunksNum == 1) + { + ETHCL_LOG("Loading single big chunk kernels"); + m_hash_kernel = cl::Kernel(program, "ethash_hash"); + m_search_kernel = cl::Kernel(program, "ethash_search"); + } + else + { + ETHCL_LOG("Loading chunk kernels"); + m_hash_kernel = cl::Kernel(program, "ethash_hash_chunks"); + m_search_kernel = cl::Kernel(program, "ethash_search_chunks"); + } // create buffer for header ETHCL_LOG("Creating buffer for header."); diff --git a/libethash-cl/ethash_cl_miner.h b/libethash-cl/ethash_cl_miner.h index cc01b0057..f36082a5a 100644 --- a/libethash-cl/ethash_cl_miner.h +++ b/libethash-cl/ethash_cl_miner.h @@ -44,7 +44,6 @@ public: static bool configureGPU( bool _allowCPU, unsigned _extraGPUMemory, - bool _forceSingleChunk, boost::optional _currentBlock ); @@ -79,8 +78,6 @@ private: unsigned m_workgroup_size; bool m_opencl_1_1; - /// Force dag upload to GPU in a single chunk even if OpenCL thinks you can't do it. Use at your own risk. - static bool s_forceSingleChunk; /// Allow CPU to appear as an OpenCL device or not. Default is false static bool s_allowCPU; /// GPU memory required for other things, like window rendering e.t.c. diff --git a/libethcore/Ethash.cpp b/libethcore/Ethash.cpp index ebf8c5615..b277e3c1c 100644 --- a/libethcore/Ethash.cpp +++ b/libethcore/Ethash.cpp @@ -389,13 +389,12 @@ bool Ethash::GPUMiner::configureGPU( unsigned _deviceId, bool _allowCPU, unsigned _extraGPUMemory, - bool _forceSingleChunk, boost::optional _currentBlock ) { s_platformId = _platformId; s_deviceId = _deviceId; - return ethash_cl_miner::configureGPU(_allowCPU, _extraGPUMemory, _forceSingleChunk, _currentBlock); + return ethash_cl_miner::configureGPU(_allowCPU, _extraGPUMemory, _currentBlock); } #endif diff --git a/libethcore/Ethash.h b/libethcore/Ethash.h index a5a7856f1..11e012df5 100644 --- a/libethcore/Ethash.h +++ b/libethcore/Ethash.h @@ -88,7 +88,7 @@ public: static unsigned instances() { return s_numInstances > 0 ? s_numInstances : std::thread::hardware_concurrency(); } static std::string platformInfo(); static void listDevices() {} - static bool configureGPU(unsigned, unsigned, bool, unsigned, bool, boost::optional) { return false; } + static bool configureGPU(unsigned, unsigned, bool, unsigned, boost::optional) { return false; } static void setNumInstances(unsigned _instances) { s_numInstances = std::min(_instances, std::thread::hardware_concurrency()); } protected: void kickOff() override @@ -122,7 +122,6 @@ public: unsigned _deviceId, bool _allowCPU, unsigned _extraGPUMemory, - bool _forceSingleChunk, boost::optional _currentBlock ); static void setNumInstances(unsigned _instances) { s_numInstances = std::min(_instances, getNumDevices()); } From 25d2fa1607a1bf8508ce3458bde7995366683805 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 18 Jun 2015 10:38:27 +0200 Subject: [PATCH 107/169] single chunk test: catch only cl::Error --- libethash-cl/ethash_cl_miner.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index 2fc6102fb..c5f77045b 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -334,8 +334,11 @@ bool ethash_cl_miner::init( m_dagChunks.push_back(cl::Buffer(m_context, CL_MEM_READ_ONLY, _dagSize)); ETHCL_LOG("Created one big buffer for the DAG"); } - catch (...) + catch (cl::Error err) { + int errCode = err.err(); + if (errCode != CL_INVALID_BUFFER_SIZE || errCode != CL_MEM_OBJECT_ALLOCATION_FAILURE) + ETHCL_LOG("Allocating single buffer failed with: " << err.what() << "(" << errCode << ")"); cl_ulong result; device.getInfo(CL_DEVICE_MAX_MEM_ALLOC_SIZE, &result); ETHCL_LOG( From 8e5e2f4a9e177c05e11f288993e085a8213d1dd4 Mon Sep 17 00:00:00 2001 From: Lefteris Karapetsas Date: Thu, 18 Jun 2015 10:56:47 +0200 Subject: [PATCH 108/169] Catch OpenCL exceptions by const& --- libethash-cl/ethash_cl_miner.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libethash-cl/ethash_cl_miner.cpp b/libethash-cl/ethash_cl_miner.cpp index c5f77045b..315f29685 100644 --- a/libethash-cl/ethash_cl_miner.cpp +++ b/libethash-cl/ethash_cl_miner.cpp @@ -321,7 +321,7 @@ bool ethash_cl_miner::init( ETHCL_LOG("Printing program log"); ETHCL_LOG(program.getBuildInfo(device).c_str()); } - catch (cl::Error err) + catch (cl::Error const& err) { ETHCL_LOG(program.getBuildInfo(device).c_str()); return false; @@ -334,7 +334,7 @@ bool ethash_cl_miner::init( m_dagChunks.push_back(cl::Buffer(m_context, CL_MEM_READ_ONLY, _dagSize)); ETHCL_LOG("Created one big buffer for the DAG"); } - catch (cl::Error err) + catch (cl::Error const& err) { int errCode = err.err(); if (errCode != CL_INVALID_BUFFER_SIZE || errCode != CL_MEM_OBJECT_ALLOCATION_FAILURE) @@ -345,6 +345,7 @@ bool ethash_cl_miner::init( "Failed to allocate 1 big chunk. Max allocateable memory is " << result << ". Trying to allocate 4 chunks." ); + // The OpenCL kernel has a hard coded number of 4 chunks at the moment m_dagChunksNum = 4; for (unsigned i = 0; i < m_dagChunksNum; i++) { @@ -404,7 +405,7 @@ bool ethash_cl_miner::init( m_search_buf[i] = cl::Buffer(m_context, CL_MEM_WRITE_ONLY, (c_max_search_results + 1) * sizeof(uint32_t)); } } - catch (cl::Error err) + catch (cl::Error const& err) { ETHCL_LOG(err.what() << "(" << err.err() << ")"); return false; @@ -498,7 +499,7 @@ void ethash_cl_miner::search(uint8_t const* header, uint64_t target, search_hook pre_return_event.wait(); #endif } - catch (cl::Error err) + catch (cl::Error const& err) { ETHCL_LOG(err.what() << "(" << err.err() << ")"); } From 212ac9366d9de7c7c92e001aede72db93111b411 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 10 Jun 2015 15:17:42 +0200 Subject: [PATCH 109/169] Cleanup of SecretStore. Added documentation, more failure checking and some general cleanup. --- libdevcore/CommonIO.cpp | 6 +- libdevcore/CommonIO.h | 7 +- libdevcrypto/Common.cpp | 26 +++++- libdevcrypto/SecretStore.cpp | 140 ++++++++++++++++-------------- libdevcrypto/SecretStore.h | 49 +++++++++-- test/libdevcrypto/SecretStore.cpp | 2 +- 6 files changed, 152 insertions(+), 78 deletions(-) diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index 03b22bfc5..e788e7460 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -95,9 +95,11 @@ string dev::contentsString(string const& _file) return contentsGeneric(_file); } -void dev::writeFile(std::string const& _file, bytesConstRef _data) +bool dev::writeFile(std::string const& _file, bytesConstRef _data) { - ofstream(_file, ios::trunc|ios::binary).write((char const*)_data.data(), _data.size()); + ofstream s(_file, ios::trunc | ios::binary); + s.write(reinterpret_cast(_data.data()), _data.size()); + return !!s; } std::string dev::getPassword(std::string const& _prompt) diff --git a/libdevcore/CommonIO.h b/libdevcore/CommonIO.h index c8aa830ff..7b1a50be2 100644 --- a/libdevcore/CommonIO.h +++ b/libdevcore/CommonIO.h @@ -56,10 +56,11 @@ std::string contentsString(std::string const& _file); bytesRef contentsNew(std::string const& _file, bytesRef _dest = bytesRef()); /// Write the given binary data into the given file, replacing the file if it pre-exists. -void writeFile(std::string const& _file, bytesConstRef _data); +/// @returns true if writing succeeded. +bool writeFile(std::string const& _file, bytesConstRef _data); /// Write the given binary data into the given file, replacing the file if it pre-exists. -inline void writeFile(std::string const& _file, bytes const& _data) { writeFile(_file, bytesConstRef(&_data)); } -inline void writeFile(std::string const& _file, std::string const& _data) { writeFile(_file, bytesConstRef(_data)); } +inline bool writeFile(std::string const& _file, bytes const& _data) { return writeFile(_file, bytesConstRef(&_data)); } +inline bool writeFile(std::string const& _file, std::string const& _data) { return writeFile(_file, bytesConstRef(_data)); } /// Nicely renders the given bytes to a string, optionally as HTML. /// @a _bytes: bytes array to be rendered as string. @a _width of a bytes line. diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp index 4ebd6a04b..620ae1b7a 100644 --- a/libdevcrypto/Common.cpp +++ b/libdevcrypto/Common.cpp @@ -178,15 +178,35 @@ bool dev::verify(Public const& _p, Signature const& _s, h256 const& _hash) bytes dev::pbkdf2(string const& _pass, bytes const& _salt, unsigned _iterations, unsigned _dkLen) { bytes ret(_dkLen); - PKCS5_PBKDF2_HMAC pbkdf; - pbkdf.DeriveKey(ret.data(), ret.size(), 0, (byte*)_pass.data(), _pass.size(), _salt.data(), _salt.size(), _iterations); + if (PKCS5_PBKDF2_HMAC().DeriveKey( + ret.data(), + ret.size(), + 0, + reinterpret_cast(_pass.data()), + _pass.size(), + _salt.data(), + _salt.size(), + _iterations + ) != _iterations) + return bytes(); return ret; } bytes dev::scrypt(std::string const& _pass, bytes const& _salt, uint64_t _n, uint32_t _r, uint32_t _p, unsigned _dkLen) { bytes ret(_dkLen); - libscrypt_scrypt((uint8_t const*)_pass.data(), _pass.size(), _salt.data(), _salt.size(), _n, _r, _p, ret.data(), ret.size()); + if (libscrypt_scrypt( + reinterpret_cast(_pass.data()), + _pass.size(), + _salt.data(), + _salt.size(), + _n, + _r, + _p, + ret.data(), + ret.size() + ) != 0) + return bytes(); return ret; } diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index b9d4ccfc6..c1bbf0141 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -36,7 +36,8 @@ namespace fs = boost::filesystem; static const int c_keyFileVersion = 3; -static js::mValue upgraded(std::string const& _s) +/// Upgrade the json-format to the current version. +static js::mValue upgraded(string const& _s) { js::mValue v; js::read_string(_s, v); @@ -84,36 +85,38 @@ static js::mValue upgraded(std::string const& _s) return js::mValue(); } -SecretStore::SecretStore(std::string const& _path): m_path(_path) +SecretStore::SecretStore(string const& _path): m_path(_path) { load(); } -SecretStore::~SecretStore() +bytes SecretStore::secret(h128 const& _uuid, function const& _pass, bool _useCache) const { -} - -bytes SecretStore::secret(h128 const& _uuid, function const& _pass, bool _useCache) const -{ - (void)_pass; auto rit = m_cached.find(_uuid); if (_useCache && rit != m_cached.end()) return rit->second; auto it = m_keys.find(_uuid); - if (it == m_keys.end()) - return bytes(); - bytes key = decrypt(it->second.first, _pass()); - if (!key.empty()) - m_cached[_uuid] = key; + bytes key; + if (it != m_keys.end()) + { + key = decrypt(it->second.encryptedKey, _pass()); + if (!key.empty()) + m_cached[_uuid] = key; + } return key; } -h128 SecretStore::importSecret(bytes const& _s, std::string const& _pass) +h128 SecretStore::importSecret(bytes const& _s, string const& _pass) { - h128 r = h128::random(); - m_cached[r] = _s; - m_keys[r] = make_pair(encrypt(_s, _pass), std::string()); - save(); + h128 r; + EncryptedKey key{encrypt(_s, _pass), string()}; + if (!key.encryptedKey.empty()) + { + r = h128::random(); + m_cached[r] = _s; + m_keys[r] = move(key); + save(); + } return r; } @@ -122,7 +125,7 @@ void SecretStore::kill(h128 const& _uuid) m_cached.erase(_uuid); if (m_keys.count(_uuid)) { - boost::filesystem::remove(m_keys[_uuid].second); + fs::remove(m_keys[_uuid].filename); m_keys.erase(_uuid); } } @@ -132,50 +135,52 @@ void SecretStore::clearCache() const m_cached.clear(); } -void SecretStore::save(std::string const& _keysPath) +void SecretStore::save(string const& _keysPath) { fs::path p(_keysPath); - boost::filesystem::create_directories(p); + fs::create_directories(p); for (auto& k: m_keys) { - std::string uuid = toUUID(k.first); - std::string filename = (p / uuid).string() + ".json"; + string uuid = toUUID(k.first); + string filename = (p / uuid).string() + ".json"; js::mObject v; js::mValue crypto; - js::read_string(k.second.first, crypto); + js::read_string(k.second.encryptedKey, crypto); v["crypto"] = crypto; v["id"] = uuid; v["version"] = c_keyFileVersion; - writeFile(filename, js::write_string(js::mValue(v), true)); - if (!k.second.second.empty() && k.second.second != filename) - boost::filesystem::remove(k.second.second); - k.second.second = filename; + if (writeFile(filename, js::write_string(js::mValue(v), true))) + { + swap(k.second.filename, filename); + if (!filename.empty() && !fs::equivalent(filename, k.second.filename)) + fs::remove(filename); + } } } -void SecretStore::load(std::string const& _keysPath) +void SecretStore::load(string const& _keysPath) { fs::path p(_keysPath); - boost::filesystem::create_directories(p); + fs::create_directories(p); for (fs::directory_iterator it(p); it != fs::directory_iterator(); ++it) - if (is_regular_file(it->path())) + if (fs::is_regular_file(it->path())) readKey(it->path().string(), true); } -h128 SecretStore::readKey(std::string const& _file, bool _deleteFile) +h128 SecretStore::readKey(string const& _file, bool _takeFileOwnership) { cnote << "Reading" << _file; - return readKeyContent(contentsString(_file), _deleteFile ? _file : string()); + return readKeyContent(contentsString(_file), _takeFileOwnership ? _file : string()); } -h128 SecretStore::readKeyContent(std::string const& _content, std::string const& _file) +h128 SecretStore::readKeyContent(string const& _content, string const& _file) { js::mValue u = upgraded(_content); if (u.type() == js::obj_type) { js::mObject& o = u.get_obj(); auto uuid = fromUUID(o["id"].get_str()); - m_keys[uuid] = make_pair(js::write_string(o["crypto"], false), _file); + m_keys[uuid] = EncryptedKey{js::write_string(o["crypto"], false), _file}; return uuid; } else @@ -183,62 +188,66 @@ h128 SecretStore::readKeyContent(std::string const& _content, std::string const& return h128(); } -bool SecretStore::recode(h128 const& _uuid, string const& _newPass, std::function const& _pass, KDF _kdf) +bool SecretStore::recode(h128 const& _uuid, string const& _newPass, function const& _pass, KDF _kdf) { -// cdebug << "recode:" << toUUID(_uuid); bytes s = secret(_uuid, _pass, true); if (s.empty()) return false; - m_keys[_uuid].first = encrypt(s, _newPass, _kdf); + m_cached.erase(_uuid); + m_keys[_uuid].encryptedKey = encrypt(s, _newPass, _kdf); save(); return true; } -std::string SecretStore::encrypt(bytes const& _v, std::string const& _pass, KDF _kdf) +static bytes deriveNewKey(string const& _pass, KDF _kdf, js::mObject& o_ret) { - js::mObject ret; - - // KDF info unsigned dklen = 32; + unsigned iterations = 1 << 19; bytes salt = h256::random().asBytes(); - bytes derivedKey; if (_kdf == KDF::Scrypt) { - unsigned iterations = 262144; unsigned p = 1; unsigned r = 8; - ret["kdf"] = "scrypt"; + o_ret["kdf"] = "scrypt"; { js::mObject params; - params["n"] = (int64_t)iterations; - params["r"] = (int)r; - params["p"] = (int)p; - params["dklen"] = (int)dklen; + params["n"] = int64_t(iterations); + params["r"] = int(r); + params["p"] = int(p); + params["dklen"] = int(dklen); params["salt"] = toHex(salt); - ret["kdfparams"] = params; + o_ret["kdfparams"] = params; } - derivedKey = scrypt(_pass, salt, iterations, r, p, dklen); + return scrypt(_pass, salt, iterations, r, p, dklen); } else { - unsigned iterations = 262144; - ret["kdf"] = "pbkdf2"; + o_ret["kdf"] = "pbkdf2"; { js::mObject params; params["prf"] = "hmac-sha256"; - params["c"] = (int)iterations; + params["c"] = int(iterations); params["salt"] = toHex(salt); - params["dklen"] = (int)dklen; - ret["kdfparams"] = params; + params["dklen"] = int(dklen); + o_ret["kdfparams"] = params; } - derivedKey = pbkdf2(_pass, salt, iterations, dklen); + return pbkdf2(_pass, salt, iterations, dklen); + } +} + +string SecretStore::encrypt(bytes const& _v, string const& _pass, KDF _kdf) +{ + js::mObject ret; + + bytes derivedKey = deriveNewKey(_pass, _kdf, ret); + if (derivedKey.empty()) + { + cwarn << "Key derivation failed."; + return string(); } -// cdebug << "derivedKey" << toHex(derivedKey); - // cipher info ret["cipher"] = "aes-128-ctr"; h128 key(derivedKey, h128::AlignLeft); -// cdebug << "cipherKey" << key.hex(); h128 iv = h128::random(); { js::mObject params; @@ -248,18 +257,21 @@ std::string SecretStore::encrypt(bytes const& _v, std::string const& _pass, KDF // cipher text bytes cipherText = encryptSymNoAuth(key, iv, &_v); + if (cipherText.empty()) + { + cwarn << "Key encryption failed."; + return string(); + } ret["ciphertext"] = toHex(cipherText); // and mac. h256 mac = sha3(ref(derivedKey).cropped(16, 16).toBytes() + cipherText); -// cdebug << "macBody" << toHex(ref(derivedKey).cropped(16, 16).toBytes() + cipherText); -// cdebug << "mac" << mac.hex(); ret["mac"] = toHex(mac.ref()); - return js::write_string((js::mValue)ret, true); + return js::write_string(js::mValue(ret), true); } -bytes SecretStore::decrypt(std::string const& _v, std::string const& _pass) +bytes SecretStore::decrypt(string const& _v, string const& _pass) { js::mObject o; { diff --git a/libdevcrypto/SecretStore.h b/libdevcrypto/SecretStore.h index 4474212b1..020640e65 100644 --- a/libdevcrypto/SecretStore.h +++ b/libdevcrypto/SecretStore.h @@ -35,41 +35,80 @@ enum class KDF { Scrypt, }; +/** + * Manages encrypted keys stored in a certain directory on disk. The keys are read into memory + * and changes to the keys are automatically synced to the directory. + * Each file stores exactly one key in a specific JSON format whose file name is derived from the + * UUID of the key. + * @note that most of the functions here affect the filesystem and throw exceptions on failure. + */ class SecretStore { public: + /// Construct a new SecretStore and read all keys in the given directory. SecretStore(std::string const& _path = defaultPath()); - ~SecretStore(); + /// @returns the secret key stored by the given @a _uuid. + /// @param _pass function that returns the password for the key. + /// @param _useCache if true, allow previously decrypted keys to be returned directly. bytes secret(h128 const& _uuid, std::function const& _pass, bool _useCache = true) const; + /// Imports the (encrypted) key stored in the file @a _file and copies it to the managed directory. h128 importKey(std::string const& _file) { auto ret = readKey(_file, false); if (ret) save(); return ret; } + /// Imports the (encrypted) key contained in the json formatted @a _content and stores it in + /// the managed directory. h128 importKeyContent(std::string const& _content) { auto ret = readKeyContent(_content, std::string()); if (ret) save(); return ret; } + /// Imports the decrypted key given by @a _s and stores it, encrypted with + /// (a key derived from) the password @a _pass. h128 importSecret(bytes const& _s, std::string const& _pass); + /// Decrypts and re-encrypts the key identified by @a _uuid. bool recode(h128 const& _uuid, std::string const& _newPass, std::function const& _pass, KDF _kdf = KDF::Scrypt); + /// Removes the key specified by @a _uuid from both memory and disk. void kill(h128 const& _uuid); + /// Returns the uuids of all stored keys. std::vector keys() const { return keysOf(m_keys); } - // Clear any cached keys. + /// Clears all cached decrypted keys. The passwords have to be supplied in order to retrieve + /// secrets again after calling this function. void clearCache() const; - // Doesn't save(). - h128 readKey(std::string const& _file, bool _deleteFile); + /// Import the key from the file @a _file, but do not copy it to the managed directory yet. + /// @param _takeFileOwnership if true, deletes the file if it is not the canonical file for the + /// key (derived from its uuid). + h128 readKey(std::string const& _file, bool _takeFileOwnership); + /// Import the key contained in the json-encoded @a _content, but do not store it in the + /// managed directory. + /// @param _file if given, assume this file contains @a _content and delete it later, if it is + /// not the canonical file for the key (derived from the uuid). h128 readKeyContent(std::string const& _content, std::string const& _file = std::string()); + /// Store all keys in the directory @a _keysPath. void save(std::string const& _keysPath); + /// Store all keys in the managed directory. void save() { save(m_path); } + /// @returns the default path for the managed directory. static std::string defaultPath() { return getDataDir("web3") + "/keys"; } private: + struct EncryptedKey + { + std::string encryptedKey; + std::string filename; + }; + + /// Loads all keys in the given directory. void load(std::string const& _keysPath); void load() { load(m_path); } + /// Encrypts @a _v with a key derived from @a _pass or the empty string on error. static std::string encrypt(bytes const& _v, std::string const& _pass, KDF _kdf = KDF::Scrypt); + /// Decrypts @a _v with a key derived from @a _pass or the empty byte array on error. static bytes decrypt(std::string const& _v, std::string const& _pass); + /// Stores decrypted keys by uuid. mutable std::unordered_map m_cached; - std::unordered_map> m_keys; + /// Stores encrypted keys together with the file they were loaded from by uuid. + std::unordered_map m_keys; std::string m_path; }; diff --git a/test/libdevcrypto/SecretStore.cpp b/test/libdevcrypto/SecretStore.cpp index 43c201edc..80d850a7c 100644 --- a/test/libdevcrypto/SecretStore.cpp +++ b/test/libdevcrypto/SecretStore.cpp @@ -52,7 +52,7 @@ BOOST_AUTO_TEST_CASE(basic_tests) { cnote << i.first; js::mObject& o = i.second.get_obj(); - SecretStore store("."); + SecretStore store(""); h128 u = store.readKeyContent(js::write_string(o["json"], false)); cdebug << "read uuid" << u; bytes s = store.secret(u, [&](){ return o["password"].get_str(); }); From 58e76408505f7fe901f41d30359a0b169cc9c92d Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2015 15:01:33 +0200 Subject: [PATCH 110/169] Throw some more exceptions. --- libdevcore/CommonIO.cpp | 5 +++-- libdevcore/CommonIO.h | 8 ++++---- libdevcrypto/Common.cpp | 5 +++-- libdevcrypto/Exceptions.h | 35 +++++++++++++++++++++++++++++++++++ libdevcrypto/SecretStore.cpp | 10 ++++------ libdevcrypto/SecretStore.h | 3 ++- 6 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 libdevcrypto/Exceptions.h diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index e788e7460..d0a1b8c5b 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -95,11 +95,12 @@ string dev::contentsString(string const& _file) return contentsGeneric(_file); } -bool dev::writeFile(std::string const& _file, bytesConstRef _data) +void dev::writeFile(std::string const& _file, bytesConstRef _data) { ofstream s(_file, ios::trunc | ios::binary); s.write(reinterpret_cast(_data.data()), _data.size()); - return !!s; + if (!s) + BOOST_THROW_EXCEPTION(FileError()); } std::string dev::getPassword(std::string const& _prompt) diff --git a/libdevcore/CommonIO.h b/libdevcore/CommonIO.h index 7b1a50be2..cc2ef7484 100644 --- a/libdevcore/CommonIO.h +++ b/libdevcore/CommonIO.h @@ -56,11 +56,11 @@ std::string contentsString(std::string const& _file); bytesRef contentsNew(std::string const& _file, bytesRef _dest = bytesRef()); /// Write the given binary data into the given file, replacing the file if it pre-exists. -/// @returns true if writing succeeded. -bool writeFile(std::string const& _file, bytesConstRef _data); +/// Throws exception on error. +void writeFile(std::string const& _file, bytesConstRef _data); /// Write the given binary data into the given file, replacing the file if it pre-exists. -inline bool writeFile(std::string const& _file, bytes const& _data) { return writeFile(_file, bytesConstRef(&_data)); } -inline bool writeFile(std::string const& _file, std::string const& _data) { return writeFile(_file, bytesConstRef(_data)); } +inline void writeFile(std::string const& _file, bytes const& _data) { writeFile(_file, bytesConstRef(&_data)); } +inline void writeFile(std::string const& _file, std::string const& _data) { writeFile(_file, bytesConstRef(_data)); } /// Nicely renders the given bytes to a string, optionally as HTML. /// @a _bytes: bytes array to be rendered as string. @a _width of a bytes line. diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp index 620ae1b7a..6c66a95d6 100644 --- a/libdevcrypto/Common.cpp +++ b/libdevcrypto/Common.cpp @@ -31,6 +31,7 @@ #include #include "AES.h" #include "CryptoPP.h" +#include "Exceptions.h" using namespace std; using namespace dev; using namespace dev::crypto; @@ -188,7 +189,7 @@ bytes dev::pbkdf2(string const& _pass, bytes const& _salt, unsigned _iterations, _salt.size(), _iterations ) != _iterations) - return bytes(); + BOOST_THROW_EXCEPTION(CryptoException()); return ret; } @@ -206,7 +207,7 @@ bytes dev::scrypt(std::string const& _pass, bytes const& _salt, uint64_t _n, uin ret.data(), ret.size() ) != 0) - return bytes(); + BOOST_THROW_EXCEPTION(CryptoException()); return ret; } diff --git a/libdevcrypto/Exceptions.h b/libdevcrypto/Exceptions.h new file mode 100644 index 000000000..675213d8b --- /dev/null +++ b/libdevcrypto/Exceptions.h @@ -0,0 +1,35 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file Exceptions.h + * @author Christian + * @date 2016 + */ + +#pragma once + +#include + +namespace dev +{ +namespace crypto +{ + +/// Rare malfunction of cryptographic functions. +DEV_SIMPLE_EXCEPTION_RLP(CryptoException); + +} +} diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index c1bbf0141..14bcae908 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -149,12 +149,10 @@ void SecretStore::save(string const& _keysPath) v["crypto"] = crypto; v["id"] = uuid; v["version"] = c_keyFileVersion; - if (writeFile(filename, js::write_string(js::mValue(v), true))) - { - swap(k.second.filename, filename); - if (!filename.empty() && !fs::equivalent(filename, k.second.filename)) - fs::remove(filename); - } + writeFile(filename, js::write_string(js::mValue(v), true)); + swap(k.second.filename, filename); + if (!filename.empty() && !fs::equivalent(filename, k.second.filename)) + fs::remove(filename); } } diff --git a/libdevcrypto/SecretStore.h b/libdevcrypto/SecretStore.h index 020640e65..029630b4e 100644 --- a/libdevcrypto/SecretStore.h +++ b/libdevcrypto/SecretStore.h @@ -40,7 +40,8 @@ enum class KDF { * and changes to the keys are automatically synced to the directory. * Each file stores exactly one key in a specific JSON format whose file name is derived from the * UUID of the key. - * @note that most of the functions here affect the filesystem and throw exceptions on failure. + * @note that most of the functions here affect the filesystem and throw exceptions on failure, + * and they also throw exceptions upon rare malfunction in the cryptographic functions. */ class SecretStore { From 8793244ed3aa2f17d61ece83592a406617ff7783 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 11 Jun 2015 19:25:48 +0200 Subject: [PATCH 111/169] Throw exception upon failed encryption. --- libdevcrypto/SecretStore.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index 14bcae908..e7409ca15 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -29,6 +29,7 @@ #include #include #include +#include using namespace std; using namespace dev; namespace js = json_spirit; @@ -111,12 +112,11 @@ h128 SecretStore::importSecret(bytes const& _s, string const& _pass) h128 r; EncryptedKey key{encrypt(_s, _pass), string()}; if (!key.encryptedKey.empty()) - { - r = h128::random(); - m_cached[r] = _s; - m_keys[r] = move(key); - save(); - } + BOOST_THROW_EXCEPTION(crypto::CryptoException()); + r = h128::random(); + m_cached[r] = _s; + m_keys[r] = move(key); + save(); return r; } From db88799cf93093fd3e62fb7e9725262d6f23bb55 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 12 Jun 2015 07:35:48 +0200 Subject: [PATCH 112/169] Try not to write files in tests. --- libdevcrypto/SecretStore.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index e7409ca15..86e378589 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -88,7 +88,8 @@ static js::mValue upgraded(string const& _s) SecretStore::SecretStore(string const& _path): m_path(_path) { - load(); + if (!m_path.empty()) + load(); } bytes SecretStore::secret(h128 const& _uuid, function const& _pass, bool _useCache) const @@ -137,6 +138,9 @@ void SecretStore::clearCache() const void SecretStore::save(string const& _keysPath) { + if (_keysPath.empty()) + return; + fs::path p(_keysPath); fs::create_directories(p); for (auto& k: m_keys) From 9e51db8b823b1c183af5b979725eef4c3fb071b8 Mon Sep 17 00:00:00 2001 From: chriseth Date: Fri, 12 Jun 2015 12:27:32 +0200 Subject: [PATCH 113/169] Do not fail if seed cannot be written to file. --- libdevcrypto/Common.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp index 6c66a95d6..8567ac12b 100644 --- a/libdevcrypto/Common.cpp +++ b/libdevcrypto/Common.cpp @@ -280,12 +280,12 @@ h256 Nonce::get(bool _commit) BOOST_THROW_EXCEPTION(InvalidState()); // prevent seed reuse if process terminates abnormally - writeFile(s_seedFile, bytes()); + try { writeFile(s_seedFile, bytes()); } catch (FileError const&) {} } h256 prev(s_seed); sha3(prev.ref(), s_seed.ref()); if (_commit) - writeFile(s_seedFile, s_seed.asBytes()); + try { writeFile(s_seedFile, s_seed.asBytes()); } catch (FileError const&) {} return std::move(s_seed); } From 0b6a09b9cfd3898481d5c905944efc3e9bf18274 Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2015 14:00:24 +0200 Subject: [PATCH 114/169] Nonce refactoring. --- libdevcrypto/Common.cpp | 89 ++++++++++++++++++++++++++------------- libdevcrypto/Common.h | 21 ++++++++- libdevcrypto/Exceptions.h | 2 +- 3 files changed, 79 insertions(+), 33 deletions(-) diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp index 8567ac12b..94f78b1e2 100644 --- a/libdevcrypto/Common.cpp +++ b/libdevcrypto/Common.cpp @@ -254,42 +254,71 @@ h256 crypto::kdf(Secret const& _priv, h256 const& _hash) return s; } -h256 Nonce::get(bool _commit) +mutex Nonce::s_x; + +h256 Nonce::get() { // todo: atomic efface bit, periodic save, kdf, rr, rng // todo: encrypt - static h256 s_seed; - static string s_seedFile(getDataDir() + "/seed"); - static mutex s_x; - Guard l(s_x); - if (!s_seed) + Guard l(Nonce::s_x); + return Nonce::singleton().next(); +} + +// get: Called for the first time: read seed hash from file (or generate) +// before destruction: increment current value and store + +Nonce::~Nonce() +{ + Guard l(Nonce::s_x); + // These might throw. + next(); + commit(); +} + +Nonce& Nonce::singleton() +{ + static Nonce s; + return s; +} + +void Nonce::initialiseIfNeeded() +{ + if (m_value) + return; + + bytes b = contents(seedFile()); + if (b.size() == 32) + memcpy(m_value.data(), b.data(), 32); + else { - static Nonce s_nonce; - bytes b = contents(s_seedFile); - if (b.size() == 32) - memcpy(s_seed.data(), b.data(), 32); - else - { - // todo: replace w/entropy from user and system - std::mt19937_64 s_eng(time(0) + chrono::high_resolution_clock::now().time_since_epoch().count()); - std::uniform_int_distribution d(0, 255); - for (unsigned i = 0; i < 32; ++i) - s_seed[i] = (byte)d(s_eng); - } - if (!s_seed) - BOOST_THROW_EXCEPTION(InvalidState()); - - // prevent seed reuse if process terminates abnormally - try { writeFile(s_seedFile, bytes()); } catch (FileError const&) {} + // todo: replace w/entropy from user and system + std::mt19937_64 s_eng(time(0) + chrono::high_resolution_clock::now().time_since_epoch().count()); + std::uniform_int_distribution d(0, 255); + for (unsigned i = 0; i < 32; ++i) + m_value[i] = byte(d(s_eng)); } - h256 prev(s_seed); - sha3(prev.ref(), s_seed.ref()); - if (_commit) - try { writeFile(s_seedFile, s_seed.asBytes()); } catch (FileError const&) {} - return std::move(s_seed); + if (!m_value) + BOOST_THROW_EXCEPTION(InvalidState()); + + // prevent seed reuse if process terminates abnormally + // this might throw + writeFile(seedFile(), bytes()); } -Nonce::~Nonce() +h256 Nonce::next() +{ + initialiseIfNeeded(); + m_value = sha3(m_value); + return m_value; +} + +void Nonce::commit() +{ + // this might throw + writeFile(seedFile(), m_value.asBytes()); +} + +string Nonce::seedFile() { - Nonce::get(true); + return getDataDir() + "/seed"; } diff --git a/libdevcrypto/Common.h b/libdevcrypto/Common.h index 7bb51e563..96f525e49 100644 --- a/libdevcrypto/Common.h +++ b/libdevcrypto/Common.h @@ -24,6 +24,7 @@ #pragma once +#include #include #include #include @@ -180,14 +181,30 @@ struct InvalidState: public dev::Exception {}; h256 kdf(Secret const& _priv, h256 const& _hash); /** - * @brief Generator for nonce material + * @brief Generator for nonce material. */ struct Nonce { - static h256 get(bool _commit = false); + static h256 get(); private: Nonce() {} ~Nonce(); + /// @returns the singleton instance. + static Nonce& singleton(); + /// Reads the last seed from the seed file. + void initialiseIfNeeded(); + /// @returns the next nonce. + h256 next(); + /// Stores the current seed in the seed file. + void commit(); + /// @returns the path of the seed file. + static std::string seedFile(); + + /// Mutex for the singleton object. + /// @note Every access to any private function has to be guarded by this mutex. + static std::mutex s_x; + + h256 m_value; }; } diff --git a/libdevcrypto/Exceptions.h b/libdevcrypto/Exceptions.h index 675213d8b..858374bda 100644 --- a/libdevcrypto/Exceptions.h +++ b/libdevcrypto/Exceptions.h @@ -29,7 +29,7 @@ namespace crypto { /// Rare malfunction of cryptographic functions. -DEV_SIMPLE_EXCEPTION_RLP(CryptoException); +DEV_SIMPLE_EXCEPTION(CryptoException); } } From 0fccf207acf51517a56c2328d6f48ae0d8a04c3f Mon Sep 17 00:00:00 2001 From: chriseth Date: Tue, 16 Jun 2015 14:02:09 +0200 Subject: [PATCH 115/169] Fixed parameter. --- libdevcrypto/SecretStore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index 86e378589..6423269f9 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -204,7 +204,7 @@ bool SecretStore::recode(h128 const& _uuid, string const& _newPass, function Date: Wed, 17 Jun 2015 16:35:28 +0200 Subject: [PATCH 116/169] Fix to correctly write nonce during tests. --- libdevcrypto/Common.cpp | 29 +++++++++++++++++++++-------- libdevcrypto/Common.h | 10 ++++++++-- test/TestUtils.cpp | 11 +++++++++++ test/TestUtils.h | 9 +++++++++ test/libdevcrypto/SecretStore.cpp | 6 +++++- test/libdevcrypto/crypto.cpp | 5 +++++ 6 files changed, 59 insertions(+), 11 deletions(-) diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp index 94f78b1e2..66f211933 100644 --- a/libdevcrypto/Common.cpp +++ b/libdevcrypto/Common.cpp @@ -255,6 +255,7 @@ h256 crypto::kdf(Secret const& _priv, h256 const& _hash) } mutex Nonce::s_x; +static string s_seedFile; h256 Nonce::get() { @@ -264,15 +265,23 @@ h256 Nonce::get() return Nonce::singleton().next(); } -// get: Called for the first time: read seed hash from file (or generate) -// before destruction: increment current value and store +void Nonce::reset() +{ + Guard l(Nonce::s_x); + Nonce::singleton().resetInternal(); +} + +void Nonce::setSeedFilePath(string const& _filePath) +{ + s_seedFile = _filePath; +} Nonce::~Nonce() { Guard l(Nonce::s_x); - // These might throw. - next(); - commit(); + if (m_value) + // this might throw + resetInternal(); } Nonce& Nonce::singleton() @@ -312,13 +321,17 @@ h256 Nonce::next() return m_value; } -void Nonce::commit() +void Nonce::resetInternal() { // this might throw + next(); writeFile(seedFile(), m_value.asBytes()); + m_value = h256(); } -string Nonce::seedFile() +string const& Nonce::seedFile() { - return getDataDir() + "/seed"; + if (s_seedFile.empty()) + s_seedFile = getDataDir() + "/seed"; + return s_seedFile; } diff --git a/libdevcrypto/Common.h b/libdevcrypto/Common.h index 96f525e49..b3d2649b8 100644 --- a/libdevcrypto/Common.h +++ b/libdevcrypto/Common.h @@ -185,7 +185,13 @@ h256 kdf(Secret const& _priv, h256 const& _hash); */ struct Nonce { + /// Returns the next nonce (might be read from a file). static h256 get(); + /// Stores the current nonce in a file and resets Nonce to the uninitialised state. + static void reset(); + /// Sets the location of the seed file to a non-default place. Used for testing. + static void setSeedFilePath(std::string const& _filePath); + private: Nonce() {} ~Nonce(); @@ -196,9 +202,9 @@ private: /// @returns the next nonce. h256 next(); /// Stores the current seed in the seed file. - void commit(); + void resetInternal(); /// @returns the path of the seed file. - static std::string seedFile(); + static std::string const& seedFile(); /// Mutex for the singleton object. /// @note Every access to any private function has to be guarded by this mutex. diff --git a/test/TestUtils.cpp b/test/TestUtils.cpp index ff5169d55..bd603a61f 100644 --- a/test/TestUtils.cpp +++ b/test/TestUtils.cpp @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -116,3 +117,13 @@ void ParallelClientBaseFixture::enumerateClients(std::function #include #include +#include #include #include @@ -78,5 +79,13 @@ struct JsonRpcFixture: public ClientBaseFixture }; +struct MoveNonceToTempDir +{ + MoveNonceToTempDir(); + ~MoveNonceToTempDir(); +private: + TransientDirectory m_dir; +}; + } } diff --git a/test/libdevcrypto/SecretStore.cpp b/test/libdevcrypto/SecretStore.cpp index 80d850a7c..dafad28a8 100644 --- a/test/libdevcrypto/SecretStore.cpp +++ b/test/libdevcrypto/SecretStore.cpp @@ -29,12 +29,16 @@ #include #include #include "MemTrie.h" -#include "../TestHelper.h" +#include +#include using namespace std; using namespace dev; +using namespace dev::test; namespace js = json_spirit; +BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir ); + BOOST_AUTO_TEST_SUITE(KeyStore) BOOST_AUTO_TEST_CASE(basic_tests) diff --git a/test/libdevcrypto/crypto.cpp b/test/libdevcrypto/crypto.cpp index 497887145..31589c3ce 100644 --- a/test/libdevcrypto/crypto.cpp +++ b/test/libdevcrypto/crypto.cpp @@ -31,12 +31,16 @@ #include #include #include +#include using namespace std; using namespace dev; +using namespace dev::test; using namespace dev::crypto; using namespace CryptoPP; +BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir ); + BOOST_AUTO_TEST_SUITE(devcrypto) static Secp256k1 s_secp256k1; @@ -45,6 +49,7 @@ static CryptoPP::OID s_curveOID(CryptoPP::ASN1::secp256k1()); static CryptoPP::DL_GroupParameters_EC s_params(s_curveOID); static CryptoPP::DL_GroupParameters_EC::EllipticCurve s_curve(s_params.GetCurve()); + BOOST_AUTO_TEST_CASE(sha3general) { BOOST_REQUIRE_EQUAL(sha3(""), h256("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")); From db803547fa97dff1699ffc9802ee1b940e1a522f Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2015 12:20:55 +0200 Subject: [PATCH 117/169] Fixes. --- libdevcrypto/Common.cpp | 4 ++-- libdevcrypto/SecretStore.cpp | 12 ++---------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/libdevcrypto/Common.cpp b/libdevcrypto/Common.cpp index 66f211933..af61a1dd5 100644 --- a/libdevcrypto/Common.cpp +++ b/libdevcrypto/Common.cpp @@ -189,7 +189,7 @@ bytes dev::pbkdf2(string const& _pass, bytes const& _salt, unsigned _iterations, _salt.size(), _iterations ) != _iterations) - BOOST_THROW_EXCEPTION(CryptoException()); + BOOST_THROW_EXCEPTION(CryptoException() << errinfo_comment("Key derivation failed.")); return ret; } @@ -207,7 +207,7 @@ bytes dev::scrypt(std::string const& _pass, bytes const& _salt, uint64_t _n, uin ret.data(), ret.size() ) != 0) - BOOST_THROW_EXCEPTION(CryptoException()); + BOOST_THROW_EXCEPTION(CryptoException() << errinfo_comment("Key derivation failed.")); return ret; } diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index 6423269f9..aeb06f11b 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -112,8 +112,6 @@ h128 SecretStore::importSecret(bytes const& _s, string const& _pass) { h128 r; EncryptedKey key{encrypt(_s, _pass), string()}; - if (!key.encryptedKey.empty()) - BOOST_THROW_EXCEPTION(crypto::CryptoException()); r = h128::random(); m_cached[r] = _s; m_keys[r] = move(key); @@ -243,10 +241,7 @@ string SecretStore::encrypt(bytes const& _v, string const& _pass, KDF _kdf) bytes derivedKey = deriveNewKey(_pass, _kdf, ret); if (derivedKey.empty()) - { - cwarn << "Key derivation failed."; - return string(); - } + BOOST_THROW_EXCEPTION(crypto::CryptoException() << errinfo_comment("Key derivation failed.")); ret["cipher"] = "aes-128-ctr"; h128 key(derivedKey, h128::AlignLeft); @@ -260,10 +255,7 @@ string SecretStore::encrypt(bytes const& _v, string const& _pass, KDF _kdf) // cipher text bytes cipherText = encryptSymNoAuth(key, iv, &_v); if (cipherText.empty()) - { - cwarn << "Key encryption failed."; - return string(); - } + BOOST_THROW_EXCEPTION(crypto::CryptoException() << errinfo_comment("Key encryption failed.")); ret["ciphertext"] = toHex(cipherText); // and mac. From 032ebde3ecd0a75c9ae9687b3186044ca66b6854 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Thu, 18 Jun 2015 12:31:58 +0200 Subject: [PATCH 118/169] avoid network tests when --nonetwork is set --- test/TestHelper.cpp | 7 ++++--- test/TestHelper.h | 3 ++- test/libethereum/stateOriginal.cpp | 6 +++++- test/libp2p/capability.cpp | 4 ++++ test/libp2p/net.cpp | 26 ++++++++++++++++++++++++++ test/libp2p/peer.cpp | 12 +++++++++--- test/libwhisper/whisperTopic.cpp | 11 +++++++++++ 7 files changed, 61 insertions(+), 8 deletions(-) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 4e1ad92b4..6c1db8eea 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -754,8 +754,10 @@ Options::Options() checkState = true; else if (arg == "--wallet") wallet = true; - else if (arg == "--network") - network = true; + else if (arg == "--nonetwork") + nonetwork = true; + else if (arg == "--nodag") + nodag = true; else if (arg == "--all") { performance = true; @@ -764,7 +766,6 @@ Options::Options() inputLimits = true; bigData = true; wallet = true; - network = true; } else if (arg == "--singletest" && i + 1 < argc) { diff --git a/test/TestHelper.h b/test/TestHelper.h index ab52a550c..c21429ef4 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -223,7 +223,8 @@ public: bool inputLimits = false; bool bigData = false; bool wallet = false; - bool network = false; + bool nonetwork = false; + bool nodag = false; /// @} /// Get reference to options diff --git a/test/libethereum/stateOriginal.cpp b/test/libethereum/stateOriginal.cpp index e7a078182..ac2f893de 100644 --- a/test/libethereum/stateOriginal.cpp +++ b/test/libethereum/stateOriginal.cpp @@ -27,7 +27,8 @@ #include #include #include -#include "../TestHelper.h" +#include + using namespace std; using namespace dev; using namespace dev::eth; @@ -48,6 +49,9 @@ BOOST_AUTO_TEST_CASE(Basic) BOOST_AUTO_TEST_CASE(Complex) { + if (test::Options::get().nodag) + return; + cnote << "Testing State..."; KeyPair me = sha3("Gav Wood"); diff --git a/test/libp2p/capability.cpp b/test/libp2p/capability.cpp index fa8592bdd..13ae4d498 100644 --- a/test/libp2p/capability.cpp +++ b/test/libp2p/capability.cpp @@ -27,6 +27,7 @@ along with cpp-ethereum. If not, see . #include #include #include +#include using namespace std; using namespace dev; @@ -98,6 +99,9 @@ BOOST_FIXTURE_TEST_SUITE(p2pCapability, P2PFixture) BOOST_AUTO_TEST_CASE(capability) { + if (test::Options::get().nonetwork) + return; + VerbosityHolder verbosityHolder(10); cnote << "Testing Capability..."; diff --git a/test/libp2p/net.cpp b/test/libp2p/net.cpp index a31537b98..8c652b479 100644 --- a/test/libp2p/net.cpp +++ b/test/libp2p/net.cpp @@ -26,6 +26,8 @@ #include #include #include +#include + using namespace std; using namespace dev; using namespace dev::p2p; @@ -153,6 +155,9 @@ public: BOOST_AUTO_TEST_CASE(requestTimeout) { + if (test::Options::get().nonetwork) + return; + using TimePoint = std::chrono::steady_clock::time_point; using RequestTimeout = std::pair; @@ -220,6 +225,9 @@ BOOST_AUTO_TEST_CASE(isIPAddressType) BOOST_AUTO_TEST_CASE(v2PingNodePacket) { + if (test::Options::get().nonetwork) + return; + // test old versino of pingNode packet w/new RLPStream s; s.appendList(3); s << "1.1.1.1" << 30303 << std::chrono::duration_cast((std::chrono::system_clock::now() + chrono::seconds(60)).time_since_epoch()).count(); @@ -231,6 +239,9 @@ BOOST_AUTO_TEST_CASE(v2PingNodePacket) BOOST_AUTO_TEST_CASE(neighboursPacketLength) { + if (test::Options::get().nonetwork) + return; + KeyPair k = KeyPair::create(); std::vector> testNodes(TestNodeTable::createTestNodes(16)); bi::udp::endpoint to(boost::asio::ip::address::from_string("127.0.0.1"), 30000); @@ -256,6 +267,9 @@ BOOST_AUTO_TEST_CASE(neighboursPacketLength) BOOST_AUTO_TEST_CASE(neighboursPacket) { + if (test::Options::get().nonetwork) + return; + KeyPair k = KeyPair::create(); std::vector> testNodes(TestNodeTable::createTestNodes(16)); bi::udp::endpoint to(boost::asio::ip::address::from_string("127.0.0.1"), 30000); @@ -291,6 +305,9 @@ BOOST_AUTO_TEST_CASE(test_findnode_neighbours) BOOST_AUTO_TEST_CASE(kademlia) { + if (test::Options::get().nonetwork) + return; + // Not yet a 'real' test. TestNodeTableHost node(8); node.start(); @@ -324,6 +341,9 @@ BOOST_AUTO_TEST_CASE(kademlia) BOOST_AUTO_TEST_CASE(udpOnce) { + if (test::Options::get().nonetwork) + return; + UDPDatagram d(bi::udp::endpoint(boost::asio::ip::address::from_string("127.0.0.1"), 30300), bytes({65,65,65,65})); TestUDPSocket a; a.m_socket->connect(); a.start(); a.m_socket->send(d); @@ -337,6 +357,9 @@ BOOST_AUTO_TEST_SUITE(netTypes) BOOST_AUTO_TEST_CASE(unspecifiedNode) { + if (test::Options::get().nonetwork) + return; + Node n = UnspecifiedNode; BOOST_REQUIRE(!n); @@ -350,6 +373,9 @@ BOOST_AUTO_TEST_CASE(unspecifiedNode) BOOST_AUTO_TEST_CASE(nodeTableReturnsUnspecifiedNode) { + if (test::Options::get().nonetwork) + return; + ba::io_service io; NodeTable t(io, KeyPair::create(), NodeIPEndpoint(bi::address::from_string("127.0.0.1"), 30303, 30303)); if (Node n = t.node(NodeId())) diff --git a/test/libp2p/peer.cpp b/test/libp2p/peer.cpp index 5fea9225e..8f37ce164 100644 --- a/test/libp2p/peer.cpp +++ b/test/libp2p/peer.cpp @@ -40,7 +40,7 @@ BOOST_FIXTURE_TEST_SUITE(p2p, P2PFixture) BOOST_AUTO_TEST_CASE(host) { - if (!test::Options::get().network) + if (test::Options::get().nonetwork) return; VerbosityHolder sentinel(10); @@ -69,7 +69,7 @@ BOOST_AUTO_TEST_CASE(host) BOOST_AUTO_TEST_CASE(networkConfig) { - if (!test::Options::get().network) + if (test::Options::get().nonetwork) return; Host save("Test", NetworkPreferences(false)); @@ -81,7 +81,7 @@ BOOST_AUTO_TEST_CASE(networkConfig) BOOST_AUTO_TEST_CASE(saveNodes) { - if (!test::Options::get().network) + if (test::Options::get().nonetwork) return; VerbosityHolder reduceVerbosity(2); @@ -145,6 +145,9 @@ BOOST_FIXTURE_TEST_SUITE(p2pPeer, P2PFixture) BOOST_AUTO_TEST_CASE(requirePeer) { + if (test::Options::get().nonetwork) + return; + VerbosityHolder reduceVerbosity(10); const char* const localhost = "127.0.0.1"; @@ -197,6 +200,9 @@ BOOST_AUTO_TEST_SUITE(peerTypes) BOOST_AUTO_TEST_CASE(emptySharedPeer) { + if (test::Options::get().nonetwork) + return; + shared_ptr p; BOOST_REQUIRE(!p); diff --git a/test/libwhisper/whisperTopic.cpp b/test/libwhisper/whisperTopic.cpp index b5f5cd7d3..f09705ccb 100644 --- a/test/libwhisper/whisperTopic.cpp +++ b/test/libwhisper/whisperTopic.cpp @@ -25,6 +25,8 @@ #include #include #include +#include + using namespace std; using namespace dev; using namespace dev::p2p; @@ -40,6 +42,9 @@ BOOST_FIXTURE_TEST_SUITE(whisper, P2PFixture) BOOST_AUTO_TEST_CASE(topic) { + if (test::Options::get().nonetwork) + return; + cnote << "Testing Whisper..."; VerbosityHolder setTemporaryLevel(0); @@ -103,6 +108,9 @@ BOOST_AUTO_TEST_CASE(topic) BOOST_AUTO_TEST_CASE(forwarding) { + if (test::Options::get().nonetwork) + return; + cnote << "Testing Whisper forwarding..."; VerbosityHolder setTemporaryLevel(0); @@ -203,6 +211,9 @@ BOOST_AUTO_TEST_CASE(forwarding) BOOST_AUTO_TEST_CASE(asyncforwarding) { + if (test::Options::get().nonetwork) + return; + cnote << "Testing Whisper async forwarding..."; VerbosityHolder setTemporaryLevel(2); From ec71a9c69ff1fb9fd7d8e31137570686b2313550 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 18 Jun 2015 12:38:09 +0200 Subject: [PATCH 119/169] - Scenario Panel UI changes --- libethereum/BlockChain.cpp | 2 +- mix/qml/Block.qml | 106 ++++++++++++++++------------------ mix/qml/BlockChain.qml | 24 ++++++-- mix/qml/ScenarioButton.qml | 3 +- mix/qml/ScenarioExecution.qml | 3 +- mix/qml/ScenarioLoader.qml | 44 +++++++++++++- 6 files changed, 115 insertions(+), 67 deletions(-) diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 195f65f1d..36f2d3e11 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -391,7 +391,7 @@ ImportRoute BlockChain::import(bytes const& _block, OverlayDB const& _db, Import try #endif { - block = verifyBlock(_block, m_onBad); + block = verifyBlock(_block, m_onBad, _ir); } #if ETH_CATCH catch (Exception& ex) diff --git a/mix/qml/Block.qml b/mix/qml/Block.qml index 46689e0f2..8fc282246 100644 --- a/mix/qml/Block.qml +++ b/mix/qml/Block.qml @@ -47,7 +47,7 @@ ColumnLayout Layout.preferredHeight: trHeight Layout.preferredWidth: blockWidth id: rowHeader - + spacing: 0 Rectangle { Layout.preferredWidth: blockWidth @@ -55,7 +55,7 @@ ColumnLayout color: "#DEDCDC" radius: 4 anchors.left: parent.left - anchors.leftMargin: statusWidth + 5 + anchors.leftMargin: statusWidth Label { anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left @@ -99,6 +99,7 @@ ColumnLayout { id: rowTransaction Layout.preferredHeight: trHeight + spacing: 0 function displayContent() { logsText.text = "" @@ -138,7 +139,7 @@ ColumnLayout Image { anchors.top: parent.top - anchors.topMargin: -7 + anchors.topMargin: -10 id: saveStatusImage source: "qrc:/qml/img/recyclediscard@2x.png" width: statusWidth @@ -179,14 +180,27 @@ ColumnLayout color: "#DEDCDC" id: rowContentTr anchors.top: parent.top + + MouseArea + { + anchors.fill: parent + onDoubleClicked: + { + transactionDialog.stateAccounts = scenario.accounts + transactionDialog.execute = false + transactionDialog.open(index, blockIndex, transactions.get(index)) + } + } + ColumnLayout { anchors.top: parent.top + width: parent.width spacing: 10 RowLayout { anchors.top: parent.top - anchors.verticalCenter: parent.verticalCenter + Layout.fillWidth: true spacing: cellSpacing Text { @@ -275,59 +289,7 @@ ColumnLayout } } - Rectangle - { - Layout.preferredWidth: debugActionWidth - Layout.preferredHeight: trHeight - 10 - color: "transparent" - - Image { - source: "qrc:/qml/img/edit.png" - width: 18 - fillMode: Image.PreserveAspectFit - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - } - MouseArea - { - anchors.fill: parent - onClicked: - { - transactionDialog.stateAccounts = scenario.accounts - transactionDialog.execute = false - transactionDialog.open(index, blockIndex, transactions.get(index)) - } - } - } - - Rectangle - { - Layout.preferredWidth: debugActionWidth - Layout.preferredHeight: trHeight - 10 - color: "transparent" - Image { - id: debugImg - source: "qrc:/qml/img/rightarrow@2x.png" - width: statusWidth - fillMode: Image.PreserveAspectFit - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - visible: transactions.get(index).recordIndex !== undefined - } - MouseArea - { - anchors.fill: parent - onClicked: - { - if (transactions.get(index).recordIndex !== undefined) - { - debugTrRequested = [ blockIndex, index ] - clientModel.debugRecord(transactions.get(index).recordIndex); - } - } - } - } } RowLayout @@ -363,6 +325,38 @@ ColumnLayout } } } + + Rectangle + { + width: debugActionWidth + height: trHeight - 10 + anchors.left: rowContentTr.right + anchors.top: rowContentTr.top + anchors.leftMargin: -50 + color: "transparent" + + Image { + id: debugImg + source: "qrc:/qml/img/rightarrow@2x.png" + width: debugActionWidth + fillMode: Image.PreserveAspectFit + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + visible: transactions.get(index).recordIndex !== undefined + } + MouseArea + { + anchors.fill: parent + onClicked: + { + if (transactions.get(index).recordIndex !== undefined) + { + debugTrRequested = [ blockIndex, index ] + clientModel.debugRecord(transactions.get(index).recordIndex); + } + } + } + } } } } diff --git a/mix/qml/BlockChain.qml b/mix/qml/BlockChain.qml index f6a56fb4f..6467009da 100644 --- a/mix/qml/BlockChain.qml +++ b/mix/qml/BlockChain.qml @@ -18,6 +18,18 @@ ColumnLayout { property int previousWidth property variant debugTrRequested: [] signal chainChanged + signal chainReloaded + + Connections + { + target: codeModel + onContractRenamed: { + rebuild.startBlinking() + } + onNewContractCompiled: { + rebuild.startBlinking() + } + } onChainChanged: { rebuild.startBlinking() @@ -30,14 +42,14 @@ ColumnLayout { { fromWidth = 100 toWidth = 100 - valueWidth = 200 + valueWidth = 250 } else { var diff = (width - previousWidth) / 3; fromWidth = fromWidth + diff < 100 ? 100 : fromWidth + diff toWidth = toWidth + diff < 100 ? 100 : toWidth + diff - valueWidth = valueWidth + diff < 200 ? 200 : valueWidth + diff + valueWidth = valueWidth + diff < 250 ? 250 : valueWidth + diff } previousWidth = width } @@ -47,7 +59,7 @@ ColumnLayout { if (!scenario) return; if (model) - chainChanged() + rebuild.startBlinking() model = scenario blockModel.clear() for (var b in model.blocks) @@ -55,10 +67,10 @@ ColumnLayout { previousWidth = width } - property int statusWidth: 40 + property int statusWidth: 50 property int fromWidth: 100 property int toWidth: 100 - property int valueWidth: 200 + property int valueWidth: 250 property int logsWidth: 40 property int debugActionWidth: 40 property int horizontalMargin: 10 @@ -68,7 +80,7 @@ ColumnLayout { { id: header spacing: 0 - Layout.preferredHeight: 30 + Layout.preferredHeight: 40 Image { id: debugImage source: "qrc:/qml/img/recycleicon@2x.png" diff --git a/mix/qml/ScenarioButton.qml b/mix/qml/ScenarioButton.qml index 7f8b5d202..1577ec955 100644 --- a/mix/qml/ScenarioButton.qml +++ b/mix/qml/ScenarioButton.qml @@ -13,7 +13,8 @@ Rectangle { function startBlinking() { - blinkTimer.start() + if (!blinkTimer.running) + blinkTimer.start() } function stopBlinking() diff --git a/mix/qml/ScenarioExecution.qml b/mix/qml/ScenarioExecution.qml index 85f1990c8..3e9d8e089 100644 --- a/mix/qml/ScenarioExecution.qml +++ b/mix/qml/ScenarioExecution.qml @@ -52,7 +52,8 @@ Rectangle { Connections { target: loader - onLoaded: { + onLoaded: + { blockChain.load(scenario) } } diff --git a/mix/qml/ScenarioLoader.qml b/mix/qml/ScenarioLoader.qml index dd67a6f0a..9323300ab 100644 --- a/mix/qml/ScenarioLoader.qml +++ b/mix/qml/ScenarioLoader.qml @@ -17,6 +17,7 @@ ColumnLayout signal saved(variant scenario) signal duplicated(variant scenario) signal loaded(variant scenario) + signal renamed(variant scenario) spacing: 0 function init() { @@ -28,8 +29,6 @@ ColumnLayout editStatus.visible = true } - //anchors.margins: 10 - //width: parent.width Rectangle { Layout.fillWidth: true @@ -75,6 +74,9 @@ ColumnLayout projectModel.stateListModel.getState(scenarioList.currentIndex).title = scenarioName.text projectModel.saveProjectFile() saved(state) + scenarioList.model.get(scenarioList.currentIndex).title = scenarioName.text + scenarioList.currentIndex = scenarioList.currentIndex + renamed(projectModel.stateListModel.getState(scenarioList.currentIndex)) } } @@ -149,6 +151,7 @@ ColumnLayout model: projectModel.stateListModel textRole: "title" height: 30 + width: 150 onCurrentIndexChanged: { restoreScenario.restore() @@ -159,6 +162,43 @@ ColumnLayout var state = projectModel.stateListModel.getState(currentIndex) loaded(state) } + + style: ComboBoxStyle { + background: Rectangle { + color: "white" + border.color: "#cccccc" + border.width: 1 + radius: 4 + anchors.fill: parent + } + label: Rectangle { + anchors.fill: parent + color: "white" + Text { + id: comboLabel + maximumLineCount: 1 + elide: Text.ElideRight + width: parent.width + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + text: { + if (projectModel.stateListModel.getState(scenarioList.currentIndex)) + return projectModel.stateListModel.getState(scenarioList.currentIndex).title + else + return "" + } + Connections { + target: blockChainSelector + onLoaded: { + comboLabel.text = projectModel.stateListModel.getState(scenarioList.currentIndex).title + } + onRenamed: { + comboLabel.text = scenario.title + } + } + } + } + } } ScenarioButton { From 7afcafa127a9ba80a97ae4f79a36d63ae933c9ad Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2015 14:41:06 +0200 Subject: [PATCH 120/169] Tests for constructor arguments "from outside". --- test/libsolidity/SolidityEndToEndTest.cpp | 28 ++++++++++++++++--- test/libsolidity/solidityExecutionFramework.h | 18 +++++++++--- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 66a8f8820..7ee259abe 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -1726,7 +1726,7 @@ BOOST_AUTO_TEST_CASE(fixed_bytes_in_calls) BOOST_CHECK(callContractFunction("callHelper(bytes2,bool)", string("\0a", 2), true) == encodeArgs(string("\0a\0\0\0", 5))); } -BOOST_AUTO_TEST_CASE(constructor_arguments) +BOOST_AUTO_TEST_CASE(constructor_arguments_internal) { char const* sourceCode = R"( contract Helper { @@ -1749,8 +1749,28 @@ BOOST_AUTO_TEST_CASE(constructor_arguments) function getName() returns (bytes3 ret) { return h.getName(); } })"; compileAndRun(sourceCode, 0, "Main"); - BOOST_REQUIRE(callContractFunction("getFlag()") == encodeArgs(true)); - BOOST_REQUIRE(callContractFunction("getName()") == encodeArgs("abc")); + BOOST_CHECK(callContractFunction("getFlag()") == encodeArgs(true)); + BOOST_CHECK(callContractFunction("getName()") == encodeArgs("abc")); +} + +BOOST_AUTO_TEST_CASE(constructor_arguments_external) +{ + char const* sourceCode = R"( + contract Main { + bytes3 name; + bool flag; + + function Main(bytes3 x, bool f) { + name = x; + flag = f; + } + function getName() returns (bytes3 ret) { return name; } + function getFlag() returns (bool ret) { return flag; } + } + )"; + compileAndRun(sourceCode, 0, "Main", encodeArgs("abc", true)); + BOOST_CHECK(callContractFunction("getFlag()") == encodeArgs(true)); + BOOST_CHECK(callContractFunction("getName()") == encodeArgs("abc")); } BOOST_AUTO_TEST_CASE(functions_called_by_constructor) @@ -4166,7 +4186,7 @@ BOOST_AUTO_TEST_CASE(evm_exceptions_in_constructor_out_of_baund) } } )"; - BOOST_CHECK(compileAndRunWthoutCheck(sourceCode, 0, "A").empty()); + BOOST_CHECK(compileAndRunWithoutCheck(sourceCode, 0, "A").empty()); } BOOST_AUTO_TEST_CASE(positive_integers_to_signed) diff --git a/test/libsolidity/solidityExecutionFramework.h b/test/libsolidity/solidityExecutionFramework.h index 4ba229815..0079d82b6 100644 --- a/test/libsolidity/solidityExecutionFramework.h +++ b/test/libsolidity/solidityExecutionFramework.h @@ -42,19 +42,29 @@ class ExecutionFramework public: ExecutionFramework() { g_logVerbosity = 0; } - bytes const& compileAndRunWthoutCheck(std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "") + bytes const& compileAndRunWithoutCheck( + std::string const& _sourceCode, + u256 const& _value = 0, + std::string const& _contractName = "", + bytes const& _arguments = bytes() + ) { m_compiler.reset(false, m_addStandardSources); m_compiler.addSource("", _sourceCode); ETH_TEST_REQUIRE_NO_THROW(m_compiler.compile(m_optimize, m_optimizeRuns), "Compiling contract failed"); bytes code = m_compiler.getBytecode(_contractName); - sendMessage(code, true, _value); + sendMessage(code + _arguments, true, _value); return m_output; } - bytes const& compileAndRun(std::string const& _sourceCode, u256 const& _value = 0, std::string const& _contractName = "") + bytes const& compileAndRun( + std::string const& _sourceCode, + u256 const& _value = 0, + std::string const& _contractName = "", + bytes const& _arguments = bytes() + ) { - compileAndRunWthoutCheck(_sourceCode, _value, _contractName); + compileAndRunWithoutCheck(_sourceCode, _value, _contractName, _arguments); BOOST_REQUIRE(!m_output.empty()); return m_output; } From d8eb362d32f63b250d385d02d92e5ead30ee8488 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 18 Jun 2015 15:15:55 +0200 Subject: [PATCH 121/169] VM: refactor and fix undefined behavior around data to memory copy. std::memcpy and std::memset cannot be called with invalid pointers even when the size to be copied/set is 0. --- libevm/VM.cpp | 58 +++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/libevm/VM.cpp b/libevm/VM.cpp index 36fba6e43..062581563 100644 --- a/libevm/VM.cpp +++ b/libevm/VM.cpp @@ -202,6 +202,24 @@ bytesConstRef VM::execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp) return nextPC; }; + auto copyDataToMemory = [](bytesConstRef _data, decltype(m_stack)& _stack, decltype(m_temp)& _memory) + { + auto offset = static_cast(_stack.back()); + _stack.pop_back(); + bigint bigIndex = _stack.back(); + auto index = static_cast(bigIndex); + _stack.pop_back(); + auto size = static_cast(_stack.back()); + _stack.pop_back(); + + auto sizeToBeCopied = bigIndex + size > _data.size() ? _data.size() < bigIndex ? 0 : _data.size() - index : size; + + if (sizeToBeCopied > 0) + std::memcpy(_memory.data() + offset, _data.data() + index, sizeToBeCopied); + if (size - sizeToBeCopied > 0) + std::memset(_memory.data() + offset + sizeToBeCopied, 0, size - sizeToBeCopied); + }; + m_steps = 0; for (auto nextPC = m_curPC + 1; true; m_curPC = nextPC, nextPC = m_curPC + 1, ++m_steps) { @@ -364,44 +382,16 @@ bytesConstRef VM::execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp) m_stack.back() = _ext.codeAt(asAddress(m_stack.back())).size(); break; case Instruction::CALLDATACOPY: + copyDataToMemory(_ext.data, m_stack, m_temp); + break; case Instruction::CODECOPY: + copyDataToMemory(&_ext.code, m_stack, m_temp); + break; case Instruction::EXTCODECOPY: { - Address a; - if (inst == Instruction::EXTCODECOPY) - { - a = asAddress(m_stack.back()); - m_stack.pop_back(); - } - unsigned offset = (unsigned)m_stack.back(); - m_stack.pop_back(); - u256 index = m_stack.back(); - m_stack.pop_back(); - unsigned size = (unsigned)m_stack.back(); + auto a = asAddress(m_stack.back()); m_stack.pop_back(); - unsigned sizeToBeCopied; - switch(inst) - { - case Instruction::CALLDATACOPY: - sizeToBeCopied = index + (bigint)size > (u256)_ext.data.size() ? (u256)_ext.data.size() < index ? 0 : _ext.data.size() - (unsigned)index : size; - memcpy(m_temp.data() + offset, _ext.data.data() + (unsigned)index, sizeToBeCopied); - break; - case Instruction::CODECOPY: - sizeToBeCopied = index + (bigint)size > (u256)_ext.code.size() ? (u256)_ext.code.size() < index ? 0 : _ext.code.size() - (unsigned)index : size; - memcpy(m_temp.data() + offset, _ext.code.data() + (unsigned)index, sizeToBeCopied); - break; - case Instruction::EXTCODECOPY: - sizeToBeCopied = index + (bigint)size > (u256)_ext.codeAt(a).size() ? (u256)_ext.codeAt(a).size() < index ? 0 : _ext.codeAt(a).size() - (unsigned)index : size; - memcpy(m_temp.data() + offset, _ext.codeAt(a).data() + (unsigned)index, sizeToBeCopied); - break; - default: - // this is unreachable, but if someone introduces a bug in the future, he may get here. - assert(false); - BOOST_THROW_EXCEPTION(InvalidOpcode() << errinfo_comment("CALLDATACOPY, CODECOPY or EXTCODECOPY instruction requested.")); - break; - } - memset(m_temp.data() + offset + sizeToBeCopied, 0, size - sizeToBeCopied); - break; + copyDataToMemory(&_ext.codeAt(a), m_stack, m_temp); } case Instruction::GASPRICE: m_stack.push_back(_ext.gasPrice); From af93ec370d3d76eda925644b72e6d4a96c0524a9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2015 14:41:24 +0200 Subject: [PATCH 122/169] Safe file writing and some tests. --- libdevcore/CommonIO.cpp | 24 ++++-- libdevcore/CommonIO.h | 8 +- libdevcrypto/SecretStore.cpp | 6 +- test/libdevcrypto/SecretStore.cpp | 132 +++++++++++++++++++++++++++++- 4 files changed, 155 insertions(+), 15 deletions(-) diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index d0a1b8c5b..cfe7b8a6b 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -23,13 +23,14 @@ #include #include #include -#include "Exceptions.h" #include #ifdef _WIN32 #include #else #include #endif +#include +#include "Exceptions.h" using namespace std; using namespace dev; @@ -95,12 +96,23 @@ string dev::contentsString(string const& _file) return contentsGeneric(_file); } -void dev::writeFile(std::string const& _file, bytesConstRef _data) +void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDeleteRename) { - ofstream s(_file, ios::trunc | ios::binary); - s.write(reinterpret_cast(_data.data()), _data.size()); - if (!s) - BOOST_THROW_EXCEPTION(FileError()); + if (_writeDeleteRename) + { + namespace fs = boost::filesystem; + fs::path tempPath = fs::unique_path(_file + "-%%%%%%"); + writeFile(tempPath.string(), _data, false); + // will delete _file if it exists + fs::rename(tempPath, _file); + } + else + { + ofstream s(_file, ios::trunc | ios::binary); + s.write(reinterpret_cast(_data.data()), _data.size()); + if (!s) + BOOST_THROW_EXCEPTION(FileError()); + } } std::string dev::getPassword(std::string const& _prompt) diff --git a/libdevcore/CommonIO.h b/libdevcore/CommonIO.h index cc2ef7484..da0f6a963 100644 --- a/libdevcore/CommonIO.h +++ b/libdevcore/CommonIO.h @@ -57,10 +57,12 @@ bytesRef contentsNew(std::string const& _file, bytesRef _dest = bytesRef()); /// Write the given binary data into the given file, replacing the file if it pre-exists. /// Throws exception on error. -void writeFile(std::string const& _file, bytesConstRef _data); +/// @param _writeDeleteRename useful not to lose any data: If set, first writes to another file in +/// the same directory and then moves that file. +void writeFile(std::string const& _file, bytesConstRef _data, bool _writeDeleteRename = false); /// Write the given binary data into the given file, replacing the file if it pre-exists. -inline void writeFile(std::string const& _file, bytes const& _data) { writeFile(_file, bytesConstRef(&_data)); } -inline void writeFile(std::string const& _file, std::string const& _data) { writeFile(_file, bytesConstRef(_data)); } +inline void writeFile(std::string const& _file, bytes const& _data, bool _writeDeleteRename = false) { writeFile(_file, bytesConstRef(&_data), _writeDeleteRename); } +inline void writeFile(std::string const& _file, std::string const& _data, bool _writeDeleteRename = false) { writeFile(_file, bytesConstRef(_data), _writeDeleteRename); } /// Nicely renders the given bytes to a string, optionally as HTML. /// @a _bytes: bytes array to be rendered as string. @a _width of a bytes line. diff --git a/libdevcrypto/SecretStore.cpp b/libdevcrypto/SecretStore.cpp index aeb06f11b..a7a16a1b8 100644 --- a/libdevcrypto/SecretStore.cpp +++ b/libdevcrypto/SecretStore.cpp @@ -88,8 +88,7 @@ static js::mValue upgraded(string const& _s) SecretStore::SecretStore(string const& _path): m_path(_path) { - if (!m_path.empty()) - load(); + load(); } bytes SecretStore::secret(h128 const& _uuid, function const& _pass, bool _useCache) const @@ -136,9 +135,6 @@ void SecretStore::clearCache() const void SecretStore::save(string const& _keysPath) { - if (_keysPath.empty()) - return; - fs::path p(_keysPath); fs::create_directories(p); for (auto& k: m_keys) diff --git a/test/libdevcrypto/SecretStore.cpp b/test/libdevcrypto/SecretStore.cpp index dafad28a8..c9d5131d0 100644 --- a/test/libdevcrypto/SecretStore.cpp +++ b/test/libdevcrypto/SecretStore.cpp @@ -36,6 +36,7 @@ using namespace dev; using namespace dev::test; namespace js = json_spirit; +namespace fs = boost::filesystem; BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir ); @@ -56,7 +57,8 @@ BOOST_AUTO_TEST_CASE(basic_tests) { cnote << i.first; js::mObject& o = i.second.get_obj(); - SecretStore store(""); + TransientDirectory tmpDir; + SecretStore store(tmpDir.path()); h128 u = store.readKeyContent(js::write_string(o["json"], false)); cdebug << "read uuid" << u; bytes s = store.secret(u, [&](){ return o["password"].get_str(); }); @@ -65,4 +67,132 @@ BOOST_AUTO_TEST_CASE(basic_tests) } } +BOOST_AUTO_TEST_CASE(import_key_from_file) +{ + // Imports a key from an external file. Tests that the imported key is there + // and that the external file is not deleted. + TransientDirectory importDir; + string importFile = importDir.path() + "/import.json"; + TransientDirectory storeDir; + string keyData = R"({ + "version": 3, + "crypto": { + "ciphertext": "d69313b6470ac1942f75d72ebf8818a0d484ac78478a132ee081cd954d6bd7a9", + "cipherparams": { "iv": "ffffffffffffffffffffffffffffffff" }, + "kdf": "pbkdf2", + "kdfparams": { "dklen": 32, "c": 262144, "prf": "hmac-sha256", "salt": "c82ef14476014cbf438081a42709e2ed" }, + "mac": "cf6bfbcc77142a22c4a908784b4a16f1023a1d0e2aff404c20158fa4f1587177", + "cipher": "aes-128-ctr", + "version": 1 + }, + "id": "abb67040-8dbe-0dad-fc39-2b082ef0ee5f" + })"; + string password = "bar"; + string priv = "0202020202020202020202020202020202020202020202020202020202020202"; + writeFile(importFile, keyData); + + h128 uuid; + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 0); + uuid = store.importKey(importFile); + BOOST_CHECK(!!uuid); + BOOST_CHECK(contentsString(importFile) == keyData); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }))); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + } + fs::remove(importFile); + // now do it again to check whether SecretStore properly stored it on disk + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }))); + } +} + +BOOST_AUTO_TEST_CASE(import_secret) +{ + for (string const& password: {"foobar", ""}) + { + TransientDirectory storeDir; + string priv = "0202020202020202020202020202020202020202020202020202020202020202"; + + h128 uuid; + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 0); + uuid = store.importSecret(fromHex(priv), password); + BOOST_CHECK(!!uuid); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }))); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + } + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }))); + } + } +} + +BOOST_AUTO_TEST_CASE(wrong_password) +{ + TransientDirectory storeDir; + SecretStore store(storeDir.path()); + string password = "foobar"; + string priv = "0202020202020202020202020202020202020202020202020202020202020202"; + + h128 uuid; + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 0); + uuid = store.importSecret(fromHex(priv), password); + BOOST_CHECK(!!uuid); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }))); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + // password will not be queried + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return "abcdefg"; }))); + } + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + BOOST_CHECK(store.secret(uuid, [&](){ return "abcdefg"; }).empty()); + } +} + +BOOST_AUTO_TEST_CASE(recode) +{ + TransientDirectory storeDir; + SecretStore store(storeDir.path()); + string password = "foobar"; + string changedPassword = "abcdefg"; + string priv = "0202020202020202020202020202020202020202020202020202020202020202"; + + h128 uuid; + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 0); + uuid = store.importSecret(fromHex(priv), password); + BOOST_CHECK(!!uuid); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return password; }))); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + } + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + BOOST_CHECK(store.secret(uuid, [&](){ return "abcdefg"; }).empty()); + BOOST_CHECK(store.recode(uuid, changedPassword, [&](){ return password; })); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return changedPassword; }))); + store.clearCache(); + BOOST_CHECK(store.secret(uuid, [&](){ return password; }).empty()); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return changedPassword; }))); + } + { + SecretStore store(storeDir.path()); + BOOST_CHECK_EQUAL(store.keys().size(), 1); + BOOST_CHECK(store.secret(uuid, [&](){ return password; }).empty()); + BOOST_CHECK_EQUAL(priv, toHex(store.secret(uuid, [&](){ return changedPassword; }))); + } +} + BOOST_AUTO_TEST_SUITE_END() From 6b3fd2d3cae85bd310f46f5929b110a579684c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 18 Jun 2015 14:01:43 +0200 Subject: [PATCH 123/169] Small override & std::move fixes. --- libethereum/BlockChain.cpp | 2 +- libethereum/EthereumHost.h | 6 +++--- libweb3jsonrpc/JsonHelper.h | 2 +- mix/MixClient.h | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 10256900d..92cc2733f 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -1122,6 +1122,6 @@ VerifiedBlockRef BlockChain::verifyBlock(bytes const& _block, function; using UncleHashes = h256s; diff --git a/mix/MixClient.h b/mix/MixClient.h index afb9f5430..1172bffbd 100644 --- a/mix/MixClient.h +++ b/mix/MixClient.h @@ -59,6 +59,7 @@ public: dev::eth::ExecutionResult call(Address const& _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice, eth::BlockNumber _blockNumber = eth::PendingBlock, eth::FudgeFactor _ff = eth::FudgeFactor::Strict) override; dev::eth::ExecutionResult create(Address const& _secret, u256 _value, bytes const& _data = bytes(), u256 _gas = 10000, u256 _gasPrice = 10 * eth::szabo, eth::BlockNumber _blockNumber = eth::PendingBlock, eth::FudgeFactor _ff = eth::FudgeFactor::Strict) override; + using ClientBase::submitTransaction; void submitTransaction(Secret _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice, bool _gasAuto); Address submitTransaction(Secret _secret, u256 _endowment, bytes const& _init, u256 _gas, u256 _gasPrice, bool _gasAuto); dev::eth::ExecutionResult call(Address const& _secret, u256 _value, Address _dest, bytes const& _data, u256 _gas, u256 _gasPrice, eth::BlockNumber _blockNumber, bool _gasAuto, eth::FudgeFactor _ff = eth::FudgeFactor::Strict); From 447494138078ab1b67c4080daa45769924d5117c Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Thu, 18 Jun 2015 15:29:05 +0200 Subject: [PATCH 124/169] BloomFilter refactoring: template class --- libwhisper/BloomFilter.cpp | 12 ++++--- libwhisper/BloomFilter.h | 65 +++++++++++++++++++++++++++++++------- 2 files changed, 62 insertions(+), 15 deletions(-) diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp index cff69c664..9680ded66 100644 --- a/libwhisper/BloomFilter.cpp +++ b/libwhisper/BloomFilter.cpp @@ -25,9 +25,11 @@ using namespace std; using namespace dev; using namespace dev::shh; +/* static unsigned const c_mask[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; -void TopicBloomFilter::addRaw(AbridgedTopic const& _h) +template +void TopicBloomFilterBase::addRaw(FixedHash const& _h) { *this |= _h; for (unsigned i = 0; i < CounterSize; ++i) @@ -40,7 +42,8 @@ void TopicBloomFilter::addRaw(AbridgedTopic const& _h) } } -void TopicBloomFilter::removeRaw(AbridgedTopic const& _h) +template +void TopicBloomFilterBase::removeRaw(FixedHash const& _h) { for (unsigned i = 0; i < CounterSize; ++i) if (isBitSet(_h, i)) @@ -53,12 +56,13 @@ void TopicBloomFilter::removeRaw(AbridgedTopic const& _h) } } -bool TopicBloomFilter::isBitSet(AbridgedTopic const& _h, unsigned _index) +template +bool TopicBloomFilterBase::isBitSet(FixedHash const& _h, unsigned _index) { unsigned iByte = _index / 8; unsigned iBit = _index % 8; return (_h[iByte] & c_mask[iBit]) != 0; } - +*/ diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index 0ca460805..cc236c255 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -28,30 +28,73 @@ namespace dev namespace shh { -class TopicBloomFilter: public AbridgedTopic +//enum { BloomSize = 4 }; + +template +class TopicBloomFilterBase: public FixedHash { public: - TopicBloomFilter() { init(); } - TopicBloomFilter(AbridgedTopic const& _h): AbridgedTopic(_h) { init(); } + TopicBloomFilterBase() { init(); } + TopicBloomFilterBase(FixedHash const& _h): FixedHash(_h) { init(); } - void addBloom(AbridgedTopic const& _h) { addRaw(_h.template bloomPart()); } - void removeBloom(AbridgedTopic const& _h) { removeRaw(_h.template bloomPart()); } - bool containsBloom(AbridgedTopic const& _h) const { return contains(_h.template bloomPart()); } + void addBloom(AbridgedTopic const& _h) { addRaw(_h.template bloomPart()); } + void removeBloom(AbridgedTopic const& _h) { removeRaw(_h.template bloomPart()); } + bool containsBloom(AbridgedTopic const& _h) const { return contains(_h.template bloomPart()); } - void addRaw(AbridgedTopic const& _h); - void removeRaw(AbridgedTopic const& _h); - bool containsRaw(AbridgedTopic const& _h) const { return contains(_h); } + void addRaw(FixedHash const& _h); + void removeRaw(FixedHash const& _h); + bool containsRaw(FixedHash const& _h) const { return contains(_h); } enum { BitsPerBloom = 3 }; private: void init() { for (unsigned i = 0; i < CounterSize; ++i) m_refCounter[i] = 0; } - static bool isBitSet(AbridgedTopic const& _h, unsigned _index); + static bool isBitSet(FixedHash const& _h, unsigned _index); - enum { CounterSize = 8 * TopicBloomFilter::size }; + enum { CounterSize = 8 * TopicBloomFilterBase::size }; std::array m_refCounter; }; +static unsigned const c_mask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; + +template +void TopicBloomFilterBase::addRaw(FixedHash const& _h) +{ + *this |= _h; + for (unsigned i = 0; i < CounterSize; ++i) + if (isBitSet(_h, i)) + { + if (m_refCounter[i] != numeric_limits::max()) + m_refCounter[i]++; + else + BOOST_THROW_EXCEPTION(Overflow()); + } +} + +template +void TopicBloomFilterBase::removeRaw(FixedHash const& _h) +{ + for (unsigned i = 0; i < CounterSize; ++i) + if (isBitSet(_h, i)) + { + if (m_refCounter[i]) + m_refCounter[i]--; + + if (!m_refCounter[i]) + (*this)[i / 8] &= ~c_mask[i % 8]; + } +} + +template +bool TopicBloomFilterBase::isBitSet(FixedHash const& _h, unsigned _index) +{ + unsigned iByte = _index / 8; + unsigned iBit = _index % 8; + return (_h[iByte] & c_mask[iBit]) != 0; +} + +using TopicBloomFilter = TopicBloomFilterBase<4>; + } } From c7b257acde69e42ca2448bd0cb535470e5992db8 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2015 16:35:25 +0200 Subject: [PATCH 125/169] Fix and test for not really recursive structs. Fixes #2223. --- libsolidity/AST.cpp | 33 +++++++++++-------- .../SolidityNameAndTypeResolution.cpp | 11 +++++++ 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/libsolidity/AST.cpp b/libsolidity/AST.cpp index 6d6a13cff..7333c024a 100644 --- a/libsolidity/AST.cpp +++ b/libsolidity/AST.cpp @@ -21,6 +21,7 @@ */ #include +#include #include #include #include @@ -434,23 +435,29 @@ void StructDefinition::checkMemberTypes() const void StructDefinition::checkRecursion() const { - set definitionsSeen; - vector queue = {this}; - while (!queue.empty()) + using StructPointer = StructDefinition const*; + using StructPointersSet = set; + function check = [&](StructPointer _struct, StructPointersSet const& _parents) { - StructDefinition const* def = queue.back(); - queue.pop_back(); - if (definitionsSeen.count(def)) - BOOST_THROW_EXCEPTION(ParserError() << errinfo_sourceLocation(def->getLocation()) - << errinfo_comment("Recursive struct definition.")); - definitionsSeen.insert(def); - for (ASTPointer const& member: def->getMembers()) + if (_parents.count(_struct)) + BOOST_THROW_EXCEPTION( + ParserError() << + errinfo_sourceLocation(_struct->getLocation()) << + errinfo_comment("Recursive struct definition.") + ); + set parents = _parents; + parents.insert(_struct); + for (ASTPointer const& member: _struct->getMembers()) if (member->getType()->getCategory() == Type::Category::Struct) { - UserDefinedTypeName const& typeName = dynamic_cast(*member->getTypeName()); - queue.push_back(&dynamic_cast(*typeName.getReferencedDeclaration())); + auto const& typeName = dynamic_cast(*member->getTypeName()); + check( + &dynamic_cast(*typeName.getReferencedDeclaration()), + parents + ); } - } + }; + check(this, {}); } TypePointer EnumDefinition::getType(ContractDefinition const*) const diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index fced12848..afa8b727f 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -190,6 +190,17 @@ BOOST_AUTO_TEST_CASE(struct_definition_indirectly_recursive) BOOST_CHECK_THROW(parseTextAndResolveNames(text), ParserError); } +BOOST_AUTO_TEST_CASE(struct_definition_not_really_recursive) +{ + char const* text = R"( + contract test { + struct s1 { uint a; } + struct s2 { s1 x; s1 y; } + } + )"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); +} + BOOST_AUTO_TEST_CASE(struct_definition_recursion_via_mapping) { char const* text = "contract test {\n" From d42f404b12f9d63de2e00fc7caf122e87d971724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 18 Jun 2015 16:37:23 +0200 Subject: [PATCH 126/169] Fix int comparison. --- libevm/VM.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libevm/VM.cpp b/libevm/VM.cpp index 062581563..2b2ada0ae 100644 --- a/libevm/VM.cpp +++ b/libevm/VM.cpp @@ -212,11 +212,11 @@ bytesConstRef VM::execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp) auto size = static_cast(_stack.back()); _stack.pop_back(); - auto sizeToBeCopied = bigIndex + size > _data.size() ? _data.size() < bigIndex ? 0 : _data.size() - index : size; + size_t sizeToBeCopied = bigIndex + size > _data.size() ? _data.size() < bigIndex ? 0 : _data.size() - index : size; if (sizeToBeCopied > 0) std::memcpy(_memory.data() + offset, _data.data() + index, sizeToBeCopied); - if (size - sizeToBeCopied > 0) + if (size > sizeToBeCopied) std::memset(_memory.data() + offset + sizeToBeCopied, 0, size - sizeToBeCopied); }; From f2dd242f5bf31f27c05ded8c36a4e7c1a9f69ed9 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2015 16:49:38 +0200 Subject: [PATCH 127/169] Fixed build errors. --- test/libdevcrypto/SecretStore.cpp | 2 +- test/libdevcrypto/crypto.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/test/libdevcrypto/SecretStore.cpp b/test/libdevcrypto/SecretStore.cpp index c9d5131d0..30bff49d9 100644 --- a/test/libdevcrypto/SecretStore.cpp +++ b/test/libdevcrypto/SecretStore.cpp @@ -38,7 +38,7 @@ using namespace dev::test; namespace js = json_spirit; namespace fs = boost::filesystem; -BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir ); +BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir ) BOOST_AUTO_TEST_SUITE(KeyStore) diff --git a/test/libdevcrypto/crypto.cpp b/test/libdevcrypto/crypto.cpp index 31589c3ce..1a0537ccd 100644 --- a/test/libdevcrypto/crypto.cpp +++ b/test/libdevcrypto/crypto.cpp @@ -39,7 +39,7 @@ using namespace dev::test; using namespace dev::crypto; using namespace CryptoPP; -BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir ); +BOOST_GLOBAL_FIXTURE( MoveNonceToTempDir ) BOOST_AUTO_TEST_SUITE(devcrypto) @@ -49,7 +49,6 @@ static CryptoPP::OID s_curveOID(CryptoPP::ASN1::secp256k1()); static CryptoPP::DL_GroupParameters_EC s_params(s_curveOID); static CryptoPP::DL_GroupParameters_EC::EllipticCurve s_curve(s_params.GetCurve()); - BOOST_AUTO_TEST_CASE(sha3general) { BOOST_REQUIRE_EQUAL(sha3(""), h256("c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470")); From f75e1fbdcdf29ac3c24739ebe647b9deda3ec0a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 18 Jun 2015 16:57:46 +0200 Subject: [PATCH 128/169] Eliminate undefied behavior in RLPStream. --- libdevcore/RLP.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libdevcore/RLP.cpp b/libdevcore/RLP.cpp index 846664cfd..330893c76 100644 --- a/libdevcore/RLP.cpp +++ b/libdevcore/RLP.cpp @@ -202,9 +202,7 @@ unsigned RLP::items() const RLPStream& RLPStream::appendRaw(bytesConstRef _s, unsigned _itemCount) { - unsigned os = m_out.size(); - m_out.resize(os + _s.size()); - memcpy(m_out.data() + os, _s.data(), _s.size()); + m_out.insert(m_out.end(), _s.begin(), _s.end()); noteAppended(_itemCount); return *this; } From 96d667baa814c0a2a0bfd16b97a8a403ce17d506 Mon Sep 17 00:00:00 2001 From: arkpar Date: Thu, 18 Jun 2015 17:00:03 +0200 Subject: [PATCH 129/169] don't grab unneeded blocks --- libethereum/BlockChainSync.cpp | 8 ++++---- libethereum/BlockChainSync.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index bcc7f72f3..eb4514731 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -402,7 +402,7 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ clog(NetWarn) << "Bad state: asking for Hashes yet not syncing!"; return; } - if (shouldGrabBlocks()) + if (shouldGrabBlocks(_peer)) { clog(NetNote) << "Difficulty of hashchain HIGHER. Grabbing" << m_syncingNeededBlocks.size() << "blocks [latest now" << m_syncingLatestHash << ", was" << host().latestBlockSent() << "]"; downloadMan().resetToChain(m_syncingNeededBlocks); @@ -504,10 +504,10 @@ bool PV60Sync::isSyncing(EthereumPeer* _peer) const return m_syncer == _peer; } -bool PV60Sync::shouldGrabBlocks() const +bool PV60Sync::shouldGrabBlocks(EthereumPeer* _peer) const { - auto td = m_syncingTotalDifficulty; - auto lh = m_syncingLatestHash; + auto td = _peer->m_totalDifficulty; + auto lh = _peer->m_latestHash; auto ctd = host().chain().details().totalDifficulty; if (m_syncingNeededBlocks.empty()) diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h index 1337c5c90..e981a344e 100644 --- a/libethereum/BlockChainSync.h +++ b/libethereum/BlockChainSync.h @@ -174,8 +174,8 @@ private: /// Do we presently need syncing with this peer? bool needsSyncing(EthereumPeer* _peer) const; - /// Check whether the session should bother grabbing blocks. - bool shouldGrabBlocks() const; + /// Check whether the session should bother grabbing blocks from a peer. + bool shouldGrabBlocks(EthereumPeer* _peer) const; /// Attempt to begin syncing with the peer; first check the peer has a more difficlult chain to download, then start asking for hashes, then move to blocks void attemptSync(EthereumPeer* _peer); From 2b4ddf80ab9fd4c1c3ec0391e1e6fade749c7198 Mon Sep 17 00:00:00 2001 From: chriseth Date: Thu, 18 Jun 2015 17:38:26 +0200 Subject: [PATCH 130/169] Added fallback function to gas estimation and fixed mix gas estimation. Fixes #2156 --- mix/CodeModel.cpp | 54 ++++++++++++++++++++++++++--------- solc/CommandLineInterface.cpp | 5 ++++ solc/jsonCompiler.cpp | 2 ++ 3 files changed, 47 insertions(+), 14 deletions(-) diff --git a/mix/CodeModel.cpp b/mix/CodeModel.cpp index 1ca5d9160..a67d2b59c 100644 --- a/mix/CodeModel.cpp +++ b/mix/CodeModel.cpp @@ -374,29 +374,55 @@ void CodeModel::gasEstimation(solidity::CompilerStack const& _cs) dev::solidity::SourceUnit const& sourceUnit = _cs.getAST(*contractDefinition.getLocation().sourceName); AssemblyItems const* items = _cs.getRuntimeAssemblyItems(n); std::map gasCosts = GasEstimator::breakToStatementLevel(GasEstimator::structuralEstimation(*items, std::vector({&sourceUnit})), {&sourceUnit}); + + auto gasToString = [](GasMeter::GasConsumption const& _gas) + { + if (_gas.isInfinite) + return QString("0"); + else + return QString::fromStdString(toString(_gas.value)); + }; + + // Structural gas costs (per opcode) for (auto gasItem = gasCosts.begin(); gasItem != gasCosts.end(); ++gasItem) { SourceLocation const& location = gasItem->first->getLocation(); GasMeter::GasConsumption cost = gasItem->second; - std::stringstream v; - v << cost.value; - m_gasCostsMaps->push(sourceName, location.start, location.end, QString::fromStdString(v.str()), cost.isInfinite, GasMap::type::Statement); + m_gasCostsMaps->push(sourceName, location.start, location.end, gasToString(cost), cost.isInfinite, GasMap::type::Statement); } - if (contractDefinition.getConstructor() != nullptr) + eth::AssemblyItems const& runtimeAssembly = *_cs.getRuntimeAssemblyItems(n); + // Functional gas costs (per function, but also for accessors) + for (auto it: contractDefinition.getInterfaceFunctions()) { - GasMeter::GasConsumption cost = GasEstimator::functionalEstimation(*_cs.getRuntimeAssemblyItems(n), contractDefinition.getConstructor()->externalSignature()); - std::stringstream v; - v << cost.value; - m_gasCostsMaps->push(sourceName, contractDefinition.getConstructor()->getLocation().start, contractDefinition.getConstructor()->getLocation().end, QString::fromStdString(v.str()), cost.isInfinite, GasMap::type::Constructor); + if (!it.second->hasDeclaration()) + continue; + SourceLocation loc = it.second->getDeclaration().getLocation(); + GasMeter::GasConsumption cost = GasEstimator::functionalEstimation(runtimeAssembly, it.second->externalSignature()); + m_gasCostsMaps->push(sourceName, loc.start, loc.end, gasToString(cost), cost.isInfinite, GasMap::type::Function); } - - for (auto func: contractDefinition.getDefinedFunctions()) + if (auto const* fallback = contractDefinition.getFallbackFunction()) + { + SourceLocation loc = fallback->getLocation(); + GasMeter::GasConsumption cost = GasEstimator::functionalEstimation(runtimeAssembly, "INVALID"); + m_gasCostsMaps->push(sourceName, loc.start, loc.end, gasToString(cost), cost.isInfinite, GasMap::type::Function); + } + for (auto const& it: contractDefinition.getDefinedFunctions()) + { + if (it->isPartOfExternalInterface() || it->isConstructor()) + continue; + SourceLocation loc = it->getLocation(); + size_t entry = _cs.getFunctionEntryPoint(n, *it); + GasEstimator::GasConsumption cost = GasEstimator::GasConsumption::infinite(); + if (entry > 0) + cost = GasEstimator::functionalEstimation(runtimeAssembly, entry, *it); + m_gasCostsMaps->push(sourceName, loc.start, loc.end, gasToString(cost), cost.isInfinite, GasMap::type::Function); + } + if (auto const* constructor = contractDefinition.getConstructor()) { - GasMeter::GasConsumption cost = GasEstimator::functionalEstimation(*_cs.getRuntimeAssemblyItems(n), func->externalSignature()); - std::stringstream v; - v << cost.value; - m_gasCostsMaps->push(sourceName, func->getLocation().start, func->getLocation().end, QString::fromStdString(v.str()), cost.isInfinite, GasMap::type::Function); + SourceLocation loc = constructor->getLocation(); + GasMeter::GasConsumption cost = GasEstimator::functionalEstimation(*_cs.getAssemblyItems(n)); + m_gasCostsMaps->push(sourceName, loc.start, loc.end, gasToString(cost), cost.isInfinite, GasMap::type::Constructor); } } } diff --git a/solc/CommandLineInterface.cpp b/solc/CommandLineInterface.cpp index ec2a90033..c95f34f62 100644 --- a/solc/CommandLineInterface.cpp +++ b/solc/CommandLineInterface.cpp @@ -273,6 +273,11 @@ void CommandLineInterface::handleGasEstimation(string const& _contract) GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, sig); cout << " " << sig << ":\t" << gas << endl; } + if (contract.getFallbackFunction()) + { + GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, "INVALID"); + cout << " fallback:\t" << gas << endl; + } cout << "internal:" << endl; for (auto const& it: contract.getDefinedFunctions()) { diff --git a/solc/jsonCompiler.cpp b/solc/jsonCompiler.cpp index 7bde3e47c..340713b1d 100644 --- a/solc/jsonCompiler.cpp +++ b/solc/jsonCompiler.cpp @@ -91,6 +91,8 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract) string sig = it.second->externalSignature(); externalFunctions[sig] = gasToJson(GasEstimator::functionalEstimation(*items, sig)); } + if (contract.getFallbackFunction()) + externalFunctions[""] = gasToJson(GasEstimator::functionalEstimation(*items, "INVALID")); gasEstimates["external"] = externalFunctions; Json::Value internalFunctions(Json::objectValue); for (auto const& it: contract.getDefinedFunctions()) From 1cca1520440f9597de3c59c39e15ef57001a6e96 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Thu, 18 Jun 2015 17:56:14 +0200 Subject: [PATCH 131/169] clean windows build --- cmake/EthCompilerSettings.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index f91f20970..d33d44bac 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -38,7 +38,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # declare Windows XP requirement # undefine windows.h MAX && MIN macros cause it cause conflicts with std::min && std::max functions # define miniupnp static library - add_compile_options(/MP /EHsc /wd4068 /wd4996 /wd4503 -D_WIN32_WINNT=0x0501 /DNOMINMAX /DMINIUPNP_STATICLIB) + add_compile_options(/MP /EHsc /wd4068 /wd4996 /wd4503 /wd4267 /wd4180 /wd4290 /wd4244 /wd4800 -D_WIN32_WINNT=0x0501 /DNOMINMAX /DMINIUPNP_STATICLIB) # disable empty object file warning set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /ignore:4221") # warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification From c2c6119b3aac196cf31f7684dc7ca078d6134da4 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Thu, 18 Jun 2015 18:20:19 +0200 Subject: [PATCH 132/169] added a comment --- cmake/EthCompilerSettings.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index d33d44bac..85574d5f0 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -34,6 +34,11 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") # disable unknown pragma warning (4068) # disable unsafe function warning (4996) # disable decorated name length exceeded, name was truncated (4503) + # disable conversion from 'size_t' to 'type', possible loss of data (4267) + # disable qualifier applied to function type has no meaning; ignored (4180) + # disable C++ exception specification ignored except to indicate a function is not __declspec(nothrow) (4290) + # disable conversion from 'type1' to 'type2', possible loss of data (4244) + # disable forcing value to bool 'true' or 'false' (performance warning) (4800) # disable warning C4535: calling _set_se_translator() requires /EHa (for boost tests) # declare Windows XP requirement # undefine windows.h MAX && MIN macros cause it cause conflicts with std::min && std::max functions From e1f4c2e0e57ef599798005a04f176bcc2bb562eb Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 18 Jun 2015 23:29:44 +0200 Subject: [PATCH 133/169] use baseType to encode arrays --- mix/CodeModel.cpp | 12 +++++++++++- mix/CodeModel.h | 2 ++ mix/ContractCallDataEncoder.cpp | 32 ++++++-------------------------- mix/ContractCallDataEncoder.h | 2 +- mix/SolidityType.h | 1 + 5 files changed, 21 insertions(+), 28 deletions(-) diff --git a/mix/CodeModel.cpp b/mix/CodeModel.cpp index 1ca5d9160..8cb901a39 100644 --- a/mix/CodeModel.cpp +++ b/mix/CodeModel.cpp @@ -493,9 +493,18 @@ dev::bytes const& CodeModel::getStdContractCode(const QString& _contractName, co return m_compiledContracts.at(_contractName); } +void CodeModel::retrieveSubType(SolidityType& _wrapperType, dev::solidity::Type const* _type) +{ + if (_type->getCategory() == Type::Category::Array) + { + ArrayType const* arrayType = dynamic_cast(_type); + _wrapperType.baseType = std::make_shared(nodeType(arrayType->getBaseType().get())); + } +} + SolidityType CodeModel::nodeType(dev::solidity::Type const* _type) { - SolidityType r { SolidityType::Type::UnsignedInteger, 32, 1, false, false, QString::fromStdString(_type->toString()), std::vector(), std::vector() }; + SolidityType r { SolidityType::Type::UnsignedInteger, 32, 1, false, false, QString::fromStdString(_type->toString()), std::vector(), std::vector(), nullptr }; if (!_type) return r; switch (_type->getCategory()) @@ -536,6 +545,7 @@ SolidityType CodeModel::nodeType(dev::solidity::Type const* _type) r.count = static_cast(array->getLength()); r.dynamicSize = _type->isDynamicallySized(); r.array = true; + retrieveSubType(r, _type); } break; case Type::Category::Enum: diff --git a/mix/CodeModel.h b/mix/CodeModel.h index b9d06341d..7841c7142 100644 --- a/mix/CodeModel.h +++ b/mix/CodeModel.h @@ -224,6 +224,8 @@ public: Q_INVOKABLE void unregisterContractSrc(QString const& _documentId); /// Convert solidity type info to mix type static SolidityType nodeType(dev::solidity::Type const* _type); + /// Retrieve subtype + static void retrieveSubType(SolidityType& _wrapperType, dev::solidity::Type const* _type); /// Check if given location belongs to contract or function bool isContractOrFunctionLocation(dev::SourceLocation const& _location); /// Get funciton name by location diff --git a/mix/ContractCallDataEncoder.cpp b/mix/ContractCallDataEncoder.cpp index 62cc39a04..da21869e4 100644 --- a/mix/ContractCallDataEncoder.cpp +++ b/mix/ContractCallDataEncoder.cpp @@ -37,24 +37,6 @@ using namespace dev; using namespace dev::solidity; using namespace dev::mix; -static QList extractDimension(QString const& _type) -{ - QList dim; - QRegExp dimExtract("(\\[[^\\]]*\\])"); - int pos = dimExtract.indexIn(_type); - while (pos != -1) - { - QString d = dimExtract.cap(0); - pos += d.length(); - pos = dimExtract.indexIn(_type, pos); - if (d == "[]") - dim.push_front(-1); - else - dim.push_front(d.replace("[", "").replace("]", "").toInt()); - } - return dim; -} - bytes ContractCallDataEncoder::encodedData() { bytes r(m_encodedData); @@ -81,25 +63,24 @@ void ContractCallDataEncoder::encode(QFunctionDefinition const* _function) m_encodedData.insert(m_encodedData.end(), hash.begin(), hash.end()); } -void ContractCallDataEncoder::encodeArray(QJsonArray const& _array, QList _dim, SolidityType const& _type, bytes& _content) +void ContractCallDataEncoder::encodeArray(QJsonArray const& _array, SolidityType const& _type, bytes& _content) { size_t offsetStart = _content.size(); - if (_dim[0] == -1) + if (_type.dynamicSize) { bytes count = bytes(32); toBigEndian((u256)_array.size(), count); _content += count; //reserved space for count } - _dim.pop_front(); int k = 0; for (QJsonValue const& c: _array) { if (c.isArray()) { - if (_dim[0] == -1) + if (_type.baseType->dynamicSize) m_dynamicOffsetMap.push_back(std::make_pair(m_dynamicData.size() + offsetStart + 32 + k * 32, m_dynamicData.size() + _content.size())); - encodeArray(c.toArray(), _dim, _type, _content); + encodeArray(c.toArray(), *_type.baseType, _content); } else { @@ -128,16 +109,15 @@ void ContractCallDataEncoder::encode(QVariant const& _data, SolidityType const& } else if (_type.array) { - QList dim = extractDimension(_type. name); bytes content; size_t size = m_encodedData.size(); - if (dim.front() == -1) + if (_type.dynamicSize) { m_encodedData += bytes(32); // reserve space for offset m_staticOffsetMap.push_back(std::make_pair(size, m_dynamicData.size())); } QJsonDocument jsonDoc = QJsonDocument::fromJson(_data.toString().toUtf8()); - encodeArray(jsonDoc.array(), dim, _type, content); + encodeArray(jsonDoc.array(), _type, content); if (!_type.dynamicSize) m_encodedData.insert(m_encodedData.end(), content.begin(), content.end()); diff --git a/mix/ContractCallDataEncoder.h b/mix/ContractCallDataEncoder.h index e29cb92e0..be11a5772 100644 --- a/mix/ContractCallDataEncoder.h +++ b/mix/ContractCallDataEncoder.h @@ -71,7 +71,7 @@ private: QString toString(bool _b); QString toString(dev::bytes const& _b); bool asString(dev::bytes const& _b, QString& _str); - void encodeArray(QJsonArray const& _array, QList _dim, SolidityType const& _type, bytes& _content); + void encodeArray(QJsonArray const& _array, SolidityType const& _type, bytes& _content); QString toChar(dev::bytes const& _b); private: diff --git a/mix/SolidityType.h b/mix/SolidityType.h index 75f47e7fa..13f5c2ecd 100644 --- a/mix/SolidityType.h +++ b/mix/SolidityType.h @@ -57,6 +57,7 @@ struct SolidityType QString name; std::vector members; //for struct std::vector enumNames; //for enum + std::shared_ptr baseType; }; struct SolidityDeclaration From d2780c3d6a7cba52c454d2c1f567340db8e102f3 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 19 Jun 2015 10:21:27 +0800 Subject: [PATCH 134/169] Use right scoping. --- eth/main.cpp | 8 ++++---- libethcore/Common.h | 3 ++- libethcore/Params.cpp | 6 +++--- libjsconsole/JSConsole.cpp | 7 +++---- libjsconsole/JSConsole.h | 7 +++---- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/eth/main.cpp b/eth/main.cpp index 540cb8c4c..912de3245 100644 --- a/eth/main.cpp +++ b/eth/main.cpp @@ -835,12 +835,12 @@ int main(int argc, char** argv) cout << "Networking disabled. To start, use netstart or pass -b or a remote host." << endl; #if ETH_JSONRPC || !ETH_TRUE - shared_ptr jsonrpcServer; + shared_ptr jsonrpcServer; unique_ptr jsonrpcConnector; if (jsonrpc > -1) { jsonrpcConnector = unique_ptr(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); - jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); + jsonrpcServer = shared_ptr(new dev::WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; }); jsonrpcServer->StartListening(); if (jsonAdmin.empty()) @@ -996,7 +996,7 @@ int main(int argc, char** argv) if (jsonrpc < 0) jsonrpc = SensibleHttpPort; jsonrpcConnector = unique_ptr(new jsonrpc::HttpServer(jsonrpc, "", "", SensibleHttpThreads)); - jsonrpcServer = shared_ptr(new WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); + jsonrpcServer = shared_ptr(new dev::WebThreeStubServer(*jsonrpcConnector.get(), web3, make_shared([&](){ return web3.ethereum(); }, getAccountPassword, keyManager), vector(), keyManager, *gasPricer)); jsonrpcServer->setMiningBenefactorChanger([&](Address const& a) { beneficiary = a; }); jsonrpcServer->StartListening(); if (jsonAdmin.empty()) @@ -1744,7 +1744,7 @@ int main(int argc, char** argv) JSConsole console(web3, make_shared([&](){return web3.ethereum();}, getAccountPassword, keyManager)); while (!g_exit) { - console.repl(); + console.readExpression(); stopMiningAfterXBlocks(c, n, mining); } #endif diff --git a/libethcore/Common.h b/libethcore/Common.h index 6f23cb0e8..18b7074b7 100644 --- a/libethcore/Common.h +++ b/libethcore/Common.h @@ -47,7 +47,8 @@ extern const unsigned c_databaseVersion; enum class Network { Olympic = 0, - Frontier = 1 + Frontier = 1, + Turbo = 2 }; extern const Network c_network; diff --git a/libethcore/Params.cpp b/libethcore/Params.cpp index 916adf6ca..0fea39b30 100644 --- a/libethcore/Params.cpp +++ b/libethcore/Params.cpp @@ -31,12 +31,12 @@ namespace eth //--- BEGIN: AUTOGENERATED FROM github.com/ethereum/common/params.json u256 const c_genesisDifficulty = 131072; u256 const c_maximumExtraDataSize = 1024; -u256 const c_genesisGasLimit = 3141592; -u256 const c_minGasLimit = 125000; +u256 const c_genesisGasLimit = c_network == Network::Turbo ? 100000000 : 3141592; +u256 const c_minGasLimit = c_network == Network::Turbo ? 100000000 : 125000; u256 const c_gasLimitBoundDivisor = 1024; u256 const c_minimumDifficulty = 131072; u256 const c_difficultyBoundDivisor = 2048; -u256 const c_durationLimit = c_network == Network::Olympic ? 8 : 12; +u256 const c_durationLimit = c_network == Network::Turbo ? 2 : c_network == Network::Olympic ? 8 : 12; //--- END: AUTOGENERATED FROM /feeStructure.json } diff --git a/libjsconsole/JSConsole.cpp b/libjsconsole/JSConsole.cpp index d1f7c0264..29d547242 100644 --- a/libjsconsole/JSConsole.cpp +++ b/libjsconsole/JSConsole.cpp @@ -39,12 +39,11 @@ JSConsole::JSConsole(WebThreeDirect& _web3, shared_ptr const& _ac m_printer(m_engine) { m_jsonrpcConnector.reset(new JSV8Connector(m_engine)); - m_jsonrpcServer.reset(new WebThreeStubServer(*m_jsonrpcConnector.get(), _web3, _accounts, vector())); + (void)_web3; (void)_accounts; +// m_jsonrpcServer.reset(new WebThreeStubServer(*m_jsonrpcConnector.get(), _web3, _accounts, vector())); } -JSConsole::~JSConsole() {} - -void JSConsole::repl() const +void JSConsole::readExpression() const { string cmd = ""; g_logPost = [](std::string const& a, char const*) { cout << "\r \r" << a << endl << flush; rl_forced_update_display(); }; diff --git a/libjsconsole/JSConsole.h b/libjsconsole/JSConsole.h index b7aded4f3..2e5144a5d 100644 --- a/libjsconsole/JSConsole.h +++ b/libjsconsole/JSConsole.h @@ -25,7 +25,7 @@ #include #include -class WebThreeStubServer; +namespace dev { class WebThreeStubServer; } namespace jsonrpc { class AbstractServerConnector; } namespace dev @@ -39,15 +39,14 @@ class JSConsole { public: JSConsole(WebThreeDirect& _web3, std::shared_ptr const& _accounts); - ~JSConsole(); - void repl() const; + void readExpression() const; private: std::string promptForIndentionLevel(int _i) const; JSV8Engine m_engine; JSV8Printer m_printer; - std::unique_ptr m_jsonrpcServer; + std::unique_ptr m_jsonrpcServer; std::unique_ptr m_jsonrpcConnector; }; From b26b38c466f6edc2e742409be62b9eaa0e8a4b35 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 19 Jun 2015 10:53:13 +0800 Subject: [PATCH 135/169] Blockchain sync trivial fixes. --- libethereum/BlockChainSync.cpp | 8 ++++---- libethereum/BlockChainSync.h | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index eb4514731..d7fd2c5ea 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -94,7 +94,7 @@ void BlockChainSync::onPeerStatus(EthereumPeer* _peer) DEV_INVARIANT_CHECK; } -unsigned BlockChainSync::estimateHashes() +unsigned BlockChainSync::estimateHashes() const { BlockInfo block = host().chain().info(); time_t lastBlockTime = (block.hash() == host().chain().genesisHash()) ? 1428192000 : (time_t)block.timestamp; @@ -478,12 +478,12 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ clog(NetWarn) << "Invalid state transition:" << EthereumHost::stateName(_s) << "from" << EthereumHost::stateName(m_state) << ", " << (isSyncing(_peer) ? "syncing" : "holding") << (needsSyncing(_peer) ? "& needed" : ""); } -void PV60Sync::resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) +void PV60Sync::resetSyncFor(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) { setNeedsSyncing(_peer, _latestHash, _td); } -void PV60Sync::setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td) +void PV60Sync::setNeedsSyncing(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) { _peer->m_latestHash = _latestHash; _peer->m_totalDifficulty = _td; @@ -707,7 +707,7 @@ void PV60Sync::onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) } unsigned knowns = 0; unsigned unknowns = 0; - for (auto h: _hashes) + for (auto const& h: _hashes) { _peer->addRating(1); DEV_GUARDED(_peer->x_knownBlocks) diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h index e981a344e..7042c5a48 100644 --- a/libethereum/BlockChainSync.h +++ b/libethereum/BlockChainSync.h @@ -103,29 +103,29 @@ protected: virtual void pauseSync() = 0; /// Restart sync for given peer - virtual void resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) = 0; + virtual void resetSyncFor(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) = 0; EthereumHost& host() { return m_host; } EthereumHost const& host() const { return m_host; } /// Estimates max number of hashes peers can give us. - unsigned estimateHashes(); + unsigned estimateHashes() const; /// Request blocks from peer if needed void requestBlocks(EthereumPeer* _peer); -private: - static char const* const s_stateNames[static_cast(SyncState::Size)]; - bool invariants() const override = 0; - EthereumHost& m_host; - HashDownloadMan m_hashMan; - protected: Handler m_bqRoomAvailable; mutable RecursiveMutex x_sync; SyncState m_state = SyncState::Idle; ///< Current sync state SyncState m_lastActiveState = SyncState::Idle; ///< Saved state before entering waiting queue mode unsigned m_estimatedHashes = 0; ///< Number of estimated hashes for the last peer over PV60. Used for status reporting only. + +private: + static char const* const s_stateNames[static_cast(SyncState::Size)]; + bool invariants() const override = 0; + EthereumHost& m_host; + HashDownloadMan m_hashMan; }; @@ -159,7 +159,7 @@ public: void restartSync() override; void completeSync() override; void pauseSync() override; - void resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) override; + void resetSyncFor(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) override; private: /// Transition sync state in a particular direction. @param _peer Peer that is responsible for state tranfer @@ -169,7 +169,7 @@ private: void resetNeedsSyncing(EthereumPeer* _peer) { setNeedsSyncing(_peer, h256(), 0); } /// Update peer syncing requirements state. - void setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td); + void setNeedsSyncing(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td); /// Do we presently need syncing with this peer? bool needsSyncing(EthereumPeer* _peer) const; From 210c86bb026fbfd0089dcf7cbfb14047cddede77 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 19 Jun 2015 14:56:59 +0800 Subject: [PATCH 136/169] Backoff to attempt to deal with non-conformant clients. Reduce verbosity. --- libethereum/Client.cpp | 10 +++++----- libethereum/EthereumHost.cpp | 2 +- libethereum/EthereumPeer.cpp | 31 +++++++++++++++++++------------ 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 8064e7e9f..7560f9165 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -673,10 +673,10 @@ void Client::onChainChanged(ImportRoute const& _ir) // insert transactions that we are declaring the dead part of the chain for (auto const& h: _ir.deadBlocks) { - clog(ClientNote) << "Dead block:" << h; + clog(ClientTrace) << "Dead block:" << h; for (auto const& t: m_bc.transactions(h)) { - clog(ClientNote) << "Resubmitting dead-block transaction " << Transaction(t, CheckTransaction::None); + clog(ClientTrace) << "Resubmitting dead-block transaction " << Transaction(t, CheckTransaction::None); m_tq.import(t, TransactionQueue::ImportCallback(), IfDropped::Retry); } } @@ -684,10 +684,10 @@ void Client::onChainChanged(ImportRoute const& _ir) // remove transactions from m_tq nicely rather than relying on out of date nonce later on. for (auto const& h: _ir.liveBlocks) { - clog(ClientChat) << "Live block:" << h; + clog(ClientTrace) << "Live block:" << h; for (auto const& th: m_bc.transactionHashes(h)) { - clog(ClientNote) << "Safely dropping transaction " << th; + clog(ClientTrace) << "Safely dropping transaction " << th; m_tq.drop(th); } } @@ -723,7 +723,7 @@ void Client::onChainChanged(ImportRoute const& _ir) DEV_READ_GUARDED(x_postMine) for (auto const& t: m_postMine.pending()) { - clog(ClientNote) << "Resubmitting post-mine transaction " << t; + clog(ClientTrace) << "Resubmitting post-mine transaction " << t; auto ir = m_tq.import(t, TransactionQueue::ImportCallback(), IfDropped::Retry); if (ir != ImportResult::Success) onTransactionQueueReady(); diff --git a/libethereum/EthereumHost.cpp b/libethereum/EthereumHost.cpp index 152c20e69..f693ff768 100644 --- a/libethereum/EthereumHost.cpp +++ b/libethereum/EthereumHost.cpp @@ -296,7 +296,7 @@ void EthereumHost::onPeerTransactions(EthereumPeer* _peer, RLP const& _r) unsigned itemCount = _r.itemCount(); clog(NetAllDetail) << "Transactions (" << dec << itemCount << "entries)"; Guard l(_peer->x_knownTransactions); - for (unsigned i = 0; i < itemCount; ++i) + for (unsigned i = 0; i < min(itemCount, 256); ++i) // process 256 transactions at most. TODO: much better solution. { auto h = sha3(_r[i].data()); _peer->m_knownTransactions.insert(h); diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 86e2a070d..87d51969a 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -37,6 +37,18 @@ using namespace dev; using namespace dev::eth; using namespace p2p; +string toString(Asking _a) +{ + switch (_a) + { + case Asking::Blocks: return "Blocks"; + case Asking::Hashes: return "Hashes"; + case Asking::Nothing: return "Nothing"; + case Asking::State: return "State"; + } + return "?"; +} + EthereumPeer::EthereumPeer(Session* _s, HostCapabilityFace* _h, unsigned _i, CapDesc const& _cap): Capability(_s, _h, _i), m_sub(host()->downloadMan()), @@ -49,6 +61,11 @@ EthereumPeer::EthereumPeer(Session* _s, HostCapabilityFace* _h, unsigned _i, Cap EthereumPeer::~EthereumPeer() { + if (m_asking != Asking::Nothing) + { + cnote << "Peer aborting while being asked for " << ::toString(m_asking); + setRude(); + } abortSync(); } @@ -65,7 +82,9 @@ unsigned EthereumPeer::askOverride() const void EthereumPeer::setRude() { + auto old = askOverride(); repMan().setData(*session(), name(), rlp(askOverride() / 2 + 1)); + cnote << "Rude behaviour; askOverride now" << askOverride() << ", was" << old; repMan().noteRude(*session(), name()); session()->addNote("manners", "RUDE"); } @@ -84,18 +103,6 @@ EthereumHost* EthereumPeer::host() const * Possible asking/syncing states for two peers: */ -string toString(Asking _a) -{ - switch (_a) - { - case Asking::Blocks: return "Blocks"; - case Asking::Hashes: return "Hashes"; - case Asking::Nothing: return "Nothing"; - case Asking::State: return "State"; - } - return "?"; -} - void EthereumPeer::setIdle() { setAsking(Asking::Nothing); From 955a1d1bb17960a62edc3462f3c6da9c10168e9d Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Fri, 19 Jun 2015 14:57:25 +0800 Subject: [PATCH 137/169] Version bump. --- libdevcore/Common.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libdevcore/Common.cpp b/libdevcore/Common.cpp index 22ea584c1..17ccae6b1 100644 --- a/libdevcore/Common.cpp +++ b/libdevcore/Common.cpp @@ -28,7 +28,7 @@ using namespace dev; namespace dev { -char const* Version = "0.9.26"; +char const* Version = "0.9.27"; const u256 UndefinedU256 = ~(u256)0; From 3b2f8f21eaabd1a87fea5d82d9296fa77c1fd16d Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 19 Jun 2015 09:49:42 +0200 Subject: [PATCH 138/169] fixed a race condition on peer aborting, style --- libethereum/BlockChainSync.cpp | 41 +++++++++++++++++++++++++--------- libethereum/BlockChainSync.h | 21 +++++++++-------- 2 files changed, 40 insertions(+), 22 deletions(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index eb4514731..6b87ce904 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -52,6 +52,7 @@ BlockChainSync::BlockChainSync(EthereumHost& _host): BlockChainSync::~BlockChainSync() { + RecursiveGuard l(x_sync); abortSync(); } @@ -67,8 +68,10 @@ DownloadMan& BlockChainSync::downloadMan() void BlockChainSync::abortSync() { + DEV_INVARIANT_CHECK; host().foreachPeer([this](EthereumPeer* _p) { onPeerAborting(_p); return true; }); downloadMan().resetToChain(h256s()); + DEV_INVARIANT_CHECK; } void BlockChainSync::onPeerStatus(EthereumPeer* _peer) @@ -87,14 +90,14 @@ void BlockChainSync::onPeerStatus(EthereumPeer* _peer) _peer->disable("Peer banned for previous bad behaviour."); else { - unsigned estimatedHashes = estimateHashes(); - _peer->m_expectedHashes = estimatedHashes; + unsigned hashes = estimatedHashes(); + _peer->m_expectedHashes = hashes; onNewPeer(_peer); } DEV_INVARIANT_CHECK; } -unsigned BlockChainSync::estimateHashes() +unsigned BlockChainSync::estimatedHashes() const { BlockInfo block = host().chain().info(); time_t lastBlockTime = (block.hash() == host().chain().genesisHash()) ? 1428192000 : (time_t)block.timestamp; @@ -113,7 +116,6 @@ void BlockChainSync::requestBlocks(EthereumPeer* _peer) if (host().bq().knownFull()) { clog(NetAllDetail) << "Waiting for block queue before downloading blocks"; - m_lastActiveState = m_state; pauseSync(); _peer->setIdle(); return; @@ -233,10 +235,8 @@ void BlockChainSync::onPeerBlocks(EthereumPeer* _peer, RLP const& _r) { if (downloadMan().isComplete()) completeSync(); - else if (!got) - requestBlocks(_peer); else - peerDoneBlocks(_peer); + requestBlocks(_peer); // Some of the blocks might have been downloaded by helping peers, proceed anyway } DEV_INVARIANT_CHECK; } @@ -478,12 +478,12 @@ void PV60Sync::transition(EthereumPeer* _peer, SyncState _s, bool _force, bool _ clog(NetWarn) << "Invalid state transition:" << EthereumHost::stateName(_s) << "from" << EthereumHost::stateName(m_state) << ", " << (isSyncing(_peer) ? "syncing" : "holding") << (needsSyncing(_peer) ? "& needed" : ""); } -void PV60Sync::resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) +void PV60Sync::resetSyncFor(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) { setNeedsSyncing(_peer, _latestHash, _td); } -void PV60Sync::setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td) +void PV60Sync::setNeedsSyncing(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) { _peer->m_latestHash = _latestHash; _peer->m_totalDifficulty = _td; @@ -636,7 +636,9 @@ void PV60Sync::noteDoneBlocks(EthereumPeer* _peer, bool _clemency) // m_banned.insert(_peer->session()->id()); // We know who you are! // _peer->disable("Peer sent hashes but was unable to provide the blocks."); } + resetSync(); downloadMan().reset(); + transition(_peer, SyncState::Idle); } _peer->m_sub.doneFetch(); } @@ -648,7 +650,7 @@ void PV60Sync::onPeerHashes(EthereumPeer* _peer, h256s const& _hashes) _peer->setIdle(); if (!isSyncing(_peer)) { - clog(NetMessageSummary) << "Ignoring hashes synce not syncing"; + clog(NetMessageSummary) << "Ignoring hashes since not syncing"; return; } if (_hashes.size() == 0) @@ -705,9 +707,10 @@ void PV60Sync::onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) clog(NetMessageSummary) << "Ignoring since we're already downloading."; return; } + clog(NetMessageDetail) << "Not syncing and new block hash discovered: syncing without help."; unsigned knowns = 0; unsigned unknowns = 0; - for (auto h: _hashes) + for (auto const& h: _hashes) { _peer->addRating(1); DEV_GUARDED(_peer->x_knownBlocks) @@ -741,6 +744,7 @@ void PV60Sync::onPeerNewHashes(EthereumPeer* _peer, h256s const& _hashes) void PV60Sync::abortSync(EthereumPeer* _peer) { + // Can't check invariants here since the peers is already removed from the list and the state is not updated yet. if (isSyncing(_peer)) { host().foreachPeer([this](EthereumPeer* _p) { _p->setIdle(); return true; }); @@ -751,6 +755,8 @@ void PV60Sync::abortSync(EthereumPeer* _peer) void PV60Sync::onPeerAborting(EthereumPeer* _peer) { + RecursiveGuard l(x_sync); + // Can't check invariants here since the peers is already removed from the list and the state is not updated yet. abortSync(_peer); DEV_INVARIANT_CHECK; } @@ -767,6 +773,10 @@ bool PV60Sync::invariants() const host().foreachPeer([&](EthereumPeer* _p) { if (_p->m_asking == Asking::Hashes) hashes = true; return !hashes; }); if (!hashes) return false; + if (!m_syncingLatestHash) + return false; + if (m_syncingNeededBlocks.empty() != (!m_syncingLastReceivedHash)) + return false; } if (m_state == SyncState::Blocks || m_state == SyncState::NewBlocks) { @@ -777,5 +787,14 @@ bool PV60Sync::invariants() const if (downloadMan().isComplete()) return false; } + if (m_state == SyncState::Idle) + { + bool busy = false; + host().foreachPeer([&](EthereumPeer* _p) { if (_p->m_asking != Asking::Nothing && _p->m_asking != Asking::State) busy = true; return !busy; }); + if (busy) + return false; + } + if (m_state == SyncState::Waiting && !host().bq().isActive()) + return false; return true; } diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h index e981a344e..f47d946e3 100644 --- a/libethereum/BlockChainSync.h +++ b/libethereum/BlockChainSync.h @@ -103,29 +103,27 @@ protected: virtual void pauseSync() = 0; /// Restart sync for given peer - virtual void resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) = 0; + virtual void resetSyncFor(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) = 0; EthereumHost& host() { return m_host; } EthereumHost const& host() const { return m_host; } /// Estimates max number of hashes peers can give us. - unsigned estimateHashes(); + unsigned estimatedHashes() const; /// Request blocks from peer if needed void requestBlocks(EthereumPeer* _peer); + Handler m_bqRoomAvailable; ///< Triggered once block queue + mutable RecursiveMutex x_sync; + SyncState m_state = SyncState::Idle; ///< Current sync state + unsigned m_estimatedHashes = 0; ///< Number of estimated hashes for the last peer over PV60. Used for status reporting only. + private: static char const* const s_stateNames[static_cast(SyncState::Size)]; bool invariants() const override = 0; EthereumHost& m_host; HashDownloadMan m_hashMan; - -protected: - Handler m_bqRoomAvailable; - mutable RecursiveMutex x_sync; - SyncState m_state = SyncState::Idle; ///< Current sync state - SyncState m_lastActiveState = SyncState::Idle; ///< Saved state before entering waiting queue mode - unsigned m_estimatedHashes = 0; ///< Number of estimated hashes for the last peer over PV60. Used for status reporting only. }; @@ -153,13 +151,14 @@ public: /// @returns Sync status SyncStatus status() const override; +protected: void onNewPeer(EthereumPeer* _peer) override; void continueSync() override; void peerDoneBlocks(EthereumPeer* _peer) override; void restartSync() override; void completeSync() override; void pauseSync() override; - void resetSyncFor(EthereumPeer* _peer, h256 _latestHash, u256 _td) override; + void resetSyncFor(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td) override; private: /// Transition sync state in a particular direction. @param _peer Peer that is responsible for state tranfer @@ -169,7 +168,7 @@ private: void resetNeedsSyncing(EthereumPeer* _peer) { setNeedsSyncing(_peer, h256(), 0); } /// Update peer syncing requirements state. - void setNeedsSyncing(EthereumPeer* _peer, h256 _latestHash, u256 _td); + void setNeedsSyncing(EthereumPeer* _peer, h256 const& _latestHash, u256 const& _td); /// Do we presently need syncing with this peer? bool needsSyncing(EthereumPeer* _peer) const; From 61e84ea862d5799c35746387cb33edf0c1a719ac Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 19 Jun 2015 10:20:23 +0200 Subject: [PATCH 139/169] transitions description --- libethereum/BlockChainSync.cpp | 2 +- libethereum/BlockChainSync.h | 71 ++++++++++++++++++++++++++++++++-- 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/libethereum/BlockChainSync.cpp b/libethereum/BlockChainSync.cpp index 6b87ce904..c3ea67e22 100644 --- a/libethereum/BlockChainSync.cpp +++ b/libethereum/BlockChainSync.cpp @@ -508,7 +508,7 @@ bool PV60Sync::shouldGrabBlocks(EthereumPeer* _peer) const { auto td = _peer->m_totalDifficulty; auto lh = _peer->m_latestHash; - auto ctd = host().chain().details().totalDifficulty; + auto ctd = host().chain().details().totalDifficulty; if (m_syncingNeededBlocks.empty()) return false; diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h index f47d946e3..18e8158e6 100644 --- a/libethereum/BlockChainSync.h +++ b/libethereum/BlockChainSync.h @@ -131,6 +131,70 @@ private: * @brief Syncrhonization over PV60. Selects a single peer and tries to downloading hashes from it. After hash downaload is complete * Syncs to peers and keeps up to date */ + +/** + * Transitions: + * + * Idle->Hashes + * Triggered when: + * * A new peer appears that we can sync to + * * Transtition to Idle, there are peers we can sync to + * Effects: + * * Set chain sync (m_syncingTotalDifficulty, m_syncingLatestHash, m_syncer) + * * Requests hashes from m_syncer + * + * Hashes->Idle + * Triggered when: + * * Received too many hashes + * * Received 0 total hashes from m_syncer + * * m_syncer aborts + * Effects: + * In case of too many hashes sync is reset + * + * Hashes->Blocks + * Triggered when: + * * Received known hash from m_syncer + * * Received 0 hashes from m_syncer and m_syncingTotalBlocks not empty + * Effects: + * * Set up download manager, clear m_syncingTotalBlocks. Set all peers to help with downloading if they can + * + * Blocks->Idle + * Triggered when: + * * m_syncer aborts + * * m_syncer does not have required block + * * All blocks downloaded + * * Block qeueue is full with unknown blocks + * Effects: + * * Download manager is reset + * + * Blocks->Waiting + * Triggered when: + * * Block queue is full with known blocks + * Effects: + * * Stop requesting blocks from peers + * + * Waiting->Blocks + * Triggered when: + * * Block queue has space for new blocks + * Effects: + * * Continue requesting blocks from peers + * + * Idle->NewBlocks + * Triggered when: + * * New block hashes arrive + * Effects: + * * Set up download manager, clear m_syncingTotalBlocks. Download blocks from a single peer. If downloaded blocks have unknown parents, set the peer to sync + * + * NewBlocks->Idle + * Triggered when: + * * m_syncer aborts + * * m_syncer does not have required block + * * All new blocks downloaded + * * Block qeueue is full with unknown blocks + * Effects: + * * Download manager is reset + * + */ class PV60Sync: public BlockChainSync { public: @@ -204,9 +268,10 @@ private: h256s m_syncingNeededBlocks; ///< The blocks that we should download from this peer. h256 m_syncingLastReceivedHash; ///< Hash most recently received from peer. - h256 m_syncingLatestHash; ///< Peer's latest block's hash, as of the current sync. - u256 m_syncingTotalDifficulty; ///< Peer's latest block's total difficulty, as of the current sync. - EthereumPeer* m_syncer = nullptr; // TODO: switch to weak_ptr + h256 m_syncingLatestHash; ///< Latest block's hash of the peer we are syncing to, as of the current sync. + u256 m_syncingTotalDifficulty; ///< Latest block's total difficulty of the peer we aresyncing to, as of the current sync. + // TODO: switch to weak_ptr + EthereumPeer* m_syncer = nullptr; ///< Current }; } } From 5953778e3cdf4a0acb7f9430291db20de22c8bfd Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 19 Jun 2015 10:34:30 +0200 Subject: [PATCH 140/169] ui changes --- mix/qml/Block.qml | 105 ++++++++++++++++++++++++------------- mix/qml/BlockChain.qml | 13 +++-- mix/qml/StateListModel.qml | 1 + mix/qml/WebPreview.qml | 4 +- 4 files changed, 77 insertions(+), 46 deletions(-) diff --git a/mix/qml/Block.qml b/mix/qml/Block.qml index 8fc282246..2f7d04a20 100644 --- a/mix/qml/Block.qml +++ b/mix/qml/Block.qml @@ -16,7 +16,7 @@ ColumnLayout property int number property int blockWidth: Layout.preferredWidth - statusWidth - horizontalMargin property int horizontalMargin: 10 - property int trHeight: 30 + property int trHeight: 35 spacing: 0 property int openedTr: 0 property int blockIndex @@ -42,6 +42,10 @@ ColumnLayout height = calculateHeight() } + DebuggerPaneStyle { + id: dbgStyle + } + RowLayout { Layout.preferredHeight: trHeight @@ -60,6 +64,7 @@ ColumnLayout anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left anchors.leftMargin: horizontalMargin + font.pointSize: dbgStyle.absoluteSize(1) color: "#adadad" text: { @@ -196,44 +201,61 @@ ColumnLayout { anchors.top: parent.top width: parent.width - spacing: 10 + spacing: 7 RowLayout { anchors.top: parent.top Layout.fillWidth: true spacing: cellSpacing - Text + Rectangle { - id: hash + Layout.preferredWidth: fromWidth anchors.left: parent.left anchors.leftMargin: horizontalMargin - Layout.preferredWidth: fromWidth - elide: Text.ElideRight - maximumLineCount: 1 - color: labelColor - text: { - if (index >= 0) - return transactions.get(index).sender - else - return "" + Text + { + id: hash + width: parent.width - 30 + elide: Text.ElideRight + anchors.verticalCenter: parent.verticalCenter + maximumLineCount: 1 + color: labelColor + font.pointSize: dbgStyle.absoluteSize(1) + font.bold: true + text: { + if (index >= 0) + return transactions.get(index).sender + else + return "" + } } } - Text + + Rectangle { - id: func - text: { - if (index >= 0) - parent.userFrienldyToken(transactions.get(index).label) - else - return "" - } - elide: Text.ElideRight - color: labelColor - maximumLineCount: 1 Layout.preferredWidth: toWidth + Text + { + id: func + text: { + if (index >= 0) + parent.parent.userFrienldyToken(transactions.get(index).label) + else + return "" + } + elide: Text.ElideRight + anchors.verticalCenter: parent.verticalCenter + color: labelColor + font.pointSize: dbgStyle.absoluteSize(1) + font.bold: true + maximumLineCount: 1 + width: parent.width + } } + + function userFrienldyToken(value) { if (value && value.indexOf("<") === 0) @@ -247,18 +269,25 @@ ColumnLayout return value } - Text + Rectangle { - id: returnValue - elide: Text.ElideRight - maximumLineCount: 1 - color: labelColor Layout.preferredWidth: valueWidth - text: { - if (index >= 0 && transactions.get(index).returned) - return transactions.get(index).returned - else - return "" + Text + { + id: returnValue + elide: Text.ElideRight + anchors.verticalCenter: parent.verticalCenter + maximumLineCount: 1 + color: labelColor + font.bold: true + font.pointSize: dbgStyle.absoluteSize(1) + width: parent.width -30 + text: { + if (index >= 0 && transactions.get(index).returned) + return transactions.get(index).returned + else + return "" + } } } @@ -272,8 +301,11 @@ ColumnLayout { id: logs anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter anchors.leftMargin: 10 color: labelColor + font.bold: true + font.pointSize: dbgStyle.absoluteSize(1) text: { if (index >= 0 && transactions.get(index).logs && transactions.get(index).logs.count) return transactions.get(index).logs.count @@ -288,8 +320,6 @@ ColumnLayout } } } - - } RowLayout @@ -329,8 +359,9 @@ ColumnLayout Rectangle { width: debugActionWidth - height: trHeight - 10 + height: trHeight anchors.left: rowContentTr.right + anchors.topMargin: -6 anchors.top: rowContentTr.top anchors.leftMargin: -50 color: "transparent" diff --git a/mix/qml/BlockChain.qml b/mix/qml/BlockChain.qml index 6467009da..b7411de16 100644 --- a/mix/qml/BlockChain.qml +++ b/mix/qml/BlockChain.qml @@ -40,16 +40,16 @@ ColumnLayout { if (width <= 630 || previousWidth <= 630) { - fromWidth = 100 + fromWidth = 150 toWidth = 100 - valueWidth = 250 + valueWidth = 200 } else { var diff = (width - previousWidth) / 3; - fromWidth = fromWidth + diff < 100 ? 100 : fromWidth + diff + fromWidth = fromWidth + diff < 150 ? 150 : fromWidth + diff toWidth = toWidth + diff < 100 ? 100 : toWidth + diff - valueWidth = valueWidth + diff < 250 ? 250 : valueWidth + diff + valueWidth = valueWidth + diff < 200 ? 200 : valueWidth + diff } previousWidth = width } @@ -68,9 +68,9 @@ ColumnLayout { } property int statusWidth: 50 - property int fromWidth: 100 + property int fromWidth: 150 property int toWidth: 100 - property int valueWidth: 250 + property int valueWidth: 200 property int logsWidth: 40 property int debugActionWidth: 40 property int horizontalMargin: 10 @@ -422,7 +422,6 @@ ColumnLayout { return; } } - // tr is not in the list. var itemTr = TransactionHelper.defaultTransaction() itemTr.saveStatus = false diff --git a/mix/qml/StateListModel.qml b/mix/qml/StateListModel.qml index 992113cc6..26817441c 100644 --- a/mix/qml/StateListModel.qml +++ b/mix/qml/StateListModel.qml @@ -256,6 +256,7 @@ Item { if (!_secret) _secret = clientModel.newSecret(); var address = clientModel.address(_secret); + console.log(address); var name = qsTr("Account") + "-" + address.substring(0, 4); return { name: name, secret: _secret, balance: QEtherHelper.createEther(_balance, _unit), address: address }; } diff --git a/mix/qml/WebPreview.qml b/mix/qml/WebPreview.qml index e4d0b61a5..c45f2cab4 100644 --- a/mix/qml/WebPreview.qml +++ b/mix/qml/WebPreview.qml @@ -89,10 +89,10 @@ Item { } } - Connections { + /*Connections { target: clientModel onRunComplete: reload(); - } + }*/ Connections { target: codeModel From 997641c035b8dcb96784bf6fbba1a8f1d18f790b Mon Sep 17 00:00:00 2001 From: arkpar Date: Fri, 19 Jun 2015 10:52:00 +0200 Subject: [PATCH 141/169] fixed comment --- libethereum/BlockChainSync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/BlockChainSync.h b/libethereum/BlockChainSync.h index 80372d3a2..b946f557e 100644 --- a/libethereum/BlockChainSync.h +++ b/libethereum/BlockChainSync.h @@ -272,7 +272,7 @@ private: h256 m_syncingLatestHash; ///< Latest block's hash of the peer we are syncing to, as of the current sync. u256 m_syncingTotalDifficulty; ///< Latest block's total difficulty of the peer we aresyncing to, as of the current sync. // TODO: switch to weak_ptr - EthereumPeer* m_syncer = nullptr; ///< Current + EthereumPeer* m_syncer = nullptr; ///< Peer we are currently syncing with }; } } From 7e7f4d07da299cb64d892db6dd1f40ddc43f5d01 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 19 Jun 2015 15:44:56 +0200 Subject: [PATCH 142/169] made TopicBloomFilter a template --- libwhisper/BloomFilter.cpp | 40 --------------------------------- libwhisper/BloomFilter.h | 16 ++++++------- libwhisper/Common.cpp | 4 ++-- libwhisper/Common.h | 4 +++- test/libwhisper/bloomFilter.cpp | 24 +++++++++++--------- 5 files changed, 26 insertions(+), 62 deletions(-) diff --git a/libwhisper/BloomFilter.cpp b/libwhisper/BloomFilter.cpp index 9680ded66..554274011 100644 --- a/libwhisper/BloomFilter.cpp +++ b/libwhisper/BloomFilter.cpp @@ -25,44 +25,4 @@ using namespace std; using namespace dev; using namespace dev::shh; -/* -static unsigned const c_mask[] = { 1, 2, 4, 8, 16, 32, 64, 128 }; - -template -void TopicBloomFilterBase::addRaw(FixedHash const& _h) -{ - *this |= _h; - for (unsigned i = 0; i < CounterSize; ++i) - if (isBitSet(_h, i)) - { - if (m_refCounter[i] != numeric_limits::max()) - m_refCounter[i]++; - else - BOOST_THROW_EXCEPTION(Overflow()); - } -} - -template -void TopicBloomFilterBase::removeRaw(FixedHash const& _h) -{ - for (unsigned i = 0; i < CounterSize; ++i) - if (isBitSet(_h, i)) - { - if (m_refCounter[i]) - m_refCounter[i]--; - - if (!m_refCounter[i]) - (*this)[i / 8] &= ~c_mask[i % 8]; - } -} - -template -bool TopicBloomFilterBase::isBitSet(FixedHash const& _h, unsigned _index) -{ - unsigned iByte = _index / 8; - unsigned iBit = _index % 8; - return (_h[iByte] & c_mask[iBit]) != 0; -} - -*/ diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index cc236c255..393ccbfd1 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -28,8 +28,6 @@ namespace dev namespace shh { -//enum { BloomSize = 4 }; - template class TopicBloomFilterBase: public FixedHash { @@ -37,9 +35,9 @@ public: TopicBloomFilterBase() { init(); } TopicBloomFilterBase(FixedHash const& _h): FixedHash(_h) { init(); } - void addBloom(AbridgedTopic const& _h) { addRaw(_h.template bloomPart()); } - void removeBloom(AbridgedTopic const& _h) { removeRaw(_h.template bloomPart()); } - bool containsBloom(AbridgedTopic const& _h) const { return contains(_h.template bloomPart()); } + void addBloom(dev::shh::AbridgedTopic const& _h) { addRaw(_h.template bloomPart()); } + void removeBloom(dev::shh::AbridgedTopic const& _h) { removeRaw(_h.template bloomPart()); } + bool containsBloom(dev::shh::AbridgedTopic const& _h) const { return contains(_h.template bloomPart()); } void addRaw(FixedHash const& _h); void removeRaw(FixedHash const& _h); @@ -55,7 +53,7 @@ private: std::array m_refCounter; }; -static unsigned const c_mask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; +static unsigned const c_powerOfTwoBitMmask[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; template void TopicBloomFilterBase::addRaw(FixedHash const& _h) @@ -81,7 +79,7 @@ void TopicBloomFilterBase::removeRaw(FixedHash const& _h) m_refCounter[i]--; if (!m_refCounter[i]) - (*this)[i / 8] &= ~c_mask[i % 8]; + (*this)[i / 8] &= ~c_powerOfTwoBitMmask[i % 8]; } } @@ -90,10 +88,10 @@ bool TopicBloomFilterBase::isBitSet(FixedHash const& _h, unsigned _index) { unsigned iByte = _index / 8; unsigned iBit = _index % 8; - return (_h[iByte] & c_mask[iBit]) != 0; + return (_h[iByte] & c_powerOfTwoBitMmask[iBit]) != 0; } -using TopicBloomFilter = TopicBloomFilterBase<4>; +using TopicBloomFilter = TopicBloomFilterBase; } } diff --git a/libwhisper/Common.cpp b/libwhisper/Common.cpp index 7f5b8ed06..32acbdd8e 100644 --- a/libwhisper/Common.cpp +++ b/libwhisper/Common.cpp @@ -95,9 +95,9 @@ TopicFilter::TopicFilter(RLP const& _r) } } -AbridgedTopic TopicFilter::exportBloom() const +FixedHash TopicFilter::exportBloom() const { - AbridgedTopic ret; + FixedHash ret; for (TopicMask const& t: m_topicMasks) for (auto const& i: t) ret |= i.first.template bloomPart(); diff --git a/libwhisper/Common.h b/libwhisper/Common.h index 07c5b3317..71435603e 100644 --- a/libwhisper/Common.h +++ b/libwhisper/Common.h @@ -59,6 +59,8 @@ enum WhisperPacket PacketCount }; +enum { TopicBloomFilterSize = 8 }; + using AbridgedTopic = FixedHash<4>; using Topic = h256; @@ -105,7 +107,7 @@ public: void streamRLP(RLPStream& _s) const { _s << m_topicMasks; } h256 sha3() const; bool matches(Envelope const& _m) const; - AbridgedTopic exportBloom() const; + FixedHash exportBloom() const; private: TopicMasks m_topicMasks; diff --git a/test/libwhisper/bloomFilter.cpp b/test/libwhisper/bloomFilter.cpp index 799c4caf6..e49473bdc 100644 --- a/test/libwhisper/bloomFilter.cpp +++ b/test/libwhisper/bloomFilter.cpp @@ -27,35 +27,39 @@ using namespace std; using namespace dev; using namespace dev::shh; -void testAddNonExisting(TopicBloomFilter& _f, AbridgedTopic const& _h) +using TopicBloomFilterShort = TopicBloomFilterBase<4>; +using TopicBloomFilterLong = TopicBloomFilterBase<8>; +using TopicBloomFilterTest = TopicBloomFilterLong; + +void testAddNonExisting(TopicBloomFilterShort& _f, AbridgedTopic const& _h) { BOOST_REQUIRE(!_f.containsRaw(_h)); _f.addRaw(_h); BOOST_REQUIRE(_f.containsRaw(_h)); } -void testRemoveExisting(TopicBloomFilter& _f, AbridgedTopic const& _h) +void testRemoveExisting(TopicBloomFilterShort& _f, AbridgedTopic const& _h) { BOOST_REQUIRE(_f.containsRaw(_h)); _f.removeRaw(_h); BOOST_REQUIRE(!_f.containsRaw(_h)); } -void testAddNonExistingBloom(TopicBloomFilter& _f, AbridgedTopic const& _h) +void testAddNonExistingBloom(TopicBloomFilterShort& _f, AbridgedTopic const& _h) { BOOST_REQUIRE(!_f.containsBloom(_h)); _f.addBloom(_h); BOOST_REQUIRE(_f.containsBloom(_h)); } -void testRemoveExistingBloom(TopicBloomFilter& _f, AbridgedTopic const& _h) +void testRemoveExistingBloom(TopicBloomFilterShort& _f, AbridgedTopic const& _h) { BOOST_REQUIRE(_f.containsBloom(_h)); _f.removeBloom(_h); BOOST_REQUIRE(!_f.containsBloom(_h)); } -int calculateExpected(TopicBloomFilter const& f, int const n) +int calculateExpected(TopicBloomFilterTest const& f, int const n) { int const m = f.size * 8; // number of bits in the bloom int const k = f.BitsPerBloom; // number of hash functions (e.g. bits set to 1 in every bloom) @@ -76,7 +80,7 @@ int calculateExpected(TopicBloomFilter const& f, int const n) return static_cast(kBitsSet * 100 + 0.5); // in percents, rounded up } -void testFalsePositiveRate(TopicBloomFilter const& f, int const inserted, Topic& x) +void testFalsePositiveRate(TopicBloomFilterTest const& f, int const inserted, Topic& x) { int const c_sampleSize = 1000; int falsePositive = 0; @@ -104,8 +108,8 @@ BOOST_AUTO_TEST_CASE(falsePositiveRate) VerbosityHolder setTemporaryLevel(10); cnote << "Testing Bloom Filter False Positive Rate..."; - TopicBloomFilter f; - Topic x(0xABCDEF); // deterministic pseudorandom value + TopicBloomFilterTest f; + Topic x(0xC0DEFEED); // deterministic pseudorandom value for (int i = 1; i < 21; ++i) { @@ -120,7 +124,7 @@ BOOST_AUTO_TEST_CASE(bloomFilterRandom) VerbosityHolder setTemporaryLevel(10); cnote << "Testing Bloom Filter matching..."; - TopicBloomFilter f; + TopicBloomFilterShort f; vector vec; Topic x(0xDEADBEEF); int const c_rounds = 4; @@ -146,7 +150,7 @@ BOOST_AUTO_TEST_CASE(bloomFilterRaw) VerbosityHolder setTemporaryLevel(10); cnote << "Testing Raw Bloom matching..."; - TopicBloomFilter f; + TopicBloomFilterShort f; AbridgedTopic b00000001(0x01); AbridgedTopic b00010000(0x10); From 7852ce4b3cecc6e4a360a8c3017a332646505fa1 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 19 Jun 2015 16:12:23 +0200 Subject: [PATCH 143/169] explicit scope resolution added --- libwhisper/BloomFilter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index 393ccbfd1..3d2ed3e12 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -62,7 +62,7 @@ void TopicBloomFilterBase::addRaw(FixedHash const& _h) for (unsigned i = 0; i < CounterSize; ++i) if (isBitSet(_h, i)) { - if (m_refCounter[i] != numeric_limits::max()) + if (m_refCounter[i] != std::numeric_limits::max()) m_refCounter[i]++; else BOOST_THROW_EXCEPTION(Overflow()); From 726848b0d5ba6d1e6300d33e644e44d53f3c4d55 Mon Sep 17 00:00:00 2001 From: Vlad Gluhovsky Date: Fri, 19 Jun 2015 16:24:13 +0200 Subject: [PATCH 144/169] explicit scope resolution added --- libwhisper/BloomFilter.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libwhisper/BloomFilter.h b/libwhisper/BloomFilter.h index 3d2ed3e12..157f4b011 100644 --- a/libwhisper/BloomFilter.h +++ b/libwhisper/BloomFilter.h @@ -37,11 +37,11 @@ public: void addBloom(dev::shh::AbridgedTopic const& _h) { addRaw(_h.template bloomPart()); } void removeBloom(dev::shh::AbridgedTopic const& _h) { removeRaw(_h.template bloomPart()); } - bool containsBloom(dev::shh::AbridgedTopic const& _h) const { return contains(_h.template bloomPart()); } + bool containsBloom(dev::shh::AbridgedTopic const& _h) const { return this->contains(_h.template bloomPart()); } void addRaw(FixedHash const& _h); void removeRaw(FixedHash const& _h); - bool containsRaw(FixedHash const& _h) const { return contains(_h); } + bool containsRaw(FixedHash const& _h) const { return this->contains(_h); } enum { BitsPerBloom = 3 }; From 56f68beb81b6de0bc2d5db153f6ca230f06fab36 Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 19 Jun 2015 16:55:19 +0200 Subject: [PATCH 145/169] ui changes --- mix/qml/Block.qml | 10 +- mix/qml/BlockChain.qml | 261 +++++++++++++++++++++---------------- mix/qml/ScenarioButton.qml | 37 +++++- mix/qml/ScenarioLoader.qml | 259 ++++++++++++++++++++++-------------- 4 files changed, 347 insertions(+), 220 deletions(-) diff --git a/mix/qml/Block.qml b/mix/qml/Block.qml index 2f7d04a20..796518f11 100644 --- a/mix/qml/Block.qml +++ b/mix/qml/Block.qml @@ -57,7 +57,6 @@ ColumnLayout Layout.preferredWidth: blockWidth Layout.preferredHeight: trHeight color: "#DEDCDC" - radius: 4 anchors.left: parent.left anchors.leftMargin: statusWidth Label { @@ -141,13 +140,14 @@ ColumnLayout color: "transparent" anchors.top: parent.top property bool saveStatus - Image { anchors.top: parent.top - anchors.topMargin: -10 + anchors.left: parent.left + anchors.leftMargin: -9 + anchors.topMargin: -9 id: saveStatusImage source: "qrc:/qml/img/recyclediscard@2x.png" - width: statusWidth + width: statusWidth + 20 fillMode: Image.PreserveAspectFit } @@ -206,7 +206,7 @@ ColumnLayout { anchors.top: parent.top Layout.fillWidth: true - spacing: cellSpacing + //spacing: cellSpacing Rectangle { Layout.preferredWidth: fromWidth diff --git a/mix/qml/BlockChain.qml b/mix/qml/BlockChain.qml index b7411de16..ed1c4a4ad 100644 --- a/mix/qml/BlockChain.qml +++ b/mix/qml/BlockChain.qml @@ -67,7 +67,7 @@ ColumnLayout { previousWidth = width } - property int statusWidth: 50 + property int statusWidth: 30 property int fromWidth: 150 property int toWidth: 100 property int valueWidth: 200 @@ -80,13 +80,20 @@ ColumnLayout { { id: header spacing: 0 - Layout.preferredHeight: 40 - Image { - id: debugImage - source: "qrc:/qml/img/recycleicon@2x.png" + Layout.preferredHeight: 30 + Rectangle + { Layout.preferredWidth: statusWidth Layout.preferredHeight: parent.height - fillMode: Image.PreserveAspectFit + color: "transparent" + Image { + id: debugImage + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + source: "qrc:/qml/img/recycleicon@2x.png" + width: statusWidth + 20 + fillMode: Image.PreserveAspectFit + } } Rectangle { @@ -96,7 +103,7 @@ ColumnLayout { anchors.verticalCenter: parent.verticalCenter text: "From" anchors.left: parent.left - anchors.leftMargin: horizontalMargin + 5 + anchors.leftMargin: horizontalMargin } } Label @@ -243,143 +250,171 @@ ColumnLayout { Layout.preferredWidth: parent.width RowLayout { - width: 4 * 100 + anchors.horizontalCenter: parent.horizontalCenter anchors.top: parent.top anchors.topMargin: 10 - spacing: 0 - ScenarioButton { - id: rebuild - text: qsTr("Rebuild") - onClicked: - { - if (ensureNotFuturetime.running) - return; - stopBlinking() - var retBlocks = []; - var bAdded = 0; - for (var j = 0; j < model.blocks.length; j++) + spacing: 20 + + Rectangle { + Layout.preferredWidth: 100 + Layout.preferredHeight: 30 + + ScenarioButton { + id: rebuild + text: qsTr("Rebuild") + width: 100 + height: 30 + roundLeft: true + roundRight: true + onClicked: { - var b = model.blocks[j]; - var block = { - hash: b.hash, - number: b.number, - transactions: [], - status: b.status - } - for (var k = 0; k < model.blocks[j].transactions.length; k++) + if (ensureNotFuturetime.running) + return; + stopBlinking() + var retBlocks = []; + var bAdded = 0; + for (var j = 0; j < model.blocks.length; j++) { - if (blockModel.get(j).transactions.get(k).saveStatus) + var b = model.blocks[j]; + var block = { + hash: b.hash, + number: b.number, + transactions: [], + status: b.status + } + for (var k = 0; k < model.blocks[j].transactions.length; k++) + { + if (blockModel.get(j).transactions.get(k).saveStatus) + { + var tr = model.blocks[j].transactions[k] + tr.saveStatus = true + block.transactions.push(tr); + } + + } + if (block.transactions.length > 0) { - var tr = model.blocks[j].transactions[k] - tr.saveStatus = true - block.transactions.push(tr); + bAdded++ + block.number = bAdded + block.status = "mined" + retBlocks.push(block) } } - if (block.transactions.length > 0) + if (retBlocks.length === 0) + retBlocks.push(projectModel.stateListModel.createEmptyBlock()) + else { - bAdded++ - block.number = bAdded - block.status = "mined" - retBlocks.push(block) + var last = retBlocks[retBlocks.length - 1] + last.number = -1 + last.status = "pending" } - } - if (retBlocks.length === 0) - retBlocks.push(projectModel.stateListModel.createEmptyBlock()) - else - { - var last = retBlocks[retBlocks.length - 1] - last.number = -1 - last.status = "pending" - } - - model.blocks = retBlocks - blockModel.clear() - for (var j = 0; j < model.blocks.length; j++) - blockModel.append(model.blocks[j]) + model.blocks = retBlocks + blockModel.clear() + for (var j = 0; j < model.blocks.length; j++) + blockModel.append(model.blocks[j]) - ensureNotFuturetime.start() - clientModel.setupScenario(model); + ensureNotFuturetime.start() + clientModel.setupScenario(model); + } + buttonShortcut: "" + sourceImg: "qrc:/qml/img/recycleicon@2x.png" } - - Layout.preferredWidth: 100 - Layout.preferredHeight: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/recycleicon@2x.png" + } - } + Rectangle + { + Layout.preferredWidth: 200 + Layout.preferredHeight: 30 + color: "transparent" - ScenarioButton { - id: addTransaction - text: qsTr("Add Transaction") - onClicked: - { - var lastBlock = model.blocks[model.blocks.length - 1]; - if (lastBlock.status === "mined") + ScenarioButton { + id: addTransaction + text: qsTr("Add Tx") + onClicked: { - var newblock = projectModel.stateListModel.createEmptyBlock() - blockModel.appendBlock(newblock) - model.blocks.push(newblock); - } + var lastBlock = model.blocks[model.blocks.length - 1]; + if (lastBlock.status === "mined") + { + var newblock = projectModel.stateListModel.createEmptyBlock() + blockModel.appendBlock(newblock) + model.blocks.push(newblock); + } - var item = TransactionHelper.defaultTransaction() - transactionDialog.stateAccounts = model.accounts - transactionDialog.execute = true - transactionDialog.open(model.blocks[model.blocks.length - 1].transactions.length, model.blocks.length - 1, item) + var item = TransactionHelper.defaultTransaction() + transactionDialog.stateAccounts = model.accounts + transactionDialog.execute = true + transactionDialog.open(model.blocks[model.blocks.length - 1].transactions.length, model.blocks.length - 1, item) + } + width: 100 + height: 30 + buttonShortcut: "" + sourceImg: "qrc:/qml/img/sendtransactionicon@2x.png" + roundLeft: true + roundRight: false } - Layout.preferredWidth: 100 - Layout.preferredHeight: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/sendtransactionicon@2x.png" - } - Timer - { - id: ensureNotFuturetime - interval: 1000 - repeat: false - running: false - } + Timer + { + id: ensureNotFuturetime + interval: 1000 + repeat: false + running: false + } - ScenarioButton { - id: addBlockBtn - text: qsTr("Add Block") - onClicked: + Rectangle { - if (ensureNotFuturetime.running) - return - if (clientModel.mining || clientModel.running) - return - if (model.blocks.length > 0) + width: 1 + height: parent.height + anchors.right: addBlockBtn.left + color: "#ededed" + } + + ScenarioButton { + id: addBlockBtn + text: qsTr("Add Block..") + anchors.left: addTransaction.right + roundLeft: false + roundRight: true + onClicked: { - var lastBlock = model.blocks[model.blocks.length - 1] - if (lastBlock.status === "pending") + if (ensureNotFuturetime.running) + return + if (clientModel.mining || clientModel.running) + return + if (model.blocks.length > 0) { - ensureNotFuturetime.start() - clientModel.mine() + var lastBlock = model.blocks[model.blocks.length - 1] + if (lastBlock.status === "pending") + { + ensureNotFuturetime.start() + clientModel.mine() + } + else + addNewBlock() } else addNewBlock() + } - else - addNewBlock() - } + function addNewBlock() + { + var block = projectModel.stateListModel.createEmptyBlock() + model.blocks.push(block) + blockModel.appendBlock(block) + } + width: 100 + height: 30 - function addNewBlock() - { - var block = projectModel.stateListModel.createEmptyBlock() - model.blocks.push(block) - blockModel.appendBlock(block) + buttonShortcut: "" + sourceImg: "qrc:/qml/img/addblock@2x.png" } - Layout.preferredWidth: 100 - Layout.preferredHeight: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/addblock@2x.png" } + Connections { target: clientModel @@ -447,7 +482,7 @@ ColumnLayout { ScenarioButton { id: newAccount - text: qsTr("New Account") + text: qsTr("New Account..") onClicked: { model.accounts.push(projectModel.stateListModel.newAccount("1000000", QEther.Ether)) } @@ -455,6 +490,8 @@ ColumnLayout { Layout.preferredHeight: 30 buttonShortcut: "" sourceImg: "qrc:/qml/img/newaccounticon@2x.png" + roundLeft: true + roundRight: true } } } diff --git a/mix/qml/ScenarioButton.qml b/mix/qml/ScenarioButton.qml index 1577ec955..d4beaefaa 100644 --- a/mix/qml/ScenarioButton.qml +++ b/mix/qml/ScenarioButton.qml @@ -2,6 +2,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.0 import QtQuick.Controls.Styles 1.1 +import QtGraphicalEffects 1.0 Rectangle { id: buttonActionContainer @@ -9,6 +10,8 @@ Rectangle { property string buttonShortcut property string sourceImg property string fillColor + property alias roundLeft: left.visible + property alias roundRight: right.visible signal clicked function startBlinking() @@ -22,12 +25,19 @@ Rectangle { blinkTimer.stop() } + Rectangle + { + id: left + width: 10 + height: parent.height + anchors.left: parent.left + anchors.leftMargin: -8 + radius: 15 + } + Rectangle { id: contentRectangle anchors.fill: parent - border.color: "#cccccc" - border.width: 1 - radius: 4 color: "white" property variant colorGradient: ["#FFFFFF", "#FFFEFC", "#FFFDF9", "#FFFCF7", "#FFFBF4", "#FFFAF2", "#FFF9EF", "#FFF8EC", "#FFF7EA", "#FFF6E7", "#FFF5E5", "#FFF5E2", "#FFF4E0", "#FFF3DD", "#FFF2DA", "#FFF1D8", "#FFF0D5", "#FFEFD3", "#FFEED0", "#FFEDCE", "#FFECCB", "#FFEBC8", "#FFEBC6", "#FFEAC3", "#FFE9C1", "#FFE8BE", "#FFE7BC", "#FFE6B9", "#FFE5B6", "#FFE4B4", "#FFE3B1", "#FFE2AF", "#FFE1AC", "#FFE1AA", "#FFE0A7", "#FFDFA4", "#FFDEA2", "#FFDD9F", "#FFDC9D", "#FFDB9A", "#FFDA97", "#FFD995", "#FFD892", "#FFD790", "#FFD78D", "#FFD68B", "#FFD588", "#FFD485", "#FFD383", "#FFD280", "#FFD17E", "#FFD07B", "#FFCF79", "#FFCE76", "#FFCD73", "#FFCD71", "#FFCC6E", "#FFCB6C", "#FFCA69", "#FFC967", "#FFC864", "#FFC761", "#FFC65F", "#FFC55C", "#FFC45A", "#FFC357", "#FFC355", "#FFC252", "#FFC14F", "#FFC04D", "#FFBF4A", "#FFBE48", "#FFBD45", "#FFBC42", "#FFBB40", "#FFBA3D", "#FFB93B", "#FFB938", "#FFB836", "#FFB733", "#FFB630", "#FFB52E", "#FFB42B", "#FFB329", "#FFB226", "#FFB124", "#FFB021", "#FFAF1E", "#FFAF1C", "#FFAE19", "#FFAD17", "#FFAC14", "#FFAB12", "#FFAA0F", "#FFA90C", "#FFA80A", "#FFA707", "#FFA605", "#FFA502", "#FFA500"] @@ -41,6 +51,9 @@ Rectangle { property int direction: 1 onTriggered: { index = index + direction + var color = parent.colorGradient[index] + left.color = color + right.color = color parent.color = parent.colorGradient[index] if (index >= parent.colorGradient.length - 1) direction = -1 @@ -50,6 +63,8 @@ Rectangle { onRunningChanged: { if (!running) { + left.color = "white" + right.color = "white" parent.color = "white" index = 0 direction = 1 @@ -57,7 +72,6 @@ Rectangle { } } - Image { id: debugImage anchors { @@ -65,12 +79,11 @@ Rectangle { right: parent.right top: parent.top bottom: parent.bottom - bottomMargin: debugImg.pressed ? 0 : 2; + bottomMargin: debugImg.pressed ? -2 : 0; topMargin: debugImg.pressed ? 2 : 0; } source: sourceImg fillMode: Image.PreserveAspectFit - height: 30 } Button { @@ -93,12 +106,22 @@ Rectangle { } } + Rectangle + { + id: right + width: 10 + height: parent.height + anchors.left: contentRectangle.right + anchors.leftMargin: -8 + radius: 15 + } + Rectangle { anchors.top: contentRectangle.bottom anchors.topMargin: 15 width: parent.width - Text + Label { text: buttonActionContainer.text anchors.centerIn: parent diff --git a/mix/qml/ScenarioLoader.qml b/mix/qml/ScenarioLoader.qml index 9323300ab..bc26b103d 100644 --- a/mix/qml/ScenarioLoader.qml +++ b/mix/qml/ScenarioLoader.qml @@ -39,11 +39,12 @@ ColumnLayout anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter color: "transparent" - Text + Label { anchors.verticalCenter: parent.verticalCenter anchors.horizontalCenter: parent.horizontalCenter id: scenarioName + font.bold: true } TextInput @@ -135,7 +136,8 @@ ColumnLayout RowLayout { - Layout.fillWidth: true + Layout.preferredWidth: 560 + anchors.horizontalCenter: parent.horizontalCenter Layout.preferredHeight: 50 spacing: 0 @@ -143,128 +145,193 @@ ColumnLayout { Layout.preferredWidth: 100 * 5 Layout.preferredHeight: 50 - spacing: 0 + spacing: 15 - ComboBox + Rectangle { - id: scenarioList - model: projectModel.stateListModel - textRole: "title" + color: "transparent" + width: 251 height: 30 - width: 150 - onCurrentIndexChanged: + Rectangle { - restoreScenario.restore() + width: 10 + height: parent.height + anchors.right: scenarioList.left + anchors.rightMargin: -8 + radius: 15 } - function load() + ComboBox { - var state = projectModel.stateListModel.getState(currentIndex) - loaded(state) - } + id: scenarioList + model: projectModel.stateListModel + textRole: "title" + height: parent.height + width: 150 + onCurrentIndexChanged: + { + restoreScenario.restore() + } - style: ComboBoxStyle { - background: Rectangle { - color: "white" - border.color: "#cccccc" - border.width: 1 - radius: 4 - anchors.fill: parent + function load() + { + var state = projectModel.stateListModel.getState(currentIndex) + loaded(state) } - label: Rectangle { - anchors.fill: parent - color: "white" - Text { - id: comboLabel - maximumLineCount: 1 - elide: Text.ElideRight - width: parent.width - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter - text: { - if (projectModel.stateListModel.getState(scenarioList.currentIndex)) - return projectModel.stateListModel.getState(scenarioList.currentIndex).title - else - return "" - } - Connections { - target: blockChainSelector - onLoaded: { - comboLabel.text = projectModel.stateListModel.getState(scenarioList.currentIndex).title + + style: ComboBoxStyle { + background: Rectangle { + color: "white" + anchors.fill: parent + } + label: Rectangle { + anchors.fill: parent + color: "white" + Label { + id: comboLabel + maximumLineCount: 1 + elide: Text.ElideRight + width: parent.width + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + text: { + if (projectModel.stateListModel.getState(scenarioList.currentIndex)) + return projectModel.stateListModel.getState(scenarioList.currentIndex).title + else + return "" } - onRenamed: { - comboLabel.text = scenario.title + Connections { + target: blockChainSelector + onLoaded: { + comboLabel.text = projectModel.stateListModel.getState(scenarioList.currentIndex).title + } + onRenamed: { + comboLabel.text = scenario.title + } } } } } } + + Rectangle + { + width: 1 + height: parent.height + anchors.right: addScenario.left + color: "#ededed" + } + + ScenarioButton { + id: addScenario + anchors.left: scenarioList.right + width: 100 + height: parent.height + buttonShortcut: "" + sourceImg: "qrc:/qml/img/restoreicon@2x.png" + onClicked: { + var item = projectModel.stateListModel.createDefaultState(); + item.title = qsTr("New Scenario") + projectModel.stateListModel.appendState(item) + projectModel.stateListModel.save() + scenarioList.currentIndex = projectModel.stateListModel.count - 1 + scenarioNameEdit.edit() + } + text: qsTr("New..") + roundRight: true + roundLeft: false + } } - ScenarioButton { - id: restoreScenario - width: 100 + + Rectangle + { + width: 100 * 3 height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/restoreicon@2x.png" - onClicked: { - restore() - } - text: qsTr("Restore") - function restore() + color: "transparent" + + Rectangle { - var state = projectModel.stateListModel.reloadStateFromFromProject(scenarioList.currentIndex) - if (state) + width: 10 + height: parent.height + anchors.right: restoreScenario.left + anchors.rightMargin: -4 + radius: 15 + } + + ScenarioButton { + id: restoreScenario + width: 100 + height: parent.height + buttonShortcut: "" + sourceImg: "qrc:/qml/img/restoreicon@2x.png" + onClicked: { + restore() + } + text: qsTr("Restore") + function restore() { - editStatus.visible = false - restored(state) - loaded(state) + var state = projectModel.stateListModel.reloadStateFromFromProject(scenarioList.currentIndex) + if (state) + { + editStatus.visible = false + restored(state) + loaded(state) + } } + roundRight: false + roundLeft: true } - } - ScenarioButton { - id: saveScenario - text: qsTr("Save") - onClicked: { - projectModel.saveProjectFile() - saved(state) + + Rectangle + { + width: 1 + height: parent.height + anchors.right: saveScenario.left + color: "#ededed" } - width: 100 - height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/saveicon@2x.png" - } - ScenarioButton - { - id: duplicateScenario - text: qsTr("Duplicate") - onClicked: { - projectModel.stateListModel.duplicateState(scenarioList.currentIndex) - duplicated(state) + ScenarioButton { + id: saveScenario + anchors.left: restoreScenario.right + text: qsTr("Save") + onClicked: { + projectModel.saveProjectFile() + saved(state) + } + width: 100 + height: parent.height + buttonShortcut: "" + sourceImg: "qrc:/qml/img/saveicon@2x.png" + roundRight: false + roundLeft: false } - width: 100 - height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/duplicateicon@2x.png" - } - ScenarioButton { - id: addScenario - width: 100 - height: 30 - buttonShortcut: "" - sourceImg: "qrc:/qml/img/plus.png" - onClicked: { - var item = projectModel.stateListModel.createDefaultState(); - item.title = qsTr("New Scenario") - projectModel.stateListModel.appendState(item) - projectModel.stateListModel.save() - scenarioList.currentIndex = projectModel.stateListModel.count - 1 - scenarioNameEdit.edit() + Rectangle + { + width: 1 + height: parent.height + anchors.right: duplicateScenario.left + color: "#ededed" + } + + ScenarioButton + { + id: duplicateScenario + anchors.left: saveScenario.right + text: qsTr("Duplicate") + onClicked: { + projectModel.stateListModel.duplicateState(scenarioList.currentIndex) + duplicated(state) + } + width: 100 + height: parent.height + buttonShortcut: "" + sourceImg: "qrc:/qml/img/duplicateicon@2x.png" + roundRight: true + roundLeft: false } - text: qsTr("New") } } } From ce3a05f8f3824e046b84978ccd70c57afa9bbc33 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 19 Jun 2015 20:51:09 +0200 Subject: [PATCH 146/169] mv BlockTestsFiller -> BlockchainTestsFiller --- .../bcGasPricerTestFiller.json | 0 .../bcInvalidHeaderTestFiller.json | 0 .../bcRPC_API_TestFiller.json | 0 .../bcTotalDifficultyTestFiller.json | 0 .../bcUncleHeaderValiditiyFiller.json | 0 .../bcUncleTestFiller.json | 0 .../bcValidBlockTestFiller.json | 0 .../bcWalletTestFiller.json | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcGasPricerTestFiller.json (100%) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcInvalidHeaderTestFiller.json (100%) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcRPC_API_TestFiller.json (100%) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcTotalDifficultyTestFiller.json (100%) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcUncleHeaderValiditiyFiller.json (100%) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcUncleTestFiller.json (100%) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcValidBlockTestFiller.json (100%) rename test/libethereum/{BlockTestsFiller => BlockchainTestsFiller}/bcWalletTestFiller.json (100%) diff --git a/test/libethereum/BlockTestsFiller/bcGasPricerTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcGasPricerTestFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcGasPricerTestFiller.json rename to test/libethereum/BlockchainTestsFiller/bcGasPricerTestFiller.json diff --git a/test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcInvalidHeaderTestFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcInvalidHeaderTestFiller.json rename to test/libethereum/BlockchainTestsFiller/bcInvalidHeaderTestFiller.json diff --git a/test/libethereum/BlockTestsFiller/bcRPC_API_TestFiller.json b/test/libethereum/BlockchainTestsFiller/bcRPC_API_TestFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcRPC_API_TestFiller.json rename to test/libethereum/BlockchainTestsFiller/bcRPC_API_TestFiller.json diff --git a/test/libethereum/BlockTestsFiller/bcTotalDifficultyTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcTotalDifficultyTestFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcTotalDifficultyTestFiller.json rename to test/libethereum/BlockchainTestsFiller/bcTotalDifficultyTestFiller.json diff --git a/test/libethereum/BlockTestsFiller/bcUncleHeaderValiditiyFiller.json b/test/libethereum/BlockchainTestsFiller/bcUncleHeaderValiditiyFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcUncleHeaderValiditiyFiller.json rename to test/libethereum/BlockchainTestsFiller/bcUncleHeaderValiditiyFiller.json diff --git a/test/libethereum/BlockTestsFiller/bcUncleTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcUncleTestFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcUncleTestFiller.json rename to test/libethereum/BlockchainTestsFiller/bcUncleTestFiller.json diff --git a/test/libethereum/BlockTestsFiller/bcValidBlockTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcValidBlockTestFiller.json rename to test/libethereum/BlockchainTestsFiller/bcValidBlockTestFiller.json diff --git a/test/libethereum/BlockTestsFiller/bcWalletTestFiller.json b/test/libethereum/BlockchainTestsFiller/bcWalletTestFiller.json similarity index 100% rename from test/libethereum/BlockTestsFiller/bcWalletTestFiller.json rename to test/libethereum/BlockchainTestsFiller/bcWalletTestFiller.json From 691482c1fd1b2fe85316b288ab7da07eee217c80 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Fri, 19 Jun 2015 20:51:56 +0200 Subject: [PATCH 147/169] mv BlockTestsFiller -> BlockchainTestsFiller in blockchain.cpp --- test/libethereum/blockchain.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/libethereum/blockchain.cpp b/test/libethereum/blockchain.cpp index 4621708bd..0314de78b 100644 --- a/test/libethereum/blockchain.cpp +++ b/test/libethereum/blockchain.cpp @@ -788,58 +788,58 @@ BOOST_AUTO_TEST_SUITE(BlockChainTests) BOOST_AUTO_TEST_CASE(bcForkBlockTest) { - dev::test::executeTests("bcForkBlockTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcForkBlockTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcTotalDifficultyTest) { - dev::test::executeTests("bcTotalDifficultyTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcTotalDifficultyTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcInvalidRLPTest) { - dev::test::executeTests("bcInvalidRLPTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcInvalidRLPTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcRPC_API_Test) { - dev::test::executeTests("bcRPC_API_Test", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcRPC_API_Test", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcValidBlockTest) { - dev::test::executeTests("bcValidBlockTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcValidBlockTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcInvalidHeaderTest) { - dev::test::executeTests("bcInvalidHeaderTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcInvalidHeaderTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcUncleTest) { - dev::test::executeTests("bcUncleTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcUncleTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcUncleHeaderValiditiy) { - dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcUncleHeaderValiditiy", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcGasPricerTest) { - dev::test::executeTests("bcGasPricerTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcGasPricerTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcBruncleTest) { - dev::test::executeTests("bcBruncleTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcBruncleTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(bcWalletTest) { if (test::Options::get().wallet) - dev::test::executeTests("bcWalletTest", "/BlockTests",dev::test::getFolder(__FILE__) + "/BlockTestsFiller", dev::test::doBlockchainTests); + dev::test::executeTests("bcWalletTest", "/BlockchainTests",dev::test::getFolder(__FILE__) + "/BlockchainTestsFiller", dev::test::doBlockchainTests); } BOOST_AUTO_TEST_CASE(userDefinedFile) From c5cb5aeed4dd601bd493f25ee3e68ed831c2d683 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 20 Jun 2015 22:04:31 +0800 Subject: [PATCH 148/169] Avoid attempting to import invalid blocks. Reduce verbosity. Minor additions to exponential backoff. --- libethereum/BlockChain.cpp | 6 ++++-- libethereum/BlockChain.h | 2 +- libethereum/BlockQueue.cpp | 11 ++++++----- libethereum/BlockQueue.h | 1 + libethereum/Client.cpp | 15 ++++++++------- libethereum/EthereumPeer.cpp | 3 +++ libethereum/State.h | 2 ++ libethereum/TransactionQueue.cpp | 3 ++- libethereum/TransactionQueue.h | 3 ++- libp2p/Host.cpp | 3 ++- libp2p/Session.cpp | 19 ++++++++++++------- libp2p/Session.h | 7 ++++--- 12 files changed, 47 insertions(+), 28 deletions(-) diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index b2da42e71..392063adb 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -305,7 +305,7 @@ LastHashes BlockChain::lastHashes(unsigned _n) const return m_lastLastHashes; } -tuple BlockChain::sync(BlockQueue& _bq, OverlayDB const& _stateDB, unsigned _max) +tuple BlockChain::sync(BlockQueue& _bq, OverlayDB const& _stateDB, unsigned _max) { // _bq.tick(*this); @@ -315,6 +315,7 @@ tuple BlockChain::sync(BlockQueue& _bq, OverlayDB const& _sta h256s fresh; h256s dead; h256s badBlocks; + unsigned count = 0; for (VerifiedBlock const& block: blocks) if (!badBlocks.empty()) badBlocks.push_back(block.verified.info.hash()); @@ -328,6 +329,7 @@ tuple BlockChain::sync(BlockQueue& _bq, OverlayDB const& _sta r = import(block.verified, _stateDB, ImportRequirements::Default & ~ImportRequirements::ValidNonce & ~ImportRequirements::CheckUncles); fresh += r.liveBlocks; dead += r.deadBlocks; + ++count; } catch (dev::eth::UnknownParent) { @@ -353,7 +355,7 @@ tuple BlockChain::sync(BlockQueue& _bq, OverlayDB const& _sta badBlocks.push_back(block.verified.info.hash()); } } - return make_tuple(ImportRoute{dead, fresh}, _bq.doneDrain(badBlocks)); + return make_tuple(ImportRoute{dead, fresh}, _bq.doneDrain(badBlocks), count); } pair BlockChain::attemptImport(bytes const& _block, OverlayDB const& _stateDB, ImportRequirements::value _ir) noexcept diff --git a/libethereum/BlockChain.h b/libethereum/BlockChain.h index 2d3abd922..c7f0402df 100644 --- a/libethereum/BlockChain.h +++ b/libethereum/BlockChain.h @@ -117,7 +117,7 @@ public: /// Sync the chain with any incoming blocks. All blocks should, if processed in order. /// @returns fresh blocks, dead blocks and true iff there are additional blocks to be processed waiting. - std::tuple sync(BlockQueue& _bq, OverlayDB const& _stateDB, unsigned _max); + std::tuple sync(BlockQueue& _bq, OverlayDB const& _stateDB, unsigned _max); /// Attempt to import the given block directly into the CanonBlockChain and sync with the state DB. /// @returns the block hashes of any blocks that came into/went out of the canonical block chain. diff --git a/libethereum/BlockQueue.cpp b/libethereum/BlockQueue.cpp index 394549076..9e647c9c1 100644 --- a/libethereum/BlockQueue.cpp +++ b/libethereum/BlockQueue.cpp @@ -36,6 +36,7 @@ const char* BlockQueueChannel::name() { return EthOrange "[]>"; } #else const char* BlockQueueChannel::name() { return EthOrange "▣┅▶"; } #endif +const char* BlockQueueTraceChannel::name() { return EthOrange "▣ ▶"; } size_t const c_maxKnownCount = 100000; size_t const c_maxKnownSize = 128 * 1024 * 1024; @@ -183,14 +184,14 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo // Check if we already know this block. h256 h = BlockInfo::headerHash(_block); - cblockq << "Queuing block" << h << "for import..."; + clog(BlockQueueTraceChannel) << "Queuing block" << h << "for import..."; UpgradableGuard l(m_lock); if (m_readySet.count(h) || m_drainingSet.count(h) || m_unknownSet.count(h) || m_knownBad.count(h)) { // Already know about this one. - cblockq << "Already known."; + clog(BlockQueueTraceChannel) << "Already known."; return ImportResult::AlreadyKnown; } @@ -228,7 +229,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo time_t bit = (unsigned)bi.timestamp; if (strftime(buf, 24, "%X", localtime(&bit)) == 0) buf[0] = '\0'; // empty if case strftime fails - cblockq << "OK - queued for future [" << bi.timestamp << "vs" << time(0) << "] - will wait until" << buf; + clog(BlockQueueTraceChannel) << "OK - queued for future [" << bi.timestamp << "vs" << time(0) << "] - will wait until" << buf; m_unknownSize += _block.size(); m_unknownCount++; m_difficulty += bi.difficulty; @@ -248,7 +249,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo else if (!m_readySet.count(bi.parentHash) && !m_drainingSet.count(bi.parentHash) && !_bc.isKnown(bi.parentHash)) { // We don't know the parent (yet) - queue it up for later. It'll get resent to us if we find out about its ancestry later on. - cblockq << "OK - queued as unknown parent:" << bi.parentHash; + clog(BlockQueueTraceChannel) << "OK - queued as unknown parent:" << bi.parentHash; m_unknown.insert(make_pair(bi.parentHash, make_pair(h, _block.toBytes()))); m_unknownSet.insert(h); m_unknownSize += _block.size(); @@ -260,7 +261,7 @@ ImportResult BlockQueue::import(bytesConstRef _block, BlockChain const& _bc, boo else { // If valid, append to blocks. - cblockq << "OK - ready for chain insertion."; + clog(BlockQueueTraceChannel) << "OK - ready for chain insertion."; DEV_GUARDED(m_verification) m_unverified.push_back(UnverifiedBlock { h, bi.parentHash, _block.toBytes() }); m_moreToVerify.notify_one(); diff --git a/libethereum/BlockQueue.h b/libethereum/BlockQueue.h index 106c08534..137048ec4 100644 --- a/libethereum/BlockQueue.h +++ b/libethereum/BlockQueue.h @@ -42,6 +42,7 @@ namespace eth class BlockChain; struct BlockQueueChannel: public LogChannel { static const char* name(); static const int verbosity = 4; }; +struct BlockQueueTraceChannel: public LogChannel { static const char* name(); static const int verbosity = 7; }; #define cblockq dev::LogOutputStream() struct BlockQueueStatus diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 7560f9165..e2a33c603 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -612,22 +612,23 @@ bool Client::submitWork(ProofOfWork::Solution const& _solution) } unsigned static const c_syncMin = 1; -unsigned static const c_syncMax = 100; +unsigned static const c_syncMax = 1000; double static const c_targetDuration = 1; void Client::syncBlockQueue() { - ImportRoute ir; cwork << "BQ ==> CHAIN ==> STATE"; + ImportRoute ir; + unsigned count; boost::timer t; - tie(ir, m_syncBlockQueue) = m_bc.sync(m_bq, m_stateDB, m_syncAmount); + tie(ir, m_syncBlockQueue, count) = m_bc.sync(m_bq, m_stateDB, m_syncAmount); double elapsed = t.elapsed(); - cnote << m_syncAmount << "blocks imported in" << unsigned(elapsed * 1000) << "ms (" << (m_syncAmount / elapsed) << "blocks/s)"; + cnote << count << "blocks imported in" << unsigned(elapsed * 1000) << "ms (" << (count / elapsed) << "blocks/s)"; - if (elapsed > c_targetDuration * 1.1 && m_syncAmount > c_syncMin) - m_syncAmount = max(c_syncMin, m_syncAmount * 9 / 10); - else if (elapsed < c_targetDuration * 0.9 && m_syncAmount < c_syncMax) + if (elapsed > c_targetDuration * 1.1 && count > c_syncMin) + m_syncAmount = max(c_syncMin, count * 9 / 10); + else if (count == m_syncAmount && elapsed < c_targetDuration * 0.9 && m_syncAmount < c_syncMax) m_syncAmount = min(c_syncMax, m_syncAmount * 11 / 10 + 1); if (ir.liveBlocks.empty()) return; diff --git a/libethereum/EthereumPeer.cpp b/libethereum/EthereumPeer.cpp index 87d51969a..093e3836d 100644 --- a/libethereum/EthereumPeer.cpp +++ b/libethereum/EthereumPeer.cpp @@ -76,6 +76,9 @@ bool EthereumPeer::isRude() const unsigned EthereumPeer::askOverride() const { + std::string static const badGeth = "Geth/v0.9.27"; + if (session()->info().clientVersion.substr(0, badGeth.size()) == badGeth) + return 1; bytes const& d = repMan().data(*session(), name()); return d.empty() ? c_maxBlocksAsk : RLP(d).toInt(RLP::LaisezFaire); } diff --git a/libethereum/State.h b/libethereum/State.h index 3eac63d04..93a4f4ade 100644 --- a/libethereum/State.h +++ b/libethereum/State.h @@ -206,6 +206,8 @@ public: return false; PoW::assignResult(_result, m_currentBlock); + if (!PoW::verify(m_currentBlock)) + return false; cnote << "Completed" << m_currentBlock.headerHash(WithoutNonce) << m_currentBlock.nonce << m_currentBlock.difficulty << PoW::verify(m_currentBlock); diff --git a/libethereum/TransactionQueue.cpp b/libethereum/TransactionQueue.cpp index e488805d9..b4fa215ad 100644 --- a/libethereum/TransactionQueue.cpp +++ b/libethereum/TransactionQueue.cpp @@ -29,6 +29,7 @@ using namespace dev; using namespace dev::eth; const char* TransactionQueueChannel::name() { return EthCyan "┉┅▶"; } +const char* TransactionQueueTraceChannel::name() { return EthCyan " ┅▶"; } ImportResult TransactionQueue::import(bytesConstRef _transactionRLP, ImportCallback const& _cb, IfDropped _ik) { @@ -115,7 +116,7 @@ ImportResult TransactionQueue::manageImport_WITH_LOCK(h256 const& _h, Transactio m_known.insert(_h); if (_cb) m_callbacks[_h] = _cb; - ctxq << "Queued vaguely legit-looking transaction" << _h; + clog(TransactionQueueTraceChannel) << "Queued vaguely legit-looking transaction" << _h; m_onReady(); } catch (Exception const& _e) diff --git a/libethereum/TransactionQueue.h b/libethereum/TransactionQueue.h index a07efb848..d9bfef847 100644 --- a/libethereum/TransactionQueue.h +++ b/libethereum/TransactionQueue.h @@ -36,7 +36,8 @@ namespace eth class BlockChain; struct TransactionQueueChannel: public LogChannel { static const char* name(); static const int verbosity = 4; }; -#define ctxq dev::LogOutputStream() +struct TransactionQueueTraceChannel: public LogChannel { static const char* name(); static const int verbosity = 7; }; +#define ctxq dev::LogOutputStream() enum class IfDropped { Ignore, Retry }; diff --git a/libp2p/Host.cpp b/libp2p/Host.cpp index feb116c4a..4ed6987ff 100644 --- a/libp2p/Host.cpp +++ b/libp2p/Host.cpp @@ -580,7 +580,8 @@ PeerSessionInfos Host::peerSessionInfo() const for (auto& i: m_sessions) if (auto j = i.second.lock()) if (j->isConnected()) - ret.push_back(j->m_info); + DEV_GUARDED(j->x_info) + ret.push_back(j->m_info); return ret; } diff --git a/libp2p/Session.cpp b/libp2p/Session.cpp index c3f0f2e35..95e7be598 100644 --- a/libp2p/Session.cpp +++ b/libp2p/Session.cpp @@ -44,7 +44,8 @@ Session::Session(Host* _h, RLPXFrameCoder* _io, std::shared_ptr cons { m_peer->m_lastDisconnect = NoDisconnect; m_lastReceived = m_connect = chrono::steady_clock::now(); - m_info.socketId = m_socket->ref().native_handle(); + DEV_GUARDED(x_info) + m_info.socketId = m_socket->ref().native_handle(); } Session::~Session() @@ -187,9 +188,12 @@ bool Session::interpret(PacketType _t, RLP const& _r) break; } case PongPacket: - m_info.lastPing = std::chrono::steady_clock::now() - m_ping; + { + DEV_GUARDED(x_info) + m_info.lastPing = std::chrono::steady_clock::now() - m_ping; clog(NetTriviaSummary) << "Latency: " << chrono::duration_cast(m_info.lastPing).count() << " ms"; break; + } case GetPeersPacket: // Disabled for interop testing. // GetPeers/PeersPacket will be modified to only exchange new nodes which it's peers are interested in. @@ -382,11 +386,12 @@ void Session::drop(DisconnectReason _reason) void Session::disconnect(DisconnectReason _reason) { clog(NetConnect) << "Disconnecting (our reason:" << reasonOf(_reason) << ")"; - StructuredLogger::p2pDisconnected( - m_info.id.abridged(), - m_peer->endpoint, // TODO: may not be 100% accurate - m_server->peerCount() - ); + DEV_GUARDED(x_info) + StructuredLogger::p2pDisconnected( + m_info.id.abridged(), + m_peer->endpoint, // TODO: may not be 100% accurate + m_server->peerCount() + ); if (m_socket->ref().is_open()) { RLPStream s; diff --git a/libp2p/Session.h b/libp2p/Session.h index 6b45fe381..32f700b11 100644 --- a/libp2p/Session.h +++ b/libp2p/Session.h @@ -67,7 +67,7 @@ public: bool isConnected() const { return m_socket->ref().is_open(); } NodeId id() const; - unsigned socketId() const { return m_info.socketId; } + unsigned socketId() const { Guard l(x_info); return m_info.socketId; } template std::shared_ptr cap() const { try { return std::static_pointer_cast(m_capabilities.at(std::make_pair(PeerCap::name(), PeerCap::version()))); } catch (...) { return nullptr; } } @@ -81,9 +81,9 @@ public: int rating() const; void addRating(int _r); - void addNote(std::string const& _k, std::string const& _v) { m_info.notes[_k] = _v; } + void addNote(std::string const& _k, std::string const& _v) { Guard l(x_info); m_info.notes[_k] = _v; } - PeerSessionInfo const& info() const { return m_info; } + PeerSessionInfo info() const { Guard l(x_info); return m_info; } void ensureNodesRequested(); void serviceNodesRequest(); @@ -119,6 +119,7 @@ private: std::shared_ptr m_peer; ///< The Peer object. bool m_dropped = false; ///< If true, we've already divested ourselves of this peer. We're just waiting for the reads & writes to fail before the shared_ptr goes OOS and the destructor kicks in. + mutable Mutex x_info; PeerSessionInfo m_info; ///< Dynamic information about this peer. bool m_theyRequestedNodes = false; ///< Has the peer requested nodes from us without receiveing an answer from us? From 84b3ce298cf4e804ff773d292f8221e6f3aaa9e2 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sat, 20 Jun 2015 23:03:26 +0800 Subject: [PATCH 149/169] Fix issue of mining rejig happening iff chain changed AND none ready: Two blocks are mined on the same parent in quick succession. First gets imported alone, chain changes but there's another "ready" so mining doesn't get rejigged. When the second gets imported soon after, it doesn't change the chain and so mining still doesn't restart. --- libethcore/Farm.h | 3 +++ libethereum/Client.cpp | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libethcore/Farm.h b/libethcore/Farm.h index 9acb375ad..581f8bd60 100644 --- a/libethcore/Farm.h +++ b/libethcore/Farm.h @@ -68,6 +68,7 @@ public: void setWork(WorkPackage const& _wp) { WriteGuard l(x_minerWork); + cdebug << "Farm::setWork()"; if (_wp.headerHash == m_work.headerHash) return; m_work = _wp; @@ -94,6 +95,7 @@ public: void stop() { WriteGuard l(x_minerWork); + cdebug << "Farm::stop()"; m_miners.clear(); m_work.reset(); m_isMining = false; @@ -175,6 +177,7 @@ private: bool start() { WriteGuard l(x_minerWork); + cdebug << "start()"; if (!m_miners.empty() && !!std::dynamic_pointer_cast(m_miners[0])) return true; m_miners.clear(); diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index e2a33c603..cb19feb9c 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -702,7 +702,7 @@ void Client::onChainChanged(ImportRoute const& _ir) // RESTART MINING - if (!m_bq.items().first) + if (!isSyncing()) { bool preChanged = false; State newPreMine; From 1439554375646390d1024f9e757756499c37d389 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 21 Jun 2015 16:59:16 +0200 Subject: [PATCH 150/169] Avoid rejigging only if we're syncing. --- libethereum/Client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index cb19feb9c..27d967708 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -765,7 +765,7 @@ void Client::startMining() void Client::rejigMining() { - if ((wouldMine() || remoteActive()) && !m_bq.items().first && (!isChainBad() || mineOnBadChain()) /*&& (forceMining() || transactionsWaiting())*/) + if ((wouldMine() || remoteActive()) && !isSyncing() && (!isChainBad() || mineOnBadChain()) /*&& (forceMining() || transactionsWaiting())*/) { cnote << "Rejigging mining..."; DEV_WRITE_GUARDED(x_working) From 0360be76f21971f21e6e1e3470617c1c95778e77 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 21 Jun 2015 17:11:51 +0200 Subject: [PATCH 151/169] Make API room for major syncing. TBI. --- libethereum/Client.cpp | 12 ++++++++++-- libethereum/Client.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libethereum/Client.cpp b/libethereum/Client.cpp index 27d967708..f66ef8c3b 100644 --- a/libethereum/Client.cpp +++ b/libethereum/Client.cpp @@ -355,6 +355,14 @@ bool Client::isSyncing() const return false; } +bool Client::isMajorSyncing() const +{ + // TODO: only return true if it is actually doing a proper chain sync. + if (auto h = m_host.lock()) + return h->isSyncing(); + return false; +} + void Client::startedWorking() { // Synchronise the state according to the head of the block chain. @@ -702,7 +710,7 @@ void Client::onChainChanged(ImportRoute const& _ir) // RESTART MINING - if (!isSyncing()) + if (!isMajorSyncing()) { bool preChanged = false; State newPreMine; @@ -765,7 +773,7 @@ void Client::startMining() void Client::rejigMining() { - if ((wouldMine() || remoteActive()) && !isSyncing() && (!isChainBad() || mineOnBadChain()) /*&& (forceMining() || transactionsWaiting())*/) + if ((wouldMine() || remoteActive()) && !isMajorSyncing() && (!isChainBad() || mineOnBadChain()) /*&& (forceMining() || transactionsWaiting())*/) { cnote << "Rejigging mining..."; DEV_WRITE_GUARDED(x_working) diff --git a/libethereum/Client.h b/libethereum/Client.h index c8aad1670..2b168f241 100644 --- a/libethereum/Client.h +++ b/libethereum/Client.h @@ -219,6 +219,7 @@ public: DownloadMan const* downloadMan() const; bool isSyncing() const; + bool isMajorSyncing() const; /// Sets the network id. void setNetworkId(u256 _n); /// Clears pending transactions. Just for debug use. From 43a6d825c3271364dc3d786f19a07dcee40e1e78 Mon Sep 17 00:00:00 2001 From: Gav Wood Date: Sun, 21 Jun 2015 19:28:30 +0200 Subject: [PATCH 152/169] Support rocksdb alternative. --- CMakeLists.txt | 13 +++++++- abi/CMakeLists.txt | 2 +- alethzero/NatspecHandler.h | 7 +---- cmake/EthDependencies.cmake | 6 ++++ cmake/FindRocksDB.cmake | 49 +++++++++++++++++++++++++++++ ethvm/CMakeLists.txt | 2 +- exp/CMakeLists.txt | 2 +- libdevcore/CMakeLists.txt | 2 ++ libdevcore/TrieDB.h | 15 +++------ libdevcore/db.h | 36 +++++++++++++++++++++ libdevcore/vector_ref.h | 8 ++--- libdevcrypto/CMakeLists.txt | 4 +-- libdevcrypto/OverlayDB.cpp | 3 +- libdevcrypto/OverlayDB.h | 7 +---- libethereum/BlockChain.cpp | 2 -- libethereum/BlockChain.h | 7 +---- libethereum/BlockDetails.h | 7 +---- libethereum/CMakeLists.txt | 3 +- libethereum/CanonBlockChain.h | 6 ---- libp2p/CMakeLists.txt | 2 +- libweb3jsonrpc/CMakeLists.txt | 3 +- libweb3jsonrpc/WebThreeStubServer.h | 12 +++---- libwebthree/CMakeLists.txt | 4 +-- libwhisper/CMakeLists.txt | 4 +-- neth/CMakeLists.txt | 4 +-- rlp/CMakeLists.txt | 3 +- 26 files changed, 136 insertions(+), 77 deletions(-) create mode 100644 cmake/FindRocksDB.cmake create mode 100644 libdevcore/db.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 904badcf2..1e580bbfc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ option(JSONRPC "Build with jsonprc. default on" ON) option(FATDB "Build with ability to list entries in the Trie. Doubles DB size, slows everything down, but good for looking at state diffs and trie contents." OFF) option(USENPM "Use npm to recompile ethereum.js if it was changed" OFF) option(PROFILING "Build in support for profiling" OFF) - +option(ROCKSDB "Use rocksdb rather than leveldb" OFF) set(BUNDLE "none" CACHE STRING "Predefined bundle of software to build (none, full, user, tests, minimal).") option(MINER "Build the CLI miner component" ON) @@ -196,6 +196,7 @@ eth_format_option(MINER) eth_format_option(USENPM) eth_format_option(PROFILING) eth_format_option(SOLIDITY) +eth_format_option(ROCKSDB) eth_format_option(GUI) eth_format_option(TESTS) eth_format_option(NOBOOST) @@ -311,6 +312,7 @@ message("-- PROFILING Profiling support ${PROFILIN message("-- FATDB Full database exploring ${FATDB}") message("-- JSONRPC JSON-RPC support ${JSONRPC}") message("-- USENPM Javascript source building ${USENPM}") +message("-- ROCKSDB Prefer rocksdb to leveldb ${ROCKSDB}") message("------------------------------------------------------------- components") message("-- MINER Build miner ${MINER}") message("-- ETHKEY Build wallet tools ${ETHKEY}") @@ -337,6 +339,15 @@ include(EthExecutableHelper) createBuildInfo() +if (ROCKSDB AND ROCKSDB_FOUND) + set(DB_INCLUDE_DIRS ${ROCKSDB_INCLUDE_DIRS}) + set(DB_LIBRARIES ${ROCKSDB_LIBRARIES}) + add_definitions(-DETH_ROCKSDB) +else() + set(DB_INCLUDE_DIRS ${LEVELDB_INCLUDE_DIRS}) + set(DB_LIBRARIES ${LEVELDB_LIBRARIES}) +endif() + if (EVMJIT) set(EVMJIT_CPP TRUE) # include CPP-JIT connector add_subdirectory(evmjit) diff --git a/abi/CMakeLists.txt b/abi/CMakeLists.txt index 3cc6b2594..96ca9b620 100644 --- a/abi/CMakeLists.txt +++ b/abi/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) set(EXECUTABLE abi) diff --git a/alethzero/NatspecHandler.h b/alethzero/NatspecHandler.h index 241df4e06..de0f1403b 100644 --- a/alethzero/NatspecHandler.h +++ b/alethzero/NatspecHandler.h @@ -22,16 +22,11 @@ #pragma once -#pragma warning(push) -#pragma warning(disable: 4100 4267) -#include -#pragma warning(pop) +#include #include #include #include "Context.h" -namespace ldb = leveldb; - class NatspecHandler: public NatSpecFace { public: diff --git a/cmake/EthDependencies.cmake b/cmake/EthDependencies.cmake index 9a18a98e7..86415f2dd 100644 --- a/cmake/EthDependencies.cmake +++ b/cmake/EthDependencies.cmake @@ -49,6 +49,12 @@ find_package (LevelDB REQUIRED) message(" - LevelDB header: ${LEVELDB_INCLUDE_DIRS}") message(" - LevelDB lib: ${LEVELDB_LIBRARIES}") +find_package (RocksDB) +if (ROCKSDB_FOUND) + message(" - RocksDB header: ${ROCKSDB_INCLUDE_DIRS}") + message(" - RocksDB lib: ${ROCKSDB_LIBRARIES}") +endif() + if (JSCONSOLE) find_package (v8 REQUIRED) message(" - v8 header: ${V8_INCLUDE_DIRS}") diff --git a/cmake/FindRocksDB.cmake b/cmake/FindRocksDB.cmake new file mode 100644 index 000000000..168930bc7 --- /dev/null +++ b/cmake/FindRocksDB.cmake @@ -0,0 +1,49 @@ +# Find rocksdb +# +# Find the rocksdb includes and library +# +# if you nee to add a custom library search path, do it via via CMAKE_PREFIX_PATH +# +# This module defines +# ROCKSDB_INCLUDE_DIRS, where to find header, etc. +# ROCKSDB_LIBRARIES, the libraries needed to use rocksdb. +# ROCKSDB_FOUND, If false, do not try to use rocksdb. + +# only look in default directories +find_path( + ROCKSDB_INCLUDE_DIR + NAMES rocksdb/db.h + DOC "rocksdb include dir" +) + +find_library( + ROCKSDB_LIBRARY + NAMES rocksdb + DOC "rocksdb library" +) + +set(ROCKSDB_INCLUDE_DIRS ${ROCKSDB_INCLUDE_DIR}) +set(ROCKSDB_LIBRARIES ${ROCKSDB_LIBRARY}) + +# debug library on windows +# same naming convention as in qt (appending debug library with d) +# boost is using the same "hack" as us with "optimized" and "debug" +if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") + + find_library( + ROCKSDB_LIBRARY_DEBUG + NAMES rocksdbd + DOC "rocksdb debug library" + ) + + set(ROCKSDB_LIBRARIES optimized ${ROCKSDB_LIBRARIES} debug ${ROCKSDB_LIBRARY_DEBUG}) + +endif() + +# handle the QUIETLY and REQUIRED arguments and set ROCKSDB_FOUND to TRUE +# if all listed variables are TRUE, hide their existence from configuration view +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(rocksdb DEFAULT_MSG + ROCKSDB_INCLUDE_DIR ROCKSDB_LIBRARY) +mark_as_advanced (ROCKSDB_INCLUDE_DIR ROCKSDB_LIBRARY) + diff --git a/ethvm/CMakeLists.txt b/ethvm/CMakeLists.txt index ed093061c..9b7e7f25d 100644 --- a/ethvm/CMakeLists.txt +++ b/ethvm/CMakeLists.txt @@ -4,7 +4,7 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) set(EXECUTABLE ethvm) diff --git a/exp/CMakeLists.txt b/exp/CMakeLists.txt index bfcd0e658..823425598 100644 --- a/exp/CMakeLists.txt +++ b/exp/CMakeLists.txt @@ -5,7 +5,7 @@ aux_source_directory(. SRC_LIST) include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) include_directories(BEFORE ..) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) set(EXECUTABLE exp) diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index 4a96d7ec5..7cd236cea 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -15,6 +15,7 @@ aux_source_directory(. SRC_LIST) include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) include_directories(BEFORE ..) include_directories(${Boost_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) set(EXECUTABLE devcore) @@ -26,6 +27,7 @@ target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${DB_LIBRARIES}) # transitive dependencies for windows executables if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") diff --git a/libdevcore/TrieDB.h b/libdevcore/TrieDB.h index f9d7bff5f..f35cf893c 100644 --- a/libdevcore/TrieDB.h +++ b/libdevcore/TrieDB.h @@ -21,19 +21,14 @@ #pragma once -#pragma warning(push) -#pragma warning(disable: 4100 4267) -#include -#pragma warning(pop) - #include -#include -#include -#include -#include +#include "db.h" +#include "Common.h" +#include "Log.h" +#include "Exceptions.h" +#include "SHA3.h" #include "MemoryDB.h" #include "TrieCommon.h" -namespace ldb = leveldb; namespace dev { diff --git a/libdevcore/db.h b/libdevcore/db.h new file mode 100644 index 000000000..4d000af78 --- /dev/null +++ b/libdevcore/db.h @@ -0,0 +1,36 @@ +/* + This file is part of cpp-ethereum. + + cpp-ethereum is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + cpp-ethereum is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with cpp-ethereum. If not, see . +*/ +/** @file DB.h + * @author Gav Wood + * @date 2014 + */ + +#pragma once + +#pragma warning(push) +#pragma warning(disable: 4100 4267) +#if ETH_ROCKSDB || !ETH_TRUE +#include +#include +namespace ldb = rocksdb; +#else +#include +#include +namespace ldb = leveldb; +#endif +#pragma warning(pop) +#define DEV_LDB 1 diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h index 98c6adb21..b05342f71 100644 --- a/libdevcore/vector_ref.h +++ b/libdevcore/vector_ref.h @@ -31,8 +31,8 @@ public: vector_ref(typename std::conditional::value, std::vector::type> const*, std::vector<_T>*>::type _data): m_data(_data->data()), m_count(_data->size()) {} /// Creates a new vector_ref pointing to the data part of a string (given as reference). vector_ref(typename std::conditional::value, std::string const&, std::string&>::type _data): m_data(reinterpret_cast<_T*>(_data.data())), m_count(_data.size() / sizeof(_T)) {} -#ifdef STORAGE_LEVELDB_INCLUDE_DB_H_ - vector_ref(leveldb::Slice const& _s): m_data(reinterpret_cast<_T*>(_s.data())), m_count(_s.size() / sizeof(_T)) {} +#if DEV_LDB + vector_ref(ldb::Slice const& _s): m_data(reinterpret_cast<_T*>(_s.data())), m_count(_s.size() / sizeof(_T)) {} #endif explicit operator bool() const { return m_data && m_count; } @@ -77,8 +77,8 @@ public: bool operator==(vector_ref<_T> const& _cmp) const { return m_data == _cmp.m_data && m_count == _cmp.m_count; } bool operator!=(vector_ref<_T> const& _cmp) const { return !operator==(_cmp); } -#ifdef STORAGE_LEVELDB_INCLUDE_DB_H_ - operator leveldb::Slice() const { return leveldb::Slice((char const*)m_data, m_count * sizeof(_T)); } +#if DEV_LDB + operator ldb::Slice() const { return ldb::Slice((char const*)m_data, m_count * sizeof(_T)); } #endif void reset() { m_data = nullptr; m_count = 0; } diff --git a/libdevcrypto/CMakeLists.txt b/libdevcrypto/CMakeLists.txt index 7df1149b0..d30aa7bc1 100644 --- a/libdevcrypto/CMakeLists.txt +++ b/libdevcrypto/CMakeLists.txt @@ -12,7 +12,7 @@ aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) include_directories(${Boost_INCLUDE_DIRS}) include_directories(${CRYPTOPP_INCLUDE_DIRS}) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) set(EXECUTABLE devcrypto) @@ -20,7 +20,7 @@ file(GLOB HEADERS "*.h") add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) target_link_libraries(${EXECUTABLE} ${Boost_FILESYSTEM_LIBRARIES}) -target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) +target_link_libraries(${EXECUTABLE} ${DB_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${CRYPTOPP_LIBRARIES}) target_link_libraries(${EXECUTABLE} scrypt) target_link_libraries(${EXECUTABLE} devcore) diff --git a/libdevcrypto/OverlayDB.cpp b/libdevcrypto/OverlayDB.cpp index a6aa684f2..730d71b4d 100644 --- a/libdevcrypto/OverlayDB.cpp +++ b/libdevcrypto/OverlayDB.cpp @@ -20,8 +20,7 @@ */ #include -#include -#include +#include #include #include "OverlayDB.h" using namespace std; diff --git a/libdevcrypto/OverlayDB.h b/libdevcrypto/OverlayDB.h index b37d2c11b..83618d8a3 100644 --- a/libdevcrypto/OverlayDB.h +++ b/libdevcrypto/OverlayDB.h @@ -21,16 +21,11 @@ #pragma once -#pragma warning(push) -#pragma warning(disable: 4100 4267) -#include -#pragma warning(pop) - #include +#include #include #include #include -namespace ldb = leveldb; namespace dev { diff --git a/libethereum/BlockChain.cpp b/libethereum/BlockChain.cpp index 392063adb..9b81fddcc 100644 --- a/libethereum/BlockChain.cpp +++ b/libethereum/BlockChain.cpp @@ -24,8 +24,6 @@ #if ETH_PROFILING_GPERF #include #endif -#include -#include #include #include #include diff --git a/libethereum/BlockChain.h b/libethereum/BlockChain.h index c7f0402df..fc56c46b6 100644 --- a/libethereum/BlockChain.h +++ b/libethereum/BlockChain.h @@ -21,15 +21,11 @@ #pragma once -#pragma warning(push) -#pragma warning(disable: 4100 4267) -#include -#pragma warning(pop) - #include #include #include #include +#include #include #include #include @@ -41,7 +37,6 @@ #include "Transaction.h" #include "BlockQueue.h" #include "VerifiedBlock.h" -namespace ldb = leveldb; namespace std { diff --git a/libethereum/BlockDetails.h b/libethereum/BlockDetails.h index 19e2c7c7a..f1526b5fd 100644 --- a/libethereum/BlockDetails.h +++ b/libethereum/BlockDetails.h @@ -22,15 +22,10 @@ #pragma once #include -#pragma warning(push) -#pragma warning(disable: 4100 4267) -#include -#pragma warning(pop) - +#include #include #include #include "TransactionReceipt.h" -namespace ldb = leveldb; namespace dev { diff --git a/libethereum/CMakeLists.txt b/libethereum/CMakeLists.txt index 6598e1bd7..e896c712b 100644 --- a/libethereum/CMakeLists.txt +++ b/libethereum/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) if (JSONRPC) include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) @@ -31,7 +31,6 @@ target_link_libraries(${EXECUTABLE} whisper) target_link_libraries(${EXECUTABLE} p2p) target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} ethcore) -target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${Boost_REGEX_LIBRARIES}) target_link_libraries(${EXECUTABLE} secp256k1) if (JSONRPC) diff --git a/libethereum/CanonBlockChain.h b/libethereum/CanonBlockChain.h index d4494c957..c16479f0d 100644 --- a/libethereum/CanonBlockChain.h +++ b/libethereum/CanonBlockChain.h @@ -21,11 +21,6 @@ #pragma once -#pragma warning(push) -#pragma warning(disable: 4100 4267) -#include -#pragma warning(pop) - #include #include #include @@ -35,7 +30,6 @@ #include "BlockDetails.h" #include "Account.h" #include "BlockChain.h" -namespace ldb = leveldb; namespace dev { diff --git a/libp2p/CMakeLists.txt b/libp2p/CMakeLists.txt index 24a3116b6..335517f11 100644 --- a/libp2p/CMakeLists.txt +++ b/libp2p/CMakeLists.txt @@ -14,7 +14,7 @@ aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) # we may not use it in libp2p, but one of our dependecies is including leveldb in header file # and windows is failing to build without that -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) if (MINIUPNPC_FOUND) diff --git a/libweb3jsonrpc/CMakeLists.txt b/libweb3jsonrpc/CMakeLists.txt index e265910fa..a28d51a06 100644 --- a/libweb3jsonrpc/CMakeLists.txt +++ b/libweb3jsonrpc/CMakeLists.txt @@ -13,7 +13,7 @@ include_directories(BEFORE ${JSONCPP_INCLUDE_DIRS}) include_directories(BEFORE ..) include_directories(${MHD_INCLUDE_DIRS}) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) set(EXECUTABLE web3jsonrpc) @@ -22,7 +22,6 @@ file(GLOB HEADERS "*.h") add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${JSONCPP_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${JSON_RPC_CPP_SERVER_LIBRARIES}) target_link_libraries(${EXECUTABLE} ${MHD_LIBRARIES}) diff --git a/libweb3jsonrpc/WebThreeStubServer.h b/libweb3jsonrpc/WebThreeStubServer.h index 290bf456c..4d545c90e 100644 --- a/libweb3jsonrpc/WebThreeStubServer.h +++ b/libweb3jsonrpc/WebThreeStubServer.h @@ -23,11 +23,7 @@ #pragma once -#pragma warning(push) -#pragma warning(disable: 4100 4267) -#include -#pragma warning(pop) - +#include #include "WebThreeStubServerBase.h" namespace dev @@ -99,9 +95,9 @@ private: dev::WebThreeDirect& m_web3; dev::eth::KeyManager& m_keyMan; dev::eth::TrivialGasPricer& m_gp; - leveldb::ReadOptions m_readOptions; - leveldb::WriteOptions m_writeOptions; - leveldb::DB* m_db; + ldb::ReadOptions m_readOptions; + ldb::WriteOptions m_writeOptions; + ldb::DB* m_db; std::function m_setMiningBenefactor; std::unordered_map m_sessions; diff --git a/libwebthree/CMakeLists.txt b/libwebthree/CMakeLists.txt index b72945cab..015c28f46 100644 --- a/libwebthree/CMakeLists.txt +++ b/libwebthree/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) set(EXECUTABLE webthree) @@ -21,8 +21,6 @@ file(GLOB HEADERS "*.h") add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) - target_link_libraries(${EXECUTABLE} ethereum) target_link_libraries(${EXECUTABLE} evm) target_link_libraries(${EXECUTABLE} lll) diff --git a/libwhisper/CMakeLists.txt b/libwhisper/CMakeLists.txt index 6ee935a90..8a1439c8b 100644 --- a/libwhisper/CMakeLists.txt +++ b/libwhisper/CMakeLists.txt @@ -12,7 +12,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB") aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) set(EXECUTABLE whisper) @@ -21,8 +21,6 @@ file(GLOB HEADERS "*.h") add_library(${EXECUTABLE} ${SRC_LIST} ${HEADERS}) -target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) - target_link_libraries(${EXECUTABLE} ethcore) target_link_libraries(${EXECUTABLE} devcrypto) target_link_libraries(${EXECUTABLE} devcore) diff --git a/neth/CMakeLists.txt b/neth/CMakeLists.txt index c500b83df..48b6408dc 100644 --- a/neth/CMakeLists.txt +++ b/neth/CMakeLists.txt @@ -4,7 +4,7 @@ aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) include_directories(${JSON_RPC_CPP_INCLUDE_DIRS}) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) include_directories(${Boost_INCLUDE_DIRS}) set(EXECUTABLE neth) @@ -13,8 +13,6 @@ add_executable(${EXECUTABLE} ${SRC_LIST}) add_dependencies(${EXECUTABLE} BuildInfo.h) -target_link_libraries(${EXECUTABLE} ${LEVELDB_LIBRARIES}) - if (JSONRPC) target_link_libraries(${EXECUTABLE} web3jsonrpc) endif() diff --git a/rlp/CMakeLists.txt b/rlp/CMakeLists.txt index 92d0c7978..9946cd4af 100644 --- a/rlp/CMakeLists.txt +++ b/rlp/CMakeLists.txt @@ -4,13 +4,14 @@ set(CMAKE_AUTOMOC OFF) aux_source_directory(. SRC_LIST) include_directories(BEFORE ..) -include_directories(${LEVELDB_INCLUDE_DIRS}) +include_directories(${DB_INCLUDE_DIRS}) set(EXECUTABLE rlp) add_executable(${EXECUTABLE} ${SRC_LIST}) target_link_libraries(${EXECUTABLE} devcrypto) +target_link_libraries(${EXECUTABLE} ${DB_LIBRARIES}) if (APPLE) install(TARGETS ${EXECUTABLE} DESTINATION bin) From 87690214d60c9ce852c0cfe0ec1211c8be5a9467 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 22 Jun 2015 07:17:07 +0200 Subject: [PATCH 153/169] update gas pricer test path --- test/libethereum/gaspricer.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/libethereum/gaspricer.cpp b/test/libethereum/gaspricer.cpp index 68a55ab42..105f4c2d7 100644 --- a/test/libethereum/gaspricer.cpp +++ b/test/libethereum/gaspricer.cpp @@ -90,51 +90,51 @@ BOOST_AUTO_TEST_CASE(basicGasPricerNoUpdate) BOOST_AUTO_TEST_CASE(basicGasPricer_RPC_API_Test) { - dev::test::executeGasPricerTest("RPC_API_Test", 30.679, 15.0, "/BlockTests/bcRPC_API_Test.json", TransactionPriority::Medium, 155632494086, 1); + dev::test::executeGasPricerTest("RPC_API_Test", 30.679, 15.0, "/BlockchainTests/bcRPC_API_Test.json", TransactionPriority::Medium, 155632494086, 1); } BOOST_AUTO_TEST_CASE(basicGasPricer_bcValidBlockTest) { - dev::test::executeGasPricerTest("SimpleTx", 30.679, 15.0, "/BlockTests/bcValidBlockTest.json", TransactionPriority::Medium, 155632494086, 10); + dev::test::executeGasPricerTest("SimpleTx", 30.679, 15.0, "/BlockchainTests/bcValidBlockTest.json", TransactionPriority::Medium, 155632494086, 10); } BOOST_AUTO_TEST_CASE(basicGasPricer_bcUncleTest) { - dev::test::executeGasPricerTest("twoUncle", 30.679, 15.0, "/BlockTests/bcUncleTest.json", TransactionPriority::Medium, 155632494086, 1); + dev::test::executeGasPricerTest("twoUncle", 30.679, 15.0, "/BlockchainTests/bcUncleTest.json", TransactionPriority::Medium, 155632494086, 1); } BOOST_AUTO_TEST_CASE(basicGasPricer_bcUncleHeaderValiditiy) { - dev::test::executeGasPricerTest("correct", 30.679, 15.0, "/BlockTests/bcUncleHeaderValiditiy.json", TransactionPriority::Medium, 155632494086, 1); + dev::test::executeGasPricerTest("correct", 30.679, 15.0, "/BlockchainTests/bcUncleHeaderValiditiy.json", TransactionPriority::Medium, 155632494086, 1); } BOOST_AUTO_TEST_CASE(basicGasPricer_notxs) { - dev::test::executeGasPricerTest("notxs", 30.679, 15.0, "/BlockTests/bcGasPricerTest.json", TransactionPriority::Medium, 155632494086, 155632494086); + dev::test::executeGasPricerTest("notxs", 30.679, 15.0, "/BlockchainTests/bcGasPricerTest.json", TransactionPriority::Medium, 155632494086, 155632494086); } BOOST_AUTO_TEST_CASE(basicGasPricer_highGasUsage_LowestPrio) { - dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockTests/bcGasPricerTest.json", TransactionPriority::Lowest, 15731282021, 10000000000000); + dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockchainTests/bcGasPricerTest.json", TransactionPriority::Lowest, 15731282021, 10000000000000); } BOOST_AUTO_TEST_CASE(basicGasPricer_highGasUsage_LowPrio) { - dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockTests/bcGasPricerTest.json", TransactionPriority::Low, 15731282021, 15734152261884); + dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockchainTests/bcGasPricerTest.json", TransactionPriority::Low, 15731282021, 15734152261884); } BOOST_AUTO_TEST_CASE(basicGasPricer_highGasUsage_MediumPrio) { - dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockTests/bcGasPricerTest.json", TransactionPriority::Medium, 15731282021, 20000000000000); + dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockchainTests/bcGasPricerTest.json", TransactionPriority::Medium, 15731282021, 20000000000000); } BOOST_AUTO_TEST_CASE(basicGasPricer_highGasUsage_HighPrio) { - dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockTests/bcGasPricerTest.json", TransactionPriority::High, 15731282021, 24265847738115); + dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockchainTests/bcGasPricerTest.json", TransactionPriority::High, 15731282021, 24265847738115); } BOOST_AUTO_TEST_CASE(basicGasPricer_highGasUsage_HighestPrio) { - dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockTests/bcGasPricerTest.json", TransactionPriority::Highest, 15731282021, 30000000000000); + dev::test::executeGasPricerTest("highGasUsage", 30.679, 15.0, "/BlockchainTests/bcGasPricerTest.json", TransactionPriority::Highest, 15731282021, 30000000000000); } BOOST_AUTO_TEST_SUITE_END() From 58c17301053b44e65f600bcb368d6e394b633b19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Mon, 22 Jun 2015 11:01:13 +0200 Subject: [PATCH 154/169] Add support for clang sanitizer to cmake scripts. To build with the sanitizer support use clang compiler and set CMAKE_BUILD_TYPE to "DebugSan". More info: http://clang.llvm.org/docs/AddressSanitizer.html. --- cmake/EthCompilerSettings.cmake | 1 + evmjit/CMakeLists.txt | 2 +- sanitizer-blacklist.txt | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 sanitizer-blacklist.txt diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake index 85574d5f0..6701cf824 100644 --- a/cmake/EthCompilerSettings.cmake +++ b/cmake/EthCompilerSettings.cmake @@ -19,6 +19,7 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wno-unknown-pragmas -Wextra -DSHAREDLIB -fPIC") set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -DETH_DEBUG") + set(CMAKE_CXX_FLAGS_DEBUGSAN "-O1 -g -fsanitize=address,integer,undefined -fsanitize-blacklist=${CMAKE_SOURCE_DIR}/sanitizer-blacklist.txt -fno-omit-frame-pointer -DETH_DEBUG") set(CMAKE_CXX_FLAGS_MINSIZEREL "-Os -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -DETH_RELEASE") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g -DETH_RELEASE") diff --git a/evmjit/CMakeLists.txt b/evmjit/CMakeLists.txt index 280fec212..d9a01255c 100644 --- a/evmjit/CMakeLists.txt +++ b/evmjit/CMakeLists.txt @@ -10,7 +10,7 @@ else() set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Wconversion -Wno-sign-conversion -Wno-unknown-pragmas ${CMAKE_CXX_FLAGS}") endif() -if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux") +if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND NOT ${CMAKE_BUILD_TYPE} STREQUAL "DebugSan") # Do not allow unresovled symbols in shared library (default on linux) set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") endif() diff --git a/sanitizer-blacklist.txt b/sanitizer-blacklist.txt new file mode 100644 index 000000000..0faf73cf4 --- /dev/null +++ b/sanitizer-blacklist.txt @@ -0,0 +1,8 @@ +# Ignore standard library headers. +src:*/include/c\+\+/* + +# Ignore boost libraries headers. +src:*/include/boost/* + +# Ignore Crypto++ library. We plan to remove it in the future. It exploits interger overflow and uses memcpy incorrectly. +src:*/include/cryptopp/* From 42a3432947670f27dcf1ab61452b10094735ea49 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 22 Jun 2015 11:27:56 +0200 Subject: [PATCH 155/169] ui changes --- mix/qml/Block.qml | 35 ++++++++++++++++++++++++++++++----- mix/qml/BlockChain.qml | 14 +++++++------- mix/qml/MainContent.qml | 10 ++++++---- 3 files changed, 43 insertions(+), 16 deletions(-) diff --git a/mix/qml/Block.qml b/mix/qml/Block.qml index 796518f11..31d3e924c 100644 --- a/mix/qml/Block.qml +++ b/mix/qml/Block.qml @@ -28,12 +28,12 @@ ColumnLayout if (transactions) { if (index >= 0) - return 30 + 30 * transactions.count + openedTr + return trHeight + trHeight * transactions.count + openedTr else - return 30 + return trHeight } else - return 30 + return trHeight } onOpenedTrChanged: @@ -46,6 +46,19 @@ ColumnLayout id: dbgStyle } + Rectangle + { + id: top + Layout.preferredWidth: blockWidth + height: 10 + anchors.bottom: rowHeader.top + color: "#DEDCDC" + radius: 15 + anchors.left: parent.left + anchors.leftMargin: statusWidth + anchors.bottomMargin: -5 + } + RowLayout { Layout.preferredHeight: trHeight @@ -201,12 +214,11 @@ ColumnLayout { anchors.top: parent.top width: parent.width - spacing: 7 + spacing: 20 RowLayout { anchors.top: parent.top Layout.fillWidth: true - //spacing: cellSpacing Rectangle { Layout.preferredWidth: fromWidth @@ -390,5 +402,18 @@ ColumnLayout } } } + + Rectangle + { + id: right + Layout.preferredWidth: blockWidth + height: 10 + anchors.top: parent.bottom + anchors.topMargin: 5 + color: "#DEDCDC" + radius: 15 + anchors.left: parent.left + anchors.leftMargin: statusWidth + } } diff --git a/mix/qml/BlockChain.qml b/mix/qml/BlockChain.qml index ed1c4a4ad..02ff72be2 100644 --- a/mix/qml/BlockChain.qml +++ b/mix/qml/BlockChain.qml @@ -37,17 +37,17 @@ ColumnLayout { onWidthChanged: { - - if (width <= 630 || previousWidth <= 630) + var minWidth = scenarioMinWidth - 20 // margin + if (width <= minWidth || previousWidth <= minWidth) { - fromWidth = 150 + fromWidth = 100 toWidth = 100 valueWidth = 200 } else { var diff = (width - previousWidth) / 3; - fromWidth = fromWidth + diff < 150 ? 150 : fromWidth + diff + fromWidth = fromWidth + diff < 100 ? 100 : fromWidth + diff toWidth = toWidth + diff < 100 ? 100 : toWidth + diff valueWidth = valueWidth + diff < 200 ? 200 : valueWidth + diff } @@ -97,7 +97,7 @@ ColumnLayout { } Rectangle { - Layout.preferredWidth: fromWidth + cellSpacing + Layout.preferredWidth: fromWidth Label { anchors.verticalCenter: parent.verticalCenter @@ -139,12 +139,12 @@ ColumnLayout { { id: blockChainScrollView anchors.fill: parent - anchors.topMargin: 10 + anchors.topMargin: 8 ColumnLayout { id: blockChainLayout width: parent.width - spacing: 10 + spacing: 20 Block { diff --git a/mix/qml/MainContent.qml b/mix/qml/MainContent.qml index de19baf35..7f180a899 100644 --- a/mix/qml/MainContent.qml +++ b/mix/qml/MainContent.qml @@ -31,6 +31,7 @@ Rectangle { property alias codeEditor: codeEditor property bool webViewHorizontal: codeWebSplitter.orientation === Qt.Vertical //vertical splitter positions elements vertically, splits screen horizontally property bool firstCompile: true + property int scenarioMinWidth: 590 Connections { target: codeModel @@ -110,6 +111,7 @@ Rectangle { property alias webHeight: webPreview.height property alias showProjectView: projectList.visible property bool runOnProjectLoad: true + property int scenarioMinWidth: scenarioMinWidth } ColumnLayout @@ -205,7 +207,7 @@ Rectangle { visible: false; Layout.fillHeight: true Keys.onEscapePressed: visible = false - Layout.minimumWidth: 650 + Layout.minimumWidth: scenarioMinWidth anchors.right: parent.right } @@ -215,7 +217,7 @@ Rectangle { visible: false Layout.fillHeight: true Keys.onEscapePressed: visible = false - Layout.minimumWidth: 650 + Layout.minimumWidth: scenarioMinWidth anchors.right: parent.right } @@ -224,10 +226,9 @@ Rectangle { onDebugDataReady: { scenarioExe.visible = false debugPanel.visible = true + debugPanel.width = scenarioExe.width if (scenarioExe.bc.debugTrRequested) - { debugPanel.setTr(scenarioExe.bc.model.blocks[scenarioExe.bc.debugTrRequested[0]].transactions[scenarioExe.bc.debugTrRequested[1]]) - } } } @@ -236,6 +237,7 @@ Rectangle { onPanelClosed: { debugPanel.visible = false scenarioExe.visible = true + scenarioExe.width = debugPanel.width } } } From 893d6fe788810980bc74033cbb2454239d60fb3d Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 22 Jun 2015 11:35:01 +0200 Subject: [PATCH 156/169] clean code --- mix/qml/StateListModel.qml | 1 - mix/qml/WebPreview.qml | 5 ----- 2 files changed, 6 deletions(-) diff --git a/mix/qml/StateListModel.qml b/mix/qml/StateListModel.qml index 26817441c..992113cc6 100644 --- a/mix/qml/StateListModel.qml +++ b/mix/qml/StateListModel.qml @@ -256,7 +256,6 @@ Item { if (!_secret) _secret = clientModel.newSecret(); var address = clientModel.address(_secret); - console.log(address); var name = qsTr("Account") + "-" + address.substring(0, 4); return { name: name, secret: _secret, balance: QEtherHelper.createEther(_balance, _unit), address: address }; } diff --git a/mix/qml/WebPreview.qml b/mix/qml/WebPreview.qml index c45f2cab4..5d0f208af 100644 --- a/mix/qml/WebPreview.qml +++ b/mix/qml/WebPreview.qml @@ -89,11 +89,6 @@ Item { } } - /*Connections { - target: clientModel - onRunComplete: reload(); - }*/ - Connections { target: codeModel onContractInterfaceChanged: reload(); From b6782665d76508019e8894991ceaf82c674f013e Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 22 Jun 2015 16:04:57 +0200 Subject: [PATCH 157/169] use boost throw exceptions --- libdevcore/RLP.h | 2 +- libethcore/KeyManager.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libdevcore/RLP.h b/libdevcore/RLP.h index 6e46807ab..6ae9c165b 100644 --- a/libdevcore/RLP.h +++ b/libdevcore/RLP.h @@ -292,7 +292,7 @@ public: RLPs toList() const; /// @returns the data payload. Valid for all types. - bytesConstRef payload() const { auto l = length(); if (l > m_data.size()) throw BadRLP(); return m_data.cropped(payloadOffset(), l); } + bytesConstRef payload() const { auto l = length(); if (l > m_data.size()) BOOST_THROW_EXCEPTION(BadRLP()); return m_data.cropped(payloadOffset(), l); } /// @returns the theoretical size of this item. /// @note Under normal circumstances, is equivalent to m_data.size() - use that unless you know it won't work. diff --git a/libethcore/KeyManager.h b/libethcore/KeyManager.h index a2b5a4e07..0e54f3f42 100644 --- a/libethcore/KeyManager.h +++ b/libethcore/KeyManager.h @@ -46,7 +46,7 @@ struct KeyInfo static h256 const UnknownPassword; /// Password query function that never returns a password. -static auto const DontKnowThrow = [](){ throw PasswordUnknown(); return std::string(); }; +static auto const DontKnowThrow = [](){ BOOST_THROW_EXCEPTION(PasswordUnknown()); return std::string(); }; enum class SemanticPassword { From 76379dcb80f9760671d3d5f2590eefdcd6067c81 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 22 Jun 2015 16:34:37 +0200 Subject: [PATCH 158/169] add BOOST_THROW_EXCEPTION --- libethereum/State.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libethereum/State.cpp b/libethereum/State.cpp index f56c12c91..37978bedb 100644 --- a/libethereum/State.cpp +++ b/libethereum/State.cpp @@ -456,7 +456,7 @@ unordered_map State::addresses() const ret[i.first] = RLP(i.second)[1].toInt(); return ret; #else - throw InterfaceNotSupported("State::addresses()"); + BOOST_THROW_EXCEPTION(InterfaceNotSupported("State::addresses()")); #endif } From beb352549c19ecad09626b4ce8a1064e0a7cf1b0 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 22 Jun 2015 16:53:19 +0200 Subject: [PATCH 159/169] even more --- ethminer/MinerAux.h | 20 ++++++++++---------- libethcore/BlockInfo.cpp | 4 ++-- libethcore/ICAP.cpp | 16 ++++++++-------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index a609754dd..a4a671ddb 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -107,7 +107,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--opencl-platform" && i + 1 < argc) try { @@ -116,7 +116,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--opencl-device" && i + 1 < argc) try { @@ -126,7 +126,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--list-devices") m_shouldListDevices = true; @@ -144,7 +144,7 @@ public: else { cerr << "Bad " << arg << " option: " << m << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } } else if (arg == "--benchmark-warmup" && i + 1 < argc) @@ -154,7 +154,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--benchmark-trial" && i + 1 < argc) try { @@ -163,7 +163,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION( BadArgument()); } else if (arg == "--benchmark-trials" && i + 1 < argc) try { @@ -172,7 +172,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION( BadArgument()); } else if (arg == "-C" || arg == "--cpu") m_minerType = MinerType::CPU; @@ -195,7 +195,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << m << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION( BadArgument()); } } else if ((arg == "-w" || arg == "--check-pow") && i + 4 < argc) @@ -232,7 +232,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << m << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION( BadArgument()); } } else if (arg == "-M" || arg == "--benchmark") @@ -245,7 +245,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - throw BadArgument(); + BOOST_THROW_EXCEPTION( BadArgument()); } } else diff --git a/libethcore/BlockInfo.cpp b/libethcore/BlockInfo.cpp index 69da52b09..fec5b4678 100644 --- a/libethcore/BlockInfo.cpp +++ b/libethcore/BlockInfo.cpp @@ -122,7 +122,7 @@ void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s, h256 const try { if (_header.itemCount() != 15) - throw InvalidBlockHeaderItemCount(); + BOOST_THROW_EXCEPTION(InvalidBlockHeaderItemCount()); parentHash = _header[field = 0].toHash(RLP::VeryStrict); sha3Uncles = _header[field = 1].toHash(RLP::VeryStrict); coinbaseAddress = _header[field = 2].toHash
(RLP::VeryStrict); @@ -146,7 +146,7 @@ void BlockInfo::populateFromHeader(RLP const& _header, Strictness _s, h256 const } if (number > ~(unsigned)0) - throw InvalidNumber(); + BOOST_THROW_EXCEPTION(InvalidNumber()); // check it hashes according to proof of work or that it's the genesis block. if (_s == CheckEverything && parentHash && !ProofOfWork::verify(*this)) diff --git a/libethcore/ICAP.cpp b/libethcore/ICAP.cpp index 158c297f8..12e8aed56 100644 --- a/libethcore/ICAP.cpp +++ b/libethcore/ICAP.cpp @@ -71,7 +71,7 @@ ICAP ICAP::decoded(std::string const& _encoded) std::string data; std::tie(country, data) = fromIBAN(_encoded); if (country != "XE") - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); if (data.size() == 30) { ret.m_type = Direct; @@ -88,10 +88,10 @@ ICAP ICAP::decoded(std::string const& _encoded) ret.m_client = data.substr(7); } else - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); } else - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); return ret; } @@ -101,7 +101,7 @@ std::string ICAP::encoded() const if (m_type == Direct) { if (!!m_direct[0]) - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); std::string d = toBase36(m_direct); while (d.size() < 30) d = "0" + d; @@ -118,11 +118,11 @@ std::string ICAP::encoded() const m_institution.size() != 4 || m_client.size() != 9 ) - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); return iban("XE", m_asset + m_institution + m_client); } else - throw InvalidICAP(); + BOOST_THROW_EXCEPTION(InvalidICAP()); } pair ICAP::lookup(std::function const& _call, Address const& _reg) const @@ -149,9 +149,9 @@ pair ICAP::lookup(std::function const& _c else if (m_institution[0] != 'X') return make_pair(resolve(m_institution + "/" + m_client), bytes()); else - throw InterfaceNotSupported("ICAP::lookup(), bad institution"); + BOOST_THROW_EXCEPTION(InterfaceNotSupported("ICAP::lookup(), bad institution")); } - throw InterfaceNotSupported("ICAP::lookup(), bad asset"); + BOOST_THROW_EXCEPTION(InterfaceNotSupported("ICAP::lookup(), bad asset")); } } From 867fe4033df6b2165136b7fdca93245e77f78903 Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Thu, 18 Jun 2015 20:13:49 +0400 Subject: [PATCH 160/169] fuzzTests: debug support --- test/fuzzTesting/createRandomTest.cpp | 107 ++++++++++++++++---------- test/libevm/vm.cpp | 6 +- 2 files changed, 69 insertions(+), 44 deletions(-) diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index e21f22eea..6a3a7f4a0 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -36,8 +36,8 @@ extern std::string const c_testExampleVMTest; extern std::string const c_testExampleBlockchainTest; //Main Test functinos -void fillRandomTest(std::function doTests, std::string const& testString); -int checkRandomTest(std::function doTests, json_spirit::mValue& value); +void fillRandomTest(std::function _doTests, std::string const& _testString, bool _debug = false); +int checkRandomTest(std::function _doTests, json_spirit::mValue& _value, bool _debug = false); //Helper Functions std::vector getTypes(); @@ -48,6 +48,8 @@ int main(int argc, char *argv[]) std::string testSuite; json_spirit::mValue testmValue; bool checktest = false; + bool filldebug = false; + bool debug = false; for (auto i = 0; i < argc; ++i) { auto arg = std::string{argv[i]}; @@ -75,6 +77,12 @@ int main(int argc, char *argv[]) read_string(s, testmValue); checktest = true; } + else + if (arg == "--debug") + debug = true; + else + if (arg == "--filldebug") + filldebug = true; } if (testSuite == "") @@ -83,45 +91,50 @@ int main(int argc, char *argv[]) return 1; } else - if (testSuite == "BlockChainTests") { if (checktest) - return checkRandomTest(dev::test::doBlockchainTests, testmValue); - else - fillRandomTest(dev::test::doBlockchainTests, c_testExampleBlockchainTest); - } - else - if (testSuite == "TransactionTests") - { - if (checktest) - return checkRandomTest(dev::test::doTransactionTests, testmValue); + std::cout << "Testing: " << testSuite.substr(0, testSuite.length() - 1) << std::endl; + + if (testSuite == "BlockChainTests") + { + if (checktest) + return checkRandomTest(dev::test::doBlockchainTests, testmValue, debug); + else + fillRandomTest(dev::test::doBlockchainTests, c_testExampleBlockchainTest, filldebug); + } else - fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest); - } - else - if (testSuite == "StateTests") - { - if (checktest) - return checkRandomTest(dev::test::doStateTests, testmValue); + if (testSuite == "TransactionTests") + { + if (checktest) + return checkRandomTest(dev::test::doTransactionTests, testmValue, debug); + else + fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest, filldebug); + } else - fillRandomTest(dev::test::doStateTests, c_testExampleStateTest); - } - else - if (testSuite == "VMTests") - { - if (checktest) + if (testSuite == "StateTests") { - dev::eth::VMFactory::setKind(dev::eth::VMKind::JIT); - return checkRandomTest(dev::test::doVMTests, testmValue); + if (checktest) + return checkRandomTest(dev::test::doStateTests, testmValue, debug); + else + fillRandomTest(dev::test::doStateTests, c_testExampleStateTest, filldebug); } else - fillRandomTest(dev::test::doVMTests, c_testExampleVMTest); + if (testSuite == "VMTests") + { + if (checktest) + { + dev::eth::VMFactory::setKind(dev::eth::VMKind::JIT); + return checkRandomTest(dev::test::doVMTests, testmValue, debug); + } + else + fillRandomTest(dev::test::doVMTests, c_testExampleVMTest, filldebug); + } } return 0; } -int checkRandomTest(std::function doTests, json_spirit::mValue& value) +int checkRandomTest(std::function _doTests, json_spirit::mValue& _value, bool _debug) { bool ret = 0; try @@ -129,14 +142,20 @@ int checkRandomTest(std::function doTests, jso //redirect all output to the stream std::ostringstream strCout; std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); - std::cout.rdbuf( strCout.rdbuf() ); - std::cerr.rdbuf( strCout.rdbuf() ); + if (!_debug) + { + std::cout.rdbuf( strCout.rdbuf() ); + std::cerr.rdbuf( strCout.rdbuf() ); + } - doTests(value, false); + _doTests(_value, false); //restroe output - std::cout.rdbuf(oldCoutStreamBuf); - std::cerr.rdbuf(oldCoutStreamBuf); + if (!_debug) + { + std::cout.rdbuf(oldCoutStreamBuf); + std::cerr.rdbuf(oldCoutStreamBuf); + } } catch (dev::Exception const& _e) { @@ -151,21 +170,24 @@ int checkRandomTest(std::function doTests, jso return ret; } -void fillRandomTest(std::function doTests, std::string const& testString) +void fillRandomTest(std::function _doTests, std::string const& _testString, bool _debug) { //redirect all output to the stream std::ostringstream strCout; std::streambuf* oldCoutStreamBuf = std::cout.rdbuf(); - std::cout.rdbuf( strCout.rdbuf() ); - std::cerr.rdbuf( strCout.rdbuf() ); + if (!_debug) + { + std::cout.rdbuf( strCout.rdbuf() ); + std::cerr.rdbuf( strCout.rdbuf() ); + } json_spirit::mValue v; try { - std::string newTest = testString; + std::string newTest = _testString; parseTestWithTypes(newTest); json_spirit::read_string(newTest, v); - doTests(v, true); + _doTests(v, true); } catch(...) { @@ -173,8 +195,11 @@ void fillRandomTest(std::function doTests, std } //restroe output - std::cout.rdbuf(oldCoutStreamBuf); - std::cerr.rdbuf(oldCoutStreamBuf); + if (!_debug) + { + std::cout.rdbuf(oldCoutStreamBuf); + std::cerr.rdbuf(oldCoutStreamBuf); + } std::cout << json_spirit::write_string(v, true); } diff --git a/test/libevm/vm.cpp b/test/libevm/vm.cpp index 25ed8113b..fdfb180fb 100644 --- a/test/libevm/vm.cpp +++ b/test/libevm/vm.cpp @@ -395,9 +395,9 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) { std::string warning = "Check State: Error! Unexpected output: " + o["out"].get_str() + " Expected: " + o["expectOut"].get_str(); if (Options::get().checkState) - BOOST_CHECK_MESSAGE((o["out"].get_str() == o["expectOut"].get_str()), warning); + {TBOOST_CHECK_MESSAGE((o["out"].get_str() == o["expectOut"].get_str()), warning);} else - BOOST_WARN_MESSAGE((o["out"].get_str() == o["expectOut"].get_str()), warning); + TBOOST_WARN_MESSAGE((o["out"].get_str() == o["expectOut"].get_str()), warning); o.erase(o.find("expectOut")); } @@ -440,7 +440,7 @@ void doVMTests(json_spirit::mValue& v, bool _fillin) checkLog(fev.sub.logs, test.sub.logs); } else // Exception expected - BOOST_CHECK(vmExceptionOccured); + TBOOST_CHECK(vmExceptionOccured); } } } From 8b8c385b01a27f200cadc7501145f051720b50f4 Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Fri, 19 Jun 2015 21:52:38 +0400 Subject: [PATCH 161/169] FuzzTests: Boost exception --- test/TestHelper.cpp | 55 ++++++++++++++++---------------- test/TestHelper.h | 4 +-- test/libethereum/transaction.cpp | 4 +-- 3 files changed, 32 insertions(+), 31 deletions(-) diff --git a/test/TestHelper.cpp b/test/TestHelper.cpp index 6c1db8eea..698f35122 100644 --- a/test/TestHelper.cpp +++ b/test/TestHelper.cpp @@ -178,7 +178,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state, stateOptio { stateOptions.m_bHasBalance = true; if (bigint(o["balance"].get_str()) >= c_max256plus1) - TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'balance' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'balance' is equal or greater than 2**256") ); balance = toInt(o["balance"]); } @@ -186,7 +186,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state, stateOptio { stateOptions.m_bHasNonce = true; if (bigint(o["nonce"].get_str()) >= c_max256plus1) - TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'nonce' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("State 'nonce' is equal or greater than 2**256") ); nonce = toInt(o["nonce"]); } @@ -230,7 +230,7 @@ void ImportTest::importState(json_spirit::mObject& _o, State& _state) { //check that every parameter was declared in state object if (!stateOptionMap.second.isAllSet()) - TBOOST_THROW_EXCEPTION(MissingFields() << errinfo_comment("Import State: Missing state fields!")); + BOOST_THROW_EXCEPTION(MissingFields() << errinfo_comment("Import State: Missing state fields!")); } } @@ -246,13 +246,13 @@ void ImportTest::importTransaction(json_spirit::mObject& _o) assert(_o.count("data") > 0); if (bigint(_o["nonce"].get_str()) >= c_max256plus1) - TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'nonce' is equal or greater than 2**256") ); if (bigint(_o["gasPrice"].get_str()) >= c_max256plus1) - TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasPrice' is equal or greater than 2**256") ); if (bigint(_o["gasLimit"].get_str()) >= c_max256plus1) - TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'gasLimit' is equal or greater than 2**256") ); if (bigint(_o["value"].get_str()) >= c_max256plus1) - TBOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") ); + BOOST_THROW_EXCEPTION(ValueTooLarge() << errinfo_comment("Transaction 'value' is equal or greater than 2**256") ); m_transaction = _o["to"].get_str().empty() ? Transaction(toInt(_o["value"]), toInt(_o["gasPrice"]), toInt(_o["gasLimit"]), importData(_o), toInt(_o["nonce"]), Secret(_o["secretKey"].get_str())) : @@ -349,9 +349,9 @@ void ImportTest::exportTest(bytes const& _output, State const& _statePost) { std::string warning = "Check State: Error! Unexpected output: " + m_TestObject["out"].get_str() + " Expected: " + m_TestObject["expectOut"].get_str(); if (Options::get().checkState) - BOOST_CHECK_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning); + {TBOOST_CHECK_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning);} else - BOOST_WARN_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning); + TBOOST_WARN_MESSAGE((m_TestObject["out"].get_str() == m_TestObject["expectOut"].get_str()), warning); m_TestObject.erase(m_TestObject.find("expectOut")); } @@ -533,24 +533,25 @@ void checkOutput(bytes const& _output, json_spirit::mObject& _o) void checkStorage(map _expectedStore, map _resultStore, Address _expectedAddr) { + _expectedAddr = _expectedAddr; //unsed parametr when macro for (auto&& expectedStorePair : _expectedStore) { auto& expectedStoreKey = expectedStorePair.first; auto resultStoreIt = _resultStore.find(expectedStoreKey); if (resultStoreIt == _resultStore.end()) - BOOST_ERROR(_expectedAddr << ": missing store key " << expectedStoreKey); + {TBOOST_ERROR(_expectedAddr << ": missing store key " << expectedStoreKey);} else { auto& expectedStoreValue = expectedStorePair.second; auto& resultStoreValue = resultStoreIt->second; - BOOST_CHECK_MESSAGE(expectedStoreValue == resultStoreValue, _expectedAddr << ": store[" << expectedStoreKey << "] = " << resultStoreValue << ", expected " << expectedStoreValue); + TBOOST_CHECK_MESSAGE((expectedStoreValue == resultStoreValue), _expectedAddr << ": store[" << expectedStoreKey << "] = " << resultStoreValue << ", expected " << expectedStoreValue); } } - BOOST_CHECK_EQUAL(_resultStore.size(), _expectedStore.size()); + TBOOST_CHECK_EQUAL(_resultStore.size(), _expectedStore.size()); for (auto&& resultStorePair: _resultStore) { if (!_expectedStore.count(resultStorePair.first)) - BOOST_ERROR(_expectedAddr << ": unexpected store key " << resultStorePair.first); + TBOOST_ERROR(_expectedAddr << ": unexpected store key " << resultStorePair.first); } } @@ -568,14 +569,14 @@ void checkLog(LogEntries _resultLogs, LogEntries _expectedLogs) void checkCallCreates(eth::Transactions _resultCallCreates, eth::Transactions _expectedCallCreates) { - BOOST_REQUIRE_EQUAL(_resultCallCreates.size(), _expectedCallCreates.size()); + TBOOST_REQUIRE_EQUAL(_resultCallCreates.size(), _expectedCallCreates.size()); for (size_t i = 0; i < _resultCallCreates.size(); ++i) { - BOOST_CHECK(_resultCallCreates[i].data() == _expectedCallCreates[i].data()); - BOOST_CHECK(_resultCallCreates[i].receiveAddress() == _expectedCallCreates[i].receiveAddress()); - BOOST_CHECK(_resultCallCreates[i].gas() == _expectedCallCreates[i].gas()); - BOOST_CHECK(_resultCallCreates[i].value() == _expectedCallCreates[i].value()); + TBOOST_CHECK((_resultCallCreates[i].data() == _expectedCallCreates[i].data())); + TBOOST_CHECK((_resultCallCreates[i].receiveAddress() == _expectedCallCreates[i].receiveAddress())); + TBOOST_CHECK((_resultCallCreates[i].gas() == _expectedCallCreates[i].gas())); + TBOOST_CHECK((_resultCallCreates[i].value() == _expectedCallCreates[i].value())); } } @@ -598,7 +599,7 @@ void userDefinedTest(std::function doTests) cnote << "Testing user defined test: " << filename; json_spirit::mValue v; string s = contentsString(filename); - BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + filename + " is empty. "); + TBOOST_REQUIRE_MESSAGE((s.length() > 0), "Contents of " + filename + " is empty. "); json_spirit::read_string(s, v); json_spirit::mObject oSingleTest; @@ -616,11 +617,11 @@ void userDefinedTest(std::function doTests) } catch (Exception const& _e) { - BOOST_ERROR("Failed Test with Exception: " << diagnostic_information(_e)); + TBOOST_ERROR("Failed Test with Exception: " << diagnostic_information(_e)); } catch (std::exception const& _e) { - BOOST_ERROR("Failed Test with Exception: " << _e.what()); + TBOOST_ERROR("Failed Test with Exception: " << _e.what()); } } @@ -640,18 +641,18 @@ void executeTests(const string& _name, const string& _testPathAppendix, const bo json_spirit::mValue v; boost::filesystem::path p(__FILE__); string s = asString(dev::contents(_pathToFiller.string() + "/" + _name + "Filler.json")); - BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + _pathToFiller.string() + "/" + _name + "Filler.json is empty."); + TBOOST_REQUIRE_MESSAGE((s.length() > 0), "Contents of " + _pathToFiller.string() + "/" + _name + "Filler.json is empty."); json_spirit::read_string(s, v); doTests(v, true); writeFile(testPath + "/" + _name + ".json", asBytes(json_spirit::write_string(v, true))); } catch (Exception const& _e) { - BOOST_ERROR("Failed filling test with Exception: " << diagnostic_information(_e)); + TBOOST_ERROR("Failed filling test with Exception: " << diagnostic_information(_e)); } catch (std::exception const& _e) { - BOOST_ERROR("Failed filling test with Exception: " << _e.what()); + TBOOST_ERROR("Failed filling test with Exception: " << _e.what()); } } @@ -660,18 +661,18 @@ void executeTests(const string& _name, const string& _testPathAppendix, const bo std::cout << "TEST " << _name << ":\n"; json_spirit::mValue v; string s = asString(dev::contents(testPath + "/" + _name + ".json")); - BOOST_REQUIRE_MESSAGE(s.length() > 0, "Contents of " + testPath + "/" + _name + ".json is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"); + TBOOST_REQUIRE_MESSAGE((s.length() > 0), "Contents of " + testPath + "/" + _name + ".json is empty. Have you cloned the 'tests' repo branch develop and set ETHEREUM_TEST_PATH to its path?"); json_spirit::read_string(s, v); Listener::notifySuiteStarted(_name); doTests(v, false); } catch (Exception const& _e) { - BOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e)); + TBOOST_ERROR("Failed test with Exception: " << diagnostic_information(_e)); } catch (std::exception const& _e) { - BOOST_ERROR("Failed test with Exception: " << _e.what()); + TBOOST_ERROR("Failed test with Exception: " << _e.what()); } } diff --git a/test/TestHelper.h b/test/TestHelper.h index c21429ef4..73b560aa0 100644 --- a/test/TestHelper.h +++ b/test/TestHelper.h @@ -32,21 +32,21 @@ #include #ifdef NOBOOST - #define TBOOST_THROW_EXCEPTION(arg) throw dev::Exception(); #define TBOOST_REQUIRE(arg) if(arg == false) throw dev::Exception(); #define TBOOST_REQUIRE_EQUAL(arg1, arg2) if(arg1 != arg2) throw dev::Exception(); #define TBOOST_CHECK_EQUAL(arg1, arg2) if(arg1 != arg2) throw dev::Exception(); #define TBOOST_CHECK(arg) if(arg == false) throw dev::Exception(); + #define TBOOST_REQUIRE_MESSAGE(arg1, arg2) if(arg1 == false) throw dev::Exception(); #define TBOOST_CHECK_MESSAGE(arg1, arg2) if(arg1 == false) throw dev::Exception(); #define TBOOST_WARN_MESSAGE(arg1, arg2) throw dev::Exception(); #define TBOOST_ERROR(arg) throw dev::Exception(); #else - #define TBOOST_THROW_EXCEPTION(arg) BOOST_THROW_EXCEPTION(arg) #define TBOOST_REQUIRE(arg) BOOST_REQUIRE(arg) #define TBOOST_REQUIRE_EQUAL(arg1, arg2) BOOST_REQUIRE_EQUAL(arg1, arg2) #define TBOOST_CHECK(arg) BOOST_CHECK(arg) #define TBOOST_CHECK_EQUAL(arg1, arg2) BOOST_CHECK_EQUAL(arg1, arg2) #define TBOOST_CHECK_MESSAGE(arg1, arg2) BOOST_CHECK_MESSAGE(arg1, arg2) + #define TBOOST_REQUIRE_MESSAGE(arg1, arg2) BOOST_REQUIRE_MESSAGE(arg1, arg2) #define TBOOST_WARN_MESSAGE(arg1, arg2) BOOST_WARN_MESSAGE(arg1, arg2) #define TBOOST_ERROR(arg) BOOST_ERROR(arg) #endif diff --git a/test/libethereum/transaction.cpp b/test/libethereum/transaction.cpp index ad20331b3..b620fc5ec 100644 --- a/test/libethereum/transaction.cpp +++ b/test/libethereum/transaction.cpp @@ -50,7 +50,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) { Transaction txFromFields(rlpStream.out(), CheckTransaction::Everything); if (!txFromFields.signature().isValid()) - TBOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); + BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); o["sender"] = toString(txFromFields.sender()); o["transaction"] = ImportTest::makeAllFieldsHex(tObj); @@ -94,7 +94,7 @@ void doTransactionTests(json_spirit::mValue& _v, bool _fillin) RLP rlp(stream); txFromRlp = Transaction(rlp.data(), CheckTransaction::Everything); if (!txFromRlp.signature().isValid()) - TBOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); + BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("transaction from RLP signature is invalid") ); } catch(Exception const& _e) { From 226cbb54098829b3d4c339a90c4edba685786002 Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Sat, 20 Jun 2015 02:47:24 +0400 Subject: [PATCH 162/169] FuzzTest: filltest option --- test/fuzzTesting/createRandomTest.cpp | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/fuzzTesting/createRandomTest.cpp b/test/fuzzTesting/createRandomTest.cpp index 6a3a7f4a0..b4a00440e 100644 --- a/test/fuzzTesting/createRandomTest.cpp +++ b/test/fuzzTesting/createRandomTest.cpp @@ -46,10 +46,12 @@ void parseTestWithTypes(std::string& test); int main(int argc, char *argv[]) { std::string testSuite; + std::string testFillString; json_spirit::mValue testmValue; bool checktest = false; bool filldebug = false; bool debug = false; + bool filltest = false; for (auto i = 0; i < argc; ++i) { auto arg = std::string{argv[i]}; @@ -64,7 +66,7 @@ int main(int argc, char *argv[]) testSuite = ""; } else - if (arg == "-checktest" && i + 1 < argc) + if ((arg == "-checktest" || arg == "-filltest") && i + 1 < argc) { std::string s; for (int j = i+1; j < argc; ++j) @@ -74,8 +76,16 @@ int main(int argc, char *argv[]) std::cout << "Error! Content of argument is empty! (Usage -checktest textstream) \n"; return 1; } - read_string(s, testmValue); - checktest = true; + if (arg == "-filltest") + { + testFillString = s; + filltest = true; + } + else + { + read_string(s, testmValue); + checktest = true; + } } else if (arg == "--debug") @@ -100,7 +110,7 @@ int main(int argc, char *argv[]) if (checktest) return checkRandomTest(dev::test::doBlockchainTests, testmValue, debug); else - fillRandomTest(dev::test::doBlockchainTests, c_testExampleBlockchainTest, filldebug); + fillRandomTest(dev::test::doBlockchainTests, (filltest) ? testFillString : c_testExampleBlockchainTest, filldebug); } else if (testSuite == "TransactionTests") @@ -108,7 +118,7 @@ int main(int argc, char *argv[]) if (checktest) return checkRandomTest(dev::test::doTransactionTests, testmValue, debug); else - fillRandomTest(dev::test::doTransactionTests, c_testExampleTransactionTest, filldebug); + fillRandomTest(dev::test::doTransactionTests, (filltest) ? testFillString : c_testExampleTransactionTest, filldebug); } else if (testSuite == "StateTests") @@ -116,7 +126,7 @@ int main(int argc, char *argv[]) if (checktest) return checkRandomTest(dev::test::doStateTests, testmValue, debug); else - fillRandomTest(dev::test::doStateTests, c_testExampleStateTest, filldebug); + fillRandomTest(dev::test::doStateTests, (filltest) ? testFillString : c_testExampleStateTest, filldebug); } else if (testSuite == "VMTests") @@ -127,7 +137,7 @@ int main(int argc, char *argv[]) return checkRandomTest(dev::test::doVMTests, testmValue, debug); } else - fillRandomTest(dev::test::doVMTests, c_testExampleVMTest, filldebug); + fillRandomTest(dev::test::doVMTests, (filltest) ? testFillString : c_testExampleVMTest, filldebug); } } From 592af7852bff8055c49c5670b9f4eaece87ba231 Mon Sep 17 00:00:00 2001 From: Dimitry Khokhlov Date: Sat, 20 Jun 2015 04:26:04 +0400 Subject: [PATCH 163/169] FuzzTests: windows build fix --- test/libethereum/state.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/libethereum/state.cpp b/test/libethereum/state.cpp index 492bfb746..a134d024f 100644 --- a/test/libethereum/state.cpp +++ b/test/libethereum/state.cpp @@ -80,7 +80,7 @@ void doStateTests(json_spirit::mValue& v, bool _fillin) #if ETH_FATDB importer.exportTest(output, theState); #else - TBOOST_THROW_EXCEPTION(Exception() << errinfo_comment("You can not fill tests when FATDB is switched off")); + BOOST_THROW_EXCEPTION(Exception() << errinfo_comment("You can not fill tests when FATDB is switched off")); #endif } else From 8803844e0ca3f96eadde4e8b6a96aeccbbeb7105 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Mon, 22 Jun 2015 18:07:44 +0200 Subject: [PATCH 164/169] style and optional NOBOOST --- CMakeLists.txt | 5 ++++- ethminer/MinerAux.h | 10 +++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e580bbfc..4adac7060 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,7 +84,10 @@ function(configureProject) add_definitions(-DETH_CURL) endif() - add_definitions(-DNOBOOST) + if (NOBOOST) + add_definitions(-DNOBOOST) + endif() + add_definitions(-DETH_TRUE) endfunction() diff --git a/ethminer/MinerAux.h b/ethminer/MinerAux.h index a4a671ddb..e123cdbb1 100644 --- a/ethminer/MinerAux.h +++ b/ethminer/MinerAux.h @@ -163,7 +163,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - BOOST_THROW_EXCEPTION( BadArgument()); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "--benchmark-trials" && i + 1 < argc) try { @@ -172,7 +172,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - BOOST_THROW_EXCEPTION( BadArgument()); + BOOST_THROW_EXCEPTION(BadArgument()); } else if (arg == "-C" || arg == "--cpu") m_minerType = MinerType::CPU; @@ -195,7 +195,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << m << endl; - BOOST_THROW_EXCEPTION( BadArgument()); + BOOST_THROW_EXCEPTION(BadArgument()); } } else if ((arg == "-w" || arg == "--check-pow") && i + 4 < argc) @@ -232,7 +232,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << m << endl; - BOOST_THROW_EXCEPTION( BadArgument()); + BOOST_THROW_EXCEPTION(BadArgument()); } } else if (arg == "-M" || arg == "--benchmark") @@ -245,7 +245,7 @@ public: catch (...) { cerr << "Bad " << arg << " option: " << argv[i] << endl; - BOOST_THROW_EXCEPTION( BadArgument()); + BOOST_THROW_EXCEPTION(BadArgument()); } } else From abe7a8f8da8a9d8049ac8b617917d3d301099b38 Mon Sep 17 00:00:00 2001 From: Alexandre Van de Sande Date: Mon, 22 Jun 2015 17:08:23 -0300 Subject: [PATCH 165/169] added new block and edit transaction action icons --- mix/qml/img/edittransaction.png | Bin 0 -> 902 bytes mix/qml/img/edittransaction2.png | Bin 0 -> 756 bytes mix/qml/img/edittransaction2@2x.png | Bin 0 -> 1448 bytes mix/qml/img/edittransaction@2x.png | Bin 0 -> 1709 bytes mix/qml/img/newblock.png | Bin 0 -> 728 bytes mix/qml/img/newblock@2x.png | Bin 0 -> 1610 bytes 6 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 mix/qml/img/edittransaction.png create mode 100644 mix/qml/img/edittransaction2.png create mode 100644 mix/qml/img/edittransaction2@2x.png create mode 100644 mix/qml/img/edittransaction@2x.png create mode 100644 mix/qml/img/newblock.png create mode 100644 mix/qml/img/newblock@2x.png diff --git a/mix/qml/img/edittransaction.png b/mix/qml/img/edittransaction.png new file mode 100644 index 0000000000000000000000000000000000000000..fac8954efb9c34756bea4da71de062ec83d79da5 GIT binary patch literal 902 zcmV;119|+3P)Px&KuJVFR7ef&RZC10K^Xpbw{NyBZK+s{pC* zn{WR42cRfL28s;)?+g%y2LoQB)%31(5BbX8tu&8cMd7 zT9x29!CEqjfFvN5N+}j4B{Yx}1<^>Gfc-SV61RLXzV^5+#&e0E*NC6J-#vb>1_5 zbFH@xAUz0$sJGc|K%lD;1rbC^K%g{;p%k!*M7n9-`IfIBZv?b~NC8|Y_&W4@QK^p@ z!vLkxpzG29$+hq+NF)*lKFNct!UfAq%V0K}m4NYhT+zKAe}#0o5J~0ar8XPHVvJI> zOY;G!t*eWM!{I|5m+TinzT|Pc$I=lMWWeRBh?4k-NUEx-C?(HvP!V5JpILgx9QlPrwhT*z@y$L z`>?_A$V=Vu^8sEIh1PV3Z3Do4fL}v>U@Zv-^xhrl6{xbb92RFo!N#-op853Tc)#g% zV;~p|9PxU+-&K1&ZW#bhj0zIHbqXX|gc6fU=>sYQpQmRT|H7jCYSTg2*SX+e@8iCW zf@wW}E>OGQbH?d(Zc2^;6s!S684-;zN}EM@3kIW6`44at!mSrQKY8-~r?)K)HKm=c z^-(=R+$=BOUD@7t1${&$v|emclTYG=nX+EqncB4V!y(@(Ih8u;DBG3QSynkt8=9Ho zZ?`vesV<16mMPzSpM^FMOeFHH%DuN4ojhl9)n`Y?u{V<*CeC(EOiWx@Sy?%}qrr>8 c{sjX+0W@JjB;+g}5C8xG07*qoM6N<$g3WN6e*gdg literal 0 HcmV?d00001 diff --git a/mix/qml/img/edittransaction2.png b/mix/qml/img/edittransaction2.png new file mode 100644 index 0000000000000000000000000000000000000000..55ffe2ad802f75a9907e8a813e3a6e4fb223d52d GIT binary patch literal 756 zcmVPx%u1Q2eR7ef&R843TQ4pTDNgMkUQZSOzMM1$dsWsbn6SBK`&v~gEV!KUIn~P>( zcix+MGvCZNZx^5<6$bt*2122#U@+KF+_O-;Df626Robmma?$ViI}I$0u_&kR?Ch)x zgu=&D-{rWbX<;T90Rx;6 z*2=*M0h`lfA5=O zv<)xdcfffeR->B8%Y-PvrV~h1GukAiYX*lVWwf-^u}e%C=hoAqoqM*wh&^{3o#kma z>DQejermuJg-ODmEI(AA` z($fzf-QP!md7%V2k62XzHx4{Y+8ws)vzbh`jWNoTVWf>)%PA(}+ zaamr7w|JPdvEEvvq*Aw@MjwCa@9&-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W@9^Sp{5-Q>#I>VGurZByy3J^|wW^;K3I9$^UbDDWmCGY~U z^B2AWonD`QaCmnZ!9P_BJe9xe3ZN4oEn&3B_xWxyn@cGmlgaW{oBfv~BSU+sV7ZZJ z4dD+hoo~E;EN0LfE@?C>0$)`6`SQX;y;A~Co1=+qe?by&eJJ$wcC*x6#0NwoQU2E}6yYqr%z2M21nmR#}c?!?%6mHJW zfw9>L{W#(jq|)NwE(8adPN(@Re@t9?`M^NS$&sB5JgW$BKq;5Mg!ci8NIVH|pL!Eo zjQnK^l@)q?b-8M?n_FU?s3_)U;cA4 z`ulYo9|+#g;wr+UYSQs|@-nKUV*N5rH~uRG*o%?JJpt}~Q$ON#`vPM+8jXK{--D;& zL6DDOd=X>*FoVyBFy7xI-}u@TEfg6L84ww`4;c6df6)V*9vDi400000NkvXXu0mjf DA(AQv literal 0 HcmV?d00001 diff --git a/mix/qml/img/newblock.png b/mix/qml/img/newblock.png new file mode 100644 index 0000000000000000000000000000000000000000..04694412c32ecad55803c742f5b8ab9546fbc034 GIT binary patch literal 728 zcmV;}0w?{6P)Px%l1W5CR7ef&QcGwPQ4~GzO)`_DF=;EYAFK;e14S35wgkkIsu)ZCRNaaT*F_3l zxDd1m3c64!R*aQy3uD_wQ4vIAiG*r}svyx#RZ3Iag-Jh?Nt4VxXOa#C+LS327m|UQ zd*9{EIrp7=fznfQpya^+>VOFFX6{DKfQn&6QRI4hde(4+0Lxxld$-tsg>_PR*i0S{ zhmY|*KT0XJN|My=_xpP%QG13#byHA|5j<9za#+iKDwH>knE$dK|E3#=L?Q2WqT|9_bvQXH_O*J5juiUN* z8nN@%`qyv6pp>Agu>sXpJ90dVqCl^gyIs)S!G2Bv*L4G2JfYp2&4J)qT#a?M0x3h- zh!!K+C<-o%XJ~k&-s|<^Xlo1XHUUe^lE$5Pby<>d$k&X-;u7p-F3e>ZJT=ve^iSN; zz+%fJahUAaP$k0}RIDVb10n93MQr_*>p@e$E)-{EU+Lfx*NSdcPMR#s=O3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k zU2d=Vyyni%j@)(F+~sqsi8iaJQa^Bat zJ^zGAr5tw3hgrlVd03|B^0_9z0uUw94S>_A{{H*8aIq9+SO104G=b#Ac%&r7!^VOf z|L}5R!g@%|*%6a~!7+i!Jp$d-V6s{*r(&R5rqX79{@Hu@73Vy2$^9AwsC8xl+%UfC zcUxM}+0lW71O^~+y&Z(J&17Nc+-&nXe5auQRy~c{=)ON@kHD`01j*W_(P$_Ocu#y^ zus1&phI%wN-$8m>Dq>?}U}TQ-)%Thxt&~Kt-$9O)GK*;M?Bkg~(NIrCU+c$@pNbnA z9Xih`Xf581I z=v0`>p9X;OGgHWiR953p`T6-~kFI{H&Km%39a}kaxUlG(zTUnchDXL`{Np1lCl`8s z_+!pc&=Q%_Z$I3U+4ESV9|eAm0iJfTTZ*57L&e3#g+s&RMV;Nue90L~>6-64&mft%%x;L|TzJ2bT+&qMYg!1U$N2&bX z2U{{vGi~p|!%wz8Qvgnz8HlvO;qj90dp)Ze03j$iy)5Kssx1QY@a0fm4 Date: Tue, 23 Jun 2015 10:00:27 +0200 Subject: [PATCH 166/169] Squashed 'libjsqrc/ethereumjs/' changes from ca46cb5..ecde334 ecde334 Merge pull request #241 from SilentCicero/master 3af1e82 Update eth.js 86d9b58 Added sendRawTransaction 4228b02 common fixes in requestmanager 47e292a version 0.6.0 c597034 gulp 9417bbf Merge branch 'master' into develop 15df5d6 Merge branch 'master' of https://github.com/ethereum/ethereum.js e947252 Merge pull request #234 from ethereum/ethers-patch-1 4d165de update license per name change to web3.js 03ae21b special logs will never be nulls, so there is no reason to check for null value 66f1def updated dependencies, gulp ccb436e Merge branch 'master' into develop d729884 unrelevant change in example fdf46ed fixed providor not set in request manager 811e3b2 Merge branch 'develop' of https://github.com/ethereum/ethereum.js into develop f454dda Merge branch 'develop' of https://github.com/asinyagin/web3.js into develop 4384805 build files b09bf31 Merge branch 'develop' into allAsync 6ea0d67 Set requests content type to application/json fe703f5 Merge pull request #229 from ethereum/extendWeb3 a90a85a mereg develop a2e5fbd add tests for the outputformatters 556eb45 re-add map files 08d2212 small fix on outputFormatters, dont transform null to 0 1495a0c add comlexity push for poll, does only show on travis 7518ed4 changed extend to _extend 1aefebd merged develop b6c49d4 improved async polling 16252f3 imporved async callback adding, without setinterval f242489 add optional default block parameter to contract call fixes #159 1d3d727 improved comment d9ce08e improved filter interval ddafe00 asyncified filters d14c706 build and improved extend function 733e19e add extend method and tests git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: ecde3345e0e6d4bca0ce03e08ee4957395cd6194 --- LICENSE | 8 +- README.md | 2 +- bower.json | 2 +- dist/web3-light.js | 231 ++++++++++++------ dist/web3-light.min.js | 4 +- dist/web3.js | 231 ++++++++++++------ dist/web3.js.map | 85 +++++++ dist/web3.min.js | 4 +- example/event_inc.html | 5 +- lib/utils/config.js | 2 +- lib/version.json | 2 +- lib/web3.js | 20 +- lib/web3/eth.js | 8 + lib/web3/filter.js | 99 +++++--- lib/web3/formatters.js | 22 +- lib/web3/function.js | 13 +- lib/web3/httpprovider.js | 4 +- lib/web3/requestmanager.js | 59 +++-- lib/web3/watches.js | 4 +- package.js | 2 +- package.json | 6 +- test/contract.js | 55 ++++- test/formatters.outputBlockFormatter.js | 70 ++++-- test/formatters.outputLogFormatter.js | 32 ++- test/formatters.outputTransactionFormatter.js | 35 ++- test/helpers/FakeHttpProvider2.js | 10 + test/helpers/FakeXMLHttpRequest.js | 7 + test/web3.extend.js | 76 ++++++ 28 files changed, 841 insertions(+), 257 deletions(-) create mode 100644 dist/web3.js.map create mode 100644 test/web3.extend.js diff --git a/LICENSE b/LICENSE index 0f187b873..29a99abb4 100644 --- a/LICENSE +++ b/LICENSE @@ -1,14 +1,14 @@ -This file is part of ethereum.js. +This file is part of web3.js. -ethereum.js is free software: you can redistribute it and/or modify +web3.js is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. -ethereum.js is distributed in the hope that it will be useful, +web3.js is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License -along with ethereum.js. If not, see . \ No newline at end of file +along with web3.js. If not, see . diff --git a/README.md b/README.md index 7a1c651fd..8abd8821d 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ eth -j [travis-url]: https://travis-ci.org/ethereum/web3.js [dep-image]: https://david-dm.org/ethereum/web3.js.svg [dep-url]: https://david-dm.org/ethereum/web3.js -[dep-dev-image]: https://david-dm.org/ethereum/web.js/dev-status.svg +[dep-dev-image]: https://david-dm.org/ethereum/web3.js/dev-status.svg [dep-dev-url]: https://david-dm.org/ethereum/web3.js#info=devDependencies [coveralls-image]: https://coveralls.io/repos/ethereum/web3.js/badge.svg?branch=master [coveralls-url]: https://coveralls.io/r/ethereum/web3.js?branch=master diff --git a/bower.json b/bower.json index eacbb4509..cb63bd076 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "web3", "namespace": "ethereum", - "version": "0.5.0", + "version": "0.6.0", "description": "Ethereum Compatible JavaScript API", "main": [ "./dist/web3.js", diff --git a/dist/web3-light.js b/dist/web3-light.js index c1452e786..a78f5ae68 100644 --- a/dist/web3-light.js +++ b/dist/web3-light.js @@ -799,7 +799,7 @@ module.exports = { ETH_SIGNATURE_LENGTH: 4, ETH_UNITS: ETH_UNITS, ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }, - ETH_POLLING_TIMEOUT: 1000, + ETH_POLLING_TIMEOUT: 1000/2, defaultBlock: 'latest', defaultAccount: undefined }; @@ -1348,7 +1348,7 @@ module.exports = { },{"bignumber.js":"bignumber.js"}],8:[function(require,module,exports){ module.exports={ - "version": "0.5.0" + "version": "0.6.0" } },{}],9:[function(require,module,exports){ @@ -1447,8 +1447,7 @@ web3.eth.filter = function (fil, eventParams, options, formatter) { return fil(eventParams, options); } - // what outputLogFormatter? that's wrong - //return new Filter(fil, watches.eth(), formatters.outputLogFormatter); + // output logs works for blockFilter and pendingTransaction filters? return new Filter(fil, watches.eth(), formatter || formatters.outputLogFormatter); }; /*jshint maxparams:3 */ @@ -1503,6 +1502,23 @@ Object.defineProperty(web3.eth, 'defaultAccount', { } }); + +// EXTEND +web3._extend = function(extension){ + /*jshint maxcomplexity: 6 */ + + if(extension.property && !web3[extension.property]) + web3[extension.property] = {}; + + setupMethods(web3[extension.property] || web3, extension.methods || []); + setupProperties(web3[extension.property] || web3, extension.properties || []); +}; +web3._extend.formatters = formatters; +web3._extend.utils = utils; +web3._extend.Method = require('./web3/method'); +web3._extend.Property = require('./web3/property'); + + /// setups all api methods setupProperties(web3, web3Properties); setupMethods(web3.net, net.methods); @@ -1515,7 +1531,7 @@ setupMethods(web3.shh, shh.methods); module.exports = web3; -},{"./utils/config":5,"./utils/sha3":6,"./utils/utils":7,"./version.json":8,"./web3/batch":10,"./web3/db":12,"./web3/eth":14,"./web3/filter":16,"./web3/formatters":17,"./web3/net":24,"./web3/property":25,"./web3/requestmanager":27,"./web3/shh":28,"./web3/watches":30}],10:[function(require,module,exports){ +},{"./utils/config":5,"./utils/sha3":6,"./utils/utils":7,"./version.json":8,"./web3/batch":10,"./web3/db":12,"./web3/eth":14,"./web3/filter":16,"./web3/formatters":17,"./web3/method":22,"./web3/net":24,"./web3/property":25,"./web3/requestmanager":27,"./web3/shh":28,"./web3/watches":30}],10:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2409,21 +2425,36 @@ var getOptions = function (options) { }; }; -var Filter = function (options, methods, formatter) { - var implementation = {}; - methods.forEach(function (method) { - method.attachToObject(implementation); - }); - this.options = getOptions(options); - this.implementation = implementation; - this.callbacks = []; - this.formatter = formatter; - this.filterId = this.implementation.newFilter(this.options); +/** +Adds the callback and sets up the methods, to iterate over the results. + +@method getLogsAtStart +@param {Object} self +@param {funciton} +*/ +var getLogsAtStart = function(self, callback){ + // call getFilterLogs for the first watch callback start + if (!utils.isString(self.options)) { + self.get(function (err, messages) { + // don't send all the responses to all the watches again... just to self one + if (err) { + callback(err); + } + + messages.forEach(function (message) { + callback(null, message); + }); + }); + } }; -Filter.prototype.watch = function (callback) { - this.callbacks.push(callback); - var self = this; +/** +Adds the callback and sets up the methods, to iterate over the results. + +@method pollFilter +@param {Object} self +*/ +var pollFilter = function(self) { var onMessage = function (error, messages) { if (error) { @@ -2440,29 +2471,55 @@ Filter.prototype.watch = function (callback) { }); }; - // call getFilterLogs on start - if (!utils.isString(this.options)) { - this.get(function (err, messages) { - // don't send all the responses to all the watches again... just to this one - if (err) { - callback(err); - } + RequestManager.getInstance().startPolling({ + method: self.implementation.poll.call, + params: [self.filterId], + }, self.filterId, onMessage, self.stopWatching.bind(self)); - messages.forEach(function (message) { - callback(null, message); +}; + +var Filter = function (options, methods, formatter) { + var self = this; + var implementation = {}; + methods.forEach(function (method) { + method.attachToObject(implementation); + }); + this.options = getOptions(options); + this.implementation = implementation; + this.callbacks = []; + this.pollFilters = []; + this.formatter = formatter; + this.implementation.newFilter(this.options, function(error, id){ + if(error) { + self.callbacks.forEach(function(callback){ + callback(error); }); - }); + } else { + self.filterId = id; + // get filter logs at start + self.callbacks.forEach(function(callback){ + getLogsAtStart(self, callback); + }); + pollFilter(self); + } + }); +}; + +Filter.prototype.watch = function (callback) { + this.callbacks.push(callback); + + if(this.filterId) { + getLogsAtStart(this, callback); + pollFilter(this); } - RequestManager.getInstance().startPolling({ - method: this.implementation.poll.call, - params: [this.filterId], - }, this.filterId, onMessage, this.stopWatching.bind(this)); + return this; }; Filter.prototype.stopWatching = function () { RequestManager.getInstance().stopPolling(this.filterId); - this.implementation.uninstallFilter(this.filterId); + // remove filter async + this.implementation.uninstallFilter(this.filterId, function(){}); this.callbacks = []; }; @@ -2484,6 +2541,8 @@ Filter.prototype.get = function (callback) { return self.formatter ? self.formatter(log) : log; }); } + + return this; }; module.exports = Filter; @@ -2581,8 +2640,10 @@ var inputTransactionFormatter = function (options){ * @returns {Object} transaction */ var outputTransactionFormatter = function (tx){ - tx.blockNumber = utils.toDecimal(tx.blockNumber); - tx.transactionIndex = utils.toDecimal(tx.transactionIndex); + if(tx.blockNumber !== null) + tx.blockNumber = utils.toDecimal(tx.blockNumber); + if(tx.transactionIndex !== null) + tx.transactionIndex = utils.toDecimal(tx.transactionIndex); tx.nonce = utils.toDecimal(tx.nonce); tx.gas = utils.toDecimal(tx.gas); tx.gasPrice = utils.toBigNumber(tx.gasPrice); @@ -2604,7 +2665,8 @@ var outputBlockFormatter = function(block) { block.gasUsed = utils.toDecimal(block.gasUsed); block.size = utils.toDecimal(block.size); block.timestamp = utils.toDecimal(block.timestamp); - block.number = utils.toDecimal(block.number); + if(block.number !== null) + block.number = utils.toDecimal(block.number); block.difficulty = utils.toBigNumber(block.difficulty); block.totalDifficulty = utils.toBigNumber(block.totalDifficulty); @@ -2627,13 +2689,12 @@ var outputBlockFormatter = function(block) { * @returns {Object} log */ var outputLogFormatter = function(log) { - if (log === null) { // 'pending' && 'latest' filters are nulls - return null; - } - - log.blockNumber = utils.toDecimal(log.blockNumber); - log.transactionIndex = utils.toDecimal(log.transactionIndex); - log.logIndex = utils.toDecimal(log.logIndex); + if(log.blockNumber !== null) + log.blockNumber = utils.toDecimal(log.blockNumber); + if(log.transactionIndex !== null) + log.transactionIndex = utils.toDecimal(log.transactionIndex); + if(log.logIndex !== null) + log.logIndex = utils.toDecimal(log.logIndex); return log; }; @@ -2735,6 +2796,7 @@ module.exports = { var web3 = require('../web3'); var coder = require('../solidity/coder'); var utils = require('../utils/utils'); +var formatters = require('./formatters'); var sha3 = require('../utils/sha3'); /** @@ -2758,6 +2820,12 @@ SolidityFunction.prototype.extractCallback = function (args) { } }; +SolidityFunction.prototype.extractDefaultBlock = function (args) { + if (args.length > this._inputTypes.length && !utils.isObject(args[args.length -1])) { + return formatters.inputDefaultBlockNumberFormatter(args.pop()); // modify the args array! + } +}; + /** * Should be used to create payload from arguments * @@ -2809,15 +2877,17 @@ SolidityFunction.prototype.unpackOutput = function (output) { SolidityFunction.prototype.call = function () { var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; }); var callback = this.extractCallback(args); + var defaultBlock = this.extractDefaultBlock(args); var payload = this.toPayload(args); + if (!callback) { - var output = web3.eth.call(payload); + var output = web3.eth.call(payload, defaultBlock); return this.unpackOutput(output); } var self = this; - web3.eth.call(payload, function (error, output) { + web3.eth.call(payload, defaultBlock, function (error, output) { callback(error, self.unpackOutput(output)); }); }; @@ -2936,7 +3006,7 @@ SolidityFunction.prototype.attachToContract = function (contract) { module.exports = SolidityFunction; -},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9}],19:[function(require,module,exports){ +},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2974,6 +3044,7 @@ HttpProvider.prototype.send = function (payload) { var request = new XMLHttpRequest(); request.open('POST', this.host, false); + request.setRequestHeader('Content-type','application/json'); try { request.send(JSON.stringify(payload)); @@ -3017,7 +3088,8 @@ HttpProvider.prototype.sendAsync = function (payload, callback) { }; request.open('POST', this.host, true); - + request.setRequestHeader('Content-type','application/json'); + try { request.send(JSON.stringify(payload)); } catch(error) { @@ -3702,9 +3774,9 @@ var RequestManager = function (provider) { arguments.callee._singletonInstance = this; this.provider = provider; - this.polls = []; + this.polls = {}; this.timeout = null; - this.poll(); + this.isPolling = false; }; /** @@ -3799,6 +3871,11 @@ RequestManager.prototype.sendBatch = function (data, callback) { */ RequestManager.prototype.setProvider = function (p) { this.provider = p; + + if (this.provider && !this.isPolling) { + this.poll(); + this.isPolling = true; + } }; /*jshint maxparams:4 */ @@ -3815,7 +3892,7 @@ RequestManager.prototype.setProvider = function (p) { * @todo cleanup number of params */ RequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) { - this.polls.push({data: data, id: pollId, callback: callback, uninstall: uninstall}); + this.polls['poll_'+ pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall}; }; /*jshint maxparams:3 */ @@ -3826,24 +3903,19 @@ RequestManager.prototype.startPolling = function (data, pollId, callback, uninst * @param {Number} pollId */ RequestManager.prototype.stopPolling = function (pollId) { - for (var i = this.polls.length; i--;) { - var poll = this.polls[i]; - if (poll.id === pollId) { - this.polls.splice(i, 1); - } - } + delete this.polls['poll_'+ pollId]; }; /** - * Should be called to reset polling mechanism of request manager + * Should be called to reset the polling mechanism of the request manager * * @method reset */ RequestManager.prototype.reset = function () { - this.polls.forEach(function (poll) { - poll.uninstall(poll.id); - }); - this.polls = []; + for (var key in this.polls) { + this.polls[key].uninstall(); + } + this.polls = {}; if (this.timeout) { clearTimeout(this.timeout); @@ -3858,9 +3930,10 @@ RequestManager.prototype.reset = function () { * @method poll */ RequestManager.prototype.poll = function () { + /*jshint maxcomplexity: 6 */ this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT); - if (!this.polls.length) { + if (Object.keys(this.polls).length === 0) { return; } @@ -3869,9 +3942,18 @@ RequestManager.prototype.poll = function () { return; } - var payload = Jsonrpc.getInstance().toBatchPayload(this.polls.map(function (data) { - return data.data; - })); + var pollsData = []; + var pollsKeys = []; + for (var key in this.polls) { + pollsData.push(this.polls[key].data); + pollsKeys.push(key); + } + + if (pollsData.length === 0) { + return; + } + + var payload = Jsonrpc.getInstance().toBatchPayload(pollsData); var self = this; this.provider.sendAsync(payload, function (error, results) { @@ -3879,14 +3961,21 @@ RequestManager.prototype.poll = function () { if (error) { return; } - + if (!utils.isArray(results)) { throw errors.InvalidResponse(results); } results.map(function (result, index) { - result.callback = self.polls[index].callback; - return result; + var key = pollsKeys[index]; + // make sure the filter is still installed after arrival of the request + if (self.polls[key]) { + result.callback = self.polls[key].callback; + return result; + } else + return false; + }).filter(function (result) { + return !!result; }).filter(function (result) { var valid = Jsonrpc.getInstance().isValidResponse(result); if (!valid) { @@ -4102,11 +4191,11 @@ var eth = function () { switch(type) { case 'latest': - args.pop(); + args.shift(); this.params = 0; return 'eth_newBlockFilter'; case 'pending': - args.pop(); + args.shift(); this.params = 0; return 'eth_newPendingTransactionFilter'; default: @@ -5583,4 +5672,4 @@ module.exports = web3; },{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvc29saWRpdHkvY29kZXIuanMiLCJsaWIvc29saWRpdHkvZm9ybWF0dGVycy5qcyIsImxpYi9zb2xpZGl0eS9wYXJhbS5qcyIsImxpYi91dGlscy9icm93c2VyLXhoci5qcyIsImxpYi91dGlscy9jb25maWcuanMiLCJsaWIvdXRpbHMvc2hhMy5qcyIsImxpYi91dGlscy91dGlscy5qcyIsImxpYi92ZXJzaW9uLmpzb24iLCJsaWIvd2ViMy5qcyIsImxpYi93ZWIzL2JhdGNoLmpzIiwibGliL3dlYjMvY29udHJhY3QuanMiLCJsaWIvd2ViMy9kYi5qcyIsImxpYi93ZWIzL2Vycm9ycy5qcyIsImxpYi93ZWIzL2V0aC5qcyIsImxpYi93ZWIzL2V2ZW50LmpzIiwibGliL3dlYjMvZmlsdGVyLmpzIiwibGliL3dlYjMvZm9ybWF0dGVycy5qcyIsImxpYi93ZWIzL2Z1bmN0aW9uLmpzIiwibGliL3dlYjMvaHR0cHByb3ZpZGVyLmpzIiwibGliL3dlYjMvaWNhcC5qcyIsImxpYi93ZWIzL2pzb25ycGMuanMiLCJsaWIvd2ViMy9tZXRob2QuanMiLCJsaWIvd2ViMy9uYW1lcmVnLmpzIiwibGliL3dlYjMvbmV0LmpzIiwibGliL3dlYjMvcHJvcGVydHkuanMiL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BpbnRvIHRoZSBuZXcgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAcmV0dXJuIHtPYmplY3R9IFRoZSBuZXcgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAc3RhdGljXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqICAgICB2YXIgTXlUeXBlID0gQ3J5cHRvSlMubGliLkJhc2UuZXh0ZW5kKHtcblx0ICAgICAgICAgICAgICogICAgICAgICBmaWVsZDogJ3ZhbHVlJyxcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogICAgICAgICBtZXRob2Q6IGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgICogICAgICAgICB9XG5cdCAgICAgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgICAgICovXG5cdCAgICAgICAgICAgIGV4dGVuZDogZnVuY3Rpb24gKG92ZXJyaWRlcykge1xuXHQgICAgICAgICAgICAgICAgLy8gU3Bhd25cblx0ICAgICAgICAgICAgICAgIEYucHJvdG90eXBlID0gdGhpcztcblx0ICAgICAgICAgICAgICAgIHZhciBzdWJ0eXBlID0gbmV3IEYoKTtcblxuXHQgICAgICAgICAgICAgICAgLy8gQXVnbWVudFxuXHQgICAgICAgICAgICAgICAgaWYgKG92ZXJyaWRlcykge1xuXHQgICAgICAgICAgICAgICAgICAgIHN1YnR5cGUubWl4SW4ob3ZlcnJpZGVzKTtcblx0ICAgICAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIGRlZmF1bHQgaW5pdGlhbGl6ZXJcblx0ICAgICAgICAgICAgICAgIGlmICghc3VidHlwZS5oYXNPd25Qcm9wZXJ0eSgnaW5pdCcpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgc3VidHlwZS5pbml0ID0gZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0eXBlLiRzdXBlci5pbml0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG5cdCAgICAgICAgICAgICAgICAgICAgfTtcblx0ICAgICAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICAgICAgLy8gSW5pdGlhbGl6ZXIncyBwcm90b3R5cGUgaXMgdGhlIHN1YnR5cGUgb2JqZWN0XG5cdCAgICAgICAgICAgICAgICBzdWJ0eXBlLmluaXQucHJvdG90eXBlID0gc3VidHlwZTtcblxuXHQgICAgICAgICAgICAgICAgLy8gUmVmZXJlbmNlIHN1cGVydHlwZVxuXHQgICAgICAgICAgICAgICAgc3VidHlwZS4kc3VwZXIgPSB0aGlzO1xuXG5cdCAgICAgICAgICAgICAgICByZXR1cm4gc3VidHlwZTtcblx0ICAgICAgICAgICAgfSxcblxuXHQgICAgICAgICAgICAvKipcblx0ICAgICAgICAgICAgICogRXh0ZW5kcyB0aGlzIG9iamVjdCBhbmQgcnVucyB0aGUgaW5pdCBtZXRob2QuXG5cdCAgICAgICAgICAgICAqIEFyZ3VtZW50cyB0byBjcmVhdGUoKSB3aWxsIGJlIHBhc3NlZCB0byBpbml0KCkuXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEByZXR1cm4ge09iamVjdH0gVGhlIG5ldyBvYmplY3QuXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBzdGF0aWNcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogICAgIHZhciBpbnN0YW5jZSA9IE15VHlwZS5jcmVhdGUoKTtcblx0ICAgICAgICAgICAgICovXG5cdCAgICAgICAgICAgIGNyZWF0ZTogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAgICAgdmFyIGluc3RhbmNlID0gdGhpcy5leHRlbmQoKTtcblx0ICAgICAgICAgICAgICAgIGluc3RhbmNlLmluaXQuYXBwbHkoaW5zdGFuY2UsIGFyZ3VtZW50cyk7XG5cblx0ICAgICAgICAgICAgICAgIHJldHVybiBpbnN0YW5jZTtcblx0ICAgICAgICAgICAgfSxcblxuXHQgICAgICAgICAgICAvKipcblx0ICAgICAgICAgICAgICogSW5pdGlhbGl6ZXMgYSBuZXdseSBjcmVhdGVkIG9iamVjdC5cblx0ICAgICAgICAgICAgICogT3ZlcnJpZGUgdGhpcyBtZXRob2QgdG8gYWRkIHNvbWUgbG9naWMgd2hlbiB5b3VyIG9iamVjdHMgYXJlIGNyZWF0ZWQuXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqICAgICB2YXIgTXlUeXBlID0gQ3J5cHRvSlMubGliLkJhc2UuZXh0ZW5kKHtcblx0ICAgICAgICAgICAgICogICAgICAgICBpbml0OiBmdW5jdGlvbiAoKSB7XG5cdCAgICAgICAgICAgICAqICAgICAgICAgICAgIC8vIC4uLlxuXHQgICAgICAgICAgICAgKiAgICAgICAgIH1cblx0ICAgICAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAgICAgKi9cblx0ICAgICAgICAgICAgaW5pdDogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICB9LFxuXG5cdCAgICAgICAgICAgIC8qKlxuXHQgICAgICAgICAgICAgKiBDb3BpZXMgcHJvcGVydGllcyBpbnRvIHRoaXMgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAcGFyYW0ge09iamVjdH0gcHJvcGVydGllcyBUaGUgcHJvcGVydGllcyB0byBtaXggaW4uXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqICAgICBNeVR5cGUubWl4SW4oe1xuXHQgICAgICAgICAgICAgKiAgICAgICAgIGZpZWxkOiAndmFsdWUnXG5cdCAgICAgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgICAgICovXG5cdCAgICAgICAgICAgIG1peEluOiBmdW5jdGlvbiAocHJvcGVydGllcykge1xuXHQgICAgICAgICAgICAgICAgZm9yICh2YXIgcHJvcGVydHlOYW1lIGluIHByb3BlcnRpZXMpIHtcblx0ICAgICAgICAgICAgICAgICAgICBpZiAocHJvcGVydGllcy5oYXNPd25Qcm9wZXJ0eShwcm9wZXJ0eU5hbWUpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbcHJvcGVydHlOYW1lXSA9IHByb3BlcnRpZXNbcHJvcGVydHlOYW1lXTtcblx0ICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgICAgIC8vIElFIHdvbid0IGNvcHkgdG9TdHJpbmcgdXNpbmcgdGhlIGxvb3AgYWJvdmVcblx0ICAgICAgICAgICAgICAgIGlmIChwcm9wZXJ0aWVzLmhhc093blByb3BlcnR5KCd0b1N0cmluZycpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhpcy50b1N0cmluZyA9IHByb3BlcnRpZXMudG9TdHJpbmc7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0sXG5cblx0ICAgICAgICAgICAgLyoqXG5cdCAgICAgICAgICAgICAqIENyZWF0ZXMgYSBjb3B5IG9mIHRoaXMgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAcmV0dXJuIHtPYmplY3R9IFRoZSBjbG9uZS5cblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogICAgIHZhciBjbG9uZSA9IGluc3RhbmNlLmNsb25lKCk7XG5cdCAgICAgICAgICAgICAqL1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y5saWIuV29yZEFycmF5LmNyZWF0ZShbMHgwMDAxMDIwMywgMHgwNDA1MDYwN10pO1xuXHQgICAgICAgICAqICAgICB2YXIgd29yZEFycmF5ID0gQ3J5cHRvSlMubGliLldvcmRBcnJheS5jcmVhdGUoWzB4MDAwMTAyMDMsIDB4MDQwNTA2MDddLCA2KTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICBpbml0OiBmdW5jdGlvbiAod29yZHMsIHNpZ0J5dGVzKSB7XG5cdCAgICAgICAgICAgIHdvcmRzID0gdGhpcy53b3JkcyA9IHdvcmRzIHx8IFtdO1xuXG5cdCAgICAgICAgICAgIGlmIChzaWdCeXRlcyAhPSB1bmRlZmluZWQpIHtcblx0ICAgICAgICAgICAgICAgIHRoaXMuc2lnQnl0ZXMgPSBzaWdCeXRlcztcblx0ICAgICAgICAgICAgfSBlbHNlIHtcblx0ICAgICAgICAgICAgICAgIHRoaXMuc2lnQnl0ZXMgPSB3b3Jkcy5sZW5ndGggKiA0O1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfSxcblxuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIENvbnZlcnRzIHRoaXMgd29yZCBhcnJheSB0byBhIHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBwYXJhbSB7RW5jb2Rlcn0gZW5jb2RlciAoT3B0aW9uYWwpIFRoZSBlbmNvZGluZyBzdHJhdGVneSB0byB1c2UuIERlZmF1bHQ6IENyeXB0b0pTLmVuYy5IZXhcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEByZXR1cm4ge3N0cmluZ30gVGhlIHN0cmluZ2lmaWVkIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciBzdHJpbmcgPSB3b3JkQXJyYXkgKyAnJztcblx0ICAgICAgICAgKiAgICAgdmFyIHN0cmluZyA9IHdvcmRBcnJheS50b1N0cmluZygpO1xuXHQgICAgICAgICAqICAgICB2YXIgc3RyaW5nID0gd29yZEFycmF5LnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0b1N0cmluZzogZnVuY3Rpb24gKGVuY29kZXIpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIChlbmNvZGVyIHx8IEhleCkuc3RyaW5naWZ5KHRoaXMpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb25jYXRlbmF0ZXMgYSB3b3JkIGFycmF5IHRvIHRoaXMgd29yZCBhcnJheS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBwYXJhbSB7V29yZEFycmF5fSB3b3JkQXJyYXkgVGhlIHdvcmQgYXJyYXkgdG8gYXBwZW5kLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7V29yZEFycmF5fSBUaGlzIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHdvcmRBcnJheTEuY29uY2F0KHdvcmRBcnJheTIpO1xuXHQgICAgICAgICAqL1xuXHQgICAgICAgIGNvbmNhdDogZnVuY3Rpb24gKHdvcmRBcnJheSkge1xuXHQgICAgICAgICAgICAvLyBTaG9ydGN1dHNcblx0ICAgICAgICAgICAgdmFyIHRoaXNXb3JkcyA9IHRoaXMud29yZHM7XG5cdCAgICAgICAgICAgIHZhciB0aGF0V29yZHMgPSB3b3JkQXJyYXkud29yZHM7XG5cdCAgICAgICAgICAgIHZhciB0aGlzU2lnQnl0ZXMgPSB0aGlzLnNpZ0J5dGVzO1xuXHQgICAgICAgICAgICB2YXIgdGhhdFNpZ0J5dGVzID0gd29yZEFycmF5LnNpZ0J5dGVzO1xuXG5cdCAgICAgICAgICAgIC8vIENsYW1wIGV4Y2V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lcyBpbnNpZ25pZmljYW50IGJpdHMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHdvcmRBcnJheS5jbGFtcCgpO1xuXHQgICAgICAgICAqL1xuXHQgICAgICAgIGNsYW1wOiBmdW5jdGlvbiAoKSB7XG5cdCAgICAgICAgICAgIC8vIFNob3J0Y3V0c1xuXHQgICAgICAgICAgICB2YXIgd29yZHMgPSB0aGlzLndvcmRzO1xuXHQgICAgICAgICAgICB2YXIgc2lnQnl0ZXMgPSB0aGlzLnNpZ0J5dGVzO1xuXG5cdCAgICAgICAgICAgIC8vIENsYW1wXG5cdCAgICAgICAgICAgIHdvcmRzW3NpZ0J5dGVzID4+PiAyXSAmPSAweGZmZmZmZmZmIDw8ICgzMiAtIChzaWdCeXRlcyAlIDQpICogOCk7XG5cdCAgICAgICAgICAgIHdvcmRzLmxlbmd0aCA9IE1hdGguY2VpbChzaWdCeXRlcyAvIDQpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDcmVhdGVzIGEgY29weSBvZiB0aGlzIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtXb3JkQXJyYXl9IFRoZSBjbG9uZS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIGNsb25lID0gd29yZEFycmF5LmNsb25lKCk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgdmFyIGNsb25lID0gQmFzZS5jbG9uZS5jYWxsKHRoaXMpO1xuXHQgICAgICAgICAgICBjbG9uZS53b3JkcyA9IHRoaXMud29yZHMuc2xpY2UoMCk7XG5cblx0ICAgICAgICAgICAgcmV0dXJuIGNsb25lO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDcmVhdGVzIGEgd29yZCBhcnJheSBmaWxsZWQgd2l0aCByYW5kb20gYnl0ZXMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge251bWJlcn0gbkJ5dGVzIFRoZSBudW1iZXIgb2YgcmFuZG9tIGJ5dGVzIHRvIGdlbmVyYXRlLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7V29yZEFycmF5fSBUaGUgcmFuZG9tIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAc3RhdGljXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB3b3JkQXJyYXkgPSBDcnlwdG9KUy5saWIuV29yZEFycmF5LnJhbmRvbSgxNik7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgcmFuZG9tOiBmdW5jdGlvbiAobkJ5dGVzKSB7XG5cdCAgICAgICAgICAgIHZhciB3b3JkcyA9IFtdO1xuXG5cdCAgICAgICAgICAgIHZhciByID0gKGZ1bmN0aW9uIChtX3cpIHtcblx0ICAgICAgICAgICAgICAgIHZhciBtX3cgPSBtX3c7XG5cdCAgICAgICAgICAgICAgICB2YXIgbV96ID0gMHgzYWRlNjhiMTtcblx0ICAgICAgICAgICAgICAgIHZhciBtYXNrID0gMHhmZmZmZmZmZjtcblxuXHQgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgICAgICAgICBtX3ogPSAoMHg5MDY5ICogKG1feiAmIDB4RkZGRikgKyAobV96ID4+IDB4MTApKSAmIG1hc2s7XG5cdCAgICAgICAgICAgICAgICAgICAgbV93ID0gKDB4NDY1MCAqIChtX3cgJiAweEZGRkYpICsgKG1fdyA+PiAweDEwKSkgJiBtYXNrO1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSAoKG1feiA8PCAweDEwKSArIG1fdykgJiBtYXNrO1xuXHQgICAgICAgICAgICAgICAgICAgIHJlc3VsdCAvPSAweDEwMDAwMDAwMDtcblx0ICAgICAgICAgICAgICAgICAgICByZXN1bHQgKz0gMC41O1xuXHQgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQgKiAoTWF0aC5yYW5kb20oKSA+IC41ID8gMSA6IC0xKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cblx0ICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIHJjYWNoZTsgaSA8IG5CeXRlczsgaSArPSA0KSB7XG5cdCAgICAgICAgICAgICAgICB2YXIgX3IgPSByKChyY2FjaGUgfHwgTWF0aC5yYW5kb20oKSkgKiAweDEwMDAwMDAwMCk7XG5cblx0ICAgICAgICAgICAgICAgIHJjYWNoZSA9IF9yKCkgKiAweDNhZGU2N2I3O1xuXHQgICAgICAgICAgICAgICAgd29yZHMucHVzaCgoX3IoKSAqIDB4MTAwMDAwMDAwKSB8IDApO1xuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgcmV0dXJuIG5ldyBXb3JkQXJyYXkuaW5pdCh3b3JkcywgbkJ5dGVzKTtcblx0ICAgICAgICB9XG5cdCAgICB9KTtcblxuXHQgICAgLyoqXG5cdCAgICAgKiBFbmNvZGVyIG5hbWVzcGFjZS5cblx0ICAgICAqL1xuXHQgICAgdmFyIENfZW5jID0gQy5lbmMgPSB7fTtcblxuXHQgICAgLyoqXG5cdCAgICAgKiBIZXggZW5jb2Rpbmcgc3RyYXRlZ3kuXG5cdCAgICAgKi9cblx0ICAgIHZhciBIZXggPSBDX2VuYy5IZXggPSB7XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogQ29udmVydHMgYSB3b3JkIGFycmF5IHRvIGEgaGV4IHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBwYXJhbSB7V29yZEFycmF5fSB3b3JkQXJyYXkgVGhlIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtzdHJpbmd9IFRoZSBoZXggc3RyaW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHN0YXRpY1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICB2YXIgaGV4U3RyaW5nID0gQ3J5cHRvSlMuZW5jLkhleC5zdHJpbmdpZnkod29yZEFycmF5KTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICBzdHJpbmdpZnk6IGZ1bmN0aW9uICh3b3JkQXJyYXkpIHtcblx0ICAgICAgICAgICAgLy8gU2hvcnRjdXRzXG5cdCAgICAgICAgICAgIHZhciB3b3JkcyA9IHdvcmRBcnJheS53b3Jkcztcblx0ICAgICAgICAgICAgdmFyIHNpZ0J5dGVzID0gd29yZEFycmF5LnNpZ0J5dGVzO1xuXG5cdCAgICAgICAgICAgIC8vIENvbnZlcnRcblx0ICAgICAgICAgICAgdmFyIGhleENoYXJzID0gW107XG5cdCAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc2lnQnl0ZXM7IGkrKykge1xuXHQgICAgICAgICAgICAgICAgdmFyIGJpdGUgPSAod29yZHNbaSA+Pj4gMl0gPj4+ICgyNCAtIChpICUgNCkgKiA4KSkgJiAweGZmO1xuXHQgICAgICAgICAgICAgICAgaGV4Q2hhcnMucHVzaCgoYml0ZSA+Pj4gNCkudG9TdHJpbmcoMTYpKTtcblx0ICAgICAgICAgICAgICAgIGhleENoYXJzLnB1c2goKGJpdGUgJiAweDBmKS50b1N0cmluZygxNikpO1xuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgcmV0dXJuIGhleENoYXJzLmpvaW4oJycpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb252ZXJ0cyBhIGhleCBzdHJpbmcgdG8gYSB3b3JkIGFycmF5LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHBhcmFtIHtzdHJpbmd9IGhleFN0ciBUaGUgaGV4IHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEByZXR1cm4ge1dvcmRBcnJheX0gVGhlIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAc3RhdGljXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB3b3JkQXJyYXkgPSBDcnlwdG9KUy5lbmMuSGV4LnBhcnNlKGhleFN0cmluZyk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgcGFyc2U6IGZ1bmN0aW9uIChoZXhTdHIpIHtcblx0ICAgICAgICAgICAgLy8gU2hvcnRjdXRcblx0ICAgICAgICAgICAgdmFyIGhleFN0ckxlbmd0aCA9IGhleFN0ci5sZW5ndGg7XG5cblx0ICAgICAgICAgICAgLy8gQ29udmVydFxuXHQgICAgICAgICAgICB2YXIgd29yZHMgPSBbXTtcblx0ICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBoZXhTdHJMZW5ndGg7IGkgKz0gMikge1xuXHQgICAgICAgICAgICAgICAgd29yZHNbaSA+Pj4gM10gfD0gcGFyc2VJbnQoaGV4U3RyLnN1YnN0cihpLCAyKSwgMTYpIDw8ICgyNCAtIChpICUgOCkgKiA0KTtcblx0ICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgIHJldHVybiBuZXcgV29yZEFycmF5LmluaXQod29yZHMsIGhleFN0ckxlbmd0aCAvIDIpO1xuXHQgICAgICAgIH1cblx0ICAgIH07XG5cblx0ICAgIC8qKlxuXHQgICAgICogTGF0aW4xIGVuY29kaW5nIHN0cmF0ZWd5LlxuXHQgICAgICovXG5cdCAgICB2YXIgTGF0aW4xID0gQ19lbmMuTGF0aW4xID0ge1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIENvbnZlcnRzIGEgd29yZCBhcnJheSB0byBhIExhdGluMSBzdHJpbmcuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge1dvcmRBcnJheX0gd29yZEFycmF5IFRoZSB3b3JkIGFycmF5LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7c3RyaW5nfSBUaGUgTGF0aW4xIHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBzdGF0aWNcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIGxhdGluMVN0cmluZyA9IENyeXB0b0pTLmVuYy5MYXRpbjEuc3RyaW5naWZ5KHdvcmRBcnJheSk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgc3RyaW5naWZ5OiBmdW5jdGlvbiAod29yZEFycmF5KSB7XG5cdCAgICAgICAgICAgIC8vIFNob3J0Y3V0c1xuXHQgICAgICAgICAgICB2YXIgd29yZHMgPSB3b3JkQXJyYXkud29yZHM7XG5cdCAgICAgICAgICAgIHZhciBzaWdCeXRlcyA9IHdvcmRBcnJheS5zaWdCeXRlcztcblxuXHQgICAgICAgICAgICAvLyBDb252ZXJ0XG5cdCAgICAgICAgICAgIHZhciBsYXRpbjFDaGFycyA9IFtdO1xuXHQgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHNpZ0J5dGVzOyBpKyspIHtcblx0ICAgICAgICAgICAgICAgIHZhciBiaXRlID0gKHdvcmRzW2kgPj4+IDJdID4+PiAoMjQgLSAoaSAlIDQpICogOCkpICYgMHhmZjtcblx0ICAgICAgICAgICAgICAgIGxhdGluMUNoYXJzLnB1c2goU3RyaW5nLmZyb21DaGFyQ29kZShiaXRlKSk7XG5cdCAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICByZXR1cm4gbGF0aW4xQ2hhcnMuam9pbignJyk7XG5cdCAgICAgICAgfSxcblxuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIENvbnZlcnRzIGEgTGF0aW4xIHN0cmluZyB0byBhIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gbGF0aW4xU3RyIFRoZSBMYXRpbjEgc3RyaW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7V29yZEFycmF5fSBUaGUgd29yZCBhcnJheS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBzdGF0aWNcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIHdvcmRBcnJheSA9IENyeXB0b0pTLmVuYy5MYXRpbjEucGFyc2UobGF0aW4xU3RyaW5nKTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICBwYXJzZTogZnVuY3Rpb24gKGxhdGluMVN0cikge1xuXHQgICAgICAgICAgICAvLyBTaG9ydGN1dFxuXHQgICAgICAgICAgICB2YXIgbGF0aW4xU3RyTGVuZ3RoID0gbGF0aW4xU3RyLmxlbmd0aDtcblxuXHQgICAgICAgICAgICAvLyBDb252ZXJ0XG5cdCAgICAgICAgICAgIHZhciB3b3JkcyA9IFtdO1xuXHQgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IGxhdGluMVN0ckxlbmd0aDsgaSsrKSB7XG5cdCAgICAgICAgICAgICAgICB3b3Jkc1tpID4+PiAyXSB8PSAobGF0aW4xU3RyLmNoYXJDb2RlQXQoaSkgJiAweGZmKSA8PCAoMjQgLSAoaSAlIDQpICogOCk7XG5cdCAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICByZXR1cm4gbmV3IFdvcmRBcnJheS5pbml0KHdvcmRzLCBsYXRpbjFTdHJMZW5ndGgpO1xuXHQgICAgICAgIH1cblx0ICAgIH07XG5cblx0ICAgIC8qKlxuXHQgICAgICogVVRGLTggZW5jb2Rpbmcgc3RyYXRlZ3kuXG5cdCAgICAgKi9cblx0ICAgIHZhciBVdGY4ID0gQ19lbmMuVXRmOCA9IHtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb252ZXJ0cyBhIHdvcmQgYXJyYXkgdG8gYSBVVEYtOCBzdHJpbmcuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge1dvcmRBcnJheX0gd29yZEFycmF5IFRoZSB3b3JkIGFycmF5LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7c3RyaW5nfSBUaGUgVVRGLTggc3RyaW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHN0YXRpY1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICB2YXIgdXRmOFN0cmluZyA9IENyeXB0b0pTLmVuYy5VdGY4LnN0cmluZ2lmeSh3b3JkQXJyYXkpO1xuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHN0cmluZ2lmeTogZnVuY3Rpb24gKHdvcmRBcnJheSkge1xuXHQgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgcmV0dXJuIGRlY29kZVVSSUNvbXBvbmVudChlc2NhcGUoTGF0aW4xLnN0cmluZ2lmeSh3b3JkQXJyYXkpKSk7XG5cdCAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignTWFsZm9ybWVkIFVURi04IGRhdGEnKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb252ZXJ0cyBhIFVURi04IHN0cmluZyB0byBhIHdvcmQgYXJ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gICAgICAgLyoqXG5cdCAgICAgICAgICogUmVzZXRzIHRoaXMgYmxvY2sgYWxnb3JpdGhtJ3MgZGF0YSBidWZmZXIgdG8gaXRzIGluaXRpYWwgc3RhdGUuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIGJ1ZmZlcmVkQmxvY2tBbGdvcml0aG0ucmVzZXQoKTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICByZXNldDogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAvLyBJbml0aWFsIHZhbHVlc1xuXHQgICAgICAgICAgICB0aGlzLl9kYXRhID0gbmV3IFdvcmRBcnJheS5pbml0KCk7XG5cdCAgICAgICAgICAgIHRoaXMuX25EYXRhQnl0ZXMgPSAwO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBBZGRzIG5ldyBkYXRhIHRvIHRoaXMgYmxvY2sgYWxnb3JpdGhtJ3MgYnVmZmVyLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHBhcmFtIHtXb3JkQXJyYXl8c3RyaW5nfSBkYXRhIFRoZSBkYXRhIHRvIGFwcGVuZC4gU3RyaW5ncyBhcmUgY29udmVydGVkIHRvIGEgV29yZEFycmF5IHVzaW5nIFVURi04LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICBidWZmZXJlZEJsb2NrQWxnb3JpdGhtLl9hcHBlbmQoJ2RhdGEnKTtcblx0ICAgICAgICAgKiAgICAgYnVmZmVyZWRCbG9ja0FsZ29yaXRobS5fYXBwZW5kKHdvcmRBcnJheSk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgX2FwcGVuZDogZnVuY3Rpb24gKGRhdGEpIHtcblx0ICAgICAgICAgICAgLy8gQ29udmVydCBzdHJpbmcgdG8gV29yZEFycm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gICAgICAgeSA9IG5ld1k7XG5cdCAgICAgICAgfVxuXG5cdCAgICAgICAgLy8gQ29tcHV0ZSBwaSBpbmRleCBjb25zdGFudHNcblx0ICAgICAgICBmb3IgKHZhciB4ID0gMDsgeCA8IDU7IHgrKykge1xuXHQgICAgICAgICAgICBmb3IgKHZhciB5ID0gMDsgeSA8IDU7IHkrKykge1xuXHQgICAgICAgICAgICAgICAgUElfSU5ERVhFU1t4ICsgNSAqIHldID0geSArICgoMiAqIHggKyAzICogeSkgJSA1KSAqIDU7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cblx0ICAgICAgICAvLyBDb21wdXRlIHJvdW5kIGNvbnN0YW50c1xuXHQgICAgICAgIHZhciBMRlNSID0gMHgwMTtcblx0ICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IDI0OyBpKyspIHtcblx0ICAgICAgICAgICAgdmFyIHJvdW5kQ29uc3RhbnRNc3cgPSAwO1xuXHQgICAgICAgICAgICB2YXIgcm91bmRDb25zdGFudExzdyA9IDA7XG5cblx0ICAgICAgICAgICAgZm9yICh2YXIgaiA9IDA7IGogPCA3OyBqKyspIHtcblx0ICAgICAgICAgICAgICAgIGlmIChMRlNSICYgMHgwMSkge1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBiaXRQb3NpdGlvbiA9ICgxIDw8IGopIC0gMTtcblx0ICAgICAgICAgICAgICAgICAgICBpZiAoYml0UG9zaXRpb24gPCAzMikge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICByb3VuZENvbnN0YW50THN3IF49IDEgPDwgYml0UG9zaXRpb247XG5cdCAgICAgICAgICAgICAgICAgICAgfSBlbHNlIC8qIGlmIChiaXRQb3NpdGlvbiA+PSAzMikgKi8ge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICByb3VuZENvbnN0YW50TXN3IF49IDEgPDwgKGJpdFBvc2l0aW9uIC0gMzIpO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICAgICAgLy8gQ29tcHV0ZSBuZXh0IExGU1Jcblx0ICAgICAgICAgICAgICAgIGlmIChMRlNSICYgMHg4MCkge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIFByaW1pdGl2ZSBwb2x5bm9taWFsIG92ZXIgR0YoMik6IHheOCArIHheNiArIHheNSArIHheNCArIDFcblx0ICAgICAgICAgICAgICAgICAgICBMRlNSID0gKExGU1IgPDwgMSkgXiAweDcxO1xuXHQgICAgICAgICAgICAgICAgfSBlbHNlIHtcblx0ICAgICAgICAgICAgICAgICAgICBMRlNSIDw8PSAxO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgUk9VTkRfQ09OU1RBTlRTW2ldID0gWDY0V29yZC5jcmVhdGUocm91bmRDb25zdGFudE1zdywgcm91bmRDb25zdGFudExzdyk7XG5cdCAgICAgICAgfVxuXHQgICAgfSgpKTtcblxuXHQgICAgLy8gUmV1c2FibGUgb2JqZWN0cyBmb3IgdGVtcG9yYXJ5IHZhbHVlc1xuXHQgICAgdmFyIFQgPSBbXTtcblx0ICAgIChmdW5jdGlvbiAoKSB7XG5cdCAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCAyNTsgaSsrKSB7XG5cdCAgICAgICAgICAgIFRbaV0gPSBYNjRXb3JkLmNyZWF0ZSgpO1xuXHQgICAgICAgIH1cblx0ICAgIH0oKSk7XG5cblx0ICAgIC8qKlxuXHQgICAgICogU0hBLTMgaGFzaCBhbGdvcml0aG0uXG5cdCAgICAgKi9cblx0ICAgIHZhciBTSEEzID0gQ19hbGdvLlNIQTMgPSBIYXNoZXIuZXh0ZW5kKHtcblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb25maWd1cmF0aW9uIG9wdGlvbnMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcHJvcGVydHkge251bWJlcn0gb3V0cHV0TGVuZ3RoXG5cd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AgICAgICAgICAgIHZhciBNMmkgID0gTVtvZmZzZXQgKyAyICogaV07XG5cdCAgICAgICAgICAgICAgICB2YXIgTTJpMSA9IE1bb2Zmc2V0ICsgMiAqIGkgKyAxXTtcblxuXHQgICAgICAgICAgICAgICAgLy8gU3dhcCBlbmRpYW5cblx0ICAgICAgICAgICAgICAgIE0yaSA9IChcblx0ICAgICAgICAgICAgICAgICAgICAoKChNMmkgPDwgOCkgIHwgKE0yaSA+Pj4gMjQpKSAmIDB4MDBmZjAwZmYpIHxcblx0ICAgICAgICAgICAgICAgICAgICAoKChNMmkgPDwgMjQpIHwgKE0yaSA+Pj4gOCkpICAmIDB4ZmYwMGZmMDApXG5cdCAgICAgICAgICAgICAgICApO1xuXHQgICAgICAgICAgICAgICAgTTJpMSA9IChcblx0ICAgICAgICAgICAgICAgICAgICAoKChNMmkxIDw8IDgpICB8IChNMmkxID4+PiAyNCkpICYgMHgwMGZmMDBmZikgfFxuXHQgICAgICAgICAgICAgICAgICAgICgoKE0yaTEgPDwgMjQpIHwgKE0yaTEgPj4+IDgpKSAgJiAweGZmMDBmZjAwKVxuXHQgICAgICAgICAgICAgICAgKTtcblxuXHQgICAgICAgICAgICAgICAgLy8gQWJzb3JiIG1lc3NhZ2UgaW50byBzdGF0ZVxuXHQgICAgICAgICAgICAgICAgdmFyIGxhbmUgPSBzdGF0ZVtpXTtcblx0ICAgICAgICAgICAgICAgIGxhbmUuaGlnaCBePSBNMmkxO1xuXHQgICAgICAgICAgICAgICAgbGFuZS5sb3cgIF49IE0yaTtcblx0ICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgIC8vIFJvdW5kc1xuXHQgICAgICAgICAgICBmb3IgKHZhciByb3VuZCA9IDA7IHJvdW5kIDwgMjQ7IHJvdW5kKyspIHtcblx0ICAgICAgICAgICAgICAgIC8vIFRoZXRhXG5cdCAgICAgICAgICAgICAgICBmb3IgKHZhciB4ID0gMDsgeCA8IDU7IHgrKykge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIE1peCBjb2x1bW4gbGFuZXNcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgdE1zdyA9IDAsIHRMc3cgPSAwO1xuXHQgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHkgPSAwOyB5IDwgNTsgeSsrKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsYW5lID0gc3RhdGVbeCArIDUgKiB5XTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdE1zdyBePSBsYW5lLmhpZ2g7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRMc3cgXj0gbGFuZS5sb3c7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gVGVtcG9yYXJ5IHZhbHVlc1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBUeCA9IFRbeF07XG5cdCAgICAgICAgICAgICAgICAgICAgVHguaGlnaCA9IHRNc3c7XG5cdCAgICAgICAgICAgICAgICAgICAgVHgubG93ICA9IHRMc3c7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBmb3IgKHZhciB4ID0gMDsgeCA8IDU7IHgrKykge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIFNob3J0Y3V0c1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBUeDQgPSBUWyh4ICsgNCkgJSA1XTtcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgVHgxID0gVFsoeCArIDEpICUgNV07XG5cdCAgICAgICAgICAgICAgICAgICAgdmFyIFR4MU1zdyA9IFR4MS5oaWdoO1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBUeDFMc3cgPSBUeDEubG93O1xuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gTWl4IHN1cnJvdW5kaW5nIGNvbHVtbnNcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgdE1zdyA9IFR4NC5oaWdoIF4gKChUeDFNc3cgPDwgMSkgfCAoVHgxTHN3ID4+PiAzMSkpO1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciB0THN3ID0gVHg0LmxvdyAgXiAoKFR4MUxzdyA8PCAxKSB8IChUeDFNc3cgPj4+IDMxKSk7XG5cdCAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgeSA9IDA7IHkgPCA1OyB5KyspIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxhbmUgPSBzdGF0ZVt4ICsgNSAqIHldO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBsYW5lLmhpZ2ggXj0gdE1zdztcblx0ICAgICAgICAgICAgICAgICAgICAgICAgbGFuZS5sb3cgIF49IHRMc3c7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAvLyBSaG8gUGlcblx0ICAgICAgICAgICAgICAgIGZvciAodmFyIGxhbmVJbmRleCA9IDE7IGxhbmVJbmRleCA8IDI1OyBsYW5lSW5kZXgrKykge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIFNob3J0Y3V0c1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBsYW5lID0gc3RhdGVbbGFuZUluZGV4XTtcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgbGFuZU1zdyA9IGxhbmUuaGlnaDtcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgbGFuZUxzdyA9IGxhbmUubG93O1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciByaG9PZmZzZXQgPSBSSE9fT0ZGU0VUU1tsYW5lSW5kZXhdO1xuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gUm90YXRlIGxhbmVzXG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKHJob09mZnNldCA8IDMyKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0TXN3ID0gKGxhbmVNc3cgPDwgcmhvT2Zmc2V0KSB8IChsYW5lTHN3ID4+PiAoMzIgLSByaG9PZmZzZXQpKTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRMc3cgPSAobGFuZUxzdyA8PCByaG9PZmZzZXQpIHwgKGxhbmVNc3cgPj4+ICgzMiAtIHJob09mZnNldCkpO1xuXHQgICAgICAgICAgICAgICAgICAgIH0gZWxzZSAvKiBpZiAocmhvT2Zmc2V0ID49IDMyKSAqLyB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0TXN3ID0gKGxhbmVMc3cgPDwgKHJob09mZnNldCAtIDMyKSkgfCAobGFuZU1zdyA+Pj4gKDY0IC0gcmhvT2Zmc2V0KSk7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0THN3ID0gKGxhbmVNc3cgPDwgKHJob09mZnNldCAtIDMyKSkgfCAobGFuZUxzdyA+Pj4gKDY0IC0gcmhvT2Zmc2V0KSk7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gVHJhbnNwb3NlIGxhbmVzXG5cdCAgICAgICAgICAgICAgICAgICAgdmFyIFRQaUxhbmUgPSBUW1BJX0lOREVYRVNbbGFuZUluZGV4XV07XG5cdCAgICAgICAgICAgICAgICAgICAgVFBpTGFuZS5oaWdoID0gdE1zdztcblx0ICAgICAgICAgICAgICAgICAgICBUUGlMYW5lLmxvdyAgPSB0THN3O1xuXHQgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAvLyBSaG8gcGkgYXQgeCA9IHkgPSAwXG5cdCAgICAgICAgICAgICAgICB2YXIgVDAgPSBUWzBdO1xuXHQgICAgICAgICAgICAgICAgdmFyIHN0YXRlMCA9IHN0YXRlWzBdO1xuXHQgICAgICAgICAgICAgICAgVDAuaGlnaCA9IHN0YXRlMC5oaWdoO1xuXHQgICAgICAgICAgICAgICAgVDAubG93ICA9IHN0YXRlMC5sb3c7XG5cblx0ICAgICAgICAgICAgICAgIC8vIENoaVxuXHQgICAgICAgICAgICAgICAgZm9yICh2YXIgeCA9IDA7IHggPCA1OyB4KyspIHtcblx0ICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB5ID0gMDsgeSA8IDU7IHkrKykge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICAvLyBTaG9ydGN1dHNcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxhbmVJbmRleCA9IHggKyA1ICogeTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxhbmUgPSBzdGF0ZVtsYW5lSW5kZXhdO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVExhbmUgPSBUW2xhbmVJbmRleF07XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciBUeDFMYW5lID0gVFsoKHggKyAxKSAlIDUpICsgNSAqIHldO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVHgyTGFuZSA9IFRbKCh4ICsgMikgJSA1KSArIDUgKiB5XTtcblxuXHQgICAgICAgICAgICAgICAgICAgICAgICAvLyBNaXggcm93c1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBsYW5lLmhpZ2ggPSBUTGFuZS5oaWdoIF4gKH5UeDFMYW5lLmhpZ2ggJiBUeDJMYW5lLmhpZ2gpO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBsYW5lLmxvdyAgPSBUTGFuZS5sb3cgIF4gKH5UeDFMYW5lLmxvdyAgJiBUeDJMYW5lLmxvdyk7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAvLyBJb3RhXG5cdCAgICAgICAgICAgICAgICB2YXIgbGFuZSA9IHN0YXRlWzBdO1xuXHQgICAgICAgICAgICAgICAgdmFyIHJvdW5kQ29uc3RhbnQgPSBST1VORF9DT05TVEFOVFNbcm91bmRdO1xuXHQgICAgICAgICAgICAgICAgbGFuZS5oaWdoIF49IHJvdW5kQ29uc3RhbnQuaGlnaDtcblx0ICAgICAgICAgICAgICAg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y5vdXRwdXRMZW5ndGggLyA4O1xuXHQgICAgICAgICAgICB2YXIgb3V0cHV0TGVuZ3RoTGFuZXMgPSBvdXRwdXRMZW5ndGhCeXRlcyAvIDg7XG5cblx0ICAgICAgICAgICAgLy8gU3F1ZWV6ZVxuXHQgICAgICAgICAgICB2YXIgaGFzaFdvcmRzID0gW107XG5cdCAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgb3V0cHV0TGVuZ3RoTGFuZXM7IGkrKykge1xuXHQgICAgICAgICAgICAgICAgLy8gU2hvcnRjdXRzXG5cdCAgICAgICAgICAgICAgICB2YXIgbGFuZSA9IHN0YXRlW2ldO1xuXHQgICAgICAgICAgICAgICAgdmFyIGxhbmVNc3cgPSBsYW5lLmhpZ2g7XG5cdCAgICAgICAgICAgICAgICB2YXIgbGFuZUxzdyA9IGxhbmUubG93O1xuXG5cdCAgICAgICAgICAgICAgICAvLyBTd2FwIGVuZGlhblxuXHQgICAgICAgICAgICAgICAgbGFuZU1zdyA9IChcblx0ICAgICAgICAgICAgICAgICAgICAoKChsYW5lTXN3IDw8IDgpICB8IChsYW5lTXN3ID4+PiAyNCkpICYgMHgwMGZmMDBmZikgfFxuXHQgICAgICAgICAgICAgICAgICAgICgoKGxhbmVNc3cgPDwgMjQpIHwgKGxhbmVNc3cgPj4+IDgpKSAgJiAweGZmMDBmZjAwKVxuXHQgICAgICAgICAgICAgICAgKTtcblx0ICAgICAgICAgICAgICAgIGxhbmVMc3cgPSAoXG5cdCAgICAgICAgICAgICAgICAgICAgKCgobGFuZUxzdyA8PCA4KSAgfCAobGFuZUxzdyA+Pj4gMjQpKSAmIDB4MDBmZjAwZmYpIHxcblx0ICAgICAgICAgICAgICAgICAgICAoKChsYW5lTHN3IDw8IDI0KSB8IChsYW5lTHN3ID4+PiA4KSkgICYgMHhmZjAwZmYwMClcblx0ICAgICAgICAgICAgICAgICk7XG5cblx0ICAgICAgICAgICAgICAgIC8vIFNxdWVlemUgc3RhdGUgdG8gc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ZXcgeDY0LVdvcmQgb2JqZWN0IGFmdGVyIHNoaWZ0aW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICB2YXIgc2hpZnRlZCA9IHg2NFdvcmQuc2hpZnRMKDI1KTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICAvLyBzaGlmdEw6IGZ1bmN0aW9uIChuKSB7XG5cdCAgICAgICAgICAgIC8vIGlmIChuIDwgMzIpIHtcblx0ICAgICAgICAgICAgICAgIC8vIHZhciBoaWdoID0gKHRoaXMuaGlnaCA8PCBuKSB8ICh0aGlzLmxvdyA+Pj4gKDMyIC0gbikpO1xuXHQgICAgICAgICAgICAgICAgLy8gdmFyIGxvdyA9IHRoaXMubG93IDw8IG47XG5cdCAgICAgICAgICAgIC8vIH0gZWxzZSB7XG5cdCAgICAgICAgICAgICAgICAvLyB2YXIgaGlnaCA9IHRoaXMubG93IDw8IChuIC0gMzIpO1xuXHQgICAgICAgICAgICAgICAgLy8gdmFyIGxvdyA9IDA7XG5cdCAgICAgICAgICAgIC8vIH1cblxuXHQgICAgICAgICAgICAvLyByZXR1cm4gWDY0V29yZC5jcmVhdGUoaGlnaCwgbG93KTtcblx0ICAgICAgICAvLyB9LFxuXG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogU2hpZnRzIHRoaXMgd29yZCBuIGJpdHMgdG8gdGhlIHJpZ2h0LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHBhcmFtIHtudW1iZXJ9IG4gVGhlIG51bWJlciBvZiBiaXRzIHRvIHNoaWZ0LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7WDY0V29yZH0gQSBuZXcgeDY0LVdvcmQgb2JqZWN0IGFmdGVyIHNoaWZ0aW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIC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dCAgICAgICAgICogQHBhcmFtIHtudW1iZXJ9IHNpZ0J5dGVzIChPcHRpb25hbCkgVGhlIG51bWJlciBvZiBzaWduaWZpY2FudCBieXRlcyBpbiB0aGUgd29yZHMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB3b3JkQXJyYXkgPSBDcnlwdG9KUy54NjQuV29yZEFycmF5LmNyZWF0ZSgpO1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB3b3JkQXJyYXkgPSBDcnlwdG9KUy54NjQuV29yZEFycmF5LmNyZWF0ZShbXG5cdCAgICAgICAgICogICAgICAgICBDcnlwdG9KUy54NjQuV29yZC5jcmVhdGUoMHgwMDAxMDIwMywgMHgwNDA1MDYwNyksXG5cdCAgICAgICAgICogICAgICAgICBDcnlwdG9KUy54NjQuV29yZC5jcmVhdGUoMHgxODE5MWExYiwgMHgxYzFkMWUxZilcblx0ICAgICAgICAgKiAgICAgXSk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIHdvcmRBcnJheSA9IENyeXB0b0pTLng2NC5Xb3JkQXJyYXkuY3JlYXRlKFtcblx0ICAgICAgICAgKiAgICAgICAgIENyeXB0b0pTLng2NC5Xb3JkLmNyZWF0ZSgweDAwMDEwMjAzLCAweDA0MDUwNjA3KSxcblx0ICAgICAgICAgKiAgICAgICAgIENyeXB0b0pTLng2NC5Xb3JkLmNyZWF0ZSgweDE4MTkxYTFiLCAweDFjMWQxZTFmKVxuXHQgICAgICAgICAqICAgICBdLCAxMCk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgaW5pdDogZnVuY3Rpb24gKHdvcmRzLCBzaWdCeXRlcykge1xuXHQgICAgICAgICAgICB3b3JkcyA9IHRoaXMud29yZHMgPSB3b3JkcyB8fCBbXTtcblxuXHQgICAgICAgICAgICBpZiAoc2lnQnl0ZXMgIT0gdW5kZWZpbmVkKSB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnNpZ0J5dGVzID0gc2lnQnl0ZXM7XG5cdCAgICAgICAgICAgIH0gZWxzZSB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnNpZ0J5dGVzID0gd29yZHMubGVuZ3RoICogODtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb252ZXJ0cyB0aGlzIDY0LWJpdCB3b3JkIGFycmF5IHRvIGEgMzItYml0IHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtDcnlwdG9KUy5saWIuV29yZEFycmF5fSBUaGlzIHdvcmQgYXJyYXkncyBkYXRhIGFzIGEgMzItYml0IHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB4MzJXb3JkQXJyYXkgPSB4NjRXb3JkQXJyYXkudG9YMzIoKTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0b1gzMjogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAvLyBTaG9ydGN1dHNcblx0ICAgICAgICAgICAgdmFyIHg2NFdvcmRzID0gdGhpcy53b3Jkcztcblx0ICAgICAgICAgICAgdmFyIHg2NFdvcmRzTGVuZ3RoID0geDY0V29yZHMubGVuZ3RoO1xuXG5cdCAgICAgICAgICAgIC8vIENvbnZlcnRcblx0ICAgICAgICAgICAgdmFyIHgzMldvcmRzID0gW107XG5cdCAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgeDY0V29yZHNMZW5ndGg7IGkrKykge1xuXHQgICAgICAgICAgICAgICAgdmFyIHg2NFdvcmQgPSB4NjRXb3Jkc1tpXTtcblx0ICAgICAgICAgICAgICAgIHgzMldvcmRzLnB1c2goeDY0V29yZC5oaWdoKTtcblx0ICAgICAgICAgICAgICAgIHgzMldvcmRzLnB1c2goeDY0V29yZC5sb3cpO1xuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgcmV0dXJuIFgzMldvcmRBcnJheS5jcmVhdGUoeDMyV29yZHMsIHRoaXMuc2lnQnl0ZXMpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDcmVhdGVzIGEgY29weSBvZiB0aGlzIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtYNjRXb3JkQXJyYXl9IFRoZSBjbG9uZS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIGNsb25lID0geDY0V29yZEFycmF5LmNsb25lKCk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgdmFyIGNsb25lID0gQmFzZS5jbG9uZS5jYWxsKHRoaXMpO1xuXG5cdCAgICAgICAgICAgIC8vIENsb25lIFwid29yZHNcIiBhcnJheVxuXHQgICAgICAgICAgICB2YXIgd29yZHMgPSBjbG9uZS53b3JkcyA9IHRoaXMud29yZHMuc2xpY2UoMCk7XG5cblx0ICAgICAgICAgICAgLy8gQ2xvbmUgZWFjaCBYNjRXb3JkIG9iamVjdFxuXHQgICAgICAgICAgICB2YXIgd29yZHNMZW5ndGggPSB3b3Jkcy5sZW5ndGg7XG5cdCAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgd29yZHNMZW5ndGg7IGkrKykge1xuXHQgICAgICAgICAgICAgICAgd29yZHNbaV0gPSB3b3Jkc1tpXS5jbG9uZSgpO1xuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgcmV0dXJuIGNsb25lO1xuXHQgICAgICAgIH1cblx0ICAgIH0pO1xuXHR9KCkpO1xuXG5cblx0cmV0dXJuIENyeXB0b0pTO1xuXG59KSk7IiwiJ3VzZSBzdHJpY3QnO1xuXG5tb2R1bGUuZXhwb3J0cyA9IEJpZ051bWJlcjsgLy8ganNoaW50IGlnbm9yZTpsaW5lXG5cbiIsInZhciB3ZWIzID0gcmVxdWlyZSgnLi9saWIvd2ViMycpO1xud2ViMy5wcm92aWRlcnMuSHR0cFByb3ZpZGVyID0gcmVxdWlyZSgnLi9saWIvd2ViMy9odHRwcHJvdmlkZXInKTtcbndlYjMucHJvdmlkZXJzLlF0U3luY1Byb3ZpZGVyID0gcmVxdWlyZSgnLi9saWIvd2ViMy9xdHN5bmMnKTtcbndlYjMuZXRoLmNvbnRyYWN0ID0gcmVxdWlyZSgnLi9saWIvd2ViMy9jb250cmFjdCcpO1xud2ViMy5ldGgubmFtZXJlZyA9IHJlcXVpcmUoJy4vbGliL3dlYjMvbmFtZXJlZycpO1xud2ViMy5ldGguc2VuZElCQU5UcmFuc2FjdGlvbiA9IHJlcXVpcmUoJy4vbGliL3dlYjMvdHJhbnNmZXInKTtcblxuLy8gZG9udCBvdmVycmlkZSBnbG9iYWwgdmFyaWFibGVcbmlmICh0eXBlb2Ygd2luZG93ICE9PSAndW5kZWZpbmVkJyAmJiB0eXBlb2Ygd2luZG93LndlYjMgPT09ICd1bmRlZmluZWQnKSB7XG4gICAgd2luZG93LndlYjMgPSB3ZWIzO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHdlYjM7XG5cbiJdfQ== +//# sourceMappingURL=web3-light.js.map diff --git a/dist/web3-light.min.js b/dist/web3-light.min.js index ea9ef2bba..3c20171ea 100644 --- a/dist/web3-light.min.js +++ b/dist/web3-light.min.js @@ -1,2 +1,2 @@ -require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var p=n[a]={exports:{}};e[a][0].call(p.exports,function(t){var n=e[a][1][t];return o(n?n:t)},p,p.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ai;i+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(i+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var o=n._requireType(t),i=o.sliceParam(e,r,t);return o.formatOutput(i,s(t))})};var p=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:i.formatInputBool,outputFormatter:i.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:i.formatInputDynamicBytes,outputFormatter:i.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:i.formatInputBytes,outputFormatter:i.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputUReal})]);e.exports=p},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){var e=2*i.ETH_PADDING;r.config(i.ETH_BIGNUMBER_ROUNDING_MODE);var n=o.padLeft(o.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},p=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},l=function(t){return s(new r(t).times(new r(2).pow(128)))},f=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},m=function(t){var e=t.staticPart()||"0";return f(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},h=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return o.toAscii(t.staticPart())},b=function(t){return o.toAscii(t.dynamicPart().slice(64))},w=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:p,formatInputReal:l,formatOutputInt:m,formatOutputUInt:h,formatOutputReal:d,formatOutputUReal:y,formatOutputBool:g,formatOutputBytes:v,formatOutputDynamicBytes:b,formatOutputAddress:w}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},o.decodeParam=function(t,e){return e=e||0,new o(t.substr(64*e,64))};var i=function(t,e){return parseInt("0x"+t.substr(64*e,64))};o.decodeBytes=function(t,e){e=e||0;var n=i(t,e);return new o(t.substr(2*n,128),0)},o.decodeArray=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return new o(t.substr(2*n,64*(r+1)),0)},e.exports=o},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),o=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:o,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),o=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),o(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),o={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);if(0===o)break;e+=String.fromCharCode(o)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+o.encodeParams(this._inputTypes,t),e},s.prototype.signature=function(){return a(this._name).slice(0,8)},s.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=o.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},s.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);if(!e){var o=r.eth.call(n);return this.unpackOutput(o)}var i=this;r.eth.call(n,function(t,n){e(t,i.unpackOutput(n))})},s.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},s.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},s.prototype.displayName=function(){return i.extractDisplayName(this._name)},s.prototype.typeName=function(){return i.extractTypeName(this._name)},s.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},s.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},s.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=s},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,o=t("./errors"),i=function(t){this.host=t||"http://localhost:8545"};i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1);try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(i)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0);try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[], -type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),o=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};o.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},o.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},o.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[o("get",r)]=this.getAsync.bind(this)},o.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},o.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=o},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls=[],this.timeout=null,void this.poll())};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t},s.prototype.startPolling=function(t,e,n,r){this.polls.push({data:t,id:e,callback:n,uninstall:r})},s.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},s.prototype.reset=function(){this.polls.forEach(function(t){t.uninstall(t.id)}),this.polls=[],this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),this.polls.length){if(!this.provider)return void console.error(a.InvalidProvider());var t=r.getInstance().toBatchPayload(this.polls.map(function(t){return t.data})),e=this;this.provider.sendAsync(t,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){return t.callback=e.polls[n].callback,t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),p=[i,a,s,u,c];e.exports={methods:p}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.pop(),this.params=0,"eth_newBlockFilter";case"pending":return t.pop(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},p=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,p=t.min(4*c,o);if(c){for(var l=0;c>l;l+=a)this._doProcessBlock(r,l);var f=r.splice(0,c);n.sigBytes-=p}return new i.init(f,p)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),l=(r.Hasher=p.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new l.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],p=[],l=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)p[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,f=0,m=0;7>m;m++){if(1&i){var h=(1<h?f^=1<t;t++)f[t]=s.create()}();var m=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var m=0;5>m;m++){for(var h=0,d=0,y=0;5>y;y++){var s=n[m+5*y];h^=s.high,d^=s.low}var g=f[m];g.high=h,g.low=d}for(var m=0;5>m;m++)for(var v=f[(m+4)%5],b=f[(m+1)%5],w=b.high,_=b.low,h=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),y=0;5>y;y++){var s=n[m+5*y];s.high^=h,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,B=s.low,I=c[x];if(32>I)var h=F<>>32-I,d=B<>>32-I;else var h=B<>>64-I,d=F<>>64-I;var N=f[p[x]];N.high=h,N.low=d}var k=f[0],A=n[0];k.high=A.high,k.low=A.low;for(var m=0;5>m;m++)for(var y=0;5>y;y++){var x=m+5*y,s=n[x],P=f[x],O=f[(m+1)%5+5*y],T=f[(m+2)%5+5*y];s.high=P.high^~O.high&T.high,s.low=P.low^~O.low&T.low}var s=n[0],D=l[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],p=0;u>p;p++){var l=a[p],f=l.high,m=l.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),c.push(m),c.push(f)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(m),n.HmacSHA3=i._createHmacHelper(m)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){"use strict";e.exports=BigNumber},{}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file +require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ai;i+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(i+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var o=n._requireType(t),i=o.sliceParam(e,r,t);return o.formatOutput(i,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:i.formatInputBool,outputFormatter:i.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:i.formatInputDynamicBytes,outputFormatter:i.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:i.formatInputBytes,outputFormatter:i.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){var e=2*i.ETH_PADDING;r.config(i.ETH_BIGNUMBER_ROUNDING_MODE);var n=o.padLeft(o.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},l=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},p=function(t){return s(new r(t).times(new r(2).pow(128)))},f=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},m=function(t){var e=t.staticPart()||"0";return f(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},h=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return o.toAscii(t.staticPart())},b=function(t){return o.toAscii(t.dynamicPart().slice(64))},w=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:l,formatInputReal:p,formatOutputInt:m,formatOutputUInt:h,formatOutputReal:d,formatOutputUReal:y,formatOutputBool:g,formatOutputBytes:v,formatOutputDynamicBytes:b,formatOutputAddress:w}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},o.decodeParam=function(t,e){return e=e||0,new o(t.substr(64*e,64))};var i=function(t,e){return parseInt("0x"+t.substr(64*e,64))};o.decodeBytes=function(t,e){e=e||0;var n=i(t,e);return new o(t.substr(2*n,128),0)},o.decodeArray=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return new o(t.substr(2*n,64*(r+1)),0)},e.exports=o},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),o=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:o,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),o=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),o(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),o={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);if(0===o)break;e+=String.fromCharCode(o)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&!i.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+o.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=o.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),o=this.toPayload(t);if(!e){var i=r.eth.call(o,n);return this.unpackOutput(i)}var a=this;r.eth.call(o,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return i.extractDisplayName(this._name)},u.prototype.typeName=function(){return i.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,o=t("./errors"),i=function(t){this.host=t||"http://localhost:8545"};i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(i)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function" +},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),o=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};o.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},o.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},o.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[o("get",r)]=this.getAsync.bind(this)},o.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},o.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=o},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[i,a,s,u,c];e.exports={methods:l}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,o);if(c){for(var p=0;c>p;p+=a)this._doProcessBlock(r,p);var f=r.splice(0,c);n.sigBytes-=l}return new i.init(f,l)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(r.Hasher=l.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new p.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],p=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,f=0,m=0;7>m;m++){if(1&i){var h=(1<h?f^=1<t;t++)f[t]=s.create()}();var m=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var m=0;5>m;m++){for(var h=0,d=0,y=0;5>y;y++){var s=n[m+5*y];h^=s.high,d^=s.low}var g=f[m];g.high=h,g.low=d}for(var m=0;5>m;m++)for(var v=f[(m+4)%5],b=f[(m+1)%5],w=b.high,_=b.low,h=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),y=0;5>y;y++){var s=n[m+5*y];s.high^=h,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,B=s.low,I=c[x];if(32>I)var h=F<>>32-I,d=B<>>32-I;else var h=B<>>64-I,d=F<>>64-I;var k=f[l[x]];k.high=h,k.low=d}var N=f[0],P=n[0];N.high=P.high,N.low=P.low;for(var m=0;5>m;m++)for(var y=0;5>y;y++){var x=m+5*y,s=n[x],A=f[x],O=f[(m+1)%5+5*y],T=f[(m+2)%5+5*y];s.high=A.high^~O.high&T.high,s.low=A.low^~O.low&T.low}var s=n[0],D=p[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var p=a[l],f=p.high,m=p.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),c.push(m),c.push(f)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(m),n.HmacSHA3=i._createHmacHelper(m)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){"use strict";e.exports=BigNumber},{}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file diff --git a/dist/web3.js b/dist/web3.js index 2ff72ea6c..7b495b48e 100644 --- a/dist/web3.js +++ b/dist/web3.js @@ -799,7 +799,7 @@ module.exports = { ETH_SIGNATURE_LENGTH: 4, ETH_UNITS: ETH_UNITS, ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }, - ETH_POLLING_TIMEOUT: 1000, + ETH_POLLING_TIMEOUT: 1000/2, defaultBlock: 'latest', defaultAccount: undefined }; @@ -1348,7 +1348,7 @@ module.exports = { },{"bignumber.js":"bignumber.js"}],8:[function(require,module,exports){ module.exports={ - "version": "0.5.0" + "version": "0.6.0" } },{}],9:[function(require,module,exports){ @@ -1447,8 +1447,7 @@ web3.eth.filter = function (fil, eventParams, options, formatter) { return fil(eventParams, options); } - // what outputLogFormatter? that's wrong - //return new Filter(fil, watches.eth(), formatters.outputLogFormatter); + // output logs works for blockFilter and pendingTransaction filters? return new Filter(fil, watches.eth(), formatter || formatters.outputLogFormatter); }; /*jshint maxparams:3 */ @@ -1503,6 +1502,23 @@ Object.defineProperty(web3.eth, 'defaultAccount', { } }); + +// EXTEND +web3._extend = function(extension){ + /*jshint maxcomplexity: 6 */ + + if(extension.property && !web3[extension.property]) + web3[extension.property] = {}; + + setupMethods(web3[extension.property] || web3, extension.methods || []); + setupProperties(web3[extension.property] || web3, extension.properties || []); +}; +web3._extend.formatters = formatters; +web3._extend.utils = utils; +web3._extend.Method = require('./web3/method'); +web3._extend.Property = require('./web3/property'); + + /// setups all api methods setupProperties(web3, web3Properties); setupMethods(web3.net, net.methods); @@ -1515,7 +1531,7 @@ setupMethods(web3.shh, shh.methods); module.exports = web3; -},{"./utils/config":5,"./utils/sha3":6,"./utils/utils":7,"./version.json":8,"./web3/batch":10,"./web3/db":12,"./web3/eth":14,"./web3/filter":16,"./web3/formatters":17,"./web3/net":24,"./web3/property":25,"./web3/requestmanager":27,"./web3/shh":28,"./web3/watches":30}],10:[function(require,module,exports){ +},{"./utils/config":5,"./utils/sha3":6,"./utils/utils":7,"./version.json":8,"./web3/batch":10,"./web3/db":12,"./web3/eth":14,"./web3/filter":16,"./web3/formatters":17,"./web3/method":22,"./web3/net":24,"./web3/property":25,"./web3/requestmanager":27,"./web3/shh":28,"./web3/watches":30}],10:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2409,21 +2425,36 @@ var getOptions = function (options) { }; }; -var Filter = function (options, methods, formatter) { - var implementation = {}; - methods.forEach(function (method) { - method.attachToObject(implementation); - }); - this.options = getOptions(options); - this.implementation = implementation; - this.callbacks = []; - this.formatter = formatter; - this.filterId = this.implementation.newFilter(this.options); +/** +Adds the callback and sets up the methods, to iterate over the results. + +@method getLogsAtStart +@param {Object} self +@param {funciton} +*/ +var getLogsAtStart = function(self, callback){ + // call getFilterLogs for the first watch callback start + if (!utils.isString(self.options)) { + self.get(function (err, messages) { + // don't send all the responses to all the watches again... just to self one + if (err) { + callback(err); + } + + messages.forEach(function (message) { + callback(null, message); + }); + }); + } }; -Filter.prototype.watch = function (callback) { - this.callbacks.push(callback); - var self = this; +/** +Adds the callback and sets up the methods, to iterate over the results. + +@method pollFilter +@param {Object} self +*/ +var pollFilter = function(self) { var onMessage = function (error, messages) { if (error) { @@ -2440,29 +2471,55 @@ Filter.prototype.watch = function (callback) { }); }; - // call getFilterLogs on start - if (!utils.isString(this.options)) { - this.get(function (err, messages) { - // don't send all the responses to all the watches again... just to this one - if (err) { - callback(err); - } + RequestManager.getInstance().startPolling({ + method: self.implementation.poll.call, + params: [self.filterId], + }, self.filterId, onMessage, self.stopWatching.bind(self)); - messages.forEach(function (message) { - callback(null, message); +}; + +var Filter = function (options, methods, formatter) { + var self = this; + var implementation = {}; + methods.forEach(function (method) { + method.attachToObject(implementation); + }); + this.options = getOptions(options); + this.implementation = implementation; + this.callbacks = []; + this.pollFilters = []; + this.formatter = formatter; + this.implementation.newFilter(this.options, function(error, id){ + if(error) { + self.callbacks.forEach(function(callback){ + callback(error); }); - }); + } else { + self.filterId = id; + // get filter logs at start + self.callbacks.forEach(function(callback){ + getLogsAtStart(self, callback); + }); + pollFilter(self); + } + }); +}; + +Filter.prototype.watch = function (callback) { + this.callbacks.push(callback); + + if(this.filterId) { + getLogsAtStart(this, callback); + pollFilter(this); } - RequestManager.getInstance().startPolling({ - method: this.implementation.poll.call, - params: [this.filterId], - }, this.filterId, onMessage, this.stopWatching.bind(this)); + return this; }; Filter.prototype.stopWatching = function () { RequestManager.getInstance().stopPolling(this.filterId); - this.implementation.uninstallFilter(this.filterId); + // remove filter async + this.implementation.uninstallFilter(this.filterId, function(){}); this.callbacks = []; }; @@ -2484,6 +2541,8 @@ Filter.prototype.get = function (callback) { return self.formatter ? self.formatter(log) : log; }); } + + return this; }; module.exports = Filter; @@ -2581,8 +2640,10 @@ var inputTransactionFormatter = function (options){ * @returns {Object} transaction */ var outputTransactionFormatter = function (tx){ - tx.blockNumber = utils.toDecimal(tx.blockNumber); - tx.transactionIndex = utils.toDecimal(tx.transactionIndex); + if(tx.blockNumber !== null) + tx.blockNumber = utils.toDecimal(tx.blockNumber); + if(tx.transactionIndex !== null) + tx.transactionIndex = utils.toDecimal(tx.transactionIndex); tx.nonce = utils.toDecimal(tx.nonce); tx.gas = utils.toDecimal(tx.gas); tx.gasPrice = utils.toBigNumber(tx.gasPrice); @@ -2604,7 +2665,8 @@ var outputBlockFormatter = function(block) { block.gasUsed = utils.toDecimal(block.gasUsed); block.size = utils.toDecimal(block.size); block.timestamp = utils.toDecimal(block.timestamp); - block.number = utils.toDecimal(block.number); + if(block.number !== null) + block.number = utils.toDecimal(block.number); block.difficulty = utils.toBigNumber(block.difficulty); block.totalDifficulty = utils.toBigNumber(block.totalDifficulty); @@ -2627,13 +2689,12 @@ var outputBlockFormatter = function(block) { * @returns {Object} log */ var outputLogFormatter = function(log) { - if (log === null) { // 'pending' && 'latest' filters are nulls - return null; - } - - log.blockNumber = utils.toDecimal(log.blockNumber); - log.transactionIndex = utils.toDecimal(log.transactionIndex); - log.logIndex = utils.toDecimal(log.logIndex); + if(log.blockNumber !== null) + log.blockNumber = utils.toDecimal(log.blockNumber); + if(log.transactionIndex !== null) + log.transactionIndex = utils.toDecimal(log.transactionIndex); + if(log.logIndex !== null) + log.logIndex = utils.toDecimal(log.logIndex); return log; }; @@ -2735,6 +2796,7 @@ module.exports = { var web3 = require('../web3'); var coder = require('../solidity/coder'); var utils = require('../utils/utils'); +var formatters = require('./formatters'); var sha3 = require('../utils/sha3'); /** @@ -2758,6 +2820,12 @@ SolidityFunction.prototype.extractCallback = function (args) { } }; +SolidityFunction.prototype.extractDefaultBlock = function (args) { + if (args.length > this._inputTypes.length && !utils.isObject(args[args.length -1])) { + return formatters.inputDefaultBlockNumberFormatter(args.pop()); // modify the args array! + } +}; + /** * Should be used to create payload from arguments * @@ -2809,15 +2877,17 @@ SolidityFunction.prototype.unpackOutput = function (output) { SolidityFunction.prototype.call = function () { var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; }); var callback = this.extractCallback(args); + var defaultBlock = this.extractDefaultBlock(args); var payload = this.toPayload(args); + if (!callback) { - var output = web3.eth.call(payload); + var output = web3.eth.call(payload, defaultBlock); return this.unpackOutput(output); } var self = this; - web3.eth.call(payload, function (error, output) { + web3.eth.call(payload, defaultBlock, function (error, output) { callback(error, self.unpackOutput(output)); }); }; @@ -2936,7 +3006,7 @@ SolidityFunction.prototype.attachToContract = function (contract) { module.exports = SolidityFunction; -},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9}],19:[function(require,module,exports){ +},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(require,module,exports){ /* This file is part of ethereum.js. @@ -2974,6 +3044,7 @@ HttpProvider.prototype.send = function (payload) { var request = new XMLHttpRequest(); request.open('POST', this.host, false); + request.setRequestHeader('Content-type','application/json'); try { request.send(JSON.stringify(payload)); @@ -3017,7 +3088,8 @@ HttpProvider.prototype.sendAsync = function (payload, callback) { }; request.open('POST', this.host, true); - + request.setRequestHeader('Content-type','application/json'); + try { request.send(JSON.stringify(payload)); } catch(error) { @@ -3702,9 +3774,9 @@ var RequestManager = function (provider) { arguments.callee._singletonInstance = this; this.provider = provider; - this.polls = []; + this.polls = {}; this.timeout = null; - this.poll(); + this.isPolling = false; }; /** @@ -3799,6 +3871,11 @@ RequestManager.prototype.sendBatch = function (data, callback) { */ RequestManager.prototype.setProvider = function (p) { this.provider = p; + + if (this.provider && !this.isPolling) { + this.poll(); + this.isPolling = true; + } }; /*jshint maxparams:4 */ @@ -3815,7 +3892,7 @@ RequestManager.prototype.setProvider = function (p) { * @todo cleanup number of params */ RequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) { - this.polls.push({data: data, id: pollId, callback: callback, uninstall: uninstall}); + this.polls['poll_'+ pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall}; }; /*jshint maxparams:3 */ @@ -3826,24 +3903,19 @@ RequestManager.prototype.startPolling = function (data, pollId, callback, uninst * @param {Number} pollId */ RequestManager.prototype.stopPolling = function (pollId) { - for (var i = this.polls.length; i--;) { - var poll = this.polls[i]; - if (poll.id === pollId) { - this.polls.splice(i, 1); - } - } + delete this.polls['poll_'+ pollId]; }; /** - * Should be called to reset polling mechanism of request manager + * Should be called to reset the polling mechanism of the request manager * * @method reset */ RequestManager.prototype.reset = function () { - this.polls.forEach(function (poll) { - poll.uninstall(poll.id); - }); - this.polls = []; + for (var key in this.polls) { + this.polls[key].uninstall(); + } + this.polls = {}; if (this.timeout) { clearTimeout(this.timeout); @@ -3858,9 +3930,10 @@ RequestManager.prototype.reset = function () { * @method poll */ RequestManager.prototype.poll = function () { + /*jshint maxcomplexity: 6 */ this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT); - if (!this.polls.length) { + if (Object.keys(this.polls).length === 0) { return; } @@ -3869,9 +3942,18 @@ RequestManager.prototype.poll = function () { return; } - var payload = Jsonrpc.getInstance().toBatchPayload(this.polls.map(function (data) { - return data.data; - })); + var pollsData = []; + var pollsKeys = []; + for (var key in this.polls) { + pollsData.push(this.polls[key].data); + pollsKeys.push(key); + } + + if (pollsData.length === 0) { + return; + } + + var payload = Jsonrpc.getInstance().toBatchPayload(pollsData); var self = this; this.provider.sendAsync(payload, function (error, results) { @@ -3879,14 +3961,21 @@ RequestManager.prototype.poll = function () { if (error) { return; } - + if (!utils.isArray(results)) { throw errors.InvalidResponse(results); } results.map(function (result, index) { - result.callback = self.polls[index].callback; - return result; + var key = pollsKeys[index]; + // make sure the filter is still installed after arrival of the request + if (self.polls[key]) { + result.callback = self.polls[key].callback; + return result; + } else + return false; + }).filter(function (result) { + return !!result; }).filter(function (result) { var valid = Jsonrpc.getInstance().isValidResponse(result); if (!valid) { @@ -4102,11 +4191,11 @@ var eth = function () { switch(type) { case 'latest': - args.pop(); + args.shift(); this.params = 0; return 'eth_newBlockFilter'; case 'pending': - args.pop(); + args.shift(); this.params = 0; return 'eth_newPendingTransactionFilter'; default: @@ -8262,4 +8351,4 @@ module.exports = web3; },{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]) -//# sourceMappingURL=data:application/json;charset:utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIm5vZGVfbW9kdWxlcy9icm93c2VyaWZ5L25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJsaWIvc29saWRpdHkvY29kZXIuanMiLCJsaWIvc29saWRpdHkvZm9ybWF0dGVycy5qcyIsImxpYi9zb2xpZGl0eS9wYXJhbS5qcyIsImxpYi91dGlscy9icm93c2VyLXhoci5qcyIsImxpYi91dGlscy9jb25maWcuanMiLCJsaWIvdXRpbHMvc2hhMy5qcyIsImxpYi91dGlscy91dGlscy5qcyIsImxpYi92ZXJzaW9uLmpzb24iLCJsaWIvd2ViMy5qcyIsImxpYi93ZWIzL2JhdGNoLmpzIiwibGliL3dlYjMvY29udHJhY3QuanMiLCJsaWIvd2ViMy9kYi5qcyIsImxpYi93ZWIzL2Vycm9ycy5qcyIsImxpYi93ZWIzL2V0aC5qcyIsImxpYi93ZWIzL2V2ZW50LmpzIiwibGliL3d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gcmV0dXJuO1xuICAgIH1cblxuICAgIHZhciBwYXlsb2FkID0gSnNvbnJwYy5nZXRJbnN0YW5jZSgpLnRvQmF0Y2hQYXlsb2FkKHRoaXMucG9sbHMubWFwKGZ1bmN0aW9uIChkYXRhKSB7XG4gICAgICAgIHJldHVybiBkYXRhLmRhdGE7XG4gICAgfSkpO1xuXG4gICAgdmFyIHNlbGYgPSB0aGlzO1xuICAgIHRoaXMucHJvdmlkZXIuc2VuZEFzeW5jKHBheWxvYWQsIGZ1bmN0aW9uIChlcnJvciwgcmVzdWx0cykge1xuICAgICAgICAvLyBUT0RPOiBjb25zb2xlIGxvZz9cbiAgICAgICAgaWYgKGVycm9yKSB7XG4gICAgICAgICAgICByZXR1cm47XG4gICAgICAgIH1cbiAgICAgICAgICAgIFxuICAgICAgICBpZiAoIXV0aWxzLmlzQXJyYXkocmVzdWx0cykpIHtcbiAgICAgICAgICAgIHRocm93IGVycm9ycy5JbnZhbGlkUmVzcG9uc2UocmVzdWx0cyk7XG4gICAgICAgIH1cblxuICAgICAgICByZXN1bHRzLm1hcChmdW5jdGlvbiAocmVzdWx0LCBpbmRleCkge1xuICAgICAgICAgICAgcmVzdWx0LmNhbGxiYWNrID0gc2VsZi5wb2xsc1tpbmRleF0uY2FsbGJhY2s7XG4gICAgICAgICAgICByZXR1cm4gcmVzdWx0O1xuICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24gKHJlc3VsdCkge1xuICAgICAgICAgICAgdmFyIHZhbGlkID0gSnNvbnJwYy5nZXRJbnN0YW5jZSgpLmlzVmFsaWRSZXNwb25zZShyZXN1bHQpO1xuICAgICAgICAgICAgaWYgKCF2YWxpZCkge1xuICAgICAgICAgICAgICAgIHJlc3VsdC5jYWxsYmFjayhlcnJvcnMuSW52YWxpZFJlc3BvbnNlKHJlc3VsdCkpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHZhbGlkO1xuICAgICAgICB9KS5maWx0ZXIoZnVuY3Rpb24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oqXG5cdCAgICAgKiBDcnlwdG9KUyBuYW1lc3BhY2UuXG5cdCAgICAgKi9cblx0ICAgIHZhciBDID0ge307XG5cblx0ICAgIC8qKlxuXHQgICAgICogTGlicmFyeSBuYW1lc3BhY2UuXG5cdCAgICAgKi9cblx0ICAgIHZhciBDX2xpYiA9IEMubGliID0ge307XG5cblx0ICAgIC8qKlxuXHQgICAgICogQmFzZSBvYmplY3QgZm9yIHByb3RvdHlwYWwgaW5oZXJpdGFuY2UuXG5cdCAgICAgKi9cblx0ICAgIHZhciBCYXNlID0gQ19saWIuQmFzZSA9IChmdW5jdGlvbiAoKSB7XG5cdCAgICAgICAgZnVuY3Rpb24gRigpIHt9XG5cblx0ICAgICAgICByZXR1cm4ge1xuXHQgICAgICAgICAgICAvKipcblx0ICAgICAgICAgICAgICogQ3JlYXRlcyBhIG5ldyBvYmplY3QgdGhhdCBpbmhlcml0cyBmcm9tIHRoaXMgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAcGFyYW0ge09iamVjdH0gb3ZlcnJpZGVzIFByb3BlcnRpZXMgdG8gY29weSBpbnRvIHRoZSBuZXcgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAcmV0dXJuIHtPYmplY3R9IFRoZSBuZXcgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAc3RhdGljXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqICAgICB2YXIgTXlUeXBlID0gQ3J5cHRvSlMubGliLkJhc2UuZXh0ZW5kKHtcblx0ICAgICAgICAgICAgICogICAgICAgICBmaWVsZDogJ3ZhbHVlJyxcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogICAgICAgICBtZXRob2Q6IGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgICogICAgICAgICB9XG5cdCAgICAgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgICAgICovXG5cdCAgICAgICAgICAgIGV4dGVuZDogZnVuY3Rpb24gKG92ZXJyaWRlcykge1xuXHQgICAgICAgICAgICAgICAgLy8gU3Bhd25cblx0ICAgICAgICAgICAgICAgIEYucHJvdG90eXBlID0gdGhpcztcblx0ICAgICAgICAgICAgICAgIHZhciBzdWJ0eXBlID0gbmV3IEYoKTtcblxuXHQgICAgICAgICAgICAgICAgLy8gQXVnbWVudFxuXHQgICAgICAgICAgICAgICAgaWYgKG92ZXJyaWRlcykge1xuXHQgICAgICAgICAgICAgICAgICAgIHN1YnR5cGUubWl4SW4ob3ZlcnJpZGVzKTtcblx0ICAgICAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICAgICAgLy8gQ3JlYXRlIGRlZmF1bHQgaW5pdGlhbGl6ZXJcblx0ICAgICAgICAgICAgICAgIGlmICghc3VidHlwZS5oYXNPd25Qcm9wZXJ0eSgnaW5pdCcpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgc3VidHlwZS5pbml0ID0gZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0eXBlLiRzdXBlci5pbml0LmFwcGx5KHRoaXMsIGFyZ3VtZW50cyk7XG5cdCAgICAgICAgICAgICAgICAgICAgfTtcblx0ICAgICAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICAgICAgLy8gSW5pdGlhbGl6ZXIncyBwcm90b3R5cGUgaXMgdGhlIHN1YnR5cGUgb2JqZWN0XG5cdCAgICAgICAgICAgICAgICBzdWJ0eXBlLmluaXQucHJvdG90eXBlID0gc3VidHlwZTtcblxuXHQgICAgICAgICAgICAgICAgLy8gUmVmZXJlbmNlIHN1cGVydHlwZVxuXHQgICAgICAgICAgICAgICAgc3VidHlwZS4kc3VwZXIgPSB0aGlzO1xuXG5cdCAgICAgICAgICAgICAgICByZXR1cm4gc3VidHlwZTtcblx0ICAgICAgICAgICAgfSxcblxuXHQgICAgICAgICAgICAvKipcblx0ICAgICAgICAgICAgICogRXh0ZW5kcyB0aGlzIG9iamVjdCBhbmQgcnVucyB0aGUgaW5pdCBtZXRob2QuXG5cdCAgICAgICAgICAgICAqIEFyZ3VtZW50cyB0byBjcmVhdGUoKSB3aWxsIGJlIHBhc3NlZCB0byBpbml0KCkuXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEByZXR1cm4ge09iamVjdH0gVGhlIG5ldyBvYmplY3QuXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBzdGF0aWNcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogICAgIHZhciBpbnN0YW5jZSA9IE15VHlwZS5jcmVhdGUoKTtcblx0ICAgICAgICAgICAgICovXG5cdCAgICAgICAgICAgIGNyZWF0ZTogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAgICAgdmFyIGluc3RhbmNlID0gdGhpcy5leHRlbmQoKTtcblx0ICAgICAgICAgICAgICAgIGluc3RhbmNlLmluaXQuYXBwbHkoaW5zdGFuY2UsIGFyZ3VtZW50cyk7XG5cblx0ICAgICAgICAgICAgICAgIHJldHVybiBpbnN0YW5jZTtcblx0ICAgICAgICAgICAgfSxcblxuXHQgICAgICAgICAgICAvKipcblx0ICAgICAgICAgICAgICogSW5pdGlhbGl6ZXMgYSBuZXdseSBjcmVhdGVkIG9iamVjdC5cblx0ICAgICAgICAgICAgICogT3ZlcnJpZGUgdGhpcyBtZXRob2QgdG8gYWRkIHNvbWUgbG9naWMgd2hlbiB5b3VyIG9iamVjdHMgYXJlIGNyZWF0ZWQuXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqICAgICB2YXIgTXlUeXBlID0gQ3J5cHRvSlMubGliLkJhc2UuZXh0ZW5kKHtcblx0ICAgICAgICAgICAgICogICAgICAgICBpbml0OiBmdW5jdGlvbiAoKSB7XG5cdCAgICAgICAgICAgICAqICAgICAgICAgICAgIC8vIC4uLlxuXHQgICAgICAgICAgICAgKiAgICAgICAgIH1cblx0ICAgICAgICAgICAgICogICAgIH0pO1xuXHQgICAgICAgICAgICAgKi9cblx0ICAgICAgICAgICAgaW5pdDogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICB9LFxuXG5cdCAgICAgICAgICAgIC8qKlxuXHQgICAgICAgICAgICAgKiBDb3BpZXMgcHJvcGVydGllcyBpbnRvIHRoaXMgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAcGFyYW0ge09iamVjdH0gcHJvcGVydGllcyBUaGUgcHJvcGVydGllcyB0byBtaXggaW4uXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICAgICAqXG5cdCAgICAgICAgICAgICAqICAgICBNeVR5cGUubWl4SW4oe1xuXHQgICAgICAgICAgICAgKiAgICAgICAgIGZpZWxkOiAndmFsdWUnXG5cdCAgICAgICAgICAgICAqICAgICB9KTtcblx0ICAgICAgICAgICAgICovXG5cdCAgICAgICAgICAgIG1peEluOiBmdW5jdGlvbiAocHJvcGVydGllcykge1xuXHQgICAgICAgICAgICAgICAgZm9yICh2YXIgcHJvcGVydHlOYW1lIGluIHByb3BlcnRpZXMpIHtcblx0ICAgICAgICAgICAgICAgICAgICBpZiAocHJvcGVydGllcy5oYXNPd25Qcm9wZXJ0eShwcm9wZXJ0eU5hbWUpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRoaXNbcHJvcGVydHlOYW1lXSA9IHByb3BlcnRpZXNbcHJvcGVydHlOYW1lXTtcblx0ICAgICAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgICAgIC8vIElFIHdvbid0IGNvcHkgdG9TdHJpbmcgdXNpbmcgdGhlIGxvb3AgYWJvdmVcblx0ICAgICAgICAgICAgICAgIGlmIChwcm9wZXJ0aWVzLmhhc093blByb3BlcnR5KCd0b1N0cmluZycpKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgdGhpcy50b1N0cmluZyA9IHByb3BlcnRpZXMudG9TdHJpbmc7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgIH0sXG5cblx0ICAgICAgICAgICAgLyoqXG5cdCAgICAgICAgICAgICAqIENyZWF0ZXMgYSBjb3B5IG9mIHRoaXMgb2JqZWN0LlxuXHQgICAgICAgICAgICAgKlxuXHQgICAgICAgICAgICAgKiBAcmV0dXJuIHtPYmplY3R9IFRoZSBjbG9uZS5cblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgICAgICpcblx0ICAgICAgICAgICAgICogICAgIHZhciBjbG9uZSA9IGluc3RhbmNlLmNsb25lKCk7XG5cdCAgICAgICAgICAgICAqL1xuXHQgICAgICAgICAgICBjbG9uZTogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAgICAgcmV0dXJuIHRoaXMuaW5pdC5wcm90b3R5cGUuZXh0ZW5kKHRoaXMpO1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfTtcblx0ICAgIH0oKSk7XG5cblx0ICAgIC8qKlxuXHQgICAgICogQW4gYXJyYXkgb2YgMzItYml0IHdvcmRzLlxuXHQgICAgICpcblx0ICAgICAqIEBwcm9wZXJ0eSB7QXJyYXl9IHdvcmRzIFRoZSBhcnJheSBvZiAzMi1iaXQgd29yZHMuXG5cdCAgICAgKiBAcHJvcGVydHkge251bWJlcn0gc2lnQnl0ZXMgVGhlIG51bWJlciBvZiBzaWduaWZpY2FudCBieXRlcyBpbiB0aGlzIHdvcmQgYXJyYXkuXG5cdCAgICAg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lbHNlIHtcblx0ICAgICAgICAgICAgICAgIHRoaXMuc2lnQnl0ZXMgPSB3b3Jkcy5sZW5ndGggKiA0O1xuXHQgICAgICAgICAgICB9XG5cdCAgICAgICAgfSxcblxuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIENvbnZlcnRzIHRoaXMgd29yZCBhcnJheSB0byBhIHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBwYXJhbSB7RW5jb2Rlcn0gZW5jb2RlciAoT3B0aW9uYWwpIFRoZSBlbmNvZGluZyBzdHJhdGVneSB0byB1c2UuIERlZmF1bHQ6IENyeXB0b0pTLmVuYy5IZXhcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEByZXR1cm4ge3N0cmluZ30gVGhlIHN0cmluZ2lmaWVkIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciBzdHJpbmcgPSB3b3JkQXJyYXkgKyAnJztcblx0ICAgICAgICAgKiAgICAgdmFyIHN0cmluZyA9IHdvcmRBcnJheS50b1N0cmluZygpO1xuXHQgICAgICAgICAqICAgICB2YXIgc3RyaW5nID0gd29yZEFycmF5LnRvU3RyaW5nKENyeXB0b0pTLmVuYy5VdGY4KTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0b1N0cmluZzogZnVuY3Rpb24gKGVuY29kZXIpIHtcblx0ICAgICAgICAgICAgcmV0dXJuIChlbmNvZGVyIHx8IEhleCkuc3RyaW5naWZ5KHRoaXMpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb25jYXRlbmF0ZXMgYSB3b3JkIGFycmF5IHRvIHRoaXMgd29yZCBhcnJheS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBwYXJhbSB7V29yZEFycmF5fSB3b3JkQXJyYXkgVGhlIHdvcmQgYXJyYXk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eXRlcyAlIDQpICogOCk7XG5cdCAgICAgICAgICAgIHdvcmRzLmxlbmd0aCA9IE1hdGguY2VpbChzaWdCeXRlcyAvIDQpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDcmVhdGVzIGEgY29weSBvZiB0aGlzIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtXb3JkQXJyYXl9IFRoZSBjbG9uZS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIGNsb25lID0gd29yZEFycmF5LmNsb25lKCk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgY2xvbmU6IGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgdmFyIGNsb25lID0gQmFzZS5jbG9uZS5jYWxsKHRoaXMpO1xuXHQgICAgICAgICAgICBjbG9uZS53b3JkcyA9IHRoaXMud29yZHMuc2xpY2UoMCk7XG5cblx0ICAgICAgICAgICAgcmV0dXJuIGNsb25lO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDcmVhdGVzIGEgd29yZCBhcnJheSBmaWxsZWQgd2l0aCByYW5kb20gYnl0ZXMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge251bWJlcn0gbkJ5dGVzIFRoZSBudW1iZXIgb2YgcmFuZG9tIGJ5dGVzIHRvIGdlbmVyYXRlLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7V29yZEFycmF5fSBUaGUgcmFuZG9tIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAc3RhdGljXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB3b3JkQXJyYXkgPSBDcnlwdG9KUy5saWIuV29yZEFycmF5LnJhbmRvbSgxNik7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgcmFuZG9tOiBmdW5jdGlvbiAobkJ5dGVzKSB7XG5cdCAgICAgICAgICAgIHZhciB3b3JkcyA9IFtdO1xuXG5cdCAgICAgICAgICAgIHZhciByID0gKGZ1bmN0aW9uIChtX3cpIHtcblx0ICAgICAgICAgICAgICAgIHZhciBtX3cgPSBtX3c7XG5cdCAgICAgICAgICAgICAgICB2YXIgbV96ID0gMHgzYWRlNjhiMTtcblx0ICAgICAgICAgICAgICAgIHZhciBtYXNrID0gMHhmZmZmZmZmZjtcblxuXHQgICAgICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgICAgICAgICBtX3ogPSAoMHg5MDY5ICogKG1feiAmIDB4RkZGRikgKyAobV96ID4+IDB4MTApKSAmIG1hc2s7XG5cdCAgICAgICAgICAgICAgICAgICAgbV93ID0gKDB4NDY1MCAqIChtX3cgJiAweEZGRkYpICsgKG1fdyA+PiAweDEwKSkgJiBtYXNrO1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciByZXN1bHQgPSAoKG1feiA8PCAweDEwKSArIG1fdykgJiBtYXNrO1xuXHQgICAgICAgICAgICAgICAgICAgIHJlc3VsdCAvPSAweDEwMDAwMDAwMDtcblx0ICAgICAgICAgICAgICAgICAgICByZXN1bHQgKz0gMC41O1xuXHQgICAgICAgICAgICAgICAgICAgIHJldHVybiByZXN1bHQgKiAoTWF0aC5yYW5kb20oKSA+IC41ID8gMSA6IC0xKTtcblx0ICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgfSk7XG5cblx0ICAgICAgICAgICAgZm9yICh2YXIgaSA9IDAsIHJjYWNoZTsgaSA8IG5CeXRlczsgaSArPSA0KSB7XG5cdCAgICAgICAgICAgICAgICB2YXIgX3IgPSByKChyY2FjaGUgfHwgTWF0aC5yYW5kb20oKSkgKiAweDEwMDAwMDAwMCk7XG5cblx0ICAgICAgICAgICAgICAgIHJjYWNoZSA9IF9yKCkgKiAweDNhZGU2N2I3O1xuXHQgICAgICAgICAgICAgICAgd29yZHMucHVzaCgoX3IoKSAqIDB4MTAwMDAwMDAwKSB8IDApO1xuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgcmV0dXJuIG5ldyBXb3JkQXJyYXkuaW5pdCh3b3JkcywgbkJ5dGVzKTtcblx0ICAgICAgICB9XG5cdCAgICB9KTtcblxuXHQgICAgLyoqXG5cdCAgICAgKiBFbmNvZGVyIG5hbWVzcGFjZS5cblx0ICAgICAqL1xuXHQgICAgdmFyIENfZW5jID0gQy5lbmMgPSB7fTtcblxuXHQgICAgLyoqXG5cdCAgICAgKiBIZXggZW5jb2Rpbmcgc3RyYXRlZ3kuXG5cdCAgICAgKi9cblx0ICAgIHZhciBIZXggPSBDX2VuYy5IZXggPSB7XG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogQ29udmVydHMgYSB3b3JkIGFycmF5IHRvIGEgaGV4IHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBwYXJhbSB7V29yZEFycmF5fSB3b3JkQXJyYXkgVGhlIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtzdHJpbmd9IFRoZSBoZXggc3RyaW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHN0YXRpY1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICB2YXIgaGV4U3RyaW5nID0gQ3J5cHRvSlMuZW5jLkhleC5zdHJpbmdpZnkod29yZEFycmF5KTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICBzdHJpbmdpZnk6IGZ1bmN0aW9uICh3b3JkQXJyYXkpIHtcblx0ICAgICAgICAgICAgLy8gU2hvcnRjdXRzXG5cdCAgICAgICAgICAgIHZhciB3b3JkcyA9IHdvcmRBcnJheS53b3Jkcztcblx0ICAgICAgICAgICAgdmFyIHNpZ0J5dGVzID0gd29yZEFycmF5LnNpZ0J5dGVzO1xuXG5cdCAgICAgICAgICAgIC8vIENvbnZlcnRcblx0ICAgICAgICAgICAgdmFyIGhleENoYXJzID0gW107XG5cdCAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgc2lnQnl0ZXM7IGkrKykge1xuXHQgICAgICAgICAgICAgICAgdmFyIGJpdGUgPSAod29yZHNbaSA+Pj4gMl0gPj4+ICgyNCAtIChpICUgNCkgKiA4KSkgJiAweGZmO1xuXHQgICAgICAgICAgICAgICAgaGV4Q2hhcnMucHVzaCgoYml0ZSA+Pj4gNCkudG9TdHJpbmcoMTYpKTtcblx0ICAgICAgICAgICAgICAgIGhleENoYXJzLnB1c2goKGJpdGUgJiAweDBmKS50b1N0cmluZygxNikpO1xuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgcmV0dXJuIGhleENoYXJzLmpvaW4oJycpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb252ZXJ0cyBhIGhleCBzdHJpbmcgdG8gYSB3b3JkIGFycmF5LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHBhcmFtIHtzdHJpbmd9IGhleFN0ciBUaGUgaGV4IHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEByZXR1cm4ge1dvcmRBcnJheX0gVGhlIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAc3RhdGljXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB3b3JkQXJyYXkgPSBDcnlwdG9KUy5lbmMuSGV4LnBhcnNlKGhleFN0cmluZyk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgcGFyc2U6IGZ1bmN0aW9uIChoZXhTdHIpIHtcblx0ICAgICAgICAgICAgLy8gU2hvcnRjdXRcblx0ICAgICAgICAgICAgdmFyIGhleFN0ckxlbmd0aCA9IGhleFN0ci5sZW5ndGg7XG5cblx0ICAgICAgICAgICAgLy8gQ29udmVydFxuXHQgICAgICAgICAgICB2YXIgd29yZHMgPSBbXTtcblx0ICAgICAgICAgICAgZm9yICh2YXIgaSA9IDA7IGkgPCBoZXhTdHJMZW5ndGg7IGkgKz0gMikge1xuXHQgICAgICAgICAgICAgICAgd29yZHNbaSA+Pj4gM10gfD0gcGFyc2VJbnQoaGV4U3RyLnN1YnN0cihpLCAyKSwgMTYpIDw8ICgyNCAtIChpICUgOCkgKiA0KTtcblx0ICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgIHJldHVybiBuZXcgV29yZEFycmF5LmluaXQod29yZHMsIGhleFN0ckxlbmd0aCAvIDIpO1xuXHQgICAgICAgIH1cblx0ICAgIH07XG5cblx0ICAgIC8qKlxuXHQgICAgICogTGF0aW4xIGVuY29kaW5nIHN0cmF0ZWd5LlxuXHQgICAgICovXG5cdCAgICB2YXIgTGF0aW4xID0gQ19lbmMuTGF0aW4xID0ge1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIENvbnZlcnRzIGEgd29yZCBhcnJheSB0byBhIExhdGluMSBzdHJpbmcuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge1dvcmRBcnJheX0gd29yZEFycmF5IFRoZSB3b3JkIGFycmF5LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7c3RyaW5nfSBUaGUgTGF0aW4xIHN0cmluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBzdGF0aWNcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIGxhdGluMVN0cmluZyA9IENyeXB0b0pTLmVuYy5MYXRpbjEuc3RyaW5naWZ5KHdvcmRBcnJheSk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgc3RyaW5naWZ5OiBmdW5jdGlvbiAod29yZEFycmF5KSB7XG5cdCAgICAgICAgICAgIC8vIFNob3J0Y3V0c1xuXHQgICAgICAgICAgICB2YXIgd29yZHMgPSB3b3JkQXJyYXkud29yZHM7XG5cdCAgICAgICAgICAgIHZhciBzaWdCeXRlcyA9IHdvcmRBcnJheS5zaWdCeXRlcztcblxuXHQgICAgICAgICAgICAvLyBDb252ZXJ0XG5cdCAgICAgICAgICAgIHZhciBsYXRpbjFDaGFycyA9IFtdO1xuXHQgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IHNpZ0J5dGVzOyBpKyspIHtcblx0ICAgICAgICAgICAgICAgIHZhciBiaXRlID0gKHdvcmRzW2kgPj4+IDJdID4+PiAoMjQgLSAoaSAlIDQpICogOCkpICYgMHhmZjtcblx0ICAgICAgICAgICAgICAgIGxhdGluMUNoYXJzLnB1c2goU3RyaW5nLmZyb21DaGFyQ29kZShiaXRlKSk7XG5cdCAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICByZXR1cm4gbGF0aW4xQ2hhcnMuam9pbignJyk7XG5cdCAgICAgICAgfSxcblxuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIENvbnZlcnRzIGEgTGF0aW4xIHN0cmluZyB0byBhIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gbGF0aW4xU3RyIFRoZSBMYXRpbjEgc3RyaW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7V29yZEFycmF5fSBUaGUgd29yZCBhcnJheS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBzdGF0aWNcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgIC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gICAgICogQHN0YXRpY1xuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICB2YXIgdXRmOFN0cmluZyA9IENyeXB0b0pTLmVuYy5VdGY4LnN0cmluZ2lmeSh3b3JkQXJyYXkpO1xuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHN0cmluZ2lmeTogZnVuY3Rpb24gKHdvcmRBcnJheSkge1xuXHQgICAgICAgICAgICB0cnkge1xuXHQgICAgICAgICAgICAgICAgcmV0dXJuIGRlY29kZVVSSUNvbXBvbmVudChlc2NhcGUoTGF0aW4xLnN0cmluZ2lmeSh3b3JkQXJyYXkpKSk7XG5cdCAgICAgICAgICAgIH0gY2F0Y2ggKGUpIHtcblx0ICAgICAgICAgICAgICAgIHRocm93IG5ldyBFcnJvcignTWFsZm9ybWVkIFVURi04IGRhdGEnKTtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb252ZXJ0cyBhIFVURi04IHN0cmluZyB0byBhIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcGFyYW0ge3N0cmluZ30gdXRmOFN0ciBUaGUgVVRGLTggc3RyaW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7V29yZEFycmF5fSBUaGUgd29yZCBhcnJheS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBzdGF0aWNcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIHdvcmRBcnJheSA9IENyeXB0b0pTLmVuYy5VdGY4LnBhcnNlKHV0ZjhTdHJpbmcpO1xuXHQgICAgICAgICAqL1xuXHQgICAgICAgIHBhcnNlOiBmdW5jdGlvbiAodXRmOFN0cikge1xuXHQgICAgICAgICAgICByZXR1c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0gQy5hbGdvO1xuXG5cdCAgICAvLyBDb25zdGFudHMgdGFibGVzXG5cdCAgICB2YXIgUkhPX09GRlNFVFMgPSBbXTtcblx0ICAgIHZhciBQSV9JTkRFWEVTICA9IFtdO1xuXHQgICAgdmFyIFJPVU5EX0NPTlNUQU5UUyA9IFtdO1xuXG5cdCAgICAvLyBDb21wdXRlIENvbnN0YW50c1xuXHQgICAgKGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAvLyBDb21wdXRlIHJobyBvZmZzZXQgY29uc3RhbnRzXG5cdCAgICAgICAgdmFyIHggPSAxLCB5ID0gMDtcblx0ICAgICAgICBmb3IgKHZhciB0ID0gMDsgdCA8IDI0OyB0KyspIHtcblx0ICAgICAgICAgICAgUkhPX09GRlNFVFNbeCArIDUgKiB5XSA9ICgodCArIDEpICogKHQgKyAyKSAvIDIpICUgNjQ7XG5cblx0ICAgICAgICAgICAgdmFyIG5ld1ggPSB5ICUgNTtcblx0ICAgICAgICAgICAgdmFyIG5ld1kgPSAoMiAqIHggKyAzICogeSkgJSA1O1xuXHQgICAgICAgICAgICB4ID0gbmV3WDtcblx0ICAgICAgICAgICAgeSA9IG5ld1k7XG5cdCAgICAgICAgfVxuXG5cdCAgICAgICAgLy8gQ29tcHV0ZSBwaSBpbmRleCBjb25zdGFudHNcblx0ICAgICAgICBmb3IgKHZhciB4ID0gMDsgeCA8IDU7IHgrKykge1xuXHQgICAgICAgICAgICBmb3IgKHZhciB5ID0gMDsgeSA8IDU7IHkrKykge1xuXHQgICAgICAgICAgICAgICAgUElfSU5ERVhFU1t4ICsgNSAqIHldID0geSArICgoMiAqIHggKyAzICogeSkgJSA1KSAqIDU7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9XG5cblx0ICAgICAgICAvLyBDb21wdXRlIHJvdW5kIGNvbnN0YW50c1xuXHQgICAgICAgIHZhciBMRlNSID0gMHgwMTtcblx0ICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IDI0OyBpKyspIHtcblx0ICAgICAgICAgICAgdmFyIHJvdW5kQ29uc3RhbnRNc3cgPSAwO1xuXHQgICAgICAgICAgICB2YXIgcm91bmRDb25zdGFudExzdyA9IDA7XG5cblx0ICAgICAgICAgICAgZm9yICh2YXIgaiA9IDA7IGogPCA3OyBqKyspIHtcblx0ICAgICAgICAgICAgICAgIGlmIChMRlNSICYgMHgwMSkge1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBiaXRQb3NpdGlvbiA9ICgxIDw8IGopIC0gMTtcblx0ICAgICAgICAgICAgICAgICAgICBpZiAoYml0UG9zaXRpb24gPCAzMikge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICByb3VuZENvbnN0YW50THN3IF49IDEgPDwgYml0UG9zaXRpb247XG5cdCAgICAgICAgICAgICAgICAgICAgfSBlbHNlIC8qIGlmIChiaXRQb3NpdGlvbiA+PSAzMikgKi8ge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICByb3VuZENvbnN0YW50TXN3IF49IDEgPDwgKGJpdFBvc2l0aW9uIC0gMzIpO1xuXHQgICAgICAgICAgICAgICAgICAgIH1cblx0ICAgICAgICAgICAgICAgIH1cblxuXHQgICAgICAgICAgICAgICAgLy8gQ29tcHV0ZSBuZXh0IExGU1Jcblx0ICAgICAgICAgICAgICAgIGlmIChMRlNSICYgMHg4MCkge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIFByaW1pdGl2ZSBwb2x5bm9taWFsIG92ZXIgR0YoMik6IHheOCArIHheNiArIHheNSArIHheNCArIDFcblx0ICAgICAgICAgICAgICAgICAgICBMRlNSID0gKExGU1IgPDwgMSkgXiAweDcxO1xuXHQgICAgICAgICAgICAgICAgfSBlbHNlIHtcblx0ICAgICAgICAgICAgICAgICAgICBMRlNSIDw8PSAxO1xuXHQgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgUk9VTkRfQ09OU1RBTlRTW2ldID0gWDY0V29yZC5jcmVhdGUocm91bmR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DA7IGkgPCAyNTsgaSsrKSB7XG5cdCAgICAgICAgICAgICAgICBzdGF0ZVtpXSA9IG5ldyBYNjRXb3JkLmluaXQoKTtcblx0ICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgIHRoaXMuYmxvY2tTaXplID0gKDE2MDAgLSAyICogdGhpcy5jZmcub3V0cHV0TGVuZ3RoKSAvIDMyO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICBfZG9Qcm9jZXNzQmxvY2s6IGZ1bmN0aW9uIChNLCBvZmZzZXQpIHtcblx0ICAgICAgICAgICAgLy8gU2hvcnRjdXRzXG5cdCAgICAgICAgICAgIHZhciBzdGF0ZSA9IHRoaXMuX3N0YXRlO1xuXHQgICAgICAgICAgICB2YXIgbkJsb2NrU2l6ZUxhbmVzID0gdGhpcy5ibG9ja1NpemUgLyAyO1xuXG5cdCAgICAgICAgICAgIC8vIEFic29yYlxuXHQgICAgICAgICAgICBmb3IgKHZhciBpID0gMDsgaSA8IG5CbG9ja1NpemVMYW5lczsgaSsrKSB7XG5cdCAgICAgICAgICAgICAgICAvLyBTaG9ydGN1dHNcblx0ICAgICAgICAgICAgICAgIHZhciBNMmkgID0gTVtvZmZzZXQgKyAyICogaV07XG5cdCAgICAgICAgICAgICAgICB2YXIgTTJpMSA9IE1bb2Zmc2V0ICsgMiAqIGkgKyAxXTtcblxuXHQgICAgICAgICAgICAgICAgLy8gU3dhcCBlbmRpYW5cblx0ICAgICAgICAgICAgICAgIE0yaSA9IChcblx0ICAgICAgICAgICAgICAgICAgICAoKChNMmkgPDwgOCkgIHwgKE0yaSA+Pj4gMjQpKSAmIDB4MDBmZjAwZmYpIHxcblx0ICAgICAgICAgICAgICAgICAgICAoKChNMmkgPDwgMjQpIHwgKE0yaSA+Pj4gOCkpICAmIDB4ZmYwMGZmMDApXG5cdCAgICAgICAgICAgICAgICApO1xuXHQgICAgICAgICAgICAgICAgTTJpMSA9IChcblx0ICAgICAgICAgICAgICAgICAgICAoKChNMmkxIDw8IDgpICB8IChNMmkxID4+PiAyNCkpICYgMHgwMGZmMDBmZikgfFxuXHQgICAgICAgICAgICAgICAgICAgICgoKE0yaTEgPDwgMjQpIHwgKE0yaTEgPj4+IDgpKSAgJiAweGZmMDBmZjAwKVxuXHQgICAgICAgICAgICAgICAgKTtcblxuXHQgICAgICAgICAgICAgICAgLy8gQWJzb3JiIG1lc3NhZ2UgaW50byBzdGF0ZVxuXHQgICAgICAgICAgICAgICAgdmFyIGxhbmUgPSBzdGF0ZVtpXTtcblx0ICAgICAgICAgICAgICAgIGxhbmUuaGlnaCBePSBNMmkxO1xuXHQgICAgICAgICAgICAgICAgbGFuZS5sb3cgIF49IE0yaTtcblx0ICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgIC8vIFJvdW5kc1xuXHQgICAgICAgICAgICBmb3IgKHZhciByb3VuZCA9IDA7IHJvdW5kIDwgMjQ7IHJvdW5kKyspIHtcblx0ICAgICAgICAgICAgICAgIC8vIFRoZXRhXG5cdCAgICAgICAgICAgICAgICBmb3IgKHZhciB4ID0gMDsgeCA8IDU7IHgrKykge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIE1peCBjb2x1bW4gbGFuZXNcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgdE1zdyA9IDAsIHRMc3cgPSAwO1xuXHQgICAgICAgICAgICAgICAgICAgIGZvciAodmFyIHkgPSAwOyB5IDwgNTsgeSsrKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciBsYW5lID0gc3RhdGVbeCArIDUgKiB5XTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdE1zdyBePSBsYW5lLmhpZ2g7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHRMc3cgXj0gbGFuZS5sb3c7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gVGVtcG9yYXJ5IHZhbHVlc1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBUeCA9IFRbeF07XG5cdCAgICAgICAgICAgICAgICAgICAgVHguaGlnaCA9IHRNc3c7XG5cdCAgICAgICAgICAgICAgICAgICAgVHgubG93ICA9IHRMc3c7XG5cdCAgICAgICAgICAgICAgICB9XG5cdCAgICAgICAgICAgICAgICBmb3IgKHZhciB4ID0gMDsgeCA8IDU7IHgrKykge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIFNob3J0Y3V0c1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBUeDQgPSBUWyh4ICsgNCkgJSA1XTtcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgVHgxID0gVFsoeCArIDEpICUgNV07XG5cdCAgICAgICAgICAgICAgICAgICAgdmFyIFR4MU1zdyA9IFR4MS5oaWdoO1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBUeDFMc3cgPSBUeDEubG93O1xuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gTWl4IHN1cnJvdW5kaW5nIGNvbHVtbnNcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgdE1zdyA9IFR4NC5oaWdoIF4gKChUeDFNc3cgPDwgMSkgfCAoVHgxTHN3ID4+PiAzMSkpO1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciB0THN3ID0gVHg0LmxvdyAgXiAoKFR4MUxzdyA8PCAxKSB8IChUeDFNc3cgPj4+IDMxKSk7XG5cdCAgICAgICAgICAgICAgICAgICAgZm9yICh2YXIgeSA9IDA7IHkgPCA1OyB5KyspIHtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxhbmUgPSBzdGF0ZVt4ICsgNSAqIHldO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBsYW5lLmhpZ2ggXj0gdE1zdztcblx0ICAgICAgICAgICAgICAgICAgICAgICAgbGFuZS5sb3cgIF49IHRMc3c7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAvLyBSaG8gUGlcblx0ICAgICAgICAgICAgICAgIGZvciAodmFyIGxhbmVJbmRleCA9IDE7IGxhbmVJbmRleCA8IDI1OyBsYW5lSW5kZXgrKykge1xuXHQgICAgICAgICAgICAgICAgICAgIC8vIFNob3J0Y3V0c1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciBsYW5lID0gc3RhdGVbbGFuZUluZGV4XTtcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgbGFuZU1zdyA9IGxhbmUuaGlnaDtcblx0ICAgICAgICAgICAgICAgICAgICB2YXIgbGFuZUxzdyA9IGxhbmUubG93O1xuXHQgICAgICAgICAgICAgICAgICAgIHZhciByaG9PZmZzZXQgPSBSSE9fT0ZGU0VUU1tsYW5lSW5kZXhdO1xuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gUm90YXRlIGxhbmVzXG5cdCAgICAgICAgICAgICAgICAgICAgaWYgKHJob09mZnNldCA8IDMyKSB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0TXN3ID0gKGxhbmVNc3cgPDwgcmhvT2Zmc2V0KSB8IChsYW5lTHN3ID4+PiAoMzIgLSByaG9PZmZzZXQpKTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIHRMc3cgPSAobGFuZUxzdyA8PCByaG9PZmZzZXQpIHwgKGxhbmVNc3cgPj4+ICgzMiAtIHJob09mZnNldCkpO1xuXHQgICAgICAgICAgICAgICAgICAgIH0gZWxzZSAvKiBpZiAocmhvT2Zmc2V0ID49IDMyKSAqLyB7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0TXN3ID0gKGxhbmVMc3cgPDwgKHJob09mZnNldCAtIDMyKSkgfCAobGFuZU1zdyA+Pj4gKDY0IC0gcmhvT2Zmc2V0KSk7XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciB0THN3ID0gKGxhbmVNc3cgPDwgKHJob09mZnNldCAtIDMyKSkgfCAobGFuZUxzdyA+Pj4gKDY0IC0gcmhvT2Zmc2V0KSk7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAgICAgLy8gVHJhbnNwb3NlIGxhbmVzXG5cdCAgICAgICAgICAgICAgICAgICAgdmFyIFRQaUxhbmUgPSBUW1BJX0lOREVYRVNbbGFuZUluZGV4XV07XG5cdCAgICAgICAgICAgICAgICAgICAgVFBpTGFuZS5oaWdoID0gdE1zdztcblx0ICAgICAgICAgICAgICAgICAgICBUUGlMYW5lLmxvdyAgPSB0THN3O1xuXHQgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAvLyBSaG8gcGkgYXQgeCA9IHkgPSAwXG5cdCAgICAgICAgICAgICAgICB2YXIgVDAgPSBUWzBdO1xuXHQgICAgICAgICAgICAgICAgdmFyIHN0YXRlMCA9IHN0YXRlWzBdO1xuXHQgICAgICAgICAgICAgICAgVDAuaGlnaCA9IHN0YXRlMC5oaWdoO1xuXHQgICAgICAgICAgICAgICAgVDAubG93ICA9IHN0YXRlMC5sb3c7XG5cblx0ICAgICAgICAgICAgICAgIC8vIENoaVxuXHQgICAgICAgICAgICAgICAgZm9yICh2YXIgeCA9IDA7IHggPCA1OyB4KyspIHtcblx0ICAgICAgICAgICAgICAgICAgICBmb3IgKHZhciB5ID0gMDsgeSA8IDU7IHkrKykge1xuXHQgICAgICAgICAgICAgICAgICAgICAgICAvLyBTaG9ydGN1dHNcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxhbmVJbmRleCA9IHggKyA1ICogeTtcblx0ICAgICAgICAgICAgICAgICAgICAgICAgdmFyIGxhbmUgPSBzdGF0ZVtsYW5lSW5kZXhdO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVExhbmUgPSBUW2xhbmVJbmRleF07XG5cdCAgICAgICAgICAgICAgICAgICAgICAgIHZhciBUeDFMYW5lID0gVFsoKHggKyAxKSAlIDUpICsgNSAqIHldO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICB2YXIgVHgyTGFuZSA9IFRbKCh4ICsgMikgJSA1KSArIDUgKiB5XTtcblxuXHQgICAgICAgICAgICAgICAgICAgICAgICAvLyBNaXggcm93c1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBsYW5lLmhpZ2ggPSBUTGFuZS5oaWdoIF4gKH5UeDFMYW5lLmhpZ2ggJiBUeDJMYW5lLmhpZ2gpO1xuXHQgICAgICAgICAgICAgICAgICAgICAgICBsYW5lLmxvdyAgPSBUTGFuZS5sb3cgIF4gKH5UeDFMYW5lLmxvdyAgJiBUeDJMYW5lLmxvdyk7XG5cdCAgICAgICAgICAgICAgICAgICAgfVxuXHQgICAgICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgICAgICAvLyBJb3RhXG5cdCAgICAgICAgICAgICAgICB2YXIgbGFuZSA9IHN0YXRlWzBdO1xuXHQgICAgICAgICAgICAgICAgdmFyIHJvdW5kQ29uc3RhbnQgPSBST1VORF9DT05TVEFOVFNbcm91bmRdO1xuXHQgICAgICAgICAgICAgICAgbGFuZS5oaWdoIF49IHJvdW5kQ29uc3RhbnQuaGlnaDtcblx0ICAgICAgICAgICAgICAgIGxhbmUubG93ICBePSByb3VuZENvbnN0YW50Lmxvdzs7XG5cdCAgICAgICAgICAgIH1cblx0ICAgICAgICB9LFxuXG5cdCAgICAgICAgX2RvRmluYWxpemU6IGZ1bmN0aW9uICgpIHtcblx0ICAgICAgICAgICAgLy8gU2hvcnRjdXRzXG5cdCAgICAgICAgICAgIHZhciBkYXRhID0gdGhpcy5fZGF0YTtcblx0ICAgICAgICAgICAgdmFyIGRhdGFXb3JkcyA9IGRhdGEud29yZHM7XG5cdCAgICAgICAgICAgIHZhciBuQml0c1RvdGFsID0gdGhpcy5fbkRhdGFCeXRlcyAqIDg7XG5cdCAgICAgICAgICAgIHZhciBuQml0c0xlZnQgPSBkYXRhLnNpZ0J5dGVzICogODtcblx0ICAgICAgICAgICAgdmFyIGJsb2NrU2l6ZUJpdHMgPSB0aGlzLmJsb2NrU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UubG93O1xuXG5cdCAgICAgICAgICAgICAgICAvLyBTd2FwIGVuZGlhblxuXHQgICAgICAgICAgICAgICAgbGFuZU1zdyA9IChcblx0ICAgICAgICAgICAgICAgICAgICAoKChsYW5lTXN3IDw8IDgpICB8IChsYW5lTXN3ID4+PiAyNCkpICYgMHgwMGZmMDBmZikgfFxuXHQgICAgICAgICAgICAgICAgICAgICgoKGxhbmVNc3cgPDwgMjQpIHwgKGxhbmVNc3cgPj4+IDgpKSAgJiAweGZmMDBmZjAwKVxuXHQgICAgICAgICAgICAgICAgKTtcblx0ICAgICAgICAgICAgICAgIGxhbmVMc3cgPSAoXG5cdCAgICAgICAgICAgICAgICAgICAgKCgobGFuZUxzdyA8PCA4KSAgfCAobGFuZUxzdyA+Pj4gMjQpKSAmIDB4MDBmZjAwZmYpIHxcblx0ICAgICAgICAgICAgICAgICAgICAoKChsYW5lTHN3IDw8IDI0KSB8IChsYW5lTHN3ID4+PiA4KSkgICYgMHhmZjAwZmYwMClcblx0ICAgICAgICAgICAgICAgICk7XG5cblx0ICAgICAgICAgICAgICAgIC8vIFNxdWVlemUgc3RhdGUgdG8gcmV0cmlldmUgaGFzaFxuXHQgICAgICAgICAgICAgICAgaGFzaFdvcmRzLnB1c2gobGFuZUxzdyk7XG5cdCAgICAgICAgICAgICAgICBoYXNoV29yZHMucHVzaChsYW5lTXN3KTtcblx0ICAgICAgICAgICAgfVxuXG5cdCAgICAgICAgICAgIC8vIFJldHVybiBmaW5hbCBjb21wdXRlZCBoYXNoXG5cdCAgICAgICAgICAgIHJldHVybiBuZXcgV29yZEFycmF5LmluaXQoaGFzaFdvcmRzLCBvdXRwdXRMZW5ndGhCeXRlcyk7XG5cdCAgICAgICAgfSxcblxuXHQgICAgICAgIGNsb25lOiBmdW5jdGlvbiAoKSB7XG5cdCAgICAgICAgICAgIHZhciBjbG9uZSA9IEhhc2hlci5jbG9uZS5jYWxsKHRoaXMpO1xuXG5cdCAgICAgICAgICAgIHZhciBzdGF0ZSA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uV29yZEFycmF5O1xuXG5cdCAgICAvKipcblx0ICAgICAqIHg2NCBuYW1lc3BhY2UuXG5cdCAgICAgKi9cblx0ICAgIHZhciBDX3g2NCA9IEMueDY0ID0ge307XG5cblx0ICAgIC8qKlxuXHQgICAgICogQSA2NC1iaXQgd29yZC5cblx0ICAgICAqL1xuXHQgICAgdmFyIFg2NFdvcmQgPSBDX3g2NC5Xb3JkID0gQmFzZS5leHRlbmQoe1xuXHQgICAgICAgIC8qKlxuXHQgICAgICAgICAqIEluaXRpYWxpemVzIGEgbmV3bHkgY3JlYXRlZCA2NC1iaXQgd29yZC5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBwYXJhbSB7bnVtYmVyfSBoaWdoIFRoZSBoaWdoIDMyIGJpdHMuXG5cdCAgICAgICAgICogQHBhcmFtIHtudW1iZXJ9IGxvdyBUaGUgbG93IDMyIGJpdHMuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB4NjRXb3JkID0gQ3J5cHRvSlMueDY0LldvcmQuY3JlYXRlKDB4MDAwMTAyMDMsIDB4MDQwNTA2MDcpO1xuXHQgICAgICAgICAqL1xuXHQgICAgICAgIGluaXQ6IGZ1bmN0aW9uIChoaWdoLCBsb3cpIHtcblx0ICAgICAgICAgICAgdGhpcy5oaWdoID0gaGlnaDtcblx0ICAgICAgICAgICAgdGhpcy5sb3cgPSBsb3c7XG5cdCAgICAgICAgfVxuXG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogQml0d2lzZSBOT1RzIHRoaXMgd29yZC5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEByZXR1cm4ge1g2NFdvcmR9IEEgbmV3IHg2NC1Xb3JkIG9iamVjdCBhZnRlciBuZWdhdGluZy5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKi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C8vIH0gZWxzZSB7XG5cdCAgICAgICAgICAgICAgICAvLyB2YXIgaGlnaCA9IHRoaXMubG93IDw8IChuIC0gMzIpO1xuXHQgICAgICAgICAgICAgICAgLy8gdmFyIGxvdyA9IDA7XG5cdCAgICAgICAgICAgIC8vIH1cblxuXHQgICAgICAgICAgICAvLyByZXR1cm4gWDY0V29yZC5jcmVhdGUoaGlnaCwgbG93KTtcblx0ICAgICAgICAvLyB9LFxuXG5cdCAgICAgICAgLyoqXG5cdCAgICAgICAgICogU2hpZnRzIHRoaXMgd29yZCBuIGJpdHMgdG8gdGhlIHJpZ2h0LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHBhcmFtIHtudW1iZXJ9IG4gVGhlIG51bWJlciBvZiBiaXRzIHRvIHNoaWZ0LlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQHJldHVybiB7WDY0V29yZH0gQSBuZXcgeDY0LVdvcmQgb2JqZWN0IGFmdGVyIHNoaWZ0aW5nLlxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogQGV4YW1wbGVcblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqICAgICB2YXIgc2hpZnRlZCA9IHg2NFdvcmQuc2hpZnRSKDcpO1xuXHQgICAgICAgICAqL1xuXHQgICAgICAgIC8vIHNoaWZ0UjogZnVuY3Rpb24gKG4pIHtcblx0ICAgICAgICAgICAgLy8gaWYgKG4gPCAzMikge1xuXHQgICAgICAgICAgICAgICAgLy8gdmFyIGxvdyA9ICh0aGlzLmxvdyA+Pj4gbikgfCAodGhpcy5oaWdoIDw8ICgzMiAtIG4pKTtcblx0ICAgICAgICAgICAgICAgIC8vIHZhciBoaWdoID0gdGhpcy5oaWdoID4+PiBuO1xuXHQgICAgICAgICAgICAvLyB9IGVsc2Uge1xuXHQgICAgICAgICAgICAgICAgLy8gdmFyIGxvdyA9IHRoaXMuaGlnaCA+Pj4gKG4gLSAzMik7XG5cdCAgICAgICAgICAgICAgICAvLyB2YXIgaGlna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AgICAgICAgICogICAgICAgICBDcnlwdG9KUy54NjQuV29yZC5jcmVhdGUoMHgxODE5MWExYiwgMHgxYzFkMWUxZilcblx0ICAgICAgICAgKiAgICAgXSk7XG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIHdvcmRBcnJheSA9IENyeXB0b0pTLng2NC5Xb3JkQXJyYXkuY3JlYXRlKFtcblx0ICAgICAgICAgKiAgICAgICAgIENyeXB0b0pTLng2NC5Xb3JkLmNyZWF0ZSgweDAwMDEwMjAzLCAweDA0MDUwNjA3KSxcblx0ICAgICAgICAgKiAgICAgICAgIENyeXB0b0pTLng2NC5Xb3JkLmNyZWF0ZSgweDE4MTkxYTFiLCAweDFjMWQxZTFmKVxuXHQgICAgICAgICAqICAgICBdLCAxMCk7XG5cdCAgICAgICAgICovXG5cdCAgICAgICAgaW5pdDogZnVuY3Rpb24gKHdvcmRzLCBzaWdCeXRlcykge1xuXHQgICAgICAgICAgICB3b3JkcyA9IHRoaXMud29yZHMgPSB3b3JkcyB8fCBbXTtcblxuXHQgICAgICAgICAgICBpZiAoc2lnQnl0ZXMgIT0gdW5kZWZpbmVkKSB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnNpZ0J5dGVzID0gc2lnQnl0ZXM7XG5cdCAgICAgICAgICAgIH0gZWxzZSB7XG5cdCAgICAgICAgICAgICAgICB0aGlzLnNpZ0J5dGVzID0gd29yZHMubGVuZ3RoICogODtcblx0ICAgICAgICAgICAgfVxuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDb252ZXJ0cyB0aGlzIDY0LWJpdCB3b3JkIGFycmF5IHRvIGEgMzItYml0IHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtDcnlwdG9KUy5saWIuV29yZEFycmF5fSBUaGlzIHdvcmQgYXJyYXkncyBkYXRhIGFzIGEgMzItYml0IHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAZXhhbXBsZVxuXHQgICAgICAgICAqXG5cdCAgICAgICAgICogICAgIHZhciB4MzJXb3JkQXJyYXkgPSB4NjRXb3JkQXJyYXkudG9YMzIoKTtcblx0ICAgICAgICAgKi9cblx0ICAgICAgICB0b1gzMjogZnVuY3Rpb24gKCkge1xuXHQgICAgICAgICAgICAvLyBTaG9ydGN1dHNcblx0ICAgICAgICAgICAgdmFyIHg2NFdvcmRzID0gdGhpcy53b3Jkcztcblx0ICAgICAgICAgICAgdmFyIHg2NFdvcmRzTGVuZ3RoID0geDY0V29yZHMubGVuZ3RoO1xuXG5cdCAgICAgICAgICAgIC8vIENvbnZlcnRcblx0ICAgICAgICAgICAgdmFyIHgzMldvcmRzID0gW107XG5cdCAgICAgICAgICAgIGZvciAodmFyIGkgPSAwOyBpIDwgeDY0V29yZHNMZW5ndGg7IGkrKykge1xuXHQgICAgICAgICAgICAgICAgdmFyIHg2NFdvcmQgPSB4NjRXb3Jkc1tpXTtcblx0ICAgICAgICAgICAgICAgIHgzMldvcmRzLnB1c2goeDY0V29yZC5oaWdoKTtcblx0ICAgICAgICAgICAgICAgIHgzMldvcmRzLnB1c2goeDY0V29yZC5sb3cpO1xuXHQgICAgICAgICAgICB9XG5cblx0ICAgICAgICAgICAgcmV0dXJuIFgzMldvcmRBcnJheS5jcmVhdGUoeDMyV29yZHMsIHRoaXMuc2lnQnl0ZXMpO1xuXHQgICAgICAgIH0sXG5cblx0ICAgICAgICAvKipcblx0ICAgICAgICAgKiBDcmVhdGVzIGEgY29weSBvZiB0aGlzIHdvcmQgYXJyYXkuXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiBAcmV0dXJuIHtYNjRXb3JkQXJyYXl9IFRoZSBjbG9uZS5cblx0ICAgICAgICAgKlxuXHQgICAgICAgICAqIEBleGFtcGxlXG5cdCAgICAgICAgICpcblx0ICAgICAgICAgKiAgICAgdmFyIGNsb25lID0geDY0V29yZEFycmF5LmNsb25l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lxuICAgICAgICAgICAgICogVGhlIHZhbHVlcyBjYW4gYWxzbyBiZSBjaGFuZ2VkIGF0IHJ1bi10aW1lIHVzaW5nIEJpZ051bWJlci5jb25maWcuXG4gICAgICAgICAgICAgKi9cblxuICAgICAgICAgICAgLy8gVGhlIG1heGltdW0gbnVtYmVyIG9mIGRlY2ltYWwgcGxhY2VzIGZvciBvcGVyYXRpb25zIGludm9sdmluZyBkaXZpc2lvbi5cbiAgICAgICAgICAgIERFQ0lNQUxfUExBQ0VTID0gMjAsICAgICAgICAgICAgICAgICAgICAgLy8gMCB0byBNQVhcblxuICAgICAgICAgICAgLypcbiAgICAgICAgICAgICAqIFRoZSByb3VuZGluZyBtb2RlIHVzZWQgd2hlbiByb3VuZGluZyB0byB0aGUgYWJvdmUgZGVjaW1hbCBwbGFjZXMsIGFuZCB3aGVuIHVzaW5nXG4gICAgICAgICAgICAgKiB0b0V4cG9uZW50aWFsLCB0b0ZpeGVkLCB0b0Zvcm1hdCBhbmQgdG9QcmVjaXNpb24sIGFuZCByb3VuZCAoZGVmYXVsdCB2YWx1ZSkuXG4gICAgICAgICAgICAgKiBVUCAgICAgICAgIDAgQXdheSBmcm9tIHplcm8uXG4gICAgICAgICAgICAgKiBET1dOICAgICAgIDEgVG93YXJkcyB6ZXJvLlxuICAgICAgICAgICAgICogQ0VJTCAgICAgICAyIFRvd2FyZHMgK0luZmluaXR5LlxuICAgICAgICAgICAgICogRkxPT1IgICAgICAzIFRvd2FyZHMgLUluZmluaXR5LlxuICAgICAgICAgICAgICogSEFMRl9VUCAgICA0IFRvd2FyZHMgbmVhcmVzdCBuZWlnaGJvdXIuIElmIGVxdWlkaXN0YW50LCB1cC5cbiAgICAgICAgICAgICAqIEhBTEZfRE9XTiAgNSBUb3dhcmRzIG5lYXJlc3QgbmVpZ2hib3VyLiBJZiBlcXVpZGlzdGFudCwgZG93bi5cbiAgICAgICAgICAgICAqIEhBTEZfRVZFTiAgNiBUb3dhcmRzIG5lYXJlc3QgbmVpZ2hib3VyLiBJZiBlcXVpZGlzdGFudCwgdG93YXJkcyBldmVuIG5laWdoYm91ci5cbiAgICAgICAgICAgICAqIEhBTEZfQ0VJTCAgNyBUb3dhcmRzIG5lYXJlc3QgbmVpZ2hib3VyLiBJZiBlcXVpZGlzdGFudCwgdG93YXJkcyArSW5maW5pdHkuXG4gICAgICAgICAgICAgKiBIQUxGX0ZMT09SIDggVG93YXJkcyBuZWFyZXN0IG5laWdoYm91ci4gSWYgZXF1aWRpc3RhbnQsIHRvd2FyZHMgLUluZmluaXR5LlxuICAgICAgICAgICAgICovXG4gICAgICAgICAgICBST1VORElOR19NT0RFID0gNCwgICAgICAgICAgICAgICAgICAgICAgIC8vIDAgdG8gOFxuXG4gICAgICAgICAgICAvLyBFWFBPTkVOVElBTF9BVCA6IFtUT19FWFBfTkVHICwgVE9fRVhQX1BPU11cblxuICAgICAgICAgICAgLy8gVGhlIGV4cG9uZW50IHZhbHVlIGF0IGFuZCBiZW5lYXRoIHdoaWNoIHRvU3RyaW5nIHJldHVybnMgZXhwb25lbnRpYWwgbm90YXRpb24uXG4gICAgICAgICAgICAvLyBOdW1iZXIgdHlwZTogLTdcbiAgICAgICAgICAgIFRPX0VYUF9ORUcgPSAtNywgICAgICAgICAgICAgICAgICAgICAgICAgLy8gMCB0byAtTUFYXG5cbiAgICAgICAgICAgIC8vIFRoZSBleHBvbmVudCB2YWx1ZSBhdCBhbmQgYWJvdmUgd2hpY2ggdG9TdHJpbmcgcmV0dXJucyBleHBvbmVudGlhbCBub3RhdGlvbi5cbiAgICAgICAgICAgIC8vIE51bWJlciB0eXBlOiAyMVxuICAgICAgICAgICAgVE9fRVhQX1BPUyA9IDIxLCAgICAgICAgICAgICAgICAgICAgICAgICAvLyAwIHRvIE1BWFxuXG4gICAgICAgICAgICAvLyBSQU5HRSA6IFtNSU5fRVhQLCBNQVhfRVhQXVxuXG4gICAgICAgICAgICAvLyBUaGUgbWluaW11bSBleHBvbmVudCB2YWx1ZSwgYmV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2YWlsYWJsZS5cbiAgICAgICAgICAgIENSWVBUTyA9IGZhbHNlLCAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gdHJ1ZSBvciBmYWxzZVxuXG4gICAgICAgICAgICAvKlxuICAgICAgICAgICAgICogVGhlIG1vZHVsbyBtb2RlIHVzZWQgd2hlbiBjYWxjdWxhdGluZyB0aGUgbW9kdWx1czogYSBtb2Qgbi5cbiAgICAgICAgICAgICAqIFRoZSBxdW90aWVudCAocSA9IGEgLyBuKSBpcyBjYWxjdWxhdGVkIGFjY29yZGluZyB0byB0aGUgY29ycmVzcG9uZGluZyByb3VuZGluZyBtb2RlLlxuICAgICAgICAgICAgICogVGhlIHJlbWFpbmRlciAocikgaXMgY2FsY3VsYXRlZCBhczogciA9IGEgLSBuICogcS5cbiAgICAgICAgICAgICAqXG4gICAgICAgICAgICAgKiBVUCAgICAgICAgMCBUaGUgcmVtYWluZGVyIGlzIHBvc2l0aXZlIGlmIHRoZSBkaXZpZGVuZCBpcyBuZWdhdGl2ZSwgZWxzZSBpcyBuZWdhdGl2ZS5cbiAgICAgICAgICAgICAqIERPV04gICAgICAxIFRoZSByZW1haW5kZXIgaGFzIHRoZSBzYW1lIHNpZ24gYXMgdGhlIGRpdmlkZW5kLlxuICAgICAgICAgICAgICogICAgICAgICAgICAgVGhpcyBtb2R1bG8gbW9kZSBpcyBjb21tb25seSBrbm93biBhcyAndHJ1bmNhdGVkIGRpdmlzaW9uJyBhbmQgaXNcbiAgICAgICAgICAgICAqICAgICAgICAgICAgIGVxdWl2YWxlbnQgdG8gKGEgJSBuKSBpbiBKYXZhU2NyaXB0LlxuICAgICAgICAgICAgICogRkxPT1IgICAgIDMgVGhlIHJlbWFpbmRlciBoYXMgdGhlIHNhbWUgc2lnbiBhcyB0aGUgZGl2aXNvciAoUHl0aG9uICUpLlxuICAgICAgICAgICAgICogSEFMRl9FVkVOIDYgVGhpcyBtb2R1bG8gbW9kZSBpbXBsZW1lbnRzIHRoZSBJRUVFIDc1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nTnVtYmVyLnByb3RvdHlwZS50b0Zvcm1hdCBtZXRob2QuXG4gICAgICAgICAgICBGT1JNQVQgPSB7XG4gICAgICAgICAgICAgICAgZGVjaW1hbFNlcGFyYXRvcjogJy4nLFxuICAgICAgICAgICAgICAgIGdyb3VwU2VwYXJhdG9yOiAnLCcsXG4gICAgICAgICAgICAgICAgZ3JvdXBTaXplOiAzLFxuICAgICAgICAgICAgICAgIHNlY29uZGFyeUdyb3VwU2l6ZTogMCxcbiAgICAgICAgICAgICAgICBmcmFjdGlvbkdyb3VwU2VwYXJhdG9yOiAnXFx4QTAnLCAgICAgIC8vIG5vbi1icmVha2luZyBzcGFjZVxuICAgICAgICAgICAgICAgIGZyYWN0aW9uR3JvdXBTaXplOiAwXG4gICAgICAgICAgICB9O1xuXG5cbiAgICAgICAgLyoqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKi9cblxuXG4gICAgICAgIC8vIENPTlNUUlVDVE9SXG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiBUaGUgQmlnTnVtYmVyIGNvbnN0cnVjdG9yIGFuZCBleHBvcnRlZCBmdW5jdGlvbi5cbiAgICAgICAgICogQ3JlYXRlIGFuZCByZXR1cm4gYSBuZXcgaW5zdGFuY2Ugb2YgYSBCaWdOdW1iZXIgb2JqZWN0LlxuICAgICAgICAgKlxuICAgICAgICAgKiBuIHtudW1iZXJ8c3RyaW5nfEJpZ051bWJlcn0gQSBudW1lcmljIHZhbHVlLlxuICAgICAgICAgKiBbYl0ge251bWJlcn0gVGhlIGJhc2Ugb2Ygbi4gSW50ZWdlciwgMiB0byA2NCBpbmNsdXNpdmUuXG4gICAgICAgICAqL1xuICAgICAgICBmdW5jdGlvbiBCaWdOdW1iZXIoIG4sIGIgKSB7XG4gICAgICAgICAgICB2YXIgYywgZSwgaSwgbnVtLCBsZW4sIHN0cixcbiAgICAgICAgICAgICAgICB4ID0gdGhpcztcblxuICAgICAgICAgICAgLy8gRW5hYmxlIGNvbnN0cnVjdG9yIHVzYWdlIHdpdGhvdXQgbmV3LlxuICAgICAgICAgICAgaWYgKCAhKCB4IGluc3RhbmNlb2YgQmlnTnVtYmVyICkgKSB7XG5cbiAgICAgICAgICAgICAgICAvLyAnQmlnTnVtYmVyKCkgY29uc3RydWN0b3IgY2FsbCB3aXRob3V0IG5ldzoge259J1xuICAgICAgICAgICAgICAgIGlmIChFUlJPUlMpIHJhaXNlKCAyNiwgJ2NvbnN0cnVjdG9yIGNhbGwgd2l0aG91dCBuZXcnLCBuICk7XG4gICAgICAgICAgICAgICAgcmV0dXJuIG5ldyBCaWdOdW1iZXIoIG4sIGIgKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gJ25ldyBCaWdOdW1iZXIoKSBiYXNlIG5vdCBhbiBpbnRlZ2VyOiB7Yn0nXG4gICAgICAgICAgICAvLyAnbmV3IEJpZ051bWJlcigpIGJhc2Ugb3V0IG9mIHJhbmdlOiB7Yn0nXG4gICAgICAgICAgICBpZiAoIGIgPT0gbnVsbCB8fCAhaXNWYWxpZEludCggYiwgMiwgNjQsIGlkLCAnYmFzZScgKSApIHtcblxuICAgICAgICAgICAgICAgIC8vIER1cGxpY2F0ZS5cbiAgICAgICAgICAgICAgICBpZiAoIG4gaW5zdGFuY2VvZiBCaWdOdW1iZXIgKSB7XG4gICAgICAgICAgICAgICAgICAgIHgucyA9IG4ucztcbiAgICAgICAgICAgICAgICAgICAgeC5lID0gbi5lO1xuICAgICAgICAgICAgICAgICAgICB4LmMgPSAoIG4gPSBuLmMgKSA/IG4uc2xpY2UoKSA6IG47XG4gICAgICAgICAgICAgICAgICAgIGlkID0gMDtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmICggKCBudW0gPSB0eXBlb2YgbiA9PSAnbnVtYmVyJyApICYmIG4gKiAwID09IDAgKSB7XG4gICAgICAgICAgICAgICAgICAgIHgucyA9IDEgLyBuIDwgMCA/ICggbiA9IC1uLCAtMSApIDogMTtcblxuICAgICAgICAgICAgICAgICAgICAvLyBGYXN0IHBhdGggZm9yIGludGVnZXJzLlxuICAgICAgICAgICAgICAgICAgICBpZiAoIG4gPT09IH5+biApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoIGUgPSAwLCBpID0gbjsgaSA+PSAxMDsgaSAvPSAxMCwgZSsrICk7XG4gICAgICAgICAgICAgICAgICAgICAgICB4LmUgPSBlO1xuICAgICAgICAgICAgICAgICAgICAgICAgeC5jID0gW25dO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWQgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgc3RyID0gbiArICcnO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICggIWlzTnVtZXJpYy50ZXN0KCBzdHIgPSBuICsgJycgKSApIHJldHVybiBwYXJzZU51bWVyaWMoIHgsIHN0ciwgbnVtICk7XG4gICAgICAgICAgICAgICAgICAgIHgucyA9IHN0ci5jaGFyQ29kZUF0KDApID09PSA0NSA/ICggc3RyID0gc3RyLnNsaWNlKDEpLCAtMSApIDogMTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGIgPSBiIHwgMDtcbiAgICAgICAgICAgICAgICBzdHIgPSBuICsgJyc7XG5cbiAgICAgICAgICAgICAgICAvLyBFbnN1cmUgcmV0dXJuIHZhbHVlIGlzIHJvdW5kZWQgdG8gREVDSU1BTF9QTEFDRVMgYXMgd2l0aCBvdGhlciBiYXNlcy5cbiAgICAgICAgICAgICAgICAvLyBBbGxvdyBleHBvbmVudGlhbCBub3RhdGlvbiB0byBiZSB1c2VkIHdpdGggYmFzZSAxMCBhcmd1bWVudC5cbiAgICAgICAgICAgICAgICBpZiAoIGIgPT0gMTAgKSB7XG4gICAgICAgICAgICAgICAgICAgIHggPSBuZXcgQmlnTnVtYmVyKCBuIGluc3RhbmNlb2YgQmlnTnVtYmVyID8gbiA6IHN0ciApO1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcm91bmQoIHgsIERFQ0lNQUxfUExBQ0VTICsgeC5lICsgMSwgUk9VTkRJTkdfTU9ERSApO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIEF2b2lkIHBvdGVudGlhbCBpbnRlcnByZXRhdGlvbiBvZiBJbmZpbml0eSBhbmQgTmFOIGFzIGJhc2UgNDQrIHZhbHVlcy5cbiAgICAgICAgICAgICAgICAvLyBBbnkgbnVtYmVyIGluIGV4cG9uZW50aWFsIGZvcm0gd2lsbCBmYWlsIGR1ZSB0byB0aGUgW0VlXVsrLV0uXG4gICAgICAgICAgICAgICAgaWYgKCAoIG51bSA9IHR5cGVvZiBuID09ICdudW1iZXInICkgJiYgbiAqIDAgIT0gMCB8fFxuICAgICAgICAgICAgICAgICAgISggbmV3IFJlZ0V4cCggJ14tPycgKyAoIGMgPSAnWycgKyBBTFBIQUJFVC5zbGljZSggMCwgYiApICsgJ10rJyApICtcbiAgICAgICAgICAgICAgICAgICAgJyg/OlxcXFwuJyArIGMgKyAnKT8kJyxiIDwgMzcgPyAnaScgOiAnJyApICkudGVzdChzdHIpICkge1xuICAgICAgICAgICAgICAgICAgICByZXR1cm4gcGFyc2VOdW1lcmljKCB4LCBzdHIsIG51bSwgYiApO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChudW0pIHtcbiAgICAgICAgICAgICAgICAgICAgeC5zID0gMSAvIG4gPCAwID8gKCBzdHIgPSBzdHIuc2xpY2UoMSksIC0xICkgOiAxO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmICggRVJST1JTICYmIHN0ci5yZXBsYWNlKCAvXjBcXC4wKnxcXC4vLCAnJyApLmxlbmd0aCA+IDE1ICkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyAnbmV3IEJpZ051bWJlcigpIG51bWJlciB0eXBlIGhhcyBtb3JlIHRoYW4gMTUgc2lnbmlmaWNhbnQgZGlnaXRzOiB7bn0nXG4gICAgICAgICAgICAgICAgICAgICAgICByYWlzZSggaWQsIHRvb01hbnlEaWdpdHMsIG4gKTtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIC8vIFByZXZlbnQgbGF0ZXIgY2hlY2sgZm9yIGxlbmd0aCBvbiBjb252ZXJ0ZWQgbnVtYmVyLlxuICAgICAgICAgICAgICAgICAgICBudW0gPSBmYWxzZTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB4LnMgPSBzdHIuY2hhckNvZGVBdCgwKSA9PT0gNDUgPyAoIHN0ciA9IHN0ci5zbGljZSgxKSwgLTEgKSA6IDE7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgc3RyID0gY29udmVydEJhc2UoIHN0ciwgMTAsIGIsIHgucyApO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBEZWNpbWFsIHBvaW50P1xuICAgICAgICAgICAgaWYgKCAoIGUgPSBzdHIuaW5kZXhPZignLicpICkgPiAtMSApIHN0ciA9IHN0ci5yZXBsYWNlKCAnLicsICcnICk7XG5cbiAgICAgICAgICAgIC8vIEV4cG9uZW50aWFsIGZvcm0/XG4gICAgICAgICAgICBpZiAoICggaSA9IHN0ci5zZWFyY2goIC9lL2kgKSApID4gMCApIHtcblxuICAgICAgICAgICAgICAgIC8vIERldGVybWluZSBleHBvbmVudC5cbiAgICAgICAgICAgICAgICBpZiAoIGUgPCAwICkgZSA9IGk7XG4gICAgICAgICAgICAgICAgZSArPSArc3RyLnNsaWNlKCBpICsgMSApO1xuICAgICAgICAgICAgICAgIHN0ciA9IHN0ci5zdWJzdHJpbmcoIDAsIGkgKTtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoIGUgPCAwICkge1xuXG4gICAgICAgICAgICAgICAgLy8gSW50ZWdlci5cbiAgICAgICAgICAgICAgICBlID0gc3RyLmxlbmd0aDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gRGV0ZXJtaW5lIGxlYWRpbmcgemVyb3MuXG4gICAgICAgICAgICBmb3IgKCBpID0gMDsgc3RyLmNoYXJDb2RlQXQoaSkgPT09IDQ4OyBpKysgKTtcblxuICAgICAgICAgICAgLy8gRGV0ZXJtaW5lIHRyYWlsaW5nIHplcm9zLlxuICAgICAgICAgICAgZm9yICggbGVuID0gc3RyLmxlbmd0aDsgc3RyLmNoYXJDb2RlQXQoLS1sZW4pID09PSA0ODsgKTtcbiAgICAgICAgICAgIHN0ciA9IHN0ci5zbGljZSggaSwgbGVuICsgMSApO1xuXG4gICAgICAgICAgICBpZiAoc3RyKSB7XG4gICAgICAgICAgICAgICAgbGVuID0gc3RyLmxlbmd0aDtcblxuICAgICAgICAgICAgICAgIC8vIERpc2FsbG93IG51bWJlcnMgd2l0aCBvdmVyIDE1IHNpZ25pZmljYW50IGRpZ2l0cyBpZiBudW1iZXIgdHlwZS5cbiAgICAgICAgICAgICAgICAvLyAnbmV3IEJpZ051bWJlcigpIG51bWJlciB0eXBlIGhhcyBtb3JlIHRoYW4gMTUgc2lnbmlmaWNhbnQgZGlnaXRzOiB7bn0nXG4gICAgICAgICAgICAgICAgaWYgKCBudW0gJiYgRVJST1JTICYmIGxlbiA+IDE1ICkgcmFpc2UoIGlkLCB0b29NYW55RGlnaXRzLCB4LnMgKiBuICk7XG5cbiAgICAgICAgICAgICAgICBlID0gZSAtIGkgLSAxO1xuXG4gICAgICAgICAgICAgICAgIC8vIE92ZXJmbG93P1xuICAgICAgICAgICAgICAgIGlmICggZSA+IE1BWF9FWFAgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gSW5maW5pdHkuXG4gICAgICAgICAgICAgICAgICAgIHguYyA9IHguZSA9IG51bGw7XG5cbiAgICAgICAgICAgICAgICAvLyBVbmRlcmZsb3c/XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICggZSA8IE1JTl9FWFAgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gWmVyby5cbiAgICAgICAgICAgICAgICAgICAgeC5jID0gWyB4LmUgPSAwIF07XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgeC5lID0gZTtcbiAgICAgICAgICAgICAgICAgICAgeC5jID0gW107XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gVHJhbnNmb3JtIGJhc2VcblxuICAgICAgICAgICAgICAgICAgICAvLyBlIGlzIHRoZSBiYXNlIDEwIGV4cG9uZW50LlxuICAgICAgICAgICAgICAgICAgICAvLyBpIGlzIHdoZXJlIHRvIHNsaWNlIHN0ciB0byBnZXQgdGhlIGZpcnN0IGVsZW1lbnQgb2YgdGhlIGNvZWZmaWNpZW50IGFycmF5LlxuICAgICAgICAgICAgICAgICAgICBpID0gKCBlICsgMSApICUgTE9HX0JBU0U7XG4gICAgICAgICAgICAgICAgICAgIGlmICggZSA8IDAgKSBpICs9IExPR19CQVNFO1xuXG4gICAgICAgICAgICAgICAgICAgIGlmICggaSA8IGxlbiApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmIChpKSB4LmMucHVzaCggK3N0ci5zbGljZSggMCwgaSApICk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoIGxlbiAtPSBMT0dfQkFTRTsgaSA8IGxlbjsgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgeC5jLnB1c2goICtzdHIuc2xpY2UoIGksIGkgKz0gTE9HX0JBU0UgKSApO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICBzdHIgPSBzdHIuc2xpY2UoaSk7XG4gICAgICAgICAgICAgICAgICAgICAgICBpID0gTE9HX0JBU0UgLSBzdHIubGVuZ3RoO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgaSAtPSBsZW47XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBmb3IgKCA7IGktLTsgc3RyICs9ICcwJyApO1xuICAgICAgICAgICAgICAgICAgICB4LmMucHVzaCggK3N0ciApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAvLyBaZXJvLlxuICAgICAgICAgICAgICAgIHguYyA9IFsgeC5lID0gMCBdO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBpZCA9IDA7XG4gICAgICAgIH1cblxuXG4gICAgICAgIC8vIENPTlNUUlVDVE9SIFBST1BFUlRJRVNcblxuXG4gICAgICAgIEJpZ051bWJlci5hbm90aGVyID0gYW5vdGhlcjtcblxuICAgICAgICBCaWdOdW1iZXIuUk9VTkRfVVAgPSAwO1xuICAgICAgICBCaWdOdW1iZXIuUk9VTkRfRE9XTiA9IDE7XG4gICAgICAgIEJpZ051bWJlci5ST1VORF9DRUlMID0gMjtcbiAgICAgICAgQmlnTnVtYmVyLlJPVU5EX0ZMT09SID0gMztcbiAgICAgICAgQmlnTnVtYmVyLlJPVU5EX0hBTEZfVVAgPSA0O1xuICAgICAgICBCaWdOdW1iZXIuUk9VTkRfSEFMRl9ET1dOID0gNTtcbiAgICAgICAgQmlnTnVtYmVyLlJPVU5EX0hBTEZfRVZFTiA9IDY7XG4gICAgICAgIEJpZ051bWJlci5ST1VORF9IQUxGX0NFSUwgPSA3O1xuICAgICAgICBCaWdOdW1iZXIuUk9VTkRfSEFMRl9GTE9PUiA9IDg7XG4gICAgICAgIEJpZ051bWJlci5FVUNMSUQgPSA5O1xuXG5cbiAgICAgICAgLypcbiAgICAgICAgICogQ29uZmlndXJlIGluZnJlcXVlbnRseS1jaGFuZ2luZyBsaWJyYXJ5LXdpZGUgc2V0dGluZ3MuXG4gICAgICAgICAqXG4gICAgICAgICAqIEFjY2VwdCBhbiBvYmplY3Qgb3IgYW4gYXJndW1lbnQgbGlzdCwgd2l0aCBvbmUgb3IgbWFueSBvZiB0aGUgZm9sbG93aW5nIHByb3BlcnRpZXMgb3JcbiAgICAgICAgICogcGFyYW1ldGVycyByZXNwZWN0aXZlbHk6XG4gICAgICAgICAqXG4gICAgICAgICAqICAgREVDSU1BTF9QTEFDRVMgIHtudW1iZXJ9ICBJbnRlZ2VyLCAwIHRvIE1BWCBpbmNsdXNpdmVcbiAgICAgICAgICogICBST1VORElOR19NT0RFICAge251bWJlcn0gIEludGVnZXIsIDAgdG8gOCBpbmNsdXNpdmVcbiAgICAgICAgICogICBFWFBPTkVOVElBTF9BVCAge251bWJlcnxudW1iZXJbXX0gIEludGVnZXIsIC1NQVggdG8gTUFYIGluY2x1c2l2ZSBvclxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW2ludGVnZXIgLU1BWCB0byAwIGluY2wuLCAwIHRvIE1BWCBpbmNsLl1cbiAgICAgICAgICogICBSQU5HRSAgICAgICAgICAge251bWJlcnxudW1iZXJbXX0gIE5vbi16ZXJvIGludGVnZXIsIC1NQVggdG8gTUFYIGluY2x1c2l2ZSBvclxuICAgICAgICAgKiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgW2ludGVnZXIgLU1BWCB0byAtMSBpbmNsLiwgaW50ZWdlciAxIHRvIE1BWCBpbmNsLl1cbiAgICAgICAgICogICBFUlJPUlMgICAgICAgICAge2Jvb2xlYW58bnVtYmVyfSAgIHRydWUsIGZhbHNlLCAxIG9yIDBcbiAgICAgICAgICogICBDUllQVE8gICAgICAgICAge2Jvb2xlYW58bnVtYmVyfSAgIHRydWUsIGZhbHNlLCAxIG9yIDBcbiAgICAgICAgICogICBNT0RVTE9fTU9ERSAgICAge251bWJlcn0gICAgICAgICAgIDAgdG8gOSBpbmNsdXNpdmVcbiAgICAgICAgICogICBQT1dfUFJFQ0lTSU9OICAge251bWJlcn0gICAgICAgICAgIDAgdG8gTUFYIGluY2x1c2l2ZVxuICAgICAgICAgKiAgIEZPUk1BVCAgICAgICAgICB7b2JqZWN0fSAgICAgICAgICAgU2VlIEJpZ051bWJlci5wcm90b3R5cGUudG9Gb3JtYXRcbiAgICAgICAgICogICAgICBkZWNpbWFsU2VwYXJhdG9yICAgICAgIHtzdHJpbmd9XG4gICAgICAgICAqICAgICAgZ3JvdXBTZXBhcmF0b3IgICAgICAgICB7c3RyaW5nfVxuICAgICAgICAgKiAgICAgIGdyb3VwU2l6ZSAgICAgICAgICAgICAge251bWJlcn1cbiAgICAgICAgICogICAgICBzZWNvbmRhcnlHcm91cFNpemUgICAgIHtudW1iZXJ9XG4gICAgICAgICAqICAgICAgZnJhY3Rpb25Hcm91cFNlcGFyYXRvciB7c3RyaW5nfVxuICAgICAgICAgKiAgICAgIGZyYWN0aW9uR3JvdXBTaXplICAgICAge251bWJlcn1cbiAgICAgICAgICpcbiAgICAgICAgICogKFRoZSB2YWx1ZXMgYXNzaWduZWQgdG8gdGhlIGFib3ZlIEZPUk1BVCBvYmplY3QgcHJvcGVydGllcyBhcmUgbm90IGNoZWNrZWQgZm9yIHZhbGlkaXR5LilcbiAgICAgICAgICpcbiAgICAgICAgICogRS5nLlxuICAgICAgICAgKiBCaWdOdW1iZXIuY29uZmlnKDIwLCA0KSBpcyBlcXVpdmFsZW50IHRvXG4gICAgICAgICAqIEJpZ051bWJlci5jb25maWcoeyBERUNJTUFMX1BMQUNFUyA6IDIwLCBST1VORElOR19NT0RFIDogNCB9KVxuICAgICAgICAgKlxuICAgICAgICAgKiBJZ25vcmUgcHJvcGVydGllcy9wYXJhbWV0ZXJzIHNldCB0byBudWxsIG9yIHVuZGVmaW5lZC5cbiAgICAgICAgICogUmV0dXJuIGFuIG9iamVjdCB3aXRoIHRoZSBwcm9wZXJ0aWVzIGN1cnJlbnQgdmFsdWVzLlxuICAgICAgICAgKi9cbiAgICAgICAgQmlnTnVtYmVyLmNvbmZpZyA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciB2LCBwLFxuICAgICAgICAgICAgICAgIGkgPSAwLFxuICAgICAgICAgICAgICAgIHIgPSB7fSxcbiAgICAgICAgICAgICAgICBhID0gYXJndW1lbnRzLFxuICAgICAgICAgICAgICAgIG8gPSBhWzBdLFxuICAgICAgICAgICAgICAgIGhhcyA9IG8gJiYgdHlwZW9mIG8gPT0gJ29iamVjdCdcbiAgICAgICAgICAgICAgICAgID8gZnVuY3Rpb24gKCkgeyBpZiAoIG8uaGFzT3duUHJvcGVydHkocCkgKSByZXR1cm4gKCB2ID0gb1twXSApICE9IG51bGw7IH1cbiAgICAgICAgICAgICAgICAgIDogZnVuY3Rpb24gKCkgeyBpZiAoIGEubGVuZ3RoID4gaSApIHJldHVybiAoIHYgPSBhW2krK10gKSAhPSBudWxsOyB9O1xuXG4gICAgICAgICAgICAvLyBERUNJTUFMX1BMQUNFUyB7bnVtYmVyfSBJbnRlZ2VyLCAwIHRvIE1BWCBpbmNsdXNpdmUuXG4gICAgICAgICAgICAvLyAnY29uZmlnKCkgREVDSU1BTF9QTEFDRVMgbm90IGFuIGludGVnZXI6IHt2fSdcbiAgICAgICAgICAgIC8vICdjb25maWcoKSBERUNJTUFMX1BMQUNFUyBvdXQgb2YgcmFuZ2U6IHt2fSdcbiAgICAgICAgICAgIGlmICggaGFzKCBwID0gJ0RFQ0lNQUxfUExBQ0VTJyApICYmIGlzVmFsaWRJbnQoIHYsIDAsIE1BWCwgMiwgcCApICkge1xuICAgICAgICAgICAgICAgIERFQ0lNQUxfUExBQ0VTID0gdiB8IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByW3BdID0gREVDSU1BTF9QTEFDRVM7XG5cbiAgICAgICAgICAgIC8vIFJPVU5ESU5HX01PREUge251bWJlcn0gSW50ZWdlciwgMCB0byA4IGluY2x1c2l2ZS5cbiAgICAgICAgICAgIC8vICdjb25maWcoKSBST1VORElOR19NT0RFIG5vdCBhbiBpbnRlZ2VyOiB7dn0nXG4gICAgICAgICAgICAvLyAnY29uZmlnKCkgUk9VTkRJTkdfTU9ERSBvdXQgb2YgcmFuZ2U6IHt2fSdcbiAgICAgICAgICAgIGlmICggaGFzKCBwID0gJ1JPVU5ESU5HX01PREUnICkgJiYgaXNWYWxpZEludCggdiwgMCwgOCwgMiwgcCApICkge1xuICAgICAgICAgICAgICAgIFJPVU5ESU5HX01PREUgPSB2IHwgMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJbcF0gPSBST1VORElOR19NT0RFO1xuXG4gICAgICAgICAgICAvLyBFWFBPTkVOVElBTF9BVCB7bnVtYmVyfG51bWJlcltdfVxuICAgICAgICAgICAgLy8gSW50ZWdlciwgLU1BWCB0byBNQVggaW5jbHVzaXZlIG9yIFtpbnRlZ2VyIC1NQVggdG8gMCBpbmNsdXNpdmUsIDAgdG8gTUFYIGluY2x1c2l2ZV0uXG4gICAgICAgICAgICAvLyAnY29uZmlnKCkgRVhQT05FTlRJQUxfQVQgbm90IGFuIGludGVnZXI6IHt2fSdcbiAgICAgICAgICAgIC8vICdjb25maWcoKSBFWFBPTkVOVElBTF9BVCBvdXQgb2YgcmFuZ2U6IHt2fSdcbiAgICAgICAgICAgIGlmICggaGFzKCBwID0gJ0VYUE9ORU5USUFMX0FUJyApICkge1xuXG4gICAgICAgICAgICAgICAgaWYgKCBpc0FycmF5KHYpICkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIGlzVmFsaWRJbnQoIHZbMF0sIC1NQVgsIDAsIDIsIHAgKSAmJiBpc1ZhbGlkSW50KCB2WzFdLCAwLCBNQVgsIDIsIHAgKSApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIFRPX0VYUF9ORUcgPSB2WzBdIHwgMDtcbiAgICAgICAgICAgICAgICAgICAgICAgIFRPX0VYUF9QT1MgPSB2WzFdIHwgMDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoIGlzVmFsaWRJbnQoIHYsIC1NQVgsIE1BWCwgMiwgcCApICkge1xuICAgICAgICAgICAgICAgICAgICBUT19FWFBfTkVHID0gLSggVE9fRVhQX1BPUyA9ICggdiA8IDAgPyAtdiA6IHYgKSB8IDAgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByW3BdID0gWyBUT19FWFBfTkVHLCBUT19FWFBfUE9TIF07XG5cbiAgICAgICAgICAgIC8vIFJBTkdFIHtudW1iZXJ8bnVtYmVyW119IE5vbi16ZXJvIGludGVnZXIsIC1NQVggdG8gTUFYIGluY2x1c2l2ZSBvclxuICAgICAgICAgICAgLy8gW2ludGVnZXIgLU1BWCB0byAtMSBpbmNsdXNpdmUsIGludGVnZXIgMSB0byBNQVggaW5jbHVzaXZlXS5cbiAgICAgICAgICAgIC8vICdjb25maWcoKSBSQU5HRSBub3QgYW4gaW50ZWdlcjoge3Z9J1xuICAgICAgICAgICAgLy8gJ2NvbmZpZygpIFJBTkdFIGNhbm5vdCBiZSB6ZXJvOiB7dn0nXG4gICAgICAgICAgICAvLyAnY29uZmlnKCkgUkFOR0Ugb3V0IG9mIHJhbmdlOiB7dn0nXG4gICAgICAgICAgICBpZiAoIGhhcyggcCA9ICdSQU5HRScgKSApIHtcblxuICAgICAgICAgICAgICAgIGlmICggaXNBcnJheSh2KSApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCBpc1ZhbGlkSW50KCB2WzBdLCAtTUFYLCAtMSwgMiwgcCApICYmIGlzVmFsaWRJbnQoIHZbMV0sIDEsIE1BWCwgMiwgcCApICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgTUlOX0VYUCA9IHZbMF0gfCAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgTUFYX0VYUCA9IHZbMV0gfCAwO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICggaXNWYWxpZEludCggdiwgLU1BWCwgTUFYLCAyLCBwICkgKSB7XG4gICAgICAgICAgICAgICAgICAgIGlmICggdiB8IDAgKSBNSU5fRVhQID0gLSggTUFYX0VYUCA9ICggdiA8IDAgPyAtdiA6IHYgKSB8IDAgKTtcbiAgICAgICAgICAgICAgICAgICAgZWxzZSBpZiAoRVJST1JTKSByYWlzZSggMiwgcCArICcgY2Fubm90IGJlIHplcm8nLCB2ICk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcltwXSA9IFsgTUlOX0VYUCwgTUFYX0VYUCBdO1xuXG4gICAgICAgICAgICAvLyBFUlJPUlMge2Jvb2xlYW58bnVtYmVyfSB0cnVlLCBmYWxzZSwgMSBvciAwLlxuICAgICAgICAgICAgLy8gJ2NvbmZpZygpIEVSUk9SUyBub3QgYSBib29sZWFuIG9yIGJpbmFyeSBkaWdpdDoge3Z9J1xuICAgICAgICAgICAgaWYgKCBoYXMoIHAgPSAnRVJST1JTJyApICkge1xuXG4gICAgICAgICAgICAgICAgaWYgKCB2ID09PSAhIXYgfHwgdiA9PT0gMSB8fCB2ID09PSAwICkge1xuICAgICAgICAgICAgICAgICAgICBpZCA9IDA7XG4gICAgICAgICAgICAgICAgICAgIGlzVmFsaWRJbnQgPSAoIEVSUk9SUyA9ICEhdiApID8gaW50VmFsaWRhdG9yV2l0aEVycm9ycyA6IGludFZhbGlkYXRvck5vRXJyb3JzO1xuICAgICAgICAgICAgICAgIH0gZWxzZSBpZiAoRVJST1JTKSB7XG4gICAgICAgICAgICAgICAgICAgIHJhaXNlKCAyLCBwICsgbm90Qm9vbCwgdiApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJbcF0gPSBFUlJPUlM7XG5cbiAgICAgICAgICAgIC8vIENSWVBUTyB7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7XG4gICAgICAgICAgICAgICAgTU9EVUxPX01PREUgPSB2IHwgMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJbcF0gPSBNT0RVTE9fTU9ERTtcblxuICAgICAgICAgICAgLy8gUE9XX1BSRUNJU0lPTiB7bnVtYmVyfSBJbnRlZ2VyLCAwIHRvIE1BWCBpbmNsdXNpdmUuXG4gICAgICAgICAgICAvLyAnY29uZmlnKCkgUE9XX1BSRUNJU0lPTiBub3QgYW4gaW50ZWdlcjoge3Z9J1xuICAgICAgICAgICAgLy8gJ2NvbmZpZygpIFBPV19QUkVDSVNJT04gb3V0IG9mIHJhbmdlOiB7dn0nXG4gICAgICAgICAgICBpZiAoIGhhcyggcCA9ICdQT1dfUFJFQ0lTSU9OJyApICYmIGlzVmFsaWRJbnQoIHYsIDAsIE1BWCwgMiwgcCApICkge1xuICAgICAgICAgICAgICAgIFBPV19QUkVDSVNJT04gPSB2IHwgMDtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJbcF0gPSBQT1dfUFJFQ0lTSU9OO1xuXG4gICAgICAgICAgICAvLyBGT1JNQVQge29iamVjdH1cbiAgICAgICAgICAgIC8vICdjb25maWcoKSBGT1JNQVQgbm90IGFuIG9iamVjdDoge3Z9J1xuICAgICAgICAgICAgaWYgKCBoYXMoIHAgPSAnRk9STUFUJyApICkge1xuXG4gICAgICAgICAgICAgICAgaWYgKCB0eXBlb2YgdiA9PSAnb2JqZWN0JyApIHtcbiAgICAgICAgICAgICAgICAgICAgRk9STUFUID0gdjtcbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKEVSUk9SUykge1xuICAgICAgICAgICAgICAgICAgICByYWlzZSggMiwgcCArICcgbm90IGFuIG9iamVjdCcsIHYgKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByW3BdID0gRk9STUFUO1xuXG4gICAgICAgICAgICByZXR1cm4gcjtcbiAgICAgICAgfTtcblxuXG4gICAgICAg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tcbiAgICAgICAgICAgICAgICAgIChNYXRoLnJhbmRvbSgpICogMHg4MDAwMDAgfCAwKTsgfTtcblxuICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uIChkcCkge1xuICAgICAgICAgICAgICAgIHZhciBhLCBiLCBlLCBrLCB2LFxuICAgICAgICAgICAgICAgICAgICBpID0gMCxcbiAgICAgICAgICAgICAgICAgICAgYyA9IFtdLFxuICAgICAgICAgICAgICAgICAgICByYW5kID0gbmV3IEJpZ051bWJlcihPTkUpO1xuXG4gICAgICAgICAgICAgICAgZHAgPSBkcCA9PSBudWxsIHx8ICFpc1ZhbGlkSW50KCBkcCwgMCwgTUFYLCAxNCApID8gREVDSU1BTF9QTEFDRVMgOiBkcCB8IDA7XG4gICAgICAgICAgICAgICAgayA9IG1hdGhjZWlsKCBkcCAvIExPR19CQVNFICk7XG5cbiAgICAgICAgICAgICAgICBpZiAoQ1JZUFRPKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gQnJvd3NlcnMgc3VwcG9ydGluZyBjcnlwdG8uZ2V0UmFuZG9tVmFsdWVzLlxuICAgICAgICAgICAgICAgICAgICBpZiAoIGNyeXB0byAmJiBjcnlwdG8uZ2V0UmFuZG9tVmFsdWVzICkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBhID0gY3J5cHRvLmdldFJhbmRvbVZhbHVlcyggbmV3IFVpbnQzMkFycmF5KCBrICo9IDIgKSApO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBmb3IgKCA7IGkgPCBrOyApIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIDUzIGJpdHM6XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gKChNYXRoLnBvdygyLCAzMikgLSAxKSAqIE1hdGgucG93KDIsIDIxKSkudG9TdHJpbmcoMilcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAxMTExMSAxMTExMTExMSAxMTExMTExMSAxMTExMTExMSAxMTEwMDAwMCAwMDAwMDAwMCAwMDAwMDAwMFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICgoTWF0aC5wb3coMiwgMzIpIC0gMSkgPj4+IDExKS50b1N0cmluZygyKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIDExMTExIDExMTExMTExIDExMTExMTExXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gMHgyMDAwMCBpcyAyXjIxLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHYgPSBhW2ldICogMHgyMDAwMCArIChhW2kgKyAxXSA+Pj4gMTEpO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gUmVqZWN0aW9uIHNhbXBsaW5nOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIDAgPD0gdiA8IDkwMDcxOTkyNTQ3NDA5OTJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBQcm9iYWJpbGl0eSB0aGF0IHYgPj0gOWUxNSwgaXNcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyA3MTk5MjU0NzQwOTkyIC8gOTAwNzE5OTI1NDc0MDk5MiB+PSAwLjAwMDgsIGkuZS4gMSBpbiAxMjUxXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCB2ID49IDllMTUgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGIgPSBjcnlwdG8uZ2V0UmFuZG9tVmFsdWVzKCBuZXcgVWludDMyQXJyYXkoMikgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYVtpXSA9IGJbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGFbaSArIDFdID0gYlsxXTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIDAgPD0gdiA8PSA4OTk5OTk5OTk5OTk5OTk5XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIDAgPD0gKHYgJSAxZTE0KSA8PSA5OTk5OTk5OTk5OTk5OVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjLnB1c2goIHYgJSAxZTE0ICk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgKz0gMjtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICBpID0gayAvIDI7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gTm9kZS5qcyBzdXBwb3J0aW5nIGNyeXB0by5yYW5kb21CeXRlcy5cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICggY3J5cHRvICYmIGNyeXB0by5yYW5kb21CeXRlcyApIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gYnVmZmVyXG4gICAgICAgICAgICAgICAgICAgICAgICBhID0gY3J5cHRvLnJhbmRvbUJ5dGVzKCBrICo9IDcgKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgZm9yICggOyBpIDwgazsgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAweDEwMDAwMDAwMDAwMDAgaXMgMl40OCwgMHgxMDAwMDAwMDAwMCBpcyAyXjQwXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gMHgxMDAwMDAwMDAgaXMgMl4zMiwgMHgxMDAwMDAwIGlzIDJeMjRcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAxMTExMSAxMTExMTExMSAxMTExMTExMSAxMTExMTExMSAxMTExMTExMSAxMTExMTExMSAxMTExMTExMVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIDAgPD0gdiA8IDkwMDcxOTkyNTQ3NDA5OTJcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB2ID0gKCAoIGFbaV0gJiAzMSApICogMHgxMDAwMDAwMDAwMDAwICkgKyAoIGFbaSArIDFdICogMHgxMDAwMDAwMDAwMCApICtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAoIGFbaSArIDJdICogMHgxMDAwMDAwMDAgKSArICggYVtpICsgM10gKiAweDEwMDAwMDAgKSArXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKCBhW2kgKyA0XSA8PCAxNiApICsgKCBhW2kgKyA1XSA8PCA4ICkgKyBhW2kgKyA2XTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggdiA+PSA5ZTE1ICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjcnlwdG8ucmFuZG9tQnl0ZXMoNykuY29weSggYSwgaSApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gMCA8PSAodiAlIDFlMTQpIDw9IDk5OTk5OTk5OTk5OTk5XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGMucHVzaCggdiAlIDFlMTQgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaSArPSA3O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgIGkgPSBrIC8gNztcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChFUlJPUlMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJhaXNlKCAxNCwgJ2NyeXB0byB1bmF2YWlsYWJsZScsIGNyeXB0byApO1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gVXNlIE1hdGgucmFuZG9tOiBDUllQVE8gaXMgZmFsc2Ugb3IgY3J5cHRvIGlzIHVuYXZhaWxhYmxlIGFuZCBFUlJPUlMgaXMgZmFsc2UuXG4gICAgICAgICAgICAgICAgaWYgKCFpKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgZm9yICggOyBpIDwgazsgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB2ID0gcmFuZG9tNTNiaXRJbnQoKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggdiA8IDllMTUgKSBjW2krK10gPSB2ICUgMWUxNDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGsgPSBjWy0taV07XG4gICAgICAgICAgICAgICAgZHAgJT0gTE9HX0JBU0U7XG5cbiAgICAgICAgICAgICAgICAvLyBDb252ZXJ0IHRyYWlsaW5nIGRpZ2l0cyB0byB6ZXJvcyBhY2NvcmRpbmcgdG8gZHAuXG4gICAgICAgICAgICAgICAgaWYgKCBrICYmIGRwICkge1xuICAgICAgICAgICAgICAgICAgICB2ID0gUE9XU19URU5bTE9HX0JBU0UgLSBkcF07XG4gICAgICAgICAgICAgICAgICAgIGNbaV0gPSBtYXRoZmxvb3IoIGsgLyB2ICkgKiB2O1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIC8vIFJlbW92ZSB0cmFpbGluZyBlbGVtZW50cyB3aGljaCBhcmUgemVyby5cbiAgICAgICAgICAgICAgICBmb3IgKCA7IGNbaV0gPT09IDA7IGMucG9wKCksIGktLSApO1xuXG4gICAgICAgICAgICAgICAgLy8gWmVybz9cbiAgICAgICAgICAgICAgICBpZiAoIGkgPCAwICkge1xuICAgICAgICAgICAgICAgICAgICBjID0gWyBlID0gMCBdO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gUmVtb3ZlIGxlYWRpbmcgZWxlbWVudHMgd2hpY2ggYXJlIHplcm8gYW5kIGFkanVzdCBleHBvbmVudCBhY2NvcmRpbmdseS5cbiAgICAgICAgICAgICAgICAgICAgZm9yICggZSA9IC0xIDsgY1swXSA9PT0gMDsgYy5zaGlmdCgpLCBlIC09IExPR19CQVNFKTtcblxuICAgICAgICAgICAgICAgICAgICAvLyBDb3VudCB0aGUgZGlnaXRzIG9mIHRoZSBmaXJzdCBlbGVtZW50IG9mIGMgdG8gZGV0ZXJtaW5lIGxlYWRpbmcgemVyb3MsIGFuZC4uLlxuICAgICAgICAgICAgICAgICAgICBmb3IgKCBpID0gMSwgdiA9IGNbMF07IHYgPj0gMTA7IHYgLz0gMTAsIGkrKyk7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gYWRqdXN0IHRoZSBleHBvbmVudCBhY2NvcmRpbmdseS5cbiAgICAgICAgICAgICAgICAgICAgaWYgKCBpIDwgTE9HX0JBU0UgKSBlIC09IExPR19CQVNFIC0gaTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByYW5kLmUgPSBlO1xuICAgICAgICAgICAgICAgIHJhbmQuYyA9IGM7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHJhbmQ7XG4gICAgICAgICAgICB9O1xuICAgICAgICB9KSgpO1xuXG5cbiAgICAgICAgLy8gUFJJVkFURSBGVU5DVElPTlNcblxuXG4gICAgICAgIC8vIENvbnZlcnQgYSBudW1lcmljIHN0cmluZyBvZiBiYXNlSW4gdG8gYSBudW1lcmljIHN0cmluZyBvZiBiYXNlT3V0LlxuICAgICAgICBmdW5jdGlvbiBjb252ZXJ0QmFzZSggc3RyLCBiYXNlT3V0LCBiYXNlSW4sIHNpZ24gKSB7XG4gICAgICAgICAgICB2YXIgZCwgZSwgaywgciwgeCwgeGMsIHksXG4gICAgICAgICAgICAgICAgaSA9IHN0ci5pbmRleE9mKCAnLicgKSxcbiAgICAgICAgICAgICAgICBkcCA9IERFQ0lNQUxfUExBQ0VTLFxuICAgICAgICAgICAgICAgIHJtID0gUk9VTkRJTkdfTU9ERTtcblxuICAgICAgICAgICAgaWYgKCBiYXNlSW4gPCAzNyApIHN0ciA9IHN0ci50b0xvd2VyQ2FzZSgpO1xuXG4gICAgICAgICAgICAvLyBOb24taW50ZWdlci5cbiAgICAgICAgICAgIGlmICggaSA+PSAwICkge1xuICAgICAgICAgICAgICAgIGsgPSBQT1dfUFJFQ0lTSU9OO1xuXG4gICAgICAgICAgICAgICAgLy8gVW5saW1pdGVkIHByZWNpc2lvbi5cbiAgICAgICAgICAgICAgICBQT1dfUFJFQ0lTSU9OID0gMDtcbiAgICAgICAgICAgICAgICBzdHIgPSBzdHIucmVwbGFjZSggJy4nLCAnJyApO1xuICAgICAgICAgICAgICAgIHkgPSBuZXcgQmlnTnVtYmVyKGJhc2VJbik7XG4gICAgICAgICAgICAgICAgeCA9IHkucG93KCBzdHIubGVuZ3RoIC0gaSApO1xuICAgICAgICAgICAgICAgIFBPV19QUkVDSVNJT04gPSBrO1xuXG4gICAgICAgICAgICAgICAgLy8gQ29udmVydCBzdHIgYXMgaWYgYW4gaW50ZWdlciwgdGhlbiByZXN0b3JlIHRoZSBmcmFjdGlvbiBwYXJ0IGJ5IGRpdmlkaW5nIHRoZVxuICAgICAgICAgICAgICAgIC8vIHJlc3VsdCBieSBpdHMgYmFzZSByYWlzZWQgdG8gYSBwb3dlci5cbiAgICAgICAgICAgICAgICB5LmMgPSB0b0Jhc2VPdXQoIHRvRml4ZWRQb2ludCggY29lZmZUb1N0cmluZyggeC5jICksIHguZSApLCAxMCwgYmFzZU91dCApO1xuICAgICAgICAgICAgICAgIHkuZSA9IHkuYy5sZW5ndGg7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIENvbnZlcnQgdGhlIG51bWJlciBhcyBpbnRlZ2VyLlxuICAgICAgICAgICAgeGMgPSB0b0Jhc2VPdXQoIHN0ciwgYmFzZUluLCBiYXNlT3V0ICk7XG4gICAgICAgICAgICBlID0gayA9IHhjLmxlbmd0aDtcblxuICAgICAgICAgICAgLy8gUmVtb3ZlIHRyYWlsaW5nIHplcm9zLlxuICAgICAgICAgICAgZm9yICggOyB4Y1stLWtdID09IDA7IHhjLnBvcCgpICk7XG4gICAgICAgICAgICBpZiAoICF4Y1swXSApIHJldHVybiAnMCc7XG5cbiAgICAgICAgICAgIGlmICggaSA8IDAgKSB7XG4gICAgICAgICAgICAgICAgLS1lO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB4LmMgPSB4YztcbiAgICAgICAgICAgICAgICB4LmUgPSBlO1xuXG4gICAgICAgICAgICAgICAgLy8gc2lnbiBpcyBuZWVkZWQgZm9yIGNvcnJlY3Qgcm91bmRpbmcuXG4gICAgICAgICAgICAgICAgeC5zID0gc2lnbjtcbiAgICAgICAgICAgICAgICB4ID0gZGl2KCB4LCB5LCBkcCwgcm0sIGJhc2VPdXQgKTtcbiAgICAgICAgICAgICAgICB4YyA9IHguYztcbiAgICAgICAgICAgICAgICByID0geC5yO1xuICAgICAgICAgICAgICAgIGUgPSB4LmU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGQgPSBlICsgZHAgKyAxO1xuXG4gICAgICAgICAgICAvLyBUaGUgcm91bmRpbmcgZGlnaXQsIGkuZS4gdGhlIGRpZ2l0IHRvIHRoZSByaWdodCBvZiB0aGUgZGlnaXQgdGhhdCBtYXkgYmUgcm91bmRlZCB1cC5cbiAgICAgICAgICAgIGkgPSB4Y1tkXTtcbiAgICAgICAgICAgIGsgPSBiYXNlT3V0IC8gMjtcbiAgICAgICAgICAgIHIgPSByIHx8IGQgPCAwIHx8IHhjW2QgKyAxXSAhPSBudWxsO1xuXG4gICAgICAgICAgICByID0gcm0gPCA0ID8gKCBpICE9IG51bGwgfHwgciApICYmICggcm0gPT0gMCB8fCBybSA9PSAoIHgucyA8IDAgPyAzIDogMiApIClcbiAgICAgICAgICAgICAgICAgICAgICAgOiBpID4gayB8fCBpID09IGsgJiYoIHJtID09IDQgfHwgciB8fCBybSA9PSA2ICYmIHhjW2QgLSAxXSAmIDEgfHxcbiAgICAgICAgICAgICAgICAgICAgICAgICBybSA9PSAoIHgucyA8IDAgPyA4IDogNyApICk7XG5cbiAgICAgICAgICAgIGlmICggZCA8IDEgfHwgIXhjWzBdICkge1xuXG4gICAgICAgICAgICAgICAgLy8gMV4tZHAgb3IgMC5cbiAgICAgICAgICAgICAgICBzdHIgPSByID8gdG9GaXhlZFBvaW50KCAnMScsIC1kcCApIDogJzAnO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICB4Yy5sZW5ndGggPSBkO1xuXG4gICAgICAgICAgICAgICAgaWYgKHIpIHtcblxuICAgICAgICAgICAgICAgICAgICAvLyBSb3VuZGluZyB1cCBtYXkgbWVhbiB0aGUgcHJldmlvdXMgZGlnaXQgaGFzIHRvIGJlIHJvdW5kZWQgdXAgYW5kIHNvIG9uLlxuICAgICAgICAgICAgICAgICAgICBmb3IgKCAtLWJhc2VPdXQ7ICsreGNbLS1kXSA+IGJhc2VPdXQ7ICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgeGNbZF0gPSAwO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoICFkICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICsrZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4Yy51bnNoaWZ0KDEpO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gRGV0ZXJtaW5lIHRyYWlsaW5nIHplcm9zLlxuICAgICAgICAgICAgICAgIGZvciAoIGsgPSB4Yy5sZW5ndGg7ICF4Y1stLWtdOyApO1xuXG4gICAgICAgICAgICAgICAgLy8gRS5nLiBbNCwgMTEsIDE1XSBiZWNvbWVzIDRiZi5cbiAgICAgICAgICAgICAgICBmb3IgKCBpID0gMCwgc3RyID0gJyc7IGkgPD0gazsgc3RyICs9IEFMUEhBQkVULmNoYXJBdCggeGNbaSsrXSApICk7XG4gICAgICAgICAgICAgICAgc3RyID0gdG9GaXhlZFBvaW50KCBzdHIsIGUgKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gVGhlIGNhbGxlciB3aWxsIGFkZCB0aGUgc2lnbi5cbiAgICAgICAgICAgIHJldHVybiBzdHI7XG4gICAgICAgIH1cblxuXG4gICAgICAgIC8vIFBlcmZvcm0gZGl2aXNpb24gaW4gdGhlIHNwZWNpZmllZCBiYXNlLiBDYWxsZWQgYnkgZGl2IGFuZCBjb252ZXJ0QmFzZS5cbiAgICAgICAgZGl2ID0gKGZ1bmN0aW9uICgpIHtcblxuICAgICAgICAgICAgLy8gQXNzdW1lIG5vbi16ZXJvIHggYW5kIGsuXG4gICAgICAgICAgICBmdW5jdGlvbiBtdWx0aXBseSggeCwgaywgYmFzZSApIHtcbiAgICAgICAgICAgICAgICB2YXIgbSwgdGVtcCwgeGxvLCB4aGksXG4gICAgICAgICAgICAgICAgICAgIGNhcnJ5ID0gMCxcbiAgICAgICAgICAgICAgICAgICAgaSA9IHgubGVuZ3RoLFxuICAgICAgICAgICAgICAgICAgICBrbG8gPSBrICUgU1FSVF9CQVNFLFxuICAgICAgICAgICAgICAgICAgICBraGkgPSBrIC8gU1FSVF9CQVNFIHwgMDtcblxuICAgICAgICAgICAgICAgIGZvciAoIHggPSB4LnNsaWNlKCk7IGktLTsgKSB7XG4gICAgICAgICAgICAgICAgICAgIHhsbyA9IHhbaV0gJSBTUVJUX0JBU0U7XG4gICAgICAgICAgICAgICAgICAgIHhoaSA9IHhbaV0gLyBTUVJUX0JBU0UgfCAwO1xuICAgICAgICAgICAgICAgICAgICBtID0ga2hpICogeGxvICsgeGhpICoga2xvO1xuICAgICAgICAgICAgICAgICAgICB0ZW1wID0ga2xvICogeGxvICsgKCAoIG0gJSBTUVJUX0JBU0UgKSAqIFNRUlRfQkFTRSApICsgY2Fycnk7XG4gICAgICAgICAgICAgICAgICAgIGNhcnJ5ID0gKCB0ZW1wIC8gYmFzZSB8IDAgKSArICggbSAvIFNRUlRfQkFTRSB8IDAgKSArIGtoaSAqIHhoaTtcbiAgICAgICAgICAgICAgICAgICAgeFtpXSA9IHRlbXAgJSBiYXNlO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIGlmIChjYXJyeSkgeC51bnNoaWZ0KGNhcnJ5KTtcblxuICAgICAgICAgICAgICAgIHJldHVybiB4O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBmdW5jdGlvbiBjb21wYXJlKCBhLCBiLCBhTCwgYkwgKSB7XG4gICAgICAgICAgICAgICAgdmFyIGksIGNtcDtcblxuICAgICAgICAgICAgICAgIGlmICggYUwgIT0gYkwgKSB7XG4gICAgICAgICAgICAgICAgICAgIGNtcCA9IGFMID4gYkwgPyAxIDogLTE7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgICAgICAgICBmb3IgKCBpID0gY21wID0gMDsgaSA8IGFMOyBpKysgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggYVtpXSAhPSBiW2ldICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcCA9IGFbaV0gPiBiW2ldID8gMSA6IC0xO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIHJldHVybiBjbXA7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGZ1bmN0aW9uIHN1YnRyYWN0KCBhLCBiLCBhTCwgYmFzZSApIHtcbiAgICAgICAgICAgICAgICB2YXIgaSA9IDA7XG5cbiAgICAgICAgICAgICAgICAvLyBTdWJ0cmFjdCBiIGZyb20gYS5cbiAgICAgICAgICAgICAgICBmb3IgKCA7IGFMLS07ICkge1xuICAgICAgICAgICAgICAgICAgICBhW2FMXSAtPSBpO1xuICAgICAgICAgICAgICAgICAgICBpID0gYVthTF0gPCBiW2FMXSA/IDEgOiAwO1xuICAgICAgICAgICAgICAgICAgICBhW2FMXSA9IGkgKiBiYXNlICsgYVthTF0gLSBiW2FMXTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAvLyBSZW1vdmUgbGVhZGluZyB6ZXJvcy5cbiAgICAgICAgICAgICAgICBmb3IgKCA7ICFhWzBdICYmIGEubGVuZ3RoID4gMTsgYS5zaGlmdCgpICk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIHg6IGRpdmlkZW5kLCB5OiBkaXZpc29yLlxuICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICggeCwgeSwgZHAsIHJtLCBiYXNlICkge1xuICAgICAgICAgICAgICAgIHZhciBjbXAsIGUsIGksIG1vcmUsIG4sIHByb2QsIHByb2RMLCBxLCBxYywgcmVtLCByZW1MLCByZW0wLCB4aSwgeEwsIHljMCxcbiAgICAgICAgICAgICAgICAgICAgeUwsIHl6LFxuICAgICAgICAgICAgICAgICAgICBzID0geC5zID09IHkucyA/IDEgOiAtMSxcbiAgICAgICAgICAgICAgICAgICAgeGMgPSB4LmMsXG4gICAgICAgICAgICAgICAgICAgIHljID0geS5jO1xuXG4gICAgICAgICAgICAgICAgLy8gRWl0aGVyIE5hTiwgSW5maW5pdHkgb3IgMD9cbiAgICAgICAgICAgICAgICBpZiAoICF4YyB8fCAheGNbMF0gfHwgIXljIHx8ICF5Y1swXSApIHtcblxuICAgICAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEJpZ051bWJlcihcblxuICAgICAgICAgICAgICAgICAgICAgIC8vIFJldHVybiBOYU4gaWYgZWl0aGVyIE5hTiwgb3IgYm90aCBJbmZpbml0eSBvciAwLlxuICAgICAgICAgICAgICAgICAgICAgICF4LnMgfHwgIXkucyB8fCAoIHhjID8geWMgJiYgeGNbMF0gPT0geWNbMF0gOiAheWMgKSA/IE5hTiA6XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIFJldHVybiDCsTAgaWYgeCBpcyDCsTAgb3IgeSBpcyDCsUluZmluaXR5LCBvciByZXR1cm4gwrFJbmZpbml0eSBhcyB5IGlzIMKxMC5cbiAgICAgICAgICAgICAgICAgICAgICAgIHhjICYmIHhjWzBdID09IDAgfHwgIXljID8gcyAqIDAgOiBzIC8gMFxuICAgICAgICAgICAgICAgICAgICApO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHEgPSBuZXcgQmlnTnVtYmVyKHMpO1xuICAgICAgICAgICAgICAgIHFjID0gcS5jID0gW107XG4gICAgICAgICAgICAgICAgZSA9IHguZSAtIHkuZTtcbiAgICAgICAgICAgICAgICBzID0gZHAgKyBlICsgMTtcblxuICAgICAgICAgICAgICAgIGlmICggIWJhc2UgKSB7XG4gICAgICAgICAgICAgICAgICAgIGJhc2UgPSBCQVNFO1xuICAgICAgICAgICAgICAgICAgICBlID0gYml0Rmxvb3IoIHguZSAvIExPR19CQVNFICkgLSBiaXRGbG9vciggeS5lIC8gTE9HX0JBU0UgKTtcbiAgICAgICAgICAgICAgICAgICAgcyA9IHMgLyBMT0dfQkFTRSB8IDA7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gUmVzdWx0IGV4cG9uZW50IG1heSBiZSBvbmUgbGVzcyB0aGVuIHRoZSBjdXJyZW50IHZhbHVlIG9mIGUuXG4gICAgICAgICAgICAgICAgLy8gVGhlIGNvZWZmaWNpZW50cyBvZiB0aGUgQmlnTnVtYmVycyBmcm9tIGNvbnZlcnRCYXNlIG1heSBoYXZlIHRyYWlsaW5nIHplcm9zLlxuICAgICAgICAgICAgICAgIGZvciAoIGkgPSAwOyB5Y1tpXSA9PSAoIHhjW2ldIHx8IDAgKTsgaSsrICk7XG4gICAgICAgICAgICAgICAgaWYgKCB5Y1tpXSA+ICggeGNbaV0gfHwgMCApICkgZS0tO1xuXG4gICAgICAgICAgICAgICAgaWYgKCBzIDwgMCApIHtcbiAgICAgICAgICAgICAgICAgICAgcWMucHVzaCgxKTtcbiAgICAgICAgICAgICAgICAgICAgbW9yZSA9IHRydWU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgeEwgPSB4Yy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgIHlMID0geWMubGVuZ3RoO1xuICAgICAgICAgICAgICAgICAgICBpID0gMDtcbiAgICAgICAgICAgICAgICAgICAgcyArPSAyO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIE5vcm1hbGlzZSB4YyBhbmQgeWMgc28gaGlnaGVzdCBvcmRlciBkaWdpdCBvZiB5YyBpcyA+PSBiYXNlIC8gMi5cblxuICAgICAgICAgICAgICAgICAgICBuID0gbWF0aGZsb29yKCBiYXNlIC8gKCB5Y1swXSArIDEgKSApO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIE5vdCBuZWNlc3NhcnksIGJ1dCB0byBoYW5kbGUgb2RkIGJhc2VzIHdoZXJlIHljWzBdID09ICggYmFzZSAvIDIgKSAtIDEuXG4gICAgICAgICAgICAgICAgICAgIC8vIGlmICggbiA+IDEgfHwgbisrID09IDEgJiYgeWNbMF0gPCBiYXNlIC8gMiApIHtcbiAgICAgICAgICAgICAgICAgICAgaWYgKCBuID4gMSApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHljID0gbXVsdGlwbHkoIHljLCBuLCBiYXNlICk7XG4gICAgICAgICAgICAgICAgICAgICAgICB4YyA9IG11bHRpcGx5KCB4YywgbiwgYmFzZSApO1xuICAgICAgICAgICAgICAgICAgICAgICAgeUwgPSB5Yy5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgICAgICB4TCA9IHhjLmxlbmd0aDtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIHhpID0geUw7XG4gICAgICAgICAgICAgICAgICAgIHJlbSA9IHhjLnNsaWNlKCAwLCB5TCApO1xuICAgICAgICAgICAgICAgICAgICByZW1MID0gcmVtLmxlbmd0aDtcblxuICAgICAgICAgICAgICAgICAgICAvLyBBZGQgemVyb3MgdG8gbWFrZSByZW1haW5kZXIgYXMgbG9uZyBhcyBkaXZpc29yLlxuICAgICAgICAgICAgICAgICAgICBmb3IgKCA7IHJlbUwgPCB5TDsgcmVtW3JlbUwrK10gPSAwICk7XG4gICAgICAgICAgICAgICAgICAgIHl6ID0geWMuc2xpY2UoKTtcbiAgICAgICAgICAgICAgICAgICAgeXoudW5zaGlmdCgwKTtcbiAgICAgICAgICAgICAgICAgICAgeWMwID0geWNbMF07XG4gICAgICAgICAgICAgICAgICAgIGlmICggeWNbMV0gPj0gYmFzZSAvIDIgKSB5YzArKztcbiAgICAgICAgICAgICAgICAgICAgLy8gTm90IG5lY2Vzc2FyeSwgYnV0IHRvIHByZXZlbnQgdHJpYWwgZGlnaXQgbiA+IGJhc2UsIHdoZW4gdXNpbmcgYmFzZSAzLlxuICAgICAgICAgICAgICAgICAgICAvLyBlbHNlIGlmICggYmFzZSA9PSAzICYmIHljMCA9PSAxICkgeWMwID0gMSArIDFlLTE1O1xuXG4gICAgICAgICAgICAgICAgICAgIGRvIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSAwO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBDb21wYXJlIGRpdmlzb3IgYW5kIHJlbWFpbmRlci5cbiAgICAgICAgICAgICAgICAgICAgICAgIGNtcCA9IGNvbXBhcmUoIHljLCByZW0sIHlMLCByZW1MICk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIGRpdmlzb3IgPCByZW1haW5kZXIuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIGNtcCA8IDAgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBDYWxjdWxhdGUgdHJpYWwgZGlnaXQsIG4uXG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW0wID0gcmVtWzBdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggeUwgIT0gcmVtTCApIHJlbTAgPSByZW0wICogYmFzZSArICggcmVtWzFdIHx8IDAgKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG4gaXMgaG93IG1hbnkgdGltZXMgdGhlIGRpdmlzb3IgZ29lcyBpbnRvIHRoZSBjdXJyZW50IHJlbWFpbmRlci5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBuID0gbWF0aGZsb29yKCByZW0wIC8geWMwICk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyAgQWxnb3JpdGhtOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAxLiBwcm9kdWN0ID0gZGl2aXNvciAqIHRyaWFsIGRpZ2l0IChuKVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAyLiBpZiBwcm9kdWN0ID4gcmVtYWluZGVyOiBwcm9kdWN0IC09IGRpdmlzb3IsIG4tLVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAzLiByZW1haW5kZXIgLT0gcHJvZHVjdFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICA0LiBpZiBwcm9kdWN0IHdhcyA8IHJlbWFpbmRlciBhdCAyOlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgIDUuIGNvbXBhcmUgbmV3IHJlbWFpbmRlciBhbmQgZGl2aXNvclxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vICAgIDYuIElmIHJlbWFpbmRlciA+IGRpdmlzb3I6IHJlbWFpbmRlciAtPSBkaXZpc29yLCBuKytcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggbiA+IDEgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gbiBtYXkgYmUgPiBiYXNlIG9ubHkgd2hlbiBiYXNlIGlzIDMuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmIChuID49IGJhc2UpIG4gPSBiYXNlIC0gMTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBwcm9kdWN0ID0gZGl2aXNvciAqIHRyaWFsIGRpZ2l0LlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kID0gbXVsdGlwbHkoIHljLCBuLCBiYXNlICk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2RMID0gcHJvZC5sZW5ndGg7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbUwgPSByZW0ubGVuZ3RoO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIENvbXBhcmUgcHJvZHVjdCBhbmQgcmVtYWluZGVyLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiBwcm9kdWN0ID4gcmVtYWluZGVyLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUcmlhbCBkaWdpdCBuIHRvbyBoaWdoLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBuIGlzIDEgdG9vIGhpZ2ggYWJvdXQgNSUgb2YgdGhlIHRpbWUsIGFuZCBpcyBub3Qga25vd24gdG8gaGF2ZVxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBldmVyIGJlZW4gbW9yZSB0aGFuIDEgdG9vIGhpZ2guXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHdoaWxlICggY29tcGFyZSggcHJvZCwgcmVtLCBwcm9kTCwgcmVtTCApID09IDEgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBuLS07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFN1YnRyYWN0IGRpdmlzb3IgZnJvbSBwcm9kdWN0LlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgc3VidHJhY3QoIHByb2QsIHlMIDwgcHJvZEwgPyB5eiA6IHljLCBwcm9kTCwgYmFzZSApO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgcHJvZEwgPSBwcm9kLmxlbmd0aDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNtcCA9IDE7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIG4gaXMgMCBvciAxLCBjbXAgaXMgLTEuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIG4gaXMgMCwgdGhlcmUgaXMgbm8gbmVlZCB0byBjb21wYXJlIHljIGFuZCByZW0gYWdhaW4gYmVsb3csXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHNvIGNoYW5nZSBjbXAgdG8gMSB0byBhdm9pZCBpdC5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgbiBpcyAxLCBsZWF2ZSBjbXAgYXMgLTEsIHNvIHljIGFuZCByZW0gYXJlIGNvbXBhcmVkIGFnYWluLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIG4gPT0gMCApIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gZGl2aXNvciA8IHJlbWFpbmRlciwgc28gbiBtdXN0IGJlIGF0IGxlYXN0IDEuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBjbXAgPSBuID0gMTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIHByb2R1Y3QgPSBkaXZpc29yXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByb2QgPSB5Yy5zbGljZSgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBwcm9kTCA9IHByb2QubGVuZ3RoO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggcHJvZEwgPCByZW1MICkgcHJvZC51bnNoaWZ0KDApO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU3VidHJhY3QgcHJvZHVjdCBmcm9tIHJlbWFpbmRlci5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzdWJ0cmFjdCggcmVtLCBwcm9kLCByZW1MLCBiYXNlICk7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVtTCA9IHJlbS5sZW5ndGg7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gSWYgcHJvZHVjdCB3YXMgPCByZW1haW5kZXIuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBjbXAgPT0gLTEgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ29tcGFyZSBkaXZpc29yIGFuZCBuZXcgcmVtYWluZGVyLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiBkaXZpc29yIDwgbmV3IHJlbWFpbmRlciwgc3VidHJhY3QgZGl2aXNvciBmcm9tIHJlbWFpbmRlci5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVHJpYWwgZGlnaXQgbiB0b28gbG93LlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBuIGlzIDEgdG9vIGxvdyBhYm91dCA1JSBvZiB0aGUgdGltZSwgYW5kIHZlcnkgcmFyZWx5IDIgdG9vIGxvdy5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgd2hpbGUgKCBjb21wYXJlKCB5YywgcmVtLCB5TCwgcmVtTCApIDwgMSApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4rKztcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gU3VidHJhY3QgZGl2aXNvciBmcm9tIHJlbWFpbmRlci5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHN1YnRyYWN0KCByZW0sIHlMIDwgcmVtTCA/IHl6IDogeWMsIHJlbUwsIGJhc2UgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbUwgPSByZW0ubGVuZ3RoO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmICggY21wID09PSAwICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4rKztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW0gPSBbMF07XG4gICAgICAgICAgICAgICAgICAgICAgICB9IC8vIGVsc2UgY21wID09PSAxIGFuZCBuIHdpbGwgYmUgMFxuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBBZGQgdGhlIG5leHQgZGlnaXQsIG4sIHRvIHRoZSByZXN1bHQgYXJyYXkuXG4gICAgICAgICAgICAgICAgICAgICAgICBxY1tpKytdID0gbjtcblxuICAgICAgICAgICAgICAgICAgICAgICAgLy8gVXBkYXRlIHRoZSByZW1haW5kZXIuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIHJlbVswXSApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW1bcmVtTCsrXSA9IHhjW3hpXSB8fCAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICByZW0gPSBbIHhjW3hpXSBdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJlbUwgPSAxO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9IHdoaWxlICggKCB4aSsrIDwgeEwgfHwgcmVtWzBdICE9IG51bGwgKSAmJiBzLS0gKTtcblxuICAgICAgICAgICAgICAgICAgICBtb3JlID0gcmVtWzBdICE9IG51bGw7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gTGVhZGluZyB6ZXJvP1xuICAgICAgICAgICAgICAgICAgICBpZiAoICFxY1swXSApIHFjLnNoaWZ0KCk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaWYgKCBiYXNlID09IEJBU0UgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gVG8gY2FsY3VsYXRlIHEuZSwgZmlyc3QgZ2V0IHRoZSBudW1iZXIgb2YgZGlnaXRzIG9mIHFjWzBdLlxuICAgICAgICAgICAgICAgICAgICBmb3IgKCBpID0gMSwgcyA9IHFjWzBdOyBzID49IDEwOyBzIC89IDEwLCBpKysgKTtcbiAgICAgICAgICAgICAgICAgICAgcm91bmQoIHEsIGRwICsgKCBxLmUgPSBpICsgZSAqIExPR19CQVNFIC0gMSApICsgMSwgcm0sIG1vcmUgKTtcblxuICAgICAgICAgICAgICAgIC8vIENhbGxlciBpcyBjb252ZXJ0QmFzZS5cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBxLmUgPSBlO1xuICAgICAgICAgICAgICAgICAgICBxLnIgPSArbW9yZTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICByZXR1cm4gcTtcbiAgICAgICAgICAgIH07XG4gICAgICAgIH0pKCk7XG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiBSZXR1cm4gYSBzdHJpbmcgcmVwcmVzZW50aW5nIHRoZSB2YWx1ZSBvZiBCaWdOdW1iZXIgbiBpbiBmaXhlZC1wb2ludCBvciBleHBvbmVudGlhbFxuICAgICAgICAgKiBub3RhdGlvbiByb3VuZGVkIHRvIHRoZSBzcGVjaWZpZWQgZGVjaW1hbCBwbGFjZXMgb3Igc2lnbmlmaWNhbnQgZGlnaXRzLlxuICAgICAgICAgKlxuICAgICAgICAgKiBuIGlzIGEgQmlnTnVtYmVyLlxuICAgICAgICAgKiBpIGlzIHRoZSBpbmRleCBvZiB0aGUgbGFzdCBkaWdpdCByZXF1aXJlZCAoaS5lLiB0aGUgZGlnaXQgdGhhdCBtYXkgYmUgcm91bmRlZCB1cCkuXG4gICAgICAgICAqIHJtIGlzIHRoZSByb3VuZGluZyBtb2RlLlxuICAgICAgICAgKiBjYWxsZXIgaXMgY2FsbGVyIGlkOiB0b0V4cG9uZW50aWFsIDE5LCB0b0ZpeGVkIDIwLCB0b0Zvcm1hdCAyMSwgdG9QcmVjaXNpb24gMjQuXG4gICAgICAgICAqL1xuICAgICAgICBmdW5jdGlvbiBmb3JtYXQoIG4sIGksIHJtLCBjYWxsZXIgKSB7XG4gICAgICAgICAgICB2YXIgYzAsIGUsIG5lLCBsZW4sIHN0cjtcblxuICAgICAgICAgICAgcm0gPSBybSAhPSBudWxsICYmIGlzVmFsaWRJbnQoIHJtLCAwLCA4LCBjYWxsZXIsIHJvdW5kaW5nTW9kZSApXG4gICAgICAgICAgICAgID8gcm0gfCAwIDogUk9VTkRJTkdfTU9ERTtcblxuICAgICAgICAgICAgaWYgKCAhbi5jICkgcmV0dXJuIG4udG9TdHJpbmcoKTtcbiAgICAgICAgICAgIGMwID0gbi5jWzBdO1xuICAgICAgICAgICAgbmUgPSBuLmU7XG5cbiAgICAgICAgICAgIGlmICggaSA9PSBudWxsICkge1xuICAgICAgICAgICAgICAgIHN0ciA9IGNvZWZmVG9TdHJpbmcoIG4uYyApO1xuICAgICAgICAgICAgICAgIHN0ciA9IGNhbGxlciA9PSAxOSB8fCBjYWxsZXIgPT0gMjQgJiYgbmUgPD0gVE9fRVhQX05FR1xuICAgICAgICAgICAgICAgICAgPyB0b0V4cG9uZW50aWFsKCBzdHIsIG5lIClcbiAgICAgICAgICAgICAgICAgIDogdG9GaXhlZFBvaW50KCBzdHIsIG5lICk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG4gPSByb3VuZCggbmV3IEJpZ051bWJlcihuKSwgaSwgcm0gKTtcblxuICAgICAgICAgICAgICAgIC8vIG4uZSBtYXkgaGF2ZSBjaGFuZ2VkIGlmIHRoZSB2YWx1ZSB3YXMgcm91bmRlZCB1cC5cbiAgICAgICAgICAgICAgICBlID0gbi5lO1xuXG4gICAgICAgICAgICAgICAgc3RyID0gY29lZmZUb1N0cmluZyggbi5jICk7XG4gICAgICAgICAgICAgICAgbGVuID0gc3RyLmxlbmd0aDtcblxuICAgICAgICAgICAgICAgIC8vIHRvUHJlY2lzaW9uIHJldHVybnMgZXhwb25lbnRpYWwgbm90YXRpb24gaWYgdGhlIG51bWJlciBvZiBzaWduaWZpY2FudCBkaWdpdHNcbiAgICAgICAgICAgICAgICAvLyBzcGVjaWZpZWQgaXMgbGVzcyB0aGFuIHRoZSBudW1iZXIgb2YgZGlnaXRzIG5lY2Vzc2FyeSB0byByZXByZXNlbnQgdGhlIGludGVnZXJcbiAgICAgICAgICAgICAgICAvLyBwYXJ0IG9mIHRoZSB2YWx1ZSBpbiBmaXhlZC1wb2ludCBub3RhdGlvbi5cblxuICAgICAgICAgICAgICAgIC8vIEV4cG9uZW50aWFsIG5vdGF0aW9uLlxuICAgICAgICAgICAgICAgIGlmICggY2FsbGVyID09IDE5IHx8IGNhbGxlciA9PSAyNCAmJiAoIGkgPD0gZSB8fCBlIDw9IFRPX0VYUF9ORUcgKSApIHtcblxuICAgICAgICAgICAgICAgICAgICAvLyBBcHBlbmQgemVyb3M/XG4gICAgICAgICAgICAgICAgICAgIGZvciAoIDsgbGVuIDwgaTsgc3RyICs9ICcwJywgbGVuKysgKTtcbiAgICAgICAgICAgICAgICAgICAgc3RyID0gdG9FeHBvbmVudGlhbCggc3RyLCBlICk7XG5cbiAgICAgICAgICAgICAgICAvLyBGaXhlZC1wb2ludCBub3RhdGlvbi5cbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpIC09IG5lO1xuICAgICAgICAgICAgICAgICAgICBzdHIgPSB0b0ZpeGVkUG9pbnQoIHN0ciwgZSApO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIEFwcGVuZCB6ZXJvcz9cbiAgICAgICAgICAgICAgICAgICAgaWYgKCBlICsgMSA+IGxlbiApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggLS1pID4gMCApIGZvciAoIHN0ciArPSAnLic7IGktLTsgc3RyICs9ICcwJyApO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgaSArPSBlIC0gbGVuO1xuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBpID4gMCApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIGUgKyAxID09IGxlbiApIHN0ciArPSAnLic7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICggOyBpLS07IHN0ciArPSAnMCcgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG4ucyA8IDAgJiYgYzAgPyAnLScgKyBzdHIgOiBzdHI7XG4gICAgICAgIH1cblxuXG4gICAgICAgIC8vIEhhbmRsZSBCaWdOdW1iZXIubWF4IGFuZCBCaWdOdW1iZXIubWluLlxuICAgICAgICBmdW5jdGlvbiBtYXhPck1pbiggYXJncywgbWV0aG9kICkge1xuICAgICAgICAgICAgdmFyIG0sIG4sXG4gICAgICAgICAgICAgICAgaSA9IDA7XG5cbiAgICAgICAgICAgIGlmICggaXNBcnJheSggYXJnc1swXSApICkgYXJncyA9IGFyZ3NbMF07XG4gICAgICAgICAgICBtID0gbmV3IEJpZ051bWJlciggYXJnc1swXSApO1xuXG4gICAgICAgICAgICBmb3IgKCA7ICsraSA8IGFyZ3MubGVuZ3RoOyApIHtcbiAgICAgICAgICAgICAgICBuID0gbmV3IEJpZ051bWJlciggYXJnc1tpXSApO1xuXG4gICAgICAgICAgICAgICAgLy8gSWYgYW55IG51bWJlciBpcyBOYU4sIHJldHVybiBOYU4uXG4gICAgICAgICAgICAgICAgaWYgKCAhbi5zICkge1xuICAgICAgICAgICAgICAgICAgICBtID0gbjtcbiAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgfSBlbHNlIGlmICggbWV0aG9kLmNhbGwoIG0sIG4gKSApIHtcbiAgICAgICAgICAgICAgICAgICAgbSA9IG47XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gbTtcbiAgICAgICAgfVxuXG5cbiAgICAgICAgLypcbiAgICAgICAgICogUmV0dXJuIHRydWUgaWYgbiBpcyBhbiBpbnRlZ2VyIGluIHJhbmdlLCBvdGhlcndpc2UgdGhyb3cuXG4gICAgICAgICAqIFVzZSBmb3IgYXJndW1lbnQgdmFsaWRhdGlvbiB3aGVuIEVSUk9SUyBpcyB0cnVlLlxuICAgICAgICAgKi9cbiAgICAgICAgZnVuY3Rpb24gaW50VmFsaWRhdG9yV2l0aEVycm9ycyggbiwgbWluLCBtYXgsIGNhbGxlciwgbmFtZSApIHtcbiAgICAgICAgICAgIGlmICggbiA8IG1pbiB8fCBuID4gbWF4IHx8IG4gIT0gdHJ1bmNhdGUobikgKSB7XG4gICAgICAgICAgICAgICAgcmFpc2UoIGNhbGxlciwgKCBuYW1lIHx8ICdkZWNpbWFsIHBsYWNlcycgKSArXG4gICAgICAgICAgICAgICAgICAoIG4gPCBtaW4gfHwgbiA+IG1heCA/ICcgb3V0IG9mIHJhbmdlJyA6ICcgbm90IGFuIGludGVnZXInICksIG4gKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqIFN0cmlwIHRyYWlsaW5nIHplcm9zLCBjYWxjdWxhdGUgYmFzZSAxMCBleHBvbmVudCBhbmQgY2hlY2sgYWdhaW5zdCBNSU5fRVhQIGFuZCBNQVhfRVhQLlxuICAgICAgICAgKiBDYWxsZWQgYnkgbWludXMsIHBsdXMgYW5kIHRpbWVzLlxuICAgICAgICAgKi9cbiAgICAgICAgZnVuY3Rpb24gbm9ybWFsaXNlKCBuLCBjLCBlICkge1xuICAgICAgICAgICAgdmFyIGkgPSAxLFxuICAgICAgICAgICAgICAgIGogPSBjLmxlbmd0aDtcblxuICAgICAgICAgICAgIC8vIFJlbW92ZSB0cmFpbGluZyB6ZXJvcy5cbiAgICAgICAgICAgIGZvciAoIDsgIWNbLS1qXTsgYy5wb3AoKSApO1xuXG4gICAgICAgICAgICAvLyBDYWxjdWxhdGUgdGhlIGJhc2UgMTAgZXhwb25lbnQuIEZpcnN0IGdldCB0aGUgbnVtYmVyIG9mIGRpZ2l0cyBvZiBjWzBdLlxuICAgICAgICAgICAgZm9yICggaiA9IGNbMF07IGogPj0gMTA7IGogLz0gMTAsIGkrKyApO1xuXG4gICAgICAgICAgICAvLyBPdmVyZmxvdz9cbiAgICAgICAgICAgIGlmICggKCBlID0gaSArIGUgKiBMT0dfQkFTRSAtIDEgKSA+IE1BWF9FWFAgKSB7XG5cbiAgICAgICAgICAgICAgICAvLyBJbmZpbml0eS5cbiAgICAgICAgICAgICAgICBuLmMgPSBuLmUgPSBudWxsO1xuXG4gICAgICAgICAgICAvLyBVbmRlcmZsb3c/XG4gICAgICAgICAgICB9IGVsc2UgaWYgKCBlIDwgTUlOX0VYUCApIHtcblxuICAgICAgICAgICAgICAgIC8vIFplcm8uXG4gICAgICAgICAgICAgICAgbi5jID0gWyBuLmUgPSAwIF07XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIG4uZSA9IGU7XG4gICAgICAgICAgICAgICAgbi5jID0gYztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIG47XG4gICAgICAgIH1cblxuXG4gICAgICAgIC8vIEhhbmRsZSB2YWx1ZXMgdGhhdCBmYWlsIHRoZSB2YWxpZGl0eSB0ZXN0IGluIEJpZ051bWJlci5cbiAgICAgICAgcGFyc2VOdW1lcmljID0gKGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBiYXNlUHJlZml4ID0gL14oLT8pMChbeGJvXSkvaSxcbiAgICAgICAgICAgICAgICBkb3RBZnRlciA9IC9eKFteLl0rKVxcLiQvLFxuICAgICAgICAgICAgICAgIGRvdEJlZm9yZSA9IC9eXFwuKFteLl0rKSQvLFxuICAgICAgICAgICAgICAgIGlzSW5maW5pdHlPck5hTiA9IC9eLT8oSW5maW5pdHl8TmFOKSQvLFxuICAgICAgICAgICAgICAgIHdoaXRlc3BhY2VPclBsdXMgPSAvXlxccypcXCt8Xlxccyt8XFxzKyQvZztcblxuICAgICAgICAgICAgcmV0dXJuIGZ1bmN0aW9uICggeCwgc3RyLCBudW0sIGIgKSB7XG4gICAgICAgICAgICAgICAgdmFyIGJhc2UsXG4gICAgICAgICAgICAgICAgICAgIHMgPSBudW0gPyBzdHIgOiBzdHIucmVwbGFjZSggd2hpdGVzcGFjZU9yUGx1cywgJycgKTtcblxuICAgICAgICAgICAgICAgIC8vIE5vIGV4Y2VwdGlvbiBvbiDCsUluZmluaXR5IG9yIE5hTi5cbiAgICAgICAgICAgICAgICBpZiAoIGlzSW5maW5pdHlPck5hTi50ZXN0KHMpICkge1xuICAgICAgICAgICAgICAgICAgICB4LnMgPSBpc05hTihzKSA/IG51bGwgOiBzIDwgMCA/IC0xIDogMTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBpZiAoICFudW0gKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGJhc2VQcmVmaXggPSAvXigtPykwKFt4Ym9dKSg/PVxcd1tcXHcuXSokKS9pXG4gICAgICAgICAgICAgICAgICAgICAgICBzID0gcy5yZXBsYWNlKCBiYXNlUHJlZml4LCBmdW5jdGlvbiAoIG0sIHAxLCBwMiApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNlID0gKCBwMiA9IHAyLnRvTG93ZXJDYXNlKCkgKSA9PSAneCcgPyAxNiA6IHAyID09ICdiJyA/IDIgOiA4O1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybiAhYiB8fCBiID09IGJhc2UgPyBwMSA6IG07XG4gICAgICAgICAgICAgICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKGIpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBiYXNlID0gYjtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIEUuZy4gJzEuJyB0byAnMScsICcuMScgdG8gJzAuMSdcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzID0gcy5yZXBsYWNlKCBkb3RBZnRlciwgJyQxJyApLnJlcGxhY2UoIGRvdEJlZm9yZSwgJzAuJDEnICk7XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggc3RyICE9IHMgKSByZXR1cm4gbmV3IEJpZ051bWJlciggcywgYmFzZSApO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gJ25ldyBCaWdOdW1iZXIoKSBub3QgYSBudW1iZXI6IHtufSdcbiAgICAgICAgICAgICAgICAgICAgLy8gJ25ldyBCaWdOdW1iZXIoKSBub3QgYSBiYXNlIHtifSBudW1iZXI6IHtufSdcbiAgICAgICAgICAgICAgICAgICAgaWYgKEVSUk9SUykgcmFpc2UoIGlkLCAnbm90IGEnICsgKCBiID8gJyBiYXNlICcgKyBiIDogJycgKSArICcgbnVtYmVyJywgc3RyICk7XG4gICAgICAgICAgICAgICAgICAgIHgucyA9IG51bGw7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgeC5jID0geC5lID0gbnVsbDtcbiAgICAgICAgICAgICAgICBpZCA9IDA7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0pKCk7XG5cblxuICAgICAgICAvLyBUaHJvdyBhIEJpZ051bWJlciBFcnJvci5cbiAgICAgICAgZnVuY3Rpb24gcmFpc2UoIGNhbGxlciwgbXNnLCB2YWwgKSB7XG4gICAgICAgICAgICB2YXIgZXJyb3IgPSBuZXcgRXJyb3IoIFtcbiAgICAgICAgICAgICAgICAnbmV3IEJpZ051bWJlcicsICAgICAvLyAwXG4gICAgICAgICAgICAgICAgJ2NtcCcsICAgICAgICAgICAgICAgLy8gMVxuICAgICAgICAgICAgICAgICdjb25maWcnLCAgICAgICAgICAgIC8vIDJcbiAgICAgICAgICAgICAgICAnZGl2JywgICAgICAgICAgICAgICAvLyAzXG4gICAgICAgICAgICAgICAgJ2RpdlRvSW50JywgICAgICAgICAgLy8gNFxuICAgICAgICAgICAgICAgICdlcScsICAgICAgICAgICAgICAgIC8vIDVcbiAgICAgICAgICAgICAgICAnZ3QnLCAgICAgICAgICAgICAgICAvLyA2XG4gICAgICAgICAgICAgICAgJ2d0ZScsICAgICAgICAgICAgICAgLy8gN1xuICAgICAgICAgICAgICAgICdsdCcsICAgICAgICAgICAgICAgIC8vIDhcbiAgICAgICAgICAgICAgICAnbHRlJywgICAgICAgICAgICAgICAvLyA5XG4gICAgICAgICAgICAgICAgJ21pbnVzJywgICAgICAgICAgICAgLy8gMTBcbiAgICAgICAgICAgICAgICAnbW9kJywgICAgICAgICAgICAgICAvLyAxMVxuICAgICAgICAgICAgICAgICdwbHVzJywgICAgICAgICAgICAgIC8vIDEyXG4gICAgICAgICAgICAgICAgJ3ByZWNpc2lvbicsICAgICAgICAgLy8gMTNcbiAgICAgICAgICAgICAgICAncmFuZG9tJywgICAgICAgICAgICAvLyAxNFxuICAgICAgICAgICAgICAgICdyb3VuZCcsICAgICAgICAgICAgIC8vIDE1XG4gICAgICAgICAgICAgICAgJ3NoaWZ0JywgICAgICAgICAgICAgLy8gMTZcbiAgICAgICAgICAgICAgICAndGltZXMnLCAgICAgICAgICAgICAvLyAxN1xuICAgICAgICAgICAgICAgICd0b0RpZ2l0cycsICAgICAgICAgIC8vIDE4XG4gICAgICAgICAgICAgICAgJ3RvRXhwb25lbnRpYWwnLCAgICAgLy8gMTlcbiAgICAgICAgICAgICAgICAndG9GaXhlZCcsICAgICAgICAgICAvLyAyMFxuICAgICAgICAgICAgICAgICd0b0Zvcm1hdCcsICAgICAgICAgIC8vIDIxXG4gICAgICAgICAgICAgICAgJ3RvRnJhY3Rpb24nLCAgICAgICAgLy8gMjJcbiAgICAgICAgICAgICAgICAncG93JywgICAgICAgICAgICAgICAvLyAyM1xuICAgICAgICAgICAgICAgICd0b1ByZWNpc2lvbicsICAgICAgIC8vIDI0XG4gICAgICAgICAgICAgICAgJ3RvU3RyaW5nJywgICAgICAgICAgLy8gMjVcbiAgICAgICAgICAgICAgICAnQmlnTnVtYmVyJyAgICAgICAgICAvLyAyNlxuICAgICAgICAgICAgXVtjYWxsZXJdICsgJygpICcgKyBtc2cgKyAnOiAnICsgdmFsICk7XG5cbiAgICAgICAgICAgIGVycm9yLm5hbWUgPSAnQmlnTnVtYmVyIEVycm9yJztcbiAgICAgICAgICAgIGlkID0gMDtcbiAgICAgICAgICAgIHRocm93IGVycm9yO1xuICAgICAgICB9XG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiBSb3VuZCB4IHRvIHNkIHNpZ25pZmljYW50IGRpZ2l0cyB1c2luZyByb3VuZGluZyBtb2RlIHJtLiBDaGVjayBmb3Igb3Zlci91bmRlci1mbG93LlxuICAgICAgICAgKiBJZiByIGlzIHRydXRoeSwgaXQgaXMga25vd24gdGhhdCB0aGVyZSBhcmUgbW9yZSBkaWdpdHMgYWZ0ZXIgdGhlIHJvdW5kaW5nIGRpZ2l0LlxuICAgICAgICAgKi9cbiAgICAgICAgZnVuY3Rpb24gcm91bmQoIHgsIHNkLCBybSwgciApIHtcbiAgICAgICAgICAgIHZhciBkLCBpLCBqLCBrLCBuLCBuaSwgcmQsXG4gICAgICAgICAgICAgICAgeGMgPSB4LmMsXG4gICAgICAgICAgICAgICAgcG93czEwID0gUE9XU19URU47XG5cbiAgICAgICAgICAgIC8vIGlmIHggaXMgbm90IEluZmluaXR5IG9yIE5hTi4uLlxuICAgICAgICAgICAgaWYgKHhjKSB7XG5cbiAgICAgICAgICAgICAgICAvLyByZCBpcyB0aGUgcm91bmRpbmcgZGlnaXQsIGkuZS4gdGhlIGRpZ2l0IGFmdGVyIHRoZSBkaWdpdCB0aGF0IG1heSBiZSByb3VuZGVkIHVwLlxuICAgICAgICAgICAgICAgIC8vIG4gaXMgYSBiYXNlIDFlMTQgbnVtYmVyLCB0aGUgdmFsdWUgb2YgdGhlIGVsZW1lbnQgb2YgYXJyYXkgeC5jIGNvbnRhaW5pbmcgcmQuXG4gICAgICAgICAgICAgICAgLy8gbmkgaXMgdGhlIGluZGV4IG9mIG4gd2l0aGluIHguYy5cbiAgICAgICAgICAgICAgICAvLyBkIGlzIHRoZSBudW1iZXIgb2YgZGlnaXRzIG9mIG4uXG4gICAgICAgICAgICAgICAgLy8gaSBpcyB0aGUgaW5kZXggb2YgcmQgd2l0aGluIG4gaW5jbHVkaW5nIGxlYWRpbmcgemVyb3MuXG4gICAgICAgICAgICAgICAgLy8gaiBpcyB0aGUgYWN0dWFsIGluZGV4IG9mIHJkIHdpdGhpbiBuIChpZiA8IDAsIHJkIGlzIGEgbGVhZGluZyB6ZXJvKS5cbiAgICAgICAgICAgICAgICBvdXQ6IHtcblxuICAgICAgICAgICAgICAgICAgICAvLyBHZXQgdGhlIG51bWJlciBvZiBkaWdpdHMgb2YgdGhlIGZpcnN0IGVsZW1lbnQgb2YgeGMuXG4gICAgICAgICAgICAgICAgICAgIGZvciAoIGQgPSAxLCBrID0geGNbMF07IGsgPj0gMTA7IGsgLz0gMTAsIGQrKyApO1xuICAgICAgICAgICAgICAgICAgICBpID0gc2QgLSBkO1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZSByb3VuZGluZyBkaWdpdCBpcyBpbiB0aGUgZmlyc3QgZWxlbWVudCBvZiB4Yy4uLlxuICAgICAgICAgICAgICAgICAgICBpZiAoIGkgPCAwICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaSArPSBMT0dfQkFTRTtcbiAgICAgICAgICAgICAgICAgICAgICAgIGogPSBzZDtcbiAgICAgICAgICAgICAgICAgICAgICAgIG4gPSB4Y1sgbmkgPSAwIF07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEdldCB0aGUgcm91bmRpbmcgZGlnaXQgYXQgaW5kZXggaiBvZiBuLlxuICAgICAgICAgICAgICAgICAgICAgICAgcmQgPSBuIC8gcG93czEwWyBkIC0gaiAtIDEgXSAlIDEwIHwgMDtcbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG5pID0gbWF0aGNlaWwoICggaSArIDEgKSAvIExPR19CQVNFICk7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGlmICggbmkgPj0geGMubGVuZ3RoICkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKHIpIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBOZWVkZWQgYnkgc3FydC5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICggOyB4Yy5sZW5ndGggPD0gbmk7IHhjLnB1c2goMCkgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbiA9IHJkID0gMDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZCA9IDE7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGkgJT0gTE9HX0JBU0U7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBpIC0gTE9HX0JBU0UgKyAxO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrIG91dDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG4gPSBrID0geGNbbmldO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gR2V0IHRoZSBudW1iZXIgb2YgZGlnaXRzIG9mIG4uXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yICggZCA9IDE7IGsgPj0gMTA7IGsgLz0gMTAsIGQrKyApO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gR2V0IHRoZSBpbmRleCBvZiByZCB3aXRoaW4gbi5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpICU9IExPR19CQVNFO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gR2V0IHRoZSBpbmRleCBvZiByZCB3aXRoaW4gbiwgYWRqdXN0ZWQgZm9yIGxlYWRpbmcgemVyb3MuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gVGhlIG51bWJlciBvZiBsZWFkaW5nIHplcm9zIG9mIG4gaXMgZ2l2ZW4gYnkgTE9HX0JBU0UgLSBkLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGogPSBpIC0gTE9HX0JBU0UgKyBkO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gR2V0IHRoZSByb3VuZGluZyBkaWdpdCBhdCBpbmRleCBqIG9mIG4uXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmQgPSBqIDwgMCA/IDAgOiBuIC8gcG93czEwWyBkIC0gaiAtIDEgXSAlIDEwIHwgMDtcbiAgICAgICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIHIgPSByIHx8IHNkIDwgMCB8fFxuXG4gICAgICAgICAgICAgICAgICAgIC8vIEFyZSB0aGVyZSBhbnkgbm9uLXplcm8gZGlnaXRzIGFmdGVyIHRoZSByb3VuZGluZyBkaWdpdD9cbiAgICAgICAgICAgICAgICAgICAgLy8gVGhlIGV4cHJlc3Npb24gIG4gJSBwb3dzMTBbIGQgLSBqIC0gMSBdICByZXR1cm5zIGFsbCBkaWdpdHMgb2YgbiB0byB0aGUgcmlnaHRcbiAgICAgICAgICAgICAgICAgICAgLy8gb2YgdGhlIGRpZ2l0IGF0IGosIGUuZy4gaWYgbiBpcyA5MDg3MTQgYW5kIGogaXMgMiwgdGhlIGV4cHJlc3Npb24gZ2l2ZXMgNzE0LlxuICAgICAgICAgICAgICAgICAgICAgIHhjW25pICsgMV0gIT0gbnVsbCB8fCAoIGogPCAwID8gbiA6IG4gJSBwb3dzMTBbIGQgLSBqIC0gMSBdICk7XG5cbiAgICAgICAgICAgICAgICAgICAgciA9IHJtIDwgNFxuICAgICAgICAgICAgICAgICAgICAgID8gKCByZCB8fCByICkgJiYgKCBybSA9PSAwIHx8IHJtID09ICggeC5zIDwgMCA/IDMgOiAyICkgKVxuICAgICAgICAgICAgICAgICAgICAgIDogcmQgPiA1IHx8IHJkID09IDUgJiYgKCBybSA9PSA0IHx8IHIgfHwgcm0gPT0gNiAmJlxuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBDaGVjayB3aGV0aGVyIHRoZSBkaWdpdCB0byB0aGUgbGVmdCBvZiB0aGUgcm91bmRpbmcgZGlnaXQgaXMgb2RkLlxuICAgICAgICAgICAgICAgICAgICAgICAgKCAoIGkgPiAwID8gaiA+IDAgPyBuIC8gcG93czEwWyBkIC0gaiBdIDogMCA6IHhjW25pIC0gMV0gKSAlIDEwICkgJiAxIHx8XG4gICAgICAgICAgICAgICAgICAgICAgICAgIHJtID09ICggeC5zIDwgMCA/IDggOiA3ICkgKTtcblxuICAgICAgICAgICAgICAgICAgICBpZiAoIHNkIDwgMSB8fCAheGNbMF0gKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICB4Yy5sZW5ndGggPSAwO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAocikge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gQ29udmVydCBzZCB0byBkZWNpbWFsIHBsYWNlcy5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzZCAtPSB4LmUgKyAxO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgLy8gMSwgMC4xLCAwLjAxLCAwLjAwMSwgMC4wMDAxIGV0Yy5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB4Y1swXSA9IHBvd3MxMFsgc2QgJSBMT0dfQkFTRSBdO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIHguZSA9IC1zZCB8fCAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIFplcm8uXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgeGNbMF0gPSB4LmUgPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICByZXR1cm4geDtcbiAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgIC8vIFJlbW92ZSBleGNlc3MgZGlnaXRzLlxuICAgICAgICAgICAgICAgICAgICBpZiAoIGkgPT0gMCApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHhjLmxlbmd0aCA9IG5pO1xuICAgICAgICAgICAgICAgICAgICAgICAgayA9IDE7XG4gICAgICAgICAgICAgICAgICAgICAgICBuaS0tO1xuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgeGMubGVuZ3RoID0gbmkgKyAxO1xuICAgICAgICAgICAgICAgICAgICAgICAgayA9IHBvd3MxMFsgTE9HX0JBU0UgLSBpIF07XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIEUuZy4gNTY3MDAgYmVjb21lcyA1NjAwMCBpZiA3IGlzIHRoZSByb3VuZGluZyBkaWdpdC5cbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGogPiAwIG1lYW5zIGkgPiBudW1iZXIgb2YgbGVhZGluZyB6ZXJvcyBvZiBuLlxuICAgICAgICAgICAgICAgICAgICAgICAgeGNbbmldID0gaiA+IDAgPyBtYXRoZmxvb3IoIG4gLyBwb3dzMTBbIGQgLSBqIF0gJSBwb3dzMTBbal0gKSAqIGsgOiAwO1xuICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gUm91bmQgdXA/XG4gICAgICAgICAgICAgICAgICAgIGlmIChyKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoIDsgOyApIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIElmIHRoZSBkaWdpdCB0byBiZSByb3VuZGVkIHVwIGlzIGluIHRoZSBmaXJzdCBlbGVtZW50IG9mIHhjLi4uXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCBuaSA9PSAwICkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC8vIGkgd2lsbCBiZSB0aGUgbGVuZ3RoIG9mIHhjWzBdIGJlZm9yZSBrIGlzIGFkZGVkLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBmb3IgKCBpID0gMSwgaiA9IHhjWzBdOyBqID49IDEwOyBqIC89IDEwLCBpKysgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaiA9IHhjWzBdICs9IGs7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvciAoIGsgPSAxOyBqID49IDEwOyBqIC89IDEwLCBrKysgKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBpZiBpICE9IGsgdGhlIGxlbmd0aCBoYXMgaW5jcmVhc2VkLlxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIGkgIT0gayApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHguZSsrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCB4Y1swXSA9PSBCQVNFICkgeGNbMF0gPSAxO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYnJlYWs7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGNbbmldICs9IGs7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmICggeGNbbmldICE9IEJBU0UgKSBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgeGNbbmktLV0gPSAwO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBrID0gMTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAvLyBSZW1vdmUgdHJhaWxpbmcgemVyb3MuXG4gICAgICAgICAgICAgICAgICAgIGZvciAoIGkgPSB4Yy5sZW5ndGg7IHhjWy0taV0gPT09IDA7IHhjLnBvcCgpICk7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgLy8gT3ZlcmZsb3c/IEluZmluaXR5LlxuICAgICAgICAgICAgICAgIGlmICggeC5lID4gTUFYX0VYUCApIHtcbiAgICAgICAgICAgICAgICAgICAgeC5jID0geC5lID0gbnVsbDtcblxuICAgICAgICAgICAgICAgIC8vIFVuZGVyZmxvdz8gWmVyby5cbiAgICAgICAgICAgICAgICB9IGVsc2UgaWYgKCB4LmUgPCBNSU5fRVhQICkge1xuICAgICAgICAgICAgICAgICAgICB4LmMgPSBbIHguZSA9IDAgXTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiB4O1xuICAgICAgICB9XG5cblxuICAgICAgICAvL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IHRoZSBzYW1lIHZhbHVlLFxuICAgICAgICAgKiBvciBudWxsIGlmIHRoZSB2YWx1ZSBvZiBlaXRoZXIgaXMgTmFOLlxuICAgICAgICAgKi9cbiAgICAgICAgUC5jb21wYXJlZFRvID0gUC5jbXAgPSBmdW5jdGlvbiAoIHksIGIgKSB7XG4gICAgICAgICAgICBpZCA9IDE7XG4gICAgICAgICAgICByZXR1cm4gY29tcGFyZSggdGhpcywgbmV3IEJpZ051bWJlciggeSwgYiApICk7XG4gICAgICAgIH07XG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiBSZXR1cm4gdGhlIG51bWJlciBvZiBkZWNpbWFsIHBsYWNlcyBvZiB0aGUgdmFsdWUgb2YgdGhpcyBCaWdOdW1iZXIsIG9yIG51bGwgaWYgdGhlIHZhbHVlXG4gICAgICAgICAqIG9mIHRoaXMgQmlnTnVtYmVyIGlzIMKxSW5maW5pdHkgb3IgTmFOLlxuICAgICAgICAgKi9cbiAgICAgICAgUC5kZWNpbWFsUGxhY2VzID0gUC5kcCA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHZhciBuLCB2LFxuICAgICAgICAgICAgICAgIGMgPSB0aGlzLmM7XG5cbiAgICAgICAgICAgIGlmICggIWMgKSByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgIG4gPSAoICggdiA9IGMubGVuZ3RoIC0gMSApIC0gYml0Rmxvb3IoIHRoaXMuZSAvIExPR19CQVNFICkgKSAqIExPR19CQVNFO1xuXG4gICAgICAgICAgICAvLyBTdWJ0cmFjdCB0aGUgbnVtYmVyIG9mIHRyYWlsaW5nIHplcm9zIG9mIHRoZSBsYXN0IG51bWJlci5cbiAgICAgICAgICAgIGlmICggdiA9IGNbdl0gKSBmb3IgKCA7IHYgJSAxMCA9PSAwOyB2IC89IDEwLCBuLS0gKTtcbiAgICAgICAgICAgIGlmICggbiA8IDAgKSBuID0gMDtcblxuICAgICAgICAgICAgcmV0dXJuIG47XG4gICAgICAgIH07XG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiAgbiAvIDAgPSBJXG4gICAgICAgICAqICBuIC8gTiA9IE5cbiAgICAgICAgICogIG4gLyBJID0gMFxuICAgICAgICAgKiAgMCAvIG4gPSAwXG4gICAgICAgICAqICAwIC8gMCA9IE5cbiAgICAgICAgICogIDAgLyBOID0gTlxuICAgICAgICAgKiAgMCAvIEkgPSAwXG4gICAgICAgICAqICBOIC8gbiA9IE5cbiAgICAgICAgICogIE4gLyAwID0gTlxuICAgICAgICAgKiAgTiAvIE4gPSBOXG4gICAgICAgICAqICBOIC8gSSA9IE5cbiAgICAgICAgICogIEkgLyBuID0gSVxuICAgICAgICAgKiAgSSAvIDAgPSBJXG4gICAgICAgICAqICBJIC8gTiA9IE5cbiAgICAgICAgICogIEkgLyBJID0gTlxuICAgICAgICAgKlxuICAgICAgICAgKiBSZXR1cm4gYSBuZXcgQmlnTnVtYmVyIHdob3NlIHZhbHVlIGlzIHRoZSB2YWx1ZSBvZiB0aGlzIEJpZ051bWJlciBkaXZpZGVkIGJ5IHRoZSB2YWx1ZSBvZlxuICAgICAgICAgKiBCaWdOdW1iZXIoeSwgYiksIHJvdW5kZWQgYWNjb3JkaW5nIHRvIERFQ0lNQUxfUExBQ0VTIGFuZCBST1VORElOR19NT0RFLlxuICAgICAgICAgKi9cbiAgICAgICAgUC5kaXZpZGVkQnkgPSBQLmRpdiA9IGZ1bmN0aW9uICggeSwgYiApIHtcbiAgICAgICAgICAgIGlkID0gMztcbiAgICAgICAgICAgIHJldHVybiBkaXYoIHRoaXMsIG5ldyBCaWdOdW1iZXIoIHksIGIgKSwgREVDSU1BTF9QTEFDRVMsIFJPVU5ESU5HX01PREUgKTtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqIFJldHVybiBhIG5ldyBCaWdOdW1iZXIgd2hvc2UgdmFsdWUgaXMgdGhlIGludGVnZXIgcGFydCBvZiBkaXZpZGluZyB0aGUgdmFsdWUgb2YgdGhpc1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b24gKCkge1xuICAgICAgICAgICAgcmV0dXJuICEhdGhpcy5jICYmIHRoaXMuY1swXSA9PSAwO1xuICAgICAgICB9O1xuXG5cbiAgICAgICAgLypcbiAgICAgICAgICogUmV0dXJuIHRydWUgaWYgdGhlIHZhbHVlIG9mIHRoaXMgQmlnTnVtYmVyIGlzIGxlc3MgdGhhbiB0aGUgdmFsdWUgb2YgQmlnTnVtYmVyKHksIGIpLFxuICAgICAgICAgKiBvdGhlcndpc2UgcmV0dXJucyBmYWxzZS5cbiAgICAgICAgICovXG4gICAgICAgIFAubGVzc1RoYW4gPSBQLmx0ID0gZnVuY3Rpb24gKCB5LCBiICkge1xuICAgICAgICAgICAgaWQgPSA4O1xuICAgICAgICAgICAgcmV0dXJuIGNvbXBhcmUoIHRoaXMsIG5ldyBCaWdOdW1iZXIoIHksIGIgKSApIDwgMDtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqIFJldHVybiB0cnVlIGlmIHRoZSB2YWx1ZSBvZiB0aGlzIEJpZ051bWJlciBpcyBsZXNzIHRoYW4gb3IgZXF1YWwgdG8gdGhlIHZhbHVlIG9mXG4gICAgICAgICAqIEJpZ051bWJlcih5LCBiKSwgb3RoZXJ3aXNlIHJldHVybnMgZmFsc2UuXG4gICAgICAgICAqL1xuICAgICAgICBQLmxlc3NUaGFuT3JFcXVhbFRvID0gUC5sdGUgPSBmdW5jdGlvbiAoIHksIGIgKSB7XG4gICAgICAgICAgICBpZCA9IDk7XG4gICAgICAgICAgICByZXR1cm4gKCBiID0gY29tcGFyZSggdGhpcywgbmV3IEJpZ051bWJlciggeSwgYiApICkgKSA9PT0gLTEgfHwgYiA9PT0gMDtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqICBuIC0gMCA9IG5cbiAgICAgICAgICogIG4gLSBOID0gTlxuICAgICAgICAgKiAgbiAtIEkgPSAtSVxuICAgICAgICAgKiAgMCAtIG4gPSAtblxuICAgICAgICAgKiAgMCAtIDAgPSAwXG4gICAgICAgICAqICAwIC0gTiA9IE5cbiAgICAgICAgICogIDAgLSBJID0gLUlcbiAgICAgICAgICogIE4gLSBuID0gTlxuICAgICAgICAgKiAgTiAtIDAgPSBOXG4gICAgICAgICAqICBOIC0gTiA9IE5cbiAgICAgICAgICogIE4gLSBJID0gTlxuICAgICAgICAgKiAgSSAtIG4gPSBJXG4gICAgICAgICAqICBJIC0gMCA9IElcbiAgICAgICAgICogIEkgLSBOID0gTlxuICAgICAgICAgKiAgSSAtIEkgPSBOXG4gICAgICAgICAqXG4gICAgICAgICAqIFJldHVybiBhIG5ldyBCaWdOdW1iZXIgd2hvc2UgdmFsdWUgaXMgdGhlIHZhbHVlIG9mIHRoaXMgQmlnTnVtYmVyIG1pbnVzIHRoZSB2YWx1ZSBvZlxuICAgICAgICAgKiBCaWdOdW1iZXIoeSwgYikuXG4gICAgICAgICAqL1xuICAgICAgICBQLm1pbnVzID0gUC5zdWIgPSBmdW5jdGlvbiAoIHksIGIgKSB7XG4gICAgICAgICAgICB2YXIgaSwgaiwgdCwgeExUeSxcbiAgICAgICAgICAgICAgICB4ID0gdGhpcyxcbiAgICAgICAgICAgICAgICBhID0geC5zO1xuXG4gICAgICAgICAgICBpZCA9IDEwO1xuICAgICAgICAgICAgeSA9IG5ldyBCaWdOdW1iZXIoIHksIGIgKTtcbiAgICAgICAgICAgIGIgPSB5LnM7XG5cbiAgICAgICAgICAgIC8vIEVpdGhlciBOYU4/XG4gICAgICAgICAgICBpZiAoICFhIHx8ICFiICkgcmV0dXJuIG5ldyBCaWdOdW1iZXIoTmFOKTtcblxuICAgICAgICAgICAgLy8gU2lnbnMgZGlmZmVyP1xuICAgICAgICAgICAgaWYgKCBhICE9IGIgKSB7XG4gICAgICAgICAgICAgICAgeS5zID0gLWI7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHgucGx1cyh5KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHhlID0geC5lIC8gTE9HX0JBU0UsXG4gICAgICAgICAgICAgICAgeWUgPSB5LmUgLyBMT0dfQkFTRSxcbiAgICAgICAgICAgICAgICB4YyA9IHguYyxcbiAgICAgICAgICAgICAgICB5YyA9IHkuYztcblxuICAgICAgICAgICAgaWYgKCAheGUgfHwgIXllICkge1xuXG4gICAgICAgICAgICAgICAgLy8gRWl0aGVyIEluZmluaXR5P1xuICAgICAgICAgICAgICAgIGlmICggIXhjIHx8ICF5YyApIHJldHVybiB4YyA/ICggeS5zID0gLWIsIHkgKSA6IG5ldyBCaWdOdW1iZXIoIHljID8geCA6IE5hTiApO1xuXG4gICAgICAgICAgICAgICAgLy8gRWl0aGVyIHplcm8/XG4gICAgICAgICAgICAgICAgaWYgKCAheGNbMF0gfHwgIXljWzBdICkge1xuXG4gICAgICAgICAgICAgICAgICAgIC8vIFJldHVybiB5IGlmIHkgaXMgbm9uLXplcm8sIHggaWYgeCBpcyBub24temVybywgb3IgemVybyBpZiBib3RoIGFyZSB6ZXJvLlxuICAgICAgICAgICAgICAgICAgICByZXR1cm4geWNbMF0gPyAoIHkucyA9IC1iLCB5ICkgOiBuZXcgQmlnTnVtYmVyKCB4Y1swXSA/IHggOlxuXG4gICAgICAgICAgICAgICAgICAgICAgLy8gSUVFRSA3NTQgKDIwMDgpIDYuMzogbiAtIG4gPSAtMCB3aGVuIHJvdW5kaW5nIHRvIC1JbmZpbml0eVxuICAgICAgICAgICAgICAgICAgICAgIFJPVU5ESU5HX01PREUgPT0gMyA/IC0wIDogMCApO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgeGUgPSBiaXRGbG9vcih4ZSk7XG4gICAgICAgICAgICB5ZSA9IGJpdEZsb29yKHllKTtcbiAgICAgICAgICAgIHhjID0geGMuc2xpY2UoKTtcblxuICAgICAgICAgICAgLy8gRGV0ZXJtaW5lIHdoaWNoIGlzIHRoZSBiaWdnZXIgbnVtYmVyLlxuICAgICAgICAgICAgaWYgKCBhID0geGUgLSB5ZSApIHtcblxuICAgICAgICAgICAgICAgIGlmICggeExUeSA9IGEgPCAwICkge1xuICAgICAgICAgICAgICAgICAgICBhID0gLWE7XG4gICAgICAgICAgICAgICAgICAgIHQgPSB4YztcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB5ZSA9IHhlO1xuICAgICAgICAgICAgICAgICAgICB0ID0geWM7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdC5yZXZlcnNlKCk7XG5cbiAgICAgICAgICAgICAgICAvLyBQcmVwZW5kIHplcm9zIHRvIGVxdWFsaXNlIGV4cG9uZW50cy5cbiAgICAgICAgICAgICAgICBmb3IgKCBiID0gYTsgYi0tOyB0LnB1c2goMCkgKTtcbiAgICAgICAgICAgICAgICB0LnJldmVyc2UoKTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAvLyBFeHBvbmVudHMgZXF1YWwuIENoZWNrIGRpZ2l0IGJ5IGRpZ2l0LlxuICAgICAgICAgICAgICAgIGogPSAoIHhMVHkgPSAoIGEgPSB4Yy5sZW5ndGggKSA8ICggYiA9IHljLmxlbmd0aCApICkgPyBhIDogYjtcblxuICAgICAgICAgICAgICAgIGZvciAoIGEgPSBiID0gMDsgYiA8IGo7IGIrKyApIHtcblxuICAgICAgICAgICAgICAgICAgICBpZiAoIHhjW2JdICE9IHljW2JdICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgeExUeSA9IHhjW2JdIDwgeWNbYl07XG4gICAgICAgICAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8geCA8IHk/IFBvaW50IHhjIHRvIHRoZSBhcnJheSBvZiB0aGUgYmlnZ2VyIG51bWJlci5cbiAgICAgICAgICAgIGlmICh4TFR5KSB0ID0geGMsIHhjID0geWMsIHljID0gdCwgeS5zID0gLXkucztcblxuICAgICAgICAgICAgYiA9ICggaiA9IHljLmxlbmd0aCApIC0gKCBpID0geGMubGVuZ3RoICk7XG5cbiAgICAgICAgICAgIC8vIEFwcGVuZCB6ZXJvcyB0byB4YyBpZiBzaG9ydGVyLlxuICAgICAgICAgICAgLy8gTm8gbmVlZCB0byBhZGQgemVyb3MgdG8geWMgaWYgc2hvcnRlciBhcyBzdWJ0cmFjdCBvbmx5IG5lZWRzIHRvIHN0YXJ0IGF0IHljLmxlbmd0aC5cbiAgICAgICAgICAgIGlmICggYiA+IDAgKSBmb3IgKCA7IGItLTsgeGNbaSsrXSA9IDAgKTtcbiAgICAgICAgICAgIGIgPSBCQVNFIC0gMTtcblxuICAgICAgICAgICAgLy8gU3VidHJhY3QgeWMgZnJvbSB4Yy5cbiAgICAgICAgICAgIGZvciAoIDsgaiA+IGE7ICkge1xuXG4gICAgICAgICAgICAgICAgaWYgKCB4Y1stLWpdIDwgeWNbal0gKSB7XG4gICAgICAgICAgICAgICAgICAgIGZvciAoIGkgPSBqOyBpICYmICF4Y1stLWldOyB4Y1tpXSA9IGIgKTtcbiAgICAgICAgICAgICAgICAgICAgLS14Y1tpXTtcbiAgICAgICAgICAgICAgICAgICAgeGNbal0gKz0gQkFTRTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICB4Y1tqXSAtPSB5Y1tqXTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gUmVtb3ZlIGxlYWRpbmcgemVyb3MgYW5kIGFkanVzdCBleHBvbmVudCBhY2NvcmRpbmdseS5cbiAgICAgICAgICAgIGZvciAoIDsgeGNbMF0gPT0gMDsgeGMuc2hpZnQoKSwgLS15ZSApO1xuXG4gICAgICAgICAgICAvLyBaZXJvP1xuICAgICAgICAgICAgaWYgKCAheGNbMF0gKSB7XG5cbiAgICAgICAgICAgICAgICAvLyBGb2xsb3dpbmcgSUVFRSA3NTQgKDIwMDgpIDYuMyxcbiAgICAgICAgICAgICAgICAvLyBuIC0gbiA9ICswICBidXQgIG4gLSBuID0gLTAgIHdoZW4gcm91bmRpbmcgdG93YXJkcyAtSW5maW5pdHkuXG4gICAgICAgICAgICAgICAgeS5zID0gUk9VTkRJTkdfTU9ERSA9PSAzID8gLTEgOiAxO1xuICAgICAgICAgICAgICAgIHkuYyA9IFsgeS5lID0gMCBdO1xuICAgICAgICAgICAgICAgIHJldHVybiB5O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAvLyBObyBuZWVkIHRvIGNoZWNrIGZvciBJbmZpbml0eSBhcyAreCAtICt5ICE9IEluZmluaXR5ICYmIC14IC0gLXkgIT0gSW5maW5pdHlcbiAgICAgICAgICAgIC8vIGZvciBmaW5pdGUgeCBhbmQgeS5cbiAgICAgICAgICAgIHJldHVybiBub3JtYWxpc2UoIHksIHhjLCB5ZSApO1xuICAgICAgICB9O1xuXG5cbiAgICAgICAgLypcbiAgICAgICAgICogICBuICUgMCA9ICBOXG4gICAgICAgICAqICAgbiAlIE4gPSAgTlxuICAgICAgICAgKiAgIG4gJSBJID0gIG5cbiAgICAgICAgICogICAwICUgbiA9ICAwXG4gICAgICAgICAqICAtMCAlIG4gPSAtMFxuICAgICAgICAgKiAgIDAgJSAwID0gIE5cbiAgICAgICAgICogICAwICUgTiA9ICBOXG4gICAgICAgICAqICAgMCAlIEkgPSAgMFxuICAgICAgICAgKiAgIE4gJSBuID0gIE5cbiAgICAgICAgICogICBOICUgMCA9ICBOXG4gICAgICAgICAqICAgTiAlIE4gPSAgTlxuICAgICAgICAgKiAgIE4gJSBJID0gIE5cbiAgICAgICAgICogICBJICUgbiA9ICBOXG4gICAgICAgICAqICAgSSAlIDAgPSAgTlxuICAgICAgICAgKiAgIEkgJSBOID0gIE5cbiAgICAgICAgICogICBJICUgSSA9ICBOXG4gICAgICAgICAqXG4gICAgICAgICAqIFJldHVybiBhIG5ldyBCaWdOdW1iZXIgd2hvc2UgdmFsdWUgaXMgdGhlIHZhbHVlIG9mIHRoaXMgQmlnTnVtYmVyIG1vZHVsbyB0aGUgdmFsdWUgb2ZcbiAgICAgICAgICogQmlnTnVtYmVyKHksIGIpLiBUaGUgcmVzdWx0IGRlcGVuZHMgb24gdGhlIHZhbHVlIG9mIE1PRFVMT19NT0RFLlxuICAgICAgICAgKi9cbiAgICAgICAgUC5tb2R1bG8gPSBQLm1vZCA9IGZ1bmN0aW9uICggeSwgYiApIHtcbiAgICAgICAgICAgIHZhciBxLCBzLFxuICAgICAgICAgICAgICAgIHggPSB0aGlzO1xuXG4gICAgICAgICAgICBpZCA9IDExO1xuICAgICAgICAgICAgeSA9IG5ldyBCaWdOdW1iZXIoIHksIGIgKTtcblxuICAgICAgICAgICAgLy8gUmV0dXJuIE5hTiBpZiB4IGlzIEluZmluaXR5IG9yIE5hTiwgb3IgeSBpcyBOYU4gb3IgemVyby5cbiAgICAgICAgICAgIGlmICggIXguYyB8fCAheS5zIHx8IHkuYyAmJiAheS5jWzBdICkge1xuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQmlnTnVtYmVyKE5hTik7XG5cbiAgICAgICAgICAgIC8vIFJldHVybiB4IGlmIHkgaXMgSW5maW5pdHkgb3IgeCBpcyB6ZXJvLlxuICAgICAgICAgICAgfSBlbHNlIGlmICggIXkuYyB8fCB4LmMgJiYgIXguY1swXSApIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEJpZ051bWJlcih4KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCBNT0RVTE9fTU9ERSA9PSA5ICkge1xuXG4gICAgICAgICAgICAgICAgLy8gRXVjbGlkaWFuIGRpdmlzaW9uOiBxID0gc2lnbih5KSAqIGZsb29yKHggLyBhYnMoeSkpXG4gICAgICAgICAgICAgICAgLy8gciA9IHggLSBxeSAgICB3aGVyZSAgMCA8PSByIDwgYWJzKHkpXG4gICAgICAgICAgICAgICAgcyA9IHkucztcbiAgICAgICAgICAgICAgICB5LnMgPSAxO1xuICAgICAgICAgICAgICAgIHEgPSBkaXYoIHgsIHksIDAsIDMgKTtcbiAgICAgICAgICAgICAgICB5LnMgPSBzO1xuICAgICAgICAgICAgICAgIHEucyAqPSBzO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBxID0gZGl2KCB4LCB5LCAwLCBNT0RVTE9fTU9ERSApO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4geC5taW51cyggcS50aW1lcyh5KSApO1xuICAgICAgICB9O1xuXG5cbiAgICAgICAgLypcbiAgICAgICAgICogUmV0dXJuIGEgbmV3IEJpZ051bWJlciB3aG9zZSB2YWx1ZSBpcyB0aGUgdmFsdWUgb2YgdGhpcyBCaWdOdW1iZXIgbmVnYXRlZCxcbiAgICAgICAgICogaS5lLiBtdWx0aXBsaWVkIGJ5IC0xLlxuICAgICAgICAgKi9cbiAgICAgICAgUC5uZWdhdGVkID0gUC5uZWcgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB2YXIgeCA9IG5ldyBCaWdOdW1iZXIodGhpcyk7XG4gICAgICAgICAgICB4LnMgPSAteC5zIHx8IG51bGw7XG4gICAgICAgICAgICByZXR1cm4geDtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqICBuICsgMCA9IG5cbiAgICAgICAgICogIG4gKyBOID0gTlxuICAgICAgICAgKiAgbiArIEkgPSBJXG4gICAgICAgICAqICAwICsgbiA9IG5cbiAgICAgICAgICogIDAgKyAwID0gMFxuICAgICAgICAgKiAgMCArIE4gPSBOXG4gICAgICAgICAqICAwICsgSSA9IElcbiAgICAgICAgICogIE4gKyBuID0gTlxuICAgICAgICAgKiAgTiArIDAgPSBOXG4gICAgICAgICAqICBOICsgTiA9IE5cbiAgICAgICAgICogIE4gKyBJID0gTlxuICAgICAgICAgKiAgSSArIG4gPSBJXG4gICAgICAgICAqICBJICsgMCA9IElcbiAgICAgICAgICogIEkgKyBOID0gTlxuICAgICAgICAgKiAgSSArIEkgPSBJXG4gICAgICAgICAqXG4gICAgICAgICAqIFJldHVybiBhIG5ldyBCaWdOdW1iZXIgd2hvc2UgdmFsdWUgaXMgdGhlIHZhbHVlIG9mIHRoaXMgQmlnTnVtYmVyIHBsdXMgdGhlIHZhbHVlIG9mXG4gICAgICAgICAqIEJpZ051bWJlcih5LCBiKS5cbiAgICAgICAgICovXG4gICAgICAgIFAucGx1cyA9IFAuYWRkID0gZnVuY3Rpb24gKCB5LCBiICkge1xuICAgICAgICAgICAgdmFyIHQsXG4gICAgICAgICAgICAgICAgeCA9IHRoaXMsXG4gICAgICAgICAgICAgICAgYSA9IHgucztcblxuICAgICAgICAgICAgaWQgPSAxMjtcbiAgICAgICAgICAgIHkgPSBuZXcgQmlnTnVtYmVyKCB5LCBiICk7XG4gICAgICAgICAgICBiID0geS5zO1xuXG4gICAgICAgICAgICAvLyBFaXRoZXIgTmFOP1xuICAgICAgICAgICAgaWYgKCAhYSB8fCAhYiApIHJldHVybiBuZXcgQmlnTnVtYmVyKE5hTik7XG5cbiAgICAgICAgICAgIC8vIFNpZ25zIGRpZmZlcj9cbiAgICAgICAgICAgICBpZiAoIGEgIT0gYiApIHtcbiAgICAgICAgICAgICAgICB5LnMgPSAtYjtcbiAgICAgICAgICAgICAgICByZXR1cm4geC5taW51cyh5KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgdmFyIHhlID0geC5lIC8gTE9HX0JBU0UsXG4gICAgICAgICAgICAgICAgeWUgPSB5LmUgLyBMT0dfQkFTRSxcbiAgICAgICAgICAgICAgICB4YyA9IHguYyxcbiAgICAgICAgICAgICAgICB5YyA9IHkuYztcblxuICAgICAgICAgICAgaWYgKCAheGUgfHwgIXllICkge1xuXG4gICAgICAgICAgICAgICAgLy8gUmV0dXJuIMKxSW5maW5pdHkgaWYgZWl0aGVyIMKxSW5maW5pdHkuXG4gICAgICAgICAgICAgICAgaWYgKCAheGMgfHwgIXljICkgcmV0dXJuIG5ldyBCaWdOdW1iZXIoIGEgLyAwICk7XG5cbiAgICAgICAgICAgICAgICAvLyBFaXRoZXIgemVybz9cbiAgICAgICAgICAgICAgICAvLyBSZXR1cm4geSBpZiB5IGlzIG5vbi16ZXJvLCB4IGlmIHggaXMgbm9uLXplcm8sIG9yIHplcm8gaWYgYm90aCBhcmUgemVyby5cbiAgICAgICAgICAgICAgICBpZiAoICF4Y1swXSB8fCAheWNbMF0gKSByZXR1cm4geWNbMF0gPyB5IDogbmV3IEJpZ051bWJlciggeGNbMF0gPyB4IDogYSAqIDAgKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgeGUgPSBiaXRGbG9vcih4ZSk7XG4gICAgICAgICAgICB5ZSA9IGJpdEZsb29yKHllKTtcbiAgICAgICAgICAgIHhjID0geGMuc2xpY2UoKTtcblxuICAgICAgICAgICAgLy8gUHJlcGVuZCB6ZXJvcyB0byBlcXVhbGlzZSBleHBvbmVudHMuIEZhc3RlciB0byB1c2UgcmV2ZXJzZSB0aGVuIGRvIHVuc2hpZnRzLlxuICAgICAgICAgICAgaWYgKCBhID0geGUgLSB5ZSApIHtcbiAgICAgICAgICAgICAgICBpZiAoIGEgPiAwICkge1xuICAgICAgICAgICAgICAgICAgICB5ZSA9IHhlO1xuICAgICAgICAgICAgICAgICAgICB0ID0geWM7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgYSA9IC1hO1xuICAgICAgICAgICAgICAgICAgICB0ID0geGM7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgdC5yZXZlcnNlKCk7XG4gICAgICAgICAgICAgICAgZm9yICggOyBhLS07IHQucHVzaCgwKSApO1xuICAgICAgICAgICAgICAgIHQucmV2ZXJzZSgpO1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBhID0geGMubGVuZ3RoO1xuICAgICAgICAgICAgYiA9IHljLmxlbmd0aDtcblxuICAgICAgICAgICAgLy8gUG9pbnQgeGMgdG8gdGhlIGxvbmdlciBhcnJheSwgYW5kIGIgdG8gdGhlIHNob3J0ZXIgbGVuZ3RoLlxuICAgICAgICAgICAgaWYgKCBhIC0gYiA8IDAgKSB0ID0geWMsIHljID0geGMsIHhjID0gdCwgYiA9IGE7XG5cbiAgICAgICAgICAgIC8vIE9ubHkgc3RhcnQgYWRkaW5nIGF0IHljLmxlbmd0aCAtIDEgYXMgdGhlIGZ1cnRoZXIgZGlnaXRzIG9mIHhjIGNhbiBiZSBpZ25vcmVkLlxuICAgICAgICAgICAgZm9yICggYSA9IDA7IGI7ICkge1xuICAgICAgICAgICAgICAgIGEgPSAoIHhjWy0tYl0gPSB4Y1tiXSArIHljW2JdICsgYSApIC8gQkFTRSB8IDA7XG4gICAgICAgICAgICAgICAgeGNbYl0gJT0gQkFTRTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGEpIHtcbiAgICAgICAgICAgICAgICB4Yy51bnNoaWZ0KGEpO1xuICAgICAgICAgICAgICAgICsreWU7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIE5vIG5lZWQgdG8gY2hlY2sgZm9yIHplcm8sIGFzICt4ICsgK3kgIT0gMCAmJiAteCArIC15ICE9IDBcbiAgICAgICAgICAgIC8vIHllID0gTUFYX0VYUCArIDEgcG9zc2libGVcbiAgICAgICAgICAgIHJldHVybiBub3JtYWxpc2UoIHksIHhjLCB5ZSApO1xuICAgICAgICB9O1xuXG5cbiAgICAgICAgLypcbiAgICAgICAgICogUmV0dXJuIHRoZSBudW1iZXIgb2Ygc2lnbmlmaWNhbnQgZGlnaXRzIG9mIHRoZSB2YWx1ZSBvZiB0aGlzIEJpZ051bWJlci5cbiAgICAgICAgICpcbiAgICAgICAgICogW3pdIHtib29sZWFufG51bWJlcn0gV2hldGhlciB0byBjb3VudCBpbnRlZ2VyLXBhcnQgdHJhaWxpbmcgemVyb3M6IHRydWUsIGZhbHNlLCAxIG9yIDAuXG4gICAgICAgICAqL1xuICAgICAgICBQLnByZWNpc2lvbiA9IFAuc2QgPSBmdW5jdGlvbiAoeikge1xuICAgICAgICAgICAgdmFyIG4sIHYsXG4gICAgICAgICAgICAgICAgeCA9IHRoaXMsXG4gICAgICAgICAgICAgICAgYyA9IHguYztcblxuICAgICAgICAgICAgLy8gJ3ByZWNpc2lvbigpIGFyZ3VtZW50IG5vdCBhIGJvb2xlYW4gb3IgYmluYXJ5IGRpZ2l0OiB7en0nXG4gICAgICAgICAgICBpZiAoIHogIT0gbnVsbCAmJiB6ICE9PSAhIXogJiYgeiAhPT0gMSAmJiB6ICE9PSAwICkge1xuICAgICAgICAgICAgICAgIGlmIChFUlJPUlMpIHJhaXNlKCAxMywgJ2FyZ3VtZW50JyArIG5vdEJvb2wsIHogKTtcbiAgICAgICAgICAgICAgICBpZiAoIHogIT0gISF6ICkgeiA9IG51bGw7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICggIWMgKSByZXR1cm4gbnVsbDtcbiAgICAgICAgICAgIHYgPSBjLmxlbmd0aCAtIDE7XG4gICAgICAgICAgICBuID0gdiAqIExPR19CQVNFICsgMTtcblxuICAgICAgICAgICAgaWYgKCB2ID0gY1t2XSApIHtcblxuICAgICAgICAgICAgICAgIC8vIFN1YnRyYWN0IHRoZSBudW1iZXIgb2YgdHJhaWxpbmcgemVyb3Mgb2YgdGhlIGxhc3QgZWxlbWVudC5cbiAgICAgICAgICAgICAgICBmb3IgKCA7IHYgJSAxMCA9PSAwOyB2IC89IDEwLCBuLS0gKTtcblxuICAgICAgICAgICAgICAgIC8vIEFkZCB0aGUgbnVtYmVyIG9mIGRpZ2l0cyBvZiB0aGUgZmlyc3QgZWxlbWVudC5cbiAgICAgICAgICAgICAgICBmb3IgKCB2ID0gY1swXTsgdiA+PSAxMDsgdiAvPSAxMCwgbisrICk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICggeiAmJiB4LmUgKyAxID4gbiApIG4gPSB4LmUgKyAxO1xuXG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FX0lOVEVHRVIsIE1BWF9TQUZFX0lOVEVHRVIsIDE2LCAnYXJndW1lbnQnIClcblxuICAgICAgICAgICAgICAvLyBrIDwgMWUrMjEsIG9yIHRydW5jYXRlKGspIHdpbGwgcHJvZHVjZSBleHBvbmVudGlhbCBub3RhdGlvbi5cbiAgICAgICAgICAgICAgPyBuLnRpbWVzKCAnMWUnICsgdHJ1bmNhdGUoaykgKVxuICAgICAgICAgICAgICA6IG5ldyBCaWdOdW1iZXIoIG4uYyAmJiBuLmNbMF0gJiYgKCBrIDwgLU1BWF9TQUZFX0lOVEVHRVIgfHwgayA+IE1BWF9TQUZFX0lOVEVHRVIgKVxuICAgICAgICAgICAgICAgID8gbi5zICogKCBrIDwgMCA/IDAgOiAxIC8gMCApXG4gICAgICAgICAgICAgICAgOiBuICk7XG4gICAgICAgIH07XG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiAgc3FydCgtbikgPSAgTlxuICAgICAgICAgKiAgc3FydCggTikgPSAgTlxuICAgICAgICAgKiAgc3FydCgtSSkgPSAgTlxuICAgICAgICAgKiAgc3FydCggSSkgPSAgSVxuICAgICAgICAgKiAgc3FydCggMCkgPSAgMFxuICAgICAgICAgKiAgc3FydCgtMCkgPSAtMFxuICAgICAgICAgKlxuICAgICAgICAgKiBSZXR1cm4gYSBuZXcgQmlnTnVtYmVyIHdob3NlIHZhbHVlIGlzIHRoZSBzcXVhcmUgcm9vdCBvZiB0aGUgdmFsdWUgb2YgdGhpcyBCaWdOdW1iZXIsXG4gICAgICAgICAqIHJvdW5kZWQgYWNjb3JkaW5nIHRvIERFQ0lNQUxfUExBQ0VTIGFuZCBST1VORElOR19NT0RFLlxuICAgICAgICAgKi9cbiAgICAgICAgUC5zcXVhcmVSb290ID0gUC5zcXJ0ID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgdmFyIG0sIG4sIHIsIHJlcCwgdCxcbiAgICAgICAgICAgICAgICB4ID0gdGhpcyxcbiAgICAgICAgICAgICAgICBjID0geC5jLFxuICAgICAgICAgICAgICAgIHMgPSB4LnMsXG4gICAgICAgICAgICAgICAgZSA9IHguZSxcbiAgICAgICAgICAgICAgICBkcCA9IERFQ0lNQUxfUExBQ0VTICsgNCxcbiAgICAgICAgICAgICAgICBoYWxmID0gbmV3IEJpZ051bWJlcignMC41Jyk7XG5cbiAgICAgICAgICAgIC8vIE5lZ2F0aXZlL05hTi9JbmZpbml0eS96ZXJvP1xuICAgICAgICAgICAgaWYgKCBzICE9PSAxIHx8ICFjIHx8ICFjWzBdICkge1xuICAgICAgICAgICAgICAgIHJldHVybiBuZXcgQmlnTnVtYmVyKCAhcyB8fCBzIDwgMCAmJiAoICFjIHx8IGNbMF0gKSA/IE5hTiA6IGMgPyB4IDogMSAvIDAgKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gSW5pdGlhbCBlc3RpbWF0ZS5cbiAgICAgICAgICAgIHMgPSBNYXRoLnNxcnQoICt4ICk7XG5cbiAgICAgICAgICAgIC8vIE1hdGguc3FydCB1bmRlcmZsb3cvb3ZlcmZsb3c/XG4gICAgICAgICAgICAvLyBQYXNzIHggdG8gTWF0aC5zcXJ0IGFzIGludGVnZXIsIHRoZW4gYWRqdXN0IHRoZSBleHBvbmVudCBvZiB0aGUgcmVzdWx0LlxuICAgICAgICAgICAgaWYgKCBzID09IDAgfHwgcyA9PSAxIC8gMCApIHtcbiAgICAgICAgICAgICAgICBuID0gY29lZmZUb1N0cmluZyhjKTtcbiAgICAgICAgICAgICAgICBpZiAoICggbi5sZW5ndGggKyBlICkgJSAyID09IDAgKSBuICs9ICcwJztcbiAgICAgICAgICAgICAgICBzID0gTWF0aC5zcXJ0KG4pO1xuICAgICAgICAgICAgICAgIGUgPSBiaXRGbG9vciggKCBlICsgMSApIC8gMiApIC0gKCBlIDwgMCB8fCBlICUgMiApO1xuXG4gICAgICAgICAgICAgICAgaWYgKCBzID09IDEgLyAwICkge1xuICAgICAgICAgICAgICAgICAgICBuID0gJzFlJyArIGU7XG4gICAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICAgICAgbiA9IHMudG9FeHBvbmVudGlhbCgpO1xuICAgICAgICAgICAgICAgICAgICBuID0gbi5zbGljZSggMCwgbi5pbmRleE9mKCdlJykgKyAxICkgKyBlO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHIgPSBuZXcgQmlnTnVtYmVyKG4pO1xuICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICByID0gbmV3IEJpZ051bWJlciggcyArICcnICk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIC8vIENoZWNrIGZvciB6ZXJvLlxuICAgICAgICAgICAgLy8gciBjb3VsZCBiZSB6ZXJvIGlmIE1JTl9FWFAgaXMgY2hhbmdlZCBhZnRlciB0aGUgdGhpcyB2YWx1ZSB3YXMgY3JlYXRlZC5cbiAgICAgICAgICAgIC8vIFRoaXMgd291bGQgY2F1c2UgYSBkaXZpc2lvbiBieSB6ZXJvICh4L3QpIGFuZCBoZW5jZSBJbmZpbml0eSBiZWxvdywgd2hpY2ggd291bGQgY2F1c2VcbiAgICAgICAgICAgIC8vIGNvZWZmVG9TdHJpbmcgdG8gdGhyb3cuXG4gICAgICAgICAgICBpZiAoIHIuY1swXSApIHtcbiAgICAgICAgICAgICAgICBlID0gci5lO1xuICAgICAgICAgICAgICAgIHMgPSBlICsgZHA7XG4gICAgICAgICAgICAgICAgaWYgKCBzIDwgMyApIHMgPSAwO1xuXG4gICAgICAgICAgICAgICAgLy8gTmV3dG9uLVJhcGhzb24gaXRlcmF0aW9uLlxuICAgICAgICAgICAgICAgIGZvciAoIDsgOyApIHtcbiAgICAgICAgICAgICAgICAgICAgdCA9IHI7XG4gICAgICAgICAgICAgICAgICAgIHIgPSBoYWxmLnRpbWVzKCB0LnBsdXMoIGRpdiggeCwgdCwgZHAsIDEgKSApICk7XG5cbiAgICAgICAgICAgICAgICAgICAgaWYgKCBjb2VmZlRvU3RyaW5nKCB0LmMgICApLnNsaWNlKCAwLCBzICkgPT09ICggbiA9XG4gICAgICAgICAgICAgICAgICAgICAgICAgY29lZmZUb1N0cmluZyggci5jICkgKS5zbGljZSggMCwgcyApICkge1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGUgZXhwb25lbnQgb2YgciBtYXkgaGVyZSBiZSBvbmUgbGVzcyB0aGFuIHRoZSBmaW5hbCByZXN1bHQgZXhwb25lbnQsXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBlLmcgMC4wMDA5OTk5IChlLTQpIC0tPiAwLjAwMSAoZS0zKSwgc28gYWRqdXN0IHMgc28gdGhlIHJvdW5kaW5nIGRpZ2l0c1xuICAgICAgICAgICAgICAgICAgICAgICAgLy8gYXJlIGluZGV4ZWQgY29ycmVjdGx5LlxuICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCByLmUgPCBlICkgLS1zO1xuICAgICAgICAgICAgICAgICAgICAgICAgbiA9IG4uc2xpY2UoIHMgLSAzLCBzICsgMSApO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBUaGUgNHRoIHJvdW5kaW5nIGRpZ2l0IG1heSBiZSBpbiBlcnJvciBieSAtMSBzbyBpZiB0aGUgNCByb3VuZGluZyBkaWdpdHNcbiAgICAgICAgICAgICAgICAgICAgICAgIC8vIGFyZSA5OTk5IG9yIDQ5OTkgKGkuZS4gYXBwcm9hY2hpbmcgYSByb3VuZGluZyBib3VuZGFyeSkgY29udGludWUgdGhlXG4gICAgICAgICAgICAgICAgICAgICAgICAvLyBpdGVyYXRpb24uXG4gICAgICAgICAgICAgICAgICAgICAgICBpZiAoIG4gPT0gJzk5OTknIHx8ICFyZXAgJiYgbiA9PSAnNDk5OScgKSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBPbiB0aGUgZmlyc3QgaXRlcmF0aW9uIG9ubHksIGNoZWNrIHRvIHNlZSBpZiByb3VuZGluZyB1cCBnaXZlcyB0aGVcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBleGFjdCByZXN1bHQgYXMgdGhlIG5pbmVzIG1heSBpbmZpbml0ZWx5IHJlcGVhdC5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoICFyZXAgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJvdW5kKCB0LCB0LmUgKyBERUNJTUFMX1BMQUNFUyArIDIsIDAgKTtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBpZiAoIHQudGltZXModCkuZXEoeCkgKSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICByID0gdDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgZHAgKz0gNDtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBzICs9IDQ7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcmVwID0gMTtcbiAgICAgICAgICAgICAgICAgICAgICAgIH0gZWxzZSB7XG5cbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBJZiByb3VuZGluZyBkaWdpdHMgYXJlIG51bGwsIDB7MCw0fSBvciA1MHswLDN9LCBjaGVjayBmb3IgZXhhY3RcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyByZXN1bHQuIElmIG5vdCwgdGhlbiB0aGVyZSBhcmUgZnVydGhlciBkaWdpdHMgYW5kIG0gd2lsbCBiZSB0cnV0aHkuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYgKCAhK24gfHwgIStuLnNsaWNlKDEpICYmIG4uY2hhckF0KDApID09ICc1JyApIHtcblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAvLyBUcnVuY2F0ZSB0byB0aGUgZmlyc3Qgcm91bmRpbmcgZGlnaXQuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHJvdW5kKCByLCByLmUgKyBERUNJTUFMX1BMQUNFUyArIDIsIDEgKTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbSA9ICFyLnRpbWVzKHIpLmVxKHgpO1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICByZXR1cm4gcm91bmQoIHIsIHIuZSArIERFQ0lNQUxfUExBQ0VTICsgMSwgUk9VTkRJTkdfTU9ERSwgbSApO1xuICAgICAgICB9O1xuXG5cbiAgICAgICAgLypcbiAgICAgICAgICogIG4gKiAwID0gMFxuICAgICAgICAgKiAgbiAqIE4gPSBOXG4gICAgICAgICAqICBuICogSSA9IElcbiAgICAgICAgICogIDAgKiBuID0gMFxuICAgICAgICAgKiAgMCAqIDAgPSAwXG4gICAgICAgICAqICAwICogTiA9IE5cbiAgICAgICAgICogIDAgKiBJID0gTlxuICAgICAgICAgKiAgTiAqIG4gPSBOXG4gICAgICAgICAqICBOICogMCA9IE5cbiAgICAgICAgICogIE4gKiBOID0gTlxuICAgICAgICAgKiAgTiAqIEkgPSBOXG4gICAgICAgICAqICBJICogbiA9IElcbiAgICAgICAgICogIEkgKiAwID0gTlxuICAgICAgICAgKiAgSSAqIE4gPSBOXG4gICAgICAgICAqICBJICogSSA9IElcbiAgICAgICAgICpcbiAgICAgICAgICogUmV0dXJuIGEgbmV3IEJpZ051bWJlciB3aG9zZSB2YWx1ZSBpcyB0aGUgdmFsdWUgb2YgdGhpcyBCaWdOdW1iZXIgdGltZXMgdGhlIHZhbHVlIG9mXG4gICAgICAgICAqIEJpZ051bWJlcih5LCBiKS5cbiAgICAgICAgICovXG4gICAgICAgIFAudGltZXMgPSBQLm11bCA9IGZ1bmN0aW9uICggeSwgYiApIHtcbiAgICAgICAgICAgIHZhciBjLCBlLCBpLCBqLCBrLCBtLCB4Y0wsIHhsbywgeGhpLCB5Y0wsIHlsbywgeWhpLCB6YyxcbiAgICAgICAgICAgICAgICBiYXNlLCBzcXJ0QmFzZSxcbiAgICAgICAgICAgICAgICB4ID0gdGhpcyxcbiAgICAgICAgICAgICAgICB4YyA9IHguYyxcbiAgICAgICAgICAgICAgICB5YyA9ICggaWQgPSAxNywgeSA9IG5ldyBCaWdOdW1iZXIoIHksIGIgKSApLmM7XG5cbiAgICAgICAgICAgIC8vIEVpdGhlciBOYU4sIMKxSW5maW5pdHkgb3IgwrEwP1xuICAgICAgICAgICAgaWYgKCAheGMgfHwgIXljIHx8ICF4Y1swXSB8fCAheWNbMF0gKSB7XG5cbiAgICAgICAgICAgICAgICAvLyBSZXR1cm4gTmFOIGlmIGVpdGhlciBpcyBOYU4sIG9yIG9uZSBpcyAwIGFuZCB0aGUgb3RoZXIgaXMgSW5maW5pdHkuXG4gICAgICAgICAgICAgICAgaWYgKCAheC5zIHx8ICF5LnMgfHwgeGMgJiYgIXhjWzBdICYmICF5YyB8fCB5YyAmJiAheWNbMF0gJiYgIXhjICkge1xuICAgICAgICAgICAgICAgICAgICB5LmMgPSB5LmUgPSB5LnMgPSBudWxsO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHkucyAqPSB4LnM7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gUmV0dXJuIMKxSW5maW5pdHkgaWYgZWl0aGVyIGlzIMKxSW5maW5pdHkuXG4gICAgICAgICAgICAgICAgICAgIGlmICggIXhjIHx8ICF5YyApIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHkuYyA9IHkuZSA9IG51bGw7XG5cbiAgICAgICAgICAgICAgICAgICAgLy8gUmV0dXJuIMKxMCBpZiBlaXRoZXIgaXMgwrEwLlxuICAgICAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICAgICAgeS5jID0gWzBdO1xuICAgICAgICAgICAgICAgICAgICAgICAgeS5lID0gMDtcbiAgICAgICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHJldHVybiB5O1xuICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICBlID0gYml0Rmxvb3IoIHguZSAvIExPR19CQVNFICkgKyBiaXRGbG9vciggeS5lIC8gTE9HX0JBU0UgKTtcbiAgICAgICAgICAgIHkucyAqPSB4LnM7XG4gICAgICAgICAgICB4Y0wgPSB4Yy5sZW5ndGg7XG4gICAgICAgICAgICB5Y0wgPSB5Yy5sZW5ndGg7XG5cbiAgICAgICAgICAgIC8vIEVuc3VyZSB4YyBwb2ludHMgdG8gbG9uZ2VyIGFycmF5IGFuZCB4Y0wgdG8gaXRzIGxlbmd0aC5cbiAgICAgICAgICAgIGlmICggeGNMIDwgeWNMICkgemMgPSB4YywgeGMgPSB5YywgeWMgPSB6YywgaSA9IHhjTCwgeGNMID0geWNMLCB5Y0wgPSBpO1xuXG4gICAgICAgICAgICAvLyBJbml0aWFsaXNlIHRoZSByZXN1bHQgYXJyYXkgd2l0aCB6ZXJvcy5cbiAgICAgICAgICAgIGZvciAoIGkgPSB4Y0wgKyB5Y0wsIHpjID0gW107IGktLTsgemMucHVzaCgwKSApO1xuXG4gICAgICAgICAgICBiYXNlID0gQkFTRTtcbiAgICAgICAgICAgIHNxcnRCYXNlID0gU1FSVF9CQVNFO1xuXG4gICAgICAgICAgICBmb3IgKCBpID0geWNMOyAtLWkgPj0gMDsgKSB7XG4gICAgICAgICAgICAgICAgYyA9IDA7XG4gICAgICAgICAgICAgICAgeWxvID0geWNbaV0gJSBzcXJ0QmFzZTtcbiAgICAgICAgICAgICAgICB5aGkgPSB5Y1tpXSAvIHNxcnRCYXNlIHwgMDtcblxuICAgICAgICAgICAgICAgIGZvciAoIGsgPSB4Y0wsIGogPSBpICsgazsgaiA+IGk7ICkge1xuICAgICAgICAgICAgICAgICAgICB4bG8gPSB4Y1stLWtdICUgc3FydEJhc2U7XG4gICAgICAgICAgICAgICAgICAgIHhoaSA9IHhjW2tdIC8gc3FydEJhc2UgfCAwO1xuICAgICAgICAgICAgICAgICAgICBtID0geWhpICogeGxvICsgeGhpICogeWxvO1xuICAgICAgICAgICAgICAgICAgICB4bG8gPSB5bG8gKiB4bG8gKyAoICggbSAlIHNxcnRCYXNlICkgKiBzcXJ0QmFzZSApICsgemNbal0gKyBjO1xuICAgICAgICAgICAgICAgICAgICBjID0gKCB4bG8gLyBiYXNlIHwgMCApICsgKCBtIC8gc3FydEJhc2UgfCAwICkgKyB5aGkgKiB4aGk7XG4gICAgICAgICAgICAgICAgICAgIHpjW2otLV0gPSB4bG8gJSBiYXNlO1xuICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgIHpjW2pdID0gYztcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKGMpIHtcbiAgICAgICAgICAgICAgICArK2U7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHpjLnNoaWZ0KCk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHJldHVybiBub3JtYWxpc2UoIHksIHpjLCBlICk7XG4gICAgICAgIH07XG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiBSZXR1cm4gYSBuZXcgQmlnTnVtYmVyIHdob3NlIHZhbHVlIGlzIHRoZSB2YWx1ZSBvZiB0aGlzIEJpZ051bWJlciByb3VuZGVkIHRvIGEgbWF4aW11bSBvZlxuICAgICAgICAgKiBzZCBzaWduaWZpY2FudCBkaWdpdHMgdXNpbmcgcm91bmRpbmcgbW9kZSBybSwgb3IgUk9VTkRJTkdfTU9ERSBpZiBybSBpcyBvbWl0dGVkLlxuICAgICAgICAgKlxuICAgICAgICAgKiBbc2RdIHtudW1iZXJ9IFNpZ25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gb3JtYXQoKSByb3VuZGluZyBtb2RlIG5vdCBhbiBpbnRlZ2VyOiB7cm19J1xuICAgICAgICAgKiAndG9Gb3JtYXQoKSByb3VuZGluZyBtb2RlIG91dCBvZiByYW5nZToge3JtfSdcbiAgICAgICAgICovXG4gICAgICAgIFAudG9Gb3JtYXQgPSBmdW5jdGlvbiAoIGRwLCBybSApIHtcbiAgICAgICAgICAgIHZhciBzdHIgPSBmb3JtYXQoIHRoaXMsIGRwICE9IG51bGwgJiYgaXNWYWxpZEludCggZHAsIDAsIE1BWCwgMjEgKVxuICAgICAgICAgICAgICA/IH5+ZHAgKyB0aGlzLmUgKyAxIDogbnVsbCwgcm0sIDIxICk7XG5cbiAgICAgICAgICAgIGlmICggdGhpcy5jICkge1xuICAgICAgICAgICAgICAgIHZhciBpLFxuICAgICAgICAgICAgICAgICAgICBhcnIgPSBzdHIuc3BsaXQoJy4nKSxcbiAgICAgICAgICAgICAgICAgICAgZzEgPSArRk9STUFULmdyb3VwU2l6ZSxcbiAgICAgICAgICAgICAgICAgICAgZzIgPSArRk9STUFULnNlY29uZGFyeUdyb3VwU2l6ZSxcbiAgICAgICAgICAgICAgICAgICAgZ3JvdXBTZXBhcmF0b3IgPSBGT1JNQVQuZ3JvdXBTZXBhcmF0b3IsXG4gICAgICAgICAgICAgICAgICAgIGludFBhcnQgPSBhcnJbMF0sXG4gICAgICAgICAgICAgICAgICAgIGZyYWN0aW9uUGFydCA9IGFyclsxXSxcbiAgICAgICAgICAgICAgICAgICAgaXNOZWcgPSB0aGlzLnMgPCAwLFxuICAgICAgICAgICAgICAgICAgICBpbnREaWdpdHMgPSBpc05lZyA/IGludFBhcnQuc2xpY2UoMSkgOiBpbnRQYXJ0LFxuICAgICAgICAgICAgICAgICAgICBsZW4gPSBpbnREaWdpdHMubGVuZ3RoO1xuXG4gICAgICAgICAgICAgICAgaWYgKGcyKSBpID0gZzEsIGcxID0gZzIsIGcyID0gaSwgbGVuIC09IGk7XG5cbiAgICAgICAgICAgICAgICBpZiAoIGcxID4gMCAmJiBsZW4gPiAwICkge1xuICAgICAgICAgICAgICAgICAgICBpID0gbGVuICUgZzEgfHwgZzE7XG4gICAgICAgICAgICAgICAgICAgIGludFBhcnQgPSBpbnREaWdpdHMuc3Vic3RyKCAwLCBpICk7XG5cbiAgICAgICAgICAgICAgICAgICAgZm9yICggOyBpIDwgbGVuOyBpICs9IGcxICkge1xuICAgICAgICAgICAgICAgICAgICAgICAgaW50UGFydCArPSBncm91cFNlcGFyYXRvciArIGludERpZ2l0cy5zdWJzdHIoIGksIGcxICk7XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICBpZiAoIGcyID4gMCApIGludFBhcnQgKz0gZ3JvdXBTZXBhcmF0b3IgKyBpbnREaWdpdHMuc2xpY2UoaSk7XG4gICAgICAgICAgICAgICAgICAgIGlmIChpc05lZykgaW50UGFydCA9ICctJyArIGludFBhcnQ7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgc3RyID0gZnJhY3Rpb25QYXJ0XG4gICAgICAgICAgICAgICAgICA/IGludFBhcnQgKyBGT1JNQVQuZGVjaW1hbFNlcGFyYXRvciArICggKCBnMiA9ICtGT1JNQVQuZnJhY3Rpb25Hcm91cFNpemUgKVxuICAgICAgICAgICAgICAgICAgICA/IGZyYWN0aW9uUGFydC5yZXBsYWNlKCBuZXcgUmVnRXhwKCAnXFxcXGR7JyArIGcyICsgJ31cXFxcQicsICdnJyApLFxuICAgICAgICAgICAgICAgICAgICAgICckJicgKyBGT1JNQVQuZnJhY3Rpb25Hcm91cFNlcGFyYXRvciApXG4gICAgICAgICAgICAgICAgICAgIDogZnJhY3Rpb25QYXJ0IClcbiAgICAgICAgICAgICAgICAgIDogaW50UGFydDtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHN0cjtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqIFJldHVybiBhIHN0c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IHguYyxcbiAgICAgICAgICAgICAgICBkID0gbmV3IEJpZ051bWJlcihPTkUpLFxuICAgICAgICAgICAgICAgIG4xID0gZDAgPSBuZXcgQmlnTnVtYmVyKE9ORSksXG4gICAgICAgICAgICAgICAgZDEgPSBuMCA9IG5ldyBCaWdOdW1iZXIoT05FKTtcblxuICAgICAgICAgICAgaWYgKCBtZCAhPSBudWxsICkge1xuICAgICAgICAgICAgICAgIEVSUk9SUyA9IGZhbHNlO1xuICAgICAgICAgICAgICAgIG4gPSBuZXcgQmlnTnVtYmVyKG1kKTtcbiAgICAgICAgICAgICAgICBFUlJPUlMgPSBrO1xuXG4gICAgICAgICAgICAgICAgaWYgKCAhKCBrID0gbi5pc0ludCgpICkgfHwgbi5sdChPTkUpICkge1xuXG4gICAgICAgICAgICAgICAgICAgIGlmIChFUlJPUlMpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIHJhaXNlKCAyMixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgJ21heCBkZW5vbWluYXRvciAnICsgKCBrID8gJ291dCBvZiByYW5nZScgOiAnbm90IGFuIGludGVnZXInICksIG1kICk7XG4gICAgICAgICAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgICAgICAgICAvLyBFUlJPUlMgaXMgZmFsc2U6XG4gICAgICAgICAgICAgICAgICAgIC8vIElmIG1kIGlzIGEgZmluaXRlIG5vbi1pbnRlZ2VyID49IDEsIHJvdW5kIGl0IHRvIGFuIGludGVnZXIgYW5kIHVzZSBpdC5cbiAgICAgICAgICAgICAgICAgICAgbWQgPSAhayAmJiBuLmMgJiYgcm91bmQoIG4sIG4uZSArIDEsIDEgKS5ndGUoT05FKSA/IG4gOiBudWxsO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgaWYgKCAheGMgKSByZXR1cm4geC50b1N0cmluZygpO1xuICAgICAgICAgICAgcyA9IGNvZWZmVG9TdHJpbmcoeGMpO1xuXG4gICAgICAgICAgICAvLyBEZXRlcm1pbmUgaW5pdGlhbCBkZW5vbWluYXRvci5cbiAgICAgICAgICAgIC8vIGQgaXMgYSBwb3dlciBvZiAxMCBhbmQgdGhlIG1pbmltdW0gbWF4IGRlbm9taW5hdG9yIHRoYXQgc3BlY2lmaWVzIHRoZSB2YWx1ZSBleGFjdGx5LlxuICAgICAgICAgICAgZSA9IGQuZSA9IHMubGVuZ3RoIC0geC5lIC0gMTtcbiAgICAgICAgICAgIGQuY1swXSA9IFBPV1NfVEVOWyAoIGV4cCA9IGUgJSBMT0dfQkFTRSApIDwgMCA/IExPR19CQVNFICsgZXhwIDogZXhwIF07XG4gICAgICAgICAgICBtZCA9ICFtZCB8fCBuLmNtcChkKSA+IDAgPyAoIGUgPiAwID8gZCA6IG4xICkgOiBuO1xuXG4gICAgICAgICAgICBleHAgPSBNQVhfRVhQO1xuICAgICAgICAgICAgTUFYX0VYUCA9IDEgLyAwO1xuICAgICAgICAgICAgbiA9IG5ldyBCaWdOdW1iZXIocyk7XG5cbiAgICAgICAgICAgIC8vIG4wID0gZDEgPSAwXG4gICAgICAgICAgICBuMC5jWzBdID0gMDtcblxuICAgICAgICAgICAgZm9yICggOyA7ICkgIHtcbiAgICAgICAgICAgICAgICBxID0gZGl2KCBuLCBkLCAwLCAxICk7XG4gICAgICAgICAgICAgICAgZDIgPSBkMC5wbHVzKCBxLnRpbWVzKGQxKSApO1xuICAgICAgICAgICAgICAgIGlmICggZDIuY21wKG1kKSA9PSAxICkgYnJlYWs7XG4gICAgICAgICAgICAgICAgZDAgPSBkMTtcbiAgICAgICAgICAgICAgICBkMSA9IGQyO1xuICAgICAgICAgICAgICAgIG4xID0gbjAucGx1cyggcS50aW1lcyggZDIgPSBuMSApICk7XG4gICAgICAgICAgICAgICAgbjAgPSBkMjtcbiAgICAgICAgICAgICAgICBkID0gbi5taW51cyggcS50aW1lcyggZDIgPSBkICkgKTtcbiAgICAgICAgICAgICAgICBuID0gZDI7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGQyID0gZGl2KCBtZC5taW51cyhkMCksIGQxLCAwLCAxICk7XG4gICAgICAgICAgICBuMCA9IG4wLnBsdXMoIGQyLnRpbWVzKG4xKSApO1xuICAgICAgICAgICAgZDAgPSBkMC5wbHVzKCBkMi50aW1lcyhkMSkgKTtcbiAgICAgICAgICAgIG4wLnMgPSBuMS5zID0geC5zO1xuICAgICAgICAgICAgZSAqPSAyO1xuXG4gICAgICAgICAgICAvLyBEZXRlcm1pbmUgd2hpY2ggZnJhY3Rpb24gaXMgY2xvc2VyIHRvIHgsIG4wL2QwIG9yIG4xL2QxXG4gICAgICAgICAgICBhcnIgPSBkaXYoIG4xLCBkMSwgZSwgUk9VTkRJTkdfTU9ERSApLm1pbnVzKHgpLmFicygpLmNtcChcbiAgICAgICAgICAgICAgICAgIGRpdiggbjAsIGQwLCBlLCBST1VORElOR19NT0RFICkubWludXMoeCkuYWJzKCkgKSA8IDFcbiAgICAgICAgICAgICAgICAgICAgPyBbIG4xLnRvU3RyaW5nKCksIGQxLnRvU3RyaW5nKCkgXVxuICAgICAgICAgICAgICAgICAgICA6IFsgbjAudG9TdHJpbmcoKSwgZDAudG9TdHJpbmcoKSBdO1xuXG4gICAgICAgICAgICBNQVhfRVhQID0gZXhwO1xuICAgICAgICAgICAgcmV0dXJuIGFycjtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqIFJldHVybiB0aGUgdmFsdWUgb2YgdGhpcyBCaWdOdW1iZXIgY29udmVydGVkIHRvIGEgbnVtYmVyIHByaW1pdGl2ZS5cbiAgICAgICAgICovXG4gICAgICAgIFAudG9OdW1iZXIgPSBmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB2YXIgeCA9IHRoaXM7XG5cbiAgICAgICAgICAgIC8vIEVuc3VyZSB6ZXJvIGhhcyBjb3JyZWN0IHNpZ24uXG4gICAgICAgICAgICByZXR1cm4gK3ggfHwgKCB4LnMgPyB4LnMgKiAwIDogTmFOICk7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0lOVEVHRVIsIE1BWF9TQUZFX0lOVEVHRVIsIDIzLCAnZXhwb25lbnQnICkgJiZcbiAgICAgICAgICAgICAgKCAhaXNGaW5pdGUobikgfHwgaSA+IE1BWF9TQUZFX0lOVEVHRVIgJiYgKCBuIC89IDAgKSB8fFxuICAgICAgICAgICAgICAgIHBhcnNlRmxvYXQobikgIT0gbiAmJiAhKCBuID0gTmFOICkgKSApIHtcbiAgICAgICAgICAgICAgICByZXR1cm4gbmV3IEJpZ051bWJlciggTWF0aC5wb3coICt4LCBuICkgKTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gVHJ1bmNhdGluZyBlYWNoIGNvZWZmaWNpZW50IGFycmF5IHRvIGEgbGVuZ3RoIG9mIGsgYWZ0ZXIgZWFjaCBtdWx0aXBsaWNhdGlvbiBlcXVhdGVzXG4gICAgICAgICAgICAvLyB0byB0cnVuY2F0aW5nIHNpZ25pZmljYW50IGRpZ2l0cyB0byBQT1dfUFJFQ0lTSU9OICsgWzI4LCA0MV0sIGkuZS4gdGhlcmUgd2lsbCBiZSBhXG4gICAgICAgICAgICAvLyBtaW5pbXVtIG9mIDI4IGd1YXJkIGRpZ2l0cyByZXRhaW5lZC4gKFVzaW5nICsgMS41IHdvdWxkIGdpdmUgWzksIDIxXSBndWFyZCBkaWdpdHMuKVxuICAgICAgICAgICAgayA9IFBPV19QUkVDSVNJT04gPyBtYXRoY2VpbCggUE9XX1BSRUNJU0lPTiAvIExPR19CQVNFICsgMiApIDogMDtcbiAgICAgICAgICAgIHkgPSBuZXcgQmlnTnVtYmVyKE9ORSk7XG5cbiAgICAgICAgICAgIGZvciAoIDsgOyApIHtcblxuICAgICAgICAgICAgICAgIGlmICggaSAlIDIgKSB7XG4gICAgICAgICAgICAgICAgICAgIHkgPSB5LnRpbWVzKHgpO1xuICAgICAgICAgICAgICAgICAgICBpZiAoICF5LmMgKSBicmVhaztcbiAgICAgICAgICAgICAgICAgICAgaWYgKCBrICYmIHkuYy5sZW5ndGggPiBrICkgeS5jLmxlbmd0aCA9IGs7XG4gICAgICAgICAgICAgICAgfVxuXG4gICAgICAgICAgICAgICAgaSA9IG1hdGhmbG9vciggaSAvIDIgKTtcbiAgICAgICAgICAgICAgICBpZiAoICFpICkgYnJlYWs7XG5cbiAgICAgICAgICAgICAgICB4ID0geC50aW1lcyh4KTtcbiAgICAgICAgICAgICAgICBpZiAoIGsgJiYgeC5jICYmIHguYy5sZW5ndGggPiBrICkgeC5jLmxlbmd0aCA9IGs7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIGlmICggbiA8IDAgKSB5ID0gT05FLmRpdih5KTtcbiAgICAgICAgICAgIHJldHVybiBrID8gcm91bmQoIHksIFBPV19QUkVDSVNJT04sIFJPVU5ESU5HX01PREUgKSA6IHk7XG4gICAgICAgIH07XG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiBSZXR1cm4gYSBzdHJpbmcgcmVwcmVzZW50aW5nIHRoZSB2YWx1ZSBvZiB0aGlzIEJpZ051bWJlciByb3VuZGVkIHRvIHNkIHNpZ25pZmljYW50IGRpZ2l0c1xuICAgICAgICAgKiB1c2luZyByb3VuZGluZyBtb2RlIHJtIG9yIFJPVU5ESU5HX01PREUuIElmIHNkIGlzIGxlc3MgdGhhbiB0aGUgbnVtYmVyIG9mIGRpZ2l0c1xuICAgICAgICAgKiBuZWNlc3NhcnkgdG8gcmVwcmVzZW50IHRoZSBpbnRlZ2VyIHBhcnQgb2YgdGhlIHZhbHVlIGluIGZpeGVkLXBvaW50IG5vdGF0aW9uLCB0aGVuIHVzZVxuICAgICAgICAgKiBleHBvbmVudGlhbCBub3RhdGlvbi5cbiAgICAgICAgICpcbiAgICAgICAgICogW3NkXSB7bnVtYmVyfSBTaWduaWZpY2FudCBkaWdpdHMuIEludGVnZXIsIDEgdG8gTUFYIGluY2x1c2l2ZS5cbiAgICAgICAgICogW3JtXSB7bnVtYmVyfSBSb3VuZGluZyBtb2RlLiBJbnRlZ2VyLCAwIH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19FWFBfUE9TLCBvciBhIG5lZ2F0aXZlIGV4cG9uZW50IGVxdWFsIHRvIG9yIGxlc3MgdGhhblxuICAgICAgICAgKiBUT19FWFBfTkVHLCByZXR1cm4gZXhwb25lbnRpYWwgbm90YXRpb24uXG4gICAgICAgICAqXG4gICAgICAgICAqIFtiXSB7bnVtYmVyfSBJbnRlZ2VyLCAyIHRvIDY0IGluY2x1c2l2ZS5cbiAgICAgICAgICpcbiAgICAgICAgICogJ3RvU3RyaW5nKCkgYmFzZSBub3QgYW4gaW50ZWdlcjoge2J9J1xuICAgICAgICAgKiAndG9TdHJpbmcoKSBiYXNlIG91dCBvZiByYW5nZToge2J9J1xuICAgICAgICAgKi9cbiAgICAgICAgUC50b1N0cmluZyA9IGZ1bmN0aW9uIChiKSB7XG4gICAgICAgICAgICB2YXIgc3RyLFxuICAgICAgICAgICAgICAgIG4gPSB0aGlzLFxuICAgICAgICAgICAgICAgIHMgPSBuLnMsXG4gICAgICAgICAgICAgICAgZSA9IG4uZTtcblxuICAgICAgICAgICAgLy8gSW5maW5pdHkgb3IgTmFOP1xuICAgICAgICAgICAgaWYgKCBlID09PSBudWxsICkge1xuXG4gICAgICAgICAgICAgICAgaWYgKHMpIHtcbiAgICAgICAgICAgICAgICAgICAgc3RyID0gJ0luZmluaXR5JztcbiAgICAgICAgICAgICAgICAgICAgaWYgKCBzIDwgMCApIHN0ciA9ICctJyArIHN0cjtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICBzdHIgPSAnTmFOJztcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHN0ciA9IGNvZWZmVG9TdHJpbmcoIG4uYyApO1xuXG4gICAgICAgICAgICAgICAgaWYgKCBiID09IG51bGwgfHwgIWlzVmFsaWRJbnQoIGIsIDIsIDY0LCAyNSwgJ2Jhc2UnICkgKSB7XG4gICAgICAgICAgICAgICAgICAgIHN0ciA9IGUgPD0gVE9fRVhQX05FRyB8fCBlID49IFRPX0VYUF9QT1NcbiAgICAgICAgICAgICAgICAgICAgICA/IHRvRXhwb25lbnRpYWwoIHN0ciwgZSApXG4gICAgICAgICAgICAgICAgICAgICAgOiB0b0ZpeGVkUG9pbnQoIHN0ciwgZSApO1xuICAgICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgICAgIHN0ciA9IGNvbnZlcnRCYXNlKCB0b0ZpeGVkUG9pbnQoIHN0ciwgZSApLCBiIHwgMCwgMTAsIHMgKTtcbiAgICAgICAgICAgICAgICB9XG5cbiAgICAgICAgICAgICAgICBpZiAoIHMgPCAwICYmIG4uY1swXSApIHN0ciA9ICctJyArIHN0cjtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgcmV0dXJuIHN0cjtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8qXG4gICAgICAgICAqIFJldHVybiBhIG5ldyBCaWdOdW1iZXIgd2hvc2UgdmFsdWUgaXMgdGhlIHZhbHVlIG9mIHRoaXMgQmlnTnVtYmVyIHRydW5jYXRlZCB0byBhIHdob2xlXG4gICAgICAgICAqIG51bWJlci5cbiAgICAgICAgICovXG4gICAgICAgIFAudHJ1bmNhdGVkID0gUC50cnVuYyA9IGZ1bmN0aW9uICgpIHtcbiAgICAgICAgICAgIHJldHVybiByb3VuZCggbmV3IEJpZ051bWJlcih0aGlzKSwgdGhpcy5lICsgMSwgMSApO1xuICAgICAgICB9O1xuXG5cblxuICAgICAgICAvKlxuICAgICAgICAgKiBSZXR1cm4gYXMgdG9TdHJpbmcsIGJ1dCBkbyBub3QgYWNjZXB0IGEgYmFzZSBhcmd1bWVudC5cbiAgICAgICAgICovXG4gICAgICAgIFAudmFsdWVPZiA9IFAudG9KU09OID0gZnVuY3Rpb24gKCkge1xuICAgICAgICAgICAgcmV0dXJuIHRoaXMudG9TdHJpbmcoKTtcbiAgICAgICAgfTtcblxuXG4gICAgICAgIC8vIEFsaWFzZXMg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AgICAgICB6ID0gTE9HX0JBU0UgLSBzLmxlbmd0aDtcbiAgICAgICAgICAgIGZvciAoIDsgei0tOyBzID0gJzAnICsgcyApO1xuICAgICAgICAgICAgciArPSBzO1xuICAgICAgICB9XG5cbiAgICAgICAgLy8gRGV0ZXJtaW5lIHRyYWlsaW5nIHplcm9zLlxuICAgICAgICBmb3IgKCBqID0gci5sZW5ndGg7IHIuY2hhckNvZGVBdCgtLWopID09PSA0ODsgKTtcbiAgICAgICAgcmV0dXJuIHIuc2xpY2UoIDAsIGogKyAxIHx8IDEgKTtcbiAgICB9XG5cblxuICAgIC8vIENvbXBhcmUgdGhlIHZhbHVlIG9mIEJpZ051bWJlcnMgeCBhbmQgeS5cbiAgICBmdW5jdGlvbiBjb21wYXJlKCB4LCB5ICkge1xuICAgICAgICB2YXIgYSwgYixcbiAgICAgICAgICAgIHhjID0geC5jLFxuICAgICAgICAgICAgeWMgPSB5LmMsXG4gICAgICAgICAgICBpID0geC5zLFxuICAgICAgICAgICAgaiA9IHkucyxcbiAgICAgICAgICAgIGsgPSB4LmUsXG4gICAgICAgICAgICBsID0geS5lO1xuXG4gICAgICAgIC8vIEVpdGhlciBOYU4/XG4gICAgICAgIGlmICggIWkgfHwgIWogKSByZXR1cm4gbnVsbDtcblxuICAgICAgICBhID0geGMgJiYgIXhjWzBdO1xuICAgICAgICBiID0geWMgJiYgIXljWzBdO1xuXG4gICAgICAgIC8vIEVpdGhlciB6ZXJvP1xuICAgICAgICBpZiAoIGEgfHwgYiApIHJldHVybiBhID8gYiA/IDAgOiAtaiA6IGk7XG5cbiAgICAgICAgLy8gU2lnbnMgZGlmZmVyP1xuICAgICAgICBpZiAoIGkgIT0gaiApIHJldHVybiBpO1xuXG4gICAgICAgIGEgPSBpIDwgMDtcbiAgICAgICAgYiA9IGsgPT0gbDtcblxuICAgICAgICAvLyBFaXRoZXIgSW5maW5pdHk/XG4gICAgICAgIGlmICggIXhjIHx8ICF5YyApIHJldHVybiBiID8gMCA6ICF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4gICAgICogQ29udmVydCBzdHJpbmcgb2YgYmFzZUluIHRvIGFuIGFycmF5IG9mIG51bWJlcnMgb2YgYmFzZU91dC5cbiAgICAgKiBFZy4gY29udmVydEJhc2UoJzI1NScsIDEwLCAxNikgcmV0dXJucyBbMTUsIDE1XS5cbiAgICAgKiBFZy4gY29udmVydEJhc2UoJ2ZmJywgMTYsIDEwKSByZXR1cm5zIFsyLCA1LCA1XS5cbiAgICAgKi9cbiAgICBmdW5jdGlvbiB0b0Jhc2VPdXQoIHN0ciwgYmFzZUluLCBiYXNlT3V0ICkge1xuICAgICAgICB2YXIgaixcbiAgICAgICAgICAgIGFyciA9IFswXSxcbiAgICAgICAgICAgIGFyckwsXG4gICAgICAgICAgICBpID0gMCxcbiAgICAgICAgICAgIGxlbiA9IHN0ci5sZW5ndGg7XG5cbiAgICAgICAgZm9yICggOyBpIDwgbGVuOyApIHtcbiAgICAgICAgICAgIGZvciAoIGFyckwgPSBhcnIubGVuZ3RoOyBhcnJMLS07IGFyclthcnJMXSAqPSBiYXNlSW4gKTtcbiAgICAgICAgICAgIGFyclsgaiA9IDAgXSArPSBBTFBIQUJFVC5pbmRleE9mKCBzdHIuY2hhckF0KCBpKysgKSApO1xuXG4gICAgICAgICAgICBmb3IgKCA7IGogPCBhcnIubGVuZ3RoOyBqKysgKSB7XG5cbiAgICAgICAgICAgICAgICBpZiAoIGFycltqXSA+IGJhc2VPdXQgLSAxICkge1xuICAgICAgICAgICAgICAgICAgICBpZiAoIGFycltqICsgMV0gPT0gbnVsbCApIGFycltqICsgMV0gPSAwO1xuICAgICAgICAgICAgICAgICAgICBhcnJbaiArIDFdICs9IGFycltqXSAvIGJhc2VPdXQgfCAwO1xuICAgICAgICAgICAgICAgICAgICBhcnJbal0gJT0gYmFzZU91dDtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gYXJyLnJldmVyc2UoKTtcbiAgICB9XG5cblxuICAgIGZ1bmN0aW9uIHRvRXhwb25lbnRpYWwoIHN0ciwgZSApIHtcbiAgICAgICAgcmV0dXJuICggc3RyLmxlbmd0aCA+IDEgPyBzdHIuY2hhckF0KDApICsgJy4nICsgc3RyLnNsaWNlKDEpIDogc3RyICkgK1xuICAgICAgICAgICggZSA8IDAgPyAnZScgOiAnZSsnICkgKyBlO1xuICAgIH1cblxuXG4gICAgZnVuY3Rpb24gdG9GaXhlZFBvaW50KCBzdHIsIGUgKSB7XG4gICAgICAgIHZhciBsZW4sIHo7XG5cbiAgICAgICAgLy8gTmVnYXRpdmUgZXhwb25lbnQ/XG4gICAgICAgIGlmICggZSA8IDAgKSB7XG5cbiAgICAgICAgICAgIC8vIFByZXBlbmQgemVyb3MuXG4gICAgICAgICAgICBmb3IgKCB6ID0gJzAuJzsgKytlOyB6ICs9ICcwJyApO1xuICAgICAgICAgICAgc3RyID0geiArIHN0cjtcblxuICAgICAgICAvLyBQb3NpdGl2ZSBleHBvbmVudFxuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgbGVuID0gc3RyLmxlbmd0aDtcblxuICAgICAgICAgICAgLy8gQXBwZW5kIHplcm9zLlxuICAgICAgICAgICAgaWYgKCArK2UgPiBsZW4gKSB7XG4gICAgICAgICAgICAgICAgZm9yICggeiA9ICcwJywgZSAtPSBsZW47IC0tZTsgeiArPSAnMCcgKTtcbiAgICAgICAgICAgICAgICBzdHIgKz0gejtcbiAgICAgICAgICAgIH0gZWxzZSBpZiAoIGUgPCBsZW4gKSB7XG4gICAgICAgICAgICAgICAgc3RyID0gc3RyLnNsaWNlKCAwLCBlICkgKyAnLicgKyBzdHIuc2xpY2UoZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICByZXR1cm4gc3RyO1xuICAgIH1cblxuXG4gICAgZnVuY3Rpb24gdHJ1bmNhdGUobikge1xuICAgICAgICBuID0gcGFyc2VGbG9hdChuKTtcbiAgICAgICAgcmV0dXJuIG4gPCAwID8gb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2ViMy5ldGguc2VuZElCQU5UcmFuc2FjdGlvbiA9IHJlcXVpcmUoJy4vbGliL3dlYjMvdHJhbnNmZXInKTtcblxuLy8gZG9udCBvdmVycmlkZSBnbG9iYWwgdmFyaWFibGVcbmlmICh0eXBlb2Ygd2luZG93ICE9PSAndW5kZWZpbmVkJyAmJiB0eXBlb2Ygd2luZG93LndlYjMgPT09ICd1bmRlZmluZWQnKSB7XG4gICAgd2luZG93LndlYjMgPSB3ZWIzO1xufVxuXG5tb2R1bGUuZXhwb3J0cyA9IHdlYjM7XG5cbiJdfQ== +//# sourceMappingURL=web3.js.map diff --git a/dist/web3.js.map b/dist/web3.js.map new file mode 100644 index 000000000..75d356186 --- /dev/null +++ b/dist/web3.js.map @@ -0,0 +1,85 @@ +{ + "version": 3, + "sources": [ + "node_modules/browserify/node_modules/browser-pack/_prelude.js", + "lib/solidity/coder.js", + "lib/solidity/formatters.js", + "lib/solidity/param.js", + "lib/utils/browser-xhr.js", + "lib/utils/config.js", + "lib/utils/sha3.js", + "lib/utils/utils.js", + "lib/version.json", + "lib/web3.js", + "lib/web3/batch.js", + "lib/web3/contract.js", + "lib/web3/db.js", + "lib/web3/errors.js", + "lib/web3/eth.js", + "lib/web3/event.js", + "lib/web3/filter.js", + "lib/web3/formatters.js", + "lib/web3/function.js", + "lib/web3/httpprovider.js", + "lib/web3/icap.js", + "lib/web3/jsonrpc.js", + "lib/web3/method.js", + "lib/web3/namereg.js", + "lib/web3/net.js", + "lib/web3/property.js", + "lib/web3/qtsync.js", + "lib/web3/requestmanager.js", + "lib/web3/shh.js", + "lib/web3/transfer.js", + "lib/web3/watches.js", + "node_modules/browserify/lib/_empty.js", + "node_modules/crypto-js/core.js", + "node_modules/crypto-js/sha3.js", + "node_modules/crypto-js/x64-core.js", + "bignumber.js", + "index.js" + ], + "names": [], + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClfA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACruBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3nFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "file": "generated.js", + "sourceRoot": "", + "sourcesContent": [ + "(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o.\n*/\n/** \n * @file coder.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar BigNumber = require('bignumber.js');\nvar utils = require('../utils/utils');\nvar f = require('./formatters');\nvar SolidityParam = require('./param');\n\n/**\n * Should be used to check if a type is an array type\n *\n * @method isArrayType\n * @param {String} type\n * @return {Bool} true is the type is an array, otherwise false\n */\nvar isArrayType = function (type) {\n return type.slice(-2) === '[]';\n};\n\n/**\n * SolidityType prototype is used to encode/decode solidity params of certain type\n */\nvar SolidityType = function (config) {\n this._name = config.name;\n this._match = config.match;\n this._mode = config.mode;\n this._inputFormatter = config.inputFormatter;\n this._outputFormatter = config.outputFormatter;\n};\n\n/**\n * Should be used to determine if this SolidityType do match given type\n *\n * @method isType\n * @param {String} name\n * @return {Bool} true if type match this SolidityType, otherwise false\n */\nSolidityType.prototype.isType = function (name) {\n if (this._match === 'strict') {\n return this._name === name || (name.indexOf(this._name) === 0 && name.slice(this._name.length) === '[]');\n } else if (this._match === 'prefix') {\n // TODO better type detection!\n return name.indexOf(this._name) === 0;\n }\n};\n\n/**\n * Should be used to transform plain param to SolidityParam object\n *\n * @method formatInput\n * @param {Object} param - plain object, or an array of objects\n * @param {Bool} arrayType - true if a param should be encoded as an array\n * @return {SolidityParam} encoded param wrapped in SolidityParam object \n */\nSolidityType.prototype.formatInput = function (param, arrayType) {\n if (utils.isArray(param) && arrayType) { // TODO: should fail if this two are not the same\n var self = this;\n return param.map(function (p) {\n return self._inputFormatter(p);\n }).reduce(function (acc, current) {\n return acc.combine(current);\n }, f.formatInputInt(param.length)).withOffset(32);\n } \n return this._inputFormatter(param);\n};\n\n/**\n * Should be used to transoform SolidityParam to plain param\n *\n * @method formatOutput\n * @param {SolidityParam} byteArray\n * @param {Bool} arrayType - true if a param should be decoded as an array\n * @return {Object} plain decoded param\n */\nSolidityType.prototype.formatOutput = function (param, arrayType) {\n if (arrayType) {\n // let's assume, that we solidity will never return long arrays :P \n var result = [];\n var length = new BigNumber(param.dynamicPart().slice(0, 64), 16);\n for (var i = 0; i < length * 64; i += 64) {\n result.push(this._outputFormatter(new SolidityParam(param.dynamicPart().substr(i + 64, 64))));\n }\n return result;\n }\n return this._outputFormatter(param);\n};\n\n/**\n * Should be used to slice single param from bytes\n *\n * @method sliceParam\n * @param {String} bytes\n * @param {Number} index of param to slice\n * @param {String} type\n * @returns {SolidityParam} param\n */\nSolidityType.prototype.sliceParam = function (bytes, index, type) {\n if (this._mode === 'bytes') {\n return SolidityParam.decodeBytes(bytes, index);\n } else if (isArrayType(type)) {\n return SolidityParam.decodeArray(bytes, index);\n }\n return SolidityParam.decodeParam(bytes, index);\n};\n\n/**\n * SolidityCoder prototype should be used to encode/decode solidity params of any type\n */\nvar SolidityCoder = function (types) {\n this._types = types;\n};\n\n/**\n * This method should be used to transform type to SolidityType\n *\n * @method _requireType\n * @param {String} type\n * @returns {SolidityType} \n * @throws {Error} throws if no matching type is found\n */\nSolidityCoder.prototype._requireType = function (type) {\n var solidityType = this._types.filter(function (t) {\n return t.isType(type);\n })[0];\n\n if (!solidityType) {\n throw Error('invalid solidity type!: ' + type);\n }\n\n return solidityType;\n};\n\n/**\n * Should be used to transform plain param of given type to SolidityParam\n *\n * @method _formatInput\n * @param {String} type of param\n * @param {Object} plain param\n * @return {SolidityParam}\n */\nSolidityCoder.prototype._formatInput = function (type, param) {\n return this._requireType(type).formatInput(param, isArrayType(type));\n};\n\n/**\n * Should be used to encode plain param\n *\n * @method encodeParam\n * @param {String} type\n * @param {Object} plain param\n * @return {String} encoded plain param\n */\nSolidityCoder.prototype.encodeParam = function (type, param) {\n return this._formatInput(type, param).encode();\n};\n\n/**\n * Should be used to encode list of params\n *\n * @method encodeParams\n * @param {Array} types\n * @param {Array} params\n * @return {String} encoded list of params\n */\nSolidityCoder.prototype.encodeParams = function (types, params) {\n var self = this;\n var solidityParams = types.map(function (type, index) {\n return self._formatInput(type, params[index]);\n });\n\n return SolidityParam.encodeList(solidityParams);\n};\n\n/**\n * Should be used to decode bytes to plain param\n *\n * @method decodeParam\n * @param {String} type\n * @param {String} bytes\n * @return {Object} plain param\n */\nSolidityCoder.prototype.decodeParam = function (type, bytes) {\n return this.decodeParams([type], bytes)[0];\n};\n\n/**\n * Should be used to decode list of params\n *\n * @method decodeParam\n * @param {Array} types\n * @param {String} bytes\n * @return {Array} array of plain params\n */\nSolidityCoder.prototype.decodeParams = function (types, bytes) {\n var self = this;\n return types.map(function (type, index) {\n var solidityType = self._requireType(type);\n var p = solidityType.sliceParam(bytes, index, type);\n return solidityType.formatOutput(p, isArrayType(type));\n });\n};\n\nvar coder = new SolidityCoder([\n new SolidityType({\n name: 'address',\n match: 'strict',\n mode: 'value',\n inputFormatter: f.formatInputInt,\n outputFormatter: f.formatOutputAddress\n }),\n new SolidityType({\n name: 'bool',\n match: 'strict',\n mode: 'value',\n inputFormatter: f.formatInputBool,\n outputFormatter: f.formatOutputBool\n }),\n new SolidityType({\n name: 'int',\n match: 'prefix',\n mode: 'value',\n inputFormatter: f.formatInputInt,\n outputFormatter: f.formatOutputInt,\n }),\n new SolidityType({\n name: 'uint',\n match: 'prefix',\n mode: 'value',\n inputFormatter: f.formatInputInt,\n outputFormatter: f.formatOutputUInt\n }),\n new SolidityType({\n name: 'bytes',\n match: 'strict',\n mode: 'bytes',\n inputFormatter: f.formatInputDynamicBytes,\n outputFormatter: f.formatOutputDynamicBytes\n }),\n new SolidityType({\n name: 'bytes',\n match: 'prefix',\n mode: 'value',\n inputFormatter: f.formatInputBytes,\n outputFormatter: f.formatOutputBytes\n }),\n new SolidityType({\n name: 'real',\n match: 'prefix',\n mode: 'value',\n inputFormatter: f.formatInputReal,\n outputFormatter: f.formatOutputReal\n }),\n new SolidityType({\n name: 'ureal',\n match: 'prefix',\n mode: 'value',\n inputFormatter: f.formatInputReal,\n outputFormatter: f.formatOutputUReal\n })\n]);\n\nmodule.exports = coder;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file formatters.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar BigNumber = require('bignumber.js');\nvar utils = require('../utils/utils');\nvar c = require('../utils/config');\nvar SolidityParam = require('./param');\n\n\n/**\n * Formats input value to byte representation of int\n * If value is negative, return it's two's complement\n * If the value is floating point, round it down\n *\n * @method formatInputInt\n * @param {String|Number|BigNumber} value that needs to be formatted\n * @returns {SolidityParam}\n */\nvar formatInputInt = function (value) {\n var padding = c.ETH_PADDING * 2;\n BigNumber.config(c.ETH_BIGNUMBER_ROUNDING_MODE);\n var result = utils.padLeft(utils.toTwosComplement(value).round().toString(16), padding);\n return new SolidityParam(result);\n};\n\n/**\n * Formats input value to byte representation of string\n *\n * @method formatInputBytes\n * @param {String}\n * @returns {SolidityParam}\n */\nvar formatInputBytes = function (value) {\n var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);\n return new SolidityParam(result);\n};\n\n/**\n * Formats input value to byte representation of string\n *\n * @method formatInputDynamicBytes\n * @param {String}\n * @returns {SolidityParam}\n */\nvar formatInputDynamicBytes = function (value) {\n var result = utils.fromAscii(value, c.ETH_PADDING).substr(2);\n return new SolidityParam(formatInputInt(value.length).value + result, 32);\n};\n\n/**\n * Formats input value to byte representation of bool\n *\n * @method formatInputBool\n * @param {Boolean}\n * @returns {SolidityParam}\n */\nvar formatInputBool = function (value) {\n var result = '000000000000000000000000000000000000000000000000000000000000000' + (value ? '1' : '0');\n return new SolidityParam(result);\n};\n\n/**\n * Formats input value to byte representation of real\n * Values are multiplied by 2^m and encoded as integers\n *\n * @method formatInputReal\n * @param {String|Number|BigNumber}\n * @returns {SolidityParam}\n */\nvar formatInputReal = function (value) {\n return formatInputInt(new BigNumber(value).times(new BigNumber(2).pow(128)));\n};\n\n/**\n * Check if input value is negative\n *\n * @method signedIsNegative\n * @param {String} value is hex format\n * @returns {Boolean} true if it is negative, otherwise false\n */\nvar signedIsNegative = function (value) {\n return (new BigNumber(value.substr(0, 1), 16).toString(2).substr(0, 1)) === '1';\n};\n\n/**\n * Formats right-aligned output bytes to int\n *\n * @method formatOutputInt\n * @param {SolidityParam} param\n * @returns {BigNumber} right-aligned output bytes formatted to big number\n */\nvar formatOutputInt = function (param) {\n var value = param.staticPart() || \"0\";\n\n // check if it's negative number\n // it it is, return two's complement\n if (signedIsNegative(value)) {\n return new BigNumber(value, 16).minus(new BigNumber('ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16)).minus(1);\n }\n return new BigNumber(value, 16);\n};\n\n/**\n * Formats right-aligned output bytes to uint\n *\n * @method formatOutputUInt\n * @param {SolidityParam}\n * @returns {BigNumeber} right-aligned output bytes formatted to uint\n */\nvar formatOutputUInt = function (param) {\n var value = param.staticPart() || \"0\";\n return new BigNumber(value, 16);\n};\n\n/**\n * Formats right-aligned output bytes to real\n *\n * @method formatOutputReal\n * @param {SolidityParam}\n * @returns {BigNumber} input bytes formatted to real\n */\nvar formatOutputReal = function (param) {\n return formatOutputInt(param).dividedBy(new BigNumber(2).pow(128)); \n};\n\n/**\n * Formats right-aligned output bytes to ureal\n *\n * @method formatOutputUReal\n * @param {SolidityParam}\n * @returns {BigNumber} input bytes formatted to ureal\n */\nvar formatOutputUReal = function (param) {\n return formatOutputUInt(param).dividedBy(new BigNumber(2).pow(128)); \n};\n\n/**\n * Should be used to format output bool\n *\n * @method formatOutputBool\n * @param {SolidityParam}\n * @returns {Boolean} right-aligned input bytes formatted to bool\n */\nvar formatOutputBool = function (param) {\n return param.staticPart() === '0000000000000000000000000000000000000000000000000000000000000001' ? true : false;\n};\n\n/**\n * Should be used to format output string\n *\n * @method formatOutputBytes\n * @param {SolidityParam} left-aligned hex representation of string\n * @returns {String} ascii string\n */\nvar formatOutputBytes = function (param) {\n // length might also be important!\n return utils.toAscii(param.staticPart());\n};\n\n/**\n * Should be used to format output string\n *\n * @method formatOutputDynamicBytes\n * @param {SolidityParam} left-aligned hex representation of string\n * @returns {String} ascii string\n */\nvar formatOutputDynamicBytes = function (param) {\n // length might also be important!\n return utils.toAscii(param.dynamicPart().slice(64));\n};\n\n/**\n * Should be used to format output address\n *\n * @method formatOutputAddress\n * @param {SolidityParam} right-aligned input bytes\n * @returns {String} address\n */\nvar formatOutputAddress = function (param) {\n var value = param.staticPart();\n return \"0x\" + value.slice(value.length - 40, value.length);\n};\n\nmodule.exports = {\n formatInputInt: formatInputInt,\n formatInputBytes: formatInputBytes,\n formatInputDynamicBytes: formatInputDynamicBytes,\n formatInputBool: formatInputBool,\n formatInputReal: formatInputReal,\n formatOutputInt: formatOutputInt,\n formatOutputUInt: formatOutputUInt,\n formatOutputReal: formatOutputReal,\n formatOutputUReal: formatOutputUReal,\n formatOutputBool: formatOutputBool,\n formatOutputBytes: formatOutputBytes,\n formatOutputDynamicBytes: formatOutputDynamicBytes,\n formatOutputAddress: formatOutputAddress\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file param.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar utils = require('../utils/utils');\n\n/**\n * SolidityParam object prototype.\n * Should be used when encoding, decoding solidity bytes\n */\nvar SolidityParam = function (value, offset) {\n this.value = value || '';\n this.offset = offset; // offset in bytes\n};\n\n/**\n * This method should be used to get length of params's dynamic part\n * \n * @method dynamicPartLength\n * @returns {Number} length of dynamic part (in bytes)\n */\nSolidityParam.prototype.dynamicPartLength = function () {\n return this.dynamicPart().length / 2;\n};\n\n/**\n * This method should be used to create copy of solidity param with different offset\n *\n * @method withOffset\n * @param {Number} offset length in bytes\n * @returns {SolidityParam} new solidity param with applied offset\n */\nSolidityParam.prototype.withOffset = function (offset) {\n return new SolidityParam(this.value, offset);\n};\n\n/**\n * This method should be used to combine solidity params together\n * eg. when appending an array\n *\n * @method combine\n * @param {SolidityParam} param with which we should combine\n * @param {SolidityParam} result of combination\n */\nSolidityParam.prototype.combine = function (param) {\n return new SolidityParam(this.value + param.value); \n};\n\n/**\n * This method should be called to check if param has dynamic size.\n * If it has, it returns true, otherwise false\n *\n * @method isDynamic\n * @returns {Boolean}\n */\nSolidityParam.prototype.isDynamic = function () {\n return this.value.length > 64 || this.offset !== undefined;\n};\n\n/**\n * This method should be called to transform offset to bytes\n *\n * @method offsetAsBytes\n * @returns {String} bytes representation of offset\n */\nSolidityParam.prototype.offsetAsBytes = function () {\n return !this.isDynamic() ? '' : utils.padLeft(utils.toTwosComplement(this.offset).toString(16), 64);\n};\n\n/**\n * This method should be called to get static part of param\n *\n * @method staticPart\n * @returns {String} offset if it is a dynamic param, otherwise value\n */\nSolidityParam.prototype.staticPart = function () {\n if (!this.isDynamic()) {\n return this.value; \n } \n return this.offsetAsBytes();\n};\n\n/**\n * This method should be called to get dynamic part of param\n *\n * @method dynamicPart\n * @returns {String} returns a value if it is a dynamic param, otherwise empty string\n */\nSolidityParam.prototype.dynamicPart = function () {\n return this.isDynamic() ? this.value : '';\n};\n\n/**\n * This method should be called to encode param\n *\n * @method encode\n * @returns {String}\n */\nSolidityParam.prototype.encode = function () {\n return this.staticPart() + this.dynamicPart();\n};\n\n/**\n * This method should be called to encode array of params\n *\n * @method encodeList\n * @param {Array[SolidityParam]} params\n * @returns {String}\n */\nSolidityParam.encodeList = function (params) {\n \n // updating offsets\n var totalOffset = params.length * 32;\n var offsetParams = params.map(function (param) {\n if (!param.isDynamic()) {\n return param;\n }\n var offset = totalOffset;\n totalOffset += param.dynamicPartLength();\n return param.withOffset(offset);\n });\n\n // encode everything!\n return offsetParams.reduce(function (result, param) {\n return result + param.dynamicPart();\n }, offsetParams.reduce(function (result, param) {\n return result + param.staticPart();\n }, ''));\n};\n\n/**\n * This method should be used to decode plain (static) solidity param at given index\n *\n * @method decodeParam\n * @param {String} bytes\n * @param {Number} index\n * @returns {SolidityParam}\n */\nSolidityParam.decodeParam = function (bytes, index) {\n index = index || 0;\n return new SolidityParam(bytes.substr(index * 64, 64)); \n};\n\n/**\n * This method should be called to get offset value from bytes at given index\n *\n * @method getOffset\n * @param {String} bytes\n * @param {Number} index\n * @returns {Number} offset as number\n */\nvar getOffset = function (bytes, index) {\n // we can do this cause offset is rather small\n return parseInt('0x' + bytes.substr(index * 64, 64));\n};\n\n/**\n * This method should be called to decode solidity bytes param at given index\n *\n * @method decodeBytes\n * @param {String} bytes\n * @param {Number} index\n * @returns {SolidityParam}\n */\nSolidityParam.decodeBytes = function (bytes, index) {\n index = index || 0;\n //TODO add support for strings longer than 32 bytes\n //var length = parseInt('0x' + bytes.substr(offset * 64, 64));\n\n var offset = getOffset(bytes, index);\n\n // 2 * , cause we also parse length\n return new SolidityParam(bytes.substr(offset * 2, 2 * 64), 0);\n};\n\n/**\n * This method should be used to decode solidity array at given index\n *\n * @method decodeArray\n * @param {String} bytes\n * @param {Number} index\n * @returns {SolidityParam}\n */\nSolidityParam.decodeArray = function (bytes, index) {\n index = index || 0;\n var offset = getOffset(bytes, index);\n var length = parseInt('0x' + bytes.substr(offset * 2, 64));\n return new SolidityParam(bytes.substr(offset * 2, (length + 1) * 64), 0);\n};\n\nmodule.exports = SolidityParam;\n\n", + "'use strict';\n\n// go env doesn't have and need XMLHttpRequest\nif (typeof XMLHttpRequest === 'undefined') {\n exports.XMLHttpRequest = {};\n} else {\n exports.XMLHttpRequest = XMLHttpRequest; // jshint ignore:line\n}\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file config.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\n/**\n * Utils\n * \n * @module utils\n */\n\n/**\n * Utility functions\n * \n * @class [utils] config\n * @constructor\n */\n\n/// required to define ETH_BIGNUMBER_ROUNDING_MODE\nvar BigNumber = require('bignumber.js');\n\nvar ETH_UNITS = [\n 'wei',\n 'kwei',\n 'Mwei',\n 'Gwei',\n 'szabo',\n 'finney',\n 'femtoether',\n 'picoether',\n 'nanoether',\n 'microether',\n 'milliether',\n 'nano',\n 'micro',\n 'milli',\n 'ether',\n 'grand',\n 'Mether',\n 'Gether',\n 'Tether',\n 'Pether',\n 'Eether',\n 'Zether',\n 'Yether',\n 'Nether',\n 'Dether',\n 'Vether',\n 'Uether'\n];\n\nmodule.exports = {\n ETH_PADDING: 32,\n ETH_SIGNATURE_LENGTH: 4,\n ETH_UNITS: ETH_UNITS,\n ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN },\n ETH_POLLING_TIMEOUT: 1000/2,\n defaultBlock: 'latest',\n defaultAccount: undefined\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file sha3.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar utils = require('./utils');\nvar sha3 = require('crypto-js/sha3');\n\nmodule.exports = function (str, isNew) {\n if (str.substr(0, 2) === '0x' && !isNew) {\n console.warn('requirement of using web3.fromAscii before sha3 is deprecated');\n console.warn('new usage: \\'web3.sha3(\"hello\")\\'');\n console.warn('see https://github.com/ethereum/web3.js/pull/205');\n console.warn('if you need to hash hex value, you can do \\'sha3(\"0xfff\", true)\\'');\n str = utils.toAscii(str);\n }\n\n return sha3(str, {\n outputLength: 256\n }).toString();\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file utils.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\n/**\n * Utils\n * \n * @module utils\n */\n\n/**\n * Utility functions\n * \n * @class [utils] utils\n * @constructor\n */\n\nvar BigNumber = require('bignumber.js');\n\nvar unitMap = {\n 'wei': '1',\n 'kwei': '1000',\n 'ada': '1000',\n 'femtoether': '1000',\n 'mwei': '1000000',\n 'babbage': '1000000',\n 'picoether': '1000000',\n 'gwei': '1000000000',\n 'shannon': '1000000000',\n 'nanoether': '1000000000',\n 'nano': '1000000000',\n 'szabo': '1000000000000',\n 'microether': '1000000000000',\n 'micro': '1000000000000',\n 'finney': '1000000000000000',\n 'milliether': '1000000000000000',\n 'milli': '1000000000000000',\n 'ether': '1000000000000000000',\n 'kether': '1000000000000000000000',\n 'grand': '1000000000000000000000',\n 'einstein': '1000000000000000000000',\n 'mether': '1000000000000000000000000',\n 'gether': '1000000000000000000000000000',\n 'tether': '1000000000000000000000000000000'\n};\n\n/**\n * Should be called to pad string to expected length\n *\n * @method padLeft\n * @param {String} string to be padded\n * @param {Number} characters that result string should have\n * @param {String} sign, by default 0\n * @returns {String} right aligned string\n */\nvar padLeft = function (string, chars, sign) {\n return new Array(chars - string.length + 1).join(sign ? sign : \"0\") + string;\n};\n\n/** \n * Should be called to get sting from it's hex representation\n *\n * @method toAscii\n * @param {String} string in hex\n * @returns {String} ascii string representation of hex value\n */\nvar toAscii = function(hex) {\n// Find termination\n var str = \"\";\n var i = 0, l = hex.length;\n if (hex.substring(0, 2) === '0x') {\n i = 2;\n }\n for (; i < l; i+=2) {\n var code = parseInt(hex.substr(i, 2), 16);\n if (code === 0) {\n break;\n }\n\n str += String.fromCharCode(code);\n }\n\n return str;\n};\n \n/**\n * Shold be called to get hex representation (prefixed by 0x) of ascii string \n *\n * @method toHexNative\n * @param {String} string\n * @returns {String} hex representation of input string\n */\nvar toHexNative = function(str) {\n var hex = \"\";\n for(var i = 0; i < str.length; i++) {\n var n = str.charCodeAt(i).toString(16);\n hex += n.length < 2 ? '0' + n : n;\n }\n\n return hex;\n};\n\n/**\n * Shold be called to get hex representation (prefixed by 0x) of ascii string \n *\n * @method fromAscii\n * @param {String} string\n * @param {Number} optional padding\n * @returns {String} hex representation of input string\n */\nvar fromAscii = function(str, pad) {\n pad = pad === undefined ? 0 : pad;\n var hex = toHexNative(str);\n while (hex.length < pad*2)\n hex += \"00\";\n return \"0x\" + hex;\n};\n\n/**\n * Should be used to create full function/event name from json abi\n *\n * @method transformToFullName\n * @param {Object} json-abi\n * @return {String} full fnction/event name\n */\nvar transformToFullName = function (json) {\n if (json.name.indexOf('(') !== -1) {\n return json.name;\n }\n\n var typeName = json.inputs.map(function(i){return i.type; }).join();\n return json.name + '(' + typeName + ')';\n};\n\n/**\n * Should be called to get display name of contract function\n * \n * @method extractDisplayName\n * @param {String} name of function/event\n * @returns {String} display name for function/event eg. multiply(uint256) -> multiply\n */\nvar extractDisplayName = function (name) {\n var length = name.indexOf('('); \n return length !== -1 ? name.substr(0, length) : name;\n};\n\n/// @returns overloaded part of function/event name\nvar extractTypeName = function (name) {\n /// TODO: make it invulnerable\n var length = name.indexOf('(');\n return length !== -1 ? name.substr(length + 1, name.length - 1 - (length + 1)).replace(' ', '') : \"\";\n};\n\n/**\n * Converts value to it's decimal representation in string\n *\n * @method toDecimal\n * @param {String|Number|BigNumber}\n * @return {String}\n */\nvar toDecimal = function (value) {\n return toBigNumber(value).toNumber();\n};\n\n/**\n * Converts value to it's hex representation\n *\n * @method fromDecimal\n * @param {String|Number|BigNumber}\n * @return {String}\n */\nvar fromDecimal = function (value) {\n var number = toBigNumber(value);\n var result = number.toString(16);\n\n return number.lessThan(0) ? '-0x' + result.substr(1) : '0x' + result;\n};\n\n/**\n * Auto converts any given value into it's hex representation.\n *\n * And even stringifys objects before.\n *\n * @method toHex\n * @param {String|Number|BigNumber|Object}\n * @return {String}\n */\nvar toHex = function (val) {\n /*jshint maxcomplexity:7 */\n\n if (isBoolean(val))\n return fromDecimal(+val);\n\n if (isBigNumber(val))\n return fromDecimal(val);\n\n if (isObject(val))\n return fromAscii(JSON.stringify(val));\n\n // if its a negative number, pass it through fromDecimal\n if (isString(val)) {\n if (val.indexOf('-0x') === 0)\n return fromDecimal(val);\n else if (!isFinite(val))\n return fromAscii(val);\n }\n\n return fromDecimal(val);\n};\n\n/**\n * Returns value of unit in Wei\n *\n * @method getValueOfUnit\n * @param {String} unit the unit to convert to, default ether\n * @returns {BigNumber} value of the unit (in Wei)\n * @throws error if the unit is not correct:w\n */\nvar getValueOfUnit = function (unit) {\n unit = unit ? unit.toLowerCase() : 'ether';\n var unitValue = unitMap[unit];\n if (unitValue === undefined) {\n throw new Error('This unit doesn\\'t exists, please use the one of the following units' + JSON.stringify(unitMap, null, 2));\n }\n return new BigNumber(unitValue, 10);\n};\n\n/**\n * Takes a number of wei and converts it to any other ether unit.\n *\n * Possible units are:\n * SI Short SI Full Effigy Other\n * - kwei femtoether ada\n * - mwei picoether babbage\n * - gwei nanoether shannon nano\n * - -- microether szabo micro\n * - -- milliether finney milli\n * - ether -- --\n * - kether einstein grand \n * - mether\n * - gether\n * - tether\n *\n * @method fromWei\n * @param {Number|String} number can be a number, number string or a HEX of a decimal\n * @param {String} unit the unit to convert to, default ether\n * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number\n*/\nvar fromWei = function(number, unit) {\n var returnValue = toBigNumber(number).dividedBy(getValueOfUnit(unit));\n\n return isBigNumber(number) ? returnValue : returnValue.toString(10); \n};\n\n/**\n * Takes a number of a unit and converts it to wei.\n *\n * Possible units are:\n * SI Short SI Full Effigy Other\n * - kwei femtoether ada\n * - mwei picoether babbage \n * - gwei nanoether shannon nano\n * - -- microether szabo micro\n * - -- milliether finney milli\n * - ether -- --\n * - kether einstein grand \n * - mether\n * - gether\n * - tether\n *\n * @method toWei\n * @param {Number|String|BigNumber} number can be a number, number string or a HEX of a decimal\n * @param {String} unit the unit to convert from, default ether\n * @return {String|Object} When given a BigNumber object it returns one as well, otherwise a number\n*/\nvar toWei = function(number, unit) {\n var returnValue = toBigNumber(number).times(getValueOfUnit(unit));\n\n return isBigNumber(number) ? returnValue : returnValue.toString(10); \n};\n\n/**\n * Takes an input and transforms it into an bignumber\n *\n * @method toBigNumber\n * @param {Number|String|BigNumber} a number, string, HEX string or BigNumber\n * @return {BigNumber} BigNumber\n*/\nvar toBigNumber = function(number) {\n /*jshint maxcomplexity:5 */\n number = number || 0;\n if (isBigNumber(number))\n return number;\n\n if (isString(number) && (number.indexOf('0x') === 0 || number.indexOf('-0x') === 0)) {\n return new BigNumber(number.replace('0x',''), 16);\n }\n \n return new BigNumber(number.toString(10), 10);\n};\n\n/**\n * Takes and input transforms it into bignumber and if it is negative value, into two's complement\n *\n * @method toTwosComplement\n * @param {Number|String|BigNumber}\n * @return {BigNumber}\n */\nvar toTwosComplement = function (number) {\n var bigNumber = toBigNumber(number);\n if (bigNumber.lessThan(0)) {\n return new BigNumber(\"ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\", 16).plus(bigNumber).plus(1);\n }\n return bigNumber;\n};\n\n/**\n * Checks if the given string is strictly an address\n *\n * @method isStrictAddress\n * @param {String} address the given HEX adress\n * @return {Boolean}\n*/\nvar isStrictAddress = function (address) {\n return /^0x[0-9a-f]{40}$/.test(address);\n};\n\n/**\n * Checks if the given string is an address\n *\n * @method isAddress\n * @param {String} address the given HEX adress\n * @return {Boolean}\n*/\nvar isAddress = function (address) {\n return /^(0x)?[0-9a-f]{40}$/.test(address);\n};\n\n/**\n * Transforms given string to valid 20 bytes-length addres with 0x prefix\n *\n * @method toAddress\n * @param {String} address\n * @return {String} formatted address\n */\nvar toAddress = function (address) {\n if (isStrictAddress(address)) {\n return address;\n }\n \n if (/^[0-9a-f]{40}$/.test(address)) {\n return '0x' + address;\n }\n\n return '0x' + padLeft(toHex(address).substr(2), 40);\n};\n\n\n/**\n * Returns true if object is BigNumber, otherwise false\n *\n * @method isBigNumber\n * @param {Object}\n * @return {Boolean} \n */\nvar isBigNumber = function (object) {\n return object instanceof BigNumber ||\n (object && object.constructor && object.constructor.name === 'BigNumber');\n};\n\n/**\n * Returns true if object is string, otherwise false\n * \n * @method isString\n * @param {Object}\n * @return {Boolean}\n */\nvar isString = function (object) {\n return typeof object === 'string' ||\n (object && object.constructor && object.constructor.name === 'String');\n};\n\n/**\n * Returns true if object is function, otherwise false\n *\n * @method isFunction\n * @param {Object}\n * @return {Boolean}\n */\nvar isFunction = function (object) {\n return typeof object === 'function';\n};\n\n/**\n * Returns true if object is Objet, otherwise false\n *\n * @method isObject\n * @param {Object}\n * @return {Boolean}\n */\nvar isObject = function (object) {\n return typeof object === 'object';\n};\n\n/**\n * Returns true if object is boolean, otherwise false\n *\n * @method isBoolean\n * @param {Object}\n * @return {Boolean}\n */\nvar isBoolean = function (object) {\n return typeof object === 'boolean';\n};\n\n/**\n * Returns true if object is array, otherwise false\n *\n * @method isArray\n * @param {Object}\n * @return {Boolean}\n */\nvar isArray = function (object) {\n return object instanceof Array; \n};\n\n/**\n * Returns true if given string is valid json object\n * \n * @method isJson\n * @param {String}\n * @return {Boolean}\n */\nvar isJson = function (str) {\n try {\n return !!JSON.parse(str);\n } catch (e) {\n return false;\n }\n};\n\n/**\n * This method should be called to check if string is valid ethereum IBAN number\n * Supports direct and indirect IBANs\n *\n * @method isIBAN\n * @param {String}\n * @return {Boolean}\n */\nvar isIBAN = function (iban) {\n return /^XE[0-9]{2}(ETH[0-9A-Z]{13}|[0-9A-Z]{30})$/.test(iban);\n};\n\nmodule.exports = {\n padLeft: padLeft,\n toHex: toHex,\n toDecimal: toDecimal,\n fromDecimal: fromDecimal,\n toAscii: toAscii,\n fromAscii: fromAscii,\n transformToFullName: transformToFullName,\n extractDisplayName: extractDisplayName,\n extractTypeName: extractTypeName,\n toWei: toWei,\n fromWei: fromWei,\n toBigNumber: toBigNumber,\n toTwosComplement: toTwosComplement,\n toAddress: toAddress,\n isBigNumber: isBigNumber,\n isStrictAddress: isStrictAddress,\n isAddress: isAddress,\n isFunction: isFunction,\n isString: isString,\n isObject: isObject,\n isBoolean: isBoolean,\n isArray: isArray,\n isJson: isJson,\n isIBAN: isIBAN\n};\n\n", + "module.exports={\n \"version\": \"0.6.0\"\n}\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file web3.js\n * @authors:\n * Jeffrey Wilcke \n * Marek Kotewicz \n * Marian Oancea \n * Fabian Vogelsteller \n * Gav Wood \n * @date 2014\n */\n\nvar version = require('./version.json');\nvar net = require('./web3/net');\nvar eth = require('./web3/eth');\nvar db = require('./web3/db');\nvar shh = require('./web3/shh');\nvar watches = require('./web3/watches');\nvar Filter = require('./web3/filter');\nvar utils = require('./utils/utils');\nvar formatters = require('./web3/formatters');\nvar RequestManager = require('./web3/requestmanager');\nvar c = require('./utils/config');\nvar Property = require('./web3/property');\nvar Batch = require('./web3/batch');\nvar sha3 = require('./utils/sha3');\n\nvar web3Properties = [\n new Property({\n name: 'version.client',\n getter: 'web3_clientVersion'\n }),\n new Property({\n name: 'version.network',\n getter: 'net_version',\n inputFormatter: utils.toDecimal\n }),\n new Property({\n name: 'version.ethereum',\n getter: 'eth_protocolVersion',\n inputFormatter: utils.toDecimal\n }),\n new Property({\n name: 'version.whisper',\n getter: 'shh_version',\n inputFormatter: utils.toDecimal\n })\n];\n\n/// creates methods in a given object based on method description on input\n/// setups api calls for these methods\nvar setupMethods = function (obj, methods) {\n methods.forEach(function (method) {\n method.attachToObject(obj);\n });\n};\n\n/// creates properties in a given object based on properties description on input\n/// setups api calls for these properties\nvar setupProperties = function (obj, properties) {\n properties.forEach(function (property) {\n property.attachToObject(obj);\n });\n};\n\n/// setups web3 object, and it's in-browser executed methods\nvar web3 = {};\nweb3.providers = {};\nweb3.version = {};\nweb3.version.api = version.version;\nweb3.eth = {};\n\n/*jshint maxparams:4 */\nweb3.eth.filter = function (fil, eventParams, options, formatter) {\n\n // if its event, treat it differently\n // TODO: simplify and remove\n if (fil._isEvent) {\n return fil(eventParams, options);\n }\n\n // output logs works for blockFilter and pendingTransaction filters?\n return new Filter(fil, watches.eth(), formatter || formatters.outputLogFormatter);\n};\n/*jshint maxparams:3 */\n\nweb3.shh = {};\nweb3.shh.filter = function (fil) {\n return new Filter(fil, watches.shh(), formatters.outputPostFormatter);\n};\nweb3.net = {};\nweb3.db = {};\nweb3.setProvider = function (provider) {\n RequestManager.getInstance().setProvider(provider);\n};\nweb3.reset = function () {\n RequestManager.getInstance().reset();\n c.defaultBlock = 'latest';\n c.defaultAccount = undefined;\n};\nweb3.toHex = utils.toHex;\nweb3.toAscii = utils.toAscii;\nweb3.fromAscii = utils.fromAscii;\nweb3.toDecimal = utils.toDecimal;\nweb3.fromDecimal = utils.fromDecimal;\nweb3.toBigNumber = utils.toBigNumber;\nweb3.toWei = utils.toWei;\nweb3.fromWei = utils.fromWei;\nweb3.isAddress = utils.isAddress;\nweb3.isIBAN = utils.isIBAN;\nweb3.sha3 = sha3;\nweb3.createBatch = function () {\n return new Batch();\n};\n\n// ADD defaultblock\nObject.defineProperty(web3.eth, 'defaultBlock', {\n get: function () {\n return c.defaultBlock;\n },\n set: function (val) {\n c.defaultBlock = val;\n return val;\n }\n});\n\nObject.defineProperty(web3.eth, 'defaultAccount', {\n get: function () {\n return c.defaultAccount;\n },\n set: function (val) {\n c.defaultAccount = val;\n return val;\n }\n});\n\n\n// EXTEND\nweb3._extend = function(extension){\n /*jshint maxcomplexity: 6 */\n\n if(extension.property && !web3[extension.property])\n web3[extension.property] = {};\n\n setupMethods(web3[extension.property] || web3, extension.methods || []);\n setupProperties(web3[extension.property] || web3, extension.properties || []);\n};\nweb3._extend.formatters = formatters;\nweb3._extend.utils = utils;\nweb3._extend.Method = require('./web3/method');\nweb3._extend.Property = require('./web3/property');\n\n\n/// setups all api methods\nsetupProperties(web3, web3Properties);\nsetupMethods(web3.net, net.methods);\nsetupProperties(web3.net, net.properties);\nsetupMethods(web3.eth, eth.methods);\nsetupProperties(web3.eth, eth.properties);\nsetupMethods(web3.db, db.methods);\nsetupMethods(web3.shh, shh.methods);\n\nmodule.exports = web3;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file batch.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar RequestManager = require('./requestmanager');\n\nvar Batch = function () {\n this.requests = [];\n};\n\n/**\n * Should be called to add create new request to batch request\n *\n * @method add\n * @param {Object} jsonrpc requet object\n */\nBatch.prototype.add = function (request) {\n this.requests.push(request);\n};\n\n/**\n * Should be called to execute batch request\n *\n * @method execute\n */\nBatch.prototype.execute = function () {\n var requests = this.requests;\n RequestManager.getInstance().sendBatch(requests, function (err, results) {\n results = results || [];\n requests.map(function (request, index) {\n return results[index] || {};\n }).map(function (result, index) {\n return requests[index].format ? requests[index].format(result.result) : result.result;\n }).forEach(function (result, index) {\n if (requests[index].callback) {\n requests[index].callback(err, result);\n }\n });\n }); \n};\n\nmodule.exports = Batch;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file contract.js\n * @author Marek Kotewicz \n * @date 2014\n */\n\nvar web3 = require('../web3'); \nvar utils = require('../utils/utils');\nvar coder = require('../solidity/coder');\nvar SolidityEvent = require('./event');\nvar SolidityFunction = require('./function');\n\n/**\n * Should be called to encode constructor params\n *\n * @method encodeConstructorParams\n * @param {Array} abi\n * @param {Array} constructor params\n */\nvar encodeConstructorParams = function (abi, params) {\n return abi.filter(function (json) {\n return json.type === 'constructor' && json.inputs.length === params.length;\n }).map(function (json) {\n return json.inputs.map(function (input) {\n return input.type;\n });\n }).map(function (types) {\n return coder.encodeParams(types, params);\n })[0] || '';\n};\n\n/**\n * Should be called to add functions to contract object\n *\n * @method addFunctionsToContract\n * @param {Contract} contract\n * @param {Array} abi\n */\nvar addFunctionsToContract = function (contract, abi) {\n abi.filter(function (json) {\n return json.type === 'function';\n }).map(function (json) {\n return new SolidityFunction(json, contract.address);\n }).forEach(function (f) {\n f.attachToContract(contract);\n });\n};\n\n/**\n * Should be called to add events to contract object\n *\n * @method addEventsToContract\n * @param {Contract} contract\n * @param {Array} abi\n */\nvar addEventsToContract = function (contract, abi) {\n abi.filter(function (json) {\n return json.type === 'event';\n }).map(function (json) {\n return new SolidityEvent(json, contract.address);\n }).forEach(function (e) {\n e.attachToContract(contract);\n });\n};\n\n/**\n * Should be called to create new ContractFactory\n *\n * @method contract\n * @param {Array} abi\n * @returns {ContractFactory} new contract factory\n */\nvar contract = function (abi) {\n return new ContractFactory(abi);\n};\n\n/**\n * Should be called to create new ContractFactory instance\n *\n * @method ContractFactory\n * @param {Array} abi\n */\nvar ContractFactory = function (abi) {\n this.abi = abi;\n};\n\n/**\n * Should be called to create new contract on a blockchain\n * \n * @method new\n * @param {Any} contract constructor param1 (optional)\n * @param {Any} contract constructor param2 (optional)\n * @param {Object} contract transaction object (required)\n * @param {Function} callback\n * @returns {Contract} returns contract if no callback was passed,\n * otherwise calls callback function (err, contract)\n */\nContractFactory.prototype.new = function () {\n // parse arguments\n var options = {}; // required!\n var callback;\n\n var args = Array.prototype.slice.call(arguments);\n if (utils.isFunction(args[args.length - 1])) {\n callback = args.pop();\n }\n\n var last = args[args.length - 1];\n if (utils.isObject(last) && !utils.isArray(last)) {\n options = args.pop();\n }\n\n // throw an error if there are no options\n\n var bytes = encodeConstructorParams(this.abi, args);\n options.data += bytes;\n\n if (!callback) {\n var address = web3.eth.sendTransaction(options);\n return this.at(address);\n }\n \n var self = this;\n web3.eth.sendTransaction(options, function (err, address) {\n if (err) {\n callback(err);\n }\n self.at(address, callback); \n }); \n};\n\n/**\n * Should be called to get access to existing contract on a blockchain\n *\n * @method at\n * @param {Address} contract address (required)\n * @param {Function} callback {optional)\n * @returns {Contract} returns contract if no callback was passed,\n * otherwise calls callback function (err, contract)\n */\nContractFactory.prototype.at = function (address, callback) {\n // TODO: address is required\n \n if (callback) {\n callback(null, new Contract(this.abi, address));\n } \n return new Contract(this.abi, address);\n};\n\n/**\n * Should be called to create new contract instance\n *\n * @method Contract\n * @param {Array} abi\n * @param {Address} contract address\n */\nvar Contract = function (abi, address) {\n this.address = address;\n addFunctionsToContract(this, abi);\n addEventsToContract(this, abi);\n};\n\nmodule.exports = contract;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file db.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Method = require('./method');\n\nvar putString = new Method({\n name: 'putString',\n call: 'db_putString',\n params: 3\n});\n\n\nvar getString = new Method({\n name: 'getString',\n call: 'db_getString',\n params: 2\n});\n\nvar putHex = new Method({\n name: 'putHex',\n call: 'db_putHex',\n params: 3\n});\n\nvar getHex = new Method({\n name: 'getHex',\n call: 'db_getHex',\n params: 2\n});\n\nvar methods = [\n putString, getString, putHex, getHex\n];\n\nmodule.exports = {\n methods: methods\n};\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file errors.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nmodule.exports = {\n InvalidNumberOfParams: function () {\n return new Error('Invalid number of input parameters');\n },\n InvalidConnection: function (host){\n return new Error('CONNECTION ERROR: Couldn\\'t connect to node '+ host +', is it running?');\n },\n InvalidProvider: function () {\n return new Error('Providor not set or invalid');\n },\n InvalidResponse: function (result){\n var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response';\n return new Error(message);\n }\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/**\n * @file eth.js\n * @author Marek Kotewicz \n * @author Fabian Vogelsteller \n * @date 2015\n */\n\n/**\n * Web3\n *\n * @module web3\n */\n\n/**\n * Eth methods and properties\n *\n * An example method object can look as follows:\n *\n * {\n * name: 'getBlock',\n * call: blockCall,\n * params: 2,\n * outputFormatter: formatters.outputBlockFormatter,\n * inputFormatter: [ // can be a formatter funciton or an array of functions. Where each item in the array will be used for one parameter\n * utils.toHex, // formats paramter 1\n * function(param){ return !!param; } // formats paramter 2\n * ]\n * },\n *\n * @class [web3] eth\n * @constructor\n */\n\n\"use strict\";\n\nvar formatters = require('./formatters');\nvar utils = require('../utils/utils');\nvar Method = require('./method');\nvar Property = require('./property');\n\nvar blockCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? \"eth_getBlockByHash\" : \"eth_getBlockByNumber\";\n};\n\nvar transactionFromBlockCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';\n};\n\nvar uncleCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';\n};\n\nvar getBlockTransactionCountCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber';\n};\n\nvar uncleCountCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber';\n};\n\n/// @returns an array of objects describing web3.eth api methods\n\nvar getBalance = new Method({\n name: 'getBalance',\n call: 'eth_getBalance',\n params: 2,\n inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],\n outputFormatter: formatters.outputBigNumberFormatter\n});\n\nvar getStorageAt = new Method({\n name: 'getStorageAt',\n call: 'eth_getStorageAt',\n params: 3,\n inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar getCode = new Method({\n name: 'getCode',\n call: 'eth_getCode',\n params: 2,\n inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar getBlock = new Method({\n name: 'getBlock',\n call: blockCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],\n outputFormatter: formatters.outputBlockFormatter\n});\n\nvar getUncle = new Method({\n name: 'getUncle',\n call: uncleCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],\n outputFormatter: formatters.outputBlockFormatter,\n\n});\n\nvar getCompilers = new Method({\n name: 'getCompilers',\n call: 'eth_getCompilers',\n params: 0\n});\n\nvar getBlockTransactionCount = new Method({\n name: 'getBlockTransactionCount',\n call: getBlockTransactionCountCall,\n params: 1,\n inputFormatter: [formatters.inputBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar getBlockUncleCount = new Method({\n name: 'getBlockUncleCount',\n call: uncleCountCall,\n params: 1,\n inputFormatter: [formatters.inputBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar getTransaction = new Method({\n name: 'getTransaction',\n call: 'eth_getTransactionByHash',\n params: 1,\n outputFormatter: formatters.outputTransactionFormatter\n});\n\nvar getTransactionFromBlock = new Method({\n name: 'getTransactionFromBlock',\n call: transactionFromBlockCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],\n outputFormatter: formatters.outputTransactionFormatter\n});\n\nvar getTransactionCount = new Method({\n name: 'getTransactionCount',\n call: 'eth_getTransactionCount',\n params: 2,\n inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar sendTransaction = new Method({\n name: 'sendTransaction',\n call: 'eth_sendTransaction',\n params: 1,\n inputFormatter: [formatters.inputTransactionFormatter]\n});\n\nvar call = new Method({\n name: 'call',\n call: 'eth_call',\n params: 2,\n inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar estimateGas = new Method({\n name: 'estimateGas',\n call: 'eth_estimateGas',\n params: 1,\n inputFormatter: [formatters.inputTransactionFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar compileSolidity = new Method({\n name: 'compile.solidity',\n call: 'eth_compileSolidity',\n params: 1\n});\n\nvar compileLLL = new Method({\n name: 'compile.lll',\n call: 'eth_compileLLL',\n params: 1\n});\n\nvar compileSerpent = new Method({\n name: 'compile.serpent',\n call: 'eth_compileSerpent',\n params: 1\n});\n\nvar submitWork = new Method({\n name: 'submitWork',\n call: 'eth_submitWork',\n params: 3\n});\n\nvar getWork = new Method({\n name: 'getWork',\n call: 'eth_getWork',\n params: 0\n});\n\nvar methods = [\n getBalance,\n getStorageAt,\n getCode,\n getBlock,\n getUncle,\n getCompilers,\n getBlockTransactionCount,\n getBlockUncleCount,\n getTransaction,\n getTransactionFromBlock,\n getTransactionCount,\n call,\n estimateGas,\n sendTransaction,\n compileSolidity,\n compileLLL,\n compileSerpent,\n submitWork,\n getWork\n];\n\n/// @returns an array of objects describing web3.eth api properties\n\n\n\nvar properties = [\n new Property({\n name: 'coinbase',\n getter: 'eth_coinbase'\n }),\n new Property({\n name: 'mining',\n getter: 'eth_mining'\n }),\n new Property({\n name: 'hashrate',\n getter: 'eth_hashrate',\n outputFormatter: utils.toDecimal\n }),\n new Property({\n name: 'gasPrice',\n getter: 'eth_gasPrice',\n outputFormatter: formatters.outputBigNumberFormatter\n }),\n new Property({\n name: 'accounts',\n getter: 'eth_accounts'\n }),\n new Property({\n name: 'blockNumber',\n getter: 'eth_blockNumber',\n outputFormatter: utils.toDecimal\n })\n];\n\nmodule.exports = {\n methods: methods,\n properties: properties\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file event.js\n * @author Marek Kotewicz \n * @date 2014\n */\n\nvar utils = require('../utils/utils');\nvar coder = require('../solidity/coder');\nvar web3 = require('../web3');\nvar formatters = require('./formatters');\nvar sha3 = require('../utils/sha3');\n\n/**\n * This prototype should be used to create event filters\n */\nvar SolidityEvent = function (json, address) {\n this._params = json.inputs;\n this._name = utils.transformToFullName(json);\n this._address = address;\n this._anonymous = json.anonymous;\n};\n\n/**\n * Should be used to get filtered param types\n *\n * @method types\n * @param {Bool} decide if returned typed should be indexed\n * @return {Array} array of types\n */\nSolidityEvent.prototype.types = function (indexed) {\n return this._params.filter(function (i) {\n return i.indexed === indexed;\n }).map(function (i) {\n return i.type;\n });\n};\n\n/**\n * Should be used to get event display name\n *\n * @method displayName\n * @return {String} event display name\n */\nSolidityEvent.prototype.displayName = function () {\n return utils.extractDisplayName(this._name);\n};\n\n/**\n * Should be used to get event type name\n *\n * @method typeName\n * @return {String} event type name\n */\nSolidityEvent.prototype.typeName = function () {\n return utils.extractTypeName(this._name);\n};\n\n/**\n * Should be used to get event signature\n *\n * @method signature\n * @return {String} event signature\n */\nSolidityEvent.prototype.signature = function () {\n return sha3(this._name);\n};\n\n/**\n * Should be used to encode indexed params and options to one final object\n * \n * @method encode\n * @param {Object} indexed\n * @param {Object} options\n * @return {Object} everything combined together and encoded\n */\nSolidityEvent.prototype.encode = function (indexed, options) {\n indexed = indexed || {};\n options = options || {};\n var result = {};\n\n ['fromBlock', 'toBlock'].filter(function (f) {\n return options[f] !== undefined;\n }).forEach(function (f) {\n result[f] = formatters.inputBlockNumberFormatter(options[f]);\n });\n\n result.topics = [];\n\n if (!this._anonymous) {\n result.address = this._address;\n result.topics.push('0x' + this.signature());\n }\n\n var indexedTopics = this._params.filter(function (i) {\n return i.indexed === true;\n }).map(function (i) {\n var value = indexed[i.name];\n if (value === undefined || value === null) {\n return null;\n }\n \n if (utils.isArray(value)) {\n return value.map(function (v) {\n return '0x' + coder.encodeParam(i.type, v);\n });\n }\n return '0x' + coder.encodeParam(i.type, value);\n });\n\n result.topics = result.topics.concat(indexedTopics);\n\n return result;\n};\n\n/**\n * Should be used to decode indexed params and options\n *\n * @method decode\n * @param {Object} data\n * @return {Object} result object with decoded indexed && not indexed params\n */\nSolidityEvent.prototype.decode = function (data) {\n \n data.data = data.data || '';\n data.topics = data.topics || [];\n\n var argTopics = this._anonymous ? data.topics : data.topics.slice(1);\n var indexedData = argTopics.map(function (topics) { return topics.slice(2); }).join(\"\");\n var indexedParams = coder.decodeParams(this.types(true), indexedData); \n\n var notIndexedData = data.data.slice(2);\n var notIndexedParams = coder.decodeParams(this.types(false), notIndexedData);\n \n var result = formatters.outputLogFormatter(data);\n result.event = this.displayName();\n result.address = data.address;\n\n result.args = this._params.reduce(function (acc, current) {\n acc[current.name] = current.indexed ? indexedParams.shift() : notIndexedParams.shift();\n return acc;\n }, {});\n\n delete result.data;\n delete result.topics;\n\n return result;\n};\n\n/**\n * Should be used to create new filter object from event\n *\n * @method execute\n * @param {Object} indexed\n * @param {Object} options\n * @return {Object} filter object\n */\nSolidityEvent.prototype.execute = function (indexed, options) {\n var o = this.encode(indexed, options);\n var formatter = this.decode.bind(this);\n return web3.eth.filter(o, undefined, undefined, formatter);\n};\n\n/**\n * Should be used to attach event to contract object\n *\n * @method attachToContract\n * @param {Contract}\n */\nSolidityEvent.prototype.attachToContract = function (contract) {\n var execute = this.execute.bind(this);\n var displayName = this.displayName();\n if (!contract[displayName]) {\n contract[displayName] = execute;\n }\n contract[displayName][this.typeName()] = this.execute.bind(this, contract);\n};\n\nmodule.exports = SolidityEvent;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file filter.js\n * @authors:\n * Jeffrey Wilcke \n * Marek Kotewicz \n * Marian Oancea \n * Fabian Vogelsteller \n * Gav Wood \n * @date 2014\n */\n\nvar RequestManager = require('./requestmanager');\nvar formatters = require('./formatters');\nvar utils = require('../utils/utils');\n\n/**\n* Converts a given topic to a hex string, but also allows null values.\n*\n* @param {Mixed} value\n* @return {String}\n*/\nvar toTopic = function(value){\n\n if(value === null || typeof value === 'undefined')\n return null;\n\n value = String(value);\n\n if(value.indexOf('0x') === 0)\n return value;\n else\n return utils.fromAscii(value);\n};\n\n/// This method should be called on options object, to verify deprecated properties && lazy load dynamic ones\n/// @param should be string or object\n/// @returns options string or object\nvar getOptions = function (options) {\n\n if (utils.isString(options)) {\n return options;\n } \n\n options = options || {};\n\n // make sure topics, get converted to hex\n options.topics = options.topics || [];\n options.topics = options.topics.map(function(topic){\n return (utils.isArray(topic)) ? topic.map(toTopic) : toTopic(topic);\n });\n\n // lazy load\n return {\n topics: options.topics,\n to: options.to,\n address: options.address,\n fromBlock: formatters.inputBlockNumberFormatter(options.fromBlock),\n toBlock: formatters.inputBlockNumberFormatter(options.toBlock) \n }; \n};\n\n/**\nAdds the callback and sets up the methods, to iterate over the results.\n\n@method getLogsAtStart\n@param {Object} self\n@param {funciton} \n*/\nvar getLogsAtStart = function(self, callback){\n // call getFilterLogs for the first watch callback start\n if (!utils.isString(self.options)) {\n self.get(function (err, messages) {\n // don't send all the responses to all the watches again... just to self one\n if (err) {\n callback(err);\n }\n\n messages.forEach(function (message) {\n callback(null, message);\n });\n });\n }\n};\n\n/**\nAdds the callback and sets up the methods, to iterate over the results.\n\n@method pollFilter\n@param {Object} self\n*/\nvar pollFilter = function(self) {\n\n var onMessage = function (error, messages) {\n if (error) {\n return self.callbacks.forEach(function (callback) {\n callback(error);\n });\n }\n\n messages.forEach(function (message) {\n message = self.formatter ? self.formatter(message) : message;\n self.callbacks.forEach(function (callback) {\n callback(null, message);\n });\n });\n };\n\n RequestManager.getInstance().startPolling({\n method: self.implementation.poll.call,\n params: [self.filterId],\n }, self.filterId, onMessage, self.stopWatching.bind(self));\n\n};\n\nvar Filter = function (options, methods, formatter) {\n var self = this;\n var implementation = {};\n methods.forEach(function (method) {\n method.attachToObject(implementation);\n });\n this.options = getOptions(options);\n this.implementation = implementation;\n this.callbacks = [];\n this.pollFilters = [];\n this.formatter = formatter;\n this.implementation.newFilter(this.options, function(error, id){\n if(error) {\n self.callbacks.forEach(function(callback){\n callback(error);\n });\n } else {\n self.filterId = id;\n // get filter logs at start\n self.callbacks.forEach(function(callback){\n getLogsAtStart(self, callback);\n });\n pollFilter(self);\n }\n });\n};\n\nFilter.prototype.watch = function (callback) {\n this.callbacks.push(callback);\n\n if(this.filterId) {\n getLogsAtStart(this, callback);\n pollFilter(this);\n }\n\n return this;\n};\n\nFilter.prototype.stopWatching = function () {\n RequestManager.getInstance().stopPolling(this.filterId);\n // remove filter async\n this.implementation.uninstallFilter(this.filterId, function(){});\n this.callbacks = [];\n};\n\nFilter.prototype.get = function (callback) {\n var self = this;\n if (utils.isFunction(callback)) {\n this.implementation.getLogs(this.filterId, function(err, res){\n if (err) {\n callback(err);\n } else {\n callback(null, res.map(function (log) {\n return self.formatter ? self.formatter(log) : log;\n }));\n }\n });\n } else {\n var logs = this.implementation.getLogs(this.filterId);\n return logs.map(function (log) {\n return self.formatter ? self.formatter(log) : log;\n });\n }\n\n return this;\n};\n\nmodule.exports = Filter;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file formatters.js\n * @author Marek Kotewicz \n * @author Fabian Vogelsteller \n * @date 2015\n */\n\nvar utils = require('../utils/utils');\nvar config = require('../utils/config');\n\n/**\n * Should the format output to a big number\n *\n * @method outputBigNumberFormatter\n * @param {String|Number|BigNumber}\n * @returns {BigNumber} object\n */\nvar outputBigNumberFormatter = function (number) {\n return utils.toBigNumber(number);\n};\n\nvar isPredefinedBlockNumber = function (blockNumber) {\n return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest';\n};\n\nvar inputDefaultBlockNumberFormatter = function (blockNumber) {\n if (blockNumber === undefined) {\n return config.defaultBlock;\n }\n return inputBlockNumberFormatter(blockNumber);\n};\n\nvar inputBlockNumberFormatter = function (blockNumber) {\n if (blockNumber === undefined) {\n return undefined;\n } else if (isPredefinedBlockNumber(blockNumber)) {\n return blockNumber;\n }\n return utils.toHex(blockNumber);\n};\n\n/**\n * Formats the input of a transaction and converts all values to HEX\n *\n * @method inputTransactionFormatter\n * @param {Object} transaction options\n * @returns object\n*/\nvar inputTransactionFormatter = function (options){\n\n options.from = options.from || config.defaultAccount;\n\n // make code -> data\n if (options.code) {\n options.data = options.code;\n delete options.code;\n }\n\n ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {\n return options[key] !== undefined;\n }).forEach(function(key){\n options[key] = utils.fromDecimal(options[key]);\n });\n\n return options; \n};\n\n/**\n * Formats the output of a transaction to its proper values\n * \n * @method outputTransactionFormatter\n * @param {Object} transaction\n * @returns {Object} transaction\n*/\nvar outputTransactionFormatter = function (tx){\n if(tx.blockNumber !== null)\n tx.blockNumber = utils.toDecimal(tx.blockNumber);\n if(tx.transactionIndex !== null)\n tx.transactionIndex = utils.toDecimal(tx.transactionIndex);\n tx.nonce = utils.toDecimal(tx.nonce);\n tx.gas = utils.toDecimal(tx.gas);\n tx.gasPrice = utils.toBigNumber(tx.gasPrice);\n tx.value = utils.toBigNumber(tx.value);\n return tx;\n};\n\n/**\n * Formats the output of a block to its proper values\n *\n * @method outputBlockFormatter\n * @param {Object} block object \n * @returns {Object} block object\n*/\nvar outputBlockFormatter = function(block) {\n\n // transform to number\n block.gasLimit = utils.toDecimal(block.gasLimit);\n block.gasUsed = utils.toDecimal(block.gasUsed);\n block.size = utils.toDecimal(block.size);\n block.timestamp = utils.toDecimal(block.timestamp);\n if(block.number !== null)\n block.number = utils.toDecimal(block.number);\n\n block.difficulty = utils.toBigNumber(block.difficulty);\n block.totalDifficulty = utils.toBigNumber(block.totalDifficulty);\n\n if (utils.isArray(block.transactions)) {\n block.transactions.forEach(function(item){\n if(!utils.isString(item))\n return outputTransactionFormatter(item);\n });\n }\n\n return block;\n};\n\n/**\n * Formats the output of a log\n * \n * @method outputLogFormatter\n * @param {Object} log object\n * @returns {Object} log\n*/\nvar outputLogFormatter = function(log) {\n if(log.blockNumber !== null)\n log.blockNumber = utils.toDecimal(log.blockNumber);\n if(log.transactionIndex !== null)\n log.transactionIndex = utils.toDecimal(log.transactionIndex);\n if(log.logIndex !== null)\n log.logIndex = utils.toDecimal(log.logIndex);\n\n return log;\n};\n\n/**\n * Formats the input of a whisper post and converts all values to HEX\n *\n * @method inputPostFormatter\n * @param {Object} transaction object\n * @returns {Object}\n*/\nvar inputPostFormatter = function(post) {\n\n post.payload = utils.toHex(post.payload);\n post.ttl = utils.fromDecimal(post.ttl);\n post.workToProve = utils.fromDecimal(post.workToProve);\n post.priority = utils.fromDecimal(post.priority);\n\n // fallback\n if (!utils.isArray(post.topics)) {\n post.topics = post.topics ? [post.topics] : [];\n }\n\n // format the following options\n post.topics = post.topics.map(function(topic){\n return utils.fromAscii(topic);\n });\n\n return post; \n};\n\n/**\n * Formats the output of a received post message\n *\n * @method outputPostFormatter\n * @param {Object}\n * @returns {Object}\n */\nvar outputPostFormatter = function(post){\n\n post.expiry = utils.toDecimal(post.expiry);\n post.sent = utils.toDecimal(post.sent);\n post.ttl = utils.toDecimal(post.ttl);\n post.workProved = utils.toDecimal(post.workProved);\n post.payloadRaw = post.payload;\n post.payload = utils.toAscii(post.payload);\n\n if (utils.isJson(post.payload)) {\n post.payload = JSON.parse(post.payload);\n }\n\n // format the following options\n if (!post.topics) {\n post.topics = [];\n }\n post.topics = post.topics.map(function(topic){\n return utils.toAscii(topic);\n });\n\n return post;\n};\n\nmodule.exports = {\n inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,\n inputBlockNumberFormatter: inputBlockNumberFormatter,\n inputTransactionFormatter: inputTransactionFormatter,\n inputPostFormatter: inputPostFormatter,\n outputBigNumberFormatter: outputBigNumberFormatter,\n outputTransactionFormatter: outputTransactionFormatter,\n outputBlockFormatter: outputBlockFormatter,\n outputLogFormatter: outputLogFormatter,\n outputPostFormatter: outputPostFormatter\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/**\n * @file function.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar web3 = require('../web3');\nvar coder = require('../solidity/coder');\nvar utils = require('../utils/utils');\nvar formatters = require('./formatters');\nvar sha3 = require('../utils/sha3');\n\n/**\n * This prototype should be used to call/sendTransaction to solidity functions\n */\nvar SolidityFunction = function (json, address) {\n this._inputTypes = json.inputs.map(function (i) {\n return i.type;\n });\n this._outputTypes = json.outputs.map(function (i) {\n return i.type;\n });\n this._constant = json.constant;\n this._name = utils.transformToFullName(json);\n this._address = address;\n};\n\nSolidityFunction.prototype.extractCallback = function (args) {\n if (utils.isFunction(args[args.length - 1])) {\n return args.pop(); // modify the args array!\n }\n};\n\nSolidityFunction.prototype.extractDefaultBlock = function (args) {\n if (args.length > this._inputTypes.length && !utils.isObject(args[args.length -1])) {\n return formatters.inputDefaultBlockNumberFormatter(args.pop()); // modify the args array!\n }\n};\n\n/**\n * Should be used to create payload from arguments\n *\n * @method toPayload\n * @param {Array} solidity function params\n * @param {Object} optional payload options\n */\nSolidityFunction.prototype.toPayload = function (args) {\n var options = {};\n if (args.length > this._inputTypes.length && utils.isObject(args[args.length -1])) {\n options = args[args.length - 1];\n }\n options.to = this._address;\n options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args);\n return options;\n};\n\n/**\n * Should be used to get function signature\n *\n * @method signature\n * @return {String} function signature\n */\nSolidityFunction.prototype.signature = function () {\n return sha3(this._name).slice(0, 8);\n};\n\n\nSolidityFunction.prototype.unpackOutput = function (output) {\n if (!output) {\n return;\n }\n\n output = output.length >= 2 ? output.slice(2) : output;\n var result = coder.decodeParams(this._outputTypes, output);\n return result.length === 1 ? result[0] : result;\n};\n\n/**\n * Calls a contract function.\n *\n * @method call\n * @param {...Object} Contract function arguments\n * @param {function} If the last argument is a function, the contract function\n * call will be asynchronous, and the callback will be passed the\n * error and result.\n * @return {String} output bytes\n */\nSolidityFunction.prototype.call = function () {\n var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });\n var callback = this.extractCallback(args);\n var defaultBlock = this.extractDefaultBlock(args);\n var payload = this.toPayload(args);\n\n\n if (!callback) {\n var output = web3.eth.call(payload, defaultBlock);\n return this.unpackOutput(output);\n } \n \n var self = this;\n web3.eth.call(payload, defaultBlock, function (error, output) {\n callback(error, self.unpackOutput(output));\n });\n};\n\n/**\n * Should be used to sendTransaction to solidity function\n *\n * @method sendTransaction\n * @param {Object} options\n */\nSolidityFunction.prototype.sendTransaction = function () {\n var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; });\n var callback = this.extractCallback(args);\n var payload = this.toPayload(args);\n\n if (!callback) {\n return web3.eth.sendTransaction(payload);\n }\n\n web3.eth.sendTransaction(payload, callback);\n};\n\n/**\n * Should be used to estimateGas of solidity function\n *\n * @method estimateGas\n * @param {Object} options\n */\nSolidityFunction.prototype.estimateGas = function () {\n var args = Array.prototype.slice.call(arguments);\n var callback = this.extractCallback(args);\n var payload = this.toPayload(args);\n\n if (!callback) {\n return web3.eth.estimateGas(payload);\n }\n\n web3.eth.estimateGas(payload, callback);\n};\n\n/**\n * Should be used to get function display name\n *\n * @method displayName\n * @return {String} display name of the function\n */\nSolidityFunction.prototype.displayName = function () {\n return utils.extractDisplayName(this._name);\n};\n\n/**\n * Should be used to get function type name\n *\n * @method typeName\n * @return {String} type name of the function\n */\nSolidityFunction.prototype.typeName = function () {\n return utils.extractTypeName(this._name);\n};\n\n/**\n * Should be called to get rpc requests from solidity function\n *\n * @method request\n * @returns {Object}\n */\nSolidityFunction.prototype.request = function () {\n var args = Array.prototype.slice.call(arguments);\n var callback = this.extractCallback(args);\n var payload = this.toPayload(args);\n var format = this.unpackOutput.bind(this);\n \n return {\n callback: callback,\n payload: payload, \n format: format\n };\n};\n\n/**\n * Should be called to execute function\n *\n * @method execute\n */\nSolidityFunction.prototype.execute = function () {\n var transaction = !this._constant;\n\n // send transaction\n if (transaction) {\n return this.sendTransaction.apply(this, Array.prototype.slice.call(arguments));\n }\n\n // call\n return this.call.apply(this, Array.prototype.slice.call(arguments));\n};\n\n/**\n * Should be called to attach function to contract\n *\n * @method attachToContract\n * @param {Contract}\n */\nSolidityFunction.prototype.attachToContract = function (contract) {\n var execute = this.execute.bind(this);\n execute.request = this.request.bind(this);\n execute.call = this.call.bind(this);\n execute.sendTransaction = this.sendTransaction.bind(this);\n execute.estimateGas = this.estimateGas.bind(this);\n var displayName = this.displayName();\n if (!contract[displayName]) {\n contract[displayName] = execute;\n }\n contract[displayName][this.typeName()] = execute; // circular!!!!\n};\n\nmodule.exports = SolidityFunction;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file httpprovider.js\n * @authors:\n * Marek Kotewicz \n * Marian Oancea \n * Fabian Vogelsteller \n * @date 2014\n */\n\n\"use strict\";\n\nvar XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest; // jshint ignore:line\nvar errors = require('./errors');\n\nvar HttpProvider = function (host) {\n this.host = host || 'http://localhost:8545';\n};\n\nHttpProvider.prototype.send = function (payload) {\n var request = new XMLHttpRequest();\n\n request.open('POST', this.host, false);\n request.setRequestHeader('Content-type','application/json');\n \n try {\n request.send(JSON.stringify(payload));\n } catch(error) {\n throw errors.InvalidConnection(this.host);\n }\n\n\n // check request.status\n // TODO: throw an error here! it cannot silently fail!!!\n //if (request.status !== 200) {\n //return;\n //}\n\n var result = request.responseText;\n\n try {\n result = JSON.parse(result);\n } catch(e) {\n throw errors.InvalidResponse(result); \n }\n\n return result;\n};\n\nHttpProvider.prototype.sendAsync = function (payload, callback) {\n var request = new XMLHttpRequest();\n request.onreadystatechange = function() {\n if (request.readyState === 4) {\n var result = request.responseText;\n var error = null;\n\n try {\n result = JSON.parse(result);\n } catch(e) {\n error = errors.InvalidResponse(result); \n }\n\n callback(error, result);\n }\n };\n\n request.open('POST', this.host, true);\n request.setRequestHeader('Content-type','application/json');\n \n try {\n request.send(JSON.stringify(payload));\n } catch(error) {\n callback(errors.InvalidConnection(this.host));\n }\n};\n\nmodule.exports = HttpProvider;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file icap.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar utils = require('../utils/utils');\n\n/**\n * This prototype should be used to extract necessary information from iban address\n *\n * @param {String} iban\n */\nvar ICAP = function (iban) {\n this._iban = iban;\n};\n\n/**\n * Should be called to check if icap is correct\n *\n * @method isValid\n * @returns {Boolean} true if it is, otherwise false\n */\nICAP.prototype.isValid = function () {\n return utils.isIBAN(this._iban);\n};\n\n/**\n * Should be called to check if iban number is direct\n *\n * @method isDirect\n * @returns {Boolean} true if it is, otherwise false\n */\nICAP.prototype.isDirect = function () {\n return this._iban.length === 34;\n};\n\n/**\n * Should be called to check if iban number if indirect\n *\n * @method isIndirect\n * @returns {Boolean} true if it is, otherwise false\n */\nICAP.prototype.isIndirect = function () {\n return this._iban.length === 20;\n};\n\n/**\n * Should be called to get iban checksum\n * Uses the mod-97-10 checksumming protocol (ISO/IEC 7064:2003)\n *\n * @method checksum\n * @returns {String} checksum\n */\nICAP.prototype.checksum = function () {\n return this._iban.substr(2, 2);\n};\n\n/**\n * Should be called to get institution identifier\n * eg. XREG\n *\n * @method institution\n * @returns {String} institution identifier\n */\nICAP.prototype.institution = function () {\n return this.isIndirect() ? this._iban.substr(7, 4) : '';\n};\n\n/**\n * Should be called to get client identifier within institution\n * eg. GAVOFYORK\n *\n * @method client\n * @returns {String} client identifier\n */\nICAP.prototype.client = function () {\n return this.isIndirect() ? this._iban.substr(11) : '';\n};\n\n/**\n * Should be called to get client direct address\n *\n * @method address\n * @returns {String} client direct address\n */\nICAP.prototype.address = function () {\n return this.isDirect() ? this._iban.substr(4) : '';\n};\n\nmodule.exports = ICAP;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file jsonrpc.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Jsonrpc = function () {\n // singleton pattern\n if (arguments.callee._singletonInstance) {\n return arguments.callee._singletonInstance;\n }\n arguments.callee._singletonInstance = this;\n\n this.messageId = 1;\n};\n\n/**\n * @return {Jsonrpc} singleton\n */\nJsonrpc.getInstance = function () {\n var instance = new Jsonrpc();\n return instance;\n};\n\n/**\n * Should be called to valid json create payload object\n *\n * @method toPayload\n * @param {Function} method of jsonrpc call, required\n * @param {Array} params, an array of method params, optional\n * @returns {Object} valid jsonrpc payload object\n */\nJsonrpc.prototype.toPayload = function (method, params) {\n if (!method)\n console.error('jsonrpc method should be specified!');\n\n return {\n jsonrpc: '2.0',\n method: method,\n params: params || [],\n id: this.messageId++\n };\n};\n\n/**\n * Should be called to check if jsonrpc response is valid\n *\n * @method isValidResponse\n * @param {Object}\n * @returns {Boolean} true if response is valid, otherwise false\n */\nJsonrpc.prototype.isValidResponse = function (response) {\n return !!response &&\n !response.error &&\n response.jsonrpc === '2.0' &&\n typeof response.id === 'number' &&\n response.result !== undefined; // only undefined is not valid json object\n};\n\n/**\n * Should be called to create batch payload object\n *\n * @method toBatchPayload\n * @param {Array} messages, an array of objects with method (required) and params (optional) fields\n * @returns {Array} batch payload\n */\nJsonrpc.prototype.toBatchPayload = function (messages) {\n var self = this;\n return messages.map(function (message) {\n return self.toPayload(message.method, message.params);\n });\n};\n\nmodule.exports = Jsonrpc;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/**\n * @file method.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar RequestManager = require('./requestmanager');\nvar utils = require('../utils/utils');\nvar errors = require('./errors');\n\nvar Method = function (options) {\n this.name = options.name;\n this.call = options.call;\n this.params = options.params || 0;\n this.inputFormatter = options.inputFormatter;\n this.outputFormatter = options.outputFormatter;\n};\n\n/**\n * Should be used to determine name of the jsonrpc method based on arguments\n *\n * @method getCall\n * @param {Array} arguments\n * @return {String} name of jsonrpc method\n */\nMethod.prototype.getCall = function (args) {\n return utils.isFunction(this.call) ? this.call(args) : this.call;\n};\n\n/**\n * Should be used to extract callback from array of arguments. Modifies input param\n *\n * @method extractCallback\n * @param {Array} arguments\n * @return {Function|Null} callback, if exists\n */\nMethod.prototype.extractCallback = function (args) {\n if (utils.isFunction(args[args.length - 1])) {\n return args.pop(); // modify the args array!\n }\n};\n\n/**\n * Should be called to check if the number of arguments is correct\n * \n * @method validateArgs\n * @param {Array} arguments\n * @throws {Error} if it is not\n */\nMethod.prototype.validateArgs = function (args) {\n if (args.length !== this.params) {\n throw errors.InvalidNumberOfParams();\n }\n};\n\n/**\n * Should be called to format input args of method\n * \n * @method formatInput\n * @param {Array}\n * @return {Array}\n */\nMethod.prototype.formatInput = function (args) {\n if (!this.inputFormatter) {\n return args;\n }\n\n return this.inputFormatter.map(function (formatter, index) {\n return formatter ? formatter(args[index]) : args[index];\n });\n};\n\n/**\n * Should be called to format output(result) of method\n *\n * @method formatOutput\n * @param {Object}\n * @return {Object}\n */\nMethod.prototype.formatOutput = function (result) {\n return this.outputFormatter && result !== null ? this.outputFormatter(result) : result;\n};\n\n/**\n * Should attach function to method\n * \n * @method attachToObject\n * @param {Object}\n * @param {Function}\n */\nMethod.prototype.attachToObject = function (obj) {\n var func = this.send.bind(this);\n func.request = this.request.bind(this);\n func.call = this.call; // that's ugly. filter.js uses it\n var name = this.name.split('.');\n if (name.length > 1) {\n obj[name[0]] = obj[name[0]] || {};\n obj[name[0]][name[1]] = func;\n } else {\n obj[name[0]] = func; \n }\n};\n\n/**\n * Should create payload from given input args\n *\n * @method toPayload\n * @param {Array} args\n * @return {Object}\n */\nMethod.prototype.toPayload = function (args) {\n var call = this.getCall(args);\n var callback = this.extractCallback(args);\n var params = this.formatInput(args);\n this.validateArgs(params);\n\n return {\n method: call,\n params: params,\n callback: callback\n };\n};\n\n/**\n * Should be called to create pure JSONRPC request which can be used in batch request\n *\n * @method request\n * @param {...} params\n * @return {Object} jsonrpc request\n */\nMethod.prototype.request = function () {\n var payload = this.toPayload(Array.prototype.slice.call(arguments));\n payload.format = this.formatOutput.bind(this);\n return payload;\n};\n\n/**\n * Should send request to the API\n *\n * @method send\n * @param list of params\n * @return result\n */\nMethod.prototype.send = function () {\n var payload = this.toPayload(Array.prototype.slice.call(arguments));\n if (payload.callback) {\n var self = this;\n return RequestManager.getInstance().sendAsync(payload, function (err, result) {\n payload.callback(err, self.formatOutput(result));\n });\n }\n return this.formatOutput(RequestManager.getInstance().send(payload));\n};\n\nmodule.exports = Method;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file namereg.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar contract = require('./contract');\n\nvar address = '0xc6d9d2cd449a754c494264e1809c50e34d64562b';\n\nvar abi = [\n {\"constant\":true,\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\"}],\"name\":\"name\",\"outputs\":[{\"name\":\"o_name\",\"type\":\"bytes32\"}],\"type\":\"function\"},\n {\"constant\":true,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"type\":\"function\"},\n {\"constant\":true,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"content\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"type\":\"function\"},\n {\"constant\":true,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"addr\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"type\":\"function\"},\n {\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"reserve\",\"outputs\":[],\"type\":\"function\"},\n {\"constant\":true,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"subRegistrar\",\"outputs\":[{\"name\":\"o_subRegistrar\",\"type\":\"address\"}],\"type\":\"function\"},\n {\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"},{\"name\":\"_newOwner\",\"type\":\"address\"}],\"name\":\"transfer\",\"outputs\":[],\"type\":\"function\"},\n {\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"},{\"name\":\"_registrar\",\"type\":\"address\"}],\"name\":\"setSubRegistrar\",\"outputs\":[],\"type\":\"function\"},\n {\"constant\":false,\"inputs\":[],\"name\":\"Registrar\",\"outputs\":[],\"type\":\"function\"},\n {\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"},{\"name\":\"_a\",\"type\":\"address\"},{\"name\":\"_primary\",\"type\":\"bool\"}],\"name\":\"setAddress\",\"outputs\":[],\"type\":\"function\"},\n {\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"},{\"name\":\"_content\",\"type\":\"bytes32\"}],\"name\":\"setContent\",\"outputs\":[],\"type\":\"function\"},\n {\"constant\":false,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"disown\",\"outputs\":[],\"type\":\"function\"},\n {\"constant\":true,\"inputs\":[{\"name\":\"_name\",\"type\":\"bytes32\"}],\"name\":\"register\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"type\":\"function\"},\n {\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"Changed\",\"type\":\"event\"},\n {\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"name\",\"type\":\"bytes32\"},{\"indexed\":true,\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"PrimaryChanged\",\"type\":\"event\"}\n];\n\nmodule.exports = contract(abi).at(address);\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file eth.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar utils = require('../utils/utils');\nvar Property = require('./property');\n\n/// @returns an array of objects describing web3.eth api methods\nvar methods = [\n];\n\n/// @returns an array of objects describing web3.eth api properties\nvar properties = [\n new Property({\n name: 'listening',\n getter: 'net_listening'\n }),\n new Property({\n name: 'peerCount',\n getter: 'net_peerCount',\n outputFormatter: utils.toDecimal\n })\n];\n\n\nmodule.exports = {\n methods: methods,\n properties: properties\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/**\n * @file property.js\n * @author Fabian Vogelsteller \n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar RequestManager = require('./requestmanager');\n\nvar Property = function (options) {\n this.name = options.name;\n this.getter = options.getter;\n this.setter = options.setter;\n this.outputFormatter = options.outputFormatter;\n this.inputFormatter = options.inputFormatter;\n};\n\n/**\n * Should be called to format input args of method\n * \n * @method formatInput\n * @param {Array}\n * @return {Array}\n */\nProperty.prototype.formatInput = function (arg) {\n return this.inputFormatter ? this.inputFormatter(arg) : arg;\n};\n\n/**\n * Should be called to format output(result) of method\n *\n * @method formatOutput\n * @param {Object}\n * @return {Object}\n */\nProperty.prototype.formatOutput = function (result) {\n return this.outputFormatter && result !== null ? this.outputFormatter(result) : result;\n};\n\n/**\n * Should attach function to method\n * \n * @method attachToObject\n * @param {Object}\n * @param {Function}\n */\nProperty.prototype.attachToObject = function (obj) {\n var proto = {\n get: this.get.bind(this),\n };\n\n var names = this.name.split('.');\n var name = names[0];\n if (names.length > 1) {\n obj[names[0]] = obj[names[0]] || {};\n obj = obj[names[0]];\n name = names[1];\n }\n \n Object.defineProperty(obj, name, proto);\n\n var toAsyncName = function (prefix, name) {\n return prefix + name.charAt(0).toUpperCase() + name.slice(1);\n };\n\n obj[toAsyncName('get', name)] = this.getAsync.bind(this);\n};\n\n/**\n * Should be used to get value of the property\n *\n * @method get\n * @return {Object} value of the property\n */\nProperty.prototype.get = function () {\n return this.formatOutput(RequestManager.getInstance().send({\n method: this.getter\n }));\n};\n\n/**\n * Should be used to asynchrounously get value of property\n *\n * @method getAsync\n * @param {Function}\n */\nProperty.prototype.getAsync = function (callback) {\n var self = this;\n RequestManager.getInstance().sendAsync({\n method: this.getter\n }, function (err, result) {\n if (err) {\n return callback(err);\n }\n callback(err, self.formatOutput(result));\n });\n};\n\nmodule.exports = Property;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file qtsync.js\n * @authors:\n * Marek Kotewicz \n * Marian Oancea \n * @date 2014\n */\n\nvar QtSyncProvider = function () {\n};\n\nQtSyncProvider.prototype.send = function (payload) {\n var result = navigator.qt.callMethod(JSON.stringify(payload));\n return JSON.parse(result);\n};\n\nmodule.exports = QtSyncProvider;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file requestmanager.js\n * @author Jeffrey Wilcke \n * @author Marek Kotewicz \n * @author Marian Oancea \n * @author Fabian Vogelsteller \n * @author Gav Wood \n * @date 2014\n */\n\nvar Jsonrpc = require('./jsonrpc');\nvar utils = require('../utils/utils');\nvar c = require('../utils/config');\nvar errors = require('./errors');\n\n/**\n * It's responsible for passing messages to providers\n * It's also responsible for polling the ethereum node for incoming messages\n * Default poll timeout is 1 second\n * Singleton\n */\nvar RequestManager = function (provider) {\n // singleton pattern\n if (arguments.callee._singletonInstance) {\n return arguments.callee._singletonInstance;\n }\n arguments.callee._singletonInstance = this;\n\n this.provider = provider;\n this.polls = {};\n this.timeout = null;\n this.isPolling = false;\n};\n\n/**\n * @return {RequestManager} singleton\n */\nRequestManager.getInstance = function () {\n var instance = new RequestManager();\n return instance;\n};\n\n/**\n * Should be used to synchronously send request\n *\n * @method send\n * @param {Object} data\n * @return {Object}\n */\nRequestManager.prototype.send = function (data) {\n if (!this.provider) {\n console.error(errors.InvalidProvider());\n return null;\n }\n\n var payload = Jsonrpc.getInstance().toPayload(data.method, data.params);\n var result = this.provider.send(payload);\n\n if (!Jsonrpc.getInstance().isValidResponse(result)) {\n throw errors.InvalidResponse(result);\n }\n\n return result.result;\n};\n\n/**\n * Should be used to asynchronously send request\n *\n * @method sendAsync\n * @param {Object} data\n * @param {Function} callback\n */\nRequestManager.prototype.sendAsync = function (data, callback) {\n if (!this.provider) {\n return callback(errors.InvalidProvider());\n }\n\n var payload = Jsonrpc.getInstance().toPayload(data.method, data.params);\n this.provider.sendAsync(payload, function (err, result) {\n if (err) {\n return callback(err);\n }\n \n if (!Jsonrpc.getInstance().isValidResponse(result)) {\n return callback(errors.InvalidResponse(result));\n }\n\n callback(null, result.result);\n });\n};\n\n/**\n * Should be called to asynchronously send batch request\n *\n * @method sendBatch\n * @param {Array} batch data\n * @param {Function} callback\n */\nRequestManager.prototype.sendBatch = function (data, callback) {\n if (!this.provider) {\n return callback(errors.InvalidProvider());\n }\n\n var payload = Jsonrpc.getInstance().toBatchPayload(data);\n\n this.provider.sendAsync(payload, function (err, results) {\n if (err) {\n return callback(err);\n }\n\n if (!utils.isArray(results)) {\n return callback(errors.InvalidResponse(results));\n }\n\n callback(err, results);\n }); \n};\n\n/**\n * Should be used to set provider of request manager\n *\n * @method setProvider\n * @param {Object}\n */\nRequestManager.prototype.setProvider = function (p) {\n this.provider = p;\n\n if (this.provider && !this.isPolling) {\n this.poll();\n this.isPolling = true;\n }\n};\n\n/*jshint maxparams:4 */\n\n/**\n * Should be used to start polling\n *\n * @method startPolling\n * @param {Object} data\n * @param {Number} pollId\n * @param {Function} callback\n * @param {Function} uninstall\n *\n * @todo cleanup number of params\n */\nRequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) {\n this.polls['poll_'+ pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall};\n};\n/*jshint maxparams:3 */\n\n/**\n * Should be used to stop polling for filter with given id\n *\n * @method stopPolling\n * @param {Number} pollId\n */\nRequestManager.prototype.stopPolling = function (pollId) {\n delete this.polls['poll_'+ pollId];\n};\n\n/**\n * Should be called to reset the polling mechanism of the request manager\n *\n * @method reset\n */\nRequestManager.prototype.reset = function () {\n for (var key in this.polls) {\n this.polls[key].uninstall();\n }\n this.polls = {};\n\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n this.poll();\n};\n\n/**\n * Should be called to poll for changes on filter with given id\n *\n * @method poll\n */\nRequestManager.prototype.poll = function () {\n /*jshint maxcomplexity: 6 */\n this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT);\n\n if (Object.keys(this.polls).length === 0) {\n return;\n }\n\n if (!this.provider) {\n console.error(errors.InvalidProvider());\n return;\n }\n\n var pollsData = [];\n var pollsKeys = [];\n for (var key in this.polls) {\n pollsData.push(this.polls[key].data);\n pollsKeys.push(key);\n }\n\n if (pollsData.length === 0) {\n return;\n }\n\n var payload = Jsonrpc.getInstance().toBatchPayload(pollsData);\n\n var self = this;\n this.provider.sendAsync(payload, function (error, results) {\n // TODO: console log?\n if (error) {\n return;\n }\n\n if (!utils.isArray(results)) {\n throw errors.InvalidResponse(results);\n }\n\n results.map(function (result, index) {\n var key = pollsKeys[index];\n // make sure the filter is still installed after arrival of the request\n if (self.polls[key]) {\n result.callback = self.polls[key].callback;\n return result;\n } else\n return false;\n }).filter(function (result) {\n return !!result; \n }).filter(function (result) {\n var valid = Jsonrpc.getInstance().isValidResponse(result);\n if (!valid) {\n result.callback(errors.InvalidResponse(result));\n }\n return valid;\n }).filter(function (result) {\n return utils.isArray(result.result) && result.result.length > 0;\n }).forEach(function (result) {\n result.callback(null, result.result);\n });\n });\n};\n\nmodule.exports = RequestManager;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file shh.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Method = require('./method');\nvar formatters = require('./formatters');\n\nvar post = new Method({\n name: 'post', \n call: 'shh_post', \n params: 1,\n inputFormatter: [formatters.inputPostFormatter]\n});\n\nvar newIdentity = new Method({\n name: 'newIdentity',\n call: 'shh_newIdentity',\n params: 0\n});\n\nvar hasIdentity = new Method({\n name: 'hasIdentity',\n call: 'shh_hasIdentity',\n params: 1\n});\n\nvar newGroup = new Method({\n name: 'newGroup',\n call: 'shh_newGroup',\n params: 0\n});\n\nvar addToGroup = new Method({\n name: 'addToGroup',\n call: 'shh_addToGroup',\n params: 0\n});\n\nvar methods = [\n post,\n newIdentity,\n hasIdentity,\n newGroup,\n addToGroup\n];\n\nmodule.exports = {\n methods: methods\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file transfer.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nvar web3 = require('../web3');\nvar ICAP = require('./icap');\nvar namereg = require('./namereg');\nvar contract = require('./contract');\n\n/**\n * Should be used to make ICAP transfer\n *\n * @method transfer\n * @param {String} iban number\n * @param {String} from (address)\n * @param {Value} value to be tranfered\n * @param {Function} callback, callback\n */\nvar transfer = function (from, iban, value, callback) {\n var icap = new ICAP(iban); \n if (!icap.isValid()) {\n throw new Error('invalid iban address');\n }\n\n if (icap.isDirect()) {\n return transferToAddress(from, icap.address(), value, callback);\n }\n \n if (!callback) {\n var address = namereg.addr(icap.institution());\n return deposit(from, address, value, icap.client());\n }\n\n namereg.addr(icap.insitution(), function (err, address) {\n return deposit(from, address, value, icap.client(), callback);\n });\n \n};\n\n/**\n * Should be used to transfer funds to certain address\n *\n * @method transferToAddress\n * @param {String} address\n * @param {String} from (address)\n * @param {Value} value to be tranfered\n * @param {Function} callback, callback\n */\nvar transferToAddress = function (from, address, value, callback) {\n return web3.eth.sendTransaction({\n address: address,\n from: from,\n value: value\n }, callback);\n};\n\n/**\n * Should be used to deposit funds to generic Exchange contract (must implement deposit(bytes32) method!)\n *\n * @method deposit\n * @param {String} address\n * @param {String} from (address)\n * @param {Value} value to be tranfered\n * @param {String} client unique identifier\n * @param {Function} callback, callback\n */\nvar deposit = function (from, address, value, client, callback) {\n var abi = [{\"constant\":false,\"inputs\":[{\"name\":\"name\",\"type\":\"bytes32\"}],\"name\":\"deposit\",\"outputs\":[],\"type\":\"function\"}];\n return contract(abi).at(address).deposit(client, {\n from: from,\n value: value\n }, callback);\n};\n\nmodule.exports = transfer;\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file watches.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Method = require('./method');\n\n/// @returns an array of objects describing web3.eth.filter api methods\nvar eth = function () {\n var newFilterCall = function (args) {\n var type = args[0];\n\n switch(type) {\n case 'latest':\n args.shift();\n this.params = 0;\n return 'eth_newBlockFilter';\n case 'pending':\n args.shift();\n this.params = 0;\n return 'eth_newPendingTransactionFilter';\n default:\n return 'eth_newFilter';\n }\n };\n\n var newFilter = new Method({\n name: 'newFilter',\n call: newFilterCall,\n params: 1\n });\n\n var uninstallFilter = new Method({\n name: 'uninstallFilter',\n call: 'eth_uninstallFilter',\n params: 1\n });\n\n var getLogs = new Method({\n name: 'getLogs',\n call: 'eth_getFilterLogs',\n params: 1\n });\n\n var poll = new Method({\n name: 'poll',\n call: 'eth_getFilterChanges',\n params: 1\n });\n\n return [\n newFilter,\n uninstallFilter,\n getLogs,\n poll\n ];\n};\n\n/// @returns an array of objects describing web3.shh.watch api methods\nvar shh = function () {\n var newFilter = new Method({\n name: 'newFilter',\n call: 'shh_newFilter',\n params: 1\n });\n\n var uninstallFilter = new Method({\n name: 'uninstallFilter',\n call: 'shh_uninstallFilter',\n params: 1\n });\n\n var getLogs = new Method({\n name: 'getLogs',\n call: 'shh_getMessages',\n params: 1\n });\n\n var poll = new Method({\n name: 'poll',\n call: 'shh_getFilterChanges',\n params: 1\n });\n\n return [\n newFilter,\n uninstallFilter,\n getLogs,\n poll\n ];\n};\n\nmodule.exports = {\n eth: eth,\n shh: shh\n};\n\n", + null, + ";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory();\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\troot.CryptoJS = factory();\n\t}\n}(this, function () {\n\n\t/**\n\t * CryptoJS core components.\n\t */\n\tvar CryptoJS = CryptoJS || (function (Math, undefined) {\n\t /**\n\t * CryptoJS namespace.\n\t */\n\t var C = {};\n\n\t /**\n\t * Library namespace.\n\t */\n\t var C_lib = C.lib = {};\n\n\t /**\n\t * Base object for prototypal inheritance.\n\t */\n\t var Base = C_lib.Base = (function () {\n\t function F() {}\n\n\t return {\n\t /**\n\t * Creates a new object that inherits from this object.\n\t *\n\t * @param {Object} overrides Properties to copy into the new object.\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * field: 'value',\n\t *\n\t * method: function () {\n\t * }\n\t * });\n\t */\n\t extend: function (overrides) {\n\t // Spawn\n\t F.prototype = this;\n\t var subtype = new F();\n\n\t // Augment\n\t if (overrides) {\n\t subtype.mixIn(overrides);\n\t }\n\n\t // Create default initializer\n\t if (!subtype.hasOwnProperty('init')) {\n\t subtype.init = function () {\n\t subtype.$super.init.apply(this, arguments);\n\t };\n\t }\n\n\t // Initializer's prototype is the subtype object\n\t subtype.init.prototype = subtype;\n\n\t // Reference supertype\n\t subtype.$super = this;\n\n\t return subtype;\n\t },\n\n\t /**\n\t * Extends this object and runs the init method.\n\t * Arguments to create() will be passed to init().\n\t *\n\t * @return {Object} The new object.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var instance = MyType.create();\n\t */\n\t create: function () {\n\t var instance = this.extend();\n\t instance.init.apply(instance, arguments);\n\n\t return instance;\n\t },\n\n\t /**\n\t * Initializes a newly created object.\n\t * Override this method to add some logic when your objects are created.\n\t *\n\t * @example\n\t *\n\t * var MyType = CryptoJS.lib.Base.extend({\n\t * init: function () {\n\t * // ...\n\t * }\n\t * });\n\t */\n\t init: function () {\n\t },\n\n\t /**\n\t * Copies properties into this object.\n\t *\n\t * @param {Object} properties The properties to mix in.\n\t *\n\t * @example\n\t *\n\t * MyType.mixIn({\n\t * field: 'value'\n\t * });\n\t */\n\t mixIn: function (properties) {\n\t for (var propertyName in properties) {\n\t if (properties.hasOwnProperty(propertyName)) {\n\t this[propertyName] = properties[propertyName];\n\t }\n\t }\n\n\t // IE won't copy toString using the loop above\n\t if (properties.hasOwnProperty('toString')) {\n\t this.toString = properties.toString;\n\t }\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = instance.clone();\n\t */\n\t clone: function () {\n\t return this.init.prototype.extend(this);\n\t }\n\t };\n\t }());\n\n\t /**\n\t * An array of 32-bit words.\n\t *\n\t * @property {Array} words The array of 32-bit words.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var WordArray = C_lib.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of 32-bit words.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.create();\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607]);\n\t * var wordArray = CryptoJS.lib.WordArray.create([0x00010203, 0x04050607], 6);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 4;\n\t }\n\t },\n\n\t /**\n\t * Converts this word array to a string.\n\t *\n\t * @param {Encoder} encoder (Optional) The encoding strategy to use. Default: CryptoJS.enc.Hex\n\t *\n\t * @return {string} The stringified word array.\n\t *\n\t * @example\n\t *\n\t * var string = wordArray + '';\n\t * var string = wordArray.toString();\n\t * var string = wordArray.toString(CryptoJS.enc.Utf8);\n\t */\n\t toString: function (encoder) {\n\t return (encoder || Hex).stringify(this);\n\t },\n\n\t /**\n\t * Concatenates a word array to this word array.\n\t *\n\t * @param {WordArray} wordArray The word array to append.\n\t *\n\t * @return {WordArray} This word array.\n\t *\n\t * @example\n\t *\n\t * wordArray1.concat(wordArray2);\n\t */\n\t concat: function (wordArray) {\n\t // Shortcuts\n\t var thisWords = this.words;\n\t var thatWords = wordArray.words;\n\t var thisSigBytes = this.sigBytes;\n\t var thatSigBytes = wordArray.sigBytes;\n\n\t // Clamp excess bits\n\t this.clamp();\n\n\t // Concat\n\t if (thisSigBytes % 4) {\n\t // Copy one byte at a time\n\t for (var i = 0; i < thatSigBytes; i++) {\n\t var thatByte = (thatWords[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t thisWords[(thisSigBytes + i) >>> 2] |= thatByte << (24 - ((thisSigBytes + i) % 4) * 8);\n\t }\n\t } else {\n\t // Copy one word at a time\n\t for (var i = 0; i < thatSigBytes; i += 4) {\n\t thisWords[(thisSigBytes + i) >>> 2] = thatWords[i >>> 2];\n\t }\n\t }\n\t this.sigBytes += thatSigBytes;\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Removes insignificant bits.\n\t *\n\t * @example\n\t *\n\t * wordArray.clamp();\n\t */\n\t clamp: function () {\n\t // Shortcuts\n\t var words = this.words;\n\t var sigBytes = this.sigBytes;\n\n\t // Clamp\n\t words[sigBytes >>> 2] &= 0xffffffff << (32 - (sigBytes % 4) * 8);\n\t words.length = Math.ceil(sigBytes / 4);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = wordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone.words = this.words.slice(0);\n\n\t return clone;\n\t },\n\n\t /**\n\t * Creates a word array filled with random bytes.\n\t *\n\t * @param {number} nBytes The number of random bytes to generate.\n\t *\n\t * @return {WordArray} The random word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.lib.WordArray.random(16);\n\t */\n\t random: function (nBytes) {\n\t var words = [];\n\n\t var r = (function (m_w) {\n\t var m_w = m_w;\n\t var m_z = 0x3ade68b1;\n\t var mask = 0xffffffff;\n\n\t return function () {\n\t m_z = (0x9069 * (m_z & 0xFFFF) + (m_z >> 0x10)) & mask;\n\t m_w = (0x4650 * (m_w & 0xFFFF) + (m_w >> 0x10)) & mask;\n\t var result = ((m_z << 0x10) + m_w) & mask;\n\t result /= 0x100000000;\n\t result += 0.5;\n\t return result * (Math.random() > .5 ? 1 : -1);\n\t }\n\t });\n\n\t for (var i = 0, rcache; i < nBytes; i += 4) {\n\t var _r = r((rcache || Math.random()) * 0x100000000);\n\n\t rcache = _r() * 0x3ade67b7;\n\t words.push((_r() * 0x100000000) | 0);\n\t }\n\n\t return new WordArray.init(words, nBytes);\n\t }\n\t });\n\n\t /**\n\t * Encoder namespace.\n\t */\n\t var C_enc = C.enc = {};\n\n\t /**\n\t * Hex encoding strategy.\n\t */\n\t var Hex = C_enc.Hex = {\n\t /**\n\t * Converts a word array to a hex string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The hex string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hexString = CryptoJS.enc.Hex.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var hexChars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t hexChars.push((bite >>> 4).toString(16));\n\t hexChars.push((bite & 0x0f).toString(16));\n\t }\n\n\t return hexChars.join('');\n\t },\n\n\t /**\n\t * Converts a hex string to a word array.\n\t *\n\t * @param {string} hexStr The hex string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Hex.parse(hexString);\n\t */\n\t parse: function (hexStr) {\n\t // Shortcut\n\t var hexStrLength = hexStr.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < hexStrLength; i += 2) {\n\t words[i >>> 3] |= parseInt(hexStr.substr(i, 2), 16) << (24 - (i % 8) * 4);\n\t }\n\n\t return new WordArray.init(words, hexStrLength / 2);\n\t }\n\t };\n\n\t /**\n\t * Latin1 encoding strategy.\n\t */\n\t var Latin1 = C_enc.Latin1 = {\n\t /**\n\t * Converts a word array to a Latin1 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The Latin1 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var latin1String = CryptoJS.enc.Latin1.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t // Shortcuts\n\t var words = wordArray.words;\n\t var sigBytes = wordArray.sigBytes;\n\n\t // Convert\n\t var latin1Chars = [];\n\t for (var i = 0; i < sigBytes; i++) {\n\t var bite = (words[i >>> 2] >>> (24 - (i % 4) * 8)) & 0xff;\n\t latin1Chars.push(String.fromCharCode(bite));\n\t }\n\n\t return latin1Chars.join('');\n\t },\n\n\t /**\n\t * Converts a Latin1 string to a word array.\n\t *\n\t * @param {string} latin1Str The Latin1 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Latin1.parse(latin1String);\n\t */\n\t parse: function (latin1Str) {\n\t // Shortcut\n\t var latin1StrLength = latin1Str.length;\n\n\t // Convert\n\t var words = [];\n\t for (var i = 0; i < latin1StrLength; i++) {\n\t words[i >>> 2] |= (latin1Str.charCodeAt(i) & 0xff) << (24 - (i % 4) * 8);\n\t }\n\n\t return new WordArray.init(words, latin1StrLength);\n\t }\n\t };\n\n\t /**\n\t * UTF-8 encoding strategy.\n\t */\n\t var Utf8 = C_enc.Utf8 = {\n\t /**\n\t * Converts a word array to a UTF-8 string.\n\t *\n\t * @param {WordArray} wordArray The word array.\n\t *\n\t * @return {string} The UTF-8 string.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var utf8String = CryptoJS.enc.Utf8.stringify(wordArray);\n\t */\n\t stringify: function (wordArray) {\n\t try {\n\t return decodeURIComponent(escape(Latin1.stringify(wordArray)));\n\t } catch (e) {\n\t throw new Error('Malformed UTF-8 data');\n\t }\n\t },\n\n\t /**\n\t * Converts a UTF-8 string to a word array.\n\t *\n\t * @param {string} utf8Str The UTF-8 string.\n\t *\n\t * @return {WordArray} The word array.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.enc.Utf8.parse(utf8String);\n\t */\n\t parse: function (utf8Str) {\n\t return Latin1.parse(unescape(encodeURIComponent(utf8Str)));\n\t }\n\t };\n\n\t /**\n\t * Abstract buffered block algorithm template.\n\t *\n\t * The property blockSize must be implemented in a concrete subtype.\n\t *\n\t * @property {number} _minBufferSize The number of blocks that should be kept unprocessed in the buffer. Default: 0\n\t */\n\t var BufferedBlockAlgorithm = C_lib.BufferedBlockAlgorithm = Base.extend({\n\t /**\n\t * Resets this block algorithm's data buffer to its initial state.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm.reset();\n\t */\n\t reset: function () {\n\t // Initial values\n\t this._data = new WordArray.init();\n\t this._nDataBytes = 0;\n\t },\n\n\t /**\n\t * Adds new data to this block algorithm's buffer.\n\t *\n\t * @param {WordArray|string} data The data to append. Strings are converted to a WordArray using UTF-8.\n\t *\n\t * @example\n\t *\n\t * bufferedBlockAlgorithm._append('data');\n\t * bufferedBlockAlgorithm._append(wordArray);\n\t */\n\t _append: function (data) {\n\t // Convert string to WordArray, else assume WordArray already\n\t if (typeof data == 'string') {\n\t data = Utf8.parse(data);\n\t }\n\n\t // Append\n\t this._data.concat(data);\n\t this._nDataBytes += data.sigBytes;\n\t },\n\n\t /**\n\t * Processes available data blocks.\n\t *\n\t * This method invokes _doProcessBlock(offset), which must be implemented by a concrete subtype.\n\t *\n\t * @param {boolean} doFlush Whether all blocks and partial blocks should be processed.\n\t *\n\t * @return {WordArray} The processed data.\n\t *\n\t * @example\n\t *\n\t * var processedData = bufferedBlockAlgorithm._process();\n\t * var processedData = bufferedBlockAlgorithm._process(!!'flush');\n\t */\n\t _process: function (doFlush) {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var dataSigBytes = data.sigBytes;\n\t var blockSize = this.blockSize;\n\t var blockSizeBytes = blockSize * 4;\n\n\t // Count blocks ready\n\t var nBlocksReady = dataSigBytes / blockSizeBytes;\n\t if (doFlush) {\n\t // Round up to include partial blocks\n\t nBlocksReady = Math.ceil(nBlocksReady);\n\t } else {\n\t // Round down to include only full blocks,\n\t // less the number of blocks that must remain in the buffer\n\t nBlocksReady = Math.max((nBlocksReady | 0) - this._minBufferSize, 0);\n\t }\n\n\t // Count words ready\n\t var nWordsReady = nBlocksReady * blockSize;\n\n\t // Count bytes ready\n\t var nBytesReady = Math.min(nWordsReady * 4, dataSigBytes);\n\n\t // Process blocks\n\t if (nWordsReady) {\n\t for (var offset = 0; offset < nWordsReady; offset += blockSize) {\n\t // Perform concrete-algorithm logic\n\t this._doProcessBlock(dataWords, offset);\n\t }\n\n\t // Remove processed words\n\t var processedWords = dataWords.splice(0, nWordsReady);\n\t data.sigBytes -= nBytesReady;\n\t }\n\n\t // Return processed words\n\t return new WordArray.init(processedWords, nBytesReady);\n\t },\n\n\t /**\n\t * Creates a copy of this object.\n\t *\n\t * @return {Object} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = bufferedBlockAlgorithm.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\t clone._data = this._data.clone();\n\n\t return clone;\n\t },\n\n\t _minBufferSize: 0\n\t });\n\n\t /**\n\t * Abstract hasher template.\n\t *\n\t * @property {number} blockSize The number of 32-bit words this hasher operates on. Default: 16 (512 bits)\n\t */\n\t var Hasher = C_lib.Hasher = BufferedBlockAlgorithm.extend({\n\t /**\n\t * Configuration options.\n\t */\n\t cfg: Base.extend(),\n\n\t /**\n\t * Initializes a newly created hasher.\n\t *\n\t * @param {Object} cfg (Optional) The configuration options to use for this hash computation.\n\t *\n\t * @example\n\t *\n\t * var hasher = CryptoJS.algo.SHA256.create();\n\t */\n\t init: function (cfg) {\n\t // Apply config defaults\n\t this.cfg = this.cfg.extend(cfg);\n\n\t // Set initial values\n\t this.reset();\n\t },\n\n\t /**\n\t * Resets this hasher to its initial state.\n\t *\n\t * @example\n\t *\n\t * hasher.reset();\n\t */\n\t reset: function () {\n\t // Reset data buffer\n\t BufferedBlockAlgorithm.reset.call(this);\n\n\t // Perform concrete-hasher logic\n\t this._doReset();\n\t },\n\n\t /**\n\t * Updates this hasher with a message.\n\t *\n\t * @param {WordArray|string} messageUpdate The message to append.\n\t *\n\t * @return {Hasher} This hasher.\n\t *\n\t * @example\n\t *\n\t * hasher.update('message');\n\t * hasher.update(wordArray);\n\t */\n\t update: function (messageUpdate) {\n\t // Append\n\t this._append(messageUpdate);\n\n\t // Update the hash\n\t this._process();\n\n\t // Chainable\n\t return this;\n\t },\n\n\t /**\n\t * Finalizes the hash computation.\n\t * Note that the finalize operation is effectively a destructive, read-once operation.\n\t *\n\t * @param {WordArray|string} messageUpdate (Optional) A final message update.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @example\n\t *\n\t * var hash = hasher.finalize();\n\t * var hash = hasher.finalize('message');\n\t * var hash = hasher.finalize(wordArray);\n\t */\n\t finalize: function (messageUpdate) {\n\t // Final message update\n\t if (messageUpdate) {\n\t this._append(messageUpdate);\n\t }\n\n\t // Perform concrete-hasher logic\n\t var hash = this._doFinalize();\n\n\t return hash;\n\t },\n\n\t blockSize: 512/32,\n\n\t /**\n\t * Creates a shortcut function to a hasher's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to create a helper for.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var SHA256 = CryptoJS.lib.Hasher._createHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHelper: function (hasher) {\n\t return function (message, cfg) {\n\t return new hasher.init(cfg).finalize(message);\n\t };\n\t },\n\n\t /**\n\t * Creates a shortcut function to the HMAC's object interface.\n\t *\n\t * @param {Hasher} hasher The hasher to use in this HMAC helper.\n\t *\n\t * @return {Function} The shortcut function.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var HmacSHA256 = CryptoJS.lib.Hasher._createHmacHelper(CryptoJS.algo.SHA256);\n\t */\n\t _createHmacHelper: function (hasher) {\n\t return function (message, key) {\n\t return new C_algo.HMAC.init(hasher, key).finalize(message);\n\t };\n\t }\n\t });\n\n\t /**\n\t * Algorithm namespace.\n\t */\n\t var C_algo = C.algo = {};\n\n\t return C;\n\t}(Math));\n\n\n\treturn CryptoJS;\n\n}));", + ";(function (root, factory, undef) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"), require(\"./x64-core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\", \"./x64-core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (Math) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var WordArray = C_lib.WordArray;\n\t var Hasher = C_lib.Hasher;\n\t var C_x64 = C.x64;\n\t var X64Word = C_x64.Word;\n\t var C_algo = C.algo;\n\n\t // Constants tables\n\t var RHO_OFFSETS = [];\n\t var PI_INDEXES = [];\n\t var ROUND_CONSTANTS = [];\n\n\t // Compute Constants\n\t (function () {\n\t // Compute rho offset constants\n\t var x = 1, y = 0;\n\t for (var t = 0; t < 24; t++) {\n\t RHO_OFFSETS[x + 5 * y] = ((t + 1) * (t + 2) / 2) % 64;\n\n\t var newX = y % 5;\n\t var newY = (2 * x + 3 * y) % 5;\n\t x = newX;\n\t y = newY;\n\t }\n\n\t // Compute pi index constants\n\t for (var x = 0; x < 5; x++) {\n\t for (var y = 0; y < 5; y++) {\n\t PI_INDEXES[x + 5 * y] = y + ((2 * x + 3 * y) % 5) * 5;\n\t }\n\t }\n\n\t // Compute round constants\n\t var LFSR = 0x01;\n\t for (var i = 0; i < 24; i++) {\n\t var roundConstantMsw = 0;\n\t var roundConstantLsw = 0;\n\n\t for (var j = 0; j < 7; j++) {\n\t if (LFSR & 0x01) {\n\t var bitPosition = (1 << j) - 1;\n\t if (bitPosition < 32) {\n\t roundConstantLsw ^= 1 << bitPosition;\n\t } else /* if (bitPosition >= 32) */ {\n\t roundConstantMsw ^= 1 << (bitPosition - 32);\n\t }\n\t }\n\n\t // Compute next LFSR\n\t if (LFSR & 0x80) {\n\t // Primitive polynomial over GF(2): x^8 + x^6 + x^5 + x^4 + 1\n\t LFSR = (LFSR << 1) ^ 0x71;\n\t } else {\n\t LFSR <<= 1;\n\t }\n\t }\n\n\t ROUND_CONSTANTS[i] = X64Word.create(roundConstantMsw, roundConstantLsw);\n\t }\n\t }());\n\n\t // Reusable objects for temporary values\n\t var T = [];\n\t (function () {\n\t for (var i = 0; i < 25; i++) {\n\t T[i] = X64Word.create();\n\t }\n\t }());\n\n\t /**\n\t * SHA-3 hash algorithm.\n\t */\n\t var SHA3 = C_algo.SHA3 = Hasher.extend({\n\t /**\n\t * Configuration options.\n\t *\n\t * @property {number} outputLength\n\t * The desired number of bits in the output hash.\n\t * Only values permitted are: 224, 256, 384, 512.\n\t * Default: 512\n\t */\n\t cfg: Hasher.cfg.extend({\n\t outputLength: 512\n\t }),\n\n\t _doReset: function () {\n\t var state = this._state = []\n\t for (var i = 0; i < 25; i++) {\n\t state[i] = new X64Word.init();\n\t }\n\n\t this.blockSize = (1600 - 2 * this.cfg.outputLength) / 32;\n\t },\n\n\t _doProcessBlock: function (M, offset) {\n\t // Shortcuts\n\t var state = this._state;\n\t var nBlockSizeLanes = this.blockSize / 2;\n\n\t // Absorb\n\t for (var i = 0; i < nBlockSizeLanes; i++) {\n\t // Shortcuts\n\t var M2i = M[offset + 2 * i];\n\t var M2i1 = M[offset + 2 * i + 1];\n\n\t // Swap endian\n\t M2i = (\n\t (((M2i << 8) | (M2i >>> 24)) & 0x00ff00ff) |\n\t (((M2i << 24) | (M2i >>> 8)) & 0xff00ff00)\n\t );\n\t M2i1 = (\n\t (((M2i1 << 8) | (M2i1 >>> 24)) & 0x00ff00ff) |\n\t (((M2i1 << 24) | (M2i1 >>> 8)) & 0xff00ff00)\n\t );\n\n\t // Absorb message into state\n\t var lane = state[i];\n\t lane.high ^= M2i1;\n\t lane.low ^= M2i;\n\t }\n\n\t // Rounds\n\t for (var round = 0; round < 24; round++) {\n\t // Theta\n\t for (var x = 0; x < 5; x++) {\n\t // Mix column lanes\n\t var tMsw = 0, tLsw = 0;\n\t for (var y = 0; y < 5; y++) {\n\t var lane = state[x + 5 * y];\n\t tMsw ^= lane.high;\n\t tLsw ^= lane.low;\n\t }\n\n\t // Temporary values\n\t var Tx = T[x];\n\t Tx.high = tMsw;\n\t Tx.low = tLsw;\n\t }\n\t for (var x = 0; x < 5; x++) {\n\t // Shortcuts\n\t var Tx4 = T[(x + 4) % 5];\n\t var Tx1 = T[(x + 1) % 5];\n\t var Tx1Msw = Tx1.high;\n\t var Tx1Lsw = Tx1.low;\n\n\t // Mix surrounding columns\n\t var tMsw = Tx4.high ^ ((Tx1Msw << 1) | (Tx1Lsw >>> 31));\n\t var tLsw = Tx4.low ^ ((Tx1Lsw << 1) | (Tx1Msw >>> 31));\n\t for (var y = 0; y < 5; y++) {\n\t var lane = state[x + 5 * y];\n\t lane.high ^= tMsw;\n\t lane.low ^= tLsw;\n\t }\n\t }\n\n\t // Rho Pi\n\t for (var laneIndex = 1; laneIndex < 25; laneIndex++) {\n\t // Shortcuts\n\t var lane = state[laneIndex];\n\t var laneMsw = lane.high;\n\t var laneLsw = lane.low;\n\t var rhoOffset = RHO_OFFSETS[laneIndex];\n\n\t // Rotate lanes\n\t if (rhoOffset < 32) {\n\t var tMsw = (laneMsw << rhoOffset) | (laneLsw >>> (32 - rhoOffset));\n\t var tLsw = (laneLsw << rhoOffset) | (laneMsw >>> (32 - rhoOffset));\n\t } else /* if (rhoOffset >= 32) */ {\n\t var tMsw = (laneLsw << (rhoOffset - 32)) | (laneMsw >>> (64 - rhoOffset));\n\t var tLsw = (laneMsw << (rhoOffset - 32)) | (laneLsw >>> (64 - rhoOffset));\n\t }\n\n\t // Transpose lanes\n\t var TPiLane = T[PI_INDEXES[laneIndex]];\n\t TPiLane.high = tMsw;\n\t TPiLane.low = tLsw;\n\t }\n\n\t // Rho pi at x = y = 0\n\t var T0 = T[0];\n\t var state0 = state[0];\n\t T0.high = state0.high;\n\t T0.low = state0.low;\n\n\t // Chi\n\t for (var x = 0; x < 5; x++) {\n\t for (var y = 0; y < 5; y++) {\n\t // Shortcuts\n\t var laneIndex = x + 5 * y;\n\t var lane = state[laneIndex];\n\t var TLane = T[laneIndex];\n\t var Tx1Lane = T[((x + 1) % 5) + 5 * y];\n\t var Tx2Lane = T[((x + 2) % 5) + 5 * y];\n\n\t // Mix rows\n\t lane.high = TLane.high ^ (~Tx1Lane.high & Tx2Lane.high);\n\t lane.low = TLane.low ^ (~Tx1Lane.low & Tx2Lane.low);\n\t }\n\t }\n\n\t // Iota\n\t var lane = state[0];\n\t var roundConstant = ROUND_CONSTANTS[round];\n\t lane.high ^= roundConstant.high;\n\t lane.low ^= roundConstant.low;;\n\t }\n\t },\n\n\t _doFinalize: function () {\n\t // Shortcuts\n\t var data = this._data;\n\t var dataWords = data.words;\n\t var nBitsTotal = this._nDataBytes * 8;\n\t var nBitsLeft = data.sigBytes * 8;\n\t var blockSizeBits = this.blockSize * 32;\n\n\t // Add padding\n\t dataWords[nBitsLeft >>> 5] |= 0x1 << (24 - nBitsLeft % 32);\n\t dataWords[((Math.ceil((nBitsLeft + 1) / blockSizeBits) * blockSizeBits) >>> 5) - 1] |= 0x80;\n\t data.sigBytes = dataWords.length * 4;\n\n\t // Hash final blocks\n\t this._process();\n\n\t // Shortcuts\n\t var state = this._state;\n\t var outputLengthBytes = this.cfg.outputLength / 8;\n\t var outputLengthLanes = outputLengthBytes / 8;\n\n\t // Squeeze\n\t var hashWords = [];\n\t for (var i = 0; i < outputLengthLanes; i++) {\n\t // Shortcuts\n\t var lane = state[i];\n\t var laneMsw = lane.high;\n\t var laneLsw = lane.low;\n\n\t // Swap endian\n\t laneMsw = (\n\t (((laneMsw << 8) | (laneMsw >>> 24)) & 0x00ff00ff) |\n\t (((laneMsw << 24) | (laneMsw >>> 8)) & 0xff00ff00)\n\t );\n\t laneLsw = (\n\t (((laneLsw << 8) | (laneLsw >>> 24)) & 0x00ff00ff) |\n\t (((laneLsw << 24) | (laneLsw >>> 8)) & 0xff00ff00)\n\t );\n\n\t // Squeeze state to retrieve hash\n\t hashWords.push(laneLsw);\n\t hashWords.push(laneMsw);\n\t }\n\n\t // Return final computed hash\n\t return new WordArray.init(hashWords, outputLengthBytes);\n\t },\n\n\t clone: function () {\n\t var clone = Hasher.clone.call(this);\n\n\t var state = clone._state = this._state.slice(0);\n\t for (var i = 0; i < 25; i++) {\n\t state[i] = state[i].clone();\n\t }\n\n\t return clone;\n\t }\n\t });\n\n\t /**\n\t * Shortcut function to the hasher's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t *\n\t * @return {WordArray} The hash.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hash = CryptoJS.SHA3('message');\n\t * var hash = CryptoJS.SHA3(wordArray);\n\t */\n\t C.SHA3 = Hasher._createHelper(SHA3);\n\n\t /**\n\t * Shortcut function to the HMAC's object interface.\n\t *\n\t * @param {WordArray|string} message The message to hash.\n\t * @param {WordArray|string} key The secret key.\n\t *\n\t * @return {WordArray} The HMAC.\n\t *\n\t * @static\n\t *\n\t * @example\n\t *\n\t * var hmac = CryptoJS.HmacSHA3(message, key);\n\t */\n\t C.HmacSHA3 = Hasher._createHmacHelper(SHA3);\n\t}(Math));\n\n\n\treturn CryptoJS.SHA3;\n\n}));", + ";(function (root, factory) {\n\tif (typeof exports === \"object\") {\n\t\t// CommonJS\n\t\tmodule.exports = exports = factory(require(\"./core\"));\n\t}\n\telse if (typeof define === \"function\" && define.amd) {\n\t\t// AMD\n\t\tdefine([\"./core\"], factory);\n\t}\n\telse {\n\t\t// Global (browser)\n\t\tfactory(root.CryptoJS);\n\t}\n}(this, function (CryptoJS) {\n\n\t(function (undefined) {\n\t // Shortcuts\n\t var C = CryptoJS;\n\t var C_lib = C.lib;\n\t var Base = C_lib.Base;\n\t var X32WordArray = C_lib.WordArray;\n\n\t /**\n\t * x64 namespace.\n\t */\n\t var C_x64 = C.x64 = {};\n\n\t /**\n\t * A 64-bit word.\n\t */\n\t var X64Word = C_x64.Word = Base.extend({\n\t /**\n\t * Initializes a newly created 64-bit word.\n\t *\n\t * @param {number} high The high 32 bits.\n\t * @param {number} low The low 32 bits.\n\t *\n\t * @example\n\t *\n\t * var x64Word = CryptoJS.x64.Word.create(0x00010203, 0x04050607);\n\t */\n\t init: function (high, low) {\n\t this.high = high;\n\t this.low = low;\n\t }\n\n\t /**\n\t * Bitwise NOTs this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after negating.\n\t *\n\t * @example\n\t *\n\t * var negated = x64Word.not();\n\t */\n\t // not: function () {\n\t // var high = ~this.high;\n\t // var low = ~this.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ANDs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to AND with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ANDing.\n\t *\n\t * @example\n\t *\n\t * var anded = x64Word.and(anotherX64Word);\n\t */\n\t // and: function (word) {\n\t // var high = this.high & word.high;\n\t // var low = this.low & word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise ORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to OR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after ORing.\n\t *\n\t * @example\n\t *\n\t * var ored = x64Word.or(anotherX64Word);\n\t */\n\t // or: function (word) {\n\t // var high = this.high | word.high;\n\t // var low = this.low | word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Bitwise XORs this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to XOR with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after XORing.\n\t *\n\t * @example\n\t *\n\t * var xored = x64Word.xor(anotherX64Word);\n\t */\n\t // xor: function (word) {\n\t // var high = this.high ^ word.high;\n\t // var low = this.low ^ word.low;\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftL(25);\n\t */\n\t // shiftL: function (n) {\n\t // if (n < 32) {\n\t // var high = (this.high << n) | (this.low >>> (32 - n));\n\t // var low = this.low << n;\n\t // } else {\n\t // var high = this.low << (n - 32);\n\t // var low = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Shifts this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to shift.\n\t *\n\t * @return {X64Word} A new x64-Word object after shifting.\n\t *\n\t * @example\n\t *\n\t * var shifted = x64Word.shiftR(7);\n\t */\n\t // shiftR: function (n) {\n\t // if (n < 32) {\n\t // var low = (this.low >>> n) | (this.high << (32 - n));\n\t // var high = this.high >>> n;\n\t // } else {\n\t // var low = this.high >>> (n - 32);\n\t // var high = 0;\n\t // }\n\n\t // return X64Word.create(high, low);\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the left.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotL(25);\n\t */\n\t // rotL: function (n) {\n\t // return this.shiftL(n).or(this.shiftR(64 - n));\n\t // },\n\n\t /**\n\t * Rotates this word n bits to the right.\n\t *\n\t * @param {number} n The number of bits to rotate.\n\t *\n\t * @return {X64Word} A new x64-Word object after rotating.\n\t *\n\t * @example\n\t *\n\t * var rotated = x64Word.rotR(7);\n\t */\n\t // rotR: function (n) {\n\t // return this.shiftR(n).or(this.shiftL(64 - n));\n\t // },\n\n\t /**\n\t * Adds this word with the passed word.\n\t *\n\t * @param {X64Word} word The x64-Word to add with this word.\n\t *\n\t * @return {X64Word} A new x64-Word object after adding.\n\t *\n\t * @example\n\t *\n\t * var added = x64Word.add(anotherX64Word);\n\t */\n\t // add: function (word) {\n\t // var low = (this.low + word.low) | 0;\n\t // var carry = (low >>> 0) < (this.low >>> 0) ? 1 : 0;\n\t // var high = (this.high + word.high + carry) | 0;\n\n\t // return X64Word.create(high, low);\n\t // }\n\t });\n\n\t /**\n\t * An array of 64-bit words.\n\t *\n\t * @property {Array} words The array of CryptoJS.x64.Word objects.\n\t * @property {number} sigBytes The number of significant bytes in this word array.\n\t */\n\t var X64WordArray = C_x64.WordArray = Base.extend({\n\t /**\n\t * Initializes a newly created word array.\n\t *\n\t * @param {Array} words (Optional) An array of CryptoJS.x64.Word objects.\n\t * @param {number} sigBytes (Optional) The number of significant bytes in the words.\n\t *\n\t * @example\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create();\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ]);\n\t *\n\t * var wordArray = CryptoJS.x64.WordArray.create([\n\t * CryptoJS.x64.Word.create(0x00010203, 0x04050607),\n\t * CryptoJS.x64.Word.create(0x18191a1b, 0x1c1d1e1f)\n\t * ], 10);\n\t */\n\t init: function (words, sigBytes) {\n\t words = this.words = words || [];\n\n\t if (sigBytes != undefined) {\n\t this.sigBytes = sigBytes;\n\t } else {\n\t this.sigBytes = words.length * 8;\n\t }\n\t },\n\n\t /**\n\t * Converts this 64-bit word array to a 32-bit word array.\n\t *\n\t * @return {CryptoJS.lib.WordArray} This word array's data as a 32-bit word array.\n\t *\n\t * @example\n\t *\n\t * var x32WordArray = x64WordArray.toX32();\n\t */\n\t toX32: function () {\n\t // Shortcuts\n\t var x64Words = this.words;\n\t var x64WordsLength = x64Words.length;\n\n\t // Convert\n\t var x32Words = [];\n\t for (var i = 0; i < x64WordsLength; i++) {\n\t var x64Word = x64Words[i];\n\t x32Words.push(x64Word.high);\n\t x32Words.push(x64Word.low);\n\t }\n\n\t return X32WordArray.create(x32Words, this.sigBytes);\n\t },\n\n\t /**\n\t * Creates a copy of this word array.\n\t *\n\t * @return {X64WordArray} The clone.\n\t *\n\t * @example\n\t *\n\t * var clone = x64WordArray.clone();\n\t */\n\t clone: function () {\n\t var clone = Base.clone.call(this);\n\n\t // Clone \"words\" array\n\t var words = clone.words = this.words.slice(0);\n\n\t // Clone each X64Word object\n\t var wordsLength = words.length;\n\t for (var i = 0; i < wordsLength; i++) {\n\t words[i] = words[i].clone();\n\t }\n\n\t return clone;\n\t }\n\t });\n\t}());\n\n\n\treturn CryptoJS;\n\n}));", + "/*! bignumber.js v2.0.7 https://github.com/MikeMcl/bignumber.js/LICENCE */\n\n;(function (global) {\n 'use strict';\n\n /*\n bignumber.js v2.0.7\n A JavaScript library for arbitrary-precision arithmetic.\n https://github.com/MikeMcl/bignumber.js\n Copyright (c) 2015 Michael Mclaughlin \n MIT Expat Licence\n */\n\n\n var BigNumber, crypto, parseNumeric,\n isNumeric = /^-?(\\d+(\\.\\d*)?|\\.\\d+)(e[+-]?\\d+)?$/i,\n mathceil = Math.ceil,\n mathfloor = Math.floor,\n notBool = ' not a boolean or binary digit',\n roundingMode = 'rounding mode',\n tooManyDigits = 'number type has more than 15 significant digits',\n ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_',\n BASE = 1e14,\n LOG_BASE = 14,\n MAX_SAFE_INTEGER = 0x1fffffffffffff, // 2^53 - 1\n // MAX_INT32 = 0x7fffffff, // 2^31 - 1\n POWS_TEN = [1, 10, 100, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, 1e10, 1e11, 1e12, 1e13],\n SQRT_BASE = 1e7,\n\n /*\n * The limit on the value of DECIMAL_PLACES, TO_EXP_NEG, TO_EXP_POS, MIN_EXP, MAX_EXP, and\n * the arguments to toExponential, toFixed, toFormat, and toPrecision, beyond which an\n * exception is thrown (if ERRORS is true).\n */\n MAX = 1E9; // 0 to MAX_INT32\n\n\n /*\n * Create and return a BigNumber constructor.\n */\n function another(configObj) {\n var div,\n\n // id tracks the caller function, so its name can be included in error messages.\n id = 0,\n P = BigNumber.prototype,\n ONE = new BigNumber(1),\n\n\n /********************************* EDITABLE DEFAULTS **********************************/\n\n\n /*\n * The default values below must be integers within the inclusive ranges stated.\n * The values can also be changed at run-time using BigNumber.config.\n */\n\n // The maximum number of decimal places for operations involving division.\n DECIMAL_PLACES = 20, // 0 to MAX\n\n /*\n * The rounding mode used when rounding to the above decimal places, and when using\n * toExponential, toFixed, toFormat and toPrecision, and round (default value).\n * UP 0 Away from zero.\n * DOWN 1 Towards zero.\n * CEIL 2 Towards +Infinity.\n * FLOOR 3 Towards -Infinity.\n * HALF_UP 4 Towards nearest neighbour. If equidistant, up.\n * HALF_DOWN 5 Towards nearest neighbour. If equidistant, down.\n * HALF_EVEN 6 Towards nearest neighbour. If equidistant, towards even neighbour.\n * HALF_CEIL 7 Towards nearest neighbour. If equidistant, towards +Infinity.\n * HALF_FLOOR 8 Towards nearest neighbour. If equidistant, towards -Infinity.\n */\n ROUNDING_MODE = 4, // 0 to 8\n\n // EXPONENTIAL_AT : [TO_EXP_NEG , TO_EXP_POS]\n\n // The exponent value at and beneath which toString returns exponential notation.\n // Number type: -7\n TO_EXP_NEG = -7, // 0 to -MAX\n\n // The exponent value at and above which toString returns exponential notation.\n // Number type: 21\n TO_EXP_POS = 21, // 0 to MAX\n\n // RANGE : [MIN_EXP, MAX_EXP]\n\n // The minimum exponent value, beneath which underflow to zero occurs.\n // Number type: -324 (5e-324)\n MIN_EXP = -1e7, // -1 to -MAX\n\n // The maximum exponent value, above which overflow to Infinity occurs.\n // Number type: 308 (1.7976931348623157e+308)\n // For MAX_EXP > 1e7, e.g. new BigNumber('1e100000000').plus(1) may be slow.\n MAX_EXP = 1e7, // 1 to MAX\n\n // Whether BigNumber Errors are ever thrown.\n ERRORS = true, // true or false\n\n // Change to intValidatorNoErrors if ERRORS is false.\n isValidInt = intValidatorWithErrors, // intValidatorWithErrors/intValidatorNoErrors\n\n // Whether to use cryptographically-secure random number generation, if available.\n CRYPTO = false, // true or false\n\n /*\n * The modulo mode used when calculating the modulus: a mod n.\n * The quotient (q = a / n) is calculated according to the corresponding rounding mode.\n * The remainder (r) is calculated as: r = a - n * q.\n *\n * UP 0 The remainder is positive if the dividend is negative, else is negative.\n * DOWN 1 The remainder has the same sign as the dividend.\n * This modulo mode is commonly known as 'truncated division' and is\n * equivalent to (a % n) in JavaScript.\n * FLOOR 3 The remainder has the same sign as the divisor (Python %).\n * HALF_EVEN 6 This modulo mode implements the IEEE 754 remainder function.\n * EUCLID 9 Euclidian division. q = sign(n) * floor(a / abs(n)).\n * The remainder is always positive.\n *\n * The truncated division, floored division, Euclidian division and IEEE 754 remainder\n * modes are commonly used for the modulus operation.\n * Although the other rounding modes can also be used, they may not give useful results.\n */\n MODULO_MODE = 1, // 0 to 9\n\n // The maximum number of significant digits of the result of the toPower operation.\n // If POW_PRECISION is 0, there will be unlimited significant digits.\n POW_PRECISION = 100, // 0 to MAX\n\n // The format specification used by the BigNumber.prototype.toFormat method.\n FORMAT = {\n decimalSeparator: '.',\n groupSeparator: ',',\n groupSize: 3,\n secondaryGroupSize: 0,\n fractionGroupSeparator: '\\xA0', // non-breaking space\n fractionGroupSize: 0\n };\n\n\n /******************************************************************************************/\n\n\n // CONSTRUCTOR\n\n\n /*\n * The BigNumber constructor and exported function.\n * Create and return a new instance of a BigNumber object.\n *\n * n {number|string|BigNumber} A numeric value.\n * [b] {number} The base of n. Integer, 2 to 64 inclusive.\n */\n function BigNumber( n, b ) {\n var c, e, i, num, len, str,\n x = this;\n\n // Enable constructor usage without new.\n if ( !( x instanceof BigNumber ) ) {\n\n // 'BigNumber() constructor call without new: {n}'\n if (ERRORS) raise( 26, 'constructor call without new', n );\n return new BigNumber( n, b );\n }\n\n // 'new BigNumber() base not an integer: {b}'\n // 'new BigNumber() base out of range: {b}'\n if ( b == null || !isValidInt( b, 2, 64, id, 'base' ) ) {\n\n // Duplicate.\n if ( n instanceof BigNumber ) {\n x.s = n.s;\n x.e = n.e;\n x.c = ( n = n.c ) ? n.slice() : n;\n id = 0;\n return;\n }\n\n if ( ( num = typeof n == 'number' ) && n * 0 == 0 ) {\n x.s = 1 / n < 0 ? ( n = -n, -1 ) : 1;\n\n // Fast path for integers.\n if ( n === ~~n ) {\n for ( e = 0, i = n; i >= 10; i /= 10, e++ );\n x.e = e;\n x.c = [n];\n id = 0;\n return;\n }\n\n str = n + '';\n } else {\n if ( !isNumeric.test( str = n + '' ) ) return parseNumeric( x, str, num );\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n } else {\n b = b | 0;\n str = n + '';\n\n // Ensure return value is rounded to DECIMAL_PLACES as with other bases.\n // Allow exponential notation to be used with base 10 argument.\n if ( b == 10 ) {\n x = new BigNumber( n instanceof BigNumber ? n : str );\n return round( x, DECIMAL_PLACES + x.e + 1, ROUNDING_MODE );\n }\n\n // Avoid potential interpretation of Infinity and NaN as base 44+ values.\n // Any number in exponential form will fail due to the [Ee][+-].\n if ( ( num = typeof n == 'number' ) && n * 0 != 0 ||\n !( new RegExp( '^-?' + ( c = '[' + ALPHABET.slice( 0, b ) + ']+' ) +\n '(?:\\\\.' + c + ')?$',b < 37 ? 'i' : '' ) ).test(str) ) {\n return parseNumeric( x, str, num, b );\n }\n\n if (num) {\n x.s = 1 / n < 0 ? ( str = str.slice(1), -1 ) : 1;\n\n if ( ERRORS && str.replace( /^0\\.0*|\\./, '' ).length > 15 ) {\n\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n raise( id, tooManyDigits, n );\n }\n\n // Prevent later check for length on converted number.\n num = false;\n } else {\n x.s = str.charCodeAt(0) === 45 ? ( str = str.slice(1), -1 ) : 1;\n }\n\n str = convertBase( str, 10, b, x.s );\n }\n\n // Decimal point?\n if ( ( e = str.indexOf('.') ) > -1 ) str = str.replace( '.', '' );\n\n // Exponential form?\n if ( ( i = str.search( /e/i ) ) > 0 ) {\n\n // Determine exponent.\n if ( e < 0 ) e = i;\n e += +str.slice( i + 1 );\n str = str.substring( 0, i );\n } else if ( e < 0 ) {\n\n // Integer.\n e = str.length;\n }\n\n // Determine leading zeros.\n for ( i = 0; str.charCodeAt(i) === 48; i++ );\n\n // Determine trailing zeros.\n for ( len = str.length; str.charCodeAt(--len) === 48; );\n str = str.slice( i, len + 1 );\n\n if (str) {\n len = str.length;\n\n // Disallow numbers with over 15 significant digits if number type.\n // 'new BigNumber() number type has more than 15 significant digits: {n}'\n if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );\n\n e = e - i - 1;\n\n // Overflow?\n if ( e > MAX_EXP ) {\n\n // Infinity.\n x.c = x.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n x.c = [ x.e = 0 ];\n } else {\n x.e = e;\n x.c = [];\n\n // Transform base\n\n // e is the base 10 exponent.\n // i is where to slice str to get the first element of the coefficient array.\n i = ( e + 1 ) % LOG_BASE;\n if ( e < 0 ) i += LOG_BASE;\n\n if ( i < len ) {\n if (i) x.c.push( +str.slice( 0, i ) );\n\n for ( len -= LOG_BASE; i < len; ) {\n x.c.push( +str.slice( i, i += LOG_BASE ) );\n }\n\n str = str.slice(i);\n i = LOG_BASE - str.length;\n } else {\n i -= len;\n }\n\n for ( ; i--; str += '0' );\n x.c.push( +str );\n }\n } else {\n\n // Zero.\n x.c = [ x.e = 0 ];\n }\n\n id = 0;\n }\n\n\n // CONSTRUCTOR PROPERTIES\n\n\n BigNumber.another = another;\n\n BigNumber.ROUND_UP = 0;\n BigNumber.ROUND_DOWN = 1;\n BigNumber.ROUND_CEIL = 2;\n BigNumber.ROUND_FLOOR = 3;\n BigNumber.ROUND_HALF_UP = 4;\n BigNumber.ROUND_HALF_DOWN = 5;\n BigNumber.ROUND_HALF_EVEN = 6;\n BigNumber.ROUND_HALF_CEIL = 7;\n BigNumber.ROUND_HALF_FLOOR = 8;\n BigNumber.EUCLID = 9;\n\n\n /*\n * Configure infrequently-changing library-wide settings.\n *\n * Accept an object or an argument list, with one or many of the following properties or\n * parameters respectively:\n *\n * DECIMAL_PLACES {number} Integer, 0 to MAX inclusive\n * ROUNDING_MODE {number} Integer, 0 to 8 inclusive\n * EXPONENTIAL_AT {number|number[]} Integer, -MAX to MAX inclusive or\n * [integer -MAX to 0 incl., 0 to MAX incl.]\n * RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n * [integer -MAX to -1 incl., integer 1 to MAX incl.]\n * ERRORS {boolean|number} true, false, 1 or 0\n * CRYPTO {boolean|number} true, false, 1 or 0\n * MODULO_MODE {number} 0 to 9 inclusive\n * POW_PRECISION {number} 0 to MAX inclusive\n * FORMAT {object} See BigNumber.prototype.toFormat\n * decimalSeparator {string}\n * groupSeparator {string}\n * groupSize {number}\n * secondaryGroupSize {number}\n * fractionGroupSeparator {string}\n * fractionGroupSize {number}\n *\n * (The values assigned to the above FORMAT object properties are not checked for validity.)\n *\n * E.g.\n * BigNumber.config(20, 4) is equivalent to\n * BigNumber.config({ DECIMAL_PLACES : 20, ROUNDING_MODE : 4 })\n *\n * Ignore properties/parameters set to null or undefined.\n * Return an object with the properties current values.\n */\n BigNumber.config = function () {\n var v, p,\n i = 0,\n r = {},\n a = arguments,\n o = a[0],\n has = o && typeof o == 'object'\n ? function () { if ( o.hasOwnProperty(p) ) return ( v = o[p] ) != null; }\n : function () { if ( a.length > i ) return ( v = a[i++] ) != null; };\n\n // DECIMAL_PLACES {number} Integer, 0 to MAX inclusive.\n // 'config() DECIMAL_PLACES not an integer: {v}'\n // 'config() DECIMAL_PLACES out of range: {v}'\n if ( has( p = 'DECIMAL_PLACES' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n DECIMAL_PLACES = v | 0;\n }\n r[p] = DECIMAL_PLACES;\n\n // ROUNDING_MODE {number} Integer, 0 to 8 inclusive.\n // 'config() ROUNDING_MODE not an integer: {v}'\n // 'config() ROUNDING_MODE out of range: {v}'\n if ( has( p = 'ROUNDING_MODE' ) && isValidInt( v, 0, 8, 2, p ) ) {\n ROUNDING_MODE = v | 0;\n }\n r[p] = ROUNDING_MODE;\n\n // EXPONENTIAL_AT {number|number[]}\n // Integer, -MAX to MAX inclusive or [integer -MAX to 0 inclusive, 0 to MAX inclusive].\n // 'config() EXPONENTIAL_AT not an integer: {v}'\n // 'config() EXPONENTIAL_AT out of range: {v}'\n if ( has( p = 'EXPONENTIAL_AT' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, 0, 2, p ) && isValidInt( v[1], 0, MAX, 2, p ) ) {\n TO_EXP_NEG = v[0] | 0;\n TO_EXP_POS = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n TO_EXP_NEG = -( TO_EXP_POS = ( v < 0 ? -v : v ) | 0 );\n }\n }\n r[p] = [ TO_EXP_NEG, TO_EXP_POS ];\n\n // RANGE {number|number[]} Non-zero integer, -MAX to MAX inclusive or\n // [integer -MAX to -1 inclusive, integer 1 to MAX inclusive].\n // 'config() RANGE not an integer: {v}'\n // 'config() RANGE cannot be zero: {v}'\n // 'config() RANGE out of range: {v}'\n if ( has( p = 'RANGE' ) ) {\n\n if ( isArray(v) ) {\n if ( isValidInt( v[0], -MAX, -1, 2, p ) && isValidInt( v[1], 1, MAX, 2, p ) ) {\n MIN_EXP = v[0] | 0;\n MAX_EXP = v[1] | 0;\n }\n } else if ( isValidInt( v, -MAX, MAX, 2, p ) ) {\n if ( v | 0 ) MIN_EXP = -( MAX_EXP = ( v < 0 ? -v : v ) | 0 );\n else if (ERRORS) raise( 2, p + ' cannot be zero', v );\n }\n }\n r[p] = [ MIN_EXP, MAX_EXP ];\n\n // ERRORS {boolean|number} true, false, 1 or 0.\n // 'config() ERRORS not a boolean or binary digit: {v}'\n if ( has( p = 'ERRORS' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n id = 0;\n isValidInt = ( ERRORS = !!v ) ? intValidatorWithErrors : intValidatorNoErrors;\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = ERRORS;\n\n // CRYPTO {boolean|number} true, false, 1 or 0.\n // 'config() CRYPTO not a boolean or binary digit: {v}'\n // 'config() crypto unavailable: {crypto}'\n if ( has( p = 'CRYPTO' ) ) {\n\n if ( v === !!v || v === 1 || v === 0 ) {\n CRYPTO = !!( v && crypto && typeof crypto == 'object' );\n if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );\n } else if (ERRORS) {\n raise( 2, p + notBool, v );\n }\n }\n r[p] = CRYPTO;\n\n // MODULO_MODE {number} Integer, 0 to 9 inclusive.\n // 'config() MODULO_MODE not an integer: {v}'\n // 'config() MODULO_MODE out of range: {v}'\n if ( has( p = 'MODULO_MODE' ) && isValidInt( v, 0, 9, 2, p ) ) {\n MODULO_MODE = v | 0;\n }\n r[p] = MODULO_MODE;\n\n // POW_PRECISION {number} Integer, 0 to MAX inclusive.\n // 'config() POW_PRECISION not an integer: {v}'\n // 'config() POW_PRECISION out of range: {v}'\n if ( has( p = 'POW_PRECISION' ) && isValidInt( v, 0, MAX, 2, p ) ) {\n POW_PRECISION = v | 0;\n }\n r[p] = POW_PRECISION;\n\n // FORMAT {object}\n // 'config() FORMAT not an object: {v}'\n if ( has( p = 'FORMAT' ) ) {\n\n if ( typeof v == 'object' ) {\n FORMAT = v;\n } else if (ERRORS) {\n raise( 2, p + ' not an object', v );\n }\n }\n r[p] = FORMAT;\n\n return r;\n };\n\n\n /*\n * Return a new BigNumber whose value is the maximum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.max = function () { return maxOrMin( arguments, P.lt ); };\n\n\n /*\n * Return a new BigNumber whose value is the minimum of the arguments.\n *\n * arguments {number|string|BigNumber}\n */\n BigNumber.min = function () { return maxOrMin( arguments, P.gt ); };\n\n\n /*\n * Return a new BigNumber with a random value equal to or greater than 0 and less than 1,\n * and with dp, or DECIMAL_PLACES if dp is omitted, decimal places (or less if trailing\n * zeros are produced).\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n *\n * 'random() decimal places not an integer: {dp}'\n * 'random() decimal places out of range: {dp}'\n * 'random() crypto unavailable: {crypto}'\n */\n BigNumber.random = (function () {\n var pow2_53 = 0x20000000000000;\n\n // Return a 53 bit integer n, where 0 <= n < 9007199254740992.\n // Check if Math.random() produces more than 32 bits of randomness.\n // If it does, assume at least 53 bits are produced, otherwise assume at least 30 bits.\n // 0x40000000 is 2^30, 0x800000 is 2^23, 0x1fffff is 2^21 - 1.\n var random53bitInt = (Math.random() * pow2_53) & 0x1fffff\n ? function () { return mathfloor( Math.random() * pow2_53 ); }\n : function () { return ((Math.random() * 0x40000000 | 0) * 0x800000) +\n (Math.random() * 0x800000 | 0); };\n\n return function (dp) {\n var a, b, e, k, v,\n i = 0,\n c = [],\n rand = new BigNumber(ONE);\n\n dp = dp == null || !isValidInt( dp, 0, MAX, 14 ) ? DECIMAL_PLACES : dp | 0;\n k = mathceil( dp / LOG_BASE );\n\n if (CRYPTO) {\n\n // Browsers supporting crypto.getRandomValues.\n if ( crypto && crypto.getRandomValues ) {\n\n a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );\n\n for ( ; i < k; ) {\n\n // 53 bits:\n // ((Math.pow(2, 32) - 1) * Math.pow(2, 21)).toString(2)\n // 11111 11111111 11111111 11111111 11100000 00000000 00000000\n // ((Math.pow(2, 32) - 1) >>> 11).toString(2)\n // 11111 11111111 11111111\n // 0x20000 is 2^21.\n v = a[i] * 0x20000 + (a[i + 1] >>> 11);\n\n // Rejection sampling:\n // 0 <= v < 9007199254740992\n // Probability that v >= 9e15, is\n // 7199254740992 / 9007199254740992 ~= 0.0008, i.e. 1 in 1251\n if ( v >= 9e15 ) {\n b = crypto.getRandomValues( new Uint32Array(2) );\n a[i] = b[0];\n a[i + 1] = b[1];\n } else {\n\n // 0 <= v <= 8999999999999999\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 2;\n }\n }\n i = k / 2;\n\n // Node.js supporting crypto.randomBytes.\n } else if ( crypto && crypto.randomBytes ) {\n\n // buffer\n a = crypto.randomBytes( k *= 7 );\n\n for ( ; i < k; ) {\n\n // 0x1000000000000 is 2^48, 0x10000000000 is 2^40\n // 0x100000000 is 2^32, 0x1000000 is 2^24\n // 11111 11111111 11111111 11111111 11111111 11111111 11111111\n // 0 <= v < 9007199254740992\n v = ( ( a[i] & 31 ) * 0x1000000000000 ) + ( a[i + 1] * 0x10000000000 ) +\n ( a[i + 2] * 0x100000000 ) + ( a[i + 3] * 0x1000000 ) +\n ( a[i + 4] << 16 ) + ( a[i + 5] << 8 ) + a[i + 6];\n\n if ( v >= 9e15 ) {\n crypto.randomBytes(7).copy( a, i );\n } else {\n\n // 0 <= (v % 1e14) <= 99999999999999\n c.push( v % 1e14 );\n i += 7;\n }\n }\n i = k / 7;\n } else if (ERRORS) {\n raise( 14, 'crypto unavailable', crypto );\n }\n }\n\n // Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.\n if (!i) {\n\n for ( ; i < k; ) {\n v = random53bitInt();\n if ( v < 9e15 ) c[i++] = v % 1e14;\n }\n }\n\n k = c[--i];\n dp %= LOG_BASE;\n\n // Convert trailing digits to zeros according to dp.\n if ( k && dp ) {\n v = POWS_TEN[LOG_BASE - dp];\n c[i] = mathfloor( k / v ) * v;\n }\n\n // Remove trailing elements which are zero.\n for ( ; c[i] === 0; c.pop(), i-- );\n\n // Zero?\n if ( i < 0 ) {\n c = [ e = 0 ];\n } else {\n\n // Remove leading elements which are zero and adjust exponent accordingly.\n for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);\n\n // Count the digits of the first element of c to determine leading zeros, and...\n for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);\n\n // adjust the exponent accordingly.\n if ( i < LOG_BASE ) e -= LOG_BASE - i;\n }\n\n rand.e = e;\n rand.c = c;\n return rand;\n };\n })();\n\n\n // PRIVATE FUNCTIONS\n\n\n // Convert a numeric string of baseIn to a numeric string of baseOut.\n function convertBase( str, baseOut, baseIn, sign ) {\n var d, e, k, r, x, xc, y,\n i = str.indexOf( '.' ),\n dp = DECIMAL_PLACES,\n rm = ROUNDING_MODE;\n\n if ( baseIn < 37 ) str = str.toLowerCase();\n\n // Non-integer.\n if ( i >= 0 ) {\n k = POW_PRECISION;\n\n // Unlimited precision.\n POW_PRECISION = 0;\n str = str.replace( '.', '' );\n y = new BigNumber(baseIn);\n x = y.pow( str.length - i );\n POW_PRECISION = k;\n\n // Convert str as if an integer, then restore the fraction part by dividing the\n // result by its base raised to a power.\n y.c = toBaseOut( toFixedPoint( coeffToString( x.c ), x.e ), 10, baseOut );\n y.e = y.c.length;\n }\n\n // Convert the number as integer.\n xc = toBaseOut( str, baseIn, baseOut );\n e = k = xc.length;\n\n // Remove trailing zeros.\n for ( ; xc[--k] == 0; xc.pop() );\n if ( !xc[0] ) return '0';\n\n if ( i < 0 ) {\n --e;\n } else {\n x.c = xc;\n x.e = e;\n\n // sign is needed for correct rounding.\n x.s = sign;\n x = div( x, y, dp, rm, baseOut );\n xc = x.c;\n r = x.r;\n e = x.e;\n }\n\n d = e + dp + 1;\n\n // The rounding digit, i.e. the digit to the right of the digit that may be rounded up.\n i = xc[d];\n k = baseOut / 2;\n r = r || d < 0 || xc[d + 1] != null;\n\n r = rm < 4 ? ( i != null || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : i > k || i == k &&( rm == 4 || r || rm == 6 && xc[d - 1] & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( d < 1 || !xc[0] ) {\n\n // 1^-dp or 0.\n str = r ? toFixedPoint( '1', -dp ) : '0';\n } else {\n xc.length = d;\n\n if (r) {\n\n // Rounding up may mean the previous digit has to be rounded up and so on.\n for ( --baseOut; ++xc[--d] > baseOut; ) {\n xc[d] = 0;\n\n if ( !d ) {\n ++e;\n xc.unshift(1);\n }\n }\n }\n\n // Determine trailing zeros.\n for ( k = xc.length; !xc[--k]; );\n\n // E.g. [4, 11, 15] becomes 4bf.\n for ( i = 0, str = ''; i <= k; str += ALPHABET.charAt( xc[i++] ) );\n str = toFixedPoint( str, e );\n }\n\n // The caller will add the sign.\n return str;\n }\n\n\n // Perform division in the specified base. Called by div and convertBase.\n div = (function () {\n\n // Assume non-zero x and k.\n function multiply( x, k, base ) {\n var m, temp, xlo, xhi,\n carry = 0,\n i = x.length,\n klo = k % SQRT_BASE,\n khi = k / SQRT_BASE | 0;\n\n for ( x = x.slice(); i--; ) {\n xlo = x[i] % SQRT_BASE;\n xhi = x[i] / SQRT_BASE | 0;\n m = khi * xlo + xhi * klo;\n temp = klo * xlo + ( ( m % SQRT_BASE ) * SQRT_BASE ) + carry;\n carry = ( temp / base | 0 ) + ( m / SQRT_BASE | 0 ) + khi * xhi;\n x[i] = temp % base;\n }\n\n if (carry) x.unshift(carry);\n\n return x;\n }\n\n function compare( a, b, aL, bL ) {\n var i, cmp;\n\n if ( aL != bL ) {\n cmp = aL > bL ? 1 : -1;\n } else {\n\n for ( i = cmp = 0; i < aL; i++ ) {\n\n if ( a[i] != b[i] ) {\n cmp = a[i] > b[i] ? 1 : -1;\n break;\n }\n }\n }\n return cmp;\n }\n\n function subtract( a, b, aL, base ) {\n var i = 0;\n\n // Subtract b from a.\n for ( ; aL--; ) {\n a[aL] -= i;\n i = a[aL] < b[aL] ? 1 : 0;\n a[aL] = i * base + a[aL] - b[aL];\n }\n\n // Remove leading zeros.\n for ( ; !a[0] && a.length > 1; a.shift() );\n }\n\n // x: dividend, y: divisor.\n return function ( x, y, dp, rm, base ) {\n var cmp, e, i, more, n, prod, prodL, q, qc, rem, remL, rem0, xi, xL, yc0,\n yL, yz,\n s = x.s == y.s ? 1 : -1,\n xc = x.c,\n yc = y.c;\n\n // Either NaN, Infinity or 0?\n if ( !xc || !xc[0] || !yc || !yc[0] ) {\n\n return new BigNumber(\n\n // Return NaN if either NaN, or both Infinity or 0.\n !x.s || !y.s || ( xc ? yc && xc[0] == yc[0] : !yc ) ? NaN :\n\n // Return ±0 if x is ±0 or y is ±Infinity, or return ±Infinity as y is ±0.\n xc && xc[0] == 0 || !yc ? s * 0 : s / 0\n );\n }\n\n q = new BigNumber(s);\n qc = q.c = [];\n e = x.e - y.e;\n s = dp + e + 1;\n\n if ( !base ) {\n base = BASE;\n e = bitFloor( x.e / LOG_BASE ) - bitFloor( y.e / LOG_BASE );\n s = s / LOG_BASE | 0;\n }\n\n // Result exponent may be one less then the current value of e.\n // The coefficients of the BigNumbers from convertBase may have trailing zeros.\n for ( i = 0; yc[i] == ( xc[i] || 0 ); i++ );\n if ( yc[i] > ( xc[i] || 0 ) ) e--;\n\n if ( s < 0 ) {\n qc.push(1);\n more = true;\n } else {\n xL = xc.length;\n yL = yc.length;\n i = 0;\n s += 2;\n\n // Normalise xc and yc so highest order digit of yc is >= base / 2.\n\n n = mathfloor( base / ( yc[0] + 1 ) );\n\n // Not necessary, but to handle odd bases where yc[0] == ( base / 2 ) - 1.\n // if ( n > 1 || n++ == 1 && yc[0] < base / 2 ) {\n if ( n > 1 ) {\n yc = multiply( yc, n, base );\n xc = multiply( xc, n, base );\n yL = yc.length;\n xL = xc.length;\n }\n\n xi = yL;\n rem = xc.slice( 0, yL );\n remL = rem.length;\n\n // Add zeros to make remainder as long as divisor.\n for ( ; remL < yL; rem[remL++] = 0 );\n yz = yc.slice();\n yz.unshift(0);\n yc0 = yc[0];\n if ( yc[1] >= base / 2 ) yc0++;\n // Not necessary, but to prevent trial digit n > base, when using base 3.\n // else if ( base == 3 && yc0 == 1 ) yc0 = 1 + 1e-15;\n\n do {\n n = 0;\n\n // Compare divisor and remainder.\n cmp = compare( yc, rem, yL, remL );\n\n // If divisor < remainder.\n if ( cmp < 0 ) {\n\n // Calculate trial digit, n.\n\n rem0 = rem[0];\n if ( yL != remL ) rem0 = rem0 * base + ( rem[1] || 0 );\n\n // n is how many times the divisor goes into the current remainder.\n n = mathfloor( rem0 / yc0 );\n\n // Algorithm:\n // 1. product = divisor * trial digit (n)\n // 2. if product > remainder: product -= divisor, n--\n // 3. remainder -= product\n // 4. if product was < remainder at 2:\n // 5. compare new remainder and divisor\n // 6. If remainder > divisor: remainder -= divisor, n++\n\n if ( n > 1 ) {\n\n // n may be > base only when base is 3.\n if (n >= base) n = base - 1;\n\n // product = divisor * trial digit.\n prod = multiply( yc, n, base );\n prodL = prod.length;\n remL = rem.length;\n\n // Compare product and remainder.\n // If product > remainder.\n // Trial digit n too high.\n // n is 1 too high about 5% of the time, and is not known to have\n // ever been more than 1 too high.\n while ( compare( prod, rem, prodL, remL ) == 1 ) {\n n--;\n\n // Subtract divisor from product.\n subtract( prod, yL < prodL ? yz : yc, prodL, base );\n prodL = prod.length;\n cmp = 1;\n }\n } else {\n\n // n is 0 or 1, cmp is -1.\n // If n is 0, there is no need to compare yc and rem again below,\n // so change cmp to 1 to avoid it.\n // If n is 1, leave cmp as -1, so yc and rem are compared again.\n if ( n == 0 ) {\n\n // divisor < remainder, so n must be at least 1.\n cmp = n = 1;\n }\n\n // product = divisor\n prod = yc.slice();\n prodL = prod.length;\n }\n\n if ( prodL < remL ) prod.unshift(0);\n\n // Subtract product from remainder.\n subtract( rem, prod, remL, base );\n remL = rem.length;\n\n // If product was < remainder.\n if ( cmp == -1 ) {\n\n // Compare divisor and new remainder.\n // If divisor < new remainder, subtract divisor from remainder.\n // Trial digit n too low.\n // n is 1 too low about 5% of the time, and very rarely 2 too low.\n while ( compare( yc, rem, yL, remL ) < 1 ) {\n n++;\n\n // Subtract divisor from remainder.\n subtract( rem, yL < remL ? yz : yc, remL, base );\n remL = rem.length;\n }\n }\n } else if ( cmp === 0 ) {\n n++;\n rem = [0];\n } // else cmp === 1 and n will be 0\n\n // Add the next digit, n, to the result array.\n qc[i++] = n;\n\n // Update the remainder.\n if ( rem[0] ) {\n rem[remL++] = xc[xi] || 0;\n } else {\n rem = [ xc[xi] ];\n remL = 1;\n }\n } while ( ( xi++ < xL || rem[0] != null ) && s-- );\n\n more = rem[0] != null;\n\n // Leading zero?\n if ( !qc[0] ) qc.shift();\n }\n\n if ( base == BASE ) {\n\n // To calculate q.e, first get the number of digits of qc[0].\n for ( i = 1, s = qc[0]; s >= 10; s /= 10, i++ );\n round( q, dp + ( q.e = i + e * LOG_BASE - 1 ) + 1, rm, more );\n\n // Caller is convertBase.\n } else {\n q.e = e;\n q.r = +more;\n }\n\n return q;\n };\n })();\n\n\n /*\n * Return a string representing the value of BigNumber n in fixed-point or exponential\n * notation rounded to the specified decimal places or significant digits.\n *\n * n is a BigNumber.\n * i is the index of the last digit required (i.e. the digit that may be rounded up).\n * rm is the rounding mode.\n * caller is caller id: toExponential 19, toFixed 20, toFormat 21, toPrecision 24.\n */\n function format( n, i, rm, caller ) {\n var c0, e, ne, len, str;\n\n rm = rm != null && isValidInt( rm, 0, 8, caller, roundingMode )\n ? rm | 0 : ROUNDING_MODE;\n\n if ( !n.c ) return n.toString();\n c0 = n.c[0];\n ne = n.e;\n\n if ( i == null ) {\n str = coeffToString( n.c );\n str = caller == 19 || caller == 24 && ne <= TO_EXP_NEG\n ? toExponential( str, ne )\n : toFixedPoint( str, ne );\n } else {\n n = round( new BigNumber(n), i, rm );\n\n // n.e may have changed if the value was rounded up.\n e = n.e;\n\n str = coeffToString( n.c );\n len = str.length;\n\n // toPrecision returns exponential notation if the number of significant digits\n // specified is less than the number of digits necessary to represent the integer\n // part of the value in fixed-point notation.\n\n // Exponential notation.\n if ( caller == 19 || caller == 24 && ( i <= e || e <= TO_EXP_NEG ) ) {\n\n // Append zeros?\n for ( ; len < i; str += '0', len++ );\n str = toExponential( str, e );\n\n // Fixed-point notation.\n } else {\n i -= ne;\n str = toFixedPoint( str, e );\n\n // Append zeros?\n if ( e + 1 > len ) {\n if ( --i > 0 ) for ( str += '.'; i--; str += '0' );\n } else {\n i += e - len;\n if ( i > 0 ) {\n if ( e + 1 == len ) str += '.';\n for ( ; i--; str += '0' );\n }\n }\n }\n }\n\n return n.s < 0 && c0 ? '-' + str : str;\n }\n\n\n // Handle BigNumber.max and BigNumber.min.\n function maxOrMin( args, method ) {\n var m, n,\n i = 0;\n\n if ( isArray( args[0] ) ) args = args[0];\n m = new BigNumber( args[0] );\n\n for ( ; ++i < args.length; ) {\n n = new BigNumber( args[i] );\n\n // If any number is NaN, return NaN.\n if ( !n.s ) {\n m = n;\n break;\n } else if ( method.call( m, n ) ) {\n m = n;\n }\n }\n\n return m;\n }\n\n\n /*\n * Return true if n is an integer in range, otherwise throw.\n * Use for argument validation when ERRORS is true.\n */\n function intValidatorWithErrors( n, min, max, caller, name ) {\n if ( n < min || n > max || n != truncate(n) ) {\n raise( caller, ( name || 'decimal places' ) +\n ( n < min || n > max ? ' out of range' : ' not an integer' ), n );\n }\n\n return true;\n }\n\n\n /*\n * Strip trailing zeros, calculate base 10 exponent and check against MIN_EXP and MAX_EXP.\n * Called by minus, plus and times.\n */\n function normalise( n, c, e ) {\n var i = 1,\n j = c.length;\n\n // Remove trailing zeros.\n for ( ; !c[--j]; c.pop() );\n\n // Calculate the base 10 exponent. First get the number of digits of c[0].\n for ( j = c[0]; j >= 10; j /= 10, i++ );\n\n // Overflow?\n if ( ( e = i + e * LOG_BASE - 1 ) > MAX_EXP ) {\n\n // Infinity.\n n.c = n.e = null;\n\n // Underflow?\n } else if ( e < MIN_EXP ) {\n\n // Zero.\n n.c = [ n.e = 0 ];\n } else {\n n.e = e;\n n.c = c;\n }\n\n return n;\n }\n\n\n // Handle values that fail the validity test in BigNumber.\n parseNumeric = (function () {\n var basePrefix = /^(-?)0([xbo])/i,\n dotAfter = /^([^.]+)\\.$/,\n dotBefore = /^\\.([^.]+)$/,\n isInfinityOrNaN = /^-?(Infinity|NaN)$/,\n whitespaceOrPlus = /^\\s*\\+|^\\s+|\\s+$/g;\n\n return function ( x, str, num, b ) {\n var base,\n s = num ? str : str.replace( whitespaceOrPlus, '' );\n\n // No exception on ±Infinity or NaN.\n if ( isInfinityOrNaN.test(s) ) {\n x.s = isNaN(s) ? null : s < 0 ? -1 : 1;\n } else {\n if ( !num ) {\n\n // basePrefix = /^(-?)0([xbo])(?=\\w[\\w.]*$)/i\n s = s.replace( basePrefix, function ( m, p1, p2 ) {\n base = ( p2 = p2.toLowerCase() ) == 'x' ? 16 : p2 == 'b' ? 2 : 8;\n return !b || b == base ? p1 : m;\n });\n\n if (b) {\n base = b;\n\n // E.g. '1.' to '1', '.1' to '0.1'\n s = s.replace( dotAfter, '$1' ).replace( dotBefore, '0.$1' );\n }\n\n if ( str != s ) return new BigNumber( s, base );\n }\n\n // 'new BigNumber() not a number: {n}'\n // 'new BigNumber() not a base {b} number: {n}'\n if (ERRORS) raise( id, 'not a' + ( b ? ' base ' + b : '' ) + ' number', str );\n x.s = null;\n }\n\n x.c = x.e = null;\n id = 0;\n }\n })();\n\n\n // Throw a BigNumber Error.\n function raise( caller, msg, val ) {\n var error = new Error( [\n 'new BigNumber', // 0\n 'cmp', // 1\n 'config', // 2\n 'div', // 3\n 'divToInt', // 4\n 'eq', // 5\n 'gt', // 6\n 'gte', // 7\n 'lt', // 8\n 'lte', // 9\n 'minus', // 10\n 'mod', // 11\n 'plus', // 12\n 'precision', // 13\n 'random', // 14\n 'round', // 15\n 'shift', // 16\n 'times', // 17\n 'toDigits', // 18\n 'toExponential', // 19\n 'toFixed', // 20\n 'toFormat', // 21\n 'toFraction', // 22\n 'pow', // 23\n 'toPrecision', // 24\n 'toString', // 25\n 'BigNumber' // 26\n ][caller] + '() ' + msg + ': ' + val );\n\n error.name = 'BigNumber Error';\n id = 0;\n throw error;\n }\n\n\n /*\n * Round x to sd significant digits using rounding mode rm. Check for over/under-flow.\n * If r is truthy, it is known that there are more digits after the rounding digit.\n */\n function round( x, sd, rm, r ) {\n var d, i, j, k, n, ni, rd,\n xc = x.c,\n pows10 = POWS_TEN;\n\n // if x is not Infinity or NaN...\n if (xc) {\n\n // rd is the rounding digit, i.e. the digit after the digit that may be rounded up.\n // n is a base 1e14 number, the value of the element of array x.c containing rd.\n // ni is the index of n within x.c.\n // d is the number of digits of n.\n // i is the index of rd within n including leading zeros.\n // j is the actual index of rd within n (if < 0, rd is a leading zero).\n out: {\n\n // Get the number of digits of the first element of xc.\n for ( d = 1, k = xc[0]; k >= 10; k /= 10, d++ );\n i = sd - d;\n\n // If the rounding digit is in the first element of xc...\n if ( i < 0 ) {\n i += LOG_BASE;\n j = sd;\n n = xc[ ni = 0 ];\n\n // Get the rounding digit at index j of n.\n rd = n / pows10[ d - j - 1 ] % 10 | 0;\n } else {\n ni = mathceil( ( i + 1 ) / LOG_BASE );\n\n if ( ni >= xc.length ) {\n\n if (r) {\n\n // Needed by sqrt.\n for ( ; xc.length <= ni; xc.push(0) );\n n = rd = 0;\n d = 1;\n i %= LOG_BASE;\n j = i - LOG_BASE + 1;\n } else {\n break out;\n }\n } else {\n n = k = xc[ni];\n\n // Get the number of digits of n.\n for ( d = 1; k >= 10; k /= 10, d++ );\n\n // Get the index of rd within n.\n i %= LOG_BASE;\n\n // Get the index of rd within n, adjusted for leading zeros.\n // The number of leading zeros of n is given by LOG_BASE - d.\n j = i - LOG_BASE + d;\n\n // Get the rounding digit at index j of n.\n rd = j < 0 ? 0 : n / pows10[ d - j - 1 ] % 10 | 0;\n }\n }\n\n r = r || sd < 0 ||\n\n // Are there any non-zero digits after the rounding digit?\n // The expression n % pows10[ d - j - 1 ] returns all digits of n to the right\n // of the digit at j, e.g. if n is 908714 and j is 2, the expression gives 714.\n xc[ni + 1] != null || ( j < 0 ? n : n % pows10[ d - j - 1 ] );\n\n r = rm < 4\n ? ( rd || r ) && ( rm == 0 || rm == ( x.s < 0 ? 3 : 2 ) )\n : rd > 5 || rd == 5 && ( rm == 4 || r || rm == 6 &&\n\n // Check whether the digit to the left of the rounding digit is odd.\n ( ( i > 0 ? j > 0 ? n / pows10[ d - j ] : 0 : xc[ni - 1] ) % 10 ) & 1 ||\n rm == ( x.s < 0 ? 8 : 7 ) );\n\n if ( sd < 1 || !xc[0] ) {\n xc.length = 0;\n\n if (r) {\n\n // Convert sd to decimal places.\n sd -= x.e + 1;\n\n // 1, 0.1, 0.01, 0.001, 0.0001 etc.\n xc[0] = pows10[ sd % LOG_BASE ];\n x.e = -sd || 0;\n } else {\n\n // Zero.\n xc[0] = x.e = 0;\n }\n\n return x;\n }\n\n // Remove excess digits.\n if ( i == 0 ) {\n xc.length = ni;\n k = 1;\n ni--;\n } else {\n xc.length = ni + 1;\n k = pows10[ LOG_BASE - i ];\n\n // E.g. 56700 becomes 56000 if 7 is the rounding digit.\n // j > 0 means i > number of leading zeros of n.\n xc[ni] = j > 0 ? mathfloor( n / pows10[ d - j ] % pows10[j] ) * k : 0;\n }\n\n // Round up?\n if (r) {\n\n for ( ; ; ) {\n\n // If the digit to be rounded up is in the first element of xc...\n if ( ni == 0 ) {\n\n // i will be the length of xc[0] before k is added.\n for ( i = 1, j = xc[0]; j >= 10; j /= 10, i++ );\n j = xc[0] += k;\n for ( k = 1; j >= 10; j /= 10, k++ );\n\n // if i != k the length has increased.\n if ( i != k ) {\n x.e++;\n if ( xc[0] == BASE ) xc[0] = 1;\n }\n\n break;\n } else {\n xc[ni] += k;\n if ( xc[ni] != BASE ) break;\n xc[ni--] = 0;\n k = 1;\n }\n }\n }\n\n // Remove trailing zeros.\n for ( i = xc.length; xc[--i] === 0; xc.pop() );\n }\n\n // Overflow? Infinity.\n if ( x.e > MAX_EXP ) {\n x.c = x.e = null;\n\n // Underflow? Zero.\n } else if ( x.e < MIN_EXP ) {\n x.c = [ x.e = 0 ];\n }\n }\n\n return x;\n }\n\n\n // PROTOTYPE/INSTANCE METHODS\n\n\n /*\n * Return a new BigNumber whose value is the absolute value of this BigNumber.\n */\n P.absoluteValue = P.abs = function () {\n var x = new BigNumber(this);\n if ( x.s < 0 ) x.s = 1;\n return x;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of Infinity.\n */\n P.ceil = function () {\n return round( new BigNumber(this), this.e + 1, 2 );\n };\n\n\n /*\n * Return\n * 1 if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * -1 if the value of this BigNumber is less than the value of BigNumber(y, b),\n * 0 if they have the same value,\n * or null if the value of either is NaN.\n */\n P.comparedTo = P.cmp = function ( y, b ) {\n id = 1;\n return compare( this, new BigNumber( y, b ) );\n };\n\n\n /*\n * Return the number of decimal places of the value of this BigNumber, or null if the value\n * of this BigNumber is ±Infinity or NaN.\n */\n P.decimalPlaces = P.dp = function () {\n var n, v,\n c = this.c;\n\n if ( !c ) return null;\n n = ( ( v = c.length - 1 ) - bitFloor( this.e / LOG_BASE ) ) * LOG_BASE;\n\n // Subtract the number of trailing zeros of the last number.\n if ( v = c[v] ) for ( ; v % 10 == 0; v /= 10, n-- );\n if ( n < 0 ) n = 0;\n\n return n;\n };\n\n\n /*\n * n / 0 = I\n * n / N = N\n * n / I = 0\n * 0 / n = 0\n * 0 / 0 = N\n * 0 / N = N\n * 0 / I = 0\n * N / n = N\n * N / 0 = N\n * N / N = N\n * N / I = N\n * I / n = I\n * I / 0 = I\n * I / N = N\n * I / I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber divided by the value of\n * BigNumber(y, b), rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.dividedBy = P.div = function ( y, b ) {\n id = 3;\n return div( this, new BigNumber( y, b ), DECIMAL_PLACES, ROUNDING_MODE );\n };\n\n\n /*\n * Return a new BigNumber whose value is the integer part of dividing the value of this\n * BigNumber by the value of BigNumber(y, b).\n */\n P.dividedToIntegerBy = P.divToInt = function ( y, b ) {\n id = 4;\n return div( this, new BigNumber( y, b ), 0, 1 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is equal to the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.equals = P.eq = function ( y, b ) {\n id = 5;\n return compare( this, new BigNumber( y, b ) ) === 0;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a whole\n * number in the direction of -Infinity.\n */\n P.floor = function () {\n return round( new BigNumber(this), this.e + 1, 3 );\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.greaterThan = P.gt = function ( y, b ) {\n id = 6;\n return compare( this, new BigNumber( y, b ) ) > 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is greater than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.greaterThanOrEqualTo = P.gte = function ( y, b ) {\n id = 7;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === 1 || b === 0;\n\n };\n\n\n /*\n * Return true if the value of this BigNumber is a finite number, otherwise returns false.\n */\n P.isFinite = function () {\n return !!this.c;\n };\n\n\n /*\n * Return true if the value of this BigNumber is an integer, otherwise return false.\n */\n P.isInteger = P.isInt = function () {\n return !!this.c && bitFloor( this.e / LOG_BASE ) > this.c.length - 2;\n };\n\n\n /*\n * Return true if the value of this BigNumber is NaN, otherwise returns false.\n */\n P.isNaN = function () {\n return !this.s;\n };\n\n\n /*\n * Return true if the value of this BigNumber is negative, otherwise returns false.\n */\n P.isNegative = P.isNeg = function () {\n return this.s < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is 0 or -0, otherwise returns false.\n */\n P.isZero = function () {\n return !!this.c && this.c[0] == 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than the value of BigNumber(y, b),\n * otherwise returns false.\n */\n P.lessThan = P.lt = function ( y, b ) {\n id = 8;\n return compare( this, new BigNumber( y, b ) ) < 0;\n };\n\n\n /*\n * Return true if the value of this BigNumber is less than or equal to the value of\n * BigNumber(y, b), otherwise returns false.\n */\n P.lessThanOrEqualTo = P.lte = function ( y, b ) {\n id = 9;\n return ( b = compare( this, new BigNumber( y, b ) ) ) === -1 || b === 0;\n };\n\n\n /*\n * n - 0 = n\n * n - N = N\n * n - I = -I\n * 0 - n = -n\n * 0 - 0 = 0\n * 0 - N = N\n * 0 - I = -I\n * N - n = N\n * N - 0 = N\n * N - N = N\n * N - I = N\n * I - n = I\n * I - 0 = I\n * I - N = N\n * I - I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber minus the value of\n * BigNumber(y, b).\n */\n P.minus = P.sub = function ( y, b ) {\n var i, j, t, xLTy,\n x = this,\n a = x.s;\n\n id = 10;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.plus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Either Infinity?\n if ( !xc || !yc ) return xc ? ( y.s = -b, y ) : new BigNumber( yc ? x : NaN );\n\n // Either zero?\n if ( !xc[0] || !yc[0] ) {\n\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n return yc[0] ? ( y.s = -b, y ) : new BigNumber( xc[0] ? x :\n\n // IEEE 754 (2008) 6.3: n - n = -0 when rounding to -Infinity\n ROUNDING_MODE == 3 ? -0 : 0 );\n }\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Determine which is the bigger number.\n if ( a = xe - ye ) {\n\n if ( xLTy = a < 0 ) {\n a = -a;\n t = xc;\n } else {\n ye = xe;\n t = yc;\n }\n\n t.reverse();\n\n // Prepend zeros to equalise exponents.\n for ( b = a; b--; t.push(0) );\n t.reverse();\n } else {\n\n // Exponents equal. Check digit by digit.\n j = ( xLTy = ( a = xc.length ) < ( b = yc.length ) ) ? a : b;\n\n for ( a = b = 0; b < j; b++ ) {\n\n if ( xc[b] != yc[b] ) {\n xLTy = xc[b] < yc[b];\n break;\n }\n }\n }\n\n // x < y? Point xc to the array of the bigger number.\n if (xLTy) t = xc, xc = yc, yc = t, y.s = -y.s;\n\n b = ( j = yc.length ) - ( i = xc.length );\n\n // Append zeros to xc if shorter.\n // No need to add zeros to yc if shorter as subtract only needs to start at yc.length.\n if ( b > 0 ) for ( ; b--; xc[i++] = 0 );\n b = BASE - 1;\n\n // Subtract yc from xc.\n for ( ; j > a; ) {\n\n if ( xc[--j] < yc[j] ) {\n for ( i = j; i && !xc[--i]; xc[i] = b );\n --xc[i];\n xc[j] += BASE;\n }\n\n xc[j] -= yc[j];\n }\n\n // Remove leading zeros and adjust exponent accordingly.\n for ( ; xc[0] == 0; xc.shift(), --ye );\n\n // Zero?\n if ( !xc[0] ) {\n\n // Following IEEE 754 (2008) 6.3,\n // n - n = +0 but n - n = -0 when rounding towards -Infinity.\n y.s = ROUNDING_MODE == 3 ? -1 : 1;\n y.c = [ y.e = 0 ];\n return y;\n }\n\n // No need to check for Infinity as +x - +y != Infinity && -x - -y != Infinity\n // for finite x and y.\n return normalise( y, xc, ye );\n };\n\n\n /*\n * n % 0 = N\n * n % N = N\n * n % I = n\n * 0 % n = 0\n * -0 % n = -0\n * 0 % 0 = N\n * 0 % N = N\n * 0 % I = 0\n * N % n = N\n * N % 0 = N\n * N % N = N\n * N % I = N\n * I % n = N\n * I % 0 = N\n * I % N = N\n * I % I = N\n *\n * Return a new BigNumber whose value is the value of this BigNumber modulo the value of\n * BigNumber(y, b). The result depends on the value of MODULO_MODE.\n */\n P.modulo = P.mod = function ( y, b ) {\n var q, s,\n x = this;\n\n id = 11;\n y = new BigNumber( y, b );\n\n // Return NaN if x is Infinity or NaN, or y is NaN or zero.\n if ( !x.c || !y.s || y.c && !y.c[0] ) {\n return new BigNumber(NaN);\n\n // Return x if y is Infinity or x is zero.\n } else if ( !y.c || x.c && !x.c[0] ) {\n return new BigNumber(x);\n }\n\n if ( MODULO_MODE == 9 ) {\n\n // Euclidian division: q = sign(y) * floor(x / abs(y))\n // r = x - qy where 0 <= r < abs(y)\n s = y.s;\n y.s = 1;\n q = div( x, y, 0, 3 );\n y.s = s;\n q.s *= s;\n } else {\n q = div( x, y, 0, MODULO_MODE );\n }\n\n return x.minus( q.times(y) );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber negated,\n * i.e. multiplied by -1.\n */\n P.negated = P.neg = function () {\n var x = new BigNumber(this);\n x.s = -x.s || null;\n return x;\n };\n\n\n /*\n * n + 0 = n\n * n + N = N\n * n + I = I\n * 0 + n = n\n * 0 + 0 = 0\n * 0 + N = N\n * 0 + I = I\n * N + n = N\n * N + 0 = N\n * N + N = N\n * N + I = N\n * I + n = I\n * I + 0 = I\n * I + N = N\n * I + I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber plus the value of\n * BigNumber(y, b).\n */\n P.plus = P.add = function ( y, b ) {\n var t,\n x = this,\n a = x.s;\n\n id = 12;\n y = new BigNumber( y, b );\n b = y.s;\n\n // Either NaN?\n if ( !a || !b ) return new BigNumber(NaN);\n\n // Signs differ?\n if ( a != b ) {\n y.s = -b;\n return x.minus(y);\n }\n\n var xe = x.e / LOG_BASE,\n ye = y.e / LOG_BASE,\n xc = x.c,\n yc = y.c;\n\n if ( !xe || !ye ) {\n\n // Return ±Infinity if either ±Infinity.\n if ( !xc || !yc ) return new BigNumber( a / 0 );\n\n // Either zero?\n // Return y if y is non-zero, x if x is non-zero, or zero if both are zero.\n if ( !xc[0] || !yc[0] ) return yc[0] ? y : new BigNumber( xc[0] ? x : a * 0 );\n }\n\n xe = bitFloor(xe);\n ye = bitFloor(ye);\n xc = xc.slice();\n\n // Prepend zeros to equalise exponents. Faster to use reverse then do unshifts.\n if ( a = xe - ye ) {\n if ( a > 0 ) {\n ye = xe;\n t = yc;\n } else {\n a = -a;\n t = xc;\n }\n\n t.reverse();\n for ( ; a--; t.push(0) );\n t.reverse();\n }\n\n a = xc.length;\n b = yc.length;\n\n // Point xc to the longer array, and b to the shorter length.\n if ( a - b < 0 ) t = yc, yc = xc, xc = t, b = a;\n\n // Only start adding at yc.length - 1 as the further digits of xc can be ignored.\n for ( a = 0; b; ) {\n a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;\n xc[b] %= BASE;\n }\n\n if (a) {\n xc.unshift(a);\n ++ye;\n }\n\n // No need to check for zero, as +x + +y != 0 && -x + -y != 0\n // ye = MAX_EXP + 1 possible\n return normalise( y, xc, ye );\n };\n\n\n /*\n * Return the number of significant digits of the value of this BigNumber.\n *\n * [z] {boolean|number} Whether to count integer-part trailing zeros: true, false, 1 or 0.\n */\n P.precision = P.sd = function (z) {\n var n, v,\n x = this,\n c = x.c;\n\n // 'precision() argument not a boolean or binary digit: {z}'\n if ( z != null && z !== !!z && z !== 1 && z !== 0 ) {\n if (ERRORS) raise( 13, 'argument' + notBool, z );\n if ( z != !!z ) z = null;\n }\n\n if ( !c ) return null;\n v = c.length - 1;\n n = v * LOG_BASE + 1;\n\n if ( v = c[v] ) {\n\n // Subtract the number of trailing zeros of the last element.\n for ( ; v % 10 == 0; v /= 10, n-- );\n\n // Add the number of digits of the first element.\n for ( v = c[0]; v >= 10; v /= 10, n++ );\n }\n\n if ( z && x.e + 1 > n ) n = x.e + 1;\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * dp decimal places using rounding mode rm, or to 0 and ROUNDING_MODE respectively if\n * omitted.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'round() decimal places out of range: {dp}'\n * 'round() decimal places not an integer: {dp}'\n * 'round() rounding mode not an integer: {rm}'\n * 'round() rounding mode out of range: {rm}'\n */\n P.round = function ( dp, rm ) {\n var n = new BigNumber(this);\n\n if ( dp == null || isValidInt( dp, 0, MAX, 15 ) ) {\n round( n, ~~dp + this.e + 1, rm == null ||\n !isValidInt( rm, 0, 8, 15, roundingMode ) ? ROUNDING_MODE : rm | 0 );\n }\n\n return n;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber shifted by k places\n * (powers of 10). Shift to the right if n > 0, and to the left if n < 0.\n *\n * k {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.\n *\n * If k is out of range and ERRORS is false, the result will be ±0 if k < 0, or ±Infinity\n * otherwise.\n *\n * 'shift() argument not an integer: {k}'\n * 'shift() argument out of range: {k}'\n */\n P.shift = function (k) {\n var n = this;\n return isValidInt( k, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 16, 'argument' )\n\n // k < 1e+21, or truncate(k) will produce exponential notation.\n ? n.times( '1e' + truncate(k) )\n : new BigNumber( n.c && n.c[0] && ( k < -MAX_SAFE_INTEGER || k > MAX_SAFE_INTEGER )\n ? n.s * ( k < 0 ? 0 : 1 / 0 )\n : n );\n };\n\n\n /*\n * sqrt(-n) = N\n * sqrt( N) = N\n * sqrt(-I) = N\n * sqrt( I) = I\n * sqrt( 0) = 0\n * sqrt(-0) = -0\n *\n * Return a new BigNumber whose value is the square root of the value of this BigNumber,\n * rounded according to DECIMAL_PLACES and ROUNDING_MODE.\n */\n P.squareRoot = P.sqrt = function () {\n var m, n, r, rep, t,\n x = this,\n c = x.c,\n s = x.s,\n e = x.e,\n dp = DECIMAL_PLACES + 4,\n half = new BigNumber('0.5');\n\n // Negative/NaN/Infinity/zero?\n if ( s !== 1 || !c || !c[0] ) {\n return new BigNumber( !s || s < 0 && ( !c || c[0] ) ? NaN : c ? x : 1 / 0 );\n }\n\n // Initial estimate.\n s = Math.sqrt( +x );\n\n // Math.sqrt underflow/overflow?\n // Pass x to Math.sqrt as integer, then adjust the exponent of the result.\n if ( s == 0 || s == 1 / 0 ) {\n n = coeffToString(c);\n if ( ( n.length + e ) % 2 == 0 ) n += '0';\n s = Math.sqrt(n);\n e = bitFloor( ( e + 1 ) / 2 ) - ( e < 0 || e % 2 );\n\n if ( s == 1 / 0 ) {\n n = '1e' + e;\n } else {\n n = s.toExponential();\n n = n.slice( 0, n.indexOf('e') + 1 ) + e;\n }\n\n r = new BigNumber(n);\n } else {\n r = new BigNumber( s + '' );\n }\n\n // Check for zero.\n // r could be zero if MIN_EXP is changed after the this value was created.\n // This would cause a division by zero (x/t) and hence Infinity below, which would cause\n // coeffToString to throw.\n if ( r.c[0] ) {\n e = r.e;\n s = e + dp;\n if ( s < 3 ) s = 0;\n\n // Newton-Raphson iteration.\n for ( ; ; ) {\n t = r;\n r = half.times( t.plus( div( x, t, dp, 1 ) ) );\n\n if ( coeffToString( t.c ).slice( 0, s ) === ( n =\n coeffToString( r.c ) ).slice( 0, s ) ) {\n\n // The exponent of r may here be one less than the final result exponent,\n // e.g 0.0009999 (e-4) --> 0.001 (e-3), so adjust s so the rounding digits\n // are indexed correctly.\n if ( r.e < e ) --s;\n n = n.slice( s - 3, s + 1 );\n\n // The 4th rounding digit may be in error by -1 so if the 4 rounding digits\n // are 9999 or 4999 (i.e. approaching a rounding boundary) continue the\n // iteration.\n if ( n == '9999' || !rep && n == '4999' ) {\n\n // On the first iteration only, check to see if rounding up gives the\n // exact result as the nines may infinitely repeat.\n if ( !rep ) {\n round( t, t.e + DECIMAL_PLACES + 2, 0 );\n\n if ( t.times(t).eq(x) ) {\n r = t;\n break;\n }\n }\n\n dp += 4;\n s += 4;\n rep = 1;\n } else {\n\n // If rounding digits are null, 0{0,4} or 50{0,3}, check for exact\n // result. If not, then there are further digits and m will be truthy.\n if ( !+n || !+n.slice(1) && n.charAt(0) == '5' ) {\n\n // Truncate to the first rounding digit.\n round( r, r.e + DECIMAL_PLACES + 2, 1 );\n m = !r.times(r).eq(x);\n }\n\n break;\n }\n }\n }\n }\n\n return round( r, r.e + DECIMAL_PLACES + 1, ROUNDING_MODE, m );\n };\n\n\n /*\n * n * 0 = 0\n * n * N = N\n * n * I = I\n * 0 * n = 0\n * 0 * 0 = 0\n * 0 * N = N\n * 0 * I = N\n * N * n = N\n * N * 0 = N\n * N * N = N\n * N * I = N\n * I * n = I\n * I * 0 = N\n * I * N = N\n * I * I = I\n *\n * Return a new BigNumber whose value is the value of this BigNumber times the value of\n * BigNumber(y, b).\n */\n P.times = P.mul = function ( y, b ) {\n var c, e, i, j, k, m, xcL, xlo, xhi, ycL, ylo, yhi, zc,\n base, sqrtBase,\n x = this,\n xc = x.c,\n yc = ( id = 17, y = new BigNumber( y, b ) ).c;\n\n // Either NaN, ±Infinity or ±0?\n if ( !xc || !yc || !xc[0] || !yc[0] ) {\n\n // Return NaN if either is NaN, or one is 0 and the other is Infinity.\n if ( !x.s || !y.s || xc && !xc[0] && !yc || yc && !yc[0] && !xc ) {\n y.c = y.e = y.s = null;\n } else {\n y.s *= x.s;\n\n // Return ±Infinity if either is ±Infinity.\n if ( !xc || !yc ) {\n y.c = y.e = null;\n\n // Return ±0 if either is ±0.\n } else {\n y.c = [0];\n y.e = 0;\n }\n }\n\n return y;\n }\n\n e = bitFloor( x.e / LOG_BASE ) + bitFloor( y.e / LOG_BASE );\n y.s *= x.s;\n xcL = xc.length;\n ycL = yc.length;\n\n // Ensure xc points to longer array and xcL to its length.\n if ( xcL < ycL ) zc = xc, xc = yc, yc = zc, i = xcL, xcL = ycL, ycL = i;\n\n // Initialise the result array with zeros.\n for ( i = xcL + ycL, zc = []; i--; zc.push(0) );\n\n base = BASE;\n sqrtBase = SQRT_BASE;\n\n for ( i = ycL; --i >= 0; ) {\n c = 0;\n ylo = yc[i] % sqrtBase;\n yhi = yc[i] / sqrtBase | 0;\n\n for ( k = xcL, j = i + k; j > i; ) {\n xlo = xc[--k] % sqrtBase;\n xhi = xc[k] / sqrtBase | 0;\n m = yhi * xlo + xhi * ylo;\n xlo = ylo * xlo + ( ( m % sqrtBase ) * sqrtBase ) + zc[j] + c;\n c = ( xlo / base | 0 ) + ( m / sqrtBase | 0 ) + yhi * xhi;\n zc[j--] = xlo % base;\n }\n\n zc[j] = c;\n }\n\n if (c) {\n ++e;\n } else {\n zc.shift();\n }\n\n return normalise( y, zc, e );\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber rounded to a maximum of\n * sd significant digits using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toDigits() precision out of range: {sd}'\n * 'toDigits() precision not an integer: {sd}'\n * 'toDigits() rounding mode not an integer: {rm}'\n * 'toDigits() rounding mode out of range: {rm}'\n */\n P.toDigits = function ( sd, rm ) {\n var n = new BigNumber(this);\n sd = sd == null || !isValidInt( sd, 1, MAX, 18, 'precision' ) ? null : sd | 0;\n rm = rm == null || !isValidInt( rm, 0, 8, 18, roundingMode ) ? ROUNDING_MODE : rm | 0;\n return sd ? round( n, sd, rm ) : n;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in exponential notation and\n * rounded using ROUNDING_MODE to dp fixed decimal places.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toExponential() decimal places not an integer: {dp}'\n * 'toExponential() decimal places out of range: {dp}'\n * 'toExponential() rounding mode not an integer: {rm}'\n * 'toExponential() rounding mode out of range: {rm}'\n */\n P.toExponential = function ( dp, rm ) {\n return format( this,\n dp != null && isValidInt( dp, 0, MAX, 19 ) ? ~~dp + 1 : null, rm, 19 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounding\n * to dp fixed decimal places using rounding mode rm, or ROUNDING_MODE if rm is omitted.\n *\n * Note: as with JavaScript's number type, (-0).toFixed(0) is '0',\n * but e.g. (-0.00001).toFixed(0) is '-0'.\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFixed() decimal places not an integer: {dp}'\n * 'toFixed() decimal places out of range: {dp}'\n * 'toFixed() rounding mode not an integer: {rm}'\n * 'toFixed() rounding mode out of range: {rm}'\n */\n P.toFixed = function ( dp, rm ) {\n return format( this, dp != null && isValidInt( dp, 0, MAX, 20 )\n ? ~~dp + this.e + 1 : null, rm, 20 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in fixed-point notation rounded\n * using rm or ROUNDING_MODE to dp decimal places, and formatted according to the properties\n * of the FORMAT object (see BigNumber.config).\n *\n * FORMAT = {\n * decimalSeparator : '.',\n * groupSeparator : ',',\n * groupSize : 3,\n * secondaryGroupSize : 0,\n * fractionGroupSeparator : '\\xA0', // non-breaking space\n * fractionGroupSize : 0\n * };\n *\n * [dp] {number} Decimal places. Integer, 0 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toFormat() decimal places not an integer: {dp}'\n * 'toFormat() decimal places out of range: {dp}'\n * 'toFormat() rounding mode not an integer: {rm}'\n * 'toFormat() rounding mode out of range: {rm}'\n */\n P.toFormat = function ( dp, rm ) {\n var str = format( this, dp != null && isValidInt( dp, 0, MAX, 21 )\n ? ~~dp + this.e + 1 : null, rm, 21 );\n\n if ( this.c ) {\n var i,\n arr = str.split('.'),\n g1 = +FORMAT.groupSize,\n g2 = +FORMAT.secondaryGroupSize,\n groupSeparator = FORMAT.groupSeparator,\n intPart = arr[0],\n fractionPart = arr[1],\n isNeg = this.s < 0,\n intDigits = isNeg ? intPart.slice(1) : intPart,\n len = intDigits.length;\n\n if (g2) i = g1, g1 = g2, g2 = i, len -= i;\n\n if ( g1 > 0 && len > 0 ) {\n i = len % g1 || g1;\n intPart = intDigits.substr( 0, i );\n\n for ( ; i < len; i += g1 ) {\n intPart += groupSeparator + intDigits.substr( i, g1 );\n }\n\n if ( g2 > 0 ) intPart += groupSeparator + intDigits.slice(i);\n if (isNeg) intPart = '-' + intPart;\n }\n\n str = fractionPart\n ? intPart + FORMAT.decimalSeparator + ( ( g2 = +FORMAT.fractionGroupSize )\n ? fractionPart.replace( new RegExp( '\\\\d{' + g2 + '}\\\\B', 'g' ),\n '$&' + FORMAT.fractionGroupSeparator )\n : fractionPart )\n : intPart;\n }\n\n return str;\n };\n\n\n /*\n * Return a string array representing the value of this BigNumber as a simple fraction with\n * an integer numerator and an integer denominator. The denominator will be a positive\n * non-zero value less than or equal to the specified maximum denominator. If a maximum\n * denominator is not specified, the denominator will be the lowest value necessary to\n * represent the number exactly.\n *\n * [md] {number|string|BigNumber} Integer >= 1 and < Infinity. The maximum denominator.\n *\n * 'toFraction() max denominator not an integer: {md}'\n * 'toFraction() max denominator out of range: {md}'\n */\n P.toFraction = function (md) {\n var arr, d0, d2, e, exp, n, n0, q, s,\n k = ERRORS,\n x = this,\n xc = x.c,\n d = new BigNumber(ONE),\n n1 = d0 = new BigNumber(ONE),\n d1 = n0 = new BigNumber(ONE);\n\n if ( md != null ) {\n ERRORS = false;\n n = new BigNumber(md);\n ERRORS = k;\n\n if ( !( k = n.isInt() ) || n.lt(ONE) ) {\n\n if (ERRORS) {\n raise( 22,\n 'max denominator ' + ( k ? 'out of range' : 'not an integer' ), md );\n }\n\n // ERRORS is false:\n // If md is a finite non-integer >= 1, round it to an integer and use it.\n md = !k && n.c && round( n, n.e + 1, 1 ).gte(ONE) ? n : null;\n }\n }\n\n if ( !xc ) return x.toString();\n s = coeffToString(xc);\n\n // Determine initial denominator.\n // d is a power of 10 and the minimum max denominator that specifies the value exactly.\n e = d.e = s.length - x.e - 1;\n d.c[0] = POWS_TEN[ ( exp = e % LOG_BASE ) < 0 ? LOG_BASE + exp : exp ];\n md = !md || n.cmp(d) > 0 ? ( e > 0 ? d : n1 ) : n;\n\n exp = MAX_EXP;\n MAX_EXP = 1 / 0;\n n = new BigNumber(s);\n\n // n0 = d1 = 0\n n0.c[0] = 0;\n\n for ( ; ; ) {\n q = div( n, d, 0, 1 );\n d2 = d0.plus( q.times(d1) );\n if ( d2.cmp(md) == 1 ) break;\n d0 = d1;\n d1 = d2;\n n1 = n0.plus( q.times( d2 = n1 ) );\n n0 = d2;\n d = n.minus( q.times( d2 = d ) );\n n = d2;\n }\n\n d2 = div( md.minus(d0), d1, 0, 1 );\n n0 = n0.plus( d2.times(n1) );\n d0 = d0.plus( d2.times(d1) );\n n0.s = n1.s = x.s;\n e *= 2;\n\n // Determine which fraction is closer to x, n0/d0 or n1/d1\n arr = div( n1, d1, e, ROUNDING_MODE ).minus(x).abs().cmp(\n div( n0, d0, e, ROUNDING_MODE ).minus(x).abs() ) < 1\n ? [ n1.toString(), d1.toString() ]\n : [ n0.toString(), d0.toString() ];\n\n MAX_EXP = exp;\n return arr;\n };\n\n\n /*\n * Return the value of this BigNumber converted to a number primitive.\n */\n P.toNumber = function () {\n var x = this;\n\n // Ensure zero has correct sign.\n return +x || ( x.s ? x.s * 0 : NaN );\n };\n\n\n /*\n * Return a BigNumber whose value is the value of this BigNumber raised to the power n.\n * If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.\n * If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.\n *\n * n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.\n * (Performs 54 loop iterations for n of 9007199254740992.)\n *\n * 'pow() exponent not an integer: {n}'\n * 'pow() exponent out of range: {n}'\n */\n P.toPower = P.pow = function (n) {\n var k, y,\n i = mathfloor( n < 0 ? -n : +n ),\n x = this;\n\n // Pass ±Infinity to Math.pow if exponent is out of range.\n if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&\n ( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||\n parseFloat(n) != n && !( n = NaN ) ) ) {\n return new BigNumber( Math.pow( +x, n ) );\n }\n\n // Truncating each coefficient array to a length of k after each multiplication equates\n // to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a\n // minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)\n k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;\n y = new BigNumber(ONE);\n\n for ( ; ; ) {\n\n if ( i % 2 ) {\n y = y.times(x);\n if ( !y.c ) break;\n if ( k && y.c.length > k ) y.c.length = k;\n }\n\n i = mathfloor( i / 2 );\n if ( !i ) break;\n\n x = x.times(x);\n if ( k && x.c && x.c.length > k ) x.c.length = k;\n }\n\n if ( n < 0 ) y = ONE.div(y);\n return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;\n };\n\n\n /*\n * Return a string representing the value of this BigNumber rounded to sd significant digits\n * using rounding mode rm or ROUNDING_MODE. If sd is less than the number of digits\n * necessary to represent the integer part of the value in fixed-point notation, then use\n * exponential notation.\n *\n * [sd] {number} Significant digits. Integer, 1 to MAX inclusive.\n * [rm] {number} Rounding mode. Integer, 0 to 8 inclusive.\n *\n * 'toPrecision() precision not an integer: {sd}'\n * 'toPrecision() precision out of range: {sd}'\n * 'toPrecision() rounding mode not an integer: {rm}'\n * 'toPrecision() rounding mode out of range: {rm}'\n */\n P.toPrecision = function ( sd, rm ) {\n return format( this, sd != null && isValidInt( sd, 1, MAX, 24, 'precision' )\n ? sd | 0 : null, rm, 24 );\n };\n\n\n /*\n * Return a string representing the value of this BigNumber in base b, or base 10 if b is\n * omitted. If a base is specified, including base 10, round according to DECIMAL_PLACES and\n * ROUNDING_MODE. If a base is not specified, and this BigNumber has a positive exponent\n * that is equal to or greater than TO_EXP_POS, or a negative exponent equal to or less than\n * TO_EXP_NEG, return exponential notation.\n *\n * [b] {number} Integer, 2 to 64 inclusive.\n *\n * 'toString() base not an integer: {b}'\n * 'toString() base out of range: {b}'\n */\n P.toString = function (b) {\n var str,\n n = this,\n s = n.s,\n e = n.e;\n\n // Infinity or NaN?\n if ( e === null ) {\n\n if (s) {\n str = 'Infinity';\n if ( s < 0 ) str = '-' + str;\n } else {\n str = 'NaN';\n }\n } else {\n str = coeffToString( n.c );\n\n if ( b == null || !isValidInt( b, 2, 64, 25, 'base' ) ) {\n str = e <= TO_EXP_NEG || e >= TO_EXP_POS\n ? toExponential( str, e )\n : toFixedPoint( str, e );\n } else {\n str = convertBase( toFixedPoint( str, e ), b | 0, 10, s );\n }\n\n if ( s < 0 && n.c[0] ) str = '-' + str;\n }\n\n return str;\n };\n\n\n /*\n * Return a new BigNumber whose value is the value of this BigNumber truncated to a whole\n * number.\n */\n P.truncated = P.trunc = function () {\n return round( new BigNumber(this), this.e + 1, 1 );\n };\n\n\n\n /*\n * Return as toString, but do not accept a base argument.\n */\n P.valueOf = P.toJSON = function () {\n return this.toString();\n };\n\n\n // Aliases for BigDecimal methods.\n //P.add = P.plus; // P.add included above\n //P.subtract = P.minus; // P.sub included above\n //P.multiply = P.times; // P.mul included above\n //P.divide = P.div;\n //P.remainder = P.mod;\n //P.compareTo = P.cmp;\n //P.negate = P.neg;\n\n\n if ( configObj != null ) BigNumber.config(configObj);\n\n return BigNumber;\n }\n\n\n // PRIVATE HELPER FUNCTIONS\n\n\n function bitFloor(n) {\n var i = n | 0;\n return n > 0 || n === i ? i : i - 1;\n }\n\n\n // Return a coefficient array as a string of base 10 digits.\n function coeffToString(a) {\n var s, z,\n i = 1,\n j = a.length,\n r = a[0] + '';\n\n for ( ; i < j; ) {\n s = a[i++] + '';\n z = LOG_BASE - s.length;\n for ( ; z--; s = '0' + s );\n r += s;\n }\n\n // Determine trailing zeros.\n for ( j = r.length; r.charCodeAt(--j) === 48; );\n return r.slice( 0, j + 1 || 1 );\n }\n\n\n // Compare the value of BigNumbers x and y.\n function compare( x, y ) {\n var a, b,\n xc = x.c,\n yc = y.c,\n i = x.s,\n j = y.s,\n k = x.e,\n l = y.e;\n\n // Either NaN?\n if ( !i || !j ) return null;\n\n a = xc && !xc[0];\n b = yc && !yc[0];\n\n // Either zero?\n if ( a || b ) return a ? b ? 0 : -j : i;\n\n // Signs differ?\n if ( i != j ) return i;\n\n a = i < 0;\n b = k == l;\n\n // Either Infinity?\n if ( !xc || !yc ) return b ? 0 : !xc ^ a ? 1 : -1;\n\n // Compare exponents.\n if ( !b ) return k > l ^ a ? 1 : -1;\n\n j = ( k = xc.length ) < ( l = yc.length ) ? k : l;\n\n // Compare digit by digit.\n for ( i = 0; i < j; i++ ) if ( xc[i] != yc[i] ) return xc[i] > yc[i] ^ a ? 1 : -1;\n\n // Compare lengths.\n return k == l ? 0 : k > l ^ a ? 1 : -1;\n }\n\n\n /*\n * Return true if n is a valid number in range, otherwise false.\n * Use for argument validation when ERRORS is false.\n * Note: parseInt('1e+1') == 1 but parseFloat('1e+1') == 10.\n */\n function intValidatorNoErrors( n, min, max ) {\n return ( n = truncate(n) ) >= min && n <= max;\n }\n\n\n function isArray(obj) {\n return Object.prototype.toString.call(obj) == '[object Array]';\n }\n\n\n /*\n * Convert string of baseIn to an array of numbers of baseOut.\n * Eg. convertBase('255', 10, 16) returns [15, 15].\n * Eg. convertBase('ff', 16, 10) returns [2, 5, 5].\n */\n function toBaseOut( str, baseIn, baseOut ) {\n var j,\n arr = [0],\n arrL,\n i = 0,\n len = str.length;\n\n for ( ; i < len; ) {\n for ( arrL = arr.length; arrL--; arr[arrL] *= baseIn );\n arr[ j = 0 ] += ALPHABET.indexOf( str.charAt( i++ ) );\n\n for ( ; j < arr.length; j++ ) {\n\n if ( arr[j] > baseOut - 1 ) {\n if ( arr[j + 1] == null ) arr[j + 1] = 0;\n arr[j + 1] += arr[j] / baseOut | 0;\n arr[j] %= baseOut;\n }\n }\n }\n\n return arr.reverse();\n }\n\n\n function toExponential( str, e ) {\n return ( str.length > 1 ? str.charAt(0) + '.' + str.slice(1) : str ) +\n ( e < 0 ? 'e' : 'e+' ) + e;\n }\n\n\n function toFixedPoint( str, e ) {\n var len, z;\n\n // Negative exponent?\n if ( e < 0 ) {\n\n // Prepend zeros.\n for ( z = '0.'; ++e; z += '0' );\n str = z + str;\n\n // Positive exponent\n } else {\n len = str.length;\n\n // Append zeros.\n if ( ++e > len ) {\n for ( z = '0', e -= len; --e; z += '0' );\n str += z;\n } else if ( e < len ) {\n str = str.slice( 0, e ) + '.' + str.slice(e);\n }\n }\n\n return str;\n }\n\n\n function truncate(n) {\n n = parseFloat(n);\n return n < 0 ? mathceil(n) : mathfloor(n);\n }\n\n\n // EXPORT\n\n\n BigNumber = another();\n\n // AMD.\n if ( typeof define == 'function' && define.amd ) {\n define( function () { return BigNumber; } );\n\n // Node and other environments that support module.exports.\n } else if ( typeof module != 'undefined' && module.exports ) {\n module.exports = BigNumber;\n if ( !crypto ) try { crypto = require('crypto'); } catch (e) {}\n\n // Browser.\n } else {\n global.BigNumber = BigNumber;\n }\n})(this);\n", + "var web3 = require('./lib/web3');\nweb3.providers.HttpProvider = require('./lib/web3/httpprovider');\nweb3.providers.QtSyncProvider = require('./lib/web3/qtsync');\nweb3.eth.contract = require('./lib/web3/contract');\nweb3.eth.namereg = require('./lib/web3/namereg');\nweb3.eth.sendIBANTransaction = require('./lib/web3/transfer');\n\n// dont override global variable\nif (typeof window !== 'undefined' && typeof window.web3 === 'undefined') {\n window.web3 = web3;\n}\n\nmodule.exports = web3;\n\n" + ] +} \ No newline at end of file diff --git a/dist/web3.min.js b/dist/web3.min.js index cf92525b8..42fee25e0 100644 --- a/dist/web3.min.js +++ b/dist/web3.min.js @@ -1,2 +1,2 @@ -require=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var f=n[a]={exports:{}};e[a][0].call(f.exports,function(t){var n=e[a][1][t];return i(n?n:t)},f,f.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;ao;o+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(o+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var i=n._requireType(t),o=i.sliceParam(e,r,t);return i.formatOutput(o,s(t))})};var f=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:o.formatInputBool,outputFormatter:o.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:o.formatInputDynamicBytes,outputFormatter:o.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:o.formatInputBytes,outputFormatter:o.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputUReal})]);e.exports=f},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./param"),s=function(t){var e=2*o.ETH_PADDING;r.config(o.ETH_BIGNUMBER_ROUNDING_MODE);var n=i.padLeft(i.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},f=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},l=function(t){return s(new r(t).times(new r(2).pow(128)))},p=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},h=function(t){var e=t.staticPart()||"0";return p(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},m=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return i.toAscii(t.staticPart())},w=function(t){return i.toAscii(t.dynamicPart().slice(64))},b=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:f,formatInputReal:l,formatOutputInt:h,formatOutputUInt:m,formatOutputReal:d,formatOutputUReal:g,formatOutputBool:y,formatOutputBytes:v,formatOutputDynamicBytes:w,formatOutputAddress:b}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),i=function(t,e){this.value=t||"",this.offset=e};i.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},i.prototype.withOffset=function(t){return new i(this.value,t)},i.prototype.combine=function(t){return new i(this.value+t.value)},i.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},i.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},i.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},i.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},i.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},i.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},i.decodeParam=function(t,e){return e=e||0,new i(t.substr(64*e,64))};var o=function(t,e){return parseInt("0x"+t.substr(64*e,64))};i.decodeBytes=function(t,e){e=e||0;var n=o(t,e);return new i(t.substr(2*n,128),0)},i.decodeArray=function(t,e){e=e||0;var n=o(t,e),r=parseInt("0x"+t.substr(2*n,64));return new i(t.substr(2*n,64*(r+1)),0)},e.exports=i},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),i=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:1e3,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),i=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),i(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),i={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},o=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&o.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+i.encodeParams(this._inputTypes,t),e},s.prototype.signature=function(){return a(this._name).slice(0,8)},s.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=i.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},s.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);if(!e){var i=r.eth.call(n);return this.unpackOutput(i)}var o=this;r.eth.call(n,function(t,n){e(t,o.unpackOutput(n))})},s.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},s.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},s.prototype.displayName=function(){return o.extractDisplayName(this._name)},s.prototype.typeName=function(){return o.extractTypeName(this._name)},s.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},s.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},s.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=s},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,i=t("./errors"),o=function(t){this.host=t||"http://localhost:8545"};o.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1);try{e.send(JSON.stringify(t))}catch(n){throw i.InvalidConnection(this.host)}var o=e.responseText;try{o=JSON.parse(o)}catch(a){throw i.InvalidResponse(o)}return o},o.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(o){r=i.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0);try{n.send(JSON.stringify(t))}catch(o){e(i.InvalidConnection(this.host))}},e.exports=o},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),i=function(t){this._iban=t};i.prototype.isValid=function(){return r.isIBAN(this._iban)},i.prototype.isDirect=function(){return 34===this._iban.length},i.prototype.isIndirect=function(){return 20===this._iban.length},i.prototype.checksum=function(){return this._iban.substr(2,2)},i.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},i.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},i.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=i},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),i=t("../utils/utils"),o=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return i.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return i.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw o.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),i="0xc6d9d2cd449a754c494264e1809c50e34d64562b",o=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[], -type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(o).at(i)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),i=t("./property"),o=[],a=[new i({name:"listening",getter:"net_listening"}),new i({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:o,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var i=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[i("get",r)]=this.getAsync.bind(this)},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=i},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls=[],this.timeout=null,void this.poll())};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):i.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t},s.prototype.startPolling=function(t,e,n,r){this.polls.push({data:t,id:e,callback:n,uninstall:r})},s.prototype.stopPolling=function(t){for(var e=this.polls.length;e--;){var n=this.polls[e];n.id===t&&this.polls.splice(e,1)}},s.prototype.reset=function(){this.polls.forEach(function(t){t.uninstall(t.id)}),this.polls=[],this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),o.ETH_POLLING_TIMEOUT),this.polls.length){if(!this.provider)return void console.error(a.InvalidProvider());var t=r.getInstance().toBatchPayload(this.polls.map(function(t){return t.data})),e=this;this.provider.sendAsync(t,function(t,n){if(!t){if(!i.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){return t.callback=e.polls[n].callback,t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return i.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),i=t("./formatters"),o=new r({name:"post",call:"shh_post",params:1,inputFormatter:[i.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),f=[o,a,s,u,c];e.exports={methods:f}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),i=t("./icap"),o=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new i(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=o.addr(a.institution());return c(t,s,n,a.client())}o.addr(a.insitution(),function(e,i){return c(t,i,n,a.client(),r)})},u=function(t,e,n,i){return r.eth.sendTransaction({address:e,from:t,value:n},i)},c=function(t,e,n,r,i){var o=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(o).at(e).deposit(r,{from:t,value:n},i)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),i=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.pop(),this.params=0,"eth_newBlockFilter";case"pending":return t.pop(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),i=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),o=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,i,o]},o=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),i=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,i]};e.exports={eth:i,shh:o}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},i=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=r.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;i>o;o++){var a=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var o=0;i>o;o+=4)e[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var i=(n<<16)+e&r;return i/=4294967296,i+=.5,i*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=i(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new o.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new o.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new o.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},f=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,a=this.blockSize,s=4*a,u=i/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,f=t.min(4*c,i);if(c){for(var l=0;c>l;l+=a)this._doProcessBlock(r,l);var p=r.splice(0,c);n.sigBytes-=f}return new o.init(p,f)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),l=(r.Hasher=f.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new l.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,i,o){"object"==typeof n?e.exports=n=i(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,i=r.WordArray,o=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],f=[],l=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,i=(2*t+3*e)%5;t=r,e=i}for(var t=0;5>t;t++)for(var e=0;5>e;e++)f[t+5*e]=e+(2*t+3*e)%5*5;for(var o=1,a=0;24>a;a++){for(var u=0,p=0,h=0;7>h;h++){if(1&o){var m=(1<m?p^=1<t;t++)p[t]=s.create()}();var h=u.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,i=0;r>i;i++){var o=t[e+2*i],a=t[e+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[i];s.high^=a,s.low^=o}for(var u=0;24>u;u++){for(var h=0;5>h;h++){for(var m=0,d=0,g=0;5>g;g++){var s=n[h+5*g];m^=s.high,d^=s.low}var y=p[h];y.high=m,y.low=d}for(var h=0;5>h;h++)for(var v=p[(h+4)%5],w=p[(h+1)%5],b=w.high,_=w.low,m=v.high^(b<<1|_>>>31),d=v.low^(_<<1|b>>>31),g=0;5>g;g++){var s=n[h+5*g];s.high^=m,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,I=s.low,B=c[x];if(32>B)var m=F<>>32-B,d=I<>>32-B;else var m=I<>>64-B,d=F<>>64-B;var N=p[f[x]];N.high=m,N.low=d}var O=p[0],A=n[0];O.high=A.high,O.low=A.low;for(var h=0;5>h;h++)for(var g=0;5>g;g++){var x=h+5*g,s=n[x],k=p[x],P=p[(h+1)%5+5*g],T=p[(h+2)%5+5*g];s.high=k.high^~P.high&T.high,s.low=k.low^~P.low&T.low}var s=n[0],D=l[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],f=0;u>f;f++){var l=a[f],p=l.high,h=l.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),c.push(h),c.push(p)}return new i.init(c,s)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=o._createHelper(h),n.HmacSHA3=o._createHmacHelper(h)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,i){"object"==typeof n?e.exports=n=i(t("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,i=r.Base,o=r.WordArray,a=n.x64={};a.Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var i=t[r];n.push(i.high),n.push(i.low)}return o.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){!function(n){"use strict";function r(t){function e(t,r){var i,o,a,s,u,c,f=this;if(!(f instanceof e))return z&&D(26,"constructor call without new",t),new e(t,r);if(null!=r&&W(r,2,64,C,"base")){if(r=0|r,c=t+"",10==r)return f=new e(t instanceof e?t:c),S(f,L+f.e+1,j);if((s="number"==typeof t)&&0*t!=0||!new RegExp("^-?"+(i="["+x.slice(0,r)+"]+")+"(?:\\."+i+")?$",37>r?"i":"").test(c))return d(f,c,s,r);s?(f.s=0>1/t?(c=c.slice(1),-1):1,z&&c.replace(/^0\.0*|\./,"").length>15&&D(C,_,t),s=!1):f.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,f.s)}else{if(t instanceof e)return f.s=t.s,f.e=t.e,f.c=(t=t.c)?t.slice():t,void(C=0);if((s="number"==typeof t)&&0*t==0){if(f.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,a=t;a>=10;a/=10,o++);return f.e=o,f.c=[t],void(C=0)}c=t+""}else{if(!g.test(c=t+""))return d(f,c,s);f.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(a=c.search(/e/i))>0?(0>o&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):0>o&&(o=c.length),a=0;48===c.charCodeAt(a);a++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(a,u+1))if(u=c.length,s&&z&&u>15&&D(C,_,f.s*t),o=o-a-1,o>M)f.c=f.e=null;else if(G>o)f.c=[f.e=0];else{if(f.e=o,f.c=[],a=(o+1)%I,0>o&&(a+=I),u>a){for(a&&f.c.push(+c.slice(0,a)),u-=I;u>a;)f.c.push(+c.slice(a,a+=I));c=c.slice(a),a=I-c.length}else a-=u;for(;a--;c+="0");f.c.push(+c)}else f.c=[f.e=0];C=0}function n(t,n,r,i){var a,s,u,f,p,h,m,d=t.indexOf("."),g=L,y=j;for(37>r&&(t=t.toLowerCase()),d>=0&&(u=V,V=0,t=t.replace(".",""),m=new e(r),p=m.pow(t.length-d),V=u,m.c=c(l(o(p.c),p.e),10,n),m.e=m.c.length),h=c(t,r,n),s=u=h.length;0==h[--u];h.pop());if(!h[0])return"0";if(0>d?--s:(p.c=h,p.e=s,p.s=i,p=E(p,m,g,y,n),h=p.c,f=p.r,s=p.e),a=s+g+1,d=h[a],u=n/2,f=f||0>a||null!=h[a+1],f=4>y?(null!=d||f)&&(0==y||y==(p.s<0?3:2)):d>u||d==u&&(4==y||f||6==y&&1&h[a-1]||y==(p.s<0?8:7)),1>a||!h[0])t=f?l("1",-g):"0";else{if(h.length=a,f)for(--n;++h[--a]>n;)h[a]=0,a||(++s,h.unshift(1));for(u=h.length;!h[--u];);for(d=0,t="";u>=d;t+=x.charAt(h[d++]));t=l(t,s)}return t}function h(t,n,r,i){var a,s,u,c,p;if(r=null!=r&&W(r,0,8,i,b)?0|r:j,!t.c)return t.toString();if(a=t.c[0],u=t.e,null==n)p=o(t.c),p=19==i||24==i&&q>=u?f(p,u):l(p,u);else if(t=S(new e(t),n,r),s=t.e,p=o(t.c),c=p.length,19==i||24==i&&(s>=n||q>=s)){for(;n>c;p+="0",c++);p=f(p,s)}else if(n-=u,p=l(p,s),s+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=s-c,n>0)for(s+1==c&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function k(t,n){var r,i,o=0;for(u(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&D(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function T(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>M?t.c=t.e=null:G>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function D(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",C=0,r}function S(t,e,n,r){var i,o,a,s,u,c,f,l=t.c,p=N;if(l){t:{for(i=1,s=l[0];s>=10;s/=10,i++);if(o=e-i,0>o)o+=I,a=e,u=l[c=0],f=u/p[i-a-1]%10|0;else if(c=y((o+1)/I),c>=l.length){if(!r)break t;for(;l.length<=c;l.push(0));u=f=0,i=1,o%=I,a=o-I+1}else{for(u=s=l[c],i=1;s>=10;s/=10,i++);o%=I,a=o-I+i,f=0>a?0:u/p[i-a-1]%10|0}if(r=r||0>e||null!=l[c+1]||(0>a?u:u%p[i-a-1]),r=4>n?(f||r)&&(0==n||n==(t.s<0?3:2)):f>5||5==f&&(4==n||r||6==n&&(o>0?a>0?u/p[i-a]:0:l[c-1])%10&1||n==(t.s<0?8:7)),1>e||!l[0])return l.length=0,r?(e-=t.e+1,l[0]=p[e%I],t.e=-e||0):l[0]=t.e=0,t;if(0==o?(l.length=c,s=1,c--):(l.length=c+1,s=p[I-o],l[c]=a>0?v(u/p[i-a]%p[a])*s:0),r)for(;;){if(0==c){for(o=1,a=l[0];a>=10;a/=10,o++);for(a=l[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(t.e++,l[0]==F&&(l[0]=1));break}if(l[c]+=s,l[c]!=F)break;l[c--]=0,s=1}for(o=l.length;0===l[--o];l.pop());}t.e>M?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return a(e="DECIMAL_PLACES")&&W(t,0,A,2,e)&&(L=0|t),r[e]=L,a(e="ROUNDING_MODE")&&W(t,0,8,2,e)&&(j=0|t),r[e]=j,a(e="EXPONENTIAL_AT")&&(u(t)?W(t[0],-A,0,2,e)&&W(t[1],0,A,2,e)&&(q=0|t[0],U=0|t[1]):W(t,-A,A,2,e)&&(q=-(U=0|(0>t?-t:t)))),r[e]=[q,U],a(e="RANGE")&&(u(t)?W(t[0],-A,-1,2,e)&&W(t[1],1,A,2,e)&&(G=0|t[0],M=0|t[1]):W(t,-A,A,2,e)&&(0|t?G=-(M=0|(0>t?-t:t)):z&&D(2,e+" cannot be zero",t))),r[e]=[G,M],a(e="ERRORS")&&(t===!!t||1===t||0===t?(C=0,W=(z=!!t)?P:s):z&&D(2,e+w,t)),r[e]=z,a(e="CRYPTO")&&(t===!!t||1===t||0===t?(J=!(!t||!m||"object"!=typeof m),t&&!J&&z&&D(2,"crypto unavailable",m)):z&&D(2,e+w,t)),r[e]=J,a(e="MODULO_MODE")&&W(t,0,9,2,e)&&($=0|t),r[e]=$,a(e="POW_PRECISION")&&W(t,0,A,2,e)&&(V=0|t),r[e]=V,a(e="FORMAT")&&("object"==typeof t?X=t:z&&D(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return k(arguments,R.lt)},e.min=function(){return k(arguments,R.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return v(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,a,s,u=0,c=[],f=new e(H);if(t=null!=t&&W(t,0,A,14)?0|t:L,a=y(t/I),J)if(m&&m.getRandomValues){for(r=m.getRandomValues(new Uint32Array(a*=2));a>u;)s=131072*r[u]+(r[u+1]>>>11),s>=9e15?(i=m.getRandomValues(new Uint32Array(2)),r[u]=i[0],r[u+1]=i[1]):(c.push(s%1e14),u+=2);u=a/2}else if(m&&m.randomBytes){for(r=m.randomBytes(a*=7);a>u;)s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6],s>=9e15?m.randomBytes(7).copy(r,u):(c.push(s%1e14),u+=7);u=a/7}else z&&D(14,"crypto unavailable",m);if(!u)for(;a>u;)s=n(),9e15>s&&(c[u++]=s%1e14);for(a=c[--u],t%=I,a&&t&&(s=N[I-t],c[u]=v(a/s)*s);0===c[u];c.pop(),u--);if(0>u)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(u=1,s=c[0];s>=10;s/=10,u++);I>u&&(o-=I-u)}return f.e=o,f.c=c,f}}(),E=function(){function t(t,e,n){var r,i,o,a,s=0,u=t.length,c=e%O,f=e/O|0;for(t=t.slice();u--;)o=t[u]%O,a=t[u]/O|0,r=f*o+a*c,i=c*o+r%O*O+s,s=(i/n|0)+(r/O|0)+f*a,t[u]=i%n;return s&&t.unshift(s),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,a,s,u,c){var f,l,p,h,m,d,g,y,w,b,_,x,B,N,O,A,k,P=o.s==a.s?1:-1,T=o.c,D=a.c;if(!(T&&T[0]&&D&&D[0]))return new e(o.s&&a.s&&(T?!D||T[0]!=D[0]:D)?T&&0==T[0]||!D?0*P:P/0:0/0);for(y=new e(P),w=y.c=[],l=o.e-a.e,P=s+l+1,c||(c=F,l=i(o.e/I)-i(a.e/I),P=P/I|0),p=0;D[p]==(T[p]||0);p++);if(D[p]>(T[p]||0)&&l--,0>P)w.push(1),h=!0;else{for(N=T.length,A=D.length,p=0,P+=2,m=v(c/(D[0]+1)),m>1&&(D=t(D,m,c),T=t(T,m,c),A=D.length,N=T.length),B=A,b=T.slice(0,A),_=b.length;A>_;b[_++]=0);k=D.slice(),k.unshift(0),O=D[0],D[1]>=c/2&&O++;do{if(m=0,f=n(D,b,A,_),0>f){if(x=b[0],A!=_&&(x=x*c+(b[1]||0)),m=v(x/O),m>1)for(m>=c&&(m=c-1),d=t(D,m,c),g=d.length,_=b.length;1==n(d,b,g,_);)m--,r(d,g>A?k:D,g,c),g=d.length,f=1;else 0==m&&(f=m=1),d=D.slice(),g=d.length;if(_>g&&d.unshift(0),r(b,d,_,c),_=b.length,-1==f)for(;n(D,b,A,_)<1;)m++,r(b,_>A?k:D,_,c),_=b.length}else 0===f&&(m++,b=[0]);w[p++]=m,b[0]?b[_++]=T[B]||0:(b=[T[B]],_=1)}while((B++=10;P/=10,p++);S(y,s+(y.e=p+l*I-1)+1,u,h)}else y.e=l,y.r=+h;return y}}(),d=function(){var t=/^(-?)0([xbo])/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+|^\s+|\s+$/g;return function(a,s,u,c){var f,l=u?s:s.replace(o,"");if(i.test(l))a.s=isNaN(l)?null:0>l?-1:1;else{if(!u&&(l=l.replace(t,function(t,e,n){return f="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=f?t:e}),c&&(f=c,l=l.replace(n,"$1").replace(r,"0.$1")),s!=l))return new e(l,f);z&&D(C,"not a"+(c?" base "+c:"")+" number",s),a.s=null}a.c=a.e=null,C=0}}(),R.absoluteValue=R.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},R.ceil=function(){return S(new e(this),this.e+1,2)},R.comparedTo=R.cmp=function(t,n){return C=1,a(this,new e(t,n))},R.decimalPlaces=R.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},R.dividedBy=R.div=function(t,n){return C=3,E(this,new e(t,n),L,j)},R.dividedToIntegerBy=R.divToInt=function(t,n){return C=4,E(this,new e(t,n),0,1)},R.equals=R.eq=function(t,n){return C=5,0===a(this,new e(t,n))},R.floor=function(){return S(new e(this),this.e+1,3)},R.greaterThan=R.gt=function(t,n){return C=6,a(this,new e(t,n))>0},R.greaterThanOrEqualTo=R.gte=function(t,n){return C=7,1===(n=a(this,new e(t,n)))||0===n},R.isFinite=function(){return!!this.c},R.isInteger=R.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},R.isNaN=function(){return!this.s},R.isNegative=R.isNeg=function(){return this.s<0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.lessThan=R.lt=function(t,n){return C=8,a(this,new e(t,n))<0},R.lessThanOrEqualTo=R.lte=function(t,n){return C=9,-1===(n=a(this,new e(t,n)))||0===n},R.minus=R.sub=function(t,n){var r,o,a,s,u=this,c=u.s;if(C=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,u.plus(t);var f=u.e/I,l=t.e/I,p=u.c,h=t.c;if(!f||!l){if(!p||!h)return p?(t.s=-n,t):new e(h?u:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?u:3==j?-0:0)}if(f=i(f),l=i(l),p=p.slice(),c=f-l){for((s=0>c)?(c=-c,a=p):(l=f,a=h),a.reverse(),n=c;n--;a.push(0));a.reverse()}else for(o=(s=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){s=p[n]0)for(;n--;p[r++]=0);for(n=F-1;o>c;){if(p[--o]0?(u=s,r=f):(a=-a,r=c),r.reverse();a--;r.push(0));r.reverse()}for(a=c.length,n=f.length,0>a-n&&(r=f,f=c,c=r,n=a),a=0;n;)a=(c[--n]=c[n]+f[n]+a)/F|0,c[n]%=F;return a&&(c.unshift(a),++u),T(t,c,u)},R.precision=R.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&(z&&D(13,"argument"+w,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},R.round=function(t,n){var r=new e(this);return(null==t||W(t,0,A,15))&&S(r,~~t+this.e+1,null!=n&&W(n,0,8,15,b)?0|n:j),r},R.shift=function(t){var n=this;return W(t,-B,B,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-B>t||t>B)?n.s*(0>t?0:1/0):n)},R.squareRoot=R.sqrt=function(){var t,n,r,a,s,u=this,c=u.c,f=u.s,l=u.e,p=L+4,h=new e("0.5");if(1!==f||!c||!c[0])return new e(!f||0>f&&(!c||c[0])?0/0:c?u:1/0);if(f=Math.sqrt(+u),0==f||f==1/0?(n=o(c),(n.length+l)%2==0&&(n+="0"),f=Math.sqrt(n),l=i((l+1)/2)-(0>l||l%2),f==1/0?n="1e"+l:(n=f.toExponential(),n=n.slice(0,n.indexOf("e")+1)+l),r=new e(n)):r=new e(f+""),r.c[0])for(l=r.e,f=l+p,3>f&&(f=0);;)if(s=r,r=h.times(s.plus(E(u,s,p,1))),o(s.c).slice(0,f)===(n=o(r.c)).slice(0,f)){if(r.ef&&(g=b,b=_,_=g,a=f,f=h,h=a),a=f+h,g=[];a--;g.push(0));for(y=F,v=O,a=h;--a>=0;){for(r=0,m=_[a]%v,d=_[a]/v|0,u=f,s=a+u;s>a;)l=b[--u]%v,p=b[u]/v|0,c=d*l+p*m,l=m*l+c%v*v+g[s]+r,r=(l/y|0)+(c/v|0)+d*p,g[s--]=l%y;g[s]=r}return r?++o:g.shift(),T(t,g,o)},R.toDigits=function(t,n){var r=new e(this);return t=null!=t&&W(t,1,A,18,"precision")?0|t:null,n=null!=n&&W(n,0,8,18,b)?0|n:j,t?S(r,t,n):r},R.toExponential=function(t,e){return h(this,null!=t&&W(t,0,A,19)?~~t+1:null,e,19)},R.toFixed=function(t,e){return h(this,null!=t&&W(t,0,A,20)?~~t+this.e+1:null,e,20)},R.toFormat=function(t,e){var n=h(this,null!=t&&W(t,0,A,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+X.groupSize,a=+X.secondaryGroupSize,s=X.groupSeparator,u=i[0],c=i[1],f=this.s<0,l=f?u.slice(1):u,p=l.length;if(a&&(r=o,o=a,a=r,p-=r),o>0&&p>0){for(r=p%o||o,u=l.substr(0,r);p>r;r+=o)u+=s+l.substr(r,o);a>0&&(u+=s+l.slice(r)),f&&(u="-"+u)}n=c?u+X.decimalSeparator+((a=+X.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+X.fractionGroupSeparator):c):u}return n},R.toFraction=function(t){var n,r,i,a,s,u,c,f,l,p=z,h=this,m=h.c,d=new e(H),g=r=new e(H),y=c=new e(H);if(null!=t&&(z=!1,u=new e(t),z=p,(!(p=u.isInt())||u.lt(H))&&(z&&D(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&u.c&&S(u,u.e+1,1).gte(H)?u:null)),!m)return h.toString();for(l=o(m),a=d.e=l.length-h.e-1,d.c[0]=N[(s=a%I)<0?I+s:s],t=!t||u.cmp(d)>0?a>0?d:g:u,s=M,M=1/0,u=new e(l),c.c[0]=0;f=E(u,d,0,1),i=r.plus(f.times(y)),1!=i.cmp(t);)r=y,y=i,g=c.plus(f.times(i=g)),c=i,d=u.minus(f.times(i=d)),u=i;return i=E(t.minus(r),y,0,1),c=c.plus(i.times(g)),r=r.plus(i.times(y)),c.s=g.s=h.s,a*=2,n=E(g,y,a,j).minus(h).abs().cmp(E(c,r,a,j).minus(h).abs())<1?[g.toString(),y.toString()]:[c.toString(),r.toString()],M=s,n},R.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},R.toPower=R.pow=function(t){var n,r,i=v(0>t?-t:+t),o=this;if(!W(t,-B,B,23,"exponent")&&(!isFinite(t)||i>B&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=V?y(V/I+2):0,r=new e(H);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=v(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=H.div(r)),n?S(r,V,j):r},R.toPrecision=function(t,e){return h(this,null!=t&&W(t,1,A,24,"precision")?0|t:null,e,24)},R.toString=function(t){var e,r=this,i=r.s,a=r.e;return null===a?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&W(t,2,64,25,"base")?n(l(e,a),0|t,10,i):q>=a||a>=U?f(e,a):l(e,a),0>i&&r.c[0]&&(e="-"+e)),e},R.truncated=R.trunc=function(){return S(new e(this),this.e+1,1)},R.valueOf=R.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function a(t,e){var n,r,i=t.c,o=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=0>a,r=u==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return u>c^n?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;s>a;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return u==c?0:u>c^n?1:-1}function s(t,e,n){return(t=p(t))>=e&&n>=t}function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],a=0,s=t.length;s>a;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=x.indexOf(t.charAt(a++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function f(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function l(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?y(t):v(t)}var h,m,d,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=Math.ceil,v=Math.floor,w=" not a boolean or binary digit",b="rounding mode",_="number type has more than 15 significant digits",x="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",F=1e14,I=14,B=9007199254740991,N=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],O=1e7,A=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!m)try{m=t("crypto")}catch(k){}}else n.BigNumber=h}(this)},{crypto:31}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file +require=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;ao;o+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(o+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var i=n._requireType(t),o=i.sliceParam(e,r,t);return i.formatOutput(o,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:o.formatInputBool,outputFormatter:o.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:o.formatInputDynamicBytes,outputFormatter:o.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:o.formatInputBytes,outputFormatter:o.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./param"),s=function(t){var e=2*o.ETH_PADDING;r.config(o.ETH_BIGNUMBER_ROUNDING_MODE);var n=i.padLeft(i.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},l=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},f=function(t){return s(new r(t).times(new r(2).pow(128)))},p=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},h=function(t){var e=t.staticPart()||"0";return p(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},m=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return i.toAscii(t.staticPart())},b=function(t){return i.toAscii(t.dynamicPart().slice(64))},w=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:l,formatInputReal:f,formatOutputInt:h,formatOutputUInt:m,formatOutputReal:d,formatOutputUReal:g,formatOutputBool:y,formatOutputBytes:v,formatOutputDynamicBytes:b,formatOutputAddress:w}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),i=function(t,e){this.value=t||"",this.offset=e};i.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},i.prototype.withOffset=function(t){return new i(this.value,t)},i.prototype.combine=function(t){return new i(this.value+t.value)},i.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},i.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},i.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},i.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},i.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},i.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},i.decodeParam=function(t,e){return e=e||0,new i(t.substr(64*e,64))};var o=function(t,e){return parseInt("0x"+t.substr(64*e,64))};i.decodeBytes=function(t,e){e=e||0;var n=o(t,e);return new i(t.substr(2*n,128),0)},i.decodeArray=function(t,e){e=e||0;var n=o(t,e),r=parseInt("0x"+t.substr(2*n,64));return new i(t.substr(2*n,64*(r+1)),0)},e.exports=i},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),i=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),i=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),i(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),i={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},o=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&!o.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&o.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+i.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=i.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),i=this.toPayload(t);if(!e){var o=r.eth.call(i,n);return this.unpackOutput(o)}var a=this;r.eth.call(i,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return o.extractDisplayName(this._name)},u.prototype.typeName=function(){return o.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,i=t("./errors"),o=function(t){this.host=t||"http://localhost:8545"};o.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw i.InvalidConnection(this.host)}var o=e.responseText;try{o=JSON.parse(o)}catch(a){throw i.InvalidResponse(o)}return o},o.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(o){r=i.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(o){e(i.InvalidConnection(this.host))}},e.exports=o},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),i=function(t){this._iban=t};i.prototype.isValid=function(){return r.isIBAN(this._iban)},i.prototype.isDirect=function(){return 34===this._iban.length},i.prototype.isIndirect=function(){return 20===this._iban.length},i.prototype.checksum=function(){return this._iban.substr(2,2)},i.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},i.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},i.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=i},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),i=t("../utils/utils"),o=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return i.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return i.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw o.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),i="0xc6d9d2cd449a754c494264e1809c50e34d64562b",o=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function" +},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(o).at(i)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),i=t("./property"),o=[],a=[new i({name:"listening",getter:"net_listening"}),new i({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:o,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var i=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[i("get",r)]=this.getAsync.bind(this)},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=i},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):i.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),o.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!i.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return i.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),i=t("./formatters"),o=new r({name:"post",call:"shh_post",params:1,inputFormatter:[i.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[o,a,s,u,c];e.exports={methods:l}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),i=t("./icap"),o=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new i(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=o.addr(a.institution());return c(t,s,n,a.client())}o.addr(a.insitution(),function(e,i){return c(t,i,n,a.client(),r)})},u=function(t,e,n,i){return r.eth.sendTransaction({address:e,from:t,value:n},i)},c=function(t,e,n,r,i){var o=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(o).at(e).deposit(r,{from:t,value:n},i)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),i=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),i=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),o=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,i,o]},o=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),i=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,i]};e.exports={eth:i,shh:o}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},i=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=r.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;i>o;o++){var a=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var o=0;i>o;o+=4)e[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var i=(n<<16)+e&r;return i/=4294967296,i+=.5,i*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=i(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new o.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new o.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new o.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,a=this.blockSize,s=4*a,u=i/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,i);if(c){for(var f=0;c>f;f+=a)this._doProcessBlock(r,f);var p=r.splice(0,c);n.sigBytes-=l}return new o.init(p,l)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(r.Hasher=l.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,i,o){"object"==typeof n?e.exports=n=i(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,i=r.WordArray,o=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],f=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,i=(2*t+3*e)%5;t=r,e=i}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var o=1,a=0;24>a;a++){for(var u=0,p=0,h=0;7>h;h++){if(1&o){var m=(1<m?p^=1<t;t++)p[t]=s.create()}();var h=u.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,i=0;r>i;i++){var o=t[e+2*i],a=t[e+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[i];s.high^=a,s.low^=o}for(var u=0;24>u;u++){for(var h=0;5>h;h++){for(var m=0,d=0,g=0;5>g;g++){var s=n[h+5*g];m^=s.high,d^=s.low}var y=p[h];y.high=m,y.low=d}for(var h=0;5>h;h++)for(var v=p[(h+4)%5],b=p[(h+1)%5],w=b.high,_=b.low,m=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),g=0;5>g;g++){var s=n[h+5*g];s.high^=m,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,I=s.low,B=c[x];if(32>B)var m=F<>>32-B,d=I<>>32-B;else var m=I<>>64-B,d=F<>>64-B;var N=p[l[x]];N.high=m,N.low=d}var O=p[0],A=n[0];O.high=A.high,O.low=A.low;for(var h=0;5>h;h++)for(var g=0;5>g;g++){var x=h+5*g,s=n[x],k=p[x],P=p[(h+1)%5+5*g],T=p[(h+2)%5+5*g];s.high=k.high^~P.high&T.high,s.low=k.low^~P.low&T.low}var s=n[0],D=f[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var f=a[l],p=f.high,h=f.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),c.push(h),c.push(p)}return new i.init(c,s)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=o._createHelper(h),n.HmacSHA3=o._createHmacHelper(h)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,i){"object"==typeof n?e.exports=n=i(t("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,i=r.Base,o=r.WordArray,a=n.x64={};a.Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var i=t[r];n.push(i.high),n.push(i.low)}return o.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){!function(n){"use strict";function r(t){function e(t,r){var i,o,a,s,u,c,l=this;if(!(l instanceof e))return z&&D(26,"constructor call without new",t),new e(t,r);if(null!=r&&W(r,2,64,C,"base")){if(r=0|r,c=t+"",10==r)return l=new e(t instanceof e?t:c),S(l,j+l.e+1,L);if((s="number"==typeof t)&&0*t!=0||!new RegExp("^-?"+(i="["+x.slice(0,r)+"]+")+"(?:\\."+i+")?$",37>r?"i":"").test(c))return d(l,c,s,r);s?(l.s=0>1/t?(c=c.slice(1),-1):1,z&&c.replace(/^0\.0*|\./,"").length>15&&D(C,_,t),s=!1):l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,l.s)}else{if(t instanceof e)return l.s=t.s,l.e=t.e,l.c=(t=t.c)?t.slice():t,void(C=0);if((s="number"==typeof t)&&0*t==0){if(l.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,a=t;a>=10;a/=10,o++);return l.e=o,l.c=[t],void(C=0)}c=t+""}else{if(!g.test(c=t+""))return d(l,c,s);l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(a=c.search(/e/i))>0?(0>o&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):0>o&&(o=c.length),a=0;48===c.charCodeAt(a);a++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(a,u+1))if(u=c.length,s&&z&&u>15&&D(C,_,l.s*t),o=o-a-1,o>G)l.c=l.e=null;else if(M>o)l.c=[l.e=0];else{if(l.e=o,l.c=[],a=(o+1)%I,0>o&&(a+=I),u>a){for(a&&l.c.push(+c.slice(0,a)),u-=I;u>a;)l.c.push(+c.slice(a,a+=I));c=c.slice(a),a=I-c.length}else a-=u;for(;a--;c+="0");l.c.push(+c)}else l.c=[l.e=0];C=0}function n(t,n,r,i){var a,s,u,l,p,h,m,d=t.indexOf("."),g=j,y=L;for(37>r&&(t=t.toLowerCase()),d>=0&&(u=V,V=0,t=t.replace(".",""),m=new e(r),p=m.pow(t.length-d),V=u,m.c=c(f(o(p.c),p.e),10,n),m.e=m.c.length),h=c(t,r,n),s=u=h.length;0==h[--u];h.pop());if(!h[0])return"0";if(0>d?--s:(p.c=h,p.e=s,p.s=i,p=E(p,m,g,y,n),h=p.c,l=p.r,s=p.e),a=s+g+1,d=h[a],u=n/2,l=l||0>a||null!=h[a+1],l=4>y?(null!=d||l)&&(0==y||y==(p.s<0?3:2)):d>u||d==u&&(4==y||l||6==y&&1&h[a-1]||y==(p.s<0?8:7)),1>a||!h[0])t=l?f("1",-g):"0";else{if(h.length=a,l)for(--n;++h[--a]>n;)h[a]=0,a||(++s,h.unshift(1));for(u=h.length;!h[--u];);for(d=0,t="";u>=d;t+=x.charAt(h[d++]));t=f(t,s)}return t}function h(t,n,r,i){var a,s,u,c,p;if(r=null!=r&&W(r,0,8,i,w)?0|r:L,!t.c)return t.toString();if(a=t.c[0],u=t.e,null==n)p=o(t.c),p=19==i||24==i&&q>=u?l(p,u):f(p,u);else if(t=S(new e(t),n,r),s=t.e,p=o(t.c),c=p.length,19==i||24==i&&(s>=n||q>=s)){for(;n>c;p+="0",c++);p=l(p,s)}else if(n-=u,p=f(p,s),s+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=s-c,n>0)for(s+1==c&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function k(t,n){var r,i,o=0;for(u(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&D(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function T(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>G?t.c=t.e=null:M>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function D(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",C=0,r}function S(t,e,n,r){var i,o,a,s,u,c,l,f=t.c,p=N;if(f){t:{for(i=1,s=f[0];s>=10;s/=10,i++);if(o=e-i,0>o)o+=I,a=e,u=f[c=0],l=u/p[i-a-1]%10|0;else if(c=y((o+1)/I),c>=f.length){if(!r)break t;for(;f.length<=c;f.push(0));u=l=0,i=1,o%=I,a=o-I+1}else{for(u=s=f[c],i=1;s>=10;s/=10,i++);o%=I,a=o-I+i,l=0>a?0:u/p[i-a-1]%10|0}if(r=r||0>e||null!=f[c+1]||(0>a?u:u%p[i-a-1]),r=4>n?(l||r)&&(0==n||n==(t.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?a>0?u/p[i-a]:0:f[c-1])%10&1||n==(t.s<0?8:7)),1>e||!f[0])return f.length=0,r?(e-=t.e+1,f[0]=p[e%I],t.e=-e||0):f[0]=t.e=0,t;if(0==o?(f.length=c,s=1,c--):(f.length=c+1,s=p[I-o],f[c]=a>0?v(u/p[i-a]%p[a])*s:0),r)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(t.e++,f[0]==F&&(f[0]=1));break}if(f[c]+=s,f[c]!=F)break;f[c--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}t.e>G?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return a(e="DECIMAL_PLACES")&&W(t,0,A,2,e)&&(j=0|t),r[e]=j,a(e="ROUNDING_MODE")&&W(t,0,8,2,e)&&(L=0|t),r[e]=L,a(e="EXPONENTIAL_AT")&&(u(t)?W(t[0],-A,0,2,e)&&W(t[1],0,A,2,e)&&(q=0|t[0],U=0|t[1]):W(t,-A,A,2,e)&&(q=-(U=0|(0>t?-t:t)))),r[e]=[q,U],a(e="RANGE")&&(u(t)?W(t[0],-A,-1,2,e)&&W(t[1],1,A,2,e)&&(M=0|t[0],G=0|t[1]):W(t,-A,A,2,e)&&(0|t?M=-(G=0|(0>t?-t:t)):z&&D(2,e+" cannot be zero",t))),r[e]=[M,G],a(e="ERRORS")&&(t===!!t||1===t||0===t?(C=0,W=(z=!!t)?P:s):z&&D(2,e+b,t)),r[e]=z,a(e="CRYPTO")&&(t===!!t||1===t||0===t?(J=!(!t||!m||"object"!=typeof m),t&&!J&&z&&D(2,"crypto unavailable",m)):z&&D(2,e+b,t)),r[e]=J,a(e="MODULO_MODE")&&W(t,0,9,2,e)&&($=0|t),r[e]=$,a(e="POW_PRECISION")&&W(t,0,A,2,e)&&(V=0|t),r[e]=V,a(e="FORMAT")&&("object"==typeof t?X=t:z&&D(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return k(arguments,R.lt)},e.min=function(){return k(arguments,R.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return v(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,a,s,u=0,c=[],l=new e(H);if(t=null!=t&&W(t,0,A,14)?0|t:j,a=y(t/I),J)if(m&&m.getRandomValues){for(r=m.getRandomValues(new Uint32Array(a*=2));a>u;)s=131072*r[u]+(r[u+1]>>>11),s>=9e15?(i=m.getRandomValues(new Uint32Array(2)),r[u]=i[0],r[u+1]=i[1]):(c.push(s%1e14),u+=2);u=a/2}else if(m&&m.randomBytes){for(r=m.randomBytes(a*=7);a>u;)s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6],s>=9e15?m.randomBytes(7).copy(r,u):(c.push(s%1e14),u+=7);u=a/7}else z&&D(14,"crypto unavailable",m);if(!u)for(;a>u;)s=n(),9e15>s&&(c[u++]=s%1e14);for(a=c[--u],t%=I,a&&t&&(s=N[I-t],c[u]=v(a/s)*s);0===c[u];c.pop(),u--);if(0>u)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(u=1,s=c[0];s>=10;s/=10,u++);I>u&&(o-=I-u)}return l.e=o,l.c=c,l}}(),E=function(){function t(t,e,n){var r,i,o,a,s=0,u=t.length,c=e%O,l=e/O|0;for(t=t.slice();u--;)o=t[u]%O,a=t[u]/O|0,r=l*o+a*c,i=c*o+r%O*O+s,s=(i/n|0)+(r/O|0)+l*a,t[u]=i%n;return s&&t.unshift(s),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,a,s,u,c){var l,f,p,h,m,d,g,y,b,w,_,x,B,N,O,A,k,P=o.s==a.s?1:-1,T=o.c,D=a.c;if(!(T&&T[0]&&D&&D[0]))return new e(o.s&&a.s&&(T?!D||T[0]!=D[0]:D)?T&&0==T[0]||!D?0*P:P/0:0/0);for(y=new e(P),b=y.c=[],f=o.e-a.e,P=s+f+1,c||(c=F,f=i(o.e/I)-i(a.e/I),P=P/I|0),p=0;D[p]==(T[p]||0);p++);if(D[p]>(T[p]||0)&&f--,0>P)b.push(1),h=!0;else{for(N=T.length,A=D.length,p=0,P+=2,m=v(c/(D[0]+1)),m>1&&(D=t(D,m,c),T=t(T,m,c),A=D.length,N=T.length),B=A,w=T.slice(0,A),_=w.length;A>_;w[_++]=0);k=D.slice(),k.unshift(0),O=D[0],D[1]>=c/2&&O++;do{if(m=0,l=n(D,w,A,_),0>l){if(x=w[0],A!=_&&(x=x*c+(w[1]||0)),m=v(x/O),m>1)for(m>=c&&(m=c-1),d=t(D,m,c),g=d.length,_=w.length;1==n(d,w,g,_);)m--,r(d,g>A?k:D,g,c),g=d.length,l=1;else 0==m&&(l=m=1),d=D.slice(),g=d.length;if(_>g&&d.unshift(0),r(w,d,_,c),_=w.length,-1==l)for(;n(D,w,A,_)<1;)m++,r(w,_>A?k:D,_,c),_=w.length}else 0===l&&(m++,w=[0]);b[p++]=m,w[0]?w[_++]=T[B]||0:(w=[T[B]],_=1)}while((B++=10;P/=10,p++);S(y,s+(y.e=p+f*I-1)+1,u,h)}else y.e=f,y.r=+h;return y}}(),d=function(){var t=/^(-?)0([xbo])/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+|^\s+|\s+$/g;return function(a,s,u,c){var l,f=u?s:s.replace(o,"");if(i.test(f))a.s=isNaN(f)?null:0>f?-1:1;else{if(!u&&(f=f.replace(t,function(t,e,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?t:e}),c&&(l=c,f=f.replace(n,"$1").replace(r,"0.$1")),s!=f))return new e(f,l);z&&D(C,"not a"+(c?" base "+c:"")+" number",s),a.s=null}a.c=a.e=null,C=0}}(),R.absoluteValue=R.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},R.ceil=function(){return S(new e(this),this.e+1,2)},R.comparedTo=R.cmp=function(t,n){return C=1,a(this,new e(t,n))},R.decimalPlaces=R.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},R.dividedBy=R.div=function(t,n){return C=3,E(this,new e(t,n),j,L)},R.dividedToIntegerBy=R.divToInt=function(t,n){return C=4,E(this,new e(t,n),0,1)},R.equals=R.eq=function(t,n){return C=5,0===a(this,new e(t,n))},R.floor=function(){return S(new e(this),this.e+1,3)},R.greaterThan=R.gt=function(t,n){return C=6,a(this,new e(t,n))>0},R.greaterThanOrEqualTo=R.gte=function(t,n){return C=7,1===(n=a(this,new e(t,n)))||0===n},R.isFinite=function(){return!!this.c},R.isInteger=R.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},R.isNaN=function(){return!this.s},R.isNegative=R.isNeg=function(){return this.s<0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.lessThan=R.lt=function(t,n){return C=8,a(this,new e(t,n))<0},R.lessThanOrEqualTo=R.lte=function(t,n){return C=9,-1===(n=a(this,new e(t,n)))||0===n},R.minus=R.sub=function(t,n){var r,o,a,s,u=this,c=u.s;if(C=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,u.plus(t);var l=u.e/I,f=t.e/I,p=u.c,h=t.c;if(!l||!f){if(!p||!h)return p?(t.s=-n,t):new e(h?u:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?u:3==L?-0:0)}if(l=i(l),f=i(f),p=p.slice(),c=l-f){for((s=0>c)?(c=-c,a=p):(f=l,a=h),a.reverse(),n=c;n--;a.push(0));a.reverse()}else for(o=(s=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){s=p[n]0)for(;n--;p[r++]=0);for(n=F-1;o>c;){if(p[--o]0?(u=s,r=l):(a=-a,r=c),r.reverse();a--;r.push(0));r.reverse()}for(a=c.length,n=l.length,0>a-n&&(r=l,l=c,c=r,n=a),a=0;n;)a=(c[--n]=c[n]+l[n]+a)/F|0,c[n]%=F;return a&&(c.unshift(a),++u),T(t,c,u)},R.precision=R.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&(z&&D(13,"argument"+b,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},R.round=function(t,n){var r=new e(this);return(null==t||W(t,0,A,15))&&S(r,~~t+this.e+1,null!=n&&W(n,0,8,15,w)?0|n:L),r},R.shift=function(t){var n=this;return W(t,-B,B,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-B>t||t>B)?n.s*(0>t?0:1/0):n)},R.squareRoot=R.sqrt=function(){var t,n,r,a,s,u=this,c=u.c,l=u.s,f=u.e,p=j+4,h=new e("0.5");if(1!==l||!c||!c[0])return new e(!l||0>l&&(!c||c[0])?0/0:c?u:1/0);if(l=Math.sqrt(+u),0==l||l==1/0?(n=o(c),(n.length+f)%2==0&&(n+="0"),l=Math.sqrt(n),f=i((f+1)/2)-(0>f||f%2),l==1/0?n="1e"+f:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+f),r=new e(n)):r=new e(l+""),r.c[0])for(f=r.e,l=f+p,3>l&&(l=0);;)if(s=r,r=h.times(s.plus(E(u,s,p,1))),o(s.c).slice(0,l)===(n=o(r.c)).slice(0,l)){if(r.el&&(g=w,w=_,_=g,a=l,l=h,h=a),a=l+h,g=[];a--;g.push(0));for(y=F,v=O,a=h;--a>=0;){for(r=0,m=_[a]%v,d=_[a]/v|0,u=l,s=a+u;s>a;)f=w[--u]%v,p=w[u]/v|0,c=d*f+p*m,f=m*f+c%v*v+g[s]+r,r=(f/y|0)+(c/v|0)+d*p,g[s--]=f%y;g[s]=r}return r?++o:g.shift(),T(t,g,o)},R.toDigits=function(t,n){var r=new e(this);return t=null!=t&&W(t,1,A,18,"precision")?0|t:null,n=null!=n&&W(n,0,8,18,w)?0|n:L,t?S(r,t,n):r},R.toExponential=function(t,e){return h(this,null!=t&&W(t,0,A,19)?~~t+1:null,e,19)},R.toFixed=function(t,e){return h(this,null!=t&&W(t,0,A,20)?~~t+this.e+1:null,e,20)},R.toFormat=function(t,e){var n=h(this,null!=t&&W(t,0,A,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+X.groupSize,a=+X.secondaryGroupSize,s=X.groupSeparator,u=i[0],c=i[1],l=this.s<0,f=l?u.slice(1):u,p=f.length;if(a&&(r=o,o=a,a=r,p-=r),o>0&&p>0){for(r=p%o||o,u=f.substr(0,r);p>r;r+=o)u+=s+f.substr(r,o);a>0&&(u+=s+f.slice(r)),l&&(u="-"+u)}n=c?u+X.decimalSeparator+((a=+X.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+X.fractionGroupSeparator):c):u}return n},R.toFraction=function(t){var n,r,i,a,s,u,c,l,f,p=z,h=this,m=h.c,d=new e(H),g=r=new e(H),y=c=new e(H);if(null!=t&&(z=!1,u=new e(t),z=p,(!(p=u.isInt())||u.lt(H))&&(z&&D(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&u.c&&S(u,u.e+1,1).gte(H)?u:null)),!m)return h.toString();for(f=o(m),a=d.e=f.length-h.e-1,d.c[0]=N[(s=a%I)<0?I+s:s],t=!t||u.cmp(d)>0?a>0?d:g:u,s=G,G=1/0,u=new e(f),c.c[0]=0;l=E(u,d,0,1),i=r.plus(l.times(y)),1!=i.cmp(t);)r=y,y=i,g=c.plus(l.times(i=g)),c=i,d=u.minus(l.times(i=d)),u=i;return i=E(t.minus(r),y,0,1),c=c.plus(i.times(g)),r=r.plus(i.times(y)),c.s=g.s=h.s,a*=2,n=E(g,y,a,L).minus(h).abs().cmp(E(c,r,a,L).minus(h).abs())<1?[g.toString(),y.toString()]:[c.toString(),r.toString()],G=s,n},R.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},R.toPower=R.pow=function(t){var n,r,i=v(0>t?-t:+t),o=this;if(!W(t,-B,B,23,"exponent")&&(!isFinite(t)||i>B&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=V?y(V/I+2):0,r=new e(H);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=v(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=H.div(r)),n?S(r,V,L):r},R.toPrecision=function(t,e){return h(this,null!=t&&W(t,1,A,24,"precision")?0|t:null,e,24)},R.toString=function(t){var e,r=this,i=r.s,a=r.e;return null===a?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&W(t,2,64,25,"base")?n(f(e,a),0|t,10,i):q>=a||a>=U?l(e,a):f(e,a),0>i&&r.c[0]&&(e="-"+e)),e},R.truncated=R.trunc=function(){return S(new e(this),this.e+1,1)},R.valueOf=R.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function a(t,e){var n,r,i=t.c,o=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=0>a,r=u==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return u>c^n?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;s>a;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return u==c?0:u>c^n?1:-1}function s(t,e,n){return(t=p(t))>=e&&n>=t}function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],a=0,s=t.length;s>a;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=x.indexOf(t.charAt(a++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function l(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function f(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?y(t):v(t)}var h,m,d,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=Math.ceil,v=Math.floor,b=" not a boolean or binary digit",w="rounding mode",_="number type has more than 15 significant digits",x="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",F=1e14,I=14,B=9007199254740991,N=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],O=1e7,A=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!m)try{m=t("crypto")}catch(k){}}else n.BigNumber=h}(this)},{crypto:31}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file diff --git a/example/event_inc.html b/example/event_inc.html index 01671c475..e4a1211b4 100644 --- a/example/event_inc.html +++ b/example/event_inc.html @@ -25,6 +25,7 @@ var address; var contract; + var inc; var update = function (err, x) { document.getElementById('result').textContent = JSON.stringify(x, null, 2); @@ -55,8 +56,8 @@ } }); - contract.Incremented({odd: true}).watch(update); - + inc = contract.Incremented({odd: true}); + inc.watch(update); }; var counter = 0; diff --git a/lib/utils/config.js b/lib/utils/config.js index d25b5d7ba..2070047c9 100644 --- a/lib/utils/config.js +++ b/lib/utils/config.js @@ -71,7 +71,7 @@ module.exports = { ETH_SIGNATURE_LENGTH: 4, ETH_UNITS: ETH_UNITS, ETH_BIGNUMBER_ROUNDING_MODE: { ROUNDING_MODE: BigNumber.ROUND_DOWN }, - ETH_POLLING_TIMEOUT: 1000, + ETH_POLLING_TIMEOUT: 1000/2, defaultBlock: 'latest', defaultAccount: undefined }; diff --git a/lib/version.json b/lib/version.json index 8fd887d4d..424d60960 100644 --- a/lib/version.json +++ b/lib/version.json @@ -1,3 +1,3 @@ { - "version": "0.5.0" + "version": "0.6.0" } diff --git a/lib/web3.js b/lib/web3.js index 021d896e6..66eea6ee1 100644 --- a/lib/web3.js +++ b/lib/web3.js @@ -93,8 +93,7 @@ web3.eth.filter = function (fil, eventParams, options, formatter) { return fil(eventParams, options); } - // what outputLogFormatter? that's wrong - //return new Filter(fil, watches.eth(), formatters.outputLogFormatter); + // output logs works for blockFilter and pendingTransaction filters? return new Filter(fil, watches.eth(), formatter || formatters.outputLogFormatter); }; /*jshint maxparams:3 */ @@ -149,6 +148,23 @@ Object.defineProperty(web3.eth, 'defaultAccount', { } }); + +// EXTEND +web3._extend = function(extension){ + /*jshint maxcomplexity: 6 */ + + if(extension.property && !web3[extension.property]) + web3[extension.property] = {}; + + setupMethods(web3[extension.property] || web3, extension.methods || []); + setupProperties(web3[extension.property] || web3, extension.properties || []); +}; +web3._extend.formatters = formatters; +web3._extend.utils = utils; +web3._extend.Method = require('./web3/method'); +web3._extend.Property = require('./web3/property'); + + /// setups all api methods setupProperties(web3, web3Properties); setupMethods(web3.net, net.methods); diff --git a/lib/web3/eth.js b/lib/web3/eth.js index 87a2b290c..ae67f999a 100644 --- a/lib/web3/eth.js +++ b/lib/web3/eth.js @@ -160,6 +160,13 @@ var getTransactionCount = new Method({ outputFormatter: utils.toDecimal }); +var sendRawTransaction = new Method({ + name: 'sendRawTransaction', + call: 'eth_sendRawTransaction', + params: 1, + inputFormatter: [] +}); + var sendTransaction = new Method({ name: 'sendTransaction', call: 'eth_sendTransaction', @@ -226,6 +233,7 @@ var methods = [ getTransactionCount, call, estimateGas, + sendRawTransaction, sendTransaction, compileSolidity, compileLLL, diff --git a/lib/web3/filter.js b/lib/web3/filter.js index bf66ab3ed..bb760c3dc 100644 --- a/lib/web3/filter.js +++ b/lib/web3/filter.js @@ -74,21 +74,36 @@ var getOptions = function (options) { }; }; -var Filter = function (options, methods, formatter) { - var implementation = {}; - methods.forEach(function (method) { - method.attachToObject(implementation); - }); - this.options = getOptions(options); - this.implementation = implementation; - this.callbacks = []; - this.formatter = formatter; - this.filterId = this.implementation.newFilter(this.options); +/** +Adds the callback and sets up the methods, to iterate over the results. + +@method getLogsAtStart +@param {Object} self +@param {funciton} +*/ +var getLogsAtStart = function(self, callback){ + // call getFilterLogs for the first watch callback start + if (!utils.isString(self.options)) { + self.get(function (err, messages) { + // don't send all the responses to all the watches again... just to self one + if (err) { + callback(err); + } + + messages.forEach(function (message) { + callback(null, message); + }); + }); + } }; -Filter.prototype.watch = function (callback) { - this.callbacks.push(callback); - var self = this; +/** +Adds the callback and sets up the methods, to iterate over the results. + +@method pollFilter +@param {Object} self +*/ +var pollFilter = function(self) { var onMessage = function (error, messages) { if (error) { @@ -105,29 +120,55 @@ Filter.prototype.watch = function (callback) { }); }; - // call getFilterLogs on start - if (!utils.isString(this.options)) { - this.get(function (err, messages) { - // don't send all the responses to all the watches again... just to this one - if (err) { - callback(err); - } + RequestManager.getInstance().startPolling({ + method: self.implementation.poll.call, + params: [self.filterId], + }, self.filterId, onMessage, self.stopWatching.bind(self)); - messages.forEach(function (message) { - callback(null, message); +}; + +var Filter = function (options, methods, formatter) { + var self = this; + var implementation = {}; + methods.forEach(function (method) { + method.attachToObject(implementation); + }); + this.options = getOptions(options); + this.implementation = implementation; + this.callbacks = []; + this.pollFilters = []; + this.formatter = formatter; + this.implementation.newFilter(this.options, function(error, id){ + if(error) { + self.callbacks.forEach(function(callback){ + callback(error); }); - }); + } else { + self.filterId = id; + // get filter logs at start + self.callbacks.forEach(function(callback){ + getLogsAtStart(self, callback); + }); + pollFilter(self); + } + }); +}; + +Filter.prototype.watch = function (callback) { + this.callbacks.push(callback); + + if(this.filterId) { + getLogsAtStart(this, callback); + pollFilter(this); } - RequestManager.getInstance().startPolling({ - method: this.implementation.poll.call, - params: [this.filterId], - }, this.filterId, onMessage, this.stopWatching.bind(this)); + return this; }; Filter.prototype.stopWatching = function () { RequestManager.getInstance().stopPolling(this.filterId); - this.implementation.uninstallFilter(this.filterId); + // remove filter async + this.implementation.uninstallFilter(this.filterId, function(){}); this.callbacks = []; }; @@ -149,6 +190,8 @@ Filter.prototype.get = function (callback) { return self.formatter ? self.formatter(log) : log; }); } + + return this; }; module.exports = Filter; diff --git a/lib/web3/formatters.js b/lib/web3/formatters.js index d45353649..743527e49 100644 --- a/lib/web3/formatters.js +++ b/lib/web3/formatters.js @@ -89,8 +89,10 @@ var inputTransactionFormatter = function (options){ * @returns {Object} transaction */ var outputTransactionFormatter = function (tx){ - tx.blockNumber = utils.toDecimal(tx.blockNumber); - tx.transactionIndex = utils.toDecimal(tx.transactionIndex); + if(tx.blockNumber !== null) + tx.blockNumber = utils.toDecimal(tx.blockNumber); + if(tx.transactionIndex !== null) + tx.transactionIndex = utils.toDecimal(tx.transactionIndex); tx.nonce = utils.toDecimal(tx.nonce); tx.gas = utils.toDecimal(tx.gas); tx.gasPrice = utils.toBigNumber(tx.gasPrice); @@ -112,7 +114,8 @@ var outputBlockFormatter = function(block) { block.gasUsed = utils.toDecimal(block.gasUsed); block.size = utils.toDecimal(block.size); block.timestamp = utils.toDecimal(block.timestamp); - block.number = utils.toDecimal(block.number); + if(block.number !== null) + block.number = utils.toDecimal(block.number); block.difficulty = utils.toBigNumber(block.difficulty); block.totalDifficulty = utils.toBigNumber(block.totalDifficulty); @@ -135,13 +138,12 @@ var outputBlockFormatter = function(block) { * @returns {Object} log */ var outputLogFormatter = function(log) { - if (log === null) { // 'pending' && 'latest' filters are nulls - return null; - } - - log.blockNumber = utils.toDecimal(log.blockNumber); - log.transactionIndex = utils.toDecimal(log.transactionIndex); - log.logIndex = utils.toDecimal(log.logIndex); + if(log.blockNumber !== null) + log.blockNumber = utils.toDecimal(log.blockNumber); + if(log.transactionIndex !== null) + log.transactionIndex = utils.toDecimal(log.transactionIndex); + if(log.logIndex !== null) + log.logIndex = utils.toDecimal(log.logIndex); return log; }; diff --git a/lib/web3/function.js b/lib/web3/function.js index 1b377be84..c510adf15 100644 --- a/lib/web3/function.js +++ b/lib/web3/function.js @@ -23,6 +23,7 @@ var web3 = require('../web3'); var coder = require('../solidity/coder'); var utils = require('../utils/utils'); +var formatters = require('./formatters'); var sha3 = require('../utils/sha3'); /** @@ -46,6 +47,12 @@ SolidityFunction.prototype.extractCallback = function (args) { } }; +SolidityFunction.prototype.extractDefaultBlock = function (args) { + if (args.length > this._inputTypes.length && !utils.isObject(args[args.length -1])) { + return formatters.inputDefaultBlockNumberFormatter(args.pop()); // modify the args array! + } +}; + /** * Should be used to create payload from arguments * @@ -97,15 +104,17 @@ SolidityFunction.prototype.unpackOutput = function (output) { SolidityFunction.prototype.call = function () { var args = Array.prototype.slice.call(arguments).filter(function (a) {return a !== undefined; }); var callback = this.extractCallback(args); + var defaultBlock = this.extractDefaultBlock(args); var payload = this.toPayload(args); + if (!callback) { - var output = web3.eth.call(payload); + var output = web3.eth.call(payload, defaultBlock); return this.unpackOutput(output); } var self = this; - web3.eth.call(payload, function (error, output) { + web3.eth.call(payload, defaultBlock, function (error, output) { callback(error, self.unpackOutput(output)); }); }; diff --git a/lib/web3/httpprovider.js b/lib/web3/httpprovider.js index fd972c05a..d3ac9cc34 100644 --- a/lib/web3/httpprovider.js +++ b/lib/web3/httpprovider.js @@ -35,6 +35,7 @@ HttpProvider.prototype.send = function (payload) { var request = new XMLHttpRequest(); request.open('POST', this.host, false); + request.setRequestHeader('Content-type','application/json'); try { request.send(JSON.stringify(payload)); @@ -78,7 +79,8 @@ HttpProvider.prototype.sendAsync = function (payload, callback) { }; request.open('POST', this.host, true); - + request.setRequestHeader('Content-type','application/json'); + try { request.send(JSON.stringify(payload)); } catch(error) { diff --git a/lib/web3/requestmanager.js b/lib/web3/requestmanager.js index 73a18881a..d46bf0a3c 100644 --- a/lib/web3/requestmanager.js +++ b/lib/web3/requestmanager.js @@ -43,9 +43,9 @@ var RequestManager = function (provider) { arguments.callee._singletonInstance = this; this.provider = provider; - this.polls = []; + this.polls = {}; this.timeout = null; - this.poll(); + this.isPolling = false; }; /** @@ -140,6 +140,11 @@ RequestManager.prototype.sendBatch = function (data, callback) { */ RequestManager.prototype.setProvider = function (p) { this.provider = p; + + if (this.provider && !this.isPolling) { + this.poll(); + this.isPolling = true; + } }; /*jshint maxparams:4 */ @@ -156,7 +161,7 @@ RequestManager.prototype.setProvider = function (p) { * @todo cleanup number of params */ RequestManager.prototype.startPolling = function (data, pollId, callback, uninstall) { - this.polls.push({data: data, id: pollId, callback: callback, uninstall: uninstall}); + this.polls['poll_'+ pollId] = {data: data, id: pollId, callback: callback, uninstall: uninstall}; }; /*jshint maxparams:3 */ @@ -167,24 +172,19 @@ RequestManager.prototype.startPolling = function (data, pollId, callback, uninst * @param {Number} pollId */ RequestManager.prototype.stopPolling = function (pollId) { - for (var i = this.polls.length; i--;) { - var poll = this.polls[i]; - if (poll.id === pollId) { - this.polls.splice(i, 1); - } - } + delete this.polls['poll_'+ pollId]; }; /** - * Should be called to reset polling mechanism of request manager + * Should be called to reset the polling mechanism of the request manager * * @method reset */ RequestManager.prototype.reset = function () { - this.polls.forEach(function (poll) { - poll.uninstall(poll.id); - }); - this.polls = []; + for (var key in this.polls) { + this.polls[key].uninstall(); + } + this.polls = {}; if (this.timeout) { clearTimeout(this.timeout); @@ -199,9 +199,10 @@ RequestManager.prototype.reset = function () { * @method poll */ RequestManager.prototype.poll = function () { + /*jshint maxcomplexity: 6 */ this.timeout = setTimeout(this.poll.bind(this), c.ETH_POLLING_TIMEOUT); - if (!this.polls.length) { + if (Object.keys(this.polls).length === 0) { return; } @@ -210,9 +211,18 @@ RequestManager.prototype.poll = function () { return; } - var payload = Jsonrpc.getInstance().toBatchPayload(this.polls.map(function (data) { - return data.data; - })); + var pollsData = []; + var pollsKeys = []; + for (var key in this.polls) { + pollsData.push(this.polls[key].data); + pollsKeys.push(key); + } + + if (pollsData.length === 0) { + return; + } + + var payload = Jsonrpc.getInstance().toBatchPayload(pollsData); var self = this; this.provider.sendAsync(payload, function (error, results) { @@ -220,14 +230,21 @@ RequestManager.prototype.poll = function () { if (error) { return; } - + if (!utils.isArray(results)) { throw errors.InvalidResponse(results); } results.map(function (result, index) { - result.callback = self.polls[index].callback; - return result; + var key = pollsKeys[index]; + // make sure the filter is still installed after arrival of the request + if (self.polls[key]) { + result.callback = self.polls[key].callback; + return result; + } else + return false; + }).filter(function (result) { + return !!result; }).filter(function (result) { var valid = Jsonrpc.getInstance().isValidResponse(result); if (!valid) { diff --git a/lib/web3/watches.js b/lib/web3/watches.js index 8bcfe207b..6b09fe329 100644 --- a/lib/web3/watches.js +++ b/lib/web3/watches.js @@ -29,11 +29,11 @@ var eth = function () { switch(type) { case 'latest': - args.pop(); + args.shift(); this.params = 0; return 'eth_newBlockFilter'; case 'pending': - args.pop(); + args.shift(); this.params = 0; return 'eth_newPendingTransactionFilter'; default: diff --git a/package.js b/package.js index ccf7ddd75..66c3ddb5d 100644 --- a/package.js +++ b/package.js @@ -1,7 +1,7 @@ /* jshint ignore:start */ Package.describe({ name: 'ethereum:web3', - version: '0.5.0', + version: '0.6.0', summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', git: 'https://github.com/ethereum/ethereum.js', // By default, Meteor will default to using README.md for documentation. diff --git a/package.json b/package.json index 3ff3028bb..f051c61cd 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "web3", "namespace": "ethereum", - "version": "0.5.0", + "version": "0.6.0", "description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC", "main": "./index.js", "directories": { @@ -17,11 +17,11 @@ }, "devDependencies": { "bower": ">=1.3.0", - "browserify": ">=6.0", + "browserify": ">=10.0", "chai": "^2.1.1", "coveralls": "^2.11.2", "del": ">=0.1.1", - "exorcist": "^0.1.6", + "exorcist": "^0.4.0", "gulp": ">=3.4.0", "gulp-jshint": ">=1.5.0", "gulp-rename": ">=1.2.0", diff --git a/test/contract.js b/test/contract.js index 00f9cbcc8..2632575f5 100644 --- a/test/contract.js +++ b/test/contract.js @@ -66,7 +66,7 @@ describe('web3.eth.contract', function () { provider.injectValidation(function (payload) { if (step === 0) { step = 1; - provider.injectResult(3); + provider.injectResult('0x3'); assert.equal(payload.jsonrpc, '2.0'); assert.equal(payload.method, 'eth_newFilter'); assert.deepEqual(payload.params[0], { @@ -105,7 +105,7 @@ describe('web3.eth.contract', function () { '0000000000000000000000000000000000000000000000000000000000000008' }]]); var r = payload.filter(function (p) { - return p.jsonrpc === '2.0' && p.method === 'eth_getFilterChanges' && p.params[0] === 3; + return p.jsonrpc === '2.0' && p.method === 'eth_getFilterChanges' && p.params[0] === '0x3'; }); assert.equal(r.length > 0, true); } @@ -114,7 +114,8 @@ describe('web3.eth.contract', function () { var contract = web3.eth.contract(desc).at(address); var res = 0; - contract.Changed({from: address}).watch(function(err, result) { + var event = contract.Changed({from: address}); + event.watch(function(err, result) { assert.equal(result.args.from, address); assert.equal(result.args.amount, 1); assert.equal(result.args.t1, 1); @@ -133,6 +134,7 @@ describe('web3.eth.contract', function () { provider.injectResult('0x0000000000000000000000000000000000000000000000000000000000000032'); var signature = 'balance(address)' var address = '0x1234567890123456789012345678901234567890'; + provider.injectValidation(function (payload) { assert.equal(payload.method, 'eth_call'); assert.deepEqual(payload.params, [{ @@ -147,6 +149,28 @@ describe('web3.eth.contract', function () { assert.deepEqual(new BigNumber(0x32), r); }); + it('should call constant function with default block', function () { + var provider = new FakeHttpProvider(); + web3.setProvider(provider); + web3.reset(); + provider.injectResult('0x0000000000000000000000000000000000000000000000000000000000000032'); + var signature = 'balance(address)' + var address = '0x1234567890123456789012345678901234567890'; + + provider.injectValidation(function (payload) { + assert.equal(payload.method, 'eth_call'); + assert.deepEqual(payload.params, [{ + data: '0x' + sha3(signature).slice(0, 8) + '0000000000000000000000001234567890123456789012345678901234567890', + to: address + }, '0xb']); + }); + + var contract = web3.eth.contract(desc).at(address); + + var r = contract.balance(address, 11); + assert.deepEqual(new BigNumber(0x32), r); + }); + it('should sendTransaction to contract function', function () { var provider = new FakeHttpProvider(); web3.setProvider(provider); @@ -218,6 +242,31 @@ describe('web3.eth.contract', function () { }); + it('should explicitly make a call with optional params and defaultBlock', function () { + + var provider = new FakeHttpProvider(); + web3.setProvider(provider); + web3.reset(); + provider.injectResult('0x0000000000000000000000000000000000000000000000000000000000000032'); + var signature = 'balance(address)'; + var address = '0x1234567890123456789012345678901234567890'; + provider.injectValidation(function (payload) { + assert.equal(payload.method, 'eth_call'); + assert.deepEqual(payload.params, [{ + data: '0x' + sha3(signature).slice(0, 8) + '0000000000000000000000001234567890123456789012345678901234567890', + to: address, + from: address, + gas: '0xc350' + }, '0xb']); + }); + + var contract = web3.eth.contract(desc).at(address); + + var r = contract.balance.call(address, {from: address, gas: 50000}, 11); + assert.deepEqual(new BigNumber(0x32), r); + + }); + it('should sendTransaction with optional params', function () { var provider = new FakeHttpProvider(); web3.setProvider(provider); diff --git a/test/formatters.outputBlockFormatter.js b/test/formatters.outputBlockFormatter.js index 272250651..a94c87b37 100644 --- a/test/formatters.outputBlockFormatter.js +++ b/test/formatters.outputBlockFormatter.js @@ -8,38 +8,72 @@ describe('formatters', function () { it('should return the correct value', function () { assert.deepEqual(formatters.outputBlockFormatter({ - hash: '0x34234kjh23kj4234', - parentHash: '0x34234kjh23kj4234', - miner: '0x34234kjh23kj4234', - stateRoot: '0x34234kjh23kj4234', - sha3Uncles: '0x34234kjh23kj4234', - bloom: '0x34234kjh23kj4234', + hash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265', + miner: '0xdcc6960376d6c6dea93647383ffb245cfced97cf', + stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583', + sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', difficulty: '0x3e8', totalDifficulty: '0x3e8', number: '0x3e8', gasLimit: '0x3e8', gasUsed: '0x3e8', timestamp: '0x3e8', - extraData: '0x34234kjh23kj4234', - nonce: '0x34234kjh23kj4234', - children: ['0x34234kjh23kj4234'], + extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + nonce: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', size: '0x3e8' }), { - hash: '0x34234kjh23kj4234', - parentHash: '0x34234kjh23kj4234', - miner: '0x34234kjh23kj4234', - stateRoot: '0x34234kjh23kj4234', - sha3Uncles: '0x34234kjh23kj4234', - bloom: '0x34234kjh23kj4234', + hash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265', + miner: '0xdcc6960376d6c6dea93647383ffb245cfced97cf', + stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583', + sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', difficulty: new BigNumber(1000), totalDifficulty: new BigNumber(1000), number: 1000, gasLimit: 1000, gasUsed: 1000, timestamp: 1000, - extraData: '0x34234kjh23kj4234', - nonce: '0x34234kjh23kj4234', - children: ['0x34234kjh23kj4234'], + extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + nonce: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + size: 1000 + }); + }); + it('should return the correct value, when null values are present', function () { + + assert.deepEqual(formatters.outputBlockFormatter({ + hash: null, + parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265', + miner: null, + stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583', + sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + difficulty: '0x3e8', + totalDifficulty: '0x3e8', + number: null, + gasLimit: '0x3e8', + gasUsed: '0x3e8', + timestamp: '0x3e8', + extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + nonce: null, + size: '0x3e8' + }), { + hash: null, + parentHash: '0x83ffb245cfced97ccc5c75253d6960376d6c6dea93647397a543a72fdaea5265', + miner: null, + stateRoot: '0x54dda68af07643f68739a6e9612ad157a26ae7e2ce81f77842bb5835fbcde583', + sha3Uncles: '0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347', + bloom: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + difficulty: new BigNumber(1000), + totalDifficulty: new BigNumber(1000), + number: null, + gasLimit: 1000, + gasUsed: 1000, + timestamp: 1000, + extraData: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + nonce: null, size: 1000 }); }); diff --git a/test/formatters.outputLogFormatter.js b/test/formatters.outputLogFormatter.js index 495a64620..432bfb0d2 100644 --- a/test/formatters.outputLogFormatter.js +++ b/test/formatters.outputLogFormatter.js @@ -9,17 +9,37 @@ describe('formatters', function () { transactionIndex: '0x3e8', logIndex: '0x3e8', blockNumber: '0x3e8', - transactionHash: '0x7b2274657374223a2274657374227d', - blockHash: '0x7b2274657374223a2274657374227d', - data: '0x7b2274657374223a2274657374227d', + transactionHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + blockHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + data: '0x7b2274657374223a2274657374227', topics: ['0x68656c6c6f','0x6d79746f70696373'] }), { transactionIndex: 1000, logIndex: 1000, blockNumber: 1000, - transactionHash: '0x7b2274657374223a2274657374227d', - blockHash: '0x7b2274657374223a2274657374227d', - data: '0x7b2274657374223a2274657374227d', + transactionHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + blockHash: '0xd6960376d6c6dea93647383ffb245cfced97ccc5c7525397a543a72fdaea5265', + data: '0x7b2274657374223a2274657374227', + topics: ['0x68656c6c6f','0x6d79746f70696373'] + }); + }); + it('should return the correct value, when null values are present', function () { + + assert.deepEqual(formatters.outputLogFormatter({ + transactionIndex: null, + logIndex: null, + blockNumber: null, + transactionHash: null, + blockHash: null, + data: '0x7b2274657374223a2274657374227', + topics: ['0x68656c6c6f','0x6d79746f70696373'] + }), { + transactionIndex: null, + logIndex: null, + blockNumber: null, + transactionHash: null, + blockHash: null, + data: '0x7b2274657374223a2274657374227', topics: ['0x68656c6c6f','0x6d79746f70696373'] }); }); diff --git a/test/formatters.outputTransactionFormatter.js b/test/formatters.outputTransactionFormatter.js index ef19b6da7..db4831602 100644 --- a/test/formatters.outputTransactionFormatter.js +++ b/test/formatters.outputTransactionFormatter.js @@ -7,7 +7,7 @@ describe('formatters', function () { it('should return the correct value', function () { assert.deepEqual(formatters.outputTransactionFormatter({ - input: '0x34234kjh23kj4234', + input: '0x3454645634534', from: '0x00000', to: '0x00000', value: '0x3e8', @@ -16,9 +16,9 @@ describe('formatters', function () { nonce: '0xb', transactionIndex: '0x1', blockNumber: '0x3e8', - blockHash: '0x34234bf23bf4234' + blockHash: '0xc9b9cdc2092a9d6589d96662b1fd6949611163fb3910cf8a173cd060f17702f9' }), { - input: '0x34234kjh23kj4234', + input: '0x3454645634534', from: '0x00000', to: '0x00000', value: new BigNumber(1000), @@ -26,9 +26,36 @@ describe('formatters', function () { gasPrice: new BigNumber(1000), nonce: 11, blockNumber: 1000, - blockHash: '0x34234bf23bf4234', + blockHash: '0xc9b9cdc2092a9d6589d96662b1fd6949611163fb3910cf8a173cd060f17702f9', transactionIndex: 1 }); }); + + it('should return the correct value, when null values are present', function () { + + assert.deepEqual(formatters.outputTransactionFormatter({ + input: '0x3454645634534', + from: '0x00000', + to: null, + value: '0x3e8', + gas: '0x3e8', + gasPrice: '0x3e8', + nonce: '0xb', + transactionIndex: null, + blockNumber: null, + blockHash: null + }), { + input: '0x3454645634534', + from: '0x00000', + to: null, + value: new BigNumber(1000), + gas: 1000, + gasPrice: new BigNumber(1000), + nonce: 11, + blockNumber: null, + blockHash: null, + transactionIndex: null + }); + }); }); }); diff --git a/test/helpers/FakeHttpProvider2.js b/test/helpers/FakeHttpProvider2.js index 0f26d84b7..e287a0745 100644 --- a/test/helpers/FakeHttpProvider2.js +++ b/test/helpers/FakeHttpProvider2.js @@ -15,11 +15,21 @@ FakeHttpProvider2.prototype.injectResultList = function (list) { FakeHttpProvider2.prototype.getResponse = function () { var result = this.resultList[this.counter]; this.counter++; + + // add fallback result value + if(!result) + result = { + result: undefined + }; + if (result.type === 'batch') { this.injectBatchResults(result.result); } else { this.injectResult(result.result); } + + this.counter = 0; + return this.response; }; diff --git a/test/helpers/FakeXMLHttpRequest.js b/test/helpers/FakeXMLHttpRequest.js index a67d7f74a..6dc35b98a 100644 --- a/test/helpers/FakeXMLHttpRequest.js +++ b/test/helpers/FakeXMLHttpRequest.js @@ -6,6 +6,9 @@ var FakeXMLHttpRequest = function () { this.readyState = 4; this.onreadystatechange = null; this.async = false; + this.headers = { + 'Content-Type': 'text/plain' + }; }; FakeXMLHttpRequest.prototype.open = function (method, host, async) { @@ -15,6 +18,10 @@ FakeXMLHttpRequest.prototype.open = function (method, host, async) { this.async = async; }; +FakeXMLHttpRequest.prototype.setRequestHeader = function(name, value) { + this.headers[name] = value; +}; + FakeXMLHttpRequest.prototype.send = function (payload) { assert.equal(typeof payload, 'string'); if (this.async) { diff --git a/test/web3.extend.js b/test/web3.extend.js new file mode 100644 index 000000000..dfa863a23 --- /dev/null +++ b/test/web3.extend.js @@ -0,0 +1,76 @@ +var chai = require('chai'); +var assert = chai.assert; +var FakeHttpProvider = require('./helpers/FakeHttpProvider'); +var web3 = require('../lib/web3'); + + +var tests = [{ + properties: [new web3._extend.Property({ + name: 'gasPrice', + getter: 'eth_gasPrice', + outputFormatter: web3._extend.formatters.outputBigNumberFormatter + })] +},{ + methods: [new web3._extend.Method({ + name: 'getBalance', + call: 'eth_getBalance', + params: 2, + inputFormatter: [web3._extend.utils.toAddress, web3._extend.formatters.inputDefaultBlockNumberFormatter], + outputFormatter: web3._extend.formatters.outputBigNumberFormatter + })] +},{ + property: 'admin', + properties: [new web3._extend.Property({ + name: 'gasPrice', + getter: 'eth_gasPrice', + outputFormatter: web3._extend.formatters.outputBigNumberFormatter + })], + methods: [new web3._extend.Method({ + name: 'getBalance', + call: 'eth_getBalance', + params: 2, + inputFormatter: [web3._extend.utils.toAddress, web3._extend.formatters.inputDefaultBlockNumberFormatter], + outputFormatter: web3._extend.formatters.outputBigNumberFormatter + })] +}]; + +describe('web3', function () { + describe('_extend', function () { + tests.forEach(function (test, index) { + it('test no: ' + index, function () { + web3._extend(test); + + + if(test.properties) + test.properties.forEach(function(property){ + + var provider = new FakeHttpProvider(); + web3.setProvider(provider); + provider.injectResult(''); + provider.injectValidation(function (payload) { + assert.equal(payload.jsonrpc, '2.0'); + assert.equal(payload.method, property.getter); + }); + + if(test.property) { + assert.isObject(web3[test.property][property.name]); + assert.isFunction(web3[test.property]['get'+ property.name.charAt(0).toUpperCase() + property.name.slice(1)]); + } else { + assert.isObject(web3[property.name]); + assert.isFunction(web3['get'+ property.name.charAt(0).toUpperCase() + property.name.slice(1)]); + } + }); + + if(test.methods) + test.methods.forEach(function(property){ + if(test.property) + assert.isFunction(web3[test.property][property.name]); + else + assert.isFunction(web3[property.name]); + }); + + }); + }); + }); +}); + From e01be87ea8c5253d489b2a96cfe9d6eb4a0da785 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 23 Jun 2015 11:38:39 +0200 Subject: [PATCH 167/169] load web3.admin js files --- alethzero/DappLoader.cpp | 2 + libjsqrc/admin.js | 120 +++++++++++++++++++++++++++++++++++++++ libjsqrc/js.qrc | 1 + 3 files changed, 123 insertions(+) create mode 100644 libjsqrc/admin.js diff --git a/alethzero/DappLoader.cpp b/alethzero/DappLoader.cpp index 662a1afbc..5ef784e3a 100644 --- a/alethzero/DappLoader.cpp +++ b/alethzero/DappLoader.cpp @@ -193,6 +193,8 @@ QByteArray const& DappLoader::web3Content() code += "\n"; code += contentsOfQResource(":/js/setup.js"); code += "\n"; + code += contentsOfQResource(":/js/admin.js"); + code += "\n"; m_web3Js = code.toLatin1(); } return m_web3Js; diff --git a/libjsqrc/admin.js b/libjsqrc/admin.js new file mode 100644 index 000000000..4bd55e74f --- /dev/null +++ b/libjsqrc/admin.js @@ -0,0 +1,120 @@ +web3.admin = {}; +web3.admin.setSessionKey = function(s) { web3.admin.sessionKey = s; }; + +var getSessionKey = function () { return web3.admin.sessionKey; }; + +web3._extend({ + property: 'admin', + methods: [new web3._extend.Method({ + name: 'web3.setVerbosity', + call: 'admin_web3_setVerbosity', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'net.start', + call: 'admin_net_start', + inputFormatter: [getSessionKey], + params: 1 + }), new web3._extend.Method({ + name: 'net.stop', + call: 'admin_net_stop', + inputFormatter: [getSessionKey], + params: 1 + }), new web3._extend.Method({ + name: 'net.connect', + call: 'admin_net_connect', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'net.peers', + call: 'admin_net_peers', + inputFormatter: [getSessionKey], + params: 1 + }), new web3._extend.Method({ + name: 'eth.blockQueueStatus', + call: 'admin_eth_blockQueueStatus', + inputFormatter: [getSessionKey], + params: 1 + }), new web3._extend.Method({ + name: 'eth.setAskPrice', + call: 'admin_eth_setAskPrice', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.setBidPrice', + call: 'admin_eth_setBidPrice', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.setReferencePrice', + call: 'admin_eth_setReferencePrice', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.setPriority', + call: 'admin_eth_setPriority', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.setMining', + call: 'admin_eth_setMining', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.findBlock', + call: 'admin_eth_findBlock', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.blockQueueFirstUnknown', + call: 'admin_eth_blockQueueFirstUnknown', + inputFormatter: [getSessionKey], + params: 1 + }), new web3._extend.Method({ + name: 'eth.blockQueueRetryUnknown', + call: 'admin_eth_blockQueueRetryUnknown', + inputFormatter: [getSessionKey], + params: 1 + }), new web3._extend.Method({ + name: 'eth.allAccounts', + call: 'admin_eth_allAccounts', + inputFormatter: [getSessionKey], + params: 1 + }), new web3._extend.Method({ + name: 'eth.newAccount', + call: 'admin_eth_newAccount', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.setSigningKey', + call: 'admin_eth_setSigningKey', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.setMiningBenefactor', + call: 'admin_eth_setMiningBenefactor', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.inspect', + call: 'admin_eth_inspect', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.reprocess', + call: 'admin_eth_reprocess', + inputFormatter: [null, getSessionKey], + params: 2 + }), new web3._extend.Method({ + name: 'eth.vmTrace', + call: 'admin_eth_vmTrace', + inputFormatter: [null, null, getSessionKey], + params: 3 + }), new web3._extend.Method({ + name: 'eth.getReceiptByHashAndIndex', + call: 'admin_eth_getReceiptByHashAndIndex', + inputFormatter: [null, null, getSessionKey], + params: 3 + })] +}); + diff --git a/libjsqrc/js.qrc b/libjsqrc/js.qrc index 0fde5703a..8bdde07a3 100644 --- a/libjsqrc/js.qrc +++ b/libjsqrc/js.qrc @@ -2,6 +2,7 @@ bignumber.min.js setup.js + admin.js ethereumjs/dist/web3.js From aeb6f95299450dc7f80c9dab7ee6bf4385fc6937 Mon Sep 17 00:00:00 2001 From: Marek Kotewicz Date: Tue, 23 Jun 2015 11:38:53 +0200 Subject: [PATCH 168/169] Squashed 'libjsqrc/ethereumjs/' changes from ecde334..2a0b46a 2a0b46a gulp git-subtree-dir: libjsqrc/ethereumjs git-subtree-split: 2a0b46ab7125533d7cbb461d06821ba242a03304 --- dist/web3-light.js | 8 ++++++++ dist/web3-light.min.js | 4 ++-- dist/web3.js | 8 ++++++++ dist/web3.js.map | 4 ++-- dist/web3.min.js | 4 ++-- 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/dist/web3-light.js b/dist/web3-light.js index a78f5ae68..a57cac292 100644 --- a/dist/web3-light.js +++ b/dist/web3-light.js @@ -2037,6 +2037,13 @@ var getTransactionCount = new Method({ outputFormatter: utils.toDecimal }); +var sendRawTransaction = new Method({ + name: 'sendRawTransaction', + call: 'eth_sendRawTransaction', + params: 1, + inputFormatter: [] +}); + var sendTransaction = new Method({ name: 'sendTransaction', call: 'eth_sendTransaction', @@ -2103,6 +2110,7 @@ var methods = [ getTransactionCount, call, estimateGas, + sendRawTransaction, sendTransaction, compileSolidity, compileLLL, diff --git a/dist/web3-light.min.js b/dist/web3-light.min.js index 3c20171ea..962e16e5f 100644 --- a/dist/web3-light.min.js +++ b/dist/web3-light.min.js @@ -1,2 +1,2 @@ -require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ai;i+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(i+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var o=n._requireType(t),i=o.sliceParam(e,r,t);return o.formatOutput(i,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:i.formatInputBool,outputFormatter:i.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:i.formatInputDynamicBytes,outputFormatter:i.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:i.formatInputBytes,outputFormatter:i.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){var e=2*i.ETH_PADDING;r.config(i.ETH_BIGNUMBER_ROUNDING_MODE);var n=o.padLeft(o.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},l=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},p=function(t){return s(new r(t).times(new r(2).pow(128)))},f=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},m=function(t){var e=t.staticPart()||"0";return f(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},h=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return o.toAscii(t.staticPart())},b=function(t){return o.toAscii(t.dynamicPart().slice(64))},w=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:l,formatInputReal:p,formatOutputInt:m,formatOutputUInt:h,formatOutputReal:d,formatOutputUReal:y,formatOutputBool:g,formatOutputBytes:v,formatOutputDynamicBytes:b,formatOutputAddress:w}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},o.decodeParam=function(t,e){return e=e||0,new o(t.substr(64*e,64))};var i=function(t,e){return parseInt("0x"+t.substr(64*e,64))};o.decodeBytes=function(t,e){e=e||0;var n=i(t,e);return new o(t.substr(2*n,128),0)},o.decodeArray=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return new o(t.substr(2*n,64*(r+1)),0)},e.exports=o},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),o=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:o,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),o=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),o(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),o={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);if(0===o)break;e+=String.fromCharCode(o)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&!i.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+o.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=o.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),o=this.toPayload(t);if(!e){var i=r.eth.call(o,n);return this.unpackOutput(i)}var a=this;r.eth.call(o,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return i.extractDisplayName(this._name)},u.prototype.typeName=function(){return i.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,o=t("./errors"),i=function(t){this.host=t||"http://localhost:8545"};i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(i)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function" -},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),o=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};o.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},o.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},o.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[o("get",r)]=this.getAsync.bind(this)},o.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},o.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=o},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[i,a,s,u,c];e.exports={methods:l}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,o);if(c){for(var p=0;c>p;p+=a)this._doProcessBlock(r,p);var f=r.splice(0,c);n.sigBytes-=l}return new i.init(f,l)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(r.Hasher=l.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new p.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],p=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,f=0,m=0;7>m;m++){if(1&i){var h=(1<h?f^=1<t;t++)f[t]=s.create()}();var m=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var m=0;5>m;m++){for(var h=0,d=0,y=0;5>y;y++){var s=n[m+5*y];h^=s.high,d^=s.low}var g=f[m];g.high=h,g.low=d}for(var m=0;5>m;m++)for(var v=f[(m+4)%5],b=f[(m+1)%5],w=b.high,_=b.low,h=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),y=0;5>y;y++){var s=n[m+5*y];s.high^=h,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,B=s.low,I=c[x];if(32>I)var h=F<>>32-I,d=B<>>32-I;else var h=B<>>64-I,d=F<>>64-I;var k=f[l[x]];k.high=h,k.low=d}var N=f[0],P=n[0];N.high=P.high,N.low=P.low;for(var m=0;5>m;m++)for(var y=0;5>y;y++){var x=m+5*y,s=n[x],A=f[x],O=f[(m+1)%5+5*y],T=f[(m+2)%5+5*y];s.high=A.high^~O.high&T.high,s.low=A.low^~O.low&T.low}var s=n[0],D=p[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var p=a[l],f=p.high,m=p.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),c.push(m),c.push(f)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(m),n.HmacSHA3=i._createHmacHelper(m)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){"use strict";e.exports=BigNumber},{}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file +require=function t(e,n,r){function o(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return o(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;ai;i+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(i+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var o=n._requireType(t),i=o.sliceParam(e,r,t);return o.formatOutput(i,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:i.formatInputBool,outputFormatter:i.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:i.formatInputInt,outputFormatter:i.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:i.formatInputDynamicBytes,outputFormatter:i.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:i.formatInputBytes,outputFormatter:i.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:i.formatInputReal,outputFormatter:i.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./param"),s=function(t){var e=2*i.ETH_PADDING;r.config(i.ETH_BIGNUMBER_ROUNDING_MODE);var n=o.padLeft(o.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=o.fromAscii(t,i.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},l=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},p=function(t){return s(new r(t).times(new r(2).pow(128)))},f=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},m=function(t){var e=t.staticPart()||"0";return f(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},h=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return o.toAscii(t.staticPart())},b=function(t){return o.toAscii(t.dynamicPart().slice(64))},w=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:l,formatInputReal:p,formatOutputInt:m,formatOutputUInt:h,formatOutputReal:d,formatOutputUReal:y,formatOutputBool:g,formatOutputBytes:v,formatOutputDynamicBytes:b,formatOutputAddress:w}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),o=function(t,e){this.value=t||"",this.offset=e};o.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},o.prototype.withOffset=function(t){return new o(this.value,t)},o.prototype.combine=function(t){return new o(this.value+t.value)},o.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},o.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},o.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},o.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},o.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},o.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},o.decodeParam=function(t,e){return e=e||0,new o(t.substr(64*e,64))};var i=function(t,e){return parseInt("0x"+t.substr(64*e,64))};o.decodeBytes=function(t,e){e=e||0;var n=i(t,e);return new o(t.substr(2*n,128),0)},o.decodeArray=function(t,e){e=e||0;var n=i(t,e),r=parseInt("0x"+t.substr(2*n,64));return new o(t.substr(2*n,64*(r+1)),0)},e.exports=o},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),o=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:o,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),o=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),o(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),o={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},i=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var o=parseInt(t.substr(n,2),16);if(0===o)break;e+=String.fromCharCode(o)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&!i.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&i.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+o.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=o.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),o=this.toPayload(t);if(!e){var i=r.eth.call(o,n);return this.unpackOutput(i)}var a=this;r.eth.call(o,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return i.extractDisplayName(this._name)},u.prototype.typeName=function(){return i.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,o=t("./errors"),i=function(t){this.host=t||"http://localhost:8545"};i.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw o.InvalidConnection(this.host)}var i=e.responseText;try{i=JSON.parse(i)}catch(a){throw o.InvalidResponse(i)}return i},i.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(i){r=o.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(i){e(o.InvalidConnection(this.host))}},e.exports=i},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),o=function(t){this._iban=t};o.prototype.isValid=function(){return r.isIBAN(this._iban)},o.prototype.isDirect=function(){return 34===this._iban.length},o.prototype.isIndirect=function(){return 20===this._iban.length},o.prototype.checksum=function(){return this._iban.substr(2,2)},o.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},o.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},o.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=o},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),o=t("../utils/utils"),i=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return o.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return o.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw i.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),o="0xc6d9d2cd449a754c494264e1809c50e34d64562b",i=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0, +inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(i).at(o)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),o=t("./property"),i=[],a=[new o({name:"listening",getter:"net_listening"}),new o({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:i,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),o=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};o.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},o.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},o.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var o=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[o("get",r)]=this.getAsync.bind(this)},o.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},o.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=o},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),o=t("../utils/utils"),i=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):o.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),i.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!o.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return o.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),o=t("./formatters"),i=new r({name:"post",call:"shh_post",params:1,inputFormatter:[o.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[i,a,s,u,c];e.exports={methods:l}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),o=t("./icap"),i=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new o(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=i.addr(a.institution());return c(t,s,n,a.client())}i.addr(a.insitution(),function(e,o){return c(t,o,n,a.client(),r)})},u=function(t,e,n,o){return r.eth.sendTransaction({address:e,from:t,value:n},o)},c=function(t,e,n,r,o){var i=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(i).at(e).deposit(r,{from:t,value:n},o)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),o=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),o=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),i=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,o,i]},i=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),o=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,o]};e.exports={eth:o,shh:i}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},o=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),i=r.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,o=t.sigBytes;if(this.clamp(),r%4)for(var i=0;o>i;i++){var a=n[i>>>2]>>>24-i%4*8&255;e[r+i>>>2]|=a<<24-(r+i)%4*8}else for(var i=0;o>i;i+=4)e[r+i>>>2]=n[i>>>2];return this.sigBytes+=o,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],o=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var o=(n<<16)+e&r;return o/=4294967296,o+=.5,o*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=o(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new i.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push((i>>>4).toString(16)),r.push((15&i).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new i.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],o=0;n>o;o++){var i=e[o>>>2]>>>24-o%4*8&255;r.push(String.fromCharCode(i))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new i.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new i.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,o=n.sigBytes,a=this.blockSize,s=4*a,u=o/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,o);if(c){for(var p=0;c>p;p+=a)this._doProcessBlock(r,p);var f=r.splice(0,c);n.sigBytes-=l}return new i.init(f,l)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),p=(r.Hasher=l.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new p.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,o,i){"object"==typeof n?e.exports=n=o(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],o):o(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,o=r.WordArray,i=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],p=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,o=(2*t+3*e)%5;t=r,e=o}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,a=0;24>a;a++){for(var u=0,f=0,m=0;7>m;m++){if(1&i){var h=(1<h?f^=1<t;t++)f[t]=s.create()}();var m=u.SHA3=i.extend({cfg:i.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,o=0;r>o;o++){var i=t[e+2*o],a=t[e+2*o+1];i=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[o];s.high^=a,s.low^=i}for(var u=0;24>u;u++){for(var m=0;5>m;m++){for(var h=0,d=0,y=0;5>y;y++){var s=n[m+5*y];h^=s.high,d^=s.low}var g=f[m];g.high=h,g.low=d}for(var m=0;5>m;m++)for(var v=f[(m+4)%5],b=f[(m+1)%5],w=b.high,_=b.low,h=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),y=0;5>y;y++){var s=n[m+5*y];s.high^=h,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,B=s.low,I=c[x];if(32>I)var h=F<>>32-I,d=B<>>32-I;else var h=B<>>64-I,d=F<>>64-I;var k=f[l[x]];k.high=h,k.low=d}var N=f[0],P=n[0];N.high=P.high,N.low=P.low;for(var m=0;5>m;m++)for(var y=0;5>y;y++){var x=m+5*y,s=n[x],A=f[x],O=f[(m+1)%5+5*y],T=f[(m+2)%5+5*y];s.high=A.high^~O.high&T.high,s.low=A.low^~O.low&T.low}var s=n[0],D=p[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),i=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/i)*i>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var p=a[l],f=p.high,m=p.low;f=16711935&(f<<8|f>>>24)|4278255360&(f<<24|f>>>8),m=16711935&(m<<8|m>>>24)|4278255360&(m<<24|m>>>8),c.push(m),c.push(f)}return new o.init(c,s)},clone:function(){for(var t=i.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=i._createHelper(m),n.HmacSHA3=i._createHmacHelper(m)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,o){"object"==typeof n?e.exports=n=o(t("./core")):"function"==typeof define&&define.amd?define(["./core"],o):o(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,o=r.Base,i=r.WordArray,a=n.x64={};a.Word=o.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=o.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var o=t[r];n.push(o.high),n.push(o.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=o.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){"use strict";e.exports=BigNumber},{}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file diff --git a/dist/web3.js b/dist/web3.js index 7b495b48e..70b096cf1 100644 --- a/dist/web3.js +++ b/dist/web3.js @@ -2037,6 +2037,13 @@ var getTransactionCount = new Method({ outputFormatter: utils.toDecimal }); +var sendRawTransaction = new Method({ + name: 'sendRawTransaction', + call: 'eth_sendRawTransaction', + params: 1, + inputFormatter: [] +}); + var sendTransaction = new Method({ name: 'sendTransaction', call: 'eth_sendTransaction', @@ -2103,6 +2110,7 @@ var methods = [ getTransactionCount, call, estimateGas, + sendRawTransaction, sendTransaction, compileSolidity, compileLLL, diff --git a/dist/web3.js.map b/dist/web3.js.map index 75d356186..b000cdd4b 100644 --- a/dist/web3.js.map +++ b/dist/web3.js.map @@ -40,7 +40,7 @@ "index.js" ], "names": [], - "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClfA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnRA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACruBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3nFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", + "mappings": "AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClNA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACTA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClfA;AACA;AACA;AACA;;ACHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3RA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACnMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5NA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5KA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AChDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClHA;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACruBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/SA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3nFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA", "file": "generated.js", "sourceRoot": "", "sourcesContent": [ @@ -58,7 +58,7 @@ "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file contract.js\n * @author Marek Kotewicz \n * @date 2014\n */\n\nvar web3 = require('../web3'); \nvar utils = require('../utils/utils');\nvar coder = require('../solidity/coder');\nvar SolidityEvent = require('./event');\nvar SolidityFunction = require('./function');\n\n/**\n * Should be called to encode constructor params\n *\n * @method encodeConstructorParams\n * @param {Array} abi\n * @param {Array} constructor params\n */\nvar encodeConstructorParams = function (abi, params) {\n return abi.filter(function (json) {\n return json.type === 'constructor' && json.inputs.length === params.length;\n }).map(function (json) {\n return json.inputs.map(function (input) {\n return input.type;\n });\n }).map(function (types) {\n return coder.encodeParams(types, params);\n })[0] || '';\n};\n\n/**\n * Should be called to add functions to contract object\n *\n * @method addFunctionsToContract\n * @param {Contract} contract\n * @param {Array} abi\n */\nvar addFunctionsToContract = function (contract, abi) {\n abi.filter(function (json) {\n return json.type === 'function';\n }).map(function (json) {\n return new SolidityFunction(json, contract.address);\n }).forEach(function (f) {\n f.attachToContract(contract);\n });\n};\n\n/**\n * Should be called to add events to contract object\n *\n * @method addEventsToContract\n * @param {Contract} contract\n * @param {Array} abi\n */\nvar addEventsToContract = function (contract, abi) {\n abi.filter(function (json) {\n return json.type === 'event';\n }).map(function (json) {\n return new SolidityEvent(json, contract.address);\n }).forEach(function (e) {\n e.attachToContract(contract);\n });\n};\n\n/**\n * Should be called to create new ContractFactory\n *\n * @method contract\n * @param {Array} abi\n * @returns {ContractFactory} new contract factory\n */\nvar contract = function (abi) {\n return new ContractFactory(abi);\n};\n\n/**\n * Should be called to create new ContractFactory instance\n *\n * @method ContractFactory\n * @param {Array} abi\n */\nvar ContractFactory = function (abi) {\n this.abi = abi;\n};\n\n/**\n * Should be called to create new contract on a blockchain\n * \n * @method new\n * @param {Any} contract constructor param1 (optional)\n * @param {Any} contract constructor param2 (optional)\n * @param {Object} contract transaction object (required)\n * @param {Function} callback\n * @returns {Contract} returns contract if no callback was passed,\n * otherwise calls callback function (err, contract)\n */\nContractFactory.prototype.new = function () {\n // parse arguments\n var options = {}; // required!\n var callback;\n\n var args = Array.prototype.slice.call(arguments);\n if (utils.isFunction(args[args.length - 1])) {\n callback = args.pop();\n }\n\n var last = args[args.length - 1];\n if (utils.isObject(last) && !utils.isArray(last)) {\n options = args.pop();\n }\n\n // throw an error if there are no options\n\n var bytes = encodeConstructorParams(this.abi, args);\n options.data += bytes;\n\n if (!callback) {\n var address = web3.eth.sendTransaction(options);\n return this.at(address);\n }\n \n var self = this;\n web3.eth.sendTransaction(options, function (err, address) {\n if (err) {\n callback(err);\n }\n self.at(address, callback); \n }); \n};\n\n/**\n * Should be called to get access to existing contract on a blockchain\n *\n * @method at\n * @param {Address} contract address (required)\n * @param {Function} callback {optional)\n * @returns {Contract} returns contract if no callback was passed,\n * otherwise calls callback function (err, contract)\n */\nContractFactory.prototype.at = function (address, callback) {\n // TODO: address is required\n \n if (callback) {\n callback(null, new Contract(this.abi, address));\n } \n return new Contract(this.abi, address);\n};\n\n/**\n * Should be called to create new contract instance\n *\n * @method Contract\n * @param {Array} abi\n * @param {Address} contract address\n */\nvar Contract = function (abi, address) {\n this.address = address;\n addFunctionsToContract(this, abi);\n addEventsToContract(this, abi);\n};\n\nmodule.exports = contract;\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file db.js\n * @authors:\n * Marek Kotewicz \n * @date 2015\n */\n\nvar Method = require('./method');\n\nvar putString = new Method({\n name: 'putString',\n call: 'db_putString',\n params: 3\n});\n\n\nvar getString = new Method({\n name: 'getString',\n call: 'db_getString',\n params: 2\n});\n\nvar putHex = new Method({\n name: 'putHex',\n call: 'db_putHex',\n params: 3\n});\n\nvar getHex = new Method({\n name: 'getHex',\n call: 'db_getHex',\n params: 2\n});\n\nvar methods = [\n putString, getString, putHex, getHex\n];\n\nmodule.exports = {\n methods: methods\n};\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file errors.js\n * @author Marek Kotewicz \n * @date 2015\n */\n\nmodule.exports = {\n InvalidNumberOfParams: function () {\n return new Error('Invalid number of input parameters');\n },\n InvalidConnection: function (host){\n return new Error('CONNECTION ERROR: Couldn\\'t connect to node '+ host +', is it running?');\n },\n InvalidProvider: function () {\n return new Error('Providor not set or invalid');\n },\n InvalidResponse: function (result){\n var message = !!result && !!result.error && !!result.error.message ? result.error.message : 'Invalid JSON RPC response';\n return new Error(message);\n }\n};\n\n", - "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/**\n * @file eth.js\n * @author Marek Kotewicz \n * @author Fabian Vogelsteller \n * @date 2015\n */\n\n/**\n * Web3\n *\n * @module web3\n */\n\n/**\n * Eth methods and properties\n *\n * An example method object can look as follows:\n *\n * {\n * name: 'getBlock',\n * call: blockCall,\n * params: 2,\n * outputFormatter: formatters.outputBlockFormatter,\n * inputFormatter: [ // can be a formatter funciton or an array of functions. Where each item in the array will be used for one parameter\n * utils.toHex, // formats paramter 1\n * function(param){ return !!param; } // formats paramter 2\n * ]\n * },\n *\n * @class [web3] eth\n * @constructor\n */\n\n\"use strict\";\n\nvar formatters = require('./formatters');\nvar utils = require('../utils/utils');\nvar Method = require('./method');\nvar Property = require('./property');\n\nvar blockCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? \"eth_getBlockByHash\" : \"eth_getBlockByNumber\";\n};\n\nvar transactionFromBlockCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';\n};\n\nvar uncleCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';\n};\n\nvar getBlockTransactionCountCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber';\n};\n\nvar uncleCountCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber';\n};\n\n/// @returns an array of objects describing web3.eth api methods\n\nvar getBalance = new Method({\n name: 'getBalance',\n call: 'eth_getBalance',\n params: 2,\n inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],\n outputFormatter: formatters.outputBigNumberFormatter\n});\n\nvar getStorageAt = new Method({\n name: 'getStorageAt',\n call: 'eth_getStorageAt',\n params: 3,\n inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar getCode = new Method({\n name: 'getCode',\n call: 'eth_getCode',\n params: 2,\n inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar getBlock = new Method({\n name: 'getBlock',\n call: blockCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],\n outputFormatter: formatters.outputBlockFormatter\n});\n\nvar getUncle = new Method({\n name: 'getUncle',\n call: uncleCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],\n outputFormatter: formatters.outputBlockFormatter,\n\n});\n\nvar getCompilers = new Method({\n name: 'getCompilers',\n call: 'eth_getCompilers',\n params: 0\n});\n\nvar getBlockTransactionCount = new Method({\n name: 'getBlockTransactionCount',\n call: getBlockTransactionCountCall,\n params: 1,\n inputFormatter: [formatters.inputBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar getBlockUncleCount = new Method({\n name: 'getBlockUncleCount',\n call: uncleCountCall,\n params: 1,\n inputFormatter: [formatters.inputBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar getTransaction = new Method({\n name: 'getTransaction',\n call: 'eth_getTransactionByHash',\n params: 1,\n outputFormatter: formatters.outputTransactionFormatter\n});\n\nvar getTransactionFromBlock = new Method({\n name: 'getTransactionFromBlock',\n call: transactionFromBlockCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],\n outputFormatter: formatters.outputTransactionFormatter\n});\n\nvar getTransactionCount = new Method({\n name: 'getTransactionCount',\n call: 'eth_getTransactionCount',\n params: 2,\n inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar sendTransaction = new Method({\n name: 'sendTransaction',\n call: 'eth_sendTransaction',\n params: 1,\n inputFormatter: [formatters.inputTransactionFormatter]\n});\n\nvar call = new Method({\n name: 'call',\n call: 'eth_call',\n params: 2,\n inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar estimateGas = new Method({\n name: 'estimateGas',\n call: 'eth_estimateGas',\n params: 1,\n inputFormatter: [formatters.inputTransactionFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar compileSolidity = new Method({\n name: 'compile.solidity',\n call: 'eth_compileSolidity',\n params: 1\n});\n\nvar compileLLL = new Method({\n name: 'compile.lll',\n call: 'eth_compileLLL',\n params: 1\n});\n\nvar compileSerpent = new Method({\n name: 'compile.serpent',\n call: 'eth_compileSerpent',\n params: 1\n});\n\nvar submitWork = new Method({\n name: 'submitWork',\n call: 'eth_submitWork',\n params: 3\n});\n\nvar getWork = new Method({\n name: 'getWork',\n call: 'eth_getWork',\n params: 0\n});\n\nvar methods = [\n getBalance,\n getStorageAt,\n getCode,\n getBlock,\n getUncle,\n getCompilers,\n getBlockTransactionCount,\n getBlockUncleCount,\n getTransaction,\n getTransactionFromBlock,\n getTransactionCount,\n call,\n estimateGas,\n sendTransaction,\n compileSolidity,\n compileLLL,\n compileSerpent,\n submitWork,\n getWork\n];\n\n/// @returns an array of objects describing web3.eth api properties\n\n\n\nvar properties = [\n new Property({\n name: 'coinbase',\n getter: 'eth_coinbase'\n }),\n new Property({\n name: 'mining',\n getter: 'eth_mining'\n }),\n new Property({\n name: 'hashrate',\n getter: 'eth_hashrate',\n outputFormatter: utils.toDecimal\n }),\n new Property({\n name: 'gasPrice',\n getter: 'eth_gasPrice',\n outputFormatter: formatters.outputBigNumberFormatter\n }),\n new Property({\n name: 'accounts',\n getter: 'eth_accounts'\n }),\n new Property({\n name: 'blockNumber',\n getter: 'eth_blockNumber',\n outputFormatter: utils.toDecimal\n })\n];\n\nmodule.exports = {\n methods: methods,\n properties: properties\n};\n\n", + "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/**\n * @file eth.js\n * @author Marek Kotewicz \n * @author Fabian Vogelsteller \n * @date 2015\n */\n\n/**\n * Web3\n *\n * @module web3\n */\n\n/**\n * Eth methods and properties\n *\n * An example method object can look as follows:\n *\n * {\n * name: 'getBlock',\n * call: blockCall,\n * params: 2,\n * outputFormatter: formatters.outputBlockFormatter,\n * inputFormatter: [ // can be a formatter funciton or an array of functions. Where each item in the array will be used for one parameter\n * utils.toHex, // formats paramter 1\n * function(param){ return !!param; } // formats paramter 2\n * ]\n * },\n *\n * @class [web3] eth\n * @constructor\n */\n\n\"use strict\";\n\nvar formatters = require('./formatters');\nvar utils = require('../utils/utils');\nvar Method = require('./method');\nvar Property = require('./property');\n\nvar blockCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? \"eth_getBlockByHash\" : \"eth_getBlockByNumber\";\n};\n\nvar transactionFromBlockCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getTransactionByBlockHashAndIndex' : 'eth_getTransactionByBlockNumberAndIndex';\n};\n\nvar uncleCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleByBlockHashAndIndex' : 'eth_getUncleByBlockNumberAndIndex';\n};\n\nvar getBlockTransactionCountCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getBlockTransactionCountByHash' : 'eth_getBlockTransactionCountByNumber';\n};\n\nvar uncleCountCall = function (args) {\n return (utils.isString(args[0]) && args[0].indexOf('0x') === 0) ? 'eth_getUncleCountByBlockHash' : 'eth_getUncleCountByBlockNumber';\n};\n\n/// @returns an array of objects describing web3.eth api methods\n\nvar getBalance = new Method({\n name: 'getBalance',\n call: 'eth_getBalance',\n params: 2,\n inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter],\n outputFormatter: formatters.outputBigNumberFormatter\n});\n\nvar getStorageAt = new Method({\n name: 'getStorageAt',\n call: 'eth_getStorageAt',\n params: 3,\n inputFormatter: [null, utils.toHex, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar getCode = new Method({\n name: 'getCode',\n call: 'eth_getCode',\n params: 2,\n inputFormatter: [utils.toAddress, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar getBlock = new Method({\n name: 'getBlock',\n call: blockCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, function (val) { return !!val; }],\n outputFormatter: formatters.outputBlockFormatter\n});\n\nvar getUncle = new Method({\n name: 'getUncle',\n call: uncleCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],\n outputFormatter: formatters.outputBlockFormatter,\n\n});\n\nvar getCompilers = new Method({\n name: 'getCompilers',\n call: 'eth_getCompilers',\n params: 0\n});\n\nvar getBlockTransactionCount = new Method({\n name: 'getBlockTransactionCount',\n call: getBlockTransactionCountCall,\n params: 1,\n inputFormatter: [formatters.inputBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar getBlockUncleCount = new Method({\n name: 'getBlockUncleCount',\n call: uncleCountCall,\n params: 1,\n inputFormatter: [formatters.inputBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar getTransaction = new Method({\n name: 'getTransaction',\n call: 'eth_getTransactionByHash',\n params: 1,\n outputFormatter: formatters.outputTransactionFormatter\n});\n\nvar getTransactionFromBlock = new Method({\n name: 'getTransactionFromBlock',\n call: transactionFromBlockCall,\n params: 2,\n inputFormatter: [formatters.inputBlockNumberFormatter, utils.toHex],\n outputFormatter: formatters.outputTransactionFormatter\n});\n\nvar getTransactionCount = new Method({\n name: 'getTransactionCount',\n call: 'eth_getTransactionCount',\n params: 2,\n inputFormatter: [null, formatters.inputDefaultBlockNumberFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar sendRawTransaction = new Method({\n name: 'sendRawTransaction',\n call: 'eth_sendRawTransaction',\n params: 1,\n inputFormatter: []\n});\n\nvar sendTransaction = new Method({\n name: 'sendTransaction',\n call: 'eth_sendTransaction',\n params: 1,\n inputFormatter: [formatters.inputTransactionFormatter]\n});\n\nvar call = new Method({\n name: 'call',\n call: 'eth_call',\n params: 2,\n inputFormatter: [formatters.inputTransactionFormatter, formatters.inputDefaultBlockNumberFormatter]\n});\n\nvar estimateGas = new Method({\n name: 'estimateGas',\n call: 'eth_estimateGas',\n params: 1,\n inputFormatter: [formatters.inputTransactionFormatter],\n outputFormatter: utils.toDecimal\n});\n\nvar compileSolidity = new Method({\n name: 'compile.solidity',\n call: 'eth_compileSolidity',\n params: 1\n});\n\nvar compileLLL = new Method({\n name: 'compile.lll',\n call: 'eth_compileLLL',\n params: 1\n});\n\nvar compileSerpent = new Method({\n name: 'compile.serpent',\n call: 'eth_compileSerpent',\n params: 1\n});\n\nvar submitWork = new Method({\n name: 'submitWork',\n call: 'eth_submitWork',\n params: 3\n});\n\nvar getWork = new Method({\n name: 'getWork',\n call: 'eth_getWork',\n params: 0\n});\n\nvar methods = [\n getBalance,\n getStorageAt,\n getCode,\n getBlock,\n getUncle,\n getCompilers,\n getBlockTransactionCount,\n getBlockUncleCount,\n getTransaction,\n getTransactionFromBlock,\n getTransactionCount,\n call,\n estimateGas,\n sendRawTransaction,\n sendTransaction,\n compileSolidity,\n compileLLL,\n compileSerpent,\n submitWork,\n getWork\n];\n\n/// @returns an array of objects describing web3.eth api properties\n\n\n\nvar properties = [\n new Property({\n name: 'coinbase',\n getter: 'eth_coinbase'\n }),\n new Property({\n name: 'mining',\n getter: 'eth_mining'\n }),\n new Property({\n name: 'hashrate',\n getter: 'eth_hashrate',\n outputFormatter: utils.toDecimal\n }),\n new Property({\n name: 'gasPrice',\n getter: 'eth_gasPrice',\n outputFormatter: formatters.outputBigNumberFormatter\n }),\n new Property({\n name: 'accounts',\n getter: 'eth_accounts'\n }),\n new Property({\n name: 'blockNumber',\n getter: 'eth_blockNumber',\n outputFormatter: utils.toDecimal\n })\n];\n\nmodule.exports = {\n methods: methods,\n properties: properties\n};\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file event.js\n * @author Marek Kotewicz \n * @date 2014\n */\n\nvar utils = require('../utils/utils');\nvar coder = require('../solidity/coder');\nvar web3 = require('../web3');\nvar formatters = require('./formatters');\nvar sha3 = require('../utils/sha3');\n\n/**\n * This prototype should be used to create event filters\n */\nvar SolidityEvent = function (json, address) {\n this._params = json.inputs;\n this._name = utils.transformToFullName(json);\n this._address = address;\n this._anonymous = json.anonymous;\n};\n\n/**\n * Should be used to get filtered param types\n *\n * @method types\n * @param {Bool} decide if returned typed should be indexed\n * @return {Array} array of types\n */\nSolidityEvent.prototype.types = function (indexed) {\n return this._params.filter(function (i) {\n return i.indexed === indexed;\n }).map(function (i) {\n return i.type;\n });\n};\n\n/**\n * Should be used to get event display name\n *\n * @method displayName\n * @return {String} event display name\n */\nSolidityEvent.prototype.displayName = function () {\n return utils.extractDisplayName(this._name);\n};\n\n/**\n * Should be used to get event type name\n *\n * @method typeName\n * @return {String} event type name\n */\nSolidityEvent.prototype.typeName = function () {\n return utils.extractTypeName(this._name);\n};\n\n/**\n * Should be used to get event signature\n *\n * @method signature\n * @return {String} event signature\n */\nSolidityEvent.prototype.signature = function () {\n return sha3(this._name);\n};\n\n/**\n * Should be used to encode indexed params and options to one final object\n * \n * @method encode\n * @param {Object} indexed\n * @param {Object} options\n * @return {Object} everything combined together and encoded\n */\nSolidityEvent.prototype.encode = function (indexed, options) {\n indexed = indexed || {};\n options = options || {};\n var result = {};\n\n ['fromBlock', 'toBlock'].filter(function (f) {\n return options[f] !== undefined;\n }).forEach(function (f) {\n result[f] = formatters.inputBlockNumberFormatter(options[f]);\n });\n\n result.topics = [];\n\n if (!this._anonymous) {\n result.address = this._address;\n result.topics.push('0x' + this.signature());\n }\n\n var indexedTopics = this._params.filter(function (i) {\n return i.indexed === true;\n }).map(function (i) {\n var value = indexed[i.name];\n if (value === undefined || value === null) {\n return null;\n }\n \n if (utils.isArray(value)) {\n return value.map(function (v) {\n return '0x' + coder.encodeParam(i.type, v);\n });\n }\n return '0x' + coder.encodeParam(i.type, value);\n });\n\n result.topics = result.topics.concat(indexedTopics);\n\n return result;\n};\n\n/**\n * Should be used to decode indexed params and options\n *\n * @method decode\n * @param {Object} data\n * @return {Object} result object with decoded indexed && not indexed params\n */\nSolidityEvent.prototype.decode = function (data) {\n \n data.data = data.data || '';\n data.topics = data.topics || [];\n\n var argTopics = this._anonymous ? data.topics : data.topics.slice(1);\n var indexedData = argTopics.map(function (topics) { return topics.slice(2); }).join(\"\");\n var indexedParams = coder.decodeParams(this.types(true), indexedData); \n\n var notIndexedData = data.data.slice(2);\n var notIndexedParams = coder.decodeParams(this.types(false), notIndexedData);\n \n var result = formatters.outputLogFormatter(data);\n result.event = this.displayName();\n result.address = data.address;\n\n result.args = this._params.reduce(function (acc, current) {\n acc[current.name] = current.indexed ? indexedParams.shift() : notIndexedParams.shift();\n return acc;\n }, {});\n\n delete result.data;\n delete result.topics;\n\n return result;\n};\n\n/**\n * Should be used to create new filter object from event\n *\n * @method execute\n * @param {Object} indexed\n * @param {Object} options\n * @return {Object} filter object\n */\nSolidityEvent.prototype.execute = function (indexed, options) {\n var o = this.encode(indexed, options);\n var formatter = this.decode.bind(this);\n return web3.eth.filter(o, undefined, undefined, formatter);\n};\n\n/**\n * Should be used to attach event to contract object\n *\n * @method attachToContract\n * @param {Contract}\n */\nSolidityEvent.prototype.attachToContract = function (contract) {\n var execute = this.execute.bind(this);\n var displayName = this.displayName();\n if (!contract[displayName]) {\n contract[displayName] = execute;\n }\n contract[displayName][this.typeName()] = this.execute.bind(this, contract);\n};\n\nmodule.exports = SolidityEvent;\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** @file filter.js\n * @authors:\n * Jeffrey Wilcke \n * Marek Kotewicz \n * Marian Oancea \n * Fabian Vogelsteller \n * Gav Wood \n * @date 2014\n */\n\nvar RequestManager = require('./requestmanager');\nvar formatters = require('./formatters');\nvar utils = require('../utils/utils');\n\n/**\n* Converts a given topic to a hex string, but also allows null values.\n*\n* @param {Mixed} value\n* @return {String}\n*/\nvar toTopic = function(value){\n\n if(value === null || typeof value === 'undefined')\n return null;\n\n value = String(value);\n\n if(value.indexOf('0x') === 0)\n return value;\n else\n return utils.fromAscii(value);\n};\n\n/// This method should be called on options object, to verify deprecated properties && lazy load dynamic ones\n/// @param should be string or object\n/// @returns options string or object\nvar getOptions = function (options) {\n\n if (utils.isString(options)) {\n return options;\n } \n\n options = options || {};\n\n // make sure topics, get converted to hex\n options.topics = options.topics || [];\n options.topics = options.topics.map(function(topic){\n return (utils.isArray(topic)) ? topic.map(toTopic) : toTopic(topic);\n });\n\n // lazy load\n return {\n topics: options.topics,\n to: options.to,\n address: options.address,\n fromBlock: formatters.inputBlockNumberFormatter(options.fromBlock),\n toBlock: formatters.inputBlockNumberFormatter(options.toBlock) \n }; \n};\n\n/**\nAdds the callback and sets up the methods, to iterate over the results.\n\n@method getLogsAtStart\n@param {Object} self\n@param {funciton} \n*/\nvar getLogsAtStart = function(self, callback){\n // call getFilterLogs for the first watch callback start\n if (!utils.isString(self.options)) {\n self.get(function (err, messages) {\n // don't send all the responses to all the watches again... just to self one\n if (err) {\n callback(err);\n }\n\n messages.forEach(function (message) {\n callback(null, message);\n });\n });\n }\n};\n\n/**\nAdds the callback and sets up the methods, to iterate over the results.\n\n@method pollFilter\n@param {Object} self\n*/\nvar pollFilter = function(self) {\n\n var onMessage = function (error, messages) {\n if (error) {\n return self.callbacks.forEach(function (callback) {\n callback(error);\n });\n }\n\n messages.forEach(function (message) {\n message = self.formatter ? self.formatter(message) : message;\n self.callbacks.forEach(function (callback) {\n callback(null, message);\n });\n });\n };\n\n RequestManager.getInstance().startPolling({\n method: self.implementation.poll.call,\n params: [self.filterId],\n }, self.filterId, onMessage, self.stopWatching.bind(self));\n\n};\n\nvar Filter = function (options, methods, formatter) {\n var self = this;\n var implementation = {};\n methods.forEach(function (method) {\n method.attachToObject(implementation);\n });\n this.options = getOptions(options);\n this.implementation = implementation;\n this.callbacks = [];\n this.pollFilters = [];\n this.formatter = formatter;\n this.implementation.newFilter(this.options, function(error, id){\n if(error) {\n self.callbacks.forEach(function(callback){\n callback(error);\n });\n } else {\n self.filterId = id;\n // get filter logs at start\n self.callbacks.forEach(function(callback){\n getLogsAtStart(self, callback);\n });\n pollFilter(self);\n }\n });\n};\n\nFilter.prototype.watch = function (callback) {\n this.callbacks.push(callback);\n\n if(this.filterId) {\n getLogsAtStart(this, callback);\n pollFilter(this);\n }\n\n return this;\n};\n\nFilter.prototype.stopWatching = function () {\n RequestManager.getInstance().stopPolling(this.filterId);\n // remove filter async\n this.implementation.uninstallFilter(this.filterId, function(){});\n this.callbacks = [];\n};\n\nFilter.prototype.get = function (callback) {\n var self = this;\n if (utils.isFunction(callback)) {\n this.implementation.getLogs(this.filterId, function(err, res){\n if (err) {\n callback(err);\n } else {\n callback(null, res.map(function (log) {\n return self.formatter ? self.formatter(log) : log;\n }));\n }\n });\n } else {\n var logs = this.implementation.getLogs(this.filterId);\n return logs.map(function (log) {\n return self.formatter ? self.formatter(log) : log;\n });\n }\n\n return this;\n};\n\nmodule.exports = Filter;\n\n", "/*\n This file is part of ethereum.js.\n\n ethereum.js is free software: you can redistribute it and/or modify\n it under the terms of the GNU Lesser General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n ethereum.js is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU Lesser General Public License for more details.\n\n You should have received a copy of the GNU Lesser General Public License\n along with ethereum.js. If not, see .\n*/\n/** \n * @file formatters.js\n * @author Marek Kotewicz \n * @author Fabian Vogelsteller \n * @date 2015\n */\n\nvar utils = require('../utils/utils');\nvar config = require('../utils/config');\n\n/**\n * Should the format output to a big number\n *\n * @method outputBigNumberFormatter\n * @param {String|Number|BigNumber}\n * @returns {BigNumber} object\n */\nvar outputBigNumberFormatter = function (number) {\n return utils.toBigNumber(number);\n};\n\nvar isPredefinedBlockNumber = function (blockNumber) {\n return blockNumber === 'latest' || blockNumber === 'pending' || blockNumber === 'earliest';\n};\n\nvar inputDefaultBlockNumberFormatter = function (blockNumber) {\n if (blockNumber === undefined) {\n return config.defaultBlock;\n }\n return inputBlockNumberFormatter(blockNumber);\n};\n\nvar inputBlockNumberFormatter = function (blockNumber) {\n if (blockNumber === undefined) {\n return undefined;\n } else if (isPredefinedBlockNumber(blockNumber)) {\n return blockNumber;\n }\n return utils.toHex(blockNumber);\n};\n\n/**\n * Formats the input of a transaction and converts all values to HEX\n *\n * @method inputTransactionFormatter\n * @param {Object} transaction options\n * @returns object\n*/\nvar inputTransactionFormatter = function (options){\n\n options.from = options.from || config.defaultAccount;\n\n // make code -> data\n if (options.code) {\n options.data = options.code;\n delete options.code;\n }\n\n ['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {\n return options[key] !== undefined;\n }).forEach(function(key){\n options[key] = utils.fromDecimal(options[key]);\n });\n\n return options; \n};\n\n/**\n * Formats the output of a transaction to its proper values\n * \n * @method outputTransactionFormatter\n * @param {Object} transaction\n * @returns {Object} transaction\n*/\nvar outputTransactionFormatter = function (tx){\n if(tx.blockNumber !== null)\n tx.blockNumber = utils.toDecimal(tx.blockNumber);\n if(tx.transactionIndex !== null)\n tx.transactionIndex = utils.toDecimal(tx.transactionIndex);\n tx.nonce = utils.toDecimal(tx.nonce);\n tx.gas = utils.toDecimal(tx.gas);\n tx.gasPrice = utils.toBigNumber(tx.gasPrice);\n tx.value = utils.toBigNumber(tx.value);\n return tx;\n};\n\n/**\n * Formats the output of a block to its proper values\n *\n * @method outputBlockFormatter\n * @param {Object} block object \n * @returns {Object} block object\n*/\nvar outputBlockFormatter = function(block) {\n\n // transform to number\n block.gasLimit = utils.toDecimal(block.gasLimit);\n block.gasUsed = utils.toDecimal(block.gasUsed);\n block.size = utils.toDecimal(block.size);\n block.timestamp = utils.toDecimal(block.timestamp);\n if(block.number !== null)\n block.number = utils.toDecimal(block.number);\n\n block.difficulty = utils.toBigNumber(block.difficulty);\n block.totalDifficulty = utils.toBigNumber(block.totalDifficulty);\n\n if (utils.isArray(block.transactions)) {\n block.transactions.forEach(function(item){\n if(!utils.isString(item))\n return outputTransactionFormatter(item);\n });\n }\n\n return block;\n};\n\n/**\n * Formats the output of a log\n * \n * @method outputLogFormatter\n * @param {Object} log object\n * @returns {Object} log\n*/\nvar outputLogFormatter = function(log) {\n if(log.blockNumber !== null)\n log.blockNumber = utils.toDecimal(log.blockNumber);\n if(log.transactionIndex !== null)\n log.transactionIndex = utils.toDecimal(log.transactionIndex);\n if(log.logIndex !== null)\n log.logIndex = utils.toDecimal(log.logIndex);\n\n return log;\n};\n\n/**\n * Formats the input of a whisper post and converts all values to HEX\n *\n * @method inputPostFormatter\n * @param {Object} transaction object\n * @returns {Object}\n*/\nvar inputPostFormatter = function(post) {\n\n post.payload = utils.toHex(post.payload);\n post.ttl = utils.fromDecimal(post.ttl);\n post.workToProve = utils.fromDecimal(post.workToProve);\n post.priority = utils.fromDecimal(post.priority);\n\n // fallback\n if (!utils.isArray(post.topics)) {\n post.topics = post.topics ? [post.topics] : [];\n }\n\n // format the following options\n post.topics = post.topics.map(function(topic){\n return utils.fromAscii(topic);\n });\n\n return post; \n};\n\n/**\n * Formats the output of a received post message\n *\n * @method outputPostFormatter\n * @param {Object}\n * @returns {Object}\n */\nvar outputPostFormatter = function(post){\n\n post.expiry = utils.toDecimal(post.expiry);\n post.sent = utils.toDecimal(post.sent);\n post.ttl = utils.toDecimal(post.ttl);\n post.workProved = utils.toDecimal(post.workProved);\n post.payloadRaw = post.payload;\n post.payload = utils.toAscii(post.payload);\n\n if (utils.isJson(post.payload)) {\n post.payload = JSON.parse(post.payload);\n }\n\n // format the following options\n if (!post.topics) {\n post.topics = [];\n }\n post.topics = post.topics.map(function(topic){\n return utils.toAscii(topic);\n });\n\n return post;\n};\n\nmodule.exports = {\n inputDefaultBlockNumberFormatter: inputDefaultBlockNumberFormatter,\n inputBlockNumberFormatter: inputBlockNumberFormatter,\n inputTransactionFormatter: inputTransactionFormatter,\n inputPostFormatter: inputPostFormatter,\n outputBigNumberFormatter: outputBigNumberFormatter,\n outputTransactionFormatter: outputTransactionFormatter,\n outputBlockFormatter: outputBlockFormatter,\n outputLogFormatter: outputLogFormatter,\n outputPostFormatter: outputPostFormatter\n};\n\n", diff --git a/dist/web3.min.js b/dist/web3.min.js index 42fee25e0..a73cde830 100644 --- a/dist/web3.min.js +++ b/dist/web3.min.js @@ -1,2 +1,2 @@ -require=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;ao;o+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(o+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var i=n._requireType(t),o=i.sliceParam(e,r,t);return i.formatOutput(o,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:o.formatInputBool,outputFormatter:o.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:o.formatInputDynamicBytes,outputFormatter:o.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:o.formatInputBytes,outputFormatter:o.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./param"),s=function(t){var e=2*o.ETH_PADDING;r.config(o.ETH_BIGNUMBER_ROUNDING_MODE);var n=i.padLeft(i.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},l=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},f=function(t){return s(new r(t).times(new r(2).pow(128)))},p=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},h=function(t){var e=t.staticPart()||"0";return p(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},m=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return i.toAscii(t.staticPart())},b=function(t){return i.toAscii(t.dynamicPart().slice(64))},w=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:l,formatInputReal:f,formatOutputInt:h,formatOutputUInt:m,formatOutputReal:d,formatOutputUReal:g,formatOutputBool:y,formatOutputBytes:v,formatOutputDynamicBytes:b,formatOutputAddress:w}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),i=function(t,e){this.value=t||"",this.offset=e};i.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},i.prototype.withOffset=function(t){return new i(this.value,t)},i.prototype.combine=function(t){return new i(this.value+t.value)},i.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},i.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},i.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},i.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},i.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},i.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},i.decodeParam=function(t,e){return e=e||0,new i(t.substr(64*e,64))};var o=function(t,e){return parseInt("0x"+t.substr(64*e,64))};i.decodeBytes=function(t,e){e=e||0;var n=o(t,e);return new i(t.substr(2*n,128),0)},i.decodeArray=function(t,e){e=e||0;var n=o(t,e),r=parseInt("0x"+t.substr(2*n,64));return new i(t.substr(2*n,64*(r+1)),0)},e.exports=i},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),i=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),i=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),i(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),i={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},o=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&!o.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&o.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+i.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=i.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),i=this.toPayload(t);if(!e){var o=r.eth.call(i,n);return this.unpackOutput(o)}var a=this;r.eth.call(i,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return o.extractDisplayName(this._name)},u.prototype.typeName=function(){return o.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,i=t("./errors"),o=function(t){this.host=t||"http://localhost:8545"};o.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw i.InvalidConnection(this.host)}var o=e.responseText;try{o=JSON.parse(o)}catch(a){throw i.InvalidResponse(o)}return o},o.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(o){r=i.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(o){e(i.InvalidConnection(this.host))}},e.exports=o},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),i=function(t){this._iban=t};i.prototype.isValid=function(){return r.isIBAN(this._iban)},i.prototype.isDirect=function(){return 34===this._iban.length},i.prototype.isIndirect=function(){return 20===this._iban.length},i.prototype.checksum=function(){return this._iban.substr(2,2)},i.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},i.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},i.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=i},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),i=t("../utils/utils"),o=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return i.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return i.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw o.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),i="0xc6d9d2cd449a754c494264e1809c50e34d64562b",o=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function" -},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(o).at(i)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),i=t("./property"),o=[],a=[new i({name:"listening",getter:"net_listening"}),new i({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:o,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var i=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[i("get",r)]=this.getAsync.bind(this)},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=i},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):i.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),o.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!i.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return i.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),i=t("./formatters"),o=new r({name:"post",call:"shh_post",params:1,inputFormatter:[i.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[o,a,s,u,c];e.exports={methods:l}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),i=t("./icap"),o=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new i(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=o.addr(a.institution());return c(t,s,n,a.client())}o.addr(a.insitution(),function(e,i){return c(t,i,n,a.client(),r)})},u=function(t,e,n,i){return r.eth.sendTransaction({address:e,from:t,value:n},i)},c=function(t,e,n,r,i){var o=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(o).at(e).deposit(r,{from:t,value:n},i)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),i=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),i=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),o=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,i,o]},o=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),i=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,i]};e.exports={eth:i,shh:o}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},i=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=r.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;i>o;o++){var a=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var o=0;i>o;o+=4)e[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var i=(n<<16)+e&r;return i/=4294967296,i+=.5,i*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=i(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new o.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new o.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new o.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,a=this.blockSize,s=4*a,u=i/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,i);if(c){for(var f=0;c>f;f+=a)this._doProcessBlock(r,f);var p=r.splice(0,c);n.sigBytes-=l}return new o.init(p,l)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(r.Hasher=l.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,i,o){"object"==typeof n?e.exports=n=i(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,i=r.WordArray,o=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],f=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,i=(2*t+3*e)%5;t=r,e=i}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var o=1,a=0;24>a;a++){for(var u=0,p=0,h=0;7>h;h++){if(1&o){var m=(1<m?p^=1<t;t++)p[t]=s.create()}();var h=u.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,i=0;r>i;i++){var o=t[e+2*i],a=t[e+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[i];s.high^=a,s.low^=o}for(var u=0;24>u;u++){for(var h=0;5>h;h++){for(var m=0,d=0,g=0;5>g;g++){var s=n[h+5*g];m^=s.high,d^=s.low}var y=p[h];y.high=m,y.low=d}for(var h=0;5>h;h++)for(var v=p[(h+4)%5],b=p[(h+1)%5],w=b.high,_=b.low,m=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),g=0;5>g;g++){var s=n[h+5*g];s.high^=m,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,I=s.low,B=c[x];if(32>B)var m=F<>>32-B,d=I<>>32-B;else var m=I<>>64-B,d=F<>>64-B;var N=p[l[x]];N.high=m,N.low=d}var O=p[0],A=n[0];O.high=A.high,O.low=A.low;for(var h=0;5>h;h++)for(var g=0;5>g;g++){var x=h+5*g,s=n[x],k=p[x],P=p[(h+1)%5+5*g],T=p[(h+2)%5+5*g];s.high=k.high^~P.high&T.high,s.low=k.low^~P.low&T.low}var s=n[0],D=f[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var f=a[l],p=f.high,h=f.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),c.push(h),c.push(p)}return new i.init(c,s)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=o._createHelper(h),n.HmacSHA3=o._createHmacHelper(h)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,i){"object"==typeof n?e.exports=n=i(t("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,i=r.Base,o=r.WordArray,a=n.x64={};a.Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var i=t[r];n.push(i.high),n.push(i.low)}return o.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){!function(n){"use strict";function r(t){function e(t,r){var i,o,a,s,u,c,l=this;if(!(l instanceof e))return z&&D(26,"constructor call without new",t),new e(t,r);if(null!=r&&W(r,2,64,C,"base")){if(r=0|r,c=t+"",10==r)return l=new e(t instanceof e?t:c),S(l,j+l.e+1,L);if((s="number"==typeof t)&&0*t!=0||!new RegExp("^-?"+(i="["+x.slice(0,r)+"]+")+"(?:\\."+i+")?$",37>r?"i":"").test(c))return d(l,c,s,r);s?(l.s=0>1/t?(c=c.slice(1),-1):1,z&&c.replace(/^0\.0*|\./,"").length>15&&D(C,_,t),s=!1):l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,l.s)}else{if(t instanceof e)return l.s=t.s,l.e=t.e,l.c=(t=t.c)?t.slice():t,void(C=0);if((s="number"==typeof t)&&0*t==0){if(l.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,a=t;a>=10;a/=10,o++);return l.e=o,l.c=[t],void(C=0)}c=t+""}else{if(!g.test(c=t+""))return d(l,c,s);l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(a=c.search(/e/i))>0?(0>o&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):0>o&&(o=c.length),a=0;48===c.charCodeAt(a);a++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(a,u+1))if(u=c.length,s&&z&&u>15&&D(C,_,l.s*t),o=o-a-1,o>G)l.c=l.e=null;else if(M>o)l.c=[l.e=0];else{if(l.e=o,l.c=[],a=(o+1)%I,0>o&&(a+=I),u>a){for(a&&l.c.push(+c.slice(0,a)),u-=I;u>a;)l.c.push(+c.slice(a,a+=I));c=c.slice(a),a=I-c.length}else a-=u;for(;a--;c+="0");l.c.push(+c)}else l.c=[l.e=0];C=0}function n(t,n,r,i){var a,s,u,l,p,h,m,d=t.indexOf("."),g=j,y=L;for(37>r&&(t=t.toLowerCase()),d>=0&&(u=V,V=0,t=t.replace(".",""),m=new e(r),p=m.pow(t.length-d),V=u,m.c=c(f(o(p.c),p.e),10,n),m.e=m.c.length),h=c(t,r,n),s=u=h.length;0==h[--u];h.pop());if(!h[0])return"0";if(0>d?--s:(p.c=h,p.e=s,p.s=i,p=E(p,m,g,y,n),h=p.c,l=p.r,s=p.e),a=s+g+1,d=h[a],u=n/2,l=l||0>a||null!=h[a+1],l=4>y?(null!=d||l)&&(0==y||y==(p.s<0?3:2)):d>u||d==u&&(4==y||l||6==y&&1&h[a-1]||y==(p.s<0?8:7)),1>a||!h[0])t=l?f("1",-g):"0";else{if(h.length=a,l)for(--n;++h[--a]>n;)h[a]=0,a||(++s,h.unshift(1));for(u=h.length;!h[--u];);for(d=0,t="";u>=d;t+=x.charAt(h[d++]));t=f(t,s)}return t}function h(t,n,r,i){var a,s,u,c,p;if(r=null!=r&&W(r,0,8,i,w)?0|r:L,!t.c)return t.toString();if(a=t.c[0],u=t.e,null==n)p=o(t.c),p=19==i||24==i&&q>=u?l(p,u):f(p,u);else if(t=S(new e(t),n,r),s=t.e,p=o(t.c),c=p.length,19==i||24==i&&(s>=n||q>=s)){for(;n>c;p+="0",c++);p=l(p,s)}else if(n-=u,p=f(p,s),s+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=s-c,n>0)for(s+1==c&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function k(t,n){var r,i,o=0;for(u(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&D(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function T(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>G?t.c=t.e=null:M>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function D(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",C=0,r}function S(t,e,n,r){var i,o,a,s,u,c,l,f=t.c,p=N;if(f){t:{for(i=1,s=f[0];s>=10;s/=10,i++);if(o=e-i,0>o)o+=I,a=e,u=f[c=0],l=u/p[i-a-1]%10|0;else if(c=y((o+1)/I),c>=f.length){if(!r)break t;for(;f.length<=c;f.push(0));u=l=0,i=1,o%=I,a=o-I+1}else{for(u=s=f[c],i=1;s>=10;s/=10,i++);o%=I,a=o-I+i,l=0>a?0:u/p[i-a-1]%10|0}if(r=r||0>e||null!=f[c+1]||(0>a?u:u%p[i-a-1]),r=4>n?(l||r)&&(0==n||n==(t.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?a>0?u/p[i-a]:0:f[c-1])%10&1||n==(t.s<0?8:7)),1>e||!f[0])return f.length=0,r?(e-=t.e+1,f[0]=p[e%I],t.e=-e||0):f[0]=t.e=0,t;if(0==o?(f.length=c,s=1,c--):(f.length=c+1,s=p[I-o],f[c]=a>0?v(u/p[i-a]%p[a])*s:0),r)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(t.e++,f[0]==F&&(f[0]=1));break}if(f[c]+=s,f[c]!=F)break;f[c--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}t.e>G?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return a(e="DECIMAL_PLACES")&&W(t,0,A,2,e)&&(j=0|t),r[e]=j,a(e="ROUNDING_MODE")&&W(t,0,8,2,e)&&(L=0|t),r[e]=L,a(e="EXPONENTIAL_AT")&&(u(t)?W(t[0],-A,0,2,e)&&W(t[1],0,A,2,e)&&(q=0|t[0],U=0|t[1]):W(t,-A,A,2,e)&&(q=-(U=0|(0>t?-t:t)))),r[e]=[q,U],a(e="RANGE")&&(u(t)?W(t[0],-A,-1,2,e)&&W(t[1],1,A,2,e)&&(M=0|t[0],G=0|t[1]):W(t,-A,A,2,e)&&(0|t?M=-(G=0|(0>t?-t:t)):z&&D(2,e+" cannot be zero",t))),r[e]=[M,G],a(e="ERRORS")&&(t===!!t||1===t||0===t?(C=0,W=(z=!!t)?P:s):z&&D(2,e+b,t)),r[e]=z,a(e="CRYPTO")&&(t===!!t||1===t||0===t?(J=!(!t||!m||"object"!=typeof m),t&&!J&&z&&D(2,"crypto unavailable",m)):z&&D(2,e+b,t)),r[e]=J,a(e="MODULO_MODE")&&W(t,0,9,2,e)&&($=0|t),r[e]=$,a(e="POW_PRECISION")&&W(t,0,A,2,e)&&(V=0|t),r[e]=V,a(e="FORMAT")&&("object"==typeof t?X=t:z&&D(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return k(arguments,R.lt)},e.min=function(){return k(arguments,R.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return v(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,a,s,u=0,c=[],l=new e(H);if(t=null!=t&&W(t,0,A,14)?0|t:j,a=y(t/I),J)if(m&&m.getRandomValues){for(r=m.getRandomValues(new Uint32Array(a*=2));a>u;)s=131072*r[u]+(r[u+1]>>>11),s>=9e15?(i=m.getRandomValues(new Uint32Array(2)),r[u]=i[0],r[u+1]=i[1]):(c.push(s%1e14),u+=2);u=a/2}else if(m&&m.randomBytes){for(r=m.randomBytes(a*=7);a>u;)s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6],s>=9e15?m.randomBytes(7).copy(r,u):(c.push(s%1e14),u+=7);u=a/7}else z&&D(14,"crypto unavailable",m);if(!u)for(;a>u;)s=n(),9e15>s&&(c[u++]=s%1e14);for(a=c[--u],t%=I,a&&t&&(s=N[I-t],c[u]=v(a/s)*s);0===c[u];c.pop(),u--);if(0>u)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(u=1,s=c[0];s>=10;s/=10,u++);I>u&&(o-=I-u)}return l.e=o,l.c=c,l}}(),E=function(){function t(t,e,n){var r,i,o,a,s=0,u=t.length,c=e%O,l=e/O|0;for(t=t.slice();u--;)o=t[u]%O,a=t[u]/O|0,r=l*o+a*c,i=c*o+r%O*O+s,s=(i/n|0)+(r/O|0)+l*a,t[u]=i%n;return s&&t.unshift(s),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,a,s,u,c){var l,f,p,h,m,d,g,y,b,w,_,x,B,N,O,A,k,P=o.s==a.s?1:-1,T=o.c,D=a.c;if(!(T&&T[0]&&D&&D[0]))return new e(o.s&&a.s&&(T?!D||T[0]!=D[0]:D)?T&&0==T[0]||!D?0*P:P/0:0/0);for(y=new e(P),b=y.c=[],f=o.e-a.e,P=s+f+1,c||(c=F,f=i(o.e/I)-i(a.e/I),P=P/I|0),p=0;D[p]==(T[p]||0);p++);if(D[p]>(T[p]||0)&&f--,0>P)b.push(1),h=!0;else{for(N=T.length,A=D.length,p=0,P+=2,m=v(c/(D[0]+1)),m>1&&(D=t(D,m,c),T=t(T,m,c),A=D.length,N=T.length),B=A,w=T.slice(0,A),_=w.length;A>_;w[_++]=0);k=D.slice(),k.unshift(0),O=D[0],D[1]>=c/2&&O++;do{if(m=0,l=n(D,w,A,_),0>l){if(x=w[0],A!=_&&(x=x*c+(w[1]||0)),m=v(x/O),m>1)for(m>=c&&(m=c-1),d=t(D,m,c),g=d.length,_=w.length;1==n(d,w,g,_);)m--,r(d,g>A?k:D,g,c),g=d.length,l=1;else 0==m&&(l=m=1),d=D.slice(),g=d.length;if(_>g&&d.unshift(0),r(w,d,_,c),_=w.length,-1==l)for(;n(D,w,A,_)<1;)m++,r(w,_>A?k:D,_,c),_=w.length}else 0===l&&(m++,w=[0]);b[p++]=m,w[0]?w[_++]=T[B]||0:(w=[T[B]],_=1)}while((B++=10;P/=10,p++);S(y,s+(y.e=p+f*I-1)+1,u,h)}else y.e=f,y.r=+h;return y}}(),d=function(){var t=/^(-?)0([xbo])/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+|^\s+|\s+$/g;return function(a,s,u,c){var l,f=u?s:s.replace(o,"");if(i.test(f))a.s=isNaN(f)?null:0>f?-1:1;else{if(!u&&(f=f.replace(t,function(t,e,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?t:e}),c&&(l=c,f=f.replace(n,"$1").replace(r,"0.$1")),s!=f))return new e(f,l);z&&D(C,"not a"+(c?" base "+c:"")+" number",s),a.s=null}a.c=a.e=null,C=0}}(),R.absoluteValue=R.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},R.ceil=function(){return S(new e(this),this.e+1,2)},R.comparedTo=R.cmp=function(t,n){return C=1,a(this,new e(t,n))},R.decimalPlaces=R.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},R.dividedBy=R.div=function(t,n){return C=3,E(this,new e(t,n),j,L)},R.dividedToIntegerBy=R.divToInt=function(t,n){return C=4,E(this,new e(t,n),0,1)},R.equals=R.eq=function(t,n){return C=5,0===a(this,new e(t,n))},R.floor=function(){return S(new e(this),this.e+1,3)},R.greaterThan=R.gt=function(t,n){return C=6,a(this,new e(t,n))>0},R.greaterThanOrEqualTo=R.gte=function(t,n){return C=7,1===(n=a(this,new e(t,n)))||0===n},R.isFinite=function(){return!!this.c},R.isInteger=R.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},R.isNaN=function(){return!this.s},R.isNegative=R.isNeg=function(){return this.s<0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.lessThan=R.lt=function(t,n){return C=8,a(this,new e(t,n))<0},R.lessThanOrEqualTo=R.lte=function(t,n){return C=9,-1===(n=a(this,new e(t,n)))||0===n},R.minus=R.sub=function(t,n){var r,o,a,s,u=this,c=u.s;if(C=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,u.plus(t);var l=u.e/I,f=t.e/I,p=u.c,h=t.c;if(!l||!f){if(!p||!h)return p?(t.s=-n,t):new e(h?u:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?u:3==L?-0:0)}if(l=i(l),f=i(f),p=p.slice(),c=l-f){for((s=0>c)?(c=-c,a=p):(f=l,a=h),a.reverse(),n=c;n--;a.push(0));a.reverse()}else for(o=(s=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){s=p[n]0)for(;n--;p[r++]=0);for(n=F-1;o>c;){if(p[--o]0?(u=s,r=l):(a=-a,r=c),r.reverse();a--;r.push(0));r.reverse()}for(a=c.length,n=l.length,0>a-n&&(r=l,l=c,c=r,n=a),a=0;n;)a=(c[--n]=c[n]+l[n]+a)/F|0,c[n]%=F;return a&&(c.unshift(a),++u),T(t,c,u)},R.precision=R.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&(z&&D(13,"argument"+b,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},R.round=function(t,n){var r=new e(this);return(null==t||W(t,0,A,15))&&S(r,~~t+this.e+1,null!=n&&W(n,0,8,15,w)?0|n:L),r},R.shift=function(t){var n=this;return W(t,-B,B,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-B>t||t>B)?n.s*(0>t?0:1/0):n)},R.squareRoot=R.sqrt=function(){var t,n,r,a,s,u=this,c=u.c,l=u.s,f=u.e,p=j+4,h=new e("0.5");if(1!==l||!c||!c[0])return new e(!l||0>l&&(!c||c[0])?0/0:c?u:1/0);if(l=Math.sqrt(+u),0==l||l==1/0?(n=o(c),(n.length+f)%2==0&&(n+="0"),l=Math.sqrt(n),f=i((f+1)/2)-(0>f||f%2),l==1/0?n="1e"+f:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+f),r=new e(n)):r=new e(l+""),r.c[0])for(f=r.e,l=f+p,3>l&&(l=0);;)if(s=r,r=h.times(s.plus(E(u,s,p,1))),o(s.c).slice(0,l)===(n=o(r.c)).slice(0,l)){if(r.el&&(g=w,w=_,_=g,a=l,l=h,h=a),a=l+h,g=[];a--;g.push(0));for(y=F,v=O,a=h;--a>=0;){for(r=0,m=_[a]%v,d=_[a]/v|0,u=l,s=a+u;s>a;)f=w[--u]%v,p=w[u]/v|0,c=d*f+p*m,f=m*f+c%v*v+g[s]+r,r=(f/y|0)+(c/v|0)+d*p,g[s--]=f%y;g[s]=r}return r?++o:g.shift(),T(t,g,o)},R.toDigits=function(t,n){var r=new e(this);return t=null!=t&&W(t,1,A,18,"precision")?0|t:null,n=null!=n&&W(n,0,8,18,w)?0|n:L,t?S(r,t,n):r},R.toExponential=function(t,e){return h(this,null!=t&&W(t,0,A,19)?~~t+1:null,e,19)},R.toFixed=function(t,e){return h(this,null!=t&&W(t,0,A,20)?~~t+this.e+1:null,e,20)},R.toFormat=function(t,e){var n=h(this,null!=t&&W(t,0,A,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+X.groupSize,a=+X.secondaryGroupSize,s=X.groupSeparator,u=i[0],c=i[1],l=this.s<0,f=l?u.slice(1):u,p=f.length;if(a&&(r=o,o=a,a=r,p-=r),o>0&&p>0){for(r=p%o||o,u=f.substr(0,r);p>r;r+=o)u+=s+f.substr(r,o);a>0&&(u+=s+f.slice(r)),l&&(u="-"+u)}n=c?u+X.decimalSeparator+((a=+X.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+X.fractionGroupSeparator):c):u}return n},R.toFraction=function(t){var n,r,i,a,s,u,c,l,f,p=z,h=this,m=h.c,d=new e(H),g=r=new e(H),y=c=new e(H);if(null!=t&&(z=!1,u=new e(t),z=p,(!(p=u.isInt())||u.lt(H))&&(z&&D(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&u.c&&S(u,u.e+1,1).gte(H)?u:null)),!m)return h.toString();for(f=o(m),a=d.e=f.length-h.e-1,d.c[0]=N[(s=a%I)<0?I+s:s],t=!t||u.cmp(d)>0?a>0?d:g:u,s=G,G=1/0,u=new e(f),c.c[0]=0;l=E(u,d,0,1),i=r.plus(l.times(y)),1!=i.cmp(t);)r=y,y=i,g=c.plus(l.times(i=g)),c=i,d=u.minus(l.times(i=d)),u=i;return i=E(t.minus(r),y,0,1),c=c.plus(i.times(g)),r=r.plus(i.times(y)),c.s=g.s=h.s,a*=2,n=E(g,y,a,L).minus(h).abs().cmp(E(c,r,a,L).minus(h).abs())<1?[g.toString(),y.toString()]:[c.toString(),r.toString()],G=s,n},R.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},R.toPower=R.pow=function(t){var n,r,i=v(0>t?-t:+t),o=this;if(!W(t,-B,B,23,"exponent")&&(!isFinite(t)||i>B&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=V?y(V/I+2):0,r=new e(H);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=v(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=H.div(r)),n?S(r,V,L):r},R.toPrecision=function(t,e){return h(this,null!=t&&W(t,1,A,24,"precision")?0|t:null,e,24)},R.toString=function(t){var e,r=this,i=r.s,a=r.e;return null===a?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&W(t,2,64,25,"base")?n(f(e,a),0|t,10,i):q>=a||a>=U?l(e,a):f(e,a),0>i&&r.c[0]&&(e="-"+e)),e},R.truncated=R.trunc=function(){return S(new e(this),this.e+1,1)},R.valueOf=R.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function a(t,e){var n,r,i=t.c,o=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=0>a,r=u==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return u>c^n?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;s>a;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return u==c?0:u>c^n?1:-1}function s(t,e,n){return(t=p(t))>=e&&n>=t}function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],a=0,s=t.length;s>a;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=x.indexOf(t.charAt(a++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function l(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function f(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?y(t):v(t)}var h,m,d,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=Math.ceil,v=Math.floor,b=" not a boolean or binary digit",w="rounding mode",_="number type has more than 15 significant digits",x="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",F=1e14,I=14,B=9007199254740991,N=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],O=1e7,A=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!m)try{m=t("crypto")}catch(k){}}else n.BigNumber=h}(this)},{crypto:31}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file +require=function t(e,n,r){function i(a,s){if(!n[a]){if(!e[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};e[a][0].call(l.exports,function(t){var n=e[a][1][t];return i(n?n:t)},l,l.exports,t,e,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;ao;o+=64)n.push(this._outputFormatter(new a(t.dynamicPart().substr(o+64,64))));return n}return this._outputFormatter(t)},u.prototype.sliceParam=function(t,e,n){return"bytes"===this._mode?a.decodeBytes(t,e):s(n)?a.decodeArray(t,e):a.decodeParam(t,e)};var c=function(t){this._types=t};c.prototype._requireType=function(t){var e=this._types.filter(function(e){return e.isType(t)})[0];if(!e)throw Error("invalid solidity type!: "+t);return e},c.prototype._formatInput=function(t,e){return this._requireType(t).formatInput(e,s(t))},c.prototype.encodeParam=function(t,e){return this._formatInput(t,e).encode()},c.prototype.encodeParams=function(t,e){var n=this,r=t.map(function(t,r){return n._formatInput(t,e[r])});return a.encodeList(r)},c.prototype.decodeParam=function(t,e){return this.decodeParams([t],e)[0]},c.prototype.decodeParams=function(t,e){var n=this;return t.map(function(t,r){var i=n._requireType(t),o=i.sliceParam(e,r,t);return i.formatOutput(o,s(t))})};var l=new c([new u({name:"address",match:"strict",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputAddress}),new u({name:"bool",match:"strict",mode:"value",inputFormatter:o.formatInputBool,outputFormatter:o.formatOutputBool}),new u({name:"int",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputInt}),new u({name:"uint",match:"prefix",mode:"value",inputFormatter:o.formatInputInt,outputFormatter:o.formatOutputUInt}),new u({name:"bytes",match:"strict",mode:"bytes",inputFormatter:o.formatInputDynamicBytes,outputFormatter:o.formatOutputDynamicBytes}),new u({name:"bytes",match:"prefix",mode:"value",inputFormatter:o.formatInputBytes,outputFormatter:o.formatOutputBytes}),new u({name:"real",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputReal}),new u({name:"ureal",match:"prefix",mode:"value",inputFormatter:o.formatInputReal,outputFormatter:o.formatOutputUReal})]);e.exports=l},{"../utils/utils":7,"./formatters":2,"./param":3,"bignumber.js":"bignumber.js"}],2:[function(t,e,n){var r=t("bignumber.js"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./param"),s=function(t){var e=2*o.ETH_PADDING;r.config(o.ETH_BIGNUMBER_ROUNDING_MODE);var n=i.padLeft(i.toTwosComplement(t).round().toString(16),e);return new a(n)},u=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(e)},c=function(t){var e=i.fromAscii(t,o.ETH_PADDING).substr(2);return new a(s(t.length).value+e,32)},l=function(t){var e="000000000000000000000000000000000000000000000000000000000000000"+(t?"1":"0");return new a(e)},f=function(t){return s(new r(t).times(new r(2).pow(128)))},p=function(t){return"1"===new r(t.substr(0,1),16).toString(2).substr(0,1)},h=function(t){var e=t.staticPart()||"0";return p(e)?new r(e,16).minus(new r("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16)).minus(1):new r(e,16)},m=function(t){var e=t.staticPart()||"0";return new r(e,16)},d=function(t){return h(t).dividedBy(new r(2).pow(128))},g=function(t){return m(t).dividedBy(new r(2).pow(128))},y=function(t){return"0000000000000000000000000000000000000000000000000000000000000001"===t.staticPart()?!0:!1},v=function(t){return i.toAscii(t.staticPart())},b=function(t){return i.toAscii(t.dynamicPart().slice(64))},w=function(t){var e=t.staticPart();return"0x"+e.slice(e.length-40,e.length)};e.exports={formatInputInt:s,formatInputBytes:u,formatInputDynamicBytes:c,formatInputBool:l,formatInputReal:f,formatOutputInt:h,formatOutputUInt:m,formatOutputReal:d,formatOutputUReal:g,formatOutputBool:y,formatOutputBytes:v,formatOutputDynamicBytes:b,formatOutputAddress:w}},{"../utils/config":5,"../utils/utils":7,"./param":3,"bignumber.js":"bignumber.js"}],3:[function(t,e,n){var r=t("../utils/utils"),i=function(t,e){this.value=t||"",this.offset=e};i.prototype.dynamicPartLength=function(){return this.dynamicPart().length/2},i.prototype.withOffset=function(t){return new i(this.value,t)},i.prototype.combine=function(t){return new i(this.value+t.value)},i.prototype.isDynamic=function(){return this.value.length>64||void 0!==this.offset},i.prototype.offsetAsBytes=function(){return this.isDynamic()?r.padLeft(r.toTwosComplement(this.offset).toString(16),64):""},i.prototype.staticPart=function(){return this.isDynamic()?this.offsetAsBytes():this.value},i.prototype.dynamicPart=function(){return this.isDynamic()?this.value:""},i.prototype.encode=function(){return this.staticPart()+this.dynamicPart()},i.encodeList=function(t){var e=32*t.length,n=t.map(function(t){if(!t.isDynamic())return t;var n=e;return e+=t.dynamicPartLength(),t.withOffset(n)});return n.reduce(function(t,e){return t+e.dynamicPart()},n.reduce(function(t,e){return t+e.staticPart()},""))},i.decodeParam=function(t,e){return e=e||0,new i(t.substr(64*e,64))};var o=function(t,e){return parseInt("0x"+t.substr(64*e,64))};i.decodeBytes=function(t,e){e=e||0;var n=o(t,e);return new i(t.substr(2*n,128),0)},i.decodeArray=function(t,e){e=e||0;var n=o(t,e),r=parseInt("0x"+t.substr(2*n,64));return new i(t.substr(2*n,64*(r+1)),0)},e.exports=i},{"../utils/utils":7}],4:[function(t,e,n){"use strict";n.XMLHttpRequest="undefined"==typeof XMLHttpRequest?{}:XMLHttpRequest},{}],5:[function(t,e,n){var r=t("bignumber.js"),i=["wei","kwei","Mwei","Gwei","szabo","finney","femtoether","picoether","nanoether","microether","milliether","nano","micro","milli","ether","grand","Mether","Gether","Tether","Pether","Eether","Zether","Yether","Nether","Dether","Vether","Uether"];e.exports={ETH_PADDING:32,ETH_SIGNATURE_LENGTH:4,ETH_UNITS:i,ETH_BIGNUMBER_ROUNDING_MODE:{ROUNDING_MODE:r.ROUND_DOWN},ETH_POLLING_TIMEOUT:500,defaultBlock:"latest",defaultAccount:void 0}},{"bignumber.js":"bignumber.js"}],6:[function(t,e,n){var r=t("./utils"),i=t("crypto-js/sha3");e.exports=function(t,e){return"0x"!==t.substr(0,2)||e||(console.warn("requirement of using web3.fromAscii before sha3 is deprecated"),console.warn("new usage: 'web3.sha3(\"hello\")'"),console.warn("see https://github.com/ethereum/web3.js/pull/205"),console.warn("if you need to hash hex value, you can do 'sha3(\"0xfff\", true)'"),t=r.toAscii(t)),i(t,{outputLength:256}).toString()}},{"./utils":7,"crypto-js/sha3":33}],7:[function(t,e,n){var r=t("bignumber.js"),i={wei:"1",kwei:"1000",ada:"1000",femtoether:"1000",mwei:"1000000",babbage:"1000000",picoether:"1000000",gwei:"1000000000",shannon:"1000000000",nanoether:"1000000000",nano:"1000000000",szabo:"1000000000000",microether:"1000000000000",micro:"1000000000000",finney:"1000000000000000",milliether:"1000000000000000",milli:"1000000000000000",ether:"1000000000000000000",kether:"1000000000000000000000",grand:"1000000000000000000000",einstein:"1000000000000000000000",mether:"1000000000000000000000000",gether:"1000000000000000000000000000",tether:"1000000000000000000000000000000"},o=function(t,e,n){return new Array(e-t.length+1).join(n?n:"0")+t},a=function(t){var e="",n=0,r=t.length;for("0x"===t.substring(0,2)&&(n=2);r>n;n+=2){var i=parseInt(t.substr(n,2),16);if(0===i)break;e+=String.fromCharCode(i)}return e},s=function(t){for(var e="",n=0;nthis._inputTypes.length&&!o.isObject(t[t.length-1])?a.inputDefaultBlockNumberFormatter(t.pop()):void 0},u.prototype.toPayload=function(t){var e={};return t.length>this._inputTypes.length&&o.isObject(t[t.length-1])&&(e=t[t.length-1]),e.to=this._address,e.data="0x"+this.signature()+i.encodeParams(this._inputTypes,t),e},u.prototype.signature=function(){return s(this._name).slice(0,8)},u.prototype.unpackOutput=function(t){if(t){t=t.length>=2?t.slice(2):t;var e=i.decodeParams(this._outputTypes,t);return 1===e.length?e[0]:e}},u.prototype.call=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.extractDefaultBlock(t),i=this.toPayload(t);if(!e){var o=r.eth.call(i,n);return this.unpackOutput(o)}var a=this;r.eth.call(i,n,function(t,n){e(t,a.unpackOutput(n))})},u.prototype.sendTransaction=function(){var t=Array.prototype.slice.call(arguments).filter(function(t){return void 0!==t}),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.sendTransaction(n,e):r.eth.sendTransaction(n)},u.prototype.estimateGas=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t);return e?void r.eth.estimateGas(n,e):r.eth.estimateGas(n)},u.prototype.displayName=function(){return o.extractDisplayName(this._name)},u.prototype.typeName=function(){return o.extractTypeName(this._name)},u.prototype.request=function(){var t=Array.prototype.slice.call(arguments),e=this.extractCallback(t),n=this.toPayload(t),r=this.unpackOutput.bind(this);return{callback:e,payload:n,format:r}},u.prototype.execute=function(){var t=!this._constant;return t?this.sendTransaction.apply(this,Array.prototype.slice.call(arguments)):this.call.apply(this,Array.prototype.slice.call(arguments))},u.prototype.attachToContract=function(t){var e=this.execute.bind(this);e.request=this.request.bind(this),e.call=this.call.bind(this),e.sendTransaction=this.sendTransaction.bind(this),e.estimateGas=this.estimateGas.bind(this);var n=this.displayName();t[n]||(t[n]=e),t[n][this.typeName()]=e},e.exports=u},{"../solidity/coder":1,"../utils/sha3":6,"../utils/utils":7,"../web3":9,"./formatters":17}],19:[function(t,e,n){"use strict";var r=t("xmlhttprequest").XMLHttpRequest,i=t("./errors"),o=function(t){this.host=t||"http://localhost:8545"};o.prototype.send=function(t){var e=new r;e.open("POST",this.host,!1),e.setRequestHeader("Content-type","application/json");try{e.send(JSON.stringify(t))}catch(n){throw i.InvalidConnection(this.host)}var o=e.responseText;try{o=JSON.parse(o)}catch(a){throw i.InvalidResponse(o)}return o},o.prototype.sendAsync=function(t,e){var n=new r;n.onreadystatechange=function(){if(4===n.readyState){var t=n.responseText,r=null;try{t=JSON.parse(t)}catch(o){r=i.InvalidResponse(t)}e(r,t)}},n.open("POST",this.host,!0),n.setRequestHeader("Content-type","application/json");try{n.send(JSON.stringify(t))}catch(o){e(i.InvalidConnection(this.host))}},e.exports=o},{"./errors":13,xmlhttprequest:4}],20:[function(t,e,n){var r=t("../utils/utils"),i=function(t){this._iban=t};i.prototype.isValid=function(){return r.isIBAN(this._iban)},i.prototype.isDirect=function(){return 34===this._iban.length},i.prototype.isIndirect=function(){return 20===this._iban.length},i.prototype.checksum=function(){return this._iban.substr(2,2)},i.prototype.institution=function(){return this.isIndirect()?this._iban.substr(7,4):""},i.prototype.client=function(){return this.isIndirect()?this._iban.substr(11):""},i.prototype.address=function(){return this.isDirect()?this._iban.substr(4):""},e.exports=i},{"../utils/utils":7}],21:[function(t,e,n){var r=function(){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,void(this.messageId=1))};r.getInstance=function(){var t=new r;return t},r.prototype.toPayload=function(t,e){return t||console.error("jsonrpc method should be specified!"),{jsonrpc:"2.0",method:t,params:e||[],id:this.messageId++}},r.prototype.isValidResponse=function(t){return!!t&&!t.error&&"2.0"===t.jsonrpc&&"number"==typeof t.id&&void 0!==t.result},r.prototype.toBatchPayload=function(t){var e=this;return t.map(function(t){return e.toPayload(t.method,t.params)})},e.exports=r},{}],22:[function(t,e,n){var r=t("./requestmanager"),i=t("../utils/utils"),o=t("./errors"),a=function(t){this.name=t.name,this.call=t.call,this.params=t.params||0,this.inputFormatter=t.inputFormatter,this.outputFormatter=t.outputFormatter};a.prototype.getCall=function(t){return i.isFunction(this.call)?this.call(t):this.call},a.prototype.extractCallback=function(t){return i.isFunction(t[t.length-1])?t.pop():void 0},a.prototype.validateArgs=function(t){if(t.length!==this.params)throw o.InvalidNumberOfParams()},a.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter.map(function(e,n){return e?e(t[n]):t[n]}):t},a.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},a.prototype.attachToObject=function(t){var e=this.send.bind(this);e.request=this.request.bind(this),e.call=this.call;var n=this.name.split(".");n.length>1?(t[n[0]]=t[n[0]]||{},t[n[0]][n[1]]=e):t[n[0]]=e},a.prototype.toPayload=function(t){var e=this.getCall(t),n=this.extractCallback(t),r=this.formatInput(t);return this.validateArgs(r),{method:e,params:r,callback:n}},a.prototype.request=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));return t.format=this.formatOutput.bind(this),t},a.prototype.send=function(){var t=this.toPayload(Array.prototype.slice.call(arguments));if(t.callback){var e=this;return r.getInstance().sendAsync(t,function(n,r){t.callback(n,e.formatOutput(r))})}return this.formatOutput(r.getInstance().send(t))},e.exports=a},{"../utils/utils":7,"./errors":13,"./requestmanager":27}],23:[function(t,e,n){var r=t("./contract"),i="0xc6d9d2cd449a754c494264e1809c50e34d64562b",o=[{constant:!0,inputs:[{name:"_owner",type:"address"}],name:"name",outputs:[{name:"o_name",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"owner",outputs:[{name:"",type:"address"}],type:"function"},{constant:!0, +inputs:[{name:"_name",type:"bytes32"}],name:"content",outputs:[{name:"",type:"bytes32"}],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"addr",outputs:[{name:"",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"reserve",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"subRegistrar",outputs:[{name:"o_subRegistrar",type:"address"}],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_newOwner",type:"address"}],name:"transfer",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_registrar",type:"address"}],name:"setSubRegistrar",outputs:[],type:"function"},{constant:!1,inputs:[],name:"Registrar",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_a",type:"address"},{name:"_primary",type:"bool"}],name:"setAddress",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"},{name:"_content",type:"bytes32"}],name:"setContent",outputs:[],type:"function"},{constant:!1,inputs:[{name:"_name",type:"bytes32"}],name:"disown",outputs:[],type:"function"},{constant:!0,inputs:[{name:"_name",type:"bytes32"}],name:"register",outputs:[{name:"",type:"address"}],type:"function"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"}],name:"Changed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,name:"name",type:"bytes32"},{indexed:!0,name:"addr",type:"address"}],name:"PrimaryChanged",type:"event"}];e.exports=r(o).at(i)},{"./contract":11}],24:[function(t,e,n){var r=t("../utils/utils"),i=t("./property"),o=[],a=[new i({name:"listening",getter:"net_listening"}),new i({name:"peerCount",getter:"net_peerCount",outputFormatter:r.toDecimal})];e.exports={methods:o,properties:a}},{"../utils/utils":7,"./property":25}],25:[function(t,e,n){var r=t("./requestmanager"),i=function(t){this.name=t.name,this.getter=t.getter,this.setter=t.setter,this.outputFormatter=t.outputFormatter,this.inputFormatter=t.inputFormatter};i.prototype.formatInput=function(t){return this.inputFormatter?this.inputFormatter(t):t},i.prototype.formatOutput=function(t){return this.outputFormatter&&null!==t?this.outputFormatter(t):t},i.prototype.attachToObject=function(t){var e={get:this.get.bind(this)},n=this.name.split("."),r=n[0];n.length>1&&(t[n[0]]=t[n[0]]||{},t=t[n[0]],r=n[1]),Object.defineProperty(t,r,e);var i=function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)};t[i("get",r)]=this.getAsync.bind(this)},i.prototype.get=function(){return this.formatOutput(r.getInstance().send({method:this.getter}))},i.prototype.getAsync=function(t){var e=this;r.getInstance().sendAsync({method:this.getter},function(n,r){return n?t(n):void t(n,e.formatOutput(r))})},e.exports=i},{"./requestmanager":27}],26:[function(t,e,n){var r=function(){};r.prototype.send=function(t){var e=navigator.qt.callMethod(JSON.stringify(t));return JSON.parse(e)},e.exports=r},{}],27:[function(t,e,n){var r=t("./jsonrpc"),i=t("../utils/utils"),o=t("../utils/config"),a=t("./errors"),s=function(t){return arguments.callee._singletonInstance?arguments.callee._singletonInstance:(arguments.callee._singletonInstance=this,this.provider=t,this.polls={},this.timeout=null,void(this.isPolling=!1))};s.getInstance=function(){var t=new s;return t},s.prototype.send=function(t){if(!this.provider)return console.error(a.InvalidProvider()),null;var e=r.getInstance().toPayload(t.method,t.params),n=this.provider.send(e);if(!r.getInstance().isValidResponse(n))throw a.InvalidResponse(n);return n.result},s.prototype.sendAsync=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toPayload(t.method,t.params);this.provider.sendAsync(n,function(t,n){return t?e(t):r.getInstance().isValidResponse(n)?void e(null,n.result):e(a.InvalidResponse(n))})},s.prototype.sendBatch=function(t,e){if(!this.provider)return e(a.InvalidProvider());var n=r.getInstance().toBatchPayload(t);this.provider.sendAsync(n,function(t,n){return t?e(t):i.isArray(n)?void e(t,n):e(a.InvalidResponse(n))})},s.prototype.setProvider=function(t){this.provider=t,this.provider&&!this.isPolling&&(this.poll(),this.isPolling=!0)},s.prototype.startPolling=function(t,e,n,r){this.polls["poll_"+e]={data:t,id:e,callback:n,uninstall:r}},s.prototype.stopPolling=function(t){delete this.polls["poll_"+t]},s.prototype.reset=function(){for(var t in this.polls)this.polls[t].uninstall();this.polls={},this.timeout&&(clearTimeout(this.timeout),this.timeout=null),this.poll()},s.prototype.poll=function(){if(this.timeout=setTimeout(this.poll.bind(this),o.ETH_POLLING_TIMEOUT),0!==Object.keys(this.polls).length){if(!this.provider)return void console.error(a.InvalidProvider());var t=[],e=[];for(var n in this.polls)t.push(this.polls[n].data),e.push(n);if(0!==t.length){var s=r.getInstance().toBatchPayload(t),u=this;this.provider.sendAsync(s,function(t,n){if(!t){if(!i.isArray(n))throw a.InvalidResponse(n);n.map(function(t,n){var r=e[n];return u.polls[r]?(t.callback=u.polls[r].callback,t):!1}).filter(function(t){return!!t}).filter(function(t){var e=r.getInstance().isValidResponse(t);return e||t.callback(a.InvalidResponse(t)),e}).filter(function(t){return i.isArray(t.result)&&t.result.length>0}).forEach(function(t){t.callback(null,t.result)})}})}}},e.exports=s},{"../utils/config":5,"../utils/utils":7,"./errors":13,"./jsonrpc":21}],28:[function(t,e,n){var r=t("./method"),i=t("./formatters"),o=new r({name:"post",call:"shh_post",params:1,inputFormatter:[i.inputPostFormatter]}),a=new r({name:"newIdentity",call:"shh_newIdentity",params:0}),s=new r({name:"hasIdentity",call:"shh_hasIdentity",params:1}),u=new r({name:"newGroup",call:"shh_newGroup",params:0}),c=new r({name:"addToGroup",call:"shh_addToGroup",params:0}),l=[o,a,s,u,c];e.exports={methods:l}},{"./formatters":17,"./method":22}],29:[function(t,e,n){var r=t("../web3"),i=t("./icap"),o=t("./namereg"),a=t("./contract"),s=function(t,e,n,r){var a=new i(e);if(!a.isValid())throw new Error("invalid iban address");if(a.isDirect())return u(t,a.address(),n,r);if(!r){var s=o.addr(a.institution());return c(t,s,n,a.client())}o.addr(a.insitution(),function(e,i){return c(t,i,n,a.client(),r)})},u=function(t,e,n,i){return r.eth.sendTransaction({address:e,from:t,value:n},i)},c=function(t,e,n,r,i){var o=[{constant:!1,inputs:[{name:"name",type:"bytes32"}],name:"deposit",outputs:[],type:"function"}];return a(o).at(e).deposit(r,{from:t,value:n},i)};e.exports=s},{"../web3":9,"./contract":11,"./icap":20,"./namereg":23}],30:[function(t,e,n){var r=t("./method"),i=function(){var t=function(t){var e=t[0];switch(e){case"latest":return t.shift(),this.params=0,"eth_newBlockFilter";case"pending":return t.shift(),this.params=0,"eth_newPendingTransactionFilter";default:return"eth_newFilter"}},e=new r({name:"newFilter",call:t,params:1}),n=new r({name:"uninstallFilter",call:"eth_uninstallFilter",params:1}),i=new r({name:"getLogs",call:"eth_getFilterLogs",params:1}),o=new r({name:"poll",call:"eth_getFilterChanges",params:1});return[e,n,i,o]},o=function(){var t=new r({name:"newFilter",call:"shh_newFilter",params:1}),e=new r({name:"uninstallFilter",call:"shh_uninstallFilter",params:1}),n=new r({name:"getLogs",call:"shh_getMessages",params:1}),i=new r({name:"poll",call:"shh_getFilterChanges",params:1});return[t,e,n,i]};e.exports={eth:i,shh:o}},{"./method":22}],31:[function(t,e,n){},{}],32:[function(t,e,n){!function(t,r){"object"==typeof n?e.exports=n=r():"function"==typeof define&&define.amd?define([],r):t.CryptoJS=r()}(this,function(){var t=t||function(t,e){var n={},r=n.lib={},i=r.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=r.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:4*t.length},toString:function(t){return(t||s).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var o=0;i>o;o++){var a=n[o>>>2]>>>24-o%4*8&255;e[r+o>>>2]|=a<<24-(r+o)%4*8}else for(var o=0;i>o;o+=4)e[r+o>>>2]=n[o>>>2];return this.sigBytes+=i,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=i.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,r=[],i=function(e){var e=e,n=987654321,r=4294967295;return function(){n=36969*(65535&n)+(n>>16)&r,e=18e3*(65535&e)+(e>>16)&r;var i=(n<<16)+e&r;return i/=4294967296,i+=.5,i*(t.random()>.5?1:-1)}},a=0;e>a;a+=4){var s=i(4294967296*(n||t.random()));n=987654071*s(),r.push(4294967296*s()|0)}return new o.init(r,e)}}),a=n.enc={},s=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push((o>>>4).toString(16)),r.push((15&o).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new o.init(n,e/2)}},u=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;n>i;i++){var o=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(o))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;e>r;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new o.init(n,e)}},c=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(e){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},l=r.BufferedBlockAlgorithm=i.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=c.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,r=n.words,i=n.sigBytes,a=this.blockSize,s=4*a,u=i/s;u=e?t.ceil(u):t.max((0|u)-this._minBufferSize,0);var c=u*a,l=t.min(4*c,i);if(c){for(var f=0;c>f;f+=a)this._doProcessBlock(r,f);var p=r.splice(0,c);n.sigBytes-=l}return new o.init(p,l)},clone:function(){var t=i.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),f=(r.Hasher=l.extend({cfg:i.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){l.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){t&&this._append(t);var e=this._doFinalize();return e},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new f.HMAC.init(t,n).finalize(e)}}}),n.algo={});return n}(Math);return t})},{}],33:[function(t,e,n){!function(r,i,o){"object"==typeof n?e.exports=n=i(t("./core"),t("./x64-core")):"function"==typeof define&&define.amd?define(["./core","./x64-core"],i):i(r.CryptoJS)}(this,function(t){return function(e){var n=t,r=n.lib,i=r.WordArray,o=r.Hasher,a=n.x64,s=a.Word,u=n.algo,c=[],l=[],f=[];!function(){for(var t=1,e=0,n=0;24>n;n++){c[t+5*e]=(n+1)*(n+2)/2%64;var r=e%5,i=(2*t+3*e)%5;t=r,e=i}for(var t=0;5>t;t++)for(var e=0;5>e;e++)l[t+5*e]=e+(2*t+3*e)%5*5;for(var o=1,a=0;24>a;a++){for(var u=0,p=0,h=0;7>h;h++){if(1&o){var m=(1<m?p^=1<t;t++)p[t]=s.create()}();var h=u.SHA3=o.extend({cfg:o.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;25>e;e++)t[e]=new s.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var n=this._state,r=this.blockSize/2,i=0;r>i;i++){var o=t[e+2*i],a=t[e+2*i+1];o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),a=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8);var s=n[i];s.high^=a,s.low^=o}for(var u=0;24>u;u++){for(var h=0;5>h;h++){for(var m=0,d=0,g=0;5>g;g++){var s=n[h+5*g];m^=s.high,d^=s.low}var y=p[h];y.high=m,y.low=d}for(var h=0;5>h;h++)for(var v=p[(h+4)%5],b=p[(h+1)%5],w=b.high,_=b.low,m=v.high^(w<<1|_>>>31),d=v.low^(_<<1|w>>>31),g=0;5>g;g++){var s=n[h+5*g];s.high^=m,s.low^=d}for(var x=1;25>x;x++){var s=n[x],F=s.high,I=s.low,B=c[x];if(32>B)var m=F<>>32-B,d=I<>>32-B;else var m=I<>>64-B,d=F<>>64-B;var N=p[l[x]];N.high=m,N.low=d}var O=p[0],A=n[0];O.high=A.high,O.low=A.low;for(var h=0;5>h;h++)for(var g=0;5>g;g++){var x=h+5*g,s=n[x],k=p[x],P=p[(h+1)%5+5*g],T=p[(h+2)%5+5*g];s.high=k.high^~P.high&T.high,s.low=k.low^~P.low&T.low}var s=n[0],D=f[u];s.high^=D.high,s.low^=D.low}},_doFinalize:function(){var t=this._data,n=t.words,r=(8*this._nDataBytes,8*t.sigBytes),o=32*this.blockSize;n[r>>>5]|=1<<24-r%32,n[(e.ceil((r+1)/o)*o>>>5)-1]|=128,t.sigBytes=4*n.length,this._process();for(var a=this._state,s=this.cfg.outputLength/8,u=s/8,c=[],l=0;u>l;l++){var f=a[l],p=f.high,h=f.low;p=16711935&(p<<8|p>>>24)|4278255360&(p<<24|p>>>8),h=16711935&(h<<8|h>>>24)|4278255360&(h<<24|h>>>8),c.push(h),c.push(p)}return new i.init(c,s)},clone:function(){for(var t=o.clone.call(this),e=t._state=this._state.slice(0),n=0;25>n;n++)e[n]=e[n].clone();return t}});n.SHA3=o._createHelper(h),n.HmacSHA3=o._createHmacHelper(h)}(Math),t.SHA3})},{"./core":32,"./x64-core":34}],34:[function(t,e,n){!function(r,i){"object"==typeof n?e.exports=n=i(t("./core")):"function"==typeof define&&define.amd?define(["./core"],i):i(r.CryptoJS)}(this,function(t){return function(e){{var n=t,r=n.lib,i=r.Base,o=r.WordArray,a=n.x64={};a.Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),a.WordArray=i.extend({init:function(t,n){t=this.words=t||[],this.sigBytes=n!=e?n:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;e>r;r++){var i=t[r];n.push(i.high),n.push(i.low)}return o.create(n,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),n=e.length,r=0;n>r;r++)e[r]=e[r].clone();return t}})}}(),t})},{"./core":32}],"bignumber.js":[function(t,e,n){!function(n){"use strict";function r(t){function e(t,r){var i,o,a,s,u,c,l=this;if(!(l instanceof e))return z&&D(26,"constructor call without new",t),new e(t,r);if(null!=r&&W(r,2,64,C,"base")){if(r=0|r,c=t+"",10==r)return l=new e(t instanceof e?t:c),S(l,j+l.e+1,L);if((s="number"==typeof t)&&0*t!=0||!new RegExp("^-?"+(i="["+x.slice(0,r)+"]+")+"(?:\\."+i+")?$",37>r?"i":"").test(c))return d(l,c,s,r);s?(l.s=0>1/t?(c=c.slice(1),-1):1,z&&c.replace(/^0\.0*|\./,"").length>15&&D(C,_,t),s=!1):l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1,c=n(c,10,r,l.s)}else{if(t instanceof e)return l.s=t.s,l.e=t.e,l.c=(t=t.c)?t.slice():t,void(C=0);if((s="number"==typeof t)&&0*t==0){if(l.s=0>1/t?(t=-t,-1):1,t===~~t){for(o=0,a=t;a>=10;a/=10,o++);return l.e=o,l.c=[t],void(C=0)}c=t+""}else{if(!g.test(c=t+""))return d(l,c,s);l.s=45===c.charCodeAt(0)?(c=c.slice(1),-1):1}}for((o=c.indexOf("."))>-1&&(c=c.replace(".","")),(a=c.search(/e/i))>0?(0>o&&(o=a),o+=+c.slice(a+1),c=c.substring(0,a)):0>o&&(o=c.length),a=0;48===c.charCodeAt(a);a++);for(u=c.length;48===c.charCodeAt(--u););if(c=c.slice(a,u+1))if(u=c.length,s&&z&&u>15&&D(C,_,l.s*t),o=o-a-1,o>G)l.c=l.e=null;else if(M>o)l.c=[l.e=0];else{if(l.e=o,l.c=[],a=(o+1)%I,0>o&&(a+=I),u>a){for(a&&l.c.push(+c.slice(0,a)),u-=I;u>a;)l.c.push(+c.slice(a,a+=I));c=c.slice(a),a=I-c.length}else a-=u;for(;a--;c+="0");l.c.push(+c)}else l.c=[l.e=0];C=0}function n(t,n,r,i){var a,s,u,l,p,h,m,d=t.indexOf("."),g=j,y=L;for(37>r&&(t=t.toLowerCase()),d>=0&&(u=V,V=0,t=t.replace(".",""),m=new e(r),p=m.pow(t.length-d),V=u,m.c=c(f(o(p.c),p.e),10,n),m.e=m.c.length),h=c(t,r,n),s=u=h.length;0==h[--u];h.pop());if(!h[0])return"0";if(0>d?--s:(p.c=h,p.e=s,p.s=i,p=E(p,m,g,y,n),h=p.c,l=p.r,s=p.e),a=s+g+1,d=h[a],u=n/2,l=l||0>a||null!=h[a+1],l=4>y?(null!=d||l)&&(0==y||y==(p.s<0?3:2)):d>u||d==u&&(4==y||l||6==y&&1&h[a-1]||y==(p.s<0?8:7)),1>a||!h[0])t=l?f("1",-g):"0";else{if(h.length=a,l)for(--n;++h[--a]>n;)h[a]=0,a||(++s,h.unshift(1));for(u=h.length;!h[--u];);for(d=0,t="";u>=d;t+=x.charAt(h[d++]));t=f(t,s)}return t}function h(t,n,r,i){var a,s,u,c,p;if(r=null!=r&&W(r,0,8,i,w)?0|r:L,!t.c)return t.toString();if(a=t.c[0],u=t.e,null==n)p=o(t.c),p=19==i||24==i&&q>=u?l(p,u):f(p,u);else if(t=S(new e(t),n,r),s=t.e,p=o(t.c),c=p.length,19==i||24==i&&(s>=n||q>=s)){for(;n>c;p+="0",c++);p=l(p,s)}else if(n-=u,p=f(p,s),s+1>c){if(--n>0)for(p+=".";n--;p+="0");}else if(n+=s-c,n>0)for(s+1==c&&(p+=".");n--;p+="0");return t.s<0&&a?"-"+p:p}function k(t,n){var r,i,o=0;for(u(t[0])&&(t=t[0]),r=new e(t[0]);++ot||t>n||t!=p(t))&&D(r,(i||"decimal places")+(e>t||t>n?" out of range":" not an integer"),t),!0}function T(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*I-1)>G?t.c=t.e=null:M>n?t.c=[t.e=0]:(t.e=n,t.c=e),t}function D(t,e,n){var r=new Error(["new BigNumber","cmp","config","div","divToInt","eq","gt","gte","lt","lte","minus","mod","plus","precision","random","round","shift","times","toDigits","toExponential","toFixed","toFormat","toFraction","pow","toPrecision","toString","BigNumber"][t]+"() "+e+": "+n);throw r.name="BigNumber Error",C=0,r}function S(t,e,n,r){var i,o,a,s,u,c,l,f=t.c,p=N;if(f){t:{for(i=1,s=f[0];s>=10;s/=10,i++);if(o=e-i,0>o)o+=I,a=e,u=f[c=0],l=u/p[i-a-1]%10|0;else if(c=y((o+1)/I),c>=f.length){if(!r)break t;for(;f.length<=c;f.push(0));u=l=0,i=1,o%=I,a=o-I+1}else{for(u=s=f[c],i=1;s>=10;s/=10,i++);o%=I,a=o-I+i,l=0>a?0:u/p[i-a-1]%10|0}if(r=r||0>e||null!=f[c+1]||(0>a?u:u%p[i-a-1]),r=4>n?(l||r)&&(0==n||n==(t.s<0?3:2)):l>5||5==l&&(4==n||r||6==n&&(o>0?a>0?u/p[i-a]:0:f[c-1])%10&1||n==(t.s<0?8:7)),1>e||!f[0])return f.length=0,r?(e-=t.e+1,f[0]=p[e%I],t.e=-e||0):f[0]=t.e=0,t;if(0==o?(f.length=c,s=1,c--):(f.length=c+1,s=p[I-o],f[c]=a>0?v(u/p[i-a]%p[a])*s:0),r)for(;;){if(0==c){for(o=1,a=f[0];a>=10;a/=10,o++);for(a=f[0]+=s,s=1;a>=10;a/=10,s++);o!=s&&(t.e++,f[0]==F&&(f[0]=1));break}if(f[c]+=s,f[c]!=F)break;f[c--]=0,s=1}for(o=f.length;0===f[--o];f.pop());}t.e>G?t.c=t.e=null:t.en?null!=(t=i[n++]):void 0};return a(e="DECIMAL_PLACES")&&W(t,0,A,2,e)&&(j=0|t),r[e]=j,a(e="ROUNDING_MODE")&&W(t,0,8,2,e)&&(L=0|t),r[e]=L,a(e="EXPONENTIAL_AT")&&(u(t)?W(t[0],-A,0,2,e)&&W(t[1],0,A,2,e)&&(q=0|t[0],U=0|t[1]):W(t,-A,A,2,e)&&(q=-(U=0|(0>t?-t:t)))),r[e]=[q,U],a(e="RANGE")&&(u(t)?W(t[0],-A,-1,2,e)&&W(t[1],1,A,2,e)&&(M=0|t[0],G=0|t[1]):W(t,-A,A,2,e)&&(0|t?M=-(G=0|(0>t?-t:t)):z&&D(2,e+" cannot be zero",t))),r[e]=[M,G],a(e="ERRORS")&&(t===!!t||1===t||0===t?(C=0,W=(z=!!t)?P:s):z&&D(2,e+b,t)),r[e]=z,a(e="CRYPTO")&&(t===!!t||1===t||0===t?(J=!(!t||!m||"object"!=typeof m),t&&!J&&z&&D(2,"crypto unavailable",m)):z&&D(2,e+b,t)),r[e]=J,a(e="MODULO_MODE")&&W(t,0,9,2,e)&&($=0|t),r[e]=$,a(e="POW_PRECISION")&&W(t,0,A,2,e)&&(V=0|t),r[e]=V,a(e="FORMAT")&&("object"==typeof t?X=t:z&&D(2,e+" not an object",t)),r[e]=X,r},e.max=function(){return k(arguments,R.lt)},e.min=function(){return k(arguments,R.gt)},e.random=function(){var t=9007199254740992,n=Math.random()*t&2097151?function(){return v(Math.random()*t)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)};return function(t){var r,i,o,a,s,u=0,c=[],l=new e(H);if(t=null!=t&&W(t,0,A,14)?0|t:j,a=y(t/I),J)if(m&&m.getRandomValues){for(r=m.getRandomValues(new Uint32Array(a*=2));a>u;)s=131072*r[u]+(r[u+1]>>>11),s>=9e15?(i=m.getRandomValues(new Uint32Array(2)),r[u]=i[0],r[u+1]=i[1]):(c.push(s%1e14),u+=2);u=a/2}else if(m&&m.randomBytes){for(r=m.randomBytes(a*=7);a>u;)s=281474976710656*(31&r[u])+1099511627776*r[u+1]+4294967296*r[u+2]+16777216*r[u+3]+(r[u+4]<<16)+(r[u+5]<<8)+r[u+6],s>=9e15?m.randomBytes(7).copy(r,u):(c.push(s%1e14),u+=7);u=a/7}else z&&D(14,"crypto unavailable",m);if(!u)for(;a>u;)s=n(),9e15>s&&(c[u++]=s%1e14);for(a=c[--u],t%=I,a&&t&&(s=N[I-t],c[u]=v(a/s)*s);0===c[u];c.pop(),u--);if(0>u)c=[o=0];else{for(o=-1;0===c[0];c.shift(),o-=I);for(u=1,s=c[0];s>=10;s/=10,u++);I>u&&(o-=I-u)}return l.e=o,l.c=c,l}}(),E=function(){function t(t,e,n){var r,i,o,a,s=0,u=t.length,c=e%O,l=e/O|0;for(t=t.slice();u--;)o=t[u]%O,a=t[u]/O|0,r=l*o+a*c,i=c*o+r%O*O+s,s=(i/n|0)+(r/O|0)+l*a,t[u]=i%n;return s&&t.unshift(s),t}function n(t,e,n,r){var i,o;if(n!=r)o=n>r?1:-1;else for(i=o=0;n>i;i++)if(t[i]!=e[i]){o=t[i]>e[i]?1:-1;break}return o}function r(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]1;t.shift());}return function(o,a,s,u,c){var l,f,p,h,m,d,g,y,b,w,_,x,B,N,O,A,k,P=o.s==a.s?1:-1,T=o.c,D=a.c;if(!(T&&T[0]&&D&&D[0]))return new e(o.s&&a.s&&(T?!D||T[0]!=D[0]:D)?T&&0==T[0]||!D?0*P:P/0:0/0);for(y=new e(P),b=y.c=[],f=o.e-a.e,P=s+f+1,c||(c=F,f=i(o.e/I)-i(a.e/I),P=P/I|0),p=0;D[p]==(T[p]||0);p++);if(D[p]>(T[p]||0)&&f--,0>P)b.push(1),h=!0;else{for(N=T.length,A=D.length,p=0,P+=2,m=v(c/(D[0]+1)),m>1&&(D=t(D,m,c),T=t(T,m,c),A=D.length,N=T.length),B=A,w=T.slice(0,A),_=w.length;A>_;w[_++]=0);k=D.slice(),k.unshift(0),O=D[0],D[1]>=c/2&&O++;do{if(m=0,l=n(D,w,A,_),0>l){if(x=w[0],A!=_&&(x=x*c+(w[1]||0)),m=v(x/O),m>1)for(m>=c&&(m=c-1),d=t(D,m,c),g=d.length,_=w.length;1==n(d,w,g,_);)m--,r(d,g>A?k:D,g,c),g=d.length,l=1;else 0==m&&(l=m=1),d=D.slice(),g=d.length;if(_>g&&d.unshift(0),r(w,d,_,c),_=w.length,-1==l)for(;n(D,w,A,_)<1;)m++,r(w,_>A?k:D,_,c),_=w.length}else 0===l&&(m++,w=[0]);b[p++]=m,w[0]?w[_++]=T[B]||0:(w=[T[B]],_=1)}while((B++=10;P/=10,p++);S(y,s+(y.e=p+f*I-1)+1,u,h)}else y.e=f,y.r=+h;return y}}(),d=function(){var t=/^(-?)0([xbo])/i,n=/^([^.]+)\.$/,r=/^\.([^.]+)$/,i=/^-?(Infinity|NaN)$/,o=/^\s*\+|^\s+|\s+$/g;return function(a,s,u,c){var l,f=u?s:s.replace(o,"");if(i.test(f))a.s=isNaN(f)?null:0>f?-1:1;else{if(!u&&(f=f.replace(t,function(t,e,n){return l="x"==(n=n.toLowerCase())?16:"b"==n?2:8,c&&c!=l?t:e}),c&&(l=c,f=f.replace(n,"$1").replace(r,"0.$1")),s!=f))return new e(f,l);z&&D(C,"not a"+(c?" base "+c:"")+" number",s),a.s=null}a.c=a.e=null,C=0}}(),R.absoluteValue=R.abs=function(){var t=new e(this);return t.s<0&&(t.s=1),t},R.ceil=function(){return S(new e(this),this.e+1,2)},R.comparedTo=R.cmp=function(t,n){return C=1,a(this,new e(t,n))},R.decimalPlaces=R.dp=function(){var t,e,n=this.c;if(!n)return null;if(t=((e=n.length-1)-i(this.e/I))*I,e=n[e])for(;e%10==0;e/=10,t--);return 0>t&&(t=0),t},R.dividedBy=R.div=function(t,n){return C=3,E(this,new e(t,n),j,L)},R.dividedToIntegerBy=R.divToInt=function(t,n){return C=4,E(this,new e(t,n),0,1)},R.equals=R.eq=function(t,n){return C=5,0===a(this,new e(t,n))},R.floor=function(){return S(new e(this),this.e+1,3)},R.greaterThan=R.gt=function(t,n){return C=6,a(this,new e(t,n))>0},R.greaterThanOrEqualTo=R.gte=function(t,n){return C=7,1===(n=a(this,new e(t,n)))||0===n},R.isFinite=function(){return!!this.c},R.isInteger=R.isInt=function(){return!!this.c&&i(this.e/I)>this.c.length-2},R.isNaN=function(){return!this.s},R.isNegative=R.isNeg=function(){return this.s<0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.lessThan=R.lt=function(t,n){return C=8,a(this,new e(t,n))<0},R.lessThanOrEqualTo=R.lte=function(t,n){return C=9,-1===(n=a(this,new e(t,n)))||0===n},R.minus=R.sub=function(t,n){var r,o,a,s,u=this,c=u.s;if(C=10,t=new e(t,n),n=t.s,!c||!n)return new e(0/0);if(c!=n)return t.s=-n,u.plus(t);var l=u.e/I,f=t.e/I,p=u.c,h=t.c;if(!l||!f){if(!p||!h)return p?(t.s=-n,t):new e(h?u:0/0);if(!p[0]||!h[0])return h[0]?(t.s=-n,t):new e(p[0]?u:3==L?-0:0)}if(l=i(l),f=i(f),p=p.slice(),c=l-f){for((s=0>c)?(c=-c,a=p):(f=l,a=h),a.reverse(),n=c;n--;a.push(0));a.reverse()}else for(o=(s=(c=p.length)<(n=h.length))?c:n,c=n=0;o>n;n++)if(p[n]!=h[n]){s=p[n]0)for(;n--;p[r++]=0);for(n=F-1;o>c;){if(p[--o]0?(u=s,r=l):(a=-a,r=c),r.reverse();a--;r.push(0));r.reverse()}for(a=c.length,n=l.length,0>a-n&&(r=l,l=c,c=r,n=a),a=0;n;)a=(c[--n]=c[n]+l[n]+a)/F|0,c[n]%=F;return a&&(c.unshift(a),++u),T(t,c,u)},R.precision=R.sd=function(t){var e,n,r=this,i=r.c;if(null!=t&&t!==!!t&&1!==t&&0!==t&&(z&&D(13,"argument"+b,t),t!=!!t&&(t=null)),!i)return null;if(n=i.length-1,e=n*I+1,n=i[n]){for(;n%10==0;n/=10,e--);for(n=i[0];n>=10;n/=10,e++);}return t&&r.e+1>e&&(e=r.e+1),e},R.round=function(t,n){var r=new e(this);return(null==t||W(t,0,A,15))&&S(r,~~t+this.e+1,null!=n&&W(n,0,8,15,w)?0|n:L),r},R.shift=function(t){var n=this;return W(t,-B,B,16,"argument")?n.times("1e"+p(t)):new e(n.c&&n.c[0]&&(-B>t||t>B)?n.s*(0>t?0:1/0):n)},R.squareRoot=R.sqrt=function(){var t,n,r,a,s,u=this,c=u.c,l=u.s,f=u.e,p=j+4,h=new e("0.5");if(1!==l||!c||!c[0])return new e(!l||0>l&&(!c||c[0])?0/0:c?u:1/0);if(l=Math.sqrt(+u),0==l||l==1/0?(n=o(c),(n.length+f)%2==0&&(n+="0"),l=Math.sqrt(n),f=i((f+1)/2)-(0>f||f%2),l==1/0?n="1e"+f:(n=l.toExponential(),n=n.slice(0,n.indexOf("e")+1)+f),r=new e(n)):r=new e(l+""),r.c[0])for(f=r.e,l=f+p,3>l&&(l=0);;)if(s=r,r=h.times(s.plus(E(u,s,p,1))),o(s.c).slice(0,l)===(n=o(r.c)).slice(0,l)){if(r.el&&(g=w,w=_,_=g,a=l,l=h,h=a),a=l+h,g=[];a--;g.push(0));for(y=F,v=O,a=h;--a>=0;){for(r=0,m=_[a]%v,d=_[a]/v|0,u=l,s=a+u;s>a;)f=w[--u]%v,p=w[u]/v|0,c=d*f+p*m,f=m*f+c%v*v+g[s]+r,r=(f/y|0)+(c/v|0)+d*p,g[s--]=f%y;g[s]=r}return r?++o:g.shift(),T(t,g,o)},R.toDigits=function(t,n){var r=new e(this);return t=null!=t&&W(t,1,A,18,"precision")?0|t:null,n=null!=n&&W(n,0,8,18,w)?0|n:L,t?S(r,t,n):r},R.toExponential=function(t,e){return h(this,null!=t&&W(t,0,A,19)?~~t+1:null,e,19)},R.toFixed=function(t,e){return h(this,null!=t&&W(t,0,A,20)?~~t+this.e+1:null,e,20)},R.toFormat=function(t,e){var n=h(this,null!=t&&W(t,0,A,21)?~~t+this.e+1:null,e,21);if(this.c){var r,i=n.split("."),o=+X.groupSize,a=+X.secondaryGroupSize,s=X.groupSeparator,u=i[0],c=i[1],l=this.s<0,f=l?u.slice(1):u,p=f.length;if(a&&(r=o,o=a,a=r,p-=r),o>0&&p>0){for(r=p%o||o,u=f.substr(0,r);p>r;r+=o)u+=s+f.substr(r,o);a>0&&(u+=s+f.slice(r)),l&&(u="-"+u)}n=c?u+X.decimalSeparator+((a=+X.fractionGroupSize)?c.replace(new RegExp("\\d{"+a+"}\\B","g"),"$&"+X.fractionGroupSeparator):c):u}return n},R.toFraction=function(t){var n,r,i,a,s,u,c,l,f,p=z,h=this,m=h.c,d=new e(H),g=r=new e(H),y=c=new e(H);if(null!=t&&(z=!1,u=new e(t),z=p,(!(p=u.isInt())||u.lt(H))&&(z&&D(22,"max denominator "+(p?"out of range":"not an integer"),t),t=!p&&u.c&&S(u,u.e+1,1).gte(H)?u:null)),!m)return h.toString();for(f=o(m),a=d.e=f.length-h.e-1,d.c[0]=N[(s=a%I)<0?I+s:s],t=!t||u.cmp(d)>0?a>0?d:g:u,s=G,G=1/0,u=new e(f),c.c[0]=0;l=E(u,d,0,1),i=r.plus(l.times(y)),1!=i.cmp(t);)r=y,y=i,g=c.plus(l.times(i=g)),c=i,d=u.minus(l.times(i=d)),u=i;return i=E(t.minus(r),y,0,1),c=c.plus(i.times(g)),r=r.plus(i.times(y)),c.s=g.s=h.s,a*=2,n=E(g,y,a,L).minus(h).abs().cmp(E(c,r,a,L).minus(h).abs())<1?[g.toString(),y.toString()]:[c.toString(),r.toString()],G=s,n},R.toNumber=function(){var t=this;return+t||(t.s?0*t.s:0/0)},R.toPower=R.pow=function(t){var n,r,i=v(0>t?-t:+t),o=this;if(!W(t,-B,B,23,"exponent")&&(!isFinite(t)||i>B&&(t/=0)||parseFloat(t)!=t&&!(t=0/0)))return new e(Math.pow(+o,t));for(n=V?y(V/I+2):0,r=new e(H);;){if(i%2){if(r=r.times(o),!r.c)break;n&&r.c.length>n&&(r.c.length=n)}if(i=v(i/2),!i)break;o=o.times(o),n&&o.c&&o.c.length>n&&(o.c.length=n)}return 0>t&&(r=H.div(r)),n?S(r,V,L):r},R.toPrecision=function(t,e){return h(this,null!=t&&W(t,1,A,24,"precision")?0|t:null,e,24)},R.toString=function(t){var e,r=this,i=r.s,a=r.e;return null===a?i?(e="Infinity",0>i&&(e="-"+e)):e="NaN":(e=o(r.c),e=null!=t&&W(t,2,64,25,"base")?n(f(e,a),0|t,10,i):q>=a||a>=U?l(e,a):f(e,a),0>i&&r.c[0]&&(e="-"+e)),e},R.truncated=R.trunc=function(){return S(new e(this),this.e+1,1)},R.valueOf=R.toJSON=function(){return this.toString()},null!=t&&e.config(t),e}function i(t){var e=0|t;return t>0||t===e?e:e-1}function o(t){for(var e,n,r=1,i=t.length,o=t[0]+"";i>r;){for(e=t[r++]+"",n=I-e.length;n--;e="0"+e);o+=e}for(i=o.length;48===o.charCodeAt(--i););return o.slice(0,i+1||1)}function a(t,e){var n,r,i=t.c,o=e.c,a=t.s,s=e.s,u=t.e,c=e.e;if(!a||!s)return null;if(n=i&&!i[0],r=o&&!o[0],n||r)return n?r?0:-s:a;if(a!=s)return a;if(n=0>a,r=u==c,!i||!o)return r?0:!i^n?1:-1;if(!r)return u>c^n?1:-1;for(s=(u=i.length)<(c=o.length)?u:c,a=0;s>a;a++)if(i[a]!=o[a])return i[a]>o[a]^n?1:-1;return u==c?0:u>c^n?1:-1}function s(t,e,n){return(t=p(t))>=e&&n>=t}function u(t){return"[object Array]"==Object.prototype.toString.call(t)}function c(t,e,n){for(var r,i,o=[0],a=0,s=t.length;s>a;){for(i=o.length;i--;o[i]*=e);for(o[r=0]+=x.indexOf(t.charAt(a++));rn-1&&(null==o[r+1]&&(o[r+1]=0),o[r+1]+=o[r]/n|0,o[r]%=n)}return o.reverse()}function l(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(0>e?"e":"e+")+e}function f(t,e){var n,r;if(0>e){for(r="0.";++e;r+="0");t=r+t}else if(n=t.length,++e>n){for(r="0",e-=n;--e;r+="0");t+=r}else n>e&&(t=t.slice(0,e)+"."+t.slice(e));return t}function p(t){return t=parseFloat(t),0>t?y(t):v(t)}var h,m,d,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,y=Math.ceil,v=Math.floor,b=" not a boolean or binary digit",w="rounding mode",_="number type has more than 15 significant digits",x="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_",F=1e14,I=14,B=9007199254740991,N=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],O=1e7,A=1e9;if(h=r(),"function"==typeof define&&define.amd)define(function(){return h});else if("undefined"!=typeof e&&e.exports){if(e.exports=h,!m)try{m=t("crypto")}catch(k){}}else n.BigNumber=h}(this)},{crypto:31}],web3:[function(t,e,n){var r=t("./lib/web3");r.providers.HttpProvider=t("./lib/web3/httpprovider"),r.providers.QtSyncProvider=t("./lib/web3/qtsync"),r.eth.contract=t("./lib/web3/contract"),r.eth.namereg=t("./lib/web3/namereg"),r.eth.sendIBANTransaction=t("./lib/web3/transfer"),"undefined"!=typeof window&&"undefined"==typeof window.web3&&(window.web3=r),e.exports=r},{"./lib/web3":9,"./lib/web3/contract":11,"./lib/web3/httpprovider":19,"./lib/web3/namereg":23,"./lib/web3/qtsync":26,"./lib/web3/transfer":29}]},{},["web3"]); \ No newline at end of file From 4565afcb51b0950ed54f429490b6fbe7c15386e8 Mon Sep 17 00:00:00 2001 From: CJentzsch Date: Tue, 23 Jun 2015 13:14:45 +0200 Subject: [PATCH 169/169] create directory if not existent when writing to file --- libdevcore/CommonIO.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/libdevcore/CommonIO.cpp b/libdevcore/CommonIO.cpp index cfe7b8a6b..055b645ed 100644 --- a/libdevcore/CommonIO.cpp +++ b/libdevcore/CommonIO.cpp @@ -98,9 +98,9 @@ string dev::contentsString(string const& _file) void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDeleteRename) { + namespace fs = boost::filesystem; if (_writeDeleteRename) { - namespace fs = boost::filesystem; fs::path tempPath = fs::unique_path(_file + "-%%%%%%"); writeFile(tempPath.string(), _data, false); // will delete _file if it exists @@ -108,10 +108,14 @@ void dev::writeFile(std::string const& _file, bytesConstRef _data, bool _writeDe } else { + // create directory if not existent + fs::path p(_file); + fs::create_directories(p.parent_path()); + ofstream s(_file, ios::trunc | ios::binary); s.write(reinterpret_cast(_data.data()), _data.size()); if (!s) - BOOST_THROW_EXCEPTION(FileError()); + BOOST_THROW_EXCEPTION(FileError() << errinfo_comment("Could not write to file: " + _file)); } }