Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nebula
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
exchain
nebula
Commits
841d7851
Unverified
Commit
841d7851
authored
Sep 01, 2021
by
elenadimitrova
Committed by
Kelvin Fichter
Nov 10, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove suggested dead code by slither
parent
6e44a1fc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
169 deletions
+0
-169
Lib_OVMCodec.sol
...ages/contracts/contracts/libraries/codec/Lib_OVMCodec.sol
+0
-35
Lib_RLPWriter.sol
packages/contracts/contracts/libraries/rlp/Lib_RLPWriter.sol
+0
-17
Lib_Bytes32Utils.sol
.../contracts/contracts/libraries/utils/Lib_Bytes32Utils.sol
+0
-37
Lib_BytesUtils.sol
...es/contracts/contracts/libraries/utils/Lib_BytesUtils.sol
+0
-80
No files found.
packages/contracts/contracts/libraries/codec/Lib_OVMCodec.sol
View file @
841d7851
...
@@ -118,41 +118,6 @@ library Lib_OVMCodec {
...
@@ -118,41 +118,6 @@ library Lib_OVMCodec {
return keccak256(encodeTransaction(_transaction));
return keccak256(encodeTransaction(_transaction));
}
}
/**
* @notice RLP-encodes an account state struct.
* @param _account Account state struct.
* @return RLP-encoded account state.
*/
function encodeEVMAccount(
EVMAccount memory _account
)
internal
pure
returns (
bytes memory
)
{
bytes[] memory raw = new bytes[](4);
// Unfortunately we can't create this array outright because
// Lib_RLPWriter.writeList will reject fixed-size arrays. Assigning
// index-by-index circumvents this issue.
raw[0] = Lib_RLPWriter.writeBytes(
Lib_Bytes32Utils.removeLeadingZeros(
bytes32(_account.nonce)
)
);
raw[1] = Lib_RLPWriter.writeBytes(
Lib_Bytes32Utils.removeLeadingZeros(
bytes32(_account.balance)
)
);
raw[2] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.storageRoot));
raw[3] = Lib_RLPWriter.writeBytes(abi.encodePacked(_account.codeHash));
return Lib_RLPWriter.writeList(raw);
}
/**
/**
* @notice Decodes an RLP-encoded account state into a useful struct.
* @notice Decodes an RLP-encoded account state into a useful struct.
* @param _encoded RLP-encoded account state.
* @param _encoded RLP-encoded account state.
...
...
packages/contracts/contracts/libraries/rlp/Lib_RLPWriter.sol
View file @
841d7851
...
@@ -89,23 +89,6 @@ library Lib_RLPWriter {
...
@@ -89,23 +89,6 @@ library Lib_RLPWriter {
return writeBytes(abi.encodePacked(_in));
return writeBytes(abi.encodePacked(_in));
}
}
/**
* RLP encodes a bytes32 value.
* @param _in The bytes32 to encode.
* @return _out The RLP encoded bytes32 in bytes.
*/
function writeBytes32(
bytes32 _in
)
internal
pure
returns (
bytes memory _out
)
{
return writeBytes(abi.encodePacked(_in));
}
/**
/**
* RLP encodes a uint.
* RLP encodes a uint.
* @param _in The uint256 to encode.
* @param _in The uint256 to encode.
...
...
packages/contracts/contracts/libraries/utils/Lib_Bytes32Utils.sol
View file @
841d7851
...
@@ -77,41 +77,4 @@ library Lib_Bytes32Utils {
...
@@ -77,41 +77,4 @@ library Lib_Bytes32Utils {
{
{
return bytes32(uint256(_in));
return bytes32(uint256(_in));
}
}
/**
* Removes the leading zeros from a bytes32 value and returns a new (smaller) bytes value.
* @param _in Input bytes32 value.
* @return Bytes32 without any leading zeros.
*/
function removeLeadingZeros(
bytes32 _in
)
internal
pure
returns (
bytes memory
)
{
bytes memory out;
assembly {
// Figure out how many leading zero bytes to remove.
let shift := 0
for { let i := 0 } and(lt(i, 32), eq(byte(i, _in), 0)) { i := add(i, 1) } {
shift := add(shift, 1)
}
// Reserve some space for our output and fix the free memory pointer.
out := mload(0x40)
mstore(0x40, add(out, 0x40))
// Shift the value and store it into the output bytes.
mstore(add(out, 0x20), shl(mul(shift, 8), _in))
// Store the new size (with leading zero bytes removed) in the output byte size.
mstore(out, sub(32, shift))
}
return out;
}
}
}
packages/contracts/contracts/libraries/utils/Lib_BytesUtils.sol
View file @
841d7851
...
@@ -100,23 +100,6 @@ library Lib_BytesUtils {
...
@@ -100,23 +100,6 @@ library Lib_BytesUtils {
return slice(_bytes, _start, _bytes.length - _start);
return slice(_bytes, _start, _bytes.length - _start);
}
}
function toBytes32PadLeft(
bytes memory _bytes
)
internal
pure
returns (
bytes32
)
{
bytes32 ret;
uint256 len = _bytes.length <= 32 ? _bytes.length : 32;
assembly {
ret := shr(mul(sub(32, len), 8), mload(add(_bytes, 32)))
}
return ret;
}
function toBytes32(
function toBytes32(
bytes memory _bytes
bytes memory _bytes
)
)
...
@@ -149,69 +132,6 @@ library Lib_BytesUtils {
...
@@ -149,69 +132,6 @@ library Lib_BytesUtils {
return uint256(toBytes32(_bytes));
return uint256(toBytes32(_bytes));
}
}
function toUint24(
bytes memory _bytes,
uint256 _start
)
internal
pure
returns (
uint24
)
{
require(_start + 3 >= _start, "toUint24_overflow");
require(_bytes.length >= _start + 3 , "toUint24_outOfBounds");
uint24 tempUint;
assembly {
tempUint := mload(add(add(_bytes, 0x3), _start))
}
return tempUint;
}
function toUint8(
bytes memory _bytes,
uint256 _start
)
internal
pure
returns (
uint8
)
{
require(_start + 1 >= _start, "toUint8_overflow");
require(_bytes.length >= _start + 1 , "toUint8_outOfBounds");
uint8 tempUint;
assembly {
tempUint := mload(add(add(_bytes, 0x1), _start))
}
return tempUint;
}
function toAddress(
bytes memory _bytes,
uint256 _start
)
internal
pure
returns (
address
)
{
require(_start + 20 >= _start, "toAddress_overflow");
require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
address tempAddress;
assembly {
tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
}
return tempAddress;
}
function toNibbles(
function toNibbles(
bytes memory _bytes
bytes memory _bytes
)
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment