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

Change Planner to use optional gas prices field and error if unset #4554

Merged
merged 3 commits into from
Jun 4, 2024

Conversation

aubrika
Copy link
Contributor

@aubrika aubrika commented Jun 4, 2024

Closes #4555 and fixes fee inclusion in validator definition upload, validator vote casting, and tx sweep.

This also introduces some protection for future planner invocations. The Planner's gas_prices field has been changed to an Option type and if it's not set it will return an error during planning:

$ cargo run --bin pcli --release -- --home ~/.local/share/pcli-preview/ validator definition upload --file validator.toml
...
Error: planner instances must call set_gas_prices prior to planning
  • If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason:

    should be limited to addressing client-side failures on tx submission, so shouldn't change consensus on which

@aubrika aubrika requested a review from zbuc June 4, 2024 20:45
@conorsch
Copy link
Contributor

conorsch commented Jun 4, 2024

We discussed this in IBC sync, because getting this work resolved is relevant to near-term IBC work. Looks like as written, this PR will fix #4541, but not #4540, which is required for unblocking IBC.

@zbuc has volunteered to tackle implementing a deeper API change here, discussed in Discord, making GasPrices optional, to avoid the hard-to-hold planner interface problem that was encountered as part of the fee enabling (#4306), as seen in Galileo today penumbra-zone/galileo#98.

@conorsch
Copy link
Contributor

conorsch commented Jun 4, 2024

Refs #4555

@conorsch conorsch marked this pull request as draft June 4, 2024 20:54
@zbuc zbuc marked this pull request as ready for review June 4, 2024 21:35
@zbuc zbuc changed the title validator fees fix Change Planner to use optional gas prices field and error if unset Jun 4, 2024
@conorsch conorsch self-requested a review June 4, 2024 21:41
Copy link
Contributor

@conorsch conorsch left a comment

Choose a reason for hiding this comment

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

There are CI failures that appear to be related to an old base branch. This should be rebased (and preferably squashed) onto lastest main, in particular in order to include #4539, which will affect how the FeeTier usage is applied throughout the pcli cli opts.

crates/bin/pcli/src/command/validator.rs Outdated Show resolved Hide resolved
crates/bin/pcli/src/command/validator.rs Outdated Show resolved Hide resolved
&self.gas_prices,
&self
.gas_prices
.context("planner instances must call set_gas_prices prior to planning")?,
Copy link
Contributor

Choose a reason for hiding this comment

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

While I'm not a huge fan of forcing a separate call rather than doing it automatically, I love how descriptive this error message is!

Copy link
Member

Choose a reason for hiding this comment

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

We alternatively could just change the Planner constructor to require GasPrices or a ViewClient instance it can fetch them from

@conorsch
Copy link
Contributor

conorsch commented Jun 4, 2024

Thanks for fixing, testing against local devnet with fees....

@conorsch
Copy link
Contributor

conorsch commented Jun 4, 2024

Confirmed that validator definition uploads are working.

fails on main
❯ cargo run --release --bin pcli -- --home ~/.local/share/pcli-devnet validator  definition upload --file val.toml
    Finished release [optimized] target(s) in 0.28s
     Running `target/release/pcli --home /home/conor/.local/share/pcli-devnet validator definition upload --file val.toml`
Scanning blocks from last sync height 69111 to latest height 69111
[0s] ██████████████████████████████████████████████████       0/0       0/s ETA: 0s
building transaction [1 actions, 0 proofs]...
finished proving in 0.001 seconds [1 actions, 0 proofs, 491 bytes]
broadcasting transaction and awaiting confirmation...
Error: error broadcasting transaction

Caused by:
    status: Internal, message: "Error submitting transaction: code 1, log: failed to deliver transaction: check_stateful failed: fee must be greater
than or equal to the transaction base price (supplied: 0, base: 3)", details: [], metadata: MetadataMap { headers: {} }
passes on this branch
❯ cargo run --release --bin pcli -- --home ~/.local/share/pcli-devnet validator  definition upload --file ../penumbra/val.toml
   Compiling penumbra-dex v0.77.0 (/home/conor/src/penumbra2/crates/core/component/dex)
   Compiling penumbra-auction v0.77.0 (/home/conor/src/penumbra2/crates/core/component/auction)
   Compiling penumbra-compact-block v0.77.0 (/home/conor/src/penumbra2/crates/core/component/compact-block)
   Compiling penumbra-proof-setup v0.77.0 (/home/conor/src/penumbra2/crates/crypto/proof-setup)
   Compiling penumbra-transaction v0.77.0 (/home/conor/src/penumbra2/crates/core/transaction)
   Compiling penumbra-tendermint-proxy v0.77.0 (/home/conor/src/penumbra2/crates/util/tendermint-proxy)
   Compiling penumbra-custody v0.77.0 (/home/conor/src/penumbra2/crates/custody)
   Compiling penumbra-app v0.77.0 (/home/conor/src/penumbra2/crates/core/app)
   Compiling penumbra-view v0.77.0 (/home/conor/src/penumbra2/crates/view)
   Compiling penumbra-wallet v0.77.0 (/home/conor/src/penumbra2/crates/wallet)
   Compiling pcli v0.77.0 (/home/conor/src/penumbra2/crates/bin/pcli)
    Finished release [optimized] target(s) in 51.73s
     Running `target/release/pcli --home /home/conor/.local/share/pcli-devnet validator definition upload --file ../penumbra/val.toml`
Scanning blocks from last sync height 69124 to latest height 69124
[0s] ██████████████████████████████████████████████████       0/0       0/s ETA: 0s
building transaction [3 actions, 2 proofs]...
finished proving in 0.527 seconds [3 actions, 2 proofs, 2081 bytes]
broadcasting transaction and awaiting confirmation...
transaction broadcast successfully: 5d264f79d166bb8b90238b9be299465baaad6fd5c3a61575793ddff52a8ca80c
transaction confirmed and detected: 5d264f79d166bb8b90238b9be299465baaad6fd5c3a61575793ddff52a8ca80c @ height 69125
Uploaded validator definition

@conorsch
Copy link
Contributor

conorsch commented Jun 4, 2024

However, validator voting appears not to work still:

failing, as expected, on main
❯ cargo -q run --release --bin pcli -- --home /tmp/devnet-val0/ validator vote cast yes --on 4
Scanning blocks from last sync height 69206 to latest height 69206
[0s] ██████████████████████████████████████████████████       0/0       0/s ETA: 0s
building transaction [1 actions, 0 proofs]...
finished proving in 0.001 seconds [1 actions, 0 proofs, 306 bytes]
broadcasting transaction and awaiting confirmation...
Error: error broadcasting transaction

Caused by:
    status: Internal, message: "Error submitting transaction: code 1, log: failed to deliver transaction: check_stateful failed: fee must be greater
than or equal to the transaction base price (supplied: 0, base: 1)", details: [], metadata: MetadataMap { headers: {} }
failing, differently, on this branch
❯ cargo -q run --release --bin pcli -- --home /tmp/devnet-val0/ validator vote cast yes --on 4
Scanning blocks from last sync height 69209 to latest height 69209
[0s] ██████████████████████████████████████████████████       0/0       0/s ETA: 0s
Error: ran out of notes to spend while planning transaction, need 1 of asset passet1984fctenw8m2fpl8a9wzguzp7j34d7vravryuhft808nyt9fdggqxmanqm

Not sure how to debug that passet denom. This PR is clearly an improvement, it looks like #4540 is not yet fixed by it though.

@zbuc
Copy link
Member

zbuc commented Jun 4, 2024

@conorsch passet1984fctenw8m2fpl8a9wzguzp7j34d7vravryuhft808nyt9fdggqxmanqm is the penumbra asset id, do you have enough balance in the validator's wallet?

@conorsch
Copy link
Contributor

conorsch commented Jun 4, 2024

@zbuc Oy, that was it!

❯ cargo -q run --release --bin pcli -- --home /tmp/devnet-val0/ validator vote cast yes --on 5
Scanning blocks from last sync height 69376 to latest height 69376
[0s] ██████████████████████████████████████████████████       0/0       0/s ETA: 0s
building transaction [3 actions, 2 proofs]...
finished proving in 0.559 seconds [3 actions, 2 proofs, 1896 bytes]
broadcasting transaction and awaiting confirmation...
transaction broadcast successfully: fdd05eb8fbdd4be7ee8d70a8adbc82366242d9b98f79e6fc6118c070a7bfbbcf
transaction confirmed and detected: fdd05eb8fbdd4be7ee8d70a8adbc82366242d9b98f79e6fc6118c070a7bfbbcf @ height 69377
Cast validator vote

Thanks, all set!

@conorsch conorsch merged commit 77f3f22 into main Jun 4, 2024
13 checks passed
@conorsch conorsch deleted the validator-def-gas branch June 4, 2024 22:18
@conorsch
Copy link
Contributor

conorsch commented Jun 4, 2024

Drat, this doesn't apply cleanly to 0.77.x. Might have to pull in #4510 as well....

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.

Planner fixes for non-zero fees
5 participants