Skip to content

Commit

Permalink
Remove even more spaces at end of lines (#192)
Browse files Browse the repository at this point in the history
  • Loading branch information
virgil-serbanuta authored Nov 22, 2024
1 parent 98f352e commit d63ac0c
Show file tree
Hide file tree
Showing 27 changed files with 151 additions and 151 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
code-quality:
name: 'Code Quality Checks'
Expand Down
2 changes: 1 addition & 1 deletion kllvm/ulm.k
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ module ULM-HOOKS
| "EVMC_FAILURE" [function]
| "EVMC_INVALID_INSTRUCTION" [function]
| "EVMC_UNDEFINED_INSTRUCTION" [function]
| "EVMC_OUT_OF_GAS" [function]
| "EVMC_OUT_OF_GAS" [function]
| "EVMC_BAD_JUMP_DESTINATION" [function]
| "EVMC_STACK_OVERFLOW" [function]
| "EVMC_STACK_UNDERFLOW" [function]
Expand Down
18 changes: 9 additions & 9 deletions rust-semantics/execution/let.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,23 +48,23 @@ module RUST-LET
<values> Values:Map => Values[NextId <- V] </values>
requires notBool mayBeDefaultTypedInt(V)
// Handling tuple assignments
// Handling tuple assignments
rule
let (Variable:PatternNoTopAlt | .PatternNoTopAlts , RemainingToAssign:Patterns):TuplePattern
= ptrValue(_,tuple(Val:Value, ValList:ValueList)) ;
let (Variable:PatternNoTopAlt | .PatternNoTopAlts , RemainingToAssign:Patterns):TuplePattern
= ptrValue(_,tuple(Val:Value, ValList:ValueList)) ;
=>
let Variable = ptrValue(null, Val);
~> let (RemainingToAssign:Patterns:TuplePatternItems):TuplePattern
let Variable = ptrValue(null, Val);
~> let (RemainingToAssign:Patterns:TuplePatternItems):TuplePattern
= ptrValue(null, tuple(ValList));
rule
let (.Patterns):TuplePattern = ptrValue(_,tuple(.ValueList));
let (.Patterns):TuplePattern = ptrValue(_,tuple(.ValueList));
=> .K
// Handles the case where the tuple pattern on the let expression has an extra comma, removing it
rule
let (Ps:Patterns,):TuplePattern = V:PtrValue;
let (Ps:Patterns,):TuplePattern = V:PtrValue;
=> let (Ps):TuplePattern = V;
Expand Down
4 changes: 2 additions & 2 deletions rust-semantics/expression/integer-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module RUST-INTEGER-ARITHMETIC-OPERATIONS
imports private RUST-SHARED-SYNTAX
imports private RUST-REPRESENTATION
// Operations are implemented only for the same types,
// Operations are implemented only for the same types,
// as implicit type casting (coercion) is not available
// in Rust.
Expand Down Expand Up @@ -69,7 +69,7 @@ module RUST-INTEGER-ARITHMETIC-OPERATIONS
requires B =/=K 0p64
rule ptrValue(_, i64(A):Value) % ptrValue(_, i64(B):Value) => ptrValue(null, i64(A %sMInt B))
requires B =/=K 0p64
rule ptrValue(_, u64(A):Value) * ptrValue(_, u64(B):Value) => ptrValue(null, u64(A *MInt B))
rule ptrValue(_, u64(A):Value) + ptrValue(_, u64(B):Value) => ptrValue(null, u64(A +MInt B))
rule ptrValue(_, u64(A):Value) - ptrValue(_, u64(B):Value) => ptrValue(null, u64(A -MInt B))
Expand Down
18 changes: 9 additions & 9 deletions rust-semantics/expression/loops.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,24 @@ module RUST-LOOP-EXPRESSIONS
syntax IteratorLoopExpression ::= "for1" Pattern "limit" PtrValue BlockExpression
| "for2" Pattern "limit" PtrValue BlockExpression
rule for Patt:Identifier:PatternNoTopAlt | R:PatternNoTopAlts in ptrValue(_, intRange(First, Last)) B:BlockExpression =>
rule for Patt:Identifier:PatternNoTopAlt | R:PatternNoTopAlts in ptrValue(_, intRange(First, Last)) B:BlockExpression =>
{
.InnerAttributes
let Patt = ptrValue(null, First);
(for1 Patt | R limit ptrValue(null, Last) B):IteratorLoopExpression;
(for1 Patt | R limit ptrValue(null, Last) B):IteratorLoopExpression;
.NonEmptyStatements
};
requires checkIntOfSameType(First, Last)
rule for1 Patt:Identifier:PatternNoTopAlt | .PatternNoTopAlts limit Last B:BlockExpression =>
if (Patt :: .PathExprSegments):PathExprSegments < Last
{
.InnerAttributes B;
(for2 Patt | .PatternNoTopAlts limit Last B):IteratorLoopExpression;
rule for1 Patt:Identifier:PatternNoTopAlt | .PatternNoTopAlts limit Last B:BlockExpression =>
if (Patt :: .PathExprSegments):PathExprSegments < Last
{
.InnerAttributes B;
(for2 Patt | .PatternNoTopAlts limit Last B):IteratorLoopExpression;
.NonEmptyStatements
};
rule for2 Patt:Identifier:PatternNoTopAlt | .PatternNoTopAlts limit ptrValue(_, LastValue) #as Last B:BlockExpression =>
rule for2 Patt:Identifier:PatternNoTopAlt | .PatternNoTopAlts limit ptrValue(_, LastValue) #as Last B:BlockExpression =>
incrementPatt(Patt, LastValue) ~> for1 Patt:Identifier:PatternNoTopAlt | .PatternNoTopAlts limit Last B
rule while (E:ExpressionExceptStructExpression) S:BlockExpression => if E { .InnerAttributes S; while(E)S; .NonEmptyStatements};
Expand Down
54 changes: 27 additions & 27 deletions rust-semantics/expression/struct.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,70 +16,70 @@ module RUST-EXPRESSION-STRUCT
| fromStructExpressionWithAssignmentsBuildFieldsMap(TypePath, StructExprFields, Map)
// From Struct Expression to struct(P, F). Case 1, field names are not given:
rule <k>
I:TypePath { L:StructBases } => fromStructExpressionWithLiteralsBuildFieldsMap(I, L, VL, .Map)
...
rule <k>
I:TypePath { L:StructBases } => fromStructExpressionWithLiteralsBuildFieldsMap(I, L, VL, .Map)
...
</k>
<struct-path> I </struct-path>
<field-list> VL </field-list>
rule <k> fromStructExpressionWithLiteralsBuildFieldsMap(I:TypePath, (E:Expression, RL):StructBases, FieldNameList:List, FieldsMap:Map)
=> E ~> fromStructExpressionWithLiteralsBuildFieldsMap(I, RL, FieldNameList, FieldsMap) ...
=> E ~> fromStructExpressionWithLiteralsBuildFieldsMap(I, RL, FieldNameList, FieldsMap) ...
</k>
rule
<k>
ptrValue(_, V:Value):PtrValue ~>
rule
<k>
ptrValue(_, V:Value):PtrValue ~>
fromStructExpressionWithLiteralsBuildFieldsMap(
I:TypePath,
RL:StructBases,
(FieldNameList):List ListItem(FieldName),
I:TypePath,
RL:StructBases,
(FieldNameList):List ListItem(FieldName),
FieldsMap:Map)
=> fromStructExpressionWithLiteralsBuildFieldsMap(I, RL, FieldNameList, FieldsMap (FieldName |-> NVI):Map )
...
=> fromStructExpressionWithLiteralsBuildFieldsMap(I, RL, FieldNameList, FieldsMap (FieldName |-> NVI):Map )
...
</k>
<values> VALUES:Map => VALUES[NVI <- V] </values>
<next-value-id> NVI:Int => NVI +Int 1 </next-value-id>
requires notBool (FieldName in_keys(FieldsMap))
requires notBool (FieldName in_keys(FieldsMap))
rule <k>
fromStructExpressionWithLiteralsBuildFieldsMap(I:TypePath, .StructBases, .List, FieldsMap:Map)
=> struct(I, FieldsMap)
...
rule <k>
fromStructExpressionWithLiteralsBuildFieldsMap(I:TypePath, .StructBases, .List, FieldsMap:Map)
=> struct(I, FieldsMap)
...
</k>
// From Struct Expression to struct(P, F). Case 2, field names are given:
rule <k>
I:TypePath { S:MaybeStructExprFieldsOrStructBase } => fromStructExpressionWithAssignmentsBuildFieldsMap(I, S, .Map)
...
rule <k>
I:TypePath { S:MaybeStructExprFieldsOrStructBase } => fromStructExpressionWithAssignmentsBuildFieldsMap(I, S, .Map)
...
</k>
rule <k>
rule <k>
fromStructExpressionWithAssignmentsBuildFieldsMap(
Name:TypePath,
Name:TypePath,
((FieldName:Identifier : Le:Expression):StructExprField, RS):StructExprFields,
FieldsMap:Map)
=> Le ~> FieldName ~> fromStructExpressionWithAssignmentsBuildFieldsMap(Name, RS, FieldsMap)
...
</k>
rule <k>
rule <k>
ptrValue(_, V:Value):PtrValue ~> FieldName:Identifier ~>
fromStructExpressionWithAssignmentsBuildFieldsMap(
Name:TypePath,
Name:TypePath,
RS:StructExprFields,
FieldsMap:Map
) =>
fromStructExpressionWithAssignmentsBuildFieldsMap(
Name, RS, FieldsMap (FieldName |-> NVI):Map
)
...
...
</k>
<values> VALUES:Map => VALUES[NVI <- V] </values>
<next-value-id> NVI:Int => NVI +Int 1 </next-value-id>
rule <k> fromStructExpressionWithAssignmentsBuildFieldsMap(
Name:TypePath,
Name:TypePath,
.StructExprFields,
FieldsMap:Map
) => struct(Name, FieldsMap)
Expand Down
6 changes: 3 additions & 3 deletions rust-semantics/preprocessing/initialization.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ module INITIALIZATION
...
</struct>
</structs>
rule
<k> structParser(Name:TypePath, ((FN:Identifier : FT:Type):StructField , RF:StructFields):StructFields) =>
<k> structParser(Name:TypePath, ((FN:Identifier : FT:Type):StructField , RF:StructFields):StructFields) =>
structParser(Name:TypePath, RF:StructFields)
...
</k>
Expand All @@ -38,7 +38,7 @@ module INITIALIZATION
</field>
...
</fields>
</struct>
</struct>
rule structParser(_Name:TypePath, .StructFields) => .K
Expand Down
6 changes: 3 additions & 3 deletions rust-semantics/representation.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,11 @@ module RUST-REPRESENTATION
rule checkIntOfType(u256(_), u256) => true
rule checkIntOfType(_, _) => false [owise]
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, u8) requires checkIntOfType(B, u8)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, u8) requires checkIntOfType(B, u8)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, i8) requires checkIntOfType(B, i8)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, u16) requires checkIntOfType(B, u16)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, u16) requires checkIntOfType(B, u16)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, i16) requires checkIntOfType(B, i16)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, u32) requires checkIntOfType(B, u32)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, u32) requires checkIntOfType(B, u32)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, i32) requires checkIntOfType(B, i32)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, u64) requires checkIntOfType(B, u64)
rule checkIntOfSameType(A:Value, B:Value) => checkIntOfType(A, i64) requires checkIntOfType(B, i64)
Expand Down
4 changes: 2 additions & 2 deletions tests/execution/constant_lookup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ pub trait ConstantValueLookup {

fn lookup_constant(&self) -> u64 { :: constant_lookup :: SAMPLE_CONSTANT }

fn lookup_constant_with_type(&self) -> u64 {
fn lookup_constant_with_type(&self) -> u64 {
let x = 100_u64 + :: constant_lookup :: SAMPLE_CONSTANT;
x
x
}

}
10 changes: 5 additions & 5 deletions tests/execution/if_expressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ pub trait IfExpressions {

#[upgrade]
fn upgrade(&self) {}
fn if_expression(&self) -> u64 {

fn if_expression(&self) -> u64 {

if 80_u64 == 80_u64 {
1_u64
}
}



}

fn if_else_expression(&self) -> u64 {
fn if_else_expression(&self) -> u64 {

if 80_u64 != 80_u64 {
1_u64
Expand All @@ -32,7 +32,7 @@ pub trait IfExpressions {

}

fn if_else_if_expression(&self) -> u64 {
fn if_else_if_expression(&self) -> u64 {

if 80_u64 != 80_u64 {
1_u64
Expand Down
14 changes: 7 additions & 7 deletions tests/execution/loops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,29 @@ pub trait LoopExpressions {

#[upgrade]
fn upgrade(&self) {}
fn iterator_evaluation(&self){

fn iterator_evaluation(&self){
for i in 1_u64..10_u64 {
let x = i * 2_u64;
};
}

fn while_evaluation(&self){
fn while_evaluation(&self){
while 1_u64 < 1_u64 {
let x: u64 = 2_u64;
let x: u64 = 2_u64;
};
}

fn iterator_with_variables(&self) {
fn iterator_with_variables(&self) {
let y = 20_u64;
let z = 10_u64;
let z = 10_u64;

for i in z..y {
let x = i * 2_u64;
};
}

fn iterator_with_same_pattern(&self) {
fn iterator_with_same_pattern(&self) {
let i = 1_u64;
for i in i..i+3_u64 {
let x = i * 2_u64;
Expand Down
4 changes: 2 additions & 2 deletions tests/execution/top_level_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ pub trait TopLevelFn {
#[upgrade]
fn upgrade(&self) {}

fn call_top_level(&self, v: u64) -> u64 {
fn call_top_level(&self, v: u64) -> u64 {
::top_level_fn::top_level(v)
}

fn call_top_level_no_arg(&self) -> u64 {
fn call_top_level_no_arg(&self) -> u64 {
::top_level_fn::top_level_no_arg()
}
}
Expand Down
4 changes: 2 additions & 2 deletions tests/syntax/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use multiversx_sc::imports::*;

pub const YEARLY_INTEREST: u64 = 7_000;
pub const BPS: u64 = 100_000;
pub const BPS: u64 = 100_000;
pub const SECONDS_IN_DAY: u64 = 24 * 60 * 60;
pub const SECONDS_IN_YEAR: u64 = 365_u64 * SECONDS_IN_DAY;

Expand Down Expand Up @@ -50,7 +50,7 @@ pub trait Staking {
self.call_value().single_fungible_esdt();
require!(token_id == self.staking_token().get(), "Wrong token ID.");
require!(amount > BigUint::zero(), "Amount must be greater than 0");

let caller =
self.blockchain().get_caller();
self.staked_balances(&caller).set(self.staked_balances(&caller).get() + &amount);
Expand Down
2 changes: 1 addition & 1 deletion tests/syntax/uniswap_v_2_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ mod pair_proxy {
#[view(getReserve0)]
#[storage_mapper("reserve0")]
fn reserve0(&self) -> SingleValueMapper<BigUint>;

#[view(getReserve1)]
#[storage_mapper("reserve1")]
fn reserve1(&self) -> SingleValueMapper<BigUint>;
Expand Down
8 changes: 4 additions & 4 deletions tests/ulm-contracts/ulm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub const EVMC_STATIC_MODE_VIOLATION: u64 = 13_u64;
pub const EVMC_PRECOMPILE_FAILURE: u64 = 14_u64;
pub const EVMC_NONCE_EXCEEDED: u64 = 15_u64;

extern {
extern {
// block parameters
fn sample_method(&self) -> u256;
fn GasLimit(&self) -> u256;
Expand All @@ -35,7 +35,7 @@ extern {
// transaction parameters
fn GasPrice(&self) -> u256;
fn Origin(&self) -> u256;

// message parameters
fn Address(&self) -> u160;
fn Caller(&self) -> u160;
Expand All @@ -44,7 +44,7 @@ extern {

// chain parameters
fn ChainId(&self) -> u256;

// account getters
fn GetAccountBalance(&self, acct: u160) -> u256;
fn GetAccountCode(&self, acct: u160) -> Bytes;
Expand All @@ -67,7 +67,7 @@ extern {
fn Log2(topic0: u256, topic1: u256, data: Bytes);
fn Log3(topic0: u256, topic1: u256, topic2: u256, data: Bytes);
fn Log4(topic0: u256, topic1: u256, topic2: u256, topic3: u256, data: Bytes);

fn MessageResult(gas: u256, data: Bytes, status: u256, target: u256) -> MessageResult;
fn Create(value: u256, data: Bytes, gas: u256) -> MessageResult;
fn Create2(value: u256, data: Bytes, salt: Bytes, gas: u256) -> MessageResult;
Expand Down
Loading

0 comments on commit d63ac0c

Please sign in to comment.