Skip to content
Open
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: 2 additions & 1 deletion conformance/src/txn_execute.zig
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ const Rent = sig.runtime.sysvar.Rent;
const SysvarCache = sig.runtime.SysvarCache;
const RuntimeTransaction = transaction_execution.RuntimeTransaction;
const TransactionExecutionEnvironment = transaction_execution.TransactionExecutionEnvironment;
const LAMPORTS_PER_SIGNATURE = sig.runtime.check_transactions.LAMPORTS_PER_SIGNATURE;
const ProcessedTransaction = transaction_execution.ProcessedTransaction;
const TransactionResult = transaction_execution.TransactionResult;

Expand Down Expand Up @@ -702,7 +703,7 @@ fn executeTxnContext(
// juggles the many different versions of lamports_per_signature.
.next_lamports_per_signature = last_lamports_per_signature,
.last_lamports_per_signature = last_lamports_per_signature,
.lamports_per_signature = 5000,
.lamports_per_signature = LAMPORTS_PER_SIGNATURE,
};

var failed_accounts = sig.runtime.account_loader.LoadedTransactionAccounts.Accounts{};
Expand Down
3 changes: 2 additions & 1 deletion v1/src/replay/execution.zig
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const AccountStore = sig.accounts_db.AccountStore;
const ForkProgress = sig.consensus.progress_map.ForkProgress;
const ParsedVote = sig.consensus.vote_listener.vote_parser.ParsedVote;
const ProcessedTransaction = sig.runtime.transaction_execution.ProcessedTransaction;
const LAMPORTS_PER_SIGNATURE = sig.runtime.check_transactions.LAMPORTS_PER_SIGNATURE;
const SlotHashes = sig.runtime.sysvar.SlotHashes;
const TransactionError = sig.ledger.transaction_status.TransactionError;

Expand Down Expand Up @@ -1131,7 +1132,7 @@ pub const TestState = struct {
.ancestors = ancestors,
.slot = 0,
.max_age = max_age,
.lamports_per_signature = 5000,
.lamports_per_signature = LAMPORTS_PER_SIGNATURE,
.blockhash_queue = .init(blockhash_queue),
.feature_set = .ALL_DISABLED,
.rent_collector = .DEFAULT,
Expand Down
2 changes: 1 addition & 1 deletion v1/src/rpc/hook_contexts/Account.zig
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ pub fn getFeeForMessage(
const fee_budget_limits = FeeBudgetLimits.fromComputeBudgetLimits(budget_limits);
fee_details = FeeDetails.init(
SignatureCounts.fromTransaction(&runtime_txn),
5_000,
bq_lps,
fee_budget_limits.prioritization_fee,
budget_limits.compute_unit_price,
);
Expand Down
5 changes: 3 additions & 2 deletions v1/src/transaction_sender/MockTransferService.zig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ const TransactionInfo = sig.TransactionSenderService.TransactionInfo;

const Commitment = sig.rpc.methods.common.Commitment;

const LAMPORTS_PER_SIGNATURE = sig.runtime.check_transactions.LAMPORTS_PER_SIGNATURE;

const Logger = sig.trace.Logger("MockTransferService");

pub const Service = @This();
Expand All @@ -40,8 +42,7 @@ successful: u64 = 0,

const TRANSFERS: u64 = 10;
const TRANSFER_AMOUNT: u64 = 1e6;
const TRANSFER_FEE: u64 = 5000;
const TRANSFER_COST: u64 = TRANSFER_AMOUNT + TRANSFER_FEE;
const TRANSFER_COST: u64 = TRANSFER_AMOUNT + LAMPORTS_PER_SIGNATURE;

pub const ACCOUNT_0: Account = .init("account_0", .{ // Pubkey: H67JSziFxAZR1KSQshWfa8Rdpr7LSv1VkT2cFQHL79rd
.public_key = .{ .bytes = .{
Expand Down
26 changes: 12 additions & 14 deletions v2/components/runtime/runtime/check_transactions.zig
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,12 @@ pub fn checkFeePayer(
// This means that lamports_per_signature is in effect *always* 5000, even
// when the fee rate governor disagrees.
//
// The other fields of FeeStructure, lamports_per_write_lock and
// compute_fee_bins, are also effectively unused.
//
// TODO: Stop hardcoding this value.
// This will probably be fixed in Agave at some point, we should fix this
// when they do.
//
// [agave] https://github.com/anza-xyz/agave/blob/b6c96e84b10396b92912d4574dae7d03f606da26/runtime/src/bank/check_transactions.rs#L106-L112

const fee_budget_limits = FeeBudgetLimits.fromComputeBudgetLimits(compute_budget_limits.*);
const fee_details = FeeDetails.init(
SignatureCounts.fromTransaction(transaction),
5_000,
LAMPORTS_PER_SIGNATURE,
fee_budget_limits.prioritization_fee,
compute_budget_limits.compute_unit_price,
);
Expand Down Expand Up @@ -179,6 +172,8 @@ pub const SignatureCounts = struct {
}
};

pub const LAMPORTS_PER_SIGNATURE: u64 = 5_000;

pub const FeeDetails = struct {
transaction_fee: u64,
prioritization_fee: u64,
Expand Down Expand Up @@ -776,12 +771,12 @@ test "checkFeePayer: happy path fee payer only" {
const fee_details, const rollbacks, const prepared_fee_payer = result.ok;
defer prepared_fee_payer.account.deinit(allocator);

try std.testing.expectEqual(5000, fee_details.transaction_fee);
try std.testing.expectEqual(LAMPORTS_PER_SIGNATURE, fee_details.transaction_fee);
try std.testing.expectEqual(0, fee_details.prioritization_fee);

try std.testing.expectEqual(1, rollbacks.slice().len);
const payer = rollbacks.slice()[0];
try std.testing.expectEqual(995_000, payer.account.lamports);
try std.testing.expectEqual(1_000_000 - LAMPORTS_PER_SIGNATURE, payer.account.lamports);
try std.testing.expectEqual(0, payer.account.rent_epoch);
}

Expand Down Expand Up @@ -847,9 +842,9 @@ test "checkFeePayer: happy path with same nonce and fee payer" {
try std.testing.expectEqual(1, rollbacks.len);
const rollback_account = rollbacks.get(0).account;

try std.testing.expectEqual(5000, fee_details.transaction_fee);
try std.testing.expectEqual(LAMPORTS_PER_SIGNATURE, fee_details.transaction_fee);
try std.testing.expectEqual(0, fee_details.prioritization_fee);
try std.testing.expectEqual(995_000, rollback_account.lamports);
try std.testing.expectEqual(1_000_000 - LAMPORTS_PER_SIGNATURE, rollback_account.lamports);
try std.testing.expectEqual(std.math.maxInt(u64), rollback_account.rent_epoch);
}

Expand Down Expand Up @@ -915,10 +910,13 @@ test "checkFeePayer: happy path with separate nonce and fee payer" {
const rollback_nonce_account = rollbacks.get(0).account;
const rollback_fee_payer_account = rollbacks.get(1).account;

try std.testing.expectEqual(5000, fee_details.transaction_fee);
try std.testing.expectEqual(LAMPORTS_PER_SIGNATURE, fee_details.transaction_fee);
try std.testing.expectEqual(0, fee_details.prioritization_fee);
try std.testing.expectEqual(1_000, rollback_nonce_account.lamports);
try std.testing.expectEqual(0, rollback_nonce_account.rent_epoch);
try std.testing.expectEqual(995_000, rollback_fee_payer_account.lamports);
try std.testing.expectEqual(
1_000_000 - LAMPORTS_PER_SIGNATURE,
rollback_fee_payer_account.lamports,
);
try std.testing.expectEqual(std.math.maxInt(u64), rollback_fee_payer_account.rent_epoch);
}
11 changes: 6 additions & 5 deletions v2/components/runtime/runtime/transaction_execution.zig
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const EpochStakeReader = sig.runtime.execution_interfaces.EpochStakeReader;
const LoadedAccount = sig.runtime.account_loader.LoadedAccount;
const FeatureSet = solana.features.Set;
const FeeDetails = sig.runtime.check_transactions.FeeDetails;
const LAMPORTS_PER_SIGNATURE = sig.runtime.check_transactions.LAMPORTS_PER_SIGNATURE;
const InstructionInfo = sig.runtime.InstructionInfo;
const LoadedTransactionAccounts = sig.runtime.account_loader.LoadedTransactionAccounts;
const LogCollector = sig.runtime.LogCollector;
Expand Down Expand Up @@ -873,7 +874,7 @@ test "loadAndExecuteTransaction: simple transfer transaction" {
.next_durable_nonce = Hash.ZEROES,
.next_lamports_per_signature = 0,
.last_lamports_per_signature = 0,
.lamports_per_signature = 5000, // Default value
.lamports_per_signature = LAMPORTS_PER_SIGNATURE,
};

const config = TransactionExecutionConfig{
Expand Down Expand Up @@ -912,10 +913,10 @@ test "loadAndExecuteTransaction: simple transfer transaction" {
const sender_account = account_map.get(sender_key).?;
const receiver_account = account_map.get(receiver_key).?;

try std.testing.expectEqual(5_000, transaction_fee);
try std.testing.expectEqual(LAMPORTS_PER_SIGNATURE, transaction_fee);
try std.testing.expectEqual(0, prioritization_fee);
try std.testing.expectEqual(0, processed_transaction.rent);
try std.testing.expectEqual(4_995_000, sender_account.lamports);
try std.testing.expectEqual(5_000_000 - LAMPORTS_PER_SIGNATURE, sender_account.lamports);
try std.testing.expectEqual(15_000_000, receiver_account.lamports);
try std.testing.expectEqual(null, processed_transaction.err);
try std.testing.expectEqual(null, executed_transaction.log_collector);
Expand Down Expand Up @@ -957,10 +958,10 @@ test "loadAndExecuteTransaction: simple transfer transaction" {
const sender_account = account_map.get(sender_key).?;
const receiver_account = account_map.get(receiver_key).?;

try std.testing.expectEqual(5_000, transaction_fee);
try std.testing.expectEqual(LAMPORTS_PER_SIGNATURE, transaction_fee);
try std.testing.expectEqual(0, prioritization_fee);
try std.testing.expectEqual(0, processed_transaction.rent);
try std.testing.expectEqual(4_990_000, sender_account.lamports);
try std.testing.expectEqual(5_000_000 - 2 * LAMPORTS_PER_SIGNATURE, sender_account.lamports);
try std.testing.expectEqual(15_000_000, receiver_account.lamports);
try std.testing.expectEqual(0, processed_transaction.err.?.InstructionError[0]);
try std.testing.expectEqual(
Expand Down