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

Account-base fee collection #1407

Merged
merged 16 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Description of the upcoming release here.
- [#1395](https://github.com/FuelLabs/fuel-core/pull/1395): Add DependentCost benchmarks for `k256`, `s256` and `mcpi` instructions.

#### Breaking
- [#1407](https://github.com/FuelLabs/fuel-core/pull/1407): The recipient is a `ContractId` instead of `Address`. The block producer should deploy its contract to receive the transaction fee. The collected fee is zero until the recipient contract is set.
- [#1407](https://github.com/FuelLabs/fuel-core/pull/1407): The `Mint` transaction is reworked with new fields to support the account-base model. It affects serialization and deserialization of the transaction and also affects GraphQL schema.
- [#1407](https://github.com/FuelLabs/fuel-core/pull/1407): The `Mint` transaction is the last transaction in the block instead of the first.
- [#1374](https://github.com/FuelLabs/fuel-core/pull/1374): Renamed `base_chain_height` to `da_height` and return current relayer height instead of latest Fuel block height.
- [#1363](https://github.com/FuelLabs/fuel-core/pull/1363): Change message_proof api to take `nonce` instead of `message_id`
- [#1339](https://github.com/FuelLabs/fuel-core/pull/1339): Added a new required field called `base_asset_id` to the `FeeParameters` definition in `ConsensusParameters`, as well as default values for `base_asset_id` in the `beta` and `dev` chainspecs.
Expand Down
33 changes: 17 additions & 16 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ fuel-core-tests = { version = "0.0.0", path = "./tests" }
fuel-core-xtask = { version = "0.0.0", path = "./xtask" }

# Fuel dependencies
fuel-vm-private = { version = "0.38.0", package = "fuel-vm", default-features = false }
fuel-vm-private = { version = "0.39.0", package = "fuel-vm", default-features = false }

# Common dependencies
anyhow = "1.0"
Expand Down
4 changes: 2 additions & 2 deletions benches/benches/vm_set/blockchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ pub fn run(c: &mut Criterion) {
let coin_output = Output::variable(Address::zeroed(), 100, AssetId::zeroed());
input.outputs.push(coin_output);
let predicate = op::ret(RegId::ONE).to_bytes().to_vec();
let owner = Input::predicate_owner(&predicate, &ChainId::default());
let owner = Input::predicate_owner(&predicate);
let coin_input = Input::coin_predicate(
Default::default(),
owner,
Expand Down Expand Up @@ -481,7 +481,7 @@ pub fn run(c: &mut Criterion) {
.chain(vec![2u8; i as usize]),
);
let predicate = op::ret(RegId::ONE).to_bytes().to_vec();
let owner = Input::predicate_owner(&predicate, &ChainId::default());
let owner = Input::predicate_owner(&predicate);
let coin_input = Input::coin_predicate(
Default::default(),
owner,
Expand Down
23 changes: 8 additions & 15 deletions bin/fuel-core/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,9 @@ use fuel_core::{
txpool::Config as TxPoolConfig,
types::{
blockchain::primitives::SecretKeyWrapper,
fuel_tx::Address,
fuel_tx::ContractId,
fuel_vm::SecretKey,
secrecy::{
ExposeSecret,
Secret,
},
secrecy::Secret,
},
};
use pyroscope::{
Expand All @@ -47,7 +44,6 @@ use pyroscope_pprofrs::{
use std::{
env,
net,
ops::Deref,
path::PathBuf,
str::FromStr,
};
Expand Down Expand Up @@ -285,16 +281,13 @@ impl Command {
}

let coinbase_recipient = if let Some(coinbase_recipient) = coinbase_recipient {
Address::from_str(coinbase_recipient.as_str()).map_err(|err| anyhow!(err))?
Some(
ContractId::from_str(coinbase_recipient.as_str())
.map_err(|err| anyhow!(err))?,
)
} else {
consensus_key
.as_ref()
.cloned()
.map(|key| {
let sk = key.expose_secret().deref();
Address::from(*sk.public_key().hash())
})
.unwrap_or_default()
tracing::warn!("The coinbase recipient `ContractId` is not set!");
None
};

let verifier = RelayerVerifierConfig {
Expand Down
4 changes: 4 additions & 0 deletions crates/client/assets/schema.sdl
Original file line number Diff line number Diff line change
Expand Up @@ -840,15 +840,19 @@ type Transaction {
id: TransactionId!
inputAssetIds: [AssetId!]
inputContracts: [Contract!]
inputContract: InputContract
gasPrice: U64
gasLimit: U64
maturity: U32
mintAmount: U64
mintAssetId: AssetId
txPointer: TxPointer
isScript: Boolean!
isCreate: Boolean!
isMint: Boolean!
inputs: [Input!]
outputs: [Output!]!
outputContract: ContractOutput
witnesses: [HexString!]
receiptsRoot: Bytes32
status: TransactionStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ query($id: TransactionId!) {
inputContracts {
id
}
inputContract {
utxoId
balanceRoot
stateRoot
txPointer
contract {
id
}
}
inputs {
__typename
... on InputCoin {
Expand Down Expand Up @@ -79,7 +88,14 @@ query($id: TransactionId!) {
stateRoot
}
}
outputContract {
inputIndex
balanceRoot
stateRoot
}
maturity
mintAmount
mintAssetId
receiptsRoot
status {
__typename
Expand Down
Loading
Loading