Commit 53a4f2a6 authored by Kelvin Fichter's avatar Kelvin Fichter Committed by GitHub

Minor deployment updates (for fraud prover) (#113)

* Testing out deployment changes

* Add nonce fix

* Linted files
parent cb4f29ef
......@@ -84,6 +84,10 @@ export const makeContractDeployConfig = async (
typeof sequencer === 'string'
? sequencer
: await sequencer.getAddress()
await AddressManager.setAddress(
'OVM_DecompressionPrecompileAddress',
'0x4200000000000000000000000000000000000005'
)
await AddressManager.setAddress('OVM_Sequencer', sequencerAddress)
await AddressManager.setAddress('Sequencer', sequencerAddress)
await contracts.OVM_CanonicalTransactionChain.init()
......
......@@ -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
}
......
......@@ -25,8 +25,11 @@ const callPrecompile = async (
if (gasLimit) {
return Helper_PrecompileCaller.callPrecompile(
precompile.address,
precompile.interface.encodeFunctionData(functionName, functionParams || []),
{gasLimit}
precompile.interface.encodeFunctionData(
functionName,
functionParams || []
),
{ gasLimit }
)
}
return Helper_PrecompileCaller.callPrecompile(
......@@ -187,7 +190,7 @@ describe('OVM_ECDSAContractAccount', () => {
it(`should revert on incorrect nonce`, async () => {
const alteredNonceTx = {
...DEFAULT_EIP155_TX,
nonce : 99
nonce: 99,
}
const message = serializeNativeTransaction(alteredNonceTx)
const sig = await signNativeTransaction(wallet, alteredNonceTx)
......@@ -241,7 +244,7 @@ describe('OVM_ECDSAContractAccount', () => {
it(`should revert on insufficient gas`, async () => {
const alteredInsufficientGasTx = {
...DEFAULT_EIP155_TX,
gasLimit : 200000000
gasLimit: 200000000,
}
const message = serializeNativeTransaction(alteredInsufficientGasTx)
const sig = await signNativeTransaction(wallet, alteredInsufficientGasTx)
......@@ -257,7 +260,7 @@ describe('OVM_ECDSAContractAccount', () => {
`0x${sig.r}`, //r
`0x${sig.s}`, //s
],
40000000,
40000000
)
const ovmREVERT: any =
......
......@@ -274,7 +274,9 @@ describe('OVM_FraudVerifier', () => {
DUMMY_BATCH_HEADERS[0],
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.'
)
})
})
......
......@@ -45,8 +45,11 @@ describe('Lib_RLPWriter', () => {
describe('Use of library with other memory-modifying operations', () => {
it('should allow creation of a contract beforehand and still work', async () => {
const randomAddress = '0x1234123412341234123412341234123412341234'
const rlpEncodedRandomAddress = '0x941234123412341234123412341234123412341234'
const encoded = await Lib_RLPWriter.callStatic.writeAddressWithOtherMemory(randomAddress)
const rlpEncodedRandomAddress =
'0x941234123412341234123412341234123412341234'
const encoded = await Lib_RLPWriter.callStatic.writeAddressWithOtherMemory(
randomAddress
)
expect(encoded).to.eq(rlpEncodedRandomAddress)
})
})
......
......@@ -114,26 +114,26 @@ describe('Lib_MerkleTrie', () => {
})
if (i > 3) {
it(`should revert when the proof node does not pass the root check`, async () => {
const test = await generator.makeInclusionProofTest(i-1)
const test2 = await generator.makeInclusionProofTest(i-2)
await expect (
const test = await generator.makeInclusionProofTest(i - 1)
const test2 = await generator.makeInclusionProofTest(i - 2)
await expect(
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 () => {
const test = await generator.makeInclusionProofTest(0)
let decodedProof = rlp.decode(test.proof)
decodedProof[0].write('abcd', 8) // change the 1st element (root) of the proof
const badProof = rlp.encode(decodedProof as rlp.Input)
await expect (
await expect(
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 () => {
const test = await generator.makeInclusionProofTest(i-1)
const test = await generator.makeInclusionProofTest(i - 1)
let newKey = test.key.slice(0, test.key.length - 8)
newKey = newKey.concat('88888888')
expect (
expect(
await Lib_MerkleTrie.get(newKey, test.proof, test.root)
).to.deep.equal([false, '0x'])
})
......@@ -158,11 +158,11 @@ describe('Lib_MerkleTrie', () => {
const test = await generator.makeInclusionProofTest(0)
let decodedProof = rlp.decode(test.proof)
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)
await expect (
await expect(
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
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment