Skip to content

Commit

Permalink
[move] Clean up names (#99)
Browse files Browse the repository at this point in the history
Co-authored-by: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com>
  • Loading branch information
2 people authored and hemulin committed Nov 14, 2023
1 parent b7ddfe3 commit 05591b7
Show file tree
Hide file tree
Showing 49 changed files with 726 additions and 624 deletions.
302 changes: 151 additions & 151 deletions Cargo.lock

Large diffs are not rendered by default.

72 changes: 36 additions & 36 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,37 +41,37 @@ libra-txs = { path = "tools/txs" }
libra-wallet = { path = "tools/wallet" }
vdf = { git = "https://github.com/0o-de-lally/verifiable_delay.git" }

diem-api-types = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-debugger = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-db = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-forge = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-transactional-test-harness = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
smoke-test = { package = "smoke-test", git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-api-types = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-debugger = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-db = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-forge = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-transactional-test-harness = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
smoke-test = { package = "smoke-test", git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }

diem = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-build-info = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-node = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-rest-client = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-sdk = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-config = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-crypto = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-genesis = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-global-constants = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-keygen = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-logger = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-types = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-gas = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-vm = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-vm-genesis = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-executor = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-framework = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-cached-packages = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-github-client = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-release-builder = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-language-e2e-tests = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-state-view = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-storage-interface = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-temppath = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-build-info = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-node = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-rest-client = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-sdk = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-config = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-crypto = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-genesis = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-global-constants = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-keygen = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-logger = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-types = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-gas = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-vm = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-vm-genesis = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-executor = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-framework = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-cached-packages = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-github-client = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-release-builder = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-language-e2e-tests = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-state-view = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-storage-interface = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
diem-temppath = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }

### External crate dependencies.
# 0L NOTE: most of these are not used. But we leave the entire block here
Expand Down Expand Up @@ -314,12 +314,12 @@ serde_with = "^3"
# move-abigen = { path = "third_party/move/move-prover/move-abigen" }
# move-binary-format = { path = "third_party/move/move-binary-format" }
# ... see full list in Aptos repo
move-binary-format = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
move-core-types = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
move-command-line-common = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
move-compiler = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
move-model = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
move-vm-test-utils = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
move-binary-format = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
move-core-types = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
move-command-line-common = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
move-compiler = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
move-model = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
move-vm-test-utils = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }

# uses a profile similar to `cli` in Diem/Cargo.toml
# optimized for performance and size
Expand Down
2 changes: 1 addition & 1 deletion framework/cached-packages/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rust-version = { workspace = true }
[dependencies]
bcs = { workspace = true }
# Note the generated SDK code uses hard coded `diemtypes`
diem-types = { git = "https://github.com/0LNetworkCommunity/diem.git", branch = "release" }
diem-types = { git = "https://github.com/0LNetworkCommunity/diem.git", rev = "839afb1" }
move-core-types = { workspace = true }
once_cell = { workspace = true }

Expand Down
48 changes: 24 additions & 24 deletions framework/cached-packages/src/libra_framework_sdk_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,17 @@ pub enum EntryFunctionCall {

/// Only callable in tests and testnets where the core resources account exists.
/// Claim the delegated mint capability and destroy the delegated token.
GasCoinClaimMintCapability {},
LibraCoinClaimMintCapability {},

/// Only callable in tests and testnets where the core resources account exists.
/// Create delegated token for the address so the account could claim MintCapability later.
GasCoinDelegateMintCapability {
LibraCoinDelegateMintCapability {
to: AccountAddress,
},

/// Root account can mint to an address. Only used for genesis and tests.
/// The "root" account in smoke tests has some privileges.
GasCoinMintToImpl {
LibraCoinMintToImpl {
dst_addr: AccountAddress,
amount: u64,
},
Expand Down Expand Up @@ -705,9 +705,9 @@ impl EntryFunctionCall {
id,
} => donor_voice_vote_veto_tx(multisig_address, id),
JailUnjailByVoucher { addr } => jail_unjail_by_voucher(addr),
GasCoinClaimMintCapability {} => gas_coin_claim_mint_capability(),
GasCoinDelegateMintCapability { to } => gas_coin_delegate_mint_capability(to),
GasCoinMintToImpl { dst_addr, amount } => gas_coin_mint_to_impl(dst_addr, amount),
LibraCoinClaimMintCapability {} => libra_coin_claim_mint_capability(),
LibraCoinDelegateMintCapability { to } => libra_coin_delegate_mint_capability(to),
LibraCoinMintToImpl { dst_addr, amount } => libra_coin_mint_to_impl(dst_addr, amount),
MultisigAccountAddOwner { new_owner } => multisig_account_add_owner(new_owner),
MultisigAccountAddOwners { new_owners } => multisig_account_add_owners(new_owners),
MultisigAccountApproveTransaction {
Expand Down Expand Up @@ -1515,14 +1515,14 @@ pub fn jail_unjail_by_voucher(addr: AccountAddress) -> TransactionPayload {

/// Only callable in tests and testnets where the core resources account exists.
/// Claim the delegated mint capability and destroy the delegated token.
pub fn gas_coin_claim_mint_capability() -> TransactionPayload {
pub fn libra_coin_claim_mint_capability() -> TransactionPayload {
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
AccountAddress::new([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1,
]),
ident_str!("gas_coin").to_owned(),
ident_str!("libra_coin").to_owned(),
),
ident_str!("claim_mint_capability").to_owned(),
vec![],
Expand All @@ -1532,14 +1532,14 @@ pub fn gas_coin_claim_mint_capability() -> TransactionPayload {

/// Only callable in tests and testnets where the core resources account exists.
/// Create delegated token for the address so the account could claim MintCapability later.
pub fn gas_coin_delegate_mint_capability(to: AccountAddress) -> TransactionPayload {
pub fn libra_coin_delegate_mint_capability(to: AccountAddress) -> TransactionPayload {
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
AccountAddress::new([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1,
]),
ident_str!("gas_coin").to_owned(),
ident_str!("libra_coin").to_owned(),
),
ident_str!("delegate_mint_capability").to_owned(),
vec![],
Expand All @@ -1549,14 +1549,14 @@ pub fn gas_coin_delegate_mint_capability(to: AccountAddress) -> TransactionPaylo

/// Root account can mint to an address. Only used for genesis and tests.
/// The "root" account in smoke tests has some privileges.
pub fn gas_coin_mint_to_impl(dst_addr: AccountAddress, amount: u64) -> TransactionPayload {
pub fn libra_coin_mint_to_impl(dst_addr: AccountAddress, amount: u64) -> TransactionPayload {
TransactionPayload::EntryFunction(EntryFunction::new(
ModuleId::new(
AccountAddress::new([
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1,
]),
ident_str!("gas_coin").to_owned(),
ident_str!("libra_coin").to_owned(),
),
ident_str!("mint_to_impl").to_owned(),
vec![],
Expand Down Expand Up @@ -2723,31 +2723,31 @@ mod decoder {
}
}

pub fn gas_coin_claim_mint_capability(
pub fn libra_coin_claim_mint_capability(
payload: &TransactionPayload,
) -> Option<EntryFunctionCall> {
if let TransactionPayload::EntryFunction(_script) = payload {
Some(EntryFunctionCall::GasCoinClaimMintCapability {})
Some(EntryFunctionCall::LibraCoinClaimMintCapability {})
} else {
None
}
}

pub fn gas_coin_delegate_mint_capability(
pub fn libra_coin_delegate_mint_capability(
payload: &TransactionPayload,
) -> Option<EntryFunctionCall> {
if let TransactionPayload::EntryFunction(script) = payload {
Some(EntryFunctionCall::GasCoinDelegateMintCapability {
Some(EntryFunctionCall::LibraCoinDelegateMintCapability {
to: bcs::from_bytes(script.args().get(0)?).ok()?,
})
} else {
None
}
}

pub fn gas_coin_mint_to_impl(payload: &TransactionPayload) -> Option<EntryFunctionCall> {
pub fn libra_coin_mint_to_impl(payload: &TransactionPayload) -> Option<EntryFunctionCall> {
if let TransactionPayload::EntryFunction(script) = payload {
Some(EntryFunctionCall::GasCoinMintToImpl {
Some(EntryFunctionCall::LibraCoinMintToImpl {
dst_addr: bcs::from_bytes(script.args().get(0)?).ok()?,
amount: bcs::from_bytes(script.args().get(1)?).ok()?,
})
Expand Down Expand Up @@ -3335,16 +3335,16 @@ static SCRIPT_FUNCTION_DECODER_MAP: once_cell::sync::Lazy<EntryFunctionDecoderMa
Box::new(decoder::jail_unjail_by_voucher),
);
map.insert(
"gas_coin_claim_mint_capability".to_string(),
Box::new(decoder::gas_coin_claim_mint_capability),
"libra_coin_claim_mint_capability".to_string(),
Box::new(decoder::libra_coin_claim_mint_capability),
);
map.insert(
"gas_coin_delegate_mint_capability".to_string(),
Box::new(decoder::gas_coin_delegate_mint_capability),
"libra_coin_delegate_mint_capability".to_string(),
Box::new(decoder::libra_coin_delegate_mint_capability),
);
map.insert(
"gas_coin_mint_to_impl".to_string(),
Box::new(decoder::gas_coin_mint_to_impl),
"libra_coin_mint_to_impl".to_string(),
Box::new(decoder::libra_coin_mint_to_impl),
);
map.insert(
"multisig_account_add_owner".to_string(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module diem_framework::coin {
use diem_std::type_info;
// use diem_std::debug::print;

friend ol_framework::gas_coin;
friend ol_framework::libra_coin;
friend ol_framework::burn;
friend ol_framework::ol_account;
friend diem_framework::genesis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ module diem_framework::diem_governance {
use diem_framework::timestamp;
use diem_framework::voting;

use ol_framework::gas_coin::LibraCoin as GasCoin;
use ol_framework::libra_coin::LibraCoin;
// use diem_std::debug::print;


#[test_only]
use ol_framework::gas_coin;
use ol_framework::libra_coin;


/// The specified stake pool does not have sufficient stake to create a proposal
Expand Down Expand Up @@ -267,7 +267,7 @@ module diem_framework::diem_governance {
// has voted. This doesn't take into subsequent inflation/deflation (rewards are issued every epoch and gas fees
// are burnt after every transaction), but inflation/delation is very unlikely to have a major impact on total
// supply during the voting period.
let total_voting_token_supply = coin::supply<GasCoin>(); //////// 0L ////////
let total_voting_token_supply = coin::supply<LibraCoin>(); //////// 0L ////////
let early_resolution_vote_threshold = option::none<u128>();
if (option::is_some(&total_voting_token_supply)) {
let total_supply = *option::borrow(&total_voting_token_supply);
Expand Down Expand Up @@ -440,7 +440,7 @@ module diem_framework::diem_governance {
// stake::get_lockup_secs(stake_pool) >= proposal_expiration,
// error::invalid_argument(EINSUFFICIENT_STAKE_LOCKUP),
// );
let voting_power = coin::balance<GasCoin>(voter_address);
let voting_power = coin::balance<LibraCoin>(voter_address);
voting::vote<GovernanceProposal>(
&governance_proposal::create_empty_proposal(),
@diem_framework,
Expand Down Expand Up @@ -590,7 +590,7 @@ module diem_framework::diem_governance {
// core_resources: &signer, signer_address: address): signer acquires GovernanceResponsbility {
// system_addresses::assert_core_resource(core_resources);
// // Core resources account only has mint capability in tests/testnets.
// assert!(gas_Coin::has_mint_capability(core_resources), error::unauthenticated(EUNAUTHORIZED));
// assert!(libra_coin::has_mint_capability(core_resources), error::unauthenticated(EUNAUTHORIZED));
// get_signer(signer_address)
// }

Expand Down Expand Up @@ -909,21 +909,21 @@ module diem_framework::diem_governance {
// let pks = vector[pk_1, pk_2, pk_3];
// stake::create_validator_set(diem_framework, active_validators, pks);

let (burn_cap, mint_cap) = gas_coin::initialize_for_test(diem_framework);
coin::register<GasCoin>(proposer);
coin::register<GasCoin>(yes_voter);
coin::register<GasCoin>(no_voter);
let (burn_cap, mint_cap) = libra_coin::initialize_for_test(diem_framework);
coin::register<LibraCoin>(proposer);
coin::register<LibraCoin>(yes_voter);
coin::register<LibraCoin>(no_voter);

gas_coin::test_mint_to(diem_framework, signer::address_of(proposer), 50);
gas_coin::test_mint_to(diem_framework, signer::address_of(yes_voter), 10);
gas_coin::test_mint_to(diem_framework, signer::address_of(no_voter), 5);
libra_coin::test_mint_to(diem_framework, signer::address_of(proposer), 50);
libra_coin::test_mint_to(diem_framework, signer::address_of(yes_voter), 10);
libra_coin::test_mint_to(diem_framework, signer::address_of(no_voter), 5);
// // Spread stake among active and pending_inactive because both need to be accounted for when computing voting
// // power.
// stake::create_stake_pool(proposer, coin::mint(50, &mint_cap), coin::mint(50, &mint_cap), 10000);
// stake::create_stake_pool(yes_voter, coin::mint(10, &mint_cap), coin::mint(10, &mint_cap), 10000);
// stake::create_stake_pool(no_voter, coin::mint(5, &mint_cap), coin::mint(5, &mint_cap), 10000);
coin::destroy_mint_cap<GasCoin>(mint_cap);
coin::destroy_burn_cap<GasCoin>(burn_cap);
coin::destroy_mint_cap<LibraCoin>(mint_cap);
coin::destroy_burn_cap<LibraCoin>(burn_cap);
}

// #[test(diem_framework = @diem_framework)]
Expand Down
Loading

0 comments on commit 05591b7

Please sign in to comment.