From 7a2099c8d81ba292ef9cb7f2a8c498dba41b4c39 Mon Sep 17 00:00:00 2001 From: evgeniy-scherbina Date: Wed, 3 Jan 2024 10:06:14 -0500 Subject: [PATCH] Temporary Setup with docker --- Dockerfile.dev | 17 +++++++++++++++++ build-docker.sh | 6 ++++++ core/vm/contracts.go | 14 ++++++++++++++ curl.sh | 4 ++++ 4 files changed, 41 insertions(+) create mode 100644 Dockerfile.dev create mode 100755 build-docker.sh create mode 100755 curl.sh diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 0000000000..e9e7435e3a --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,17 @@ +FROM golang:1.20-alpine + +# Set up dependencies +# bash, jq, curl for debugging +# git, make for installation +# libc-dev, gcc, linux-headers, eudev-dev are used for cgo and ledger installation +# RUN apk add bash git make libc-dev gcc linux-headers eudev-dev jq curl +RUN apk add make curl bash + +RUN mkdir -p $GOPATH/src/github.com/Kava-Labs/go-ethereum +WORKDIR $GOPATH/src/github.com/Kava-Labs/go-ethereum + +COPY . . +RUN make geth +RUN cp ./build/bin/geth /go/bin/ + +CMD ["geth","--dev","--http"] diff --git a/build-docker.sh b/build-docker.sh new file mode 100755 index 0000000000..8be0389f61 --- /dev/null +++ b/build-docker.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +docker build -t go-ethereum-dev -f Dockerfile.dev . + +# RUN +# docker run -it go-ethereum-dev sh \ No newline at end of file diff --git a/core/vm/contracts.go b/core/vm/contracts.go index 574bb9bef6..da3308d8bc 100644 --- a/core/vm/contracts.go +++ b/core/vm/contracts.go @@ -105,6 +105,7 @@ var PrecompiledContractsCancun = map[common.Address]PrecompiledContract{ common.BytesToAddress([]byte{8}): &bn256PairingIstanbul{}, common.BytesToAddress([]byte{9}): &blake2F{}, common.BytesToAddress([]byte{0x0a}): &kzgPointEvaluation{}, + //common.BytesToAddress([]byte{0x0b}): &sum3{}, } // PrecompiledContractsBLS contains the set of pre-compiled Ethereum @@ -231,6 +232,19 @@ func (c *sha256hash) Run(input []byte) ([]byte, error) { return h[:], nil } +type sum3 struct{} + +// RequiredGas returns the gas required to execute the pre-compiled contract. +// +// This method does not require any overflow checking as the input size gas costs +// required for anything significant is so high it's impossible to pay for. +func (c *sum3) RequiredGas(input []byte) uint64 { + return 1 +} +func (c *sum3) Run(input []byte) ([]byte, error) { + return input, nil +} + // RIPEMD160 implemented as a native contract. type ripemd160hash struct{} diff --git a/curl.sh b/curl.sh new file mode 100755 index 0000000000..9943b8b342 --- /dev/null +++ b/curl.sh @@ -0,0 +1,4 @@ +curl -X POST \ + --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}' \ + -H "Content-Type: application/json" \ + http://localhost:8545