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
eeed99ed
Commit
eeed99ed
authored
Mar 11, 2023
by
clabby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove old diff testing script
parent
cfd2c0a5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
230 deletions
+1
-230
package.json
packages/contracts-bedrock/package.json
+1
-1
differential-testing.ts
packages/contracts-bedrock/scripts/differential-testing.ts
+0
-229
No files found.
packages/contracts-bedrock/package.json
View file @
eeed99ed
...
...
@@ -17,7 +17,7 @@
"bindings"
:
"cd ../../op-bindings && make"
,
"build:forge"
:
"forge build"
,
"build:with-metadata"
:
"FOUNDRY_PROFILE=echidna yarn build:forge"
,
"build:differential"
:
"
tsc scripts/differential-testing.ts --outDir dist --moduleResolution node --esModuleInterop &&
go build -o ./scripts/differential-testing/differential-testing ./scripts/differential-testing"
,
"build:differential"
:
"go build -o ./scripts/differential-testing/differential-testing ./scripts/differential-testing"
,
"build:fuzz"
:
"(cd test-case-generator && go build ./cmd/fuzz.go)"
,
"prebuild"
:
"yarn ts-node scripts/verify-foundry-install.ts"
,
"build"
:
"hardhat compile && yarn autogen:artifacts && yarn build:ts && yarn typechain"
,
...
...
packages/contracts-bedrock/scripts/differential-testing.ts
deleted
100644 → 0
View file @
cfd2c0a5
import
{
BigNumber
,
utils
,
constants
}
from
'
ethers
'
import
{
decodeVersionedNonce
,
hashCrossDomainMessage
,
DepositTx
,
SourceHashDomain
,
encodeCrossDomainMessage
,
hashWithdrawal
,
hashOutputRootProof
,
}
from
'
@eth-optimism/core-utils
'
import
{
SecureTrie
}
from
'
@ethereumjs/trie
'
import
{
Account
,
Address
,
toBuffer
,
bufferToHex
}
from
'
@ethereumjs/util
'
import
{
predeploys
}
from
'
../src
'
const
{
hexZeroPad
,
keccak256
}
=
utils
const
args
=
process
.
argv
.
slice
(
2
)
const
command
=
args
[
0
]
;(
async
()
=>
{
switch
(
command
)
{
case
'
decodeVersionedNonce
'
:
{
const
input
=
BigNumber
.
from
(
args
[
1
])
const
{
nonce
,
version
}
=
decodeVersionedNonce
(
input
)
const
output
=
utils
.
defaultAbiCoder
.
encode
(
[
'
uint256
'
,
'
uint256
'
],
[
nonce
.
toHexString
(),
version
.
toHexString
()]
)
process
.
stdout
.
write
(
output
)
break
}
case
'
encodeCrossDomainMessage
'
:
{
const
nonce
=
BigNumber
.
from
(
args
[
1
])
const
sender
=
args
[
2
]
const
target
=
args
[
3
]
const
value
=
BigNumber
.
from
(
args
[
4
])
const
gasLimit
=
BigNumber
.
from
(
args
[
5
])
const
data
=
args
[
6
]
const
encoding
=
encodeCrossDomainMessage
(
nonce
,
sender
,
target
,
value
,
gasLimit
,
data
)
const
output
=
utils
.
defaultAbiCoder
.
encode
([
'
bytes
'
],
[
encoding
])
process
.
stdout
.
write
(
output
)
break
}
case
'
hashCrossDomainMessage
'
:
{
const
nonce
=
BigNumber
.
from
(
args
[
1
])
const
sender
=
args
[
2
]
const
target
=
args
[
3
]
const
value
=
BigNumber
.
from
(
args
[
4
])
const
gasLimit
=
BigNumber
.
from
(
args
[
5
])
const
data
=
args
[
6
]
const
hash
=
hashCrossDomainMessage
(
nonce
,
sender
,
target
,
value
,
gasLimit
,
data
)
const
output
=
utils
.
defaultAbiCoder
.
encode
([
'
bytes32
'
],
[
hash
])
process
.
stdout
.
write
(
output
)
break
}
case
'
hashDepositTransaction
'
:
{
// The solidity transaction hash computation currently only works with
// user deposits. System deposit transaction hashing is not supported.
const
l1BlockHash
=
args
[
1
]
const
logIndex
=
BigNumber
.
from
(
args
[
2
])
const
from
=
args
[
3
]
const
to
=
args
[
4
]
const
mint
=
BigNumber
.
from
(
args
[
5
])
const
value
=
BigNumber
.
from
(
args
[
6
])
const
gas
=
BigNumber
.
from
(
args
[
7
])
const
data
=
args
[
8
]
const
tx
=
new
DepositTx
({
l1BlockHash
,
logIndex
,
from
,
to
,
mint
,
value
,
gas
,
data
,
isSystemTransaction
:
false
,
domain
:
SourceHashDomain
.
UserDeposit
,
})
const
digest
=
tx
.
hash
()
const
output
=
utils
.
defaultAbiCoder
.
encode
([
'
bytes32
'
],
[
digest
])
process
.
stdout
.
write
(
output
)
break
}
case
'
encodeDepositTransaction
'
:
{
const
from
=
args
[
1
]
const
to
=
args
[
2
]
const
value
=
BigNumber
.
from
(
args
[
3
])
const
mint
=
BigNumber
.
from
(
args
[
4
])
const
gasLimit
=
BigNumber
.
from
(
args
[
5
])
const
isCreate
=
args
[
6
]
===
'
true
'
?
true
:
false
const
data
=
args
[
7
]
const
l1BlockHash
=
args
[
8
]
const
logIndex
=
BigNumber
.
from
(
args
[
9
])
const
tx
=
new
DepositTx
({
from
,
to
:
isCreate
?
null
:
to
,
value
,
mint
,
gas
:
gasLimit
,
data
,
l1BlockHash
,
logIndex
,
domain
:
SourceHashDomain
.
UserDeposit
,
})
const
raw
=
tx
.
encode
()
const
output
=
utils
.
defaultAbiCoder
.
encode
([
'
bytes
'
],
[
raw
])
process
.
stdout
.
write
(
output
)
break
}
case
'
hashWithdrawal
'
:
{
const
nonce
=
BigNumber
.
from
(
args
[
1
])
const
sender
=
args
[
2
]
const
target
=
args
[
3
]
const
value
=
BigNumber
.
from
(
args
[
4
])
const
gas
=
BigNumber
.
from
(
args
[
5
])
const
data
=
args
[
6
]
const
hash
=
hashWithdrawal
(
nonce
,
sender
,
target
,
value
,
gas
,
data
)
const
output
=
utils
.
defaultAbiCoder
.
encode
([
'
bytes32
'
],
[
hash
])
process
.
stdout
.
write
(
output
)
break
}
case
'
hashOutputRootProof
'
:
{
const
version
=
hexZeroPad
(
BigNumber
.
from
(
args
[
1
]).
toHexString
(),
32
)
const
stateRoot
=
hexZeroPad
(
BigNumber
.
from
(
args
[
2
]).
toHexString
(),
32
)
const
messagePasserStorageRoot
=
hexZeroPad
(
BigNumber
.
from
(
args
[
3
]).
toHexString
(),
32
)
const
latestBlockhash
=
hexZeroPad
(
BigNumber
.
from
(
args
[
4
]).
toHexString
(),
32
)
const
hash
=
hashOutputRootProof
({
version
,
stateRoot
,
messagePasserStorageRoot
,
latestBlockhash
,
})
const
output
=
utils
.
defaultAbiCoder
.
encode
([
'
bytes32
'
],
[
hash
])
process
.
stdout
.
write
(
output
)
break
}
case
'
getProveWithdrawalTransactionInputs
'
:
{
const
nonce
=
BigNumber
.
from
(
args
[
1
])
const
sender
=
args
[
2
]
const
target
=
args
[
3
]
const
value
=
BigNumber
.
from
(
args
[
4
])
const
gas
=
BigNumber
.
from
(
args
[
5
])
const
data
=
args
[
6
]
// Compute the withdrawalHash
const
withdrawalHash
=
hashWithdrawal
(
nonce
,
sender
,
target
,
value
,
gas
,
data
)
// Compute the storage slot the withdrawalHash will be stored in
const
slot
=
utils
.
defaultAbiCoder
.
encode
(
[
'
bytes32
'
,
'
bytes32
'
],
[
withdrawalHash
,
utils
.
hexZeroPad
(
'
0x
'
,
32
)]
)
const
key
=
keccak256
(
slot
)
// Create the account storage trie
const
storage
=
new
SecureTrie
()
// Put a bool "true" into storage
await
storage
.
put
(
toBuffer
(
key
),
toBuffer
(
'
0x01
'
))
// Put the storage root into the L2ToL1MessagePasser storage
const
address
=
Address
.
fromString
(
predeploys
.
L2ToL1MessagePasser
)
const
account
=
Account
.
fromAccountData
({
nonce
:
0
,
balance
:
0
,
stateRoot
:
storage
.
root
,
})
const
world
=
new
SecureTrie
()
await
world
.
put
(
address
.
toBuffer
(),
account
.
serialize
())
const
proof
=
await
SecureTrie
.
createProof
(
storage
,
toBuffer
(
key
))
const
outputRoot
=
hashOutputRootProof
({
version
:
constants
.
HashZero
,
stateRoot
:
bufferToHex
(
world
.
root
),
messagePasserStorageRoot
:
bufferToHex
(
storage
.
root
),
latestBlockhash
:
constants
.
HashZero
,
})
const
output
=
utils
.
defaultAbiCoder
.
encode
(
[
'
bytes32
'
,
'
bytes32
'
,
'
bytes32
'
,
'
bytes32
'
,
'
bytes[]
'
],
[
world
.
root
,
storage
.
root
,
outputRoot
,
withdrawalHash
,
proof
]
)
process
.
stdout
.
write
(
output
)
break
}
}
})().
catch
((
err
:
Error
)
=>
{
console
.
error
(
err
)
process
.
stdout
.
write
(
''
)
})
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