Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xeth, core, event/filter, rpc: new block and transaction filters #864

Merged
merged 5 commits into from
May 8, 2015

Conversation

obscuren
Copy link
Contributor

@obscuren obscuren commented May 6, 2015

No description provided.

@frozeman
Copy link
Contributor

frozeman commented May 7, 2015

eth_newBlockFilter works, but for eth_newPendingTransactionFilter seems not to be implemented

self.filterManager.UninstallFilter(id)
return true
}
func (self *XEth) NewTransactionFilter() int {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be NewPendingTransactionFilter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not the line you're looking for. But indeed, I implemented it as eth_newTransactionFilter. I'll change it to eth_newPendingTransactionFilter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried both. Are sure that its also exposed to the RPC?

@frozeman
Copy link
Contributor

frozeman commented May 7, 2015

I currently can't run the RPC test as the blocktest is not loading.

@obscuren
Copy link
Contributor Author

obscuren commented May 7, 2015

I think this is now properly implemented:

Create filter

curl --data '{"jsonrpc":"2.0","method":"eth_newPendingTransactionFilter","params":[],"id":1}' http://127.0.0.1:8545
{
    "id": 5,
    "jsonrpc": "2.0",
    "result": "0x0"
}

Send transaction

> eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: "10", gasPrice: "10"})
'0x3e477f3c0b66864a2d3775e8889f0f75a35dcb8f3d40c63a309a77375bccde56'

Get filter changes

curl --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0x0"],"id":5}' http://127.0.0.1:8545
{
    "id": 5,
    "jsonrpc": "2.0",
    "result": [
        "0x3e477f3c0b66864a2d3775e8889f0f75a35dcb8f3d40c63a309a77375bccde56"
    ]
}

Get the transactions (including the pending)

> eth.getTransaction("0x3e477f3c0b66864a2d3775e8889f0f75a35dcb8f3d40c63a309a77375bccde56")
{
  transactionIndex: 0,
  value: '10',
  input: '0x',
  nonce: 329,
  blockHash: '0x0000000000000000000000000000000000000000000000000000000000000000',
  from: '0x1da8b4c338fcf6d64e64383f5a8d4da86eea9a6d',
  to: '0x30867b568b4cf518d4c432e8b140e1010e9f021c',
  gas: 90000,
  gasPrice: '10',
  hash: '0x3e477f3c0b66864a2d3775e8889f0f75a35dcb8f3d40c63a309a77375bccde56',
  blockNumber: 0
}

@frozeman
Copy link
Contributor

frozeman commented May 8, 2015

will test in an h, thanks!!

@frozeman
Copy link
Contributor

frozeman commented May 8, 2015

All seems to work fine!

But i have two things:

  1. When i use eth_getTransactionByHash the console shows the following error I0508 09:42:10.729635 84136 xeth.go:257] EOF
  2. I would strongly advise that we return null for the blockNumber and blockHash in the pending transaction. We agreed to that when we been here all together and i think its very necessary to allow for reliable checks.
    if you get a transaction using web3.eth.getTransaction('0x1235...') its hard to tell if its pending or not. Except you compare the blockNumber === 0, which imho is kind of wrong, as block number 0 is the genisis block. (This means we would have to explain that in the docs, that 0 means pending, whereas null is self explanatory)

I would do the same with pending logs (which rely on #852 to be fixed).

@obscuren
Copy link
Contributor Author

obscuren commented May 8, 2015

No. null is not a valid hash neither a number.

null isn't right because it indicates a pointer type. The block number nor the hash is or should be a pointer (even if the internal type is). The right thing to do is to remove the field entirely (and therefor undefined)

@obscuren
Copy link
Contributor Author

obscuren commented May 8, 2015

This PR will be merged because the change has been addressed. We can open a new issue for any pending (other) issues.

obscuren added a commit that referenced this pull request May 8, 2015
xeth, core, event/filter, rpc: new block and transaction filters
@obscuren obscuren merged commit 637b241 into ethereum:develop May 8, 2015
@obscuren obscuren deleted the filter_changes branch May 8, 2015 09:56
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this pull request Jan 20, 2022
tony-ricciardi pushed a commit to tony-ricciardi/go-ethereum that referenced this pull request Jan 20, 2022
…#1263)

### Description

This changes the `light.serve` default back to zero so that serving light clients becomes opt-in rather than opt-out.  The reason is that there are many use-cases for running a node that don't involve light clients, and only one use-case that is about serving light clients, so it makes more sense to have it opt-in to avoid people running the light server without realizing it.

### Other changes

* Change `light.maxpeers` default value from 99 back to 100 (the change to 99 was to work around an issue that no longer exists, see below under "Related issues")
* Fix a bug in the logic for the `lightPeers` variable in `SetP2PConfig()` (it was not respecting the default value of LightPeers, leading to incorrect values in the `Maximum peer count` log line and to `MaxPeers` not being increased when it should have been.

### Tested

* Automated tests pass
* Without specifying any flags, LES is off, max peers is 175
* Specifying `--light.serve 100`, LES is on, total max peers is 275, max eth peers is 175, max light peers is 100
* Specifying `--light.serve 100 --light.maxpeers 200`, LES is on, total max peers is 375, max eth peers is 175, max light peers is 200
* Specifying `--light.serve 100 --maxpeers 150`, LES is on, total max peers is 250, max eth peers is 150, max light peers is 100
* Specifying `--light.serve 100 --light.maxpeers 1000 --maxpeers 100`, LES is on, total max peers is 1100, max eth peers is 100, max light peers is 1000 (these are the flag values recommended in the docs for serving light clients, and are based on the fact that if (and only if) you specify both `light.maxpeers` and `maxpeers` then `maxpeers` is assumed to include `light.maxpeers`)

### Related issues

- Closes ethereum#1262
- Additional context: ethereum#395, ethereum#416, ethereum#864 

### Backwards compatibility

Breaking change to the defaults, most notably `--light.serve`, but with limited impact, because in the docs for running a full node we specify `--light.serve`, `--light.maxpeers` and `--maxpeers`, so it's not relying on the defaults anyway.  And for users who are not intending to serve light clients, the new defaults make more sense.
maoueh pushed a commit to streamingfast/go-ethereum that referenced this pull request Jun 9, 2023
)

* updated Indore HF related changes by adding stateSyncConfirmationDelay

* converted StateSyncConfirmationDelay to map[string]uint64 and cleanup

* calculate last state ID from incoming state object with eth call (ethereum#883)

* removed IndoreBlock from configs

* fix

* remove code duplication and refactor

---------

Co-authored-by: Manav Darji <manavdarji.india@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants