Skip to content

Commit

Permalink
Fix tests in exec::tests
Browse files Browse the repository at this point in the history
In particular, this commit removes the usage of `0` as unlimited
metering in the following tests:

- `nonce`
- `last_frame_output_works_on_instantiate`
- `instantiation_from_contract`
- `immutable_data_set_works_only_once`
- `immutable_data_set_errors_with_empty_data`
- `immutable_data_access_checks_work`
  • Loading branch information
rockbmb committed Dec 17, 2024
1 parent 2c33d23 commit ed1f312
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions substrate/frame/revive/src/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3098,8 +3098,8 @@ mod tests {
let (address, output) = ctx
.ext
.instantiate(
Weight::zero(),
U256::zero(),
Weight::MAX,
U256::from(u64::MAX),
dummy_ch,
<Test as Config>::Currency::minimum_balance().into(),
vec![],
Expand Down Expand Up @@ -3802,8 +3802,8 @@ mod tests {
let succ_fail_code = MockLoader::insert(Constructor, move |ctx, _| {
ctx.ext
.instantiate(
Weight::zero(),
U256::zero(),
Weight::MAX,
U256::from(u64::MAX),
fail_code,
ctx.ext.minimum_balance() * 100,
vec![],
Expand All @@ -3819,8 +3819,8 @@ mod tests {
let addr = ctx
.ext
.instantiate(
Weight::zero(),
U256::zero(),
Weight::MAX,
U256::from(u64::MAX),
success_code,
ctx.ext.minimum_balance() * 100,
vec![],
Expand Down Expand Up @@ -4597,7 +4597,7 @@ mod tests {
// Successful instantiation should set the output
let address = ctx
.ext
.instantiate(Weight::zero(), U256::zero(), ok_ch, value, vec![], None)
.instantiate(Weight::MAX, U256::from(u64::MAX), ok_ch, value, vec![], None)
.unwrap();
assert_eq!(
ctx.ext.last_frame_output(),
Expand All @@ -4607,8 +4607,8 @@ mod tests {
// Balance transfers should reset the output
ctx.ext
.call(
Weight::zero(),
U256::zero(),
Weight::MAX,
U256::from(u64::MAX),
&address,
U256::from(1),
vec![],
Expand Down Expand Up @@ -4827,7 +4827,7 @@ mod tests {

// Constructors can not access the immutable data
ctx.ext
.instantiate(Weight::zero(), U256::zero(), dummy_ch, value, vec![], None)
.instantiate(Weight::MAX, U256::from(u64::MAX), dummy_ch, value, vec![], None)
.unwrap();

exec_success()
Expand Down Expand Up @@ -4944,7 +4944,7 @@ mod tests {
move |ctx, _| {
let value = <Test as Config>::Currency::minimum_balance().into();
ctx.ext
.instantiate(Weight::zero(), U256::zero(), dummy_ch, value, vec![], None)
.instantiate(Weight::MAX, U256::from(u64::MAX), dummy_ch, value, vec![], None)
.unwrap();

exec_success()
Expand Down Expand Up @@ -4989,7 +4989,7 @@ mod tests {
move |ctx, _| {
let value = <Test as Config>::Currency::minimum_balance().into();
ctx.ext
.instantiate(Weight::zero(), U256::zero(), dummy_ch, value, vec![], None)
.instantiate(Weight::MAX, U256::from(u64::MAX), dummy_ch, value, vec![], None)
.unwrap();

exec_success()
Expand Down

0 comments on commit ed1f312

Please sign in to comment.