Skip to content
Merged
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
109 changes: 55 additions & 54 deletions .github/workflows/dev-ecr-deploy.yml
Original file line number Diff line number Diff line change
@@ -1,54 +1,55 @@
name: Build & Tag Container, Push to ECR, Deploy to Dev

on:
push:
branches:
- master

jobs:
build:
name: Build, Tag & push to ECR, Deploy task
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Setup node
uses: actions/setup-node@v1

- name: Install Dependencies
run: yarn install

- name: Build
run: |
yarn clean
yarn build

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_CI_USER_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_CI_USER_SECRET_ACCESS_KEY }}
aws-region: us-east-2

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: optimism/rollup-full-node
IMAGE_TAG: latest
run: |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG

- name: Stop existing dev-rollup-full-node ECS task to auto-start task with new image
run: |
./.github/scripts/stop-ecs-task.sh dev-full-node full-node
./.github/scripts/stop-ecs-task.sh synthetix-dev-full-node full-node


- name: Logout of Amazon ECR
if: always()
run: docker logout ${{ steps.login-ecr.outputs.registry }}
# TODO: Uncomment when Dev works
#name: Build & Tag Container, Push to ECR, Deploy to Dev
#
#on:
# push:
# branches:
# - master
#
#jobs:
# build:
# name: Build, Tag & push to ECR, Deploy task
# runs-on: ubuntu-latest
#
# steps:
# - uses: actions/checkout@v2
# - name: Setup node
# uses: actions/setup-node@v1
#
# - name: Install Dependencies
# run: yarn install
#
# - name: Build
# run: |
# yarn clean
# yarn build
#
# - name: Configure AWS Credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-access-key-id: ${{ secrets.AWS_CI_USER_ACCESS_KEY_ID }}
# aws-secret-access-key: ${{ secrets.AWS_CI_USER_SECRET_ACCESS_KEY }}
# aws-region: us-east-2
#
# - name: Login to Amazon ECR
# id: login-ecr
# uses: aws-actions/amazon-ecr-login@v1
#
# - name: Build, tag, and push image to Amazon ECR
# env:
# ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
# ECR_REPOSITORY: optimism/rollup-full-node
# IMAGE_TAG: latest
# run: |
# docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
# docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
#
# - name: Stop existing dev-rollup-full-node ECS task to auto-start task with new image
# run: |
# ./.github/scripts/stop-ecs-task.sh dev-full-node full-node
# ./.github/scripts/stop-ecs-task.sh synthetix-dev-full-node full-node
#
#
# - name: Logout of Amazon ECR
# if: always()
# run: docker logout ${{ steps.login-ecr.outputs.registry }}
1 change: 1 addition & 0 deletions packages/core-utils/src/app/constants.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const ZERO_ADDRESS = '0x' + '00'.repeat(20)
export const INVALID_ADDRESS = '0xdeaDDeADDEaDdeaDdEAddEADDEAdDeadDEADDEaD'
39 changes: 39 additions & 0 deletions packages/core-utils/src/app/crypto.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
/* External Imports */
import { Md5 } from 'ts-md5'
import { ethers } from 'ethers'
import { TransactionRequest } from 'ethers/providers/abstract-provider'
import {
joinSignature,
resolveProperties,
serializeTransaction,
} from 'ethers/utils'

/* Internal Imports */
import { HashAlgorithm, HashFunction } from '../types'
Expand Down Expand Up @@ -54,3 +60,36 @@ export const hashFunctionFor = (algo: HashAlgorithm): HashFunction => {
throw Error(`HashAlgorithm ${algo} not supported.`)
}
}

/**
* Gets the tx signer address from the Tx Request and r, s, v.
*
* @param tx The Transaction Request.
* @param r The r parameter of the signature.
* @param s The s parameter of the signature.
* @param v The v parameter of the signature.
* @returns The signer's address.
*/
export const getTxSigner = async (
tx: TransactionRequest,
r: string,
s: string,
v: number
): Promise<string> => {
const txHash: string = ethers.utils.keccak256(
serializeTransaction(await resolveProperties(tx))
)

try {
return ethers.utils.recoverAddress(
ethers.utils.arrayify(txHash),
joinSignature({
s: add0x(s),
r: add0x(r),
v,
})
)
} catch (e) {
return undefined
}
}
2 changes: 1 addition & 1 deletion packages/core-utils/src/app/log.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import debug from 'debug'
import { Logger } from '../types'

export const LOG_NEWLINE_STRING = ' <\\n> '
export const LOG_NEWLINE_STRING = process.env.LOG_NEW_LINES ? '\n' : ' <\\n> '
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😀😀😀


/**
* Gets a logger specific to the provided identifier.
Expand Down
20 changes: 17 additions & 3 deletions packages/core-utils/src/app/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ export const sleep = (ms: number): Promise<void> => {
* @returns the string without "0x".
*/
export const remove0x = (str: string): string => {
if (str === undefined) {
return str
}
return str.startsWith('0x') ? str.slice(2) : str
}

Expand All @@ -89,6 +92,9 @@ export const remove0x = (str: string): string => {
* @returns the string with "0x".
*/
export const add0x = (str: string): string => {
if (str === undefined) {
return str
}
return str.startsWith('0x') ? str : '0x' + str
}

Expand Down Expand Up @@ -162,12 +168,20 @@ export const bnToHexString = (bn: BigNumber): string => {
}

/**
* Converts a JavaScript number to a hex string.
* Converts a JavaScript number to a big-endian hex string.
* @param number the JavaScript number to be converted.
* @param padToBytes the number of numeric bytes the resulting string should be, -1 if no padding should be done.
* @returns the JavaScript number as a string.
*/
export const numberToHexString = (number: number): string => {
return add0x(number.toString(16))
export const numberToHexString = (
number: number,
padToBytes: number = -1
): string => {
let str = number.toString(16)
if (padToBytes > 0 || str.length < padToBytes * 2) {
str = `${'0'.repeat(padToBytes * 2 - str.length)}${str}`
}
return add0x(str)
}

/**
Expand Down
1 change: 1 addition & 0 deletions packages/rollup-core/src/app/data/consumers/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export * from './l1-batch-submitter'
export * from './l2-batch-creator'
export * from './l2-batch-submitter'
export * from './verifier'
Loading