Coder Social home page Coder Social logo

espp's Introduction

ESPP

espp's People

Contributors

amagicneko avatar

Watchers

 avatar

espp's Issues

Problem: Crash on EVMONE get_tx_context (block number or get time_stamp)

crash on

 inline void number(StackTop stack, ExecutionState& state) noexcept
{
    auto n = state.get_tx_context(); // crashed here
    stack.push(static_cast<uint64_t>(n.block_number));
}

it is odd.

backtrack

const evmc_tx_context& get_tx_context() noexcept
  {
      if (INTX_UNLIKELY(m_tx.block_timestamp == 0))
          m_tx = host.get_tx_context();
      return m_tx;
  }
evmc_tx_context SimulateHost::get_tx_context() const noexcept {
    return _context;
}

Problem: Temporary Variable has a same address as the Heap-Allocated Variable

for (auto& log: logs) {
    if (log.address != factory_address) {
        LOG(INFO) << "not matched factory address::" << log.address.to_string();
        continue;
    }
    LOG(INFO) << "matched log:" <<  log.to_string();
    if (log.data.size() != 64) [[unlikely]] {
        LOG(INFO) << "wrong log data:" << log.data.to_string();
        continue;
    }
    if (log.topics.size() != 4) [[unlikely]] {
        LOG(INFO) << "wrong log topics:" << log.topics[0].to_string();
        continue;
    }
    /*
    event PoolCreated(
    address indexed token0,
    address indexed token1,
    uint24 indexed fee,
    int24 tickSpacing,
    address pool
    );
    */
    Address token1(log.topics[1]);
    Address token2(log.topics[2]);
    uint64_t fee = log.topics[3].to_uint256().convert_to<uint64_t>();
    uint64_t tick_space = log.data.to_uint256(0, 32).convert_to<uint64_t>();;
    Address pool(log.data, 44, 64); // pool has the same address as the PoolManager::instance()->_pools[1]->address
    PoolManager::instance()->add_uniswapv3_pool(pool, token1, token2, fee, tick_space);
    UniswapV3Pool* p = 0;
...
UniswapV3Pool* PoolManager::add_uniswapv3_pool(const Address& pool_addr, const Address& token0, const Address& token1, uint64_t fee, uint64_t tickspace) {
    if (_pools_address_map.seek(pool_addr) != 0) {
        return 0;
    }
    add_token(token0);
    add_token(token0);
    uint32_t index0 = _tokens_index[token0];
    uint32_t index1 = _tokens_index[token0];
    auto p = new UniswapV3Pool(index0, index1, pool_addr, fee, tickspace, 2 * FLAGS_uniswapv3_half_tick_count + 1);
    _pools.push_back(p); // pushed here
    _pools_map[index0][index1].push_back(_pools.size() - 1);
    _pools_reverse_map[index1][index0].push_back(_pools.size()-1);
    assert(_pools_address_map.seek(pool_addr) == 0);
    _pools_address_map.insert(pool_addr, _pools.size()-1);
    LOG(INFO) << "added uniswapV3 pool:" << p->address.to_string();
    for (auto pp : _pools) {
        LOG(INFO) << pp->address.to_string();
    }
    return 0;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.