Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { NON_ZERO_ADDRESS } from '../../../helpers/constants'
import {
serializeNativeTransaction,
signNativeTransaction,
// `DEFAULT_EIP155_TX` comes with `chainId: 420` encoded as a key-value pair,
// along with other transaction data
DEFAULT_EIP155_TX,
serializeEthSignTransaction,
signEthSignMessage,
Expand Down Expand Up @@ -216,9 +218,11 @@ describe('OVM_ECDSAContractAccount', () => {
})

it(`should revert on incorrect chainId`, async () => {
// `DEFAULT_EIP155_TX` comes with `chainId: 420` encoded as a key-value
// pair, along with other transaction data.
const alteredChainIdTx = {
...DEFAULT_EIP155_TX,
chainId: 421,
chainId: 421, // Overwrites the default `chainId: 420`.
}
const message = serializeNativeTransaction(alteredChainIdTx)
const sig = await signNativeTransaction(wallet, alteredChainIdTx)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import {
encodeSequencerCalldata,
signNativeTransaction,
signEthSignMessage,
// `DEFAULT_EIP155_TX` comes with `chainId: 420` encoded as a key-value pair,
// along with other transaction data
DEFAULT_EIP155_TX,
serializeNativeTransaction,
serializeEthSignTransaction,
Expand Down
3 changes: 2 additions & 1 deletion test/helpers/codec/encoding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@ export interface SignatureParameters {
s: string
}

// Used in OVM_ECDSAContractAccount.spec.ts and OVM_SequencerEntrypoint.spec.ts
export const DEFAULT_EIP155_TX: EIP155Transaction = {
to: `0x${'12'.repeat(20)}`,
nonce: 100,
gasLimit: 1000000,
gasPrice: 100000000,
data: `0x${'99'.repeat(10)}`,
chainId: 420,
chainId: 420, // Encoding chainId. Test in OVM_ECDSAContractAccount.spec.ts
}

export const getRawSignedComponents = (signed: string): any[] => {
Expand Down