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
53a4f2a6
Commit
53a4f2a6
authored
Dec 10, 2020
by
Kelvin Fichter
Committed by
GitHub
Dec 10, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor deployment updates (for fraud prover) (#113)
* Testing out deployment changes * Add nonce fix * Linted files
parent
cb4f29ef
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
40 additions
and
20 deletions
+40
-20
config.ts
packages/contracts/src/contract-deployment/config.ts
+4
-0
contract-dumps.ts
packages/contracts/src/contract-dumps.ts
+8
-0
OVM_ECDSAContractAccount.spec.ts
...t/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts
+8
-5
OVM_FraudVerifier.spec.ts
...test/contracts/OVM/verification/OVM_FraudVerifier.spec.ts
+3
-1
Lib_RLPWriter.spec.ts
...tracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts
+5
-2
Lib_MerkleTrie.spec.ts
...acts/test/contracts/libraries/trie/Lib_MerkleTrie.spec.ts
+12
-12
No files found.
packages/contracts/src/contract-deployment/config.ts
View file @
53a4f2a6
...
@@ -84,6 +84,10 @@ export const makeContractDeployConfig = async (
...
@@ -84,6 +84,10 @@ export const makeContractDeployConfig = async (
typeof
sequencer
===
'
string
'
typeof
sequencer
===
'
string
'
?
sequencer
?
sequencer
:
await
sequencer
.
getAddress
()
:
await
sequencer
.
getAddress
()
await
AddressManager
.
setAddress
(
'
OVM_DecompressionPrecompileAddress
'
,
'
0x4200000000000000000000000000000000000005
'
)
await
AddressManager
.
setAddress
(
'
OVM_Sequencer
'
,
sequencerAddress
)
await
AddressManager
.
setAddress
(
'
OVM_Sequencer
'
,
sequencerAddress
)
await
AddressManager
.
setAddress
(
'
Sequencer
'
,
sequencerAddress
)
await
AddressManager
.
setAddress
(
'
Sequencer
'
,
sequencerAddress
)
await
contracts
.
OVM_CanonicalTransactionChain
.
init
()
await
contracts
.
OVM_CanonicalTransactionChain
.
init
()
...
...
packages/contracts/src/contract-dumps.ts
View file @
53a4f2a6
...
@@ -215,6 +215,14 @@ export const makeStateDump = async (): Promise<any> => {
...
@@ -215,6 +215,14 @@ export const makeStateDump = async (): Promise<any> => {
)
)
}
}
dump
.
accounts
[
'
OVM_GasMetadata
'
]
=
{
address
:
'
0x06a506a506a506a506a506a506a506a506a506a5
'
,
code
:
'
0x00
'
,
codeHash
:
keccak256
(
'
0x00
'
),
storage
:
{},
abi
:
[],
}
return
dump
return
dump
}
}
...
...
packages/contracts/test/contracts/OVM/accounts/OVM_ECDSAContractAccount.spec.ts
View file @
53a4f2a6
...
@@ -25,8 +25,11 @@ const callPrecompile = async (
...
@@ -25,8 +25,11 @@ const callPrecompile = async (
if
(
gasLimit
)
{
if
(
gasLimit
)
{
return
Helper_PrecompileCaller
.
callPrecompile
(
return
Helper_PrecompileCaller
.
callPrecompile
(
precompile
.
address
,
precompile
.
address
,
precompile
.
interface
.
encodeFunctionData
(
functionName
,
functionParams
||
[]),
precompile
.
interface
.
encodeFunctionData
(
{
gasLimit
}
functionName
,
functionParams
||
[]
),
{
gasLimit
}
)
)
}
}
return
Helper_PrecompileCaller
.
callPrecompile
(
return
Helper_PrecompileCaller
.
callPrecompile
(
...
@@ -187,7 +190,7 @@ describe('OVM_ECDSAContractAccount', () => {
...
@@ -187,7 +190,7 @@ describe('OVM_ECDSAContractAccount', () => {
it
(
`should revert on incorrect nonce`
,
async
()
=>
{
it
(
`should revert on incorrect nonce`
,
async
()
=>
{
const
alteredNonceTx
=
{
const
alteredNonceTx
=
{
...
DEFAULT_EIP155_TX
,
...
DEFAULT_EIP155_TX
,
nonce
:
99
nonce
:
99
,
}
}
const
message
=
serializeNativeTransaction
(
alteredNonceTx
)
const
message
=
serializeNativeTransaction
(
alteredNonceTx
)
const
sig
=
await
signNativeTransaction
(
wallet
,
alteredNonceTx
)
const
sig
=
await
signNativeTransaction
(
wallet
,
alteredNonceTx
)
...
@@ -241,7 +244,7 @@ describe('OVM_ECDSAContractAccount', () => {
...
@@ -241,7 +244,7 @@ describe('OVM_ECDSAContractAccount', () => {
it
(
`should revert on insufficient gas`
,
async
()
=>
{
it
(
`should revert on insufficient gas`
,
async
()
=>
{
const
alteredInsufficientGasTx
=
{
const
alteredInsufficientGasTx
=
{
...
DEFAULT_EIP155_TX
,
...
DEFAULT_EIP155_TX
,
gasLimit
:
200000000
gasLimit
:
200000000
,
}
}
const
message
=
serializeNativeTransaction
(
alteredInsufficientGasTx
)
const
message
=
serializeNativeTransaction
(
alteredInsufficientGasTx
)
const
sig
=
await
signNativeTransaction
(
wallet
,
alteredInsufficientGasTx
)
const
sig
=
await
signNativeTransaction
(
wallet
,
alteredInsufficientGasTx
)
...
@@ -257,7 +260,7 @@ describe('OVM_ECDSAContractAccount', () => {
...
@@ -257,7 +260,7 @@ describe('OVM_ECDSAContractAccount', () => {
`0x
${
sig
.
r
}
`
,
//r
`0x
${
sig
.
r
}
`
,
//r
`0x
${
sig
.
s
}
`
,
//s
`0x
${
sig
.
s
}
`
,
//s
],
],
40000000
,
40000000
)
)
const
ovmREVERT
:
any
=
const
ovmREVERT
:
any
=
...
...
packages/contracts/test/contracts/OVM/verification/OVM_FraudVerifier.spec.ts
View file @
53a4f2a6
...
@@ -274,7 +274,9 @@ describe('OVM_FraudVerifier', () => {
...
@@ -274,7 +274,9 @@ describe('OVM_FraudVerifier', () => {
DUMMY_BATCH_HEADERS
[
0
],
DUMMY_BATCH_HEADERS
[
0
],
batchProof
batchProof
)
)
).
to
.
be
.
revertedWith
(
'
Post-state root global index must equal to the pre state root global index plus one.
'
)
).
to
.
be
.
revertedWith
(
'
Post-state root global index must equal to the pre state root global index plus one.
'
)
})
})
})
})
...
...
packages/contracts/test/contracts/libraries/rlp/Lib_RLPWriter.spec.ts
View file @
53a4f2a6
...
@@ -45,8 +45,11 @@ describe('Lib_RLPWriter', () => {
...
@@ -45,8 +45,11 @@ describe('Lib_RLPWriter', () => {
describe
(
'
Use of library with other memory-modifying operations
'
,
()
=>
{
describe
(
'
Use of library with other memory-modifying operations
'
,
()
=>
{
it
(
'
should allow creation of a contract beforehand and still work
'
,
async
()
=>
{
it
(
'
should allow creation of a contract beforehand and still work
'
,
async
()
=>
{
const
randomAddress
=
'
0x1234123412341234123412341234123412341234
'
const
randomAddress
=
'
0x1234123412341234123412341234123412341234
'
const
rlpEncodedRandomAddress
=
'
0x941234123412341234123412341234123412341234
'
const
rlpEncodedRandomAddress
=
const
encoded
=
await
Lib_RLPWriter
.
callStatic
.
writeAddressWithOtherMemory
(
randomAddress
)
'
0x941234123412341234123412341234123412341234
'
const
encoded
=
await
Lib_RLPWriter
.
callStatic
.
writeAddressWithOtherMemory
(
randomAddress
)
expect
(
encoded
).
to
.
eq
(
rlpEncodedRandomAddress
)
expect
(
encoded
).
to
.
eq
(
rlpEncodedRandomAddress
)
})
})
})
})
...
...
packages/contracts/test/contracts/libraries/trie/Lib_MerkleTrie.spec.ts
View file @
53a4f2a6
...
@@ -114,26 +114,26 @@ describe('Lib_MerkleTrie', () => {
...
@@ -114,26 +114,26 @@ describe('Lib_MerkleTrie', () => {
})
})
if
(
i
>
3
)
{
if
(
i
>
3
)
{
it
(
`should revert when the proof node does not pass the root check`
,
async
()
=>
{
it
(
`should revert when the proof node does not pass the root check`
,
async
()
=>
{
const
test
=
await
generator
.
makeInclusionProofTest
(
i
-
1
)
const
test
=
await
generator
.
makeInclusionProofTest
(
i
-
1
)
const
test2
=
await
generator
.
makeInclusionProofTest
(
i
-
2
)
const
test2
=
await
generator
.
makeInclusionProofTest
(
i
-
2
)
await
expect
(
await
expect
(
Lib_MerkleTrie
.
get
(
test2
.
key
,
test
.
proof
,
test
.
root
)
Lib_MerkleTrie
.
get
(
test2
.
key
,
test
.
proof
,
test
.
root
)
).
to
.
be
.
revertedWith
(
"
Invalid large internal hash
"
)
).
to
.
be
.
revertedWith
(
'
Invalid large internal hash
'
)
})
})
it
(
`should revert when the first proof element is not the root node`
,
async
()
=>
{
it
(
`should revert when the first proof element is not the root node`
,
async
()
=>
{
const
test
=
await
generator
.
makeInclusionProofTest
(
0
)
const
test
=
await
generator
.
makeInclusionProofTest
(
0
)
let
decodedProof
=
rlp
.
decode
(
test
.
proof
)
let
decodedProof
=
rlp
.
decode
(
test
.
proof
)
decodedProof
[
0
].
write
(
'
abcd
'
,
8
)
// change the 1st element (root) of the proof
decodedProof
[
0
].
write
(
'
abcd
'
,
8
)
// change the 1st element (root) of the proof
const
badProof
=
rlp
.
encode
(
decodedProof
as
rlp
.
Input
)
const
badProof
=
rlp
.
encode
(
decodedProof
as
rlp
.
Input
)
await
expect
(
await
expect
(
Lib_MerkleTrie
.
get
(
test
.
key
,
badProof
,
test
.
root
)
Lib_MerkleTrie
.
get
(
test
.
key
,
badProof
,
test
.
root
)
).
to
.
be
.
revertedWith
(
"
Invalid root hash
"
)
).
to
.
be
.
revertedWith
(
'
Invalid root hash
'
)
})
})
it
(
`should be false when calling get on an incorrect key`
,
async
()
=>
{
it
(
`should be false when calling get on an incorrect key`
,
async
()
=>
{
const
test
=
await
generator
.
makeInclusionProofTest
(
i
-
1
)
const
test
=
await
generator
.
makeInclusionProofTest
(
i
-
1
)
let
newKey
=
test
.
key
.
slice
(
0
,
test
.
key
.
length
-
8
)
let
newKey
=
test
.
key
.
slice
(
0
,
test
.
key
.
length
-
8
)
newKey
=
newKey
.
concat
(
'
88888888
'
)
newKey
=
newKey
.
concat
(
'
88888888
'
)
expect
(
expect
(
await
Lib_MerkleTrie
.
get
(
newKey
,
test
.
proof
,
test
.
root
)
await
Lib_MerkleTrie
.
get
(
newKey
,
test
.
proof
,
test
.
root
)
).
to
.
deep
.
equal
([
false
,
'
0x
'
])
).
to
.
deep
.
equal
([
false
,
'
0x
'
])
})
})
...
@@ -158,11 +158,11 @@ describe('Lib_MerkleTrie', () => {
...
@@ -158,11 +158,11 @@ describe('Lib_MerkleTrie', () => {
const
test
=
await
generator
.
makeInclusionProofTest
(
0
)
const
test
=
await
generator
.
makeInclusionProofTest
(
0
)
let
decodedProof
=
rlp
.
decode
(
test
.
proof
)
let
decodedProof
=
rlp
.
decode
(
test
.
proof
)
decodedProof
[
0
].
write
(
'
a
'
,
3
)
// change the prefix
decodedProof
[
0
].
write
(
'
a
'
,
3
)
// change the prefix
test
.
root
=
ethers
.
utils
.
keccak256
(
toHexString
(
decodedProof
[
0
]))
;
test
.
root
=
ethers
.
utils
.
keccak256
(
toHexString
(
decodedProof
[
0
]))
const
badProof
=
rlp
.
encode
(
decodedProof
as
rlp
.
Input
)
const
badProof
=
rlp
.
encode
(
decodedProof
as
rlp
.
Input
)
await
expect
(
await
expect
(
Lib_MerkleTrie
.
get
(
test
.
key
,
badProof
,
test
.
root
)
Lib_MerkleTrie
.
get
(
test
.
key
,
badProof
,
test
.
root
)
).
to
.
be
.
revertedWith
(
"
Received a node with an unknown prefix
"
)
).
to
.
be
.
revertedWith
(
'
Received a node with an unknown prefix
'
)
})
})
})
})
})
})
\ No newline at end of file
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