Coder Social home page Coder Social logo

thetatoken / theta-eth-rpc-adaptor Goto Github PK

View Code? Open in Web Editor NEW
24.0 24.0 11.0 374 KB

An adaptor that translates the Theta RPC APIs to the Ethereum RPC APIs

Home Page: https://docs.thetatoken.org/

Makefile 1.27% Go 97.96% Dockerfile 0.22% Shell 0.55%

theta-eth-rpc-adaptor's People

Contributors

jieyilong avatar jingxu85 avatar weiribao avatar zhenyang-sliver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

theta-eth-rpc-adaptor's Issues

Empty reply from server while calling block height 0x1

After the guardian node and RPC-adaptor are deployed. I tried to call eth_getBlockByNumber via RPC-adaptor. When I call the latest block number, it's fine:

root@server:/opt/apps/theta/bin# curl -X "POST" "http://127.0.0.1:8545/" -H 'Content-Type: application/json' -d '{"id": 1337, "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0xe518e8", false]}'
{"jsonrpc":"2.0","id":1337,"result":{"number":"0xe518e8","hash":"0x593e38309902397f4222c0d94326653fcbd562411bbd40aa591591ee97cfe657","parentHash":"0x198180ec11e8f1fe1b1aa60c2ec77687886a5009bce12d63a983856d2b63d53a","timestamp":"0x625d572b","miner":"0x80eab22e27d4b94511f5906484369b868d6552d2","transactionsRoot":"0xab0e8312f8f4f611000d554a2f176be6f299e89a04f01f01ec9cc5abeab905fa","stateRoot":"0xf631cce5c8267bb6450cbe07cfffc2d7f8820a9c723ca9a8f7163aa245ad2023","receiptsRoot":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","sha3Uncles":"0x0000000000000000000000000000000000000000000000000000000000000000","logsBloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","difficulty":"0x0","totalDifficulty":"0x0","size":"0x3e8","gasLimit":"0x1312d00","gasUsed":"0x0","extraData":"0x","uncles":[],"transactions":[]}}

When I call the very first block number 0x1. It looks like something is wrong:

root@server:/opt/apps/theta/bin# curl -X "POST" "http://127.0.0.1:8545/" -H 'Content-Type: application/json' -d '{"id": 1337, "jsonrpc": "2.0", "method": "eth_getBlockByNumber", "params": ["0x1", false]}'
curl: (52) Empty reply from server

PS: I followed this doc to build and deploy rpc-adaptor and Theta guardian node.

Unable to estimate gas with ethers and metamask if amount being sent in value exceeds 20 TFUEL

I've been trying to debug this strange error. I'm trying to call a contract with ethers and metamask, and it seems like the estimateGas function fails every time if the amount being sent in value exceeds 20 TFUEL. Here is a sample code to help replicate the problem:

    let estimate = contract.estimateGas.mintTicket;
    let method = contract.mintTicket;
    const tokensToMint = BigNumber.from(numTokens)
    let args = [
      tokensToMint 
    ];
    let value = tokenPrice.mul(tokensToMint)
    estimate(...args, { value }).then((estimatedGasLimit: any) => {
      return method(...args, {
        value,
        gasLimit: calculateGasMargin(estimatedGasLimit, GAS_MARGIN)
      })
    }).then((tx: any) => {
      addTransaction(tx);
    })

Let's say tokenPrice is 5 TFUEL, then the above function works with tokensToMint being 3 or less. If tokenPrice is 20 TFUEL, the above function fails even with tokensToMint being 1. Which puzzles me because technically, less tokens to mint should execute less code, resulting in less gas being used.

The RPC adaptor returns the following error message: "WARN[0049] eth_estimateGas: EVM execution failed: evm: execution reverted prefix=ethrpc"

I think it might be a problem with the RPC adaptor estimate gas function, because calling the method with a manually set gas limit does not revert. It seems like there is a hardcoded gas limit here ./rpc/ethrpc/eth_get_block_by_hash.go: result.GasLimit = 20000000, though I did not check if this is what is causing it. This is also on a local Theta privatenet. Perhaps the value of the transaction is being mixed up with gas used in the transaction?

build error

Hi there!
I'm trying to build the adaptor and there is an error during build process:

go: downloading github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521
../theta/rpc/query.go:24:2: cannot find module providing package github.com/thetatoken/theta/version: module github.com/thetatoken/theta/version: git ls-remote -q origin in /home/kliapkou/go/pkg/mod/cache/vcs/5f8e6c4bdc5462a94fc16d4df6a65c06d7c188180d6d3bfc6fee44ce27dadd04: exit status 128:
        fatal: could not read Username for 'https://github.com': terminal prompts disabled
Confirm the import path was entered correctly.
If this is a private repository, see https://golang.org/doc/faq#git_https for additional information.
Makefile:24: recipe for target 'release' failed
make: *** [release] Error 1

Details:

go version
go version go1.14.2 linux/amd64

eth_getLogs returns error: -32000: Block height must be specified

Hello again! I'm trying to retrieve logs for events emitted by my smart contract, and this is what I am calling with ethers:

const filter = FACTORY_CONTRACT.filters.EventCreate(account, null);
const logs = await FACTORY_CONTRACT.queryFilter(filter, 0, "latest");
console.log(logs)

However, the RPC adaptor seems to be throwing this error instead:

INFO[1871] eth_getLogs called, fromBlock: 0x0, toBlock: latest, address: 0x11af5e52989cdd566ad60a8966b6be12d6d6fcf7, blockHash: 0x0000000000000000000000000000000000000000000000000000000000000000, topics: [0x4f6315262068043110f08ded2fb22695a25b3bb03e903990fc81a0d3fedb9bb9 0x0000000000000000000000007825110a6a33113978d54bbf1aad6383b094008c]  prefix=ethrpc
INFO[1871] blockStart: 0, blockEnd: 688746               prefix=ethrpc
WARN[1871] eth_getLogs, theta.GetBlocksByHeight returned error: theta RPC returns an error: -32000: Block height must be specified  prefix=ethrpc
WARN[1873] eth_getLogs, theta.GetBlocksByHeight returned error: theta RPC returns an error: -32000: Block height must be specified  prefix=ethrpc
WARN[1877] eth_getLogs, theta.GetBlocksByHeight returned error: theta RPC returns an error: -32000: Block height must be specified  prefix=ethrpc
...

Any idea what might be going wrong here? Thank you!

Incorrect events emitted by the Theta blockchain

Hi there! This is Richard from TKETS again. I have observed a rather strange thing happening on the blockchain explorer and the RPC endpoint, and was wondering why this is happening.

First of all, for our ticket smart contract, we have a mint ticket function as follows (for your reference):

function mintTicket(uint256 numberOfTickets) external payable {
        # checks if the number of tickets is not 0
        require(numberOfTickets != 0, TICKET_SALE_ERROR);

        # sets the commission and adds to the price of the ticket
        uint256 ticketCommission = SafeMath.div(SafeMath.mul(ticketPrice, factory.commissionRate()), 10000);
        uint256 ticketSalePrice = SafeMath.add(ticketPrice, ticketCommission);

        # calculates the expected TFUEL value paid for this mint transaction, based on the number of tickets
        uint256 ticketSaleValue = SafeMath.mul(ticketSalePrice, numberOfTickets);

        # check if the message amount is equal or greater than (in case of donations) the total ticket sale value calculated previously
        require(msg.value == ticketSaleValue || (metadata.acceptDonations && msg.value > ticketSaleValue), TICKET_SALE_ERROR);
        
        # check if event exists in the factory
        require(!factory.eventToStatus(eventId), TICKET_SALE_ERROR);

        # check if minting is within ticket sale time
        require(block.timestamp > SafeMath.sub(metadata.ticketStartTime, 10) && block.timestamp < metadata.ticketEndTime, TICKET_SALE_ERROR); // have some leeway for starting time

        # get current total supply of tickets
        uint256 currentTicketCount = totalSupply();

        # add the number of tickets to be minted
        uint256 endTicketCount = SafeMath.add(currentTicketCount, numberOfTickets);

        # check if this end ticket count is not greater than the maximum tickets allowed
        require(metadata.maxTickets == 0 || endTicketCount <= metadata.maxTickets, TICKET_SALE_ERROR);


        # for each ticket in number of tickets minted, mint the ticket to the sender address
        for (uint256 i = 1; i <= numberOfTickets; i++) {
            # adds i to the current ticket count and emits a mint event
            uint256 nextTokenId = currentTicketCount + i;
            super._mint(msg.sender, nextTokenId);
            emit TicketMint(msg.sender, nextTokenId);
        }

        # pay ticket commission if there is
        if (ticketCommission > 0) {
            payable(factory).transfer(SafeMath.mul(ticketCommission, numberOfTickets));
        }
    }

I've checked this many times and I don't see how in any case, the same token ID could be minted twice. There is no possibility of reentrancy here, because the only external contract we call is our own EventFactory contract. Yet, take a look at the following sequence of transactions:

Transaction 1

Explorer link: https://explorer.thetatoken.org/txs/0x8c1266aec59c934e1ae8798f3623623e9a8684d367cced22c8404260dd632e50
Event 0x38724e6ad4034b018042d9630894fc289eef8ca90c53de83ce512efd5e638bba topics (our mint event):
Topic 1: 0x00000000000000000000000080ca09c8622f62ec83fb32049adbd007aff51571 (the owner address)
Topic 2: 0x000000000000000000000000000000000000000000000000000000000000028f (the token ID minted, in hexadecimal)

This is fine for now, until we look at the next two transactions.

Transaction 2

Explorer link: https://explorer.thetatoken.org/txs/0x21a1f5872991c7e14977a89456a449742b438dbdc8346423bf4dc249479b7d53
Event 0x38724e6ad4034b018042d9630894fc289eef8ca90c53de83ce512efd5e638bba topics (our mint event):
Topic 1: 0x000000000000000000000000cf46d7def9a16966661506ecd9f2235cfa166377 (the owner address)
Topic 2: 0x0000000000000000000000000000000000000000000000000000000000000295 (the token ID minted, in hexadecimal)

This should be 290, because that is the next succeeding token ID. But if we look at the next transaction...

Transaction 3

Explorer link: https://explorer.thetatoken.org/txs/0x4ed593597e64bb60aae6b035586eccc0c2fb719481288fa3f2ce8102bd0f37e3
Event 0x38724e6ad4034b018042d9630894fc289eef8ca90c53de83ce512efd5e638bba topics (our mint event):
Topic 1: 0x0000000000000000000000007003053a96979b76ffd7359aa288bd583d74807c (the owner address)
Topic 2: 0x0000000000000000000000000000000000000000000000000000000000000291 (the token ID minted, in hexadecimal)

... (there are multiple events for this transaction)

Event 0x38724e6ad4034b018042d9630894fc289eef8ca90c53de83ce512efd5e638bba topics (our mint event):
Topic 1: 0x0000000000000000000000007003053a96979b76ffd7359aa288bd583d74807c (the owner address)
Topic 2: 0x0000000000000000000000000000000000000000000000000000000000000295 (the token ID minted, in hexadecimal)

Here we see that the first ticket minted is 291, which is correct. However, this person mints 5 tickets in total, and therefore mints ticket 295 again, which should not be possible.

If we query the smart contract directly for the owner of the token ID 656 (which is in hexadecimal 290, our missing ticket) using the following script run in truffle:

const TNT721 = artifacts.require("TNT721");

module.exports = async function(callback) {
  // perform actions
  const NFTInstance = await TNT721.at("0x0478578c5e906afeb1bdbbf358929affbf1575c8");
  let ownerOfToken = await NFTInstance.ownerOf("656")
  console.log(ownerOfToken)
  callback()
}

we get the following owner: 0xcf46d7DeF9a16966661506EcD9f2235Cfa166377, which is the same owner of the ticket minted in transaction 2. Therefore, this means that our code is functional, because the event we emit uses the same nextTokenId as the one we call the _mint() function with. If there was a bug in the minting loop, both the event and the owner stored on the blockchain would be wrong. I suspect that there may be some problem with the logs emitted for this particular block, or perhaps just some issues with caching on the Theta Explorer and RPC endpoint? I'm not sure. This is the only occurence of this particular problem for us. Could you advice on what might be wrong here? Thank you!

common/utils.go:249:34: undefined: common.HeightRPCCompatibility

@jieyilong , Please comment on this issue ,
ubuntu@ip-172-31-6-115:/usr/local/go/src/github.com/thetatoken/theta-eth-rpc-adaptor$ make install
go install ./cmd/...

github.com/thetatoken/theta-eth-rpc-adaptor/common

common/utils.go:249:34: undefined: common.HeightRPCCompatibility
make: *** [Makefile:24: release] Error 2

theta-eth-rpc-adaptor build error on linux

hi everyone,

I would like to run this on my linux machine.

and I ran on makefile directory : make linux

then I got this error:

make: integration/docker/build/build.sh: Command not found make: *** [Makefile:13: linux] Error 127

how do I fix this error and how do I run on linux?

also I tried make install to, but I got errors again like this:

`

$ make install

go install ./cmd/...
go: finding github.com/jackpal/go-nat-pmp v1.0.2-0.20160603034137-1fa385a6f458
go: finding github.com/julienschmidt/httprouter v1.1.1-0.20170430222011-975b5c4c7c21
go: finding github.com/steakknife/bloomfilter v0.0.0-20180922174646-6819c0d2a570
go: finding github.com/kylelemons/godebug v1.1.0
go: finding github.com/libp2p/go-libp2p-routing-helpers v0.2.3
go: finding github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef
go: finding github.com/steakknife/hamming v0.0.0-20180906055917-c99c65617cd3
go: finding github.com/wsddn/go-ecdh v0.0.0-20161211032359-48726bab9208
go: finding golang.org/x/net v0.0.0-20190628185345-da137c7871d7
go: finding github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6
go: finding github.com/mattn/go-colorable v0.1.0
go: finding github.com/google/gopacket v1.1.18
go: finding github.com/wedeploy/gosocketio v0.0.7-beta
go: parsing ../theta/common/go.mod: open /home/harmony/theta_eth_rpc_adaptor/theta/common/go.mod: no such file or directory
go: finding github.com/ipfs/go-ipns v0.0.2
go: finding github.com/hashicorp/golang-lru v0.0.0-20160813221303-0a025b7e63ad
go: finding github.com/karalabe/usb v0.0.0-20190919080040-51dc0efba356
go: finding github.com/cespare/xxhash/v2 v2.1.1
go: github.com/wedeploy/[email protected]: unknown revision v0.0.7-beta
go: finding github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035
go: finding golang.org/x/sync v0.0.0-20181108010431-42b317875d0f
go: finding github.com/gorilla/websocket v1.4.1-0.20190629185528-ae1634f6a989
go: finding golang.org/x/sys v0.0.0-20200519105757-fe76b779f299
go: finding github.com/btcsuite/btcd v0.0.0-20171128150713-2e60448ffcc6
go: finding github.com/syndtr/goleveldb v1.0.1-0.20190923125748-758128399b1d
go: finding go.uber.org/zap v1.16.0

go: finding github.com/benbjohnson/clock v1.0.2
go: finding github.com/cespare/cp v0.1.0
go: finding github.com/spf13/pflag v1.0.5
go: finding gopkg.in/olebedev/go-duktape.v3 v3.0.0-20190213234257-ec84240a7772
go: finding golang.org/x/sys v0.0.0-20190712062909-fae7ac547cb7
go: finding github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc
go: finding github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4
go: finding github.com/go-ole/go-ole v1.2.1
go: finding github.com/Azure/azure-pipeline-go v0.2.2
go: finding github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7
go: finding github.com/cloudflare/cloudflare-go v0.10.2-0.20190916151808-a80f83b9add9
go: parsing ../theta/go.mod: open /home/harmony/theta_eth_rpc_adaptor/theta/go.mod: no such file or directory
go: finding github.com/libp2p/go-libp2p-testing v0.3.0
go: finding github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
go: finding github.com/libp2p/go-libp2p-record v0.1.3
go: finding github.com/hashicorp/go-multierror v1.1.0
go: finding github.com/robertkrimen/otto v0.0.0-20170205013659-6a77b7cbc37d
go: finding golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9
go: finding github.com/google/go-cmp v0.3.1
go: parsing ../theta/rpc/lib/rpc-codec/jsonrpc2/go.mod: open /home/harmony/theta_eth_rpc_adaptor/theta/rpc/lib/rpc-codec/jsonrpc2/go.mod: no such file or directory
go: finding github.com/rjeczalik/notify v0.9.1
go: finding github.com/nxadm/tail v1.4.4
go: finding github.com/prometheus/tsdb v0.6.2-0.20190402121629-4f204dcbc150
go: finding github.com/konsorten/go-windows-terminal-sequences v1.0.3
go: finding github.com/elastic/gosigar v0.8.1-0.20180330100440-37f05ff46ffa
go: finding github.com/graph-gophers/graphql-go v0.0.0-20191115155744-f33e81362277
go: finding github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
go: finding github.com/naoina/go-stringutil v0.1.0
go: finding gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce
go: finding github.com/olekukonko/tablewriter v0.0.2-0.20190409134802-7e037d187b0c
go: finding golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd
go: finding github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf
go: finding github.com/deckarep/golang-set v0.0.0-20180603214616-504e848d77ea
go: finding github.com/go-stack/stack v1.8.0
go: finding github.com/Azure/azure-storage-blob-go v0.7.0
go: finding github.com/Azure/go-autorest/autorest/adal v0.8.0
go: finding github.com/edsrzf/mmap-go v0.0.0-20160512033002-935e0e8a636c
go: finding github.com/libp2p/go-libp2p-kbucket v0.4.7
go: finding gopkg.in/sourcemap.v1 v1.0.5
go: finding github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847
go: finding github.com/fatih/color v1.3.0
go: finding gotest.tools v2.2.0+incompatible
go: finding github.com/rs/xhandler v0.0.0-20160618193221-ed27b6fd6521
go: finding github.com/cpuguy83/go-md2man/v2 v2.0.0
go: finding github.com/influxdata/influxdb v1.2.3-0.20180221223340-01288bdb0883
go: finding github.com/VictoriaMetrics/fastcache v1.5.3
go: finding gopkg.in/urfave/cli.v1 v1.20.0
go: finding github.com/golang/protobuf v1.3.2-0.20190517061210-b285ee9cfc6c
go: finding github.com/rs/cors v0.0.0-20160617231935-a62a804a8a00
go: finding github.com/huin/goupnp v0.0.0-20161224104101-679507af18f3
go: finding github.com/libp2p/go-libp2p v0.12.0
go: finding gopkg.in/yaml.v2 v2.2.8
go: finding github.com/pborman/uuid v0.0.0-20170112150404-1b00554d8222
go: finding github.com/fsnotify/fsnotify v1.4.9
go: finding github.com/google/uuid v1.1.2
go: error loading module requirements
make: *** [Makefile:24: release] Error 1

`

how do I fix?

thank you

RPC error with Metamask version 10.13.0

Hi Jieyi!

I've been doing some testing for some new features, and noticed an error when testing some previously working code:

MetaMask - RPC Error: [ethjs-query] while formatting outputs from RPC 
'{"value":{"code":-32603,"data":{"code":-32000,"message":"theta RPC returns an error: -32000: rlp: expected input list for types.EthTransaction"}}}'

This error occurs on every contract call, and seems to also occur when simply transferring TFUEL via Metamask.

I tested this on other sites as well, such as OpenTheta, and it seems like the error is occurring everywhere, which means this is something to do with Metamask or the RPC.

Looking at the Metamask update history, they've just updated their wallet 6 days ago to version 10.13.0, which I suspect is the cause of the error.

I rolled back to version 10.11.3 and it all seems to work fine now. Strange thing is, before I pushed the updates (frontend, not contract level) to the mainnet, everything worked fine on the testnet. Perhaps you guys already fixed it? I'll do some further testing to try to figure out what is going on. Any thoughts on what could be going wrong?

Revert reason: 'encoding/hex: invalid byte: U+007B '{''.

I'm trying to deploy my contract on the Testnet but I am getting this error, any idea why?

Transaction 0x8a6d97950.... has failed with status: 0x0. Gas used: 10000000. Revert reason: 'encoding/hex: invalid byte: U+007B '{''.

panic: mismatching message name: got trezor.ThetaGetAddress, want trezor.testGetAddress

this is issue is coming when are trying private net with custom name and trying to run eth rpc services, we have checked in our code custom name is added all over places but still the same error kindly guide us on this please

oroutine 1 [running]:
google.golang.org/protobuf/internal/impl.legacyLoadMessageDesc({0xfc92e0?, 0xd8a4a0}, {0xde0d3c, 0x16})
/home/ubuntu/go/pkg/mod/google.golang.org/[email protected]/internal/impl/legacy_message.go:136 +0x479
google.golang.org/protobuf/internal/impl.legacyLoadMessageInfo({0xfc92e0?, 0xd8a4a0}, {0xde0d3c, 0x16})
/home/ubuntu/go/pkg/mod/google.golang.org/[email protected]/internal/impl/legacy_message.go:48 +0x90
google.golang.org/protobuf/internal/impl.Export.LegacyMessageTypeOf({}, {0xfc1ea8?, 0x0}, {0xde0d3c, 0x16})
/home/ubuntu/go/pkg/mod/google.golang.org/[email protected]/internal/impl/legacy_export.go:33 +0x9d
github.com/golang/protobuf/proto.RegisterType({0xfc1ea8?, 0x0}, {0xde0d3c, 0x16})
/home/ubuntu/go/pkg/mod/github.com/golang/[email protected]/proto/registry.go:186 +0x36
github.com/testtoken/test/wallet/coldwallet/keystore/trezor.init.0()
/home/ubuntu/go/bin/test-blockchain/testtoken/test/wallet/coldwallet/keystore/trezor/messages.pb.go:4387 +0x299

502 Bad Gateway on testnet RPC adaptor

Hello! Just wanted to let you know that I've been getting a 502 Bad Gateway error when calling eth_getLogs over a 1000 block range, on the testnet RPC adaptor (https://eth-rpc-api-testnet.thetatoken.org/rpc).

Oct 20 17:28:34.547 DEBG Requesting logs for blocks [12831437, 12832436], contract 0x0500846477052021d20fc89e0c7c345b7e9ef32b, 6 events, sgd: 1, subgraph_id: QmY1KyakhQgRJCqNtoAc7YPSt69eoPY1ifhSUmzyCLWrGa, component: BlockStream
Oct 20 17:29:04.687 DEBG Trying again after eth_getLogs RPC call failed (attempt #1) with result Err(Transport("Unexpected response status code: 502 Bad Gateway")), sgd: 1, subgraph_id: QmY1KyakhQgRJCqNtoAc7YPSt69eoPY1ifhSUmzyCLWrGa, component: BlockStream

This is on my Graph node indexer that is trying to sync the logs from blocks into my GraphQL database. This worked perfectly fine previously, so I'm wondering what is causing the error here. Querying over blocks with a very small range (30-50 blocks) returns fine, but takes a really long time (14+ seconds). However, not being able to query logs with a range of at most 2000 blocks breaks the graph node indexer, because it tries to query 1, 10, 100, 1000 then 2000 blocks at once when rebuilding the index.

Any ideas? Thank you!

eth_call for non-latest block returns wrong info

The eth_call rpc call has a parameter (the "default block parameter", which is supposed to apply to eth_call, and four other functions, as detailed at https://eth.wiki/json-rpc/API) to specify for which block the data should be supplied, but the data returned is always for the latest block, unlike other chains' EVMs. For some number of recent blocks, the eth_getBalance function works properly when specifying the block number.

Having this function supported is needed to properly synchronize the state as of a specific recent point in time.

why is the websocket server not starting?

hi everyone,

my config.yaml file is here:

theta: rpcEndpoint: "http://127.0.0.1:16888/rpc" rpc: enabled: true httpAddress: "0.0.0.0" httpPort: 18888 wsAddress: "0.0.0.0" wsPort: 18889 timeoutSecs: 600 maxConnections: 2048 log: levels: "*:debug"

and the logs here:

`
INFO[0000] Using keyDirPath: /.theta-eth-rpc-adaptor/keys
INFO[0000] opening test wallet 0xFCA1D42cA7CBCaACBf81C2F2dBD37eDeF9f56099
INFO[0000] opening test wallet 0xba09F065bc9d14aD640326D10B0Af5a2FFa3aA69
INFO[0001] opening test wallet 0xDfEaA98eE9C07434952232B31ed2BEB3a35E2ABB
INFO[0002] opening test wallet 0xc9b2bD5A755158A95Ab9f630a566238222246aDC
INFO[0003] opening test wallet 0xA483FB8bA7c0Ff07213C5E838Bb25ce1BE72FFb3
INFO[0004] opening test wallet 0x340E66E965B16992BA1717cc23972DcFb186dB21
INFO[0005] opening test wallet 0x6BCa9501E9291262cf6DC2Ddc048Ed0F70E2360B
INFO[0006] opening test wallet 0x4C5a14f58F15bc050bB8D7E83bfD7cfAFADd9C07
INFO[0007] opening test wallet 0x2287a648124E89895AD037a67c79063E155555Ac
INFO[0007] opening test wallet 0x6eB7F32E4f04aCaA483757cb83f9a99a897d5a6d
Using config file: ../eth-rpc-adaptor/config.yaml
INFO[0008] Started RPC server at: 0.0.0.0:18888 prefix=rpc

`

http server is started but web socket is not... why? my theta node is running on 16888..

how do I fix this issue?

thank you

new blockheader subscriber over websocket

hi everyone,

Is there any way I can listen to the last block header or block number over websocket? I couldn't find anything in your supported methods?

I tried this:

{"id": 1, "method": "eth_subscribe", "params": ["newHeads", {}]}

but I got this error:

{"jsonrpc":"2.0","id":1,"error":{"code":-32601,"message":"no "newHeads" subscription in eth namespace"}}

what should I do?

thank you

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.