Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Symbolic Executor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blockchains
UTXO Chains
Symbolic Executor
Commits
f7594310
Commit
f7594310
authored
2 years ago
by
vincent
Browse files
Options
Downloads
Patches
Plain Diff
[BTCMachine] Remove unused parameter in _min_bytes_needed
parent
7ac79378
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
symbolic_execution/hardware/machines/btc_machine.py
+8
-8
8 additions, 8 deletions
symbolic_execution/hardware/machines/btc_machine.py
with
8 additions
and
8 deletions
symbolic_execution/hardware/machines/btc_machine.py
+
8
−
8
View file @
f7594310
...
...
@@ -48,7 +48,7 @@ class BTCVector:
BTC_FALSE
=
IntVal
(
0
)
@classmethod
def
_min_bytes_needed
(
cls
,
val
:
ExprRef
,
n
=
0
):
def
_min_bytes_needed
(
cls
,
val
:
ExprRef
):
return
If
(
val
==
0
,
IntVal
(
0
),
...
...
@@ -89,13 +89,13 @@ class BTCVector:
def
__add__
(
self
,
other
):
"""
Return the sum of 2 btc vectors.
"""
return
BTCVector
(
self
.
val
+
other
.
val
,
self
.
_min_bytes_needed
(
self
.
val
+
other
.
val
,
1
)
self
.
val
+
other
.
val
,
self
.
_min_bytes_needed
(
self
.
val
+
other
.
val
)
)
def
__sub__
(
self
,
other
):
"""
Return the difference of 2 btc vectors.
"""
return
BTCVector
(
self
.
val
-
other
.
val
,
self
.
_min_bytes_needed
(
self
.
val
-
other
.
val
,
1
)
self
.
val
-
other
.
val
,
self
.
_min_bytes_needed
(
self
.
val
-
other
.
val
)
)
def
__neg__
(
self
):
...
...
@@ -109,7 +109,7 @@ class BTCVector:
def
__eq__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val == other.val`.
"""
if
isinstance
(
other
,
int
):
other
=
BTCVector
(
IntVal
(
other
),
self
.
_min_bytes_needed
(
other
,
1
))
other
=
BTCVector
(
IntVal
(
other
),
self
.
_min_bytes_needed
(
other
))
return
BTCVector
(
If
(
And
(
self
.
val
==
other
.
val
,
self
.
size
==
other
.
size
),
...
...
@@ -206,10 +206,10 @@ class BTCVector:
def
__size__
(
self
):
"""
Return the number of bytes the vector is composed of.
"""
return
BTCVector
(
self
.
size
,
self
.
_min_bytes_needed
(
self
.
size
,
1
))
return
BTCVector
(
self
.
size
,
self
.
_min_bytes_needed
(
self
.
size
))
BTC_VECTOR_1
=
BTCVector
(
IntVal
(
1
),
BTCVector
.
_min_bytes_needed
(
1
,
1
))
BTC_VECTOR_1
=
BTCVector
(
IntVal
(
1
),
BTCVector
.
_min_bytes_needed
(
1
))
class
SymbolicConditionError
(
Exception
):
...
...
@@ -286,7 +286,7 @@ class BTCMachine(IStackBasedMachine, IRAMBasedMachine, ISymbolicMachine):
if
val
<
-
(
2
**
31
-
1
)
or
val
>
(
2
**
31
-
1
):
raise
ValueError
(
f
"
This integer is too large to be encoded:
{
val
}
.
"
)
val
=
IntVal
(
val
)
size
=
BTCVector
.
_min_bytes_needed
(
val
,
1
)
size
=
BTCVector
.
_min_bytes_needed
(
val
)
elif
isinstance
(
val
,
str
):
bytes_needed
=
len
(
val
)
//
2
# The string must be in hex format
if
bytes_needed
>
self
.
_word_size
//
8
:
...
...
@@ -381,7 +381,7 @@ class BTCMachine(IStackBasedMachine, IRAMBasedMachine, ISymbolicMachine):
def
count_stack_elements
(
self
,
n
:
int
=
0
)
->
BTCVector
:
"""
Return the number of elements on the stack {n}.
"""
return
BTCVector
(
self
.
_stack_sizes
[
n
],
BTCVector
.
_min_bytes_needed
(
self
.
_stack_sizes
[
n
]
,
1
)
self
.
_stack_sizes
[
n
],
BTCVector
.
_min_bytes_needed
(
self
.
_stack_sizes
[
n
])
)
# ######################## #
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment