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

Renaming StoredValue::LegacyTransfer to StoredValue::Transfer #5034

Merged
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
2 changes: 1 addition & 1 deletion execution_engine/src/runtime_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ where
| StoredValue::Contract(_)
| StoredValue::AddressableEntity(_)
| StoredValue::SmartContract(_)
| StoredValue::LegacyTransfer(_)
| StoredValue::Transfer(_)
| StoredValue::DeployInfo(_)
| StoredValue::EraInfo(_)
| StoredValue::Bid(_)
Expand Down
4 changes: 2 additions & 2 deletions resources/test/sse_data_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3718,10 +3718,10 @@
"description": "A version 1 transfer.",
"type": "object",
"required": [
"LegacyTransfer"
"Transfer"
],
"properties": {
"LegacyTransfer": {
"Transfer": {
"$ref": "#/definitions/TransferV1"
}
},
Expand Down
2 changes: 1 addition & 1 deletion storage/src/tracking_copy/byte_size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl ByteSize for StoredValue {
}
StoredValue::SmartContract(package) => package.serialized_length(),
StoredValue::DeployInfo(deploy_info) => deploy_info.serialized_length(),
StoredValue::LegacyTransfer(transfer_v1) => transfer_v1.serialized_length(),
StoredValue::Transfer(transfer_v1) => transfer_v1.serialized_length(),
StoredValue::EraInfo(era_info) => era_info.serialized_length(),
StoredValue::Bid(bid) => bid.serialized_length(),
StoredValue::BidKind(bid_kind) => bid_kind.serialized_length(),
Expand Down
2 changes: 1 addition & 1 deletion storage/src/tracking_copy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ where
StoredValue::ByteCode(_) => {
return Ok(query.into_not_found_result("ByteCode value found."));
}
StoredValue::LegacyTransfer(_) => {
StoredValue::Transfer(_) => {
return Ok(query.into_not_found_result("Legacy Transfer value found."));
}
StoredValue::DeployInfo(_) => {
Expand Down
3 changes: 1 addition & 2 deletions types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ All notable changes to this project will be documented in this file. The format
- struct ExcessiveSizeError changed name to DeployExcessiveSizeError
- struct Transfer changed name to TransferV1
- enum GlobalStateIdentifier
- enum StoredValue has new variants: LegacyTransfer, AddressableEntity, BidKind, Package, ByteCode, MessageTopic, Message, NamedKey,Reservation,EntryPoint,
- enum StoredValue has new variants: Transfer, AddressableEntity, BidKind, Package, ByteCode, MessageTopic, Message, NamedKey,Reservation,EntryPoint,
- enum system::SystemContractType changed name to system::SystemEntityType
- enum system::handle_payment::Error variant SystemFunctionCalledByUserAccount changed to InvalidCaller
- struct EntryPoint has a new field `entry_point_payment`
Expand All @@ -242,7 +242,6 @@ All notable changes to this project will be documented in this file. The format
- type EntryPointsMap
- type NamedKeys
- methods `groups_mut`, `add_group`, `lookup_contract_hash`, `is_version_enabled`, `is_contract_enabled`, `insert_contract_version`, `disable_contract_version`, `enable_contract_version`, `enabled_versions`, `remove_group`, `next_contract_version_for`, `current_contract_version`, `current_contract_hash` in struct ContractPackage
- in enum StoredValue removed variant Transfer (replaced with LegacyTransfer)

## [Unreleased] (node 1.5.4)

Expand Down
2 changes: 1 addition & 1 deletion types/src/execution/transform_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ impl TransformKindV2 {
let found = "ByteCode".to_string();
Err(StoredValueTypeMismatch::new(expected, found).into())
}
StoredValue::LegacyTransfer(_) => {
StoredValue::Transfer(_) => {
let expected = "Contract or Account".to_string();
let found = "Transfer".to_string();
Err(StoredValueTypeMismatch::new(expected, found).into())
Expand Down
4 changes: 2 additions & 2 deletions types/src/gens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ pub fn stored_value_arb() -> impl Strategy<Value = StoredValue> {
contract_package_arb().prop_map(StoredValue::ContractPackage),
addressable_entity_arb().prop_map(StoredValue::AddressableEntity),
package_arb().prop_map(StoredValue::SmartContract),
transfer_v1_arb().prop_map(StoredValue::LegacyTransfer),
transfer_v1_arb().prop_map(StoredValue::Transfer),
deploy_info_arb().prop_map(StoredValue::DeployInfo),
era_info_arb(1..10).prop_map(StoredValue::EraInfo),
unified_bid_arb(0..3).prop_map(StoredValue::BidKind),
Expand All @@ -1002,7 +1002,7 @@ pub fn stored_value_arb() -> impl Strategy<Value = StoredValue> {
StoredValue::ContractWasm(_) => stored_value,
StoredValue::Contract(_) => stored_value,
StoredValue::ContractPackage(_) => stored_value,
StoredValue::LegacyTransfer(_) => stored_value,
StoredValue::Transfer(_) => stored_value,
StoredValue::DeployInfo(_) => stored_value,
StoredValue::EraInfo(_) => stored_value,
StoredValue::Bid(_) => stored_value,
Expand Down
2 changes: 1 addition & 1 deletion types/src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ pub enum FromStrError {
Hash(String),
/// URef parse error.
URef(uref::FromStrError),
/// Legacy Transfer parse error.
/// Transfer parse error.
Transfer(TransferFromStrError),
/// DeployInfo parse error.
DeployInfo(String),
Expand Down
49 changes: 20 additions & 29 deletions types/src/stored_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ pub enum StoredValueTag {
Contract = 3,
/// A contract package.
ContractPackage = 4,
/// A version 1 (legacy) transfer.
LegacyTransfer = 5,
/// A version 1 transfer.
Transfer = 5,
/// Info about a deploy.
DeployInfo = 6,
/// Info about an era.
Expand Down Expand Up @@ -101,7 +101,7 @@ pub enum StoredValue {
/// A contract package.
ContractPackage(ContractPackage),
/// A version 1 transfer.
LegacyTransfer(TransferV1),
Transfer(TransferV1),
/// Info about a deploy.
DeployInfo(DeployInfo),
/// Info about an era.
Expand Down Expand Up @@ -191,10 +191,10 @@ impl StoredValue {
}
}

/// Returns a reference to the wrapped `TransferV1` if this is a `LegacyTransfer` variant.
pub fn as_legacy_transfer(&self) -> Option<&TransferV1> {
/// Returns a reference to the wrapped `TransferV1` if this is a `Transfer` variant.
pub fn as_transfer(&self) -> Option<&TransferV1> {
match self {
StoredValue::LegacyTransfer(transfer_v1) => Some(transfer_v1),
StoredValue::Transfer(transfer_v1) => Some(transfer_v1),
_ => None,
}
}
Expand Down Expand Up @@ -348,10 +348,10 @@ impl StoredValue {
}
}

/// Returns the `TransferV1` if this is a `LegacyTransfer` variant.
/// Returns the `TransferV1` if this is a `Transfer` variant.
pub fn into_legacy_transfer(self) -> Option<TransferV1> {
match self {
StoredValue::LegacyTransfer(transfer_v1) => Some(transfer_v1),
StoredValue::Transfer(transfer_v1) => Some(transfer_v1),
_ => None,
}
}
Expand Down Expand Up @@ -430,7 +430,7 @@ impl StoredValue {
StoredValue::ContractWasm(_) => "ContractWasm".to_string(),
StoredValue::Contract(_) => "Contract".to_string(),
StoredValue::ContractPackage(_) => "ContractPackage".to_string(),
StoredValue::LegacyTransfer(_) => "LegacyTransfer".to_string(),
StoredValue::Transfer(_) => "Transfer".to_string(),
StoredValue::DeployInfo(_) => "DeployInfo".to_string(),
StoredValue::EraInfo(_) => "EraInfo".to_string(),
StoredValue::Bid(_) => "Bid".to_string(),
Expand All @@ -457,7 +457,7 @@ impl StoredValue {
StoredValue::ContractWasm(_) => StoredValueTag::ContractWasm,
StoredValue::ContractPackage(_) => StoredValueTag::ContractPackage,
StoredValue::Contract(_) => StoredValueTag::Contract,
StoredValue::LegacyTransfer(_) => StoredValueTag::LegacyTransfer,
StoredValue::Transfer(_) => StoredValueTag::Transfer,
StoredValue::DeployInfo(_) => StoredValueTag::DeployInfo,
StoredValue::EraInfo(_) => StoredValueTag::EraInfo,
StoredValue::Bid(_) => StoredValueTag::Bid,
Expand Down Expand Up @@ -679,11 +679,8 @@ impl TryFrom<StoredValue> for TransferV1 {

fn try_from(value: StoredValue) -> Result<Self, Self::Error> {
match value {
StoredValue::LegacyTransfer(transfer_v1) => Ok(transfer_v1),
_ => Err(TypeMismatch::new(
"LegacyTransfer".to_string(),
value.type_name(),
)),
StoredValue::Transfer(transfer_v1) => Ok(transfer_v1),
_ => Err(TypeMismatch::new("Transfer".to_string(), value.type_name())),
}
}
}
Expand Down Expand Up @@ -766,7 +763,7 @@ impl ToBytes for StoredValue {
StoredValue::ContractPackage(contract_package) => {
contract_package.serialized_length()
}
StoredValue::LegacyTransfer(transfer_v1) => transfer_v1.serialized_length(),
StoredValue::Transfer(transfer_v1) => transfer_v1.serialized_length(),
StoredValue::DeployInfo(deploy_info) => deploy_info.serialized_length(),
StoredValue::EraInfo(era_info) => era_info.serialized_length(),
StoredValue::Bid(bid) => bid.serialized_length(),
Expand Down Expand Up @@ -795,7 +792,7 @@ impl ToBytes for StoredValue {
StoredValue::ContractWasm(contract_wasm) => contract_wasm.write_bytes(writer),
StoredValue::Contract(contract_header) => contract_header.write_bytes(writer),
StoredValue::ContractPackage(contract_package) => contract_package.write_bytes(writer),
StoredValue::LegacyTransfer(transfer_v1) => transfer_v1.write_bytes(writer),
StoredValue::Transfer(transfer_v1) => transfer_v1.write_bytes(writer),
StoredValue::DeployInfo(deploy_info) => deploy_info.write_bytes(writer),
StoredValue::EraInfo(era_info) => era_info.write_bytes(writer),
StoredValue::Bid(bid) => bid.write_bytes(writer),
Expand Down Expand Up @@ -836,10 +833,8 @@ impl FromBytes for StoredValue {
}
tag if tag == StoredValueTag::Contract as u8 => Contract::from_bytes(remainder)
.map(|(contract, remainder)| (StoredValue::Contract(contract), remainder)),
tag if tag == StoredValueTag::LegacyTransfer as u8 => TransferV1::from_bytes(remainder)
.map(|(transfer_v1, remainder)| {
(StoredValue::LegacyTransfer(transfer_v1), remainder)
}),
tag if tag == StoredValueTag::Transfer as u8 => TransferV1::from_bytes(remainder)
.map(|(transfer_v1, remainder)| (StoredValue::Transfer(transfer_v1), remainder)),
tag if tag == StoredValueTag::DeployInfo as u8 => DeployInfo::from_bytes(remainder)
.map(|(deploy_info, remainder)| (StoredValue::DeployInfo(deploy_info), remainder)),
tag if tag == StoredValueTag::EraInfo as u8 => EraInfo::from_bytes(remainder)
Expand Down Expand Up @@ -901,7 +896,7 @@ mod serde_helpers {
ContractWasm(&'a ContractWasm),
Contract(&'a Contract),
ContractPackage(&'a ContractPackage),
LegacyTransfer(&'a TransferV1),
Transfer(&'a TransferV1),
DeployInfo(&'a DeployInfo),
EraInfo(&'a EraInfo),
Bid(&'a Bid),
Expand All @@ -927,7 +922,7 @@ mod serde_helpers {
ContractWasm(ContractWasm),
Contract(Contract),
ContractPackage(ContractPackage),
LegacyTransfer(TransferV1),
Transfer(TransferV1),
DeployInfo(DeployInfo),
EraInfo(EraInfo),
Bid(Box<Bid>),
Expand Down Expand Up @@ -955,9 +950,7 @@ mod serde_helpers {
StoredValue::ContractPackage(payload) => {
HumanReadableSerHelper::ContractPackage(payload)
}
StoredValue::LegacyTransfer(payload) => {
HumanReadableSerHelper::LegacyTransfer(payload)
}
StoredValue::Transfer(payload) => HumanReadableSerHelper::Transfer(payload),
StoredValue::DeployInfo(payload) => HumanReadableSerHelper::DeployInfo(payload),
StoredValue::EraInfo(payload) => HumanReadableSerHelper::EraInfo(payload),
StoredValue::Bid(payload) => HumanReadableSerHelper::Bid(payload),
Expand Down Expand Up @@ -997,9 +990,7 @@ mod serde_helpers {
HumanReadableDeserHelper::ContractPackage(payload) => {
StoredValue::ContractPackage(payload)
}
HumanReadableDeserHelper::LegacyTransfer(payload) => {
StoredValue::LegacyTransfer(payload)
}
HumanReadableDeserHelper::Transfer(payload) => StoredValue::Transfer(payload),
HumanReadableDeserHelper::DeployInfo(payload) => StoredValue::DeployInfo(payload),
HumanReadableDeserHelper::EraInfo(payload) => StoredValue::EraInfo(payload),
HumanReadableDeserHelper::Bid(bid) => StoredValue::Bid(bid),
Expand Down
2 changes: 1 addition & 1 deletion types/src/transaction/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub use crate::transaction::transaction_v1::InvalidTransactionV1;
#[cfg_attr(feature = "datasize", derive(DataSize))]
#[non_exhaustive]
pub enum InvalidTransaction {
/// Legacy deploys.
/// Deploys.
Deploy(InvalidDeploy),
/// V1 transactions.
V1(InvalidTransactionV1),
Expand Down
6 changes: 3 additions & 3 deletions utils/validation/src/generators.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ pub fn make_abi_test_fixtures() -> Result<TestFixtures, Error> {
ABITestCase::from_inputs(vec![UREF_KEY.into()])?,
);
keys.insert(
"LegacyTransfer".to_string(),
"Transfer".to_string(),
ABITestCase::from_inputs(vec![TRANSFER_KEY.into()])?,
);
keys.insert(
Expand Down Expand Up @@ -433,8 +433,8 @@ pub fn make_abi_test_fixtures() -> Result<TestFixtures, Error> {
);

stored_value.insert(
"LegacyTransfer".to_string(),
ABITestCase::from_inputs(vec![StoredValue::LegacyTransfer(legacy_transfer).into()])?,
"Transfer".to_string(),
ABITestCase::from_inputs(vec![StoredValue::Transfer(legacy_transfer).into()])?,
);
stored_value.insert(
"DeployInfo".to_string(),
Expand Down
2 changes: 1 addition & 1 deletion utils/validation/tests/fixtures/ABI/key.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
],
"output": "012a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a2a"
},
"LegacyTransfer": {
"Transfer": {
"input": [
{
"type": "Key",
Expand Down
4 changes: 2 additions & 2 deletions utils/validation/tests/fixtures/ABI/stored_value.json
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@
],
"output": "07020000000001197f6b23e16c8532c6abc838facd5ea789be0c76b2920334039bfa8b3d368d610400ca9a3b01000202bb58b5feca505c74edc000d8282fc556e51a1024fc8e7d7e56c6f887c5c8d5f201197f6b23e16c8532c6abc838facd5ea789be0c76b2920334039bfa8b3d368d610400ca9a3b"
},
"LegacyTransfer": {
"Transfer": {
"input": [
{
"type": "StoredValue",
"value": {
"LegacyTransfer": {
"Transfer": {
"deploy_hash": "2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c2c",
"from": "account-hash-6464646464646464646464646464646464646464646464646464646464646464",
"to": "account-hash-6565656565656565656565656565656565656565656565656565656565656565",
Expand Down
Loading