Skip to content

Commit

Permalink
Merge branch 'grarco/variable-fees' (#1327)
Browse files Browse the repository at this point in the history
* origin/grarco/variable-fees:
  changelog: #1327
  [ci] wasm checksums update
  Keep write log changes before fee unshield failure in `charge_fee`
  Changes `dev` feature to `testing`
  Adds check on masp gas payer
  Fixes broken fee optimization logic in cli. Fixes fee unshielding logic in ledger
  Saves optional disposable keypair to wallet
  Moves disposable signing key generation to wallet module
  Improves fee-related logs in the client
  Renames fees cli arguments
  Fixes gas in tests
  Renames fee payers cli arguments
  Refactors `get_tx_fee` to avoid using `Uint`
  Fixes `fee_amount` parsing
  Reduces the scale of the gas sub-units
  Adds gas and fees protocol parameters to query response
  Updates visibility of functions
  Adds fee unshielding integration test. Updates other tests
  Adds disposable signer e2e test. Updates other tests
  Updates gas meters in tests
  Updates e2e tests
  Misc adjustments for testing
  Adds disposable wrapper signer. Adjusts tx construction for fees
  Sdk functions to return the optional `Epoch` for fee unshielding
  Handles wrapper's signer separately
  Renames `gas_payer` to `fee_payer`
  Reworks wasm compilation step. Accepts `floats` wasm feature
  Dry-run wrapper tx
  Updates gas meter objects initializations
  Helper storage functions to construct fee unshielding tx in protocol
  `ShellParams` carries a generic wl_storage. Reworks `dispatch_tx` to charge fees and adds related functions
  Adds spare gas for each tx in the storage queue
  Updates gas computation with multipliers
  Removes masp fees + gas for the vp
  Fixes `clean-wasm` step of wasm Makefile
  Updates wasm vps with gas and host sig verification
  Gas metering for sig verification
  Renames gas function and adds exposed function for signatures' verification
  Exposes wasm functions for consuming gas
  Whitelisted gas in wasm
  Adds benchmarks crate for gas
  `process_proposal` validates gas & fees
  `prepare_proposal` validates gas & fee. Extracts validation to a separate method
  Renames `BlockAllocator` and makes it track gas too
  Updates unit tests for mandatory block proposer
  Reviews `ErrorCodes`. Adds fee validation function
  Always expects a block proposer. Moves `WrapperTx` handling inside `dispatch_tx`
  Adds new CLI arguments for gas & fee
  Adds core methods for fee unshielding. Brings back `GasLimit` to `u64`
  Adds a precommit write log to `WriteLog`. Adjusts gas accounting with multipliers
  Adds `split_borrow` method to `WriteLogAndStorage` trait
  Adds gas and fee protocol parameters
  Reworks `gas` module. Introduces `GasMetering` trait and gas sub-units
  • Loading branch information
Fraccaman committed Aug 25, 2023
2 parents 1612bf1 + af95690 commit dea97b2
Show file tree
Hide file tree
Showing 115 changed files with 9,793 additions and 2,148 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/1327-variable-fees.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Implemented the runtime gas and fee system.
([\#1327](https://github.com/anoma/namada/pull/1327))
1 change: 1 addition & 0 deletions .github/workflows/scripts/e2e.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"e2e::ledger_tests::test_genesis_validators": 14,
"e2e::ledger_tests::test_node_connectivity_and_consensus": 28,
"e2e::ledger_tests::test_epoch_sleep": 12,
"e2e::ledger_tests::wrapper_disposable_signer": 28,
"e2e::wallet_tests::wallet_address_cmds": 1,
"e2e::wallet_tests::wallet_encrypted_key_cmds": 1,
"e2e::wallet_tests::wallet_encrypted_key_cmds_env_var": 1,
Expand Down
199 changes: 196 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ resolver = "2"

members = [
"apps",
"benches",
"core",
"ethereum_bridge",
"proof_of_stake",
Expand Down
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ crates += namada_vm_env
crates += namada_vp_prelude

build:
$(cargo) build $(jobs)
$(cargo) build $(jobs) --workspace --exclude namada_benchmarks

build-test:
$(cargo) +$(nightly) build --tests $(jobs)
Expand All @@ -64,7 +64,8 @@ package: build-release

check-wasm = $(cargo) check --target wasm32-unknown-unknown --manifest-path $(wasm)/Cargo.toml
check:
$(cargo) check && \
$(cargo) check --workspace --exclude namada_benchmarks && \
$(cargo) +$(nightly) check --benches && \
make -C $(wasms) check && \
make -C $(wasms_for_tests) check && \
$(foreach wasm,$(wasm_templates),$(check-wasm) && ) true
Expand Down Expand Up @@ -149,7 +150,7 @@ test-integration:
# Clear pre-built proofs, run integration tests and save the new proofs
test-integration-save-proofs:
# Clear old proofs first
rm --force test_fixtures/masp_proofs/*.bin || true
rm -f test_fixtures/masp_proofs/*.bin || true
NAMADA_MASP_TEST_SEED=$(NAMADA_MASP_TEST_SEED) \
NAMADA_MASP_TEST_PROOFS=save \
TEST_FILTER=masp \
Expand Down Expand Up @@ -220,6 +221,9 @@ watch:
clean:
$(cargo) clean

bench:
$(cargo) bench

build-doc:
$(cargo) doc --no-deps

Expand Down Expand Up @@ -273,4 +277,4 @@ test-miri:
MIRIFLAGS="-Zmiri-disable-isolation" $(cargo) +$(nightly) miri test


.PHONY : build check build-release clippy install run-ledger run-gossip reset-ledger test test-debug fmt watch clean build-doc doc build-wasm-scripts-docker debug-wasm-scripts-docker build-wasm-scripts debug-wasm-scripts clean-wasm-scripts dev-deps test-miri test-unit
.PHONY : build check build-release clippy install run-ledger run-gossip reset-ledger test test-debug fmt watch clean build-doc doc build-wasm-scripts-docker debug-wasm-scripts-docker build-wasm-scripts debug-wasm-scripts clean-wasm-scripts dev-deps test-miri test-unit bench
13 changes: 9 additions & 4 deletions apps/src/bin/namada-client/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,11 +238,16 @@ pub async fn main() -> Result<()> {
let tx = bridge_pool::build_bridge_pool_tx(
&client,
args.clone(),
signing_data.gas_payer.clone(),
signing_data.fee_payer.clone(),
)
.await?;

signing::generate_test_vector(&client, &mut ctx.wallet, &tx).await;
.await?;

signing::generate_test_vector(
&client,
&mut ctx.wallet,
&tx,
)
.await;

if args.tx.dump_tx {
dump_tx(&args.tx, tx);
Expand Down
Loading

0 comments on commit dea97b2

Please sign in to comment.