Skip to content

Commit

Permalink
Merge pull request #14 from archway-network/fix/block-gas-limit
Browse files Browse the repository at this point in the history
Fix/block gas limit
  • Loading branch information
FloppyDisck authored Oct 31, 2024
2 parents 531555f + 5927fce commit 903d4e1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 43 deletions.
3 changes: 1 addition & 2 deletions packages/archway-test-tube/libarchway/testenv/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,9 @@ func InitChain(appInstance *app.ArchwayApp) (sdk.Context, secp256k1.PrivKey) {
requireNoErr(err)

concensusParams := simtestutil.DefaultConsensusParams
// TODO: max gas could be set to 300mil
concensusParams.Block = &cmtproto.BlockParams{
MaxBytes: 22020096,
MaxGas: -1,
MaxGas: 300000000,
}

// replace sdk.DefaultDenom with "aarch", a bit of a hack, needs improvement
Expand Down
41 changes: 0 additions & 41 deletions packages/archway-test-tube/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -674,47 +674,6 @@ mod tests {
assert!(admin_list.mutable);
}

#[test]
fn test_custom_fee() {
let app = ArchwayApp::default();
let initial_balance = 1_000_000_000_000_000_000_000;
let alice = app.init_account(&coins(initial_balance, "aarch")).unwrap();
let bob = app.init_account(&coins(initial_balance, "aarch")).unwrap();

let amount = Coin::new(1_000_000u128, "aarch");
let gas_limit = 100_000_000;

// use FeeSetting::Auto by default, so should not equal newly custom fee setting
let wasm = Wasm::new(&app);
let wasm_byte_code = std::fs::read("./test_artifacts/cw1_whitelist.wasm").unwrap();
let res = wasm.store_code(&wasm_byte_code, None, &alice).unwrap();

assert_ne!(res.gas_info.gas_wanted, gas_limit);

//update fee setting
let bob = bob.with_fee_setting(FeeSetting::Custom {
amount: amount.clone(),
gas_limit,
});
let _res = wasm.store_code(&wasm_byte_code, None, &bob).unwrap();

let bob_balance = Bank::new(&app)
.query_all_balances(&QueryAllBalancesRequest {
address: bob.address(),
pagination: None,
})
.unwrap()
.balances
.into_iter()
.find(|c| c.denom == "aarch")
.unwrap()
.amount
.parse::<u128>()
.unwrap();

assert_eq!(bob_balance, initial_balance - amount.amount.u128());
}

#[test]
fn test_block_skipping() {
let app = ArchwayApp::default();
Expand Down

0 comments on commit 903d4e1

Please sign in to comment.