Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geth Compatibility #71

Merged
merged 5 commits into from
Apr 7, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
23 changes: 21 additions & 2 deletions docker/geth/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,27 @@
FROM ethereum/client-go
## Begin ethereum/client-go
# Build Geth in a stock Go builder container
FROM golang:1.13-alpine as builder

RUN apk add --no-cache make gcc musl-dev linux-headers git

RUN mkdir /go-ethereum
RUN git clone https://github.com/K-Ho/go-ethereum.git /go-ethereum

Choose a reason for hiding this comment

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

Suggested change
RUN git clone https://github.com/K-Ho/go-ethereum.git /go-ethereum
RUN git clone https://github.com/ethereum-optimism/go-ethereum.git /go-ethereum

RUN cd /go-ethereum && make all

# Pull all binaries into a second stage deploy alpine container
FROM alpine:latest

RUN apk add --no-cache ca-certificates
COPY --from=builder /go-ethereum/build/bin/* /usr/local/bin/

EXPOSE 8545 8546 8547 30303 30303/udp

## end ethereum/client-go

RUN apk add --no-cache openssl jq
COPY rollup-fullnode.json /etc/
COPY entrypoint.sh /bin
RUN chmod +x /bin/entrypoint.sh

EXPOSE 9545
ENTRYPOINT ["sh", "/bin/entrypoint.sh"]
ENTRYPOINT ["sh", "/bin/entrypoint.sh"]
35 changes: 21 additions & 14 deletions packages/rollup-full-node/src/app/web3-rpc-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -491,21 +491,28 @@ export class DefaultWeb3Handler implements Web3Handler, FullnodeHandler {
throw Error(msg)
}

const receipt: OvmTransactionReceipt = await this.getTransactionReceipt(
ovmTxHash,
true
)
log.debug(
`Transaction receipt for ${rawOvmTx}: ${JSON.stringify(receipt)}`
)
if (!receipt || !receipt.status) {
log.debug(`Transaction reverted: ${rawOvmTx}, ovmTxHash: ${ovmTxHash}`)
throw new RevertError(receipt.revertMessage)
}

await this.processTransactionEvents(receipt)
this.context.provider
.waitForTransaction(internalTxHash)
.then(async () => {
const receipt: OvmTransactionReceipt = await this.getTransactionReceipt(
ovmTxHash,
true
)
log.debug(
`Transaction receipt for ${rawOvmTx}: ${JSON.stringify(receipt)}`
)
if (!receipt) {
log.error(`Unable to find receipt for raw ovm tx: ${rawOvmTx}`)
return
} else if (!receipt.status) {
log.debug(`Transaction reverted: ${rawOvmTx}`)
} else {
log.debug(`Transaction mined successfully: ${rawOvmTx}`)
await this.processTransactionEvents(receipt)
}
this.blockTimestamps[receipt.blockNumber] = timestamp
})
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks good! I remember @willmeister raising a concern about the logic at the end of this function when it reverts. However, to me it looks good!

Choose a reason for hiding this comment

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

I was uncertain if waitForTransaction(...) throws on revert, but it doesn't. Also wanted to make sure that the timestamp was updated whether it was reverted or not, which it looks like this does.


this.blockTimestamps[receipt.blockNumber] = timestamp
log.debug(`Completed send raw tx [${rawOvmTx}]. Response: [${ovmTxHash}]`)
// Return the *OVM* tx hash. We can do this because we store a mapping to the ovmTxHashs in the EM contract.
return ovmTxHash
Expand Down