refactor(applying): unify approach for protocol params access (#432)

This commit is contained in:
Maico Leberle 2024-04-11 21:41:27 -03:00 committed by GitHub
parent df3291bef5
commit fb8b7402fe
45 changed files with 2056 additions and 1520 deletions

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -3,7 +3,7 @@ pub mod common;
use common::{cbor_to_bytes, minted_tx_payload_from_cbor, mk_utxo_for_byron_tx};
use pallas_applying::{
utils::{
ByronError, ByronProtParams, Environment, FeePolicy, MultiEraProtParams, ValidationError::*,
ByronError, ByronProtParams, Environment, MultiEraProtocolParameters, ValidationError::*,
},
validate, UTxOs,
};
@ -33,17 +33,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron2.address")),
String::from("83581CDC7E4DD6A44886816DEC9A4B2021056A8FCAF500C09E316028F2985FA002"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 6341,
@ -65,17 +75,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -95,7 +115,7 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
@ -110,12 +130,22 @@ mod byron_tests {
mtxp.transaction = Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -148,17 +178,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -181,12 +221,22 @@ mod byron_tests {
let metx: MultiEraTx = MultiEraTx::from_byron(&mtxp);
let utxos: UTxOs = UTxOs::new();
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -225,17 +275,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -259,17 +319,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 1000,
multiplier: 1000,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 1000,
multiplier: 1000,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -293,17 +363,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 0,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -319,7 +399,7 @@ mod byron_tests {
}
#[test]
// The input to the transaction does not have a corresponding witness.
// The input to the transaction does not have a matching witness.
fn missing_witness() {
let cbor_bytes: Vec<u8> = cbor_to_bytes(include_str!("../../test_data/byron1.tx"));
let mut mtxp: MintedTxPayload = minted_tx_payload_from_cbor(&cbor_bytes);
@ -335,17 +415,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,
@ -386,17 +476,27 @@ mod byron_tests {
let utxos: UTxOs = mk_utxo_for_byron_tx(
&mtxp.transaction,
&[(
String::from(include_str!("../../test_data/byron1.address")),
String::from("83581cff66e7549ee0706abe5ce63ba325f792f2c1145d918baf563db2b457a101581e581cca3e553c9c63c5927480e7434620200eb3a162ef0b6cf6f671ba925100"),
19999000000,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Byron(ByronProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
},
prot_params: MultiEraProtocolParameters::Byron(ByronProtParams {
script_version: 0,
slot_duration: 20000,
max_block_size: 2000000,
max_header_size: 2000000,
max_tx_size: 4096,
max_proposal_size: 700,
mpc_thd: 20000000000000,
heavy_del_thd: 300000000000,
update_vote_thd: 1000000000000,
update_proposal_thd: 100000000000000,
update_implicit: 10000,
soft_fork_rule: (900000000000000, 600000000000000, 50000000000000),
summand: 155381,
multiplier: 44,
unlock_stake_epoch: 18446744073709551615,
}),
prot_magic: 764824073,
block_slot: 3241381,

View file

@ -4,7 +4,7 @@ use common::*;
use pallas_addresses::{Address, Network, ShelleyAddress};
use pallas_applying::{
utils::{
Environment, FeePolicy, MultiEraProtParams, ShelleyMAError, ShelleyProtParams,
Environment, MultiEraProtocolParameters, ShelleyMAError, ShelleyProtParams,
ValidationError::*,
},
validate, UTxOs,
@ -17,7 +17,8 @@ use pallas_codec::{
utils::{Bytes, Nullable},
};
use pallas_primitives::alonzo::{
MintedTx, MintedWitnessSet, TransactionBody, TransactionOutput, VKeyWitness, Value,
MintedTx, MintedWitnessSet, Nonce, NonceVariant, RationalNumber, TransactionBody,
TransactionOutput, VKeyWitness, Value,
};
use pallas_traverse::{Era, MultiEraTx};
@ -35,19 +36,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -69,19 +98,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley2.address")),
String::from("7165c197d565e88a20885e535f93755682444d3c02fd44dd70883fe89e"),
Value::Coin(2000000),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 17584925,
@ -103,19 +160,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley3.address")),
String::from("61c96001f4a4e10567ac18be3c47663a00a858f51c56779e94993d30ef"),
Value::Coin(10000000),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5860488,
@ -137,19 +222,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/mary1.address")),
String::from("611489ac0c22c04abc9c6de7f95d71e1ba2c95c9b4e2f6f2900f682285"),
Value::Coin(3500000),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 24381863,
@ -169,7 +282,7 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
@ -186,13 +299,41 @@ mod shelley_ma_tests {
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -215,13 +356,41 @@ mod shelley_ma_tests {
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
let utxos: UTxOs = UTxOs::new();
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -244,7 +413,7 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
@ -260,13 +429,41 @@ mod shelley_ma_tests {
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -290,19 +487,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 9999999,
@ -326,19 +551,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 0,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 0,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -363,19 +616,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 10000000000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 10000000000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -409,19 +690,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -445,19 +754,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 70, // This value was 44 during Shelley on mainnet.
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 70,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -510,13 +847,41 @@ mod shelley_ma_tests {
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -525,7 +890,7 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
@ -551,19 +916,47 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley3.address")),
String::from("61c96001f4a4e10567ac18be3c47663a00a858f51c56779e94993d30ef"),
Value::Coin(10000000),
None,
)],
);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5860488,
@ -597,13 +990,41 @@ mod shelley_ma_tests {
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -612,7 +1033,7 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
@ -650,13 +1071,41 @@ mod shelley_ma_tests {
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -665,7 +1114,7 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley1.address")),
String::from("0129bb156d52d014bb444a14138cbee36044c6faed37d0c2d49d2358315c465cbf8c5536970e8a29bb7adcda0d663b20007d481813694c64ef"),
Value::Coin(2332267427205),
None,
)],
@ -698,13 +1147,41 @@ mod shelley_ma_tests {
Decode::decode(&mut Decoder::new(tx_buf.as_slice()), &mut ()).unwrap();
let metx: MultiEraTx = MultiEraTx::from_alonzo_compatible(&mtx, Era::Shelley);
let env: Environment = Environment {
prot_params: MultiEraProtParams::Shelley(ShelleyProtParams {
fee_policy: FeePolicy {
summand: 155381,
multiplier: 44,
prot_params: MultiEraProtocolParameters::Shelley(ShelleyProtParams {
minfee_b: 155381,
minfee_a: 44,
max_block_body_size: 65536,
max_transaction_size: 4096,
max_block_header_size: 1100,
key_deposit: 2000000,
pool_deposit: 500000000,
maximum_epoch: 18,
desired_number_of_stake_pools: 150,
pool_pledge_influence: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
max_tx_size: 4096,
min_lovelace: 1000000,
expansion_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
treasury_growth_rate: RationalNumber {
// FIX: this is a made-up value.
numerator: 1,
denominator: 1,
},
decentralization_constant: RationalNumber {
numerator: 1,
denominator: 1,
},
extra_entropy: Nonce {
variant: NonceVariant::NeutralNonce,
hash: None,
},
protocol_version: (0, 2),
min_utxo_value: 1000000,
}),
prot_magic: 764824073,
block_slot: 5281340,
@ -713,7 +1190,7 @@ mod shelley_ma_tests {
let utxos: UTxOs = mk_utxo_for_alonzo_compatible_tx(
&mtx.transaction_body,
&[(
String::from(include_str!("../../test_data/shelley2.address")),
String::from("7165c197d565e88a20885e535f93755682444d3c02fd44dd70883fe89e"),
Value::Coin(2000000),
None,
)],