From 5e03b9affe3901e240a4a9df8d68dc2522811fe8 Mon Sep 17 00:00:00 2001 From: 0o-de-lally <1364012+0o-de-lally@users.noreply.github.com> Date: Thu, 26 Oct 2023 03:03:02 +0000 Subject: [PATCH] fixed supply casting issue in smoke tests --- .../sources/ol_sources/libra_coin.move | 14 +++++++-- .../sources/ol_sources/mock.move | 13 ++++---- .../sources/ol_sources/ol_account.move | 1 + framework/releases/head.mrb | Bin 589763 -> 590168 bytes smoke-tests/src/libra_smoke.rs | 8 +++-- tools/genesis/src/vm.rs | 2 +- tools/query/tests/query.rs | 4 +-- tools/query/tests/view.rs | 28 ++++++++++++++++++ tools/tower/tests/tower_newbie.rs | 4 ++- tools/txs/tests/sender_primitives.rs | 2 +- tools/txs/tests/transfer.rs | 2 +- 11 files changed, 60 insertions(+), 18 deletions(-) create mode 100644 tools/query/tests/view.rs diff --git a/framework/libra-framework/sources/ol_sources/libra_coin.move b/framework/libra-framework/sources/ol_sources/libra_coin.move index 493b8bbac..683acb57f 100644 --- a/framework/libra-framework/sources/ol_sources/libra_coin.move +++ b/framework/libra-framework/sources/ol_sources/libra_coin.move @@ -120,6 +120,7 @@ module ol_framework::gas_coin { use std::signer; use std::vector; use std::option::{Self, Option}; + // use diem_std::debug::print; use diem_framework::coin::{Self, MintCapability, BurnCapability}; use diem_framework::system_addresses; @@ -129,12 +130,16 @@ module ol_framework::gas_coin { friend diem_framework::genesis; friend ol_framework::genesis_migration; + const MAX_U64: u128 = 18446744073709551615; + /// Account does not have mint capability const ENO_CAPABILITIES: u64 = 1; /// Mint capability has already been delegated to this specified address const EALREADY_DELEGATED: u64 = 2; /// Cannot find delegation of mint capability to this account const EDELEGATION_NOT_FOUND: u64 = 3; + /// Supply somehow above MAX_U64 + const ESUPPLY_OVERFLOW: u64 = 4; struct LibraCoin has key {} @@ -258,12 +263,13 @@ module ol_framework::gas_coin { let supply_opt = coin::supply(); if (option::is_some(&supply_opt)) { let value = *option::borrow(&supply_opt); - if (value == 0) return 0u64; + assert!(value <= MAX_U64, ESUPPLY_OVERFLOW); return (value as u64) }; 0 } - + #[view] + /// debugging view public fun supply_128(): u128 { let supply_opt = coin::supply(); if (option::is_some(&supply_opt)) { @@ -302,7 +308,8 @@ module ol_framework::gas_coin { coin::register(core_resources); let coins = coin::mint( - 18446744073709551615, + 1000000 * 1000000, // core resources can have 1M coins, MAX_U64 was + // causing arthmetic errors calling supply() on downcast &mint_cap, ); coin::deposit(signer::address_of(core_resources), coins); @@ -332,6 +339,7 @@ module ol_framework::gas_coin { dst_addr: address, amount: u64, ) acquires MintCapStore { + let _s = supply(); // check we didn't overflow supply let account_addr = signer::address_of(root); diff --git a/framework/libra-framework/sources/ol_sources/mock.move b/framework/libra-framework/sources/ol_sources/mock.move index ef8957dc6..d6c91905b 100644 --- a/framework/libra-framework/sources/ol_sources/mock.move +++ b/framework/libra-framework/sources/ol_sources/mock.move @@ -24,11 +24,13 @@ module ol_framework::mock { use ol_framework::musical_chairs; use ol_framework::globals; use diem_framework::block; - // use diem_framework::chain_status; - use diem_std::debug::print; + + // use diem_std::debug::print; const ENO_GENESIS_END_MARKER: u64 = 1; - const EDID_NOT_ADVANCE_EPOCH: u64 = 1; + const EDID_NOT_ADVANCE_EPOCH: u64 = 2; + /// coin supply does not match expected + const ESUPPLY_MISMATCH: u64 = 3; #[test_only] public fun reset_val_perf_one(vm: &signer, addr: address) { @@ -203,14 +205,13 @@ module ol_framework::mock { let (burn_cap, mint_cap) = gas_coin::initialize_for_test_without_aggregator_factory(root); coin::destroy_burn_cap(burn_cap); - transaction_fee::initialize_fee_collection_and_distribution(root, 0); let initial_fees = 1000000 * 100; // coin scaling * 100 coins let tx_fees = coin::test_mint(initial_fees, &mint_cap); transaction_fee::vm_pay_fee(root, @ol_framework, tx_fees); let supply_pre = gas_coin::supply(); - assert!(supply_pre == initial_fees, 666); + assert!(supply_pre == initial_fees, ESUPPLY_MISMATCH); gas_coin::test_set_final_supply(root, initial_fees); mint_cap @@ -311,7 +312,6 @@ module ol_framework::mock { // genesis(); let set = genesis_n_vals(&root, 4); - print(&set); assert!(vector::length(&set) == 4, 7357001); let addr = vector::borrow(&set, 0); @@ -362,5 +362,4 @@ module ol_framework::mock { assert!(entry_fee == 999, 73570003); assert!(median_bid == 3, 73570004); } - } diff --git a/framework/libra-framework/sources/ol_sources/ol_account.move b/framework/libra-framework/sources/ol_sources/ol_account.move index 511671a00..7703e9451 100644 --- a/framework/libra-framework/sources/ol_sources/ol_account.move +++ b/framework/libra-framework/sources/ol_sources/ol_account.move @@ -324,6 +324,7 @@ module ol_framework::ol_account { if (exists(addr)) return; let (_, total_balance) = balance(addr); + move_to(sig, BurnTracker { prev_supply: gas_coin::supply(), prev_balance: total_balance, diff --git a/framework/releases/head.mrb b/framework/releases/head.mrb index 67f6abf62f96367178939a255f70c16dc36be162..304d46ee3d3a19b4a420992c2f90ac804d7037cd 100644 GIT binary patch delta 11426 zcmeI&RZ|?mvH)OU*@fUvaJS$Ni!K_1y9EgD65JOjfuI2v39x8zcXtvjxVyVc2zGPM zz5n38rmK3Yt7fWap1+>n7rOZn`k*kxI;6o|NnR-)0RetlIT=AY9$8^oDH(_WFP9L6 zm!C^WMox~0hYKPo%LU<);S%J6$OsGZ^YTgaN(&0e@N;p=Nb&MQU?_P=zo0F&RMDsi z{|Tg*6GJ~|vO(OJwQRFIB!RT?B%9$ljTCiR4Ff=wrJl+XoLObKmBHucBDTH#Yaitf$w)$LiIj12g?+%jdXl={p%0k(xAY)u`rIn=VS+{$kAsWcD+H2`6+jA(2%TO9r zWbmPbq`EUoqfmD2I@aw2&8W|Sg*vP{b<=vd#9;W~^pv(d<;H=WxO9b{@K3hB&WNW; zn?H{q__MViXLxFRY8%eu&*S^Y;W3U1v)b9d3JTi;alnLpa< z>L{d)t%v51g)NVsPpZGqzkfaFElNRLs%@|`s;P8zIyw`Ia_G|F#ha$0a5(59-Wt%g zuF4JsP=41;<8W1{6osn>htugqd9cuBh#F^7Dl%jds z7RTt?8XLtf_+&XI;l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<_e%yIGWu2QoW77gPLyHT*_EL8g!&Q^5XK{zpCSqt%gN?nS?B4Lz z_KlSZ0ngbu{|2~^`oo(WC*$?vkhqw*aI6V4r!A#5C8xW1BGSfH-Z8+3T=_s9HKt~A z@{@z%yH6y4tJr#zf|Prgz_@W#x9}KxA+>2-wd=tB)}1Vr7Nbq#v22=pw_FYQLJTkI zkQJh6mHgca#zE`rrw4I|Cm{^VxQg=5GWtI&3(wb<1do=ifO1A&vxOI#UenLw!TF1h z2g-7MHiCceh>Y&%Xc?YS_7zPxYh&A}?J6A`y!-5N0A@?0Q%S5PFJ1i5`ntgN)IE zhl(|T2S!}9q2RZ$&O&665ggU16bN@K2m@kj3Bm*_0fG>ZOOQJ>BoM^Y%iZ1C40}DWaU?d~}fQ0_P z+R#;qu_2flNCk$${%e5?d<{g#hyB+E%mPFQ!T>NJ7Ki`{0sQv?1Va))1EK(s06+jT z3YZm$4Z;Va{_h10L&Cvi1_RMRNJy^;p-4EmP$U#&9C8#0LSPNThW!6u9o8V6ScLy8 zMF&Aa%wRAIG89p{2BF5r7r;PA!bB3l1mpg9V&Nldgn$GX)L<;g|F_Wkzn#{|<2A^C NiPCbshU!B9e*lHd7t#O# diff --git a/smoke-tests/src/libra_smoke.rs b/smoke-tests/src/libra_smoke.rs index 9c20b87a2..5fd15491b 100644 --- a/smoke-tests/src/libra_smoke.rs +++ b/smoke-tests/src/libra_smoke.rs @@ -73,9 +73,13 @@ impl LibraSmoke { // the genesis does NOT mint by default to genesis validators // 10,000 coins with 6 decimals precision let mut pub_info = swarm.diem_public_info(); - helpers::mint_libra(&mut pub_info, addr, 100_000_000_000).await.context("could not mint to account")?; + helpers::mint_libra(&mut pub_info, addr, 1000 * 1000_000) + .await + .context("could not mint to account")?; - helpers::unlock_libra(&mut pub_info, addr, 100_000_000_000).await.context("could not unlock coins")?; + helpers::unlock_libra(&mut pub_info, addr, 1000 * 1000_000) + .await + .context("could not unlock coins")?; Ok(Self { swarm, diff --git a/tools/genesis/src/vm.rs b/tools/genesis/src/vm.rs index fea1ede36..0792fe3d0 100644 --- a/tools/genesis/src/vm.rs +++ b/tools/genesis/src/vm.rs @@ -26,7 +26,7 @@ use diem_vm_genesis::{ use libra_types::{legacy_types::legacy_recovery::LegacyRecovery, ol_progress::OLProgress}; use crate::{ - genesis_functions::{rounding_mint, set_validator_baseline_reward, set_final_supply}, + genesis_functions::{rounding_mint, set_final_supply, set_validator_baseline_reward}, supply::{populate_supply_stats_from_legacy, SupplySettings}, }; diff --git a/tools/query/tests/query.rs b/tools/query/tests/query.rs index ae5f669d7..95be6f9a8 100644 --- a/tools/query/tests/query.rs +++ b/tools/query/tests/query.rs @@ -15,8 +15,8 @@ async fn libra_query_test() { Ok(v) => { println!("v: {:?}", v); let b: LibraBalanceDisplay = serde_json::from_value(v).unwrap(); - assert!(b.unlocked == 100000.0); - assert!(b.total == 100000.0); + assert!(b.unlocked == 1000.0); + assert!(b.total == 1000.0); } Err(e) => { println!("e: {:?}", e); diff --git a/tools/query/tests/view.rs b/tools/query/tests/view.rs new file mode 100644 index 000000000..ee1600461 --- /dev/null +++ b/tools/query/tests/view.rs @@ -0,0 +1,28 @@ +use libra_query::query_type::QueryType; +use libra_smoke_tests::libra_smoke::LibraSmoke; + +/// Testing the query library +#[tokio::test(flavor = "multi_thread", worker_threads = 1)] +async fn libra_view_test() { + let mut s = LibraSmoke::new(None).await.expect("could not start swarm"); + + let c = s.client(); + + let q = QueryType::View { + function_id: "0x1::gas_coin::supply".to_string(), + type_args: None, + args: None, + }; + match q.query_to_json(Some(c.to_owned())).await { + Ok(v) => { + println!("v: {:?}", v); + // let b: LibraBalanceDisplay = serde_json::from_value(v).unwrap(); + // assert!(b.unlocked == 10.0); + // assert!(b.total == 10.0); + } + Err(e) => { + println!("e: {:?}", e); + panic!("nothing returned from query"); + } + } +} diff --git a/tools/tower/tests/tower_newbie.rs b/tools/tower/tests/tower_newbie.rs index 384b9fcb9..b7f1d9beb 100644 --- a/tools/tower/tests/tower_newbie.rs +++ b/tools/tower/tests/tower_newbie.rs @@ -1,3 +1,4 @@ +use anyhow::Context; use libra_smoke_tests::libra_smoke::LibraSmoke; use libra_txs::submit_transaction::Sender; @@ -25,7 +26,8 @@ async fn tower_newbie() -> anyhow::Result<()> { let mut s = Sender::from_app_cfg(&val_app_cfg, None).await?; let res = s .transfer(alice.child_0_owner.account, 10_000.0, false) - .await? + .await + .context("could not create account")? .unwrap(); assert!(res.info.status().is_success()); diff --git a/tools/txs/tests/sender_primitives.rs b/tools/txs/tests/sender_primitives.rs index 71f6cc6fa..249ce696b 100644 --- a/tools/txs/tests/sender_primitives.rs +++ b/tools/txs/tests/sender_primitives.rs @@ -26,7 +26,7 @@ async fn sender_back_and_forth() -> anyhow::Result<()> { // create an account for alice by transferring funds let mut s = Sender::from_app_cfg(&val_app_cfg, None).await?; let res = s - .transfer(alice.child_0_owner.account, 10_000.0, false) + .transfer(alice.child_0_owner.account, 100.0, false) .await? .unwrap(); assert!(res.info.status().is_success()); diff --git a/tools/txs/tests/transfer.rs b/tools/txs/tests/transfer.rs index 2c7999ac7..1130d269a 100644 --- a/tools/txs/tests/transfer.rs +++ b/tools/txs/tests/transfer.rs @@ -108,7 +108,7 @@ async fn smoke_transfer_estimate() { config_path: Some(d.path().to_owned().join("libra.yaml")), url: Some(s.api_endpoint.clone()), tx_profile: None, - tx_cost: Some(TxCost::default_baseline_cost()), + tx_cost: Some(TxCost::default_cheap_txs_cost()), estimate_only: true, };