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

fix: ETH RPC API: ETH Call should use the parent state root of the subsequent tipset #11905

Merged
merged 7 commits into from
Jun 11, 2024

Conversation

aarshkshah1992
Copy link
Contributor

Related Issues

Closes #11205

Proposed Changes

ETH Call should use the parent state root of the subsequent tipset. This can be obtained from the TipsetState on the Statemanager

Additional Info

Checklist

Before you mark the PR ready for review, please make sure that:

  • Commits have a clear commit message.
  • PR title is in the form of of <PR type>: <area>: <change being made>
    • example: fix: mempool: Introduce a cache for valid signatures
    • PR type: fix, feat, build, chore, ci, docs, perf, refactor, revert, style, test
    • area, e.g. api, chain, state, market, mempool, multisig, networking, paych, proving, sealing, wallet, deps
  • If the PR affects users (e.g., new feature, bug fix, system requirements change), update the CHANGELOG.md and add details to the UNRELEASED section.
  • New features have usage guidelines and / or documentation updates in
  • Tests exist for new functionality or change in behavior
  • CI is green

@jennijuju
Copy link
Member

@aarshkshah1992 - can you please assign a reviewer?

@Stebalien
Copy link
Member

Well, this is bringing back past nightmares with respect to #10216.

@aarshkshah1992
Copy link
Contributor Author

@Stebalien Are you saying that this wont work ?

chain/stmgr/call.go Outdated Show resolved Hide resolved
node/impl/full/eth.go Outdated Show resolved Hide resolved
@aarshkshah1992
Copy link
Contributor Author

Hey @raulk

This PR needs a review from someone who understands the ETH RPC stack really well. But @Stebalien is fully focused on F3 currently. Would you or Mikers or Fridrick be able to help review this by any chance ?

@aarshkshah1992
Copy link
Contributor Author

@rvagg Have addressed both your review comments. Please can you take one final look at the PR ?

node/impl/full/eth.go Outdated Show resolved Hide resolved
@momack2
Copy link
Contributor

momack2 commented May 30, 2024

@rvagg @aarshkshah1992 can we get a status update here? What's needed to get this fully reviewed?

node/impl/full/eth.go Outdated Show resolved Hide resolved
node/impl/full/eth.go Outdated Show resolved Hide resolved
@rvagg
Copy link
Member

rvagg commented May 31, 2024

@momack2 just waiting on expert eyes to review so the blind don't lead the blind down a dodgy alleyway

Copy link

github-actions bot commented May 31, 2024

All checks have completed

❌ Failed Test / Test (itest-gateway) (pull_request)
❌ Failed Test / Test (itest-path_type_filters) (pull_request)

@aarshkshah1992
Copy link
Contributor Author

@raulk I agree. We have removed the looping so if the user specifies a tipset that can cause an expensive fork, we just error out the request(should be few of those as Rodd mentions).

@aarshkshah1992
Copy link
Contributor Author

@momack2 We were waiting on a review from someone who understands the ETH<>Filecoin stack well. Now that Raul has reviewed it, we can land this. Have addressed the latest round of review. Will merge on a green tick.

Copy link
Member

@rvagg rvagg left a comment

Choose a reason for hiding this comment

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

I wouldn't mind hearing @raulk's response to the fact that we error on a migration epoch if he has time to chime in. But, it's also something that can be easily changed at a future date if we hear objections after this lands.
It might be good to bring up in a sync meeting actually, just that specific point.
Otherwise this lgtm.

@aarshkshah1992
Copy link
Contributor Author

Will address @raulk 's response in a future PR when he takes a look at this as we're not changing any pre-existing behaviour here wrt handling migration epochs.

@aarshkshah1992 aarshkshah1992 enabled auto-merge (squash) June 1, 2024 21:11
raulk
raulk previously requested changes Jun 4, 2024
node/impl/full/eth.go Show resolved Hide resolved
@rvagg
Copy link
Member

rvagg commented Jun 5, 2024

@raulk:

  • But this is the wrong way to go about it. Events should always be served from the event index, and the event index should track its own data availability and reject queries for epochs it has no data for.
  • In fact, at IPC we've had two or three episodes of event data inconsistency from Lotus, and I suspect it has to do with Lotus happily returning empty answers for epoch ranges it has not indexed (instead of erroring with "epochs not indexed").

Some relevant issues that you might want to weigh in on because there's known problems all over this that are difficult to prioritise addressing without hearing feedback from users. If these are problems for you, you should let us know and they can be bumped up in priority:

And there's more in the list, if you want to have a look at the things we're currently aware of: https://github.com/filecoin-project/lotus/issues?q=is%3Aopen+is%3Aissue+label%3Aarea%2Fevents

@aarshkshah1992
Copy link
Contributor Author

@raulk Can we go ahead and merge this one given that we're now co-ordinating on a separate workstream for events ?

@raulk
Copy link
Member

raulk commented Jun 6, 2024

@aarshkshah1992 I am good with merging this as-is and addressing the remaining design issues next, as long as someone focuses on them straight after. We amassed good momentum in discussions, we've all "paged back into" the subject, and it would be a net loss of collective productivity if we merge this PR and mentally move on.

@raulk raulk dismissed their stale review June 6, 2024 10:00

See conversation.

@aarshkshah1992 aarshkshah1992 merged commit 4828757 into master Jun 11, 2024
92 of 94 checks passed
@aarshkshah1992 aarshkshah1992 deleted the fix/eth-call branch June 11, 2024 15:07
@aarshkshah1992
Copy link
Contributor Author

aarshkshah1992 commented Jun 11, 2024

@raulk Vulcanise is also running into some of the rough edges related to the events. So we are starting the work with fixing one of the issues they're running into i.e. async indexing of events leading to races where client discovers a block but does not get any events for them because they're yet to be indexed.

However, please note that we don't have dedicated epic to fix all of the issues you and @rvagg have enlisted above. If doing all of those is important, would be great to do a prioritsation epic for this workstream with @jennijuju and @rvagg.

@snissn
Copy link
Contributor

snissn commented Jun 12, 2024

@aarshkshah1992 this PR sped the eth_call RPC call up considerably!

Before:

ab -p postdata.json -T application/json -c 10 -n 1000 http://127.0.0.1:1234/rpc/v1
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>
                                                                                 
Benchmarking 127.0.0.1 (be patient)                                                        

Server Software:        
Server Hostname:        127.0.0.1
Server Port:            1234

Document Path:          /rpc/v1
Document Length:        103 bytes

Concurrency Level:      10
Time taken for tests:   127.168 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      221000 bytes
Total body sent:        394000
HTML transferred:       103000 bytes
Requests per second:    7.86 [#/sec] (mean)
Time per request:       1271.684 [ms] (mean)
Time per request:       127.168 [ms] (mean, across all concurrent requests)
Transfer rate:          1.70 [Kbytes/sec] received
                        3.03 kb/s sent
                        4.72 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:   302 1264 589.7   1112    3408
Waiting:      302 1264 589.7   1112    3408
Total:        302 1264 589.8   1112    3408

Percentage of the requests served within a certain time (ms)
  50%   1112
  66%   1415
  75%   1647
  80%   1785
  90%   2143
  95%   2402
  98%   2741
  99%   2865
 100%   3408 (longest request)

after:

$ ab -p postdata.json -T application/json -c 10 -n 1000 http://127.0.0.1:1234/rpc/v1
This is ApacheBench, Version 2.3 <$Revision: 1879490 $>

Server Software:        
Server Hostname:        127.0.0.1
Server Port:            1234

Document Path:          /rpc/v1
Document Length:        103 bytes

Concurrency Level:      10
Time taken for tests:   1.524 seconds
Complete requests:      1000
Failed requests:        0
Total transferred:      221000 bytes
Total body sent:        394000
HTML transferred:       103000 bytes
Requests per second:    656.21 [#/sec] (mean)
Time per request:       15.239 [ms] (mean)
Time per request:       1.524 [ms] (mean, across all concurrent requests)
Transfer rate:          141.62 [Kbytes/sec] received
                        252.49 kb/s sent
                        394.11 kb/s total

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.0      0       0
Processing:     4   15  23.0      8     221
Waiting:        4   15  22.9      8     219
Total:          4   15  23.0      8     221

Percentage of the requests served within a certain time (ms)
  50%      8
  66%     10
  75%     13
  80%     16
  90%     29
  95%     49
  98%     81
  99%    131
 100%    221 (longest request)         

ribasushi pushed a commit to ribasushi/ci-abusing-lotus-fork that referenced this pull request Jun 15, 2024
…bsequent tipset (filecoin-project#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>
ribasushi pushed a commit to ribasushi/ci-abusing-lotus-fork that referenced this pull request Jun 15, 2024
…bsequent tipset (filecoin-project#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>
rjan90 pushed a commit that referenced this pull request Jun 17, 2024
…bsequent tipset (#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>
@rjan90 rjan90 mentioned this pull request Jun 17, 2024
7 tasks
jennijuju pushed a commit that referenced this pull request Jun 19, 2024
* fix: ci: do not use deprecated --debug goreleaser flag (#12086)

* chore: deals: remove forgotten graphsync references (#12084)

* chore: types: remove more items forgotten after markets (#12095)

* chore: cleanup: remove more items forgotten after markets

* .gz somehow reappeared after #11625

* fix: ETH RPC API: ETH Call should use the parent state root of the subsequent tipset (#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>

* Update changelog to RC2

Update changelog to RC2

* Make gen / make docsgen-cli

Make gen / make docsgen-cli

* chore: api: the Net API/CLI now remains only on daemon

The only part of this repository that does lp2p is now lotus-daemon

Remove the CommonNet type, used exclusively bu the CLI stack

Adjust the rest of struct-memebership to match what went where

End result best seen in diff of `documentation/en/api-v0-methods-miner.md`

* Update changelog

Update changelog

* fix: events: sqlite db improvements (#12090)

* fix: events: sqlite db improvements

* fix unclosed multi-row query
* tune options to limit wal growth

Ref: #12089

* fix: events: use correct context for CollectEvents transaction

* fix: events: close prepared read statement

* fix: events: close initial query; handle lint failures

* Update CHANGELOG.md

---------

Co-authored-by: Piotr Galar <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
jennijuju added a commit that referenced this pull request Jun 25, 2024
* release: v1.26.3 (#11908) (#11915)

* deps: update dependencies to address migration memory bloat

to address memory concerns during a heavy migration

Ref: filecoin-project/go-state-types#260
Ref: whyrusleeping/cbor-gen#96
Ref: filecoin-project/go-amt-ipld#90

* release: prep v1.26.3 patch

Prep v1.26.3 patch release:
- Update changelog, version and make gen + make docsgen-cli

* deps: update cbor-gen to tagged version

deps: update cbor-gen to tagged version

* deps: update go-state-types to tagged version

deps: update go-state-types to tagged version v0.13.2

* chore: deps: update go-state-types to v0.13.3

Fixes a panic when we have fewer than 1k proposals.

---------

Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>

* build: release: v1.27.0-rc1 (#11947)

* chore: Set version as v1.27.0-rc1

Set version as v1.27.0-rc1, run make gen & make docsgen-cli

* Update changelog

Update changelog

* Update changelog

Update changelog based on feedback

* Bump pubsub-dep

Bump pubsub-dep

* Prep v1.27.0-rc2

Prep v1.27.0-rc2

* Typo fixes, and more changelog updates

Typo fixes, and more changelog updates

* chore: remove unmaintained bootstrappers (#11983)

* chore: remove unmaintained bootstrappers

chore: remove unmaintained bootstrappers

* Update mainnet.pi fixing typoed domain

fixing typo for 1475.io 'bootstarp' -> 'bootstrap'

* Update mainnet.pi

apparently the actual hostname is typoed. so bootstarp it is.

---------

Co-authored-by: smagdali <[email protected]>

* chore: update go-data-transfer and go-graphsync

* add ETH addrs API to Gateway (#11979)

* fix: copy Flags field from SectorOnChainInfo

Fixes: #11962

* feat: libp2p: Lotus stream cleanup (#11993)

* set stream deadlines in Lotus

* reduce timeout

* whitelist bootstrappers

* fix tests

* Update changelog and version

Update changelog and version

* ci: deprecate circle ci in favour of github actions (#11786)

* Update changelog

Update changelog with the deprecate circle-ci

* chore: update drand (#12021)

* Update changelog / make docsgen

Update changelog / make docsgen

* chore: lint: update golangci lint config

* remove and replace some linters
* remove some exclusions
* make all exclusions more explicit matches

* chore: lint: fix lint errors with new linting config

Ref: #11967

* chore: lint: address feedback from reviews

* doc: eth: restore comment lost in linter cleanup

Ref: #11968

* chore: libp2p: update to v0.34.1 (#12027)

* update libp2p to v0.34.0

* fix libp2p err

* fix imports

* update go mod

* update go mod

* Update changelog

Update changelog

* go mod tidy

go mod tidy

* revert go version change (#12050)

* Update changelog

Update changelog

* chore: backport #12054 to release/v1.27.0 branch (#12056)

* chore: pin golanglint-ci to v1.58.2 (#12054)

Fixes: #12044

* Add backport to changelog

Add backport to changelog

---------

Co-authored-by: Rod Vagg <[email protected]>

* Bump version - make gen/make docsgen

Bump version - make gen/make docsgen

* Update changelog

Update changelog

* Bump NodeBuildVersion to v1.27.1-rc1

Bump NodeBuildVersion to v1.27.1-rc1

* Add Lotus-Miner / Curio related changes

Add Lotus-Miner / Curio related changes

* Update date and upgrade warnings

Update date and upgrade warnings

* fix: ci: do not use deprecated --debug goreleaser flag (#12086)

* chore: deals: remove forgotten graphsync references (#12084)

* chore: types: remove more items forgotten after markets (#12095)

* chore: cleanup: remove more items forgotten after markets

* .gz somehow reappeared after #11625

* fix: ETH RPC API: ETH Call should use the parent state root of the subsequent tipset (#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>

* Update changelog to RC2

Update changelog to RC2

* Make gen / make docsgen-cli

Make gen / make docsgen-cli

* chore: api: the Net API/CLI now remains only on daemon

The only part of this repository that does lp2p is now lotus-daemon

Remove the CommonNet type, used exclusively bu the CLI stack

Adjust the rest of struct-memebership to match what went where

End result best seen in diff of `documentation/en/api-v0-methods-miner.md`

* Update changelog

Update changelog

* fix: events: sqlite db improvements (#12090)

* fix: events: sqlite db improvements

* fix unclosed multi-row query
* tune options to limit wal growth

Ref: #12089

* fix: events: use correct context for CollectEvents transaction

* fix: events: close prepared read statement

* fix: events: close initial query; handle lint failures

* Update CHANGELOG.md

* build: release: v1.27.1-rc2 (#12101)

* fix: ci: do not use deprecated --debug goreleaser flag (#12086)

* chore: deals: remove forgotten graphsync references (#12084)

* chore: types: remove more items forgotten after markets (#12095)

* chore: cleanup: remove more items forgotten after markets

* .gz somehow reappeared after #11625

* fix: ETH RPC API: ETH Call should use the parent state root of the subsequent tipset (#11905)

* fix eth call

* tests

* changes as per review

* changes as per review

* Update node/impl/full/eth.go

Co-authored-by: Rod Vagg <[email protected]>

* fix as per review

---------

Co-authored-by: Rod Vagg <[email protected]>

* Update changelog to RC2

Update changelog to RC2

* Make gen / make docsgen-cli

Make gen / make docsgen-cli

* chore: api: the Net API/CLI now remains only on daemon

The only part of this repository that does lp2p is now lotus-daemon

Remove the CommonNet type, used exclusively bu the CLI stack

Adjust the rest of struct-memebership to match what went where

End result best seen in diff of `documentation/en/api-v0-methods-miner.md`

* Update changelog

Update changelog

* fix: events: sqlite db improvements (#12090)

* fix: events: sqlite db improvements

* fix unclosed multi-row query
* tune options to limit wal growth

Ref: #12089

* fix: events: use correct context for CollectEvents transaction

* fix: events: close prepared read statement

* fix: events: close initial query; handle lint failures

* Update CHANGELOG.md

---------

Co-authored-by: Piotr Galar <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>

* small fix in changelog

* fix: release: update goreleaser config file

Fixes: #12120

* fix go releaser and test with rc3

* Update CHANGELOG.md

* lotus v1.27.1 prep

* address review
- resolve one more conflicts
- revert 2 new line added

* doc: events: note events db migration impact

---------

Co-authored-by: Phi-rjan <[email protected]>
Co-authored-by: Rod Vagg <[email protected]>
Co-authored-by: Steven Allen <[email protected]>
Co-authored-by: smagdali <[email protected]>
Co-authored-by: Aarsh Shah <[email protected]>
Co-authored-by: Piotr Galar <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
Co-authored-by: Peter Rabbitson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

eth_call incorrectly reconciling deferred (Filecoin) and immediate (Ethereum) execution
7 participants