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
f89c4510
Unverified
Commit
f89c4510
authored
Mar 06, 2023
by
mergify[bot]
Committed by
GitHub
Mar 06, 2023
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' into fix-slow-finality
parents
7df082bb
179e3d04
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
9 deletions
+78
-9
metal-feet-give.md
.changeset/metal-feet-give.md
+5
-0
package.json
packages/atst/package.json
+14
-0
index.ts
packages/atst/src/index.ts
+0
-2
getEvents.ts
packages/atst/src/lib/getEvents.ts
+1
-1
ParseBytesReturn.ts
packages/atst/src/types/ParseBytesReturn.ts
+1
-1
tsup.config.ts
packages/atst/tsup.config.ts
+1
-1
.gas-snapshot
packages/contracts-bedrock/.gas-snapshot
+4
-4
Bytes.t.sol
packages/contracts-bedrock/contracts/test/Bytes.t.sol
+52
-0
No files found.
.changeset/metal-feet-give.md
0 → 100644
View file @
f89c4510
---
'
@eth-optimism/atst'
:
minor
---
Move react api to @eth-optimism/atst/react so react isn't required to run the core sdk
packages/atst/package.json
View file @
f89c4510
...
...
@@ -6,6 +6,20 @@
"types"
:
"src/index.ts"
,
"module"
:
"dist/index.cjs"
,
"license"
:
"MIT"
,
"exports"
:
{
"."
:
{
"types"
:
"./src/index.ts"
,
"default"
:
"./dist/index.js"
,
"import"
:
"./dist/index.js"
,
"require"
:
"./dist/index.cjs"
},
"./react"
:
{
"types"
:
"./src/react.ts"
,
"default"
:
"./dist/react.js"
,
"import"
:
"./dist/react.js"
,
"require"
:
"./dist/react.cjs"
}
},
"bin"
:
{
"atst"
:
"./dist/cli.js"
},
...
...
packages/atst/src/index.ts
View file @
f89c4510
...
...
@@ -28,5 +28,3 @@ export type { AttestationCreatedEvent } from './types/AttestationCreatedEvent'
export
type
{
AttestationReadParams
}
from
'
./types/AttestationReadParams
'
export
type
{
DataTypeOption
}
from
'
./types/DataTypeOption
'
export
type
{
WagmiBytes
}
from
'
./types/WagmiBytes
'
// react
export
*
from
'
./react
'
packages/atst/src/lib/getEvents.ts
View file @
f89c4510
import
{
ethers
}
from
'
ethers
'
import
{
Address
}
from
'
wagmi
'
import
type
{
Address
}
from
'
@wagmi/core
'
import
{
ATTESTATION_STATION_ADDRESS
}
from
'
../constants/attestationStationAddress
'
import
{
abi
}
from
'
../lib/abi
'
...
...
packages/atst/src/types/ParseBytesReturn.ts
View file @
f89c4510
import
{
BigNumber
}
from
'
ethers
'
import
{
Address
}
from
'
wagmi
'
import
type
{
Address
}
from
'
@wagmi/core
'
import
{
DataTypeOption
}
from
'
./DataTypeOption
'
import
{
WagmiBytes
}
from
'
./WagmiBytes
'
...
...
packages/atst/tsup.config.ts
View file @
f89c4510
...
...
@@ -10,7 +10,7 @@ export default defineConfig({
*
* @see https://tsup.egoist.dev/#building-cli-app
*/
entry
:
[
'
src/index.ts
'
,
'
src/cli.ts
'
],
entry
:
[
'
src/index.ts
'
,
'
src/cli.ts
'
,
'
src/react.ts
'
],
outDir
:
'
dist
'
,
target
:
'
es2021
'
,
// will create a .js file for commonjs and a .cjs file for esm
...
...
packages/contracts-bedrock/.gas-snapshot
View file @
f89c4510
Bytes_slice_Test:test_slice_acrossMultipleWords_works() (gas: 94
2
3)
Bytes_slice_Test:test_slice_acrossWords_works() (gas: 14
18
)
Bytes_slice_Test:test_slice_fromNonZeroIdx_works() (gas: 17
154
)
Bytes_slice_Test:test_slice_fromZeroIdx_works() (gas: 20
694
)
Bytes_slice_Test:test_slice_acrossMultipleWords_works() (gas: 94
1
3)
Bytes_slice_Test:test_slice_acrossWords_works() (gas: 14
30
)
Bytes_slice_Test:test_slice_fromNonZeroIdx_works() (gas: 17
240
)
Bytes_slice_Test:test_slice_fromZeroIdx_works() (gas: 20
826
)
Bytes_toNibbles_Test:test_toNibbles_expectedResult128Bytes_works() (gas: 129874)
Bytes_toNibbles_Test:test_toNibbles_expectedResult5Bytes_works() (gas: 6132)
Bytes_toNibbles_Test:test_toNibbles_zeroLengthInput_works() (gas: 944)
...
...
packages/contracts-bedrock/contracts/test/Bytes.t.sol
View file @
f89c4510
...
...
@@ -122,6 +122,58 @@ contract Bytes_slice_Test is Test {
vm.expectRevert("slice_overflow");
Bytes.slice(_input, _start, _length);
}
/**
* @notice Tests that the `slice` function correctly updates the free memory pointer depending
* on the length of the slice.
*/
function testFuzz_slice_memorySafety_succeeds(
bytes memory _input,
uint256 _start,
uint256 _length
) public {
// The start should never be more than the length of the input bytes array - 1
vm.assume(_start < _input.length);
// The length should never be more than the length of the input bytes array - the starting
// slice index.
vm.assume(_length <= _input.length - _start);
// Grab the free memory pointer before the slice operation
uint256 initPtr;
assembly {
initPtr := mload(0x40)
}
// Slice the input bytes array from `_start` to `_start + _length`
bytes memory slice = Bytes.slice(_input, _start, _length);
// Grab the free memory pointer after the slice operation
uint256 finalPtr;
assembly {
finalPtr := mload(0x40)
}
// The free memory pointer should have been updated properly
if (_length == 0) {
// If the slice length is zero, only 32 bytes of memory should have been allocated.
assertEq(finalPtr, initPtr + 0x20);
} else {
// If the slice length is greater than zero, the memory allocated should be the
// length of the slice rounded up to the next 32 byte word + 32 bytes for the
// length of the byte array.
//
// Note that we use a slightly less efficient, but equivalent method of rounding
// up `_length` to the next multiple of 32 than is used in the `slice` function.
// This is to diff test the method used in `slice`.
assertEq(finalPtr, initPtr + 0x20 + (((_length + 0x1F) >> 5) << 5));
// Sanity check for equivalence of the rounding methods.
assertEq(((_length + 0x1F) >> 5) << 5, (_length + 0x1F) & ~uint256(0x1F));
}
// The slice length should be equal to `_length`
assertEq(slice.length, _length);
}
}
contract Bytes_toNibbles_Test is Test {
...
...
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