diff --git a/build.rs b/build.rs index 500de0e7..3d71d772 100644 --- a/build.rs +++ b/build.rs @@ -15,19 +15,19 @@ const CKB_HASH_PERSONALIZATION: &[u8] = b"ckb-default-hash"; const BINARIES: &[(&str, &str)] = &[ ( "generator", - "b1284ae3e3268611368b60c4e7f08b5086cd2d5c5f20c56c94051e689b658f7f", + "2dedb79afb0bffb21e01a832866cb32bd49bbde0af4b76e3c1fe8d7e1943cf52", ), ( "validator", - "9996e062253cd32ebf1b820c391b0103781ff943e66fc937e03cfc817759655f", + "30e56ee291fd106f752253654966e6789bf247d73ae731df5650361f26eb36cf", ), ( "generator_log", - "235e1c7a126c5e8954a4008a57301f45ad60074ac71e0ccaa730391afb2fddf3", + "a9ea7e5940b0c2cf21dd8a07bd9bce20aca3edc007ffb70a19f50ed6f4e9c418", ), ( "validator_log", - "8b25482e9c3a7c5070fe356aac24c999b7b60dc142a78f9134f0c58d99b56df4", + "3998335dc17c056512e51c8ad1e08ed147e54eb6fb78372b8203cda40c573bb3", ), ]; diff --git a/devtools/ci/integration-test.sh b/devtools/ci/integration-test.sh index 8fd66c51..1f2e395b 100644 --- a/devtools/ci/integration-test.sh +++ b/devtools/ci/integration-test.sh @@ -16,7 +16,7 @@ else fi cd $GODWOKEN_DIR # checkout https://github.com/nervosnetwork/godwoken/pull/659/head -git fetch origin 0dd1500455ca81c23addadff05399925921aa352 +git fetch origin ed9d3ab716ea5d5a8f22f5ea7e6c90e23b6a49a8 git checkout FETCH_HEAD git submodule update --init --recursive --depth=1 diff --git a/polyjuice-tests/Cargo.lock b/polyjuice-tests/Cargo.lock index 0296063f..7aea6330 100644 --- a/polyjuice-tests/Cargo.lock +++ b/polyjuice-tests/Cargo.lock @@ -733,7 +733,6 @@ dependencies = [ "gw-hash", "gw-types", "merkle-cbt", - "primitive-types", "sparse-merkle-tree", "thiserror", ] @@ -870,6 +869,7 @@ dependencies = [ "ckb-types", "gw-hash", "molecule", + "primitive-types", "sparse-merkle-tree", ] diff --git a/polyjuice-tests/src/helper.rs b/polyjuice-tests/src/helper.rs index 73b2c4ba..cb253de9 100644 --- a/polyjuice-tests/src/helper.rs +++ b/polyjuice-tests/src/helper.rs @@ -26,9 +26,10 @@ use gw_types::{ offchain::RunResult, packed::{ AllowedTypeHash, BatchSetMapping, BlockInfo, Fee, LogItem, RawL2Transaction, RollupConfig, - Script, Uint64, + Script, SetMapping, Uint64, }, prelude::*, + U256, }; use gw_types::{ offchain::RollupContext, @@ -126,13 +127,13 @@ pub enum Log { sudt_id: u32, from_addr: RegistryAddress, to_addr: RegistryAddress, - amount: u128, + amount: U256, }, SudtPayFee { sudt_id: u32, from_addr: RegistryAddress, block_producer_addr: RegistryAddress, - amount: u128, + amount: U256, }, PolyjuiceSystem { gas_used: u64, @@ -147,13 +148,13 @@ pub enum Log { }, } -fn parse_sudt_log_data(data: &[u8]) -> (RegistryAddress, RegistryAddress, u128) { +fn parse_sudt_log_data(data: &[u8]) -> (RegistryAddress, RegistryAddress, U256) { let from_addr = RegistryAddress::from_slice(&data[0..28]).expect("parse from_addr"); let to_addr = RegistryAddress::from_slice(&data[28..56]).expect("parse to_addr"); - let mut u128_bytes = [0u8; 16]; - u128_bytes.copy_from_slice(&data[56..56 + 16]); - let amount = u128::from_le_bytes(u128_bytes); + let mut u256_bytes = [0u8; 32]; + u256_bytes.copy_from_slice(&data[56..56 + 32]); + let amount = U256::from_little_endian(&mut u256_bytes); (from_addr, to_addr, amount) } @@ -164,7 +165,7 @@ pub fn parse_log(item: &LogItem) -> Log { match service_flag { GW_LOG_SUDT_TRANSFER => { let sudt_id: u32 = item.account_id().unpack(); - if data.len() != (28 + 28 + 16) { + if data.len() != (28 + 28 + 32) { panic!("Invalid data length: {}", data.len()); } let (from_addr, to_addr, amount) = parse_sudt_log_data(data); @@ -177,7 +178,7 @@ pub fn parse_log(item: &LogItem) -> Log { } GW_LOG_SUDT_PAY_FEE => { let sudt_id: u32 = item.account_id().unpack(); - if data.len() != (28 + 28 + 16) { + if data.len() != (28 + 28 + 32) { panic!("Invalid data length: {}", data.len()); } let (from_addr, block_producer_addr, amount) = parse_sudt_log_data(data); @@ -685,7 +686,7 @@ pub(crate) fn create_block_producer(state: &mut DummyState) -> RegistryAddress { pub(crate) fn create_eth_eoa_account( state: &mut DummyState, eth_address: &[u8; 20], - mint_ckb: u128, + mint_ckb: impl Into, ) -> (u32, [u8; 32]) { let script = build_eth_l2_script(eth_address); let script_hash = script.hash(); @@ -735,38 +736,6 @@ pub(crate) fn register_eoa_account( .expect("map reg addr to script hash"); } -#[derive(Default)] -struct SetMappingArgsBuilder { - method: u32, - gw_script_hash: [u8; 32], - fee: u64, -} -impl SetMappingArgsBuilder { - /// Set the SetMappingArgs builder's method. - fn method(mut self, method: u32) -> Self { - self.method = method; - self - } - /// Set the SetMappingArgs builder's gw script hash. - fn gw_script_hash(mut self, gw_script_hash: [u8; 32]) -> Self { - self.gw_script_hash = gw_script_hash; - self - } - /// Set the set mapping args‘s fee. - fn set_fee(mut self, fee: u64) -> Self { - self.fee = fee; - self - } - fn build(self) -> Vec { - let mut output: Vec = vec![0u8; 4]; - output[0..4].copy_from_slice(&self.method.to_le_bytes()[..]); - output.extend(self.gw_script_hash); - output.extend(ETH_REGISTRY_ACCOUNT_ID.to_le_bytes()); - output.extend(&self.fee.to_le_bytes()[..]); - output - } -} - pub enum SetMappingArgs { One(H256), Batch(Vec), @@ -783,16 +752,24 @@ pub(crate) fn eth_address_regiser( set_mapping_args: SetMappingArgs, ) -> Result { let args = match set_mapping_args { - SetMappingArgs::One(gw_script_hash) => SetMappingArgsBuilder::default() - .method(2u32) - .gw_script_hash(gw_script_hash.into()) - .set_fee(1000) - .build() - .pack(), + SetMappingArgs::One(gw_script_hash) => { + let fee = Fee::new_builder() + .registry_id(ETH_REGISTRY_ACCOUNT_ID.pack()) + .amount(U256::from(1000u64).pack()) + .build(); + let set_mapping = SetMapping::new_builder() + .fee(fee) + .gw_script_hash(gw_script_hash.pack()) + .build(); + let args = ETHAddrRegArgs::new_builder() + .set(ETHAddrRegArgsUnion::SetMapping(set_mapping)) + .build(); + args.as_bytes().pack() + } SetMappingArgs::Batch(gw_script_hashes) => { let fee = Fee::new_builder() .registry_id(ETH_REGISTRY_ACCOUNT_ID.pack()) - .amount(1000u64.pack()) + .amount(U256::from(1000u64).pack()) .build(); let batch_set_mapping = BatchSetMapping::new_builder() .fee(fee) diff --git a/polyjuice-tests/src/test_cases/call_selfdestruct.rs b/polyjuice-tests/src/test_cases/call_selfdestruct.rs index 19cf5cbf..e4e2b8e7 100644 --- a/polyjuice-tests/src/test_cases/call_selfdestruct.rs +++ b/polyjuice-tests/src/test_cases/call_selfdestruct.rs @@ -11,7 +11,7 @@ use gw_common::{ use gw_generator::traits::StateExt; use gw_store::chain_view::ChainView; use gw_store::traits::chain_store::ChainStore; -use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*}; +use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*, U256}; const SD_INIT_CODE: &str = include_str!("./evm-contracts/SelfDestruct.bin"); const CALL_SD_INIT_CODE: &str = include_str!("./evm-contracts/CallSelfDestruct.bin"); @@ -33,7 +33,7 @@ fn test_selfdestruct() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &beneficiary_address) .unwrap(), - 0 + U256::zero() ); // deploy SelfDestruct @@ -71,13 +71,13 @@ fn test_selfdestruct() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &sd_address) .unwrap(), - 200 + U256::from(200u64) ); assert_eq!( state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &beneficiary_address) .unwrap(), - 0 + U256::zero() ); // deploy CallSelfDestruct @@ -152,13 +152,13 @@ fn test_selfdestruct() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &sd_address) .unwrap(), - 0 + U256::zero() ); assert_eq!( state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &beneficiary_address) .unwrap(), - 200 + U256::from(200u64) ); block_number += 1; diff --git a/polyjuice-tests/src/test_cases/create2.rs b/polyjuice-tests/src/test_cases/create2.rs index aafd4772..71c17954 100644 --- a/polyjuice-tests/src/test_cases/create2.rs +++ b/polyjuice-tests/src/test_cases/create2.rs @@ -10,7 +10,7 @@ use gw_common::{builtins::ETH_REGISTRY_ACCOUNT_ID, state::State}; use gw_generator::traits::StateExt; use gw_store::chain_view::ChainView; use gw_store::traits::chain_store::ChainStore; -use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*}; +use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*, U256}; const SS_INIT_CODE: &str = include_str!("./evm-contracts/SimpleStorage.bin"); const CREATE2_IMPL_CODE: &str = include_str!("./evm-contracts/Create2Impl.bin"); @@ -59,7 +59,7 @@ fn test_create2() { let create2_contract_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(); - assert_eq!(create2_contract_balance, 0); + assert_eq!(create2_contract_balance, U256::zero()); let input_value_u128: u128 = 0x9a; // bytes32 salt @@ -128,7 +128,7 @@ fn test_create2() { let create2_account_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(); - assert_eq!(create2_account_balance, input_value_u128); + assert_eq!(create2_account_balance, U256::from(input_value_u128)); let run_result = simple_storage_get( &store, diff --git a/polyjuice-tests/src/test_cases/eth_addr_reg.rs b/polyjuice-tests/src/test_cases/eth_addr_reg.rs index 766d43db..238a2fce 100644 --- a/polyjuice-tests/src/test_cases/eth_addr_reg.rs +++ b/polyjuice-tests/src/test_cases/eth_addr_reg.rs @@ -5,7 +5,7 @@ use crate::helper::{ use gw_common::{registry_address::RegistryAddress, state::State}; use gw_generator::{error::TransactionError, traits::StateExt}; use gw_store::{chain_view::ChainView, traits::chain_store::ChainStore}; -use gw_types::{packed::RawL2Transaction, prelude::*}; +use gw_types::{packed::RawL2Transaction, prelude::*, U256}; const SS_INIT_CODE: &str = include_str!("./evm-contracts/SimpleStorage.bin"); @@ -79,7 +79,7 @@ fn test_update_eth_addr_reg_by_contract() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(), - 0u128 + U256::zero() ); state /* mint CKB to pay fee */ .mint_sudt(CKB_SUDT_ACCOUNT_ID, &address, 52000) @@ -88,7 +88,7 @@ fn test_update_eth_addr_reg_by_contract() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(), - 52000u128 + U256::from(52000u128) ); // update_eth_address_registry by `ETH Address Registry` layer2 contract @@ -110,7 +110,7 @@ fn test_update_eth_addr_reg_by_contract() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(), - 51000u128 + U256::from(51000u128) ); // try to register the same account again @@ -203,7 +203,7 @@ fn test_batch_set_mapping_by_contract() { // init accounts let from_eth_address = [1u8; 20]; let (from_id, _from_script_hash) = - helper::create_eth_eoa_account(&mut state, &from_eth_address, 400000); + helper::create_eth_eoa_account(&mut state, &from_eth_address, 400000u64); // create new EOAs which is not registered let eth_eoa_addresses = vec![[0xeeu8; 20], [0xefu8; 20]]; @@ -219,16 +219,16 @@ fn test_batch_set_mapping_by_contract() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(), - 0u128 + U256::zero() ); state /* mint CKB to pay fee */ - .mint_sudt(CKB_SUDT_ACCOUNT_ID, &address, 200000) + .mint_sudt(CKB_SUDT_ACCOUNT_ID, &address, 200000u64) .unwrap(); assert_eq!( state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(), - 200000u128 + U256::from(200000u128) ); } diff --git a/polyjuice-tests/src/test_cases/invalid_sudt_erc20_proxy.rs b/polyjuice-tests/src/test_cases/invalid_sudt_erc20_proxy.rs index 8aa5b96e..9272e993 100644 --- a/polyjuice-tests/src/test_cases/invalid_sudt_erc20_proxy.rs +++ b/polyjuice-tests/src/test_cases/invalid_sudt_erc20_proxy.rs @@ -9,7 +9,7 @@ use gw_common::{builtins::ETH_REGISTRY_ACCOUNT_ID, state::State}; use gw_generator::{error::TransactionError, traits::StateExt}; use gw_store::chain_view::ChainView; use gw_store::traits::chain_store::ChainStore; -use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*}; +use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*, U256}; const INVALID_SUDT_ERC20_PROXY_CODE: &str = include_str!("./evm-contracts/InvalidSudtERC20Proxy.bin"); @@ -82,10 +82,16 @@ fn test_invalid_sudt_erc20_proxy() { assert_eq!( state.get_sudt_balance(new_sudt_id, &address1).unwrap(), - 160000000000000000000000000000u128 + U256::from(160000000000000000000000000000u128) + ); + assert_eq!( + state.get_sudt_balance(new_sudt_id, &address2).unwrap(), + U256::zero() + ); + assert_eq!( + state.get_sudt_balance(new_sudt_id, &address2).unwrap(), + U256::zero() ); - assert_eq!(state.get_sudt_balance(new_sudt_id, &address2).unwrap(), 0); - assert_eq!(state.get_sudt_balance(new_sudt_id, &address2).unwrap(), 0); for (_idx, (from_id, args_str, success, return_data_str)) in [ // balanceOf(eoa1) ( diff --git a/polyjuice-tests/src/test_cases/parse_log_event.rs b/polyjuice-tests/src/test_cases/parse_log_event.rs index e9dcafb3..37b89d2b 100644 --- a/polyjuice-tests/src/test_cases/parse_log_event.rs +++ b/polyjuice-tests/src/test_cases/parse_log_event.rs @@ -9,7 +9,7 @@ use gw_common::{builtins::ETH_REGISTRY_ACCOUNT_ID, state::State}; use gw_generator::traits::StateExt; use gw_store::chain_view::ChainView; use gw_store::traits::chain_store::ChainStore; -use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*}; +use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*, U256}; const INIT_CODE: &str = include_str!("./evm-contracts/LogEvents.bin"); @@ -29,7 +29,7 @@ fn test_parse_log_event() { let from_balance1 = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &address) .unwrap(); - assert_eq!(from_balance1, 200000); + assert_eq!(from_balance1, U256::from(200000u64)); let mut block_number = 0; let deploy_value = 0xfa; @@ -75,7 +75,7 @@ fn test_parse_log_event() { { assert_eq!(&the_from_addr, &address); assert_eq!(&the_to_addr, &contract_addr); - assert_eq!(amount, deploy_value); + assert_eq!(amount, U256::from(deploy_value)); } else { panic!("unexpected polyjuice log"); } @@ -142,7 +142,7 @@ fn test_parse_log_event() { assert_eq!(&the_from_addr, &address); // The block producer id is `0` assert_eq!(&the_to_addr, &block_producer); - assert_eq!(amount, 1814); + assert_eq!(amount, U256::from(1814u64)); } else { panic!("unexpected polyjuice log"); } diff --git a/polyjuice-tests/src/test_cases/selfdestruct.rs b/polyjuice-tests/src/test_cases/selfdestruct.rs index 2aee6adf..f0a2602c 100644 --- a/polyjuice-tests/src/test_cases/selfdestruct.rs +++ b/polyjuice-tests/src/test_cases/selfdestruct.rs @@ -12,7 +12,7 @@ use gw_common::{ use gw_generator::traits::StateExt; use gw_store::chain_view::ChainView; use gw_store::traits::chain_store::ChainStore; -use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*}; +use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*, U256}; const INIT_CODE: &str = include_str!("./evm-contracts/SelfDestruct.bin"); @@ -35,7 +35,7 @@ fn test_selfdestruct() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &beneficiary_reg_addr) .unwrap(), - 0 + U256::zero() ); { @@ -87,13 +87,13 @@ fn test_selfdestruct() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &contract_reg_addr) .unwrap(), - 200 + U256::from(200) ); assert_eq!( state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &beneficiary_reg_addr) .unwrap(), - 0 + U256::zero() ); { // call SelfDestruct.done(); @@ -130,13 +130,13 @@ fn test_selfdestruct() { state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &contract_reg_addr) .unwrap(), - 0 + U256::zero() ); assert_eq!( state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &beneficiary_reg_addr) .unwrap(), - 200 + U256::from(200u64) ); { diff --git a/polyjuice-tests/src/test_cases/simple_transfer.rs b/polyjuice-tests/src/test_cases/simple_transfer.rs index 0a94ee3f..13dc3209 100644 --- a/polyjuice-tests/src/test_cases/simple_transfer.rs +++ b/polyjuice-tests/src/test_cases/simple_transfer.rs @@ -12,7 +12,7 @@ use gw_common::{ use gw_generator::traits::StateExt; use gw_store::chain_view::ChainView; use gw_store::traits::chain_store::ChainStore; -use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*}; +use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*, U256}; use std::convert::TryInto; const SS_INIT_CODE: &str = include_str!("./evm-contracts/SimpleStorage.bin"); @@ -23,7 +23,7 @@ fn test_simple_transfer() { let (store, mut state, generator) = setup(); let block_producer_id = helper::create_block_producer(&mut state); - let mint_balance: u128 = 400000; + let mint_balance = U256::from(400000u128); let from_eth_address = [1u8; 20]; let (from_id, _from_script_hash) = helper::create_eth_eoa_account(&mut state, &from_eth_address, mint_balance); @@ -41,7 +41,7 @@ fn test_simple_transfer() { let target_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &target_reg_addr) .unwrap(); - assert_eq!(target_balance, 0); + assert_eq!(target_balance, U256::zero()); // Deploy SimpleStorage let mut block_number = 0; @@ -79,7 +79,7 @@ fn test_simple_transfer() { let ss_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &ss_reg_addr) .unwrap(); - assert_eq!(ss_balance, 0); + assert_eq!(ss_balance, U256::zero()); let run_result = simple_storage_get( &store, &state, @@ -128,7 +128,7 @@ fn test_simple_transfer() { let st_contract_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &st_contract_reg_addr) .unwrap(); - assert_eq!(st_contract_balance, deploy_value); + assert_eq!(st_contract_balance, U256::from(deploy_value)); println!("================"); println!( @@ -178,11 +178,11 @@ fn test_simple_transfer() { let new_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &st_contract_reg_addr) .unwrap(); - assert_eq!(new_balance, old_balance - 1); + assert_eq!(new_balance, old_balance - 1u64); let target_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &target_reg_addr) .unwrap(); - assert_eq!(target_balance, 1); + assert_eq!(target_balance, U256::one()); } // TODO: check this logic: can't transfer to zero_address{0} @@ -285,11 +285,11 @@ fn test_simple_transfer() { let new_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &st_contract_reg_addr) .unwrap(); - assert_eq!(new_balance, old_balance - 1); + assert_eq!(new_balance, old_balance - 1u64); let ss_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &ss_reg_addr) .unwrap(); - assert_eq!(ss_balance, 1); + assert_eq!(ss_balance, U256::one()); println!("================"); let run_result = simple_storage_get( &store, @@ -344,11 +344,11 @@ fn test_simple_transfer() { let new_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &st_contract_reg_addr) .unwrap(); - assert_eq!(new_balance, old_balance - 1); + assert_eq!(new_balance, old_balance - 1u64); let ss_balance = state .get_sudt_balance(CKB_SUDT_ACCOUNT_ID, &ss_reg_addr) .unwrap(); - assert_eq!(ss_balance, 2); + assert_eq!(ss_balance, U256::from(2u64)); let run_result = simple_storage_get( &store, &state, diff --git a/polyjuice-tests/src/test_cases/sudt_erc20_proxy.rs b/polyjuice-tests/src/test_cases/sudt_erc20_proxy.rs index 08ffbe21..6e51832e 100644 --- a/polyjuice-tests/src/test_cases/sudt_erc20_proxy.rs +++ b/polyjuice-tests/src/test_cases/sudt_erc20_proxy.rs @@ -13,7 +13,7 @@ use gw_common::state::State; use gw_generator::{dummy_state::DummyState, error::TransactionError, traits::StateExt, Generator}; use gw_store::traits::chain_store::ChainStore; use gw_store::{chain_view::ChainView, Store}; -use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*}; +use gw_types::{bytes::Bytes, packed::RawL2Transaction, prelude::*, U256}; fn test_sudt_erc20_proxy_inner( generator: &Generator, @@ -77,7 +77,7 @@ fn test_sudt_erc20_proxy_inner( .mint_sudt( new_sudt_id, &from_reg_addr1, - 160000000000000000000000000000u128, + U256::from(160000000000000000000000000000u128), ) .unwrap(); @@ -85,19 +85,19 @@ fn test_sudt_erc20_proxy_inner( state .get_sudt_balance(new_sudt_id, &from_reg_addr1) .unwrap(), - 160000000000000000000000000000u128 + U256::from(160000000000000000000000000000u128) ); assert_eq!( state .get_sudt_balance(new_sudt_id, &from_reg_addr2) .unwrap(), - 0 + U256::zero() ); assert_eq!( state .get_sudt_balance(new_sudt_id, &from_reg_addr3) .unwrap(), - 0 + U256::zero() ); let total_supply = {