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

feat(blob): improve gas estimation and track min gas price #2511

Merged
merged 19 commits into from
Aug 22, 2023

Conversation

cmwaters
Copy link
Contributor

@cmwaters cmwaters commented Jul 24, 2023

Overview

This PR incorporates the more recent gas estimation method in celestia-app. It also makes use of a new gRPC endpoint for consensus nodes that reveals the nodes min gas price. This enables the blob module to submit transactions with the correct gas price. If the node changes that price, the blob module is able to parse the error and retry using the new gas price.

Additionally, a stubbed CoreAccessor was introduced for when a core endpoint is not provided in order to return a better/more readable error, whereas previously, the CoreAccessor depended on the grpc dial to silently fail during start and any call to the state module would return a "cannot dial address" error.

It now looks like this:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 1,
    "message": "node is running without state access"
  }
}

Checklist

  • New and updated code has appropriate documentation
  • New and updated code has new and/or updated testing
  • Required CI checks are passing
  • Visual proof for any user facing features like CLI or documentation updates
  • Linked issues closed with keywords

@github-actions github-actions bot added the external Issues created by non node team members label Jul 24, 2023
@vgonkivs vgonkivs added kind:feat Attached to feature PRs area:blob and removed external Issues created by non node team members labels Jul 24, 2023
blob/service.go Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jul 25, 2023

Codecov Report

Merging #2511 (b5cb4d5) into main (13e9b1f) will increase coverage by 0.17%.
The diff coverage is 39.32%.

@@            Coverage Diff             @@
##             main    #2511      +/-   ##
==========================================
+ Coverage   51.15%   51.32%   +0.17%     
==========================================
  Files         157      157              
  Lines       10433    10489      +56     
==========================================
+ Hits         5337     5384      +47     
- Misses       4628     4634       +6     
- Partials      468      471       +3     
Files Changed Coverage Δ
blob/helper.go 53.96% <ø> (+6.08%) ⬆️
blob/service.go 72.83% <0.00%> (+3.37%) ⬆️
state/metrics.go 0.00% <0.00%> (ø)
state/core_access.go 35.14% <43.20%> (+7.17%) ⬆️

... and 4 files with indirect coverage changes

@cmwaters
Copy link
Contributor Author

Writing tests...

@cmwaters cmwaters marked this pull request as ready for review July 25, 2023 13:17
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

How complicated it is to do gas estimations and retries for all transactions and not just for SubmitPFB?

state/core_access_test.go Outdated Show resolved Hide resolved
state/core_access.go Outdated Show resolved Hide resolved
state/core_access.go Outdated Show resolved Hide resolved
state/core_access.go Show resolved Hide resolved
state/core_access.go Show resolved Hide resolved
@cmwaters
Copy link
Contributor Author

How complicated it is to do gas estimations and retries for all transactions and not just for SubmitPFB?

There's currently no one solution for all gas estimation. The best thing I can think of is hitting the /simulate endpoint but that becomes cumbersome if you need an extra round trip for every transaction. Getting the min gas price is easier to handle for all txs

@cmwaters
Copy link
Contributor Author

I am not able to write all the tests I would like because of the functionality that celestia-app needs to provide in their test infra. I'm going to work on this (on celestia-app side). We can still merge this if we think logically it makes sense and I can make an issue and follow up on the missing tests in a different PR

@cmwaters cmwaters requested a review from Wondertan August 2, 2023 13:57
state/core_access.go Outdated Show resolved Hide resolved
state/core_access.go Outdated Show resolved Hide resolved
@cmwaters cmwaters requested a review from Wondertan August 2, 2023 14:01
@cmwaters cmwaters requested a review from Wondertan August 7, 2023 13:17
state/core_access.go Outdated Show resolved Hide resolved
state/core_access.go Outdated Show resolved Hide resolved
@renaynay
Copy link
Member

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 1,
    "message": "node is running without state access"
  }
}

nodebuilder/node_test.go Outdated Show resolved Hide resolved
state/core_access.go Outdated Show resolved Hide resolved
nodebuilder/state/core.go Outdated Show resolved Hide resolved
nodebuilder/state/module.go Outdated Show resolved Hide resolved
nodebuilder/state/core_accessor_stub.go Outdated Show resolved Hide resolved
nodebuilder/state/core_accessor_stub.go Outdated Show resolved Hide resolved
state/metrics.go Outdated Show resolved Hide resolved
Copy link
Member

@Wondertan Wondertan left a comment

Choose a reason for hiding this comment

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

Requesting extraction of stub in a separate PR

@renaynay renaynay enabled auto-merge (squash) August 22, 2023 15:34
@renaynay renaynay disabled auto-merge August 22, 2023 15:34
@renaynay renaynay enabled auto-merge (squash) August 22, 2023 15:37
@renaynay renaynay merged commit bb9b4d4 into celestiaorg:main Aug 22, 2023
12 of 14 checks passed
renaynay added a commit to renaynay/celestia-node that referenced this pull request Aug 23, 2023
…int not provided (celestiaorg#2577)

This is a pre-requisite for celestiaorg#2511 

It makes a check in CoreAccessor constructor to see if a core endpoint
was provided, and returns nil CoreAccessor if not. A stubbed state
module will then be provided if no core endpoint was provided so that
errors are more readable.

Previously, node start logic relied on the fact that the grpc Dial
inside CoreAccessor.Start was non-blocking so it could silently fail
under the hood and any calls made on state Module would return errors
from the inability to reach the address that is the default for the core
config (which was confusing).
renaynay added a commit to renaynay/celestia-node that referenced this pull request Aug 23, 2023
…rg#2511)

## Overview

This PR incorporates the more recent gas estimation method in
celestia-app. It also makes use of a new gRPC endpoint for consensus
nodes that reveals the nodes min gas price. This enables the blob module
to submit transactions with the correct gas price. If the node changes
that price, the blob module is able to parse the error and retry using
the new gas price.

Additionally, a stubbed CoreAccessor was introduced for when a core
endpoint is not provided in order to return a better/more readable
error, whereas previously, the CoreAccessor depended on the grpc dial to
silently fail during start and any call to the state module would return
a "cannot dial address" error.

It now looks like this: 

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 1,
    "message": "node is running without state access"
  }
}
```

## Checklist

<!-- 
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [ ] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [ ] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords

---------

Co-authored-by: rene <[email protected]>
walldiss pushed a commit to walldiss/celestia-node that referenced this pull request Sep 22, 2023
…int not provided (celestiaorg#2577)

This is a pre-requisite for celestiaorg#2511

It makes a check in CoreAccessor constructor to see if a core endpoint
was provided, and returns nil CoreAccessor if not. A stubbed state
module will then be provided if no core endpoint was provided so that
errors are more readable.

Previously, node start logic relied on the fact that the grpc Dial
inside CoreAccessor.Start was non-blocking so it could silently fail
under the hood and any calls made on state Module would return errors
from the inability to reach the address that is the default for the core
config (which was confusing).

(cherry picked from commit 13e9b1f)
walldiss pushed a commit to walldiss/celestia-node that referenced this pull request Sep 22, 2023
…rg#2511)

## Overview

This PR incorporates the more recent gas estimation method in
celestia-app. It also makes use of a new gRPC endpoint for consensus
nodes that reveals the nodes min gas price. This enables the blob module
to submit transactions with the correct gas price. If the node changes
that price, the blob module is able to parse the error and retry using
the new gas price.

Additionally, a stubbed CoreAccessor was introduced for when a core
endpoint is not provided in order to return a better/more readable
error, whereas previously, the CoreAccessor depended on the grpc dial to
silently fail during start and any call to the state module would return
a "cannot dial address" error.

It now looks like this:

```
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": 1,
    "message": "node is running without state access"
  }
}
```

## Checklist

<!--
Please complete the checklist to ensure that the PR is ready to be
reviewed.

IMPORTANT:
PRs should be left in Draft until the below checklist is completed.
-->

- [ ] New and updated code has appropriate documentation
- [ ] New and updated code has new and/or updated testing
- [ ] Required CI checks are passing
- [ ] Visual proof for any user facing features like CLI or
documentation updates
- [ ] Linked issues closed with keywords

---------

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

(cherry picked from commit bb9b4d4)
walldiss pushed a commit that referenced this pull request Sep 22, 2023
…int not provided (#2577)

This is a pre-requisite for #2511

It makes a check in CoreAccessor constructor to see if a core endpoint
was provided, and returns nil CoreAccessor if not. A stubbed state
module will then be provided if no core endpoint was provided so that
errors are more readable.

Previously, node start logic relied on the fact that the grpc Dial
inside CoreAccessor.Start was non-blocking so it could silently fail
under the hood and any calls made on state Module would return errors
from the inability to reach the address that is the default for the core
config (which was confusing).

(cherry picked from commit 13e9b1f)
walldiss pushed a commit to walldiss/celestia-node that referenced this pull request Sep 22, 2023
…int not provided (celestiaorg#2577)

This is a pre-requisite for celestiaorg#2511

It makes a check in CoreAccessor constructor to see if a core endpoint
was provided, and returns nil CoreAccessor if not. A stubbed state
module will then be provided if no core endpoint was provided so that
errors are more readable.

Previously, node start logic relied on the fact that the grpc Dial
inside CoreAccessor.Start was non-blocking so it could silently fail
under the hood and any calls made on state Module would return errors
from the inability to reach the address that is the default for the core
config (which was confusing).

(cherry picked from commit 13e9b1f)
walldiss pushed a commit to walldiss/celestia-node that referenced this pull request Sep 25, 2023
…int not provided (celestiaorg#2577)

This is a pre-requisite for celestiaorg#2511

It makes a check in CoreAccessor constructor to see if a core endpoint
was provided, and returns nil CoreAccessor if not. A stubbed state
module will then be provided if no core endpoint was provided so that
errors are more readable.

Previously, node start logic relied on the fact that the grpc Dial
inside CoreAccessor.Start was non-blocking so it could silently fail
under the hood and any calls made on state Module would return errors
from the inability to reach the address that is the default for the core
config (which was confusing).

(cherry picked from commit 13e9b1f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:blob kind:feat Attached to feature PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants