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

Audit branch #2

Open
wants to merge 47 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7a302d5
replace env variables and flags with urfav cli
Evan-Kim2028 Oct 29, 2024
4bc46ad
add main.go to top level and remove cmd directory
Evan-Kim2028 Oct 29, 2024
6b20668
rename core to internal, reorganize folder directory
Evan-Kim2028 Oct 29, 2024
e910aa0
update golang
Evan-Kim2028 Oct 29, 2024
0b86e53
replace context background with context timeout
Evan-Kim2028 Oct 30, 2024
e26c2dc
remove http client and use constant timeout variable to set timeout
Evan-Kim2028 Oct 30, 2024
4fcdc41
check body contents when function gets returned
Evan-Kim2028 Oct 30, 2024
4dabb5d
load environment variables before the cli app
Evan-Kim2028 Oct 30, 2024
2bcfdc5
remove unused logging module
Evan-Kim2028 Oct 30, 2024
39ccc5d
add priority fee
Evan-Kim2028 Oct 30, 2024
4744b8e
feat: turn the addresses into environmental variables
Evan-Kim2028 Oct 31, 2024
c677eb6
remove hard coded chain ID
Evan-Kim2028 Oct 31, 2024
f87c416
remove timer and have for loop run indefinitely
Evan-Kim2028 Oct 31, 2024
7aff508
update example .env file
Evan-Kim2028 Oct 31, 2024
38b3e93
update example .env file
Evan-Kim2028 Oct 31, 2024
bfc4e96
fix: linting
Evan-Kim2028 Oct 31, 2024
7ae287e
refactor: move client functions from main to client
Evan-Kim2028 Oct 31, 2024
37dc3a9
refactor: move sendpreconfbid from main to bidderapi
Evan-Kim2028 Oct 31, 2024
1d6c268
refactor: replace eth_transfer and blob .env variables with single nu…
Evan-Kim2028 Oct 31, 2024
8bd9dbb
feat: add priority fee to blob
Evan-Kim2028 Oct 31, 2024
e78b5b0
fix: change num blob from Uint to Uint64
Evan-Kim2028 Oct 31, 2024
28119ec
refactor: switch logging to zerolog
Evan-Kim2028 Oct 31, 2024
4fac7f9
docs: update .env example
Evan-Kim2028 Oct 31, 2024
de38b54
docs: update readme
Evan-Kim2028 Oct 31, 2024
af0ce7d
refactor: make defaultTimeout a .env variable
Evan-Kim2028 Oct 31, 2024
ceba29e
docs: update comments
Evan-Kim2028 Oct 31, 2024
4b626fa
chore: linting
Evan-Kim2028 Oct 31, 2024
5406b8f
feat: add valid pubkey check
Evan-Kim2028 Oct 31, 2024
be78cb3
feat: add unit testing for SendPreconfBid
Evan-Kim2028 Oct 31, 2024
bf7e4fe
fix: add nil transaction check
Evan-Kim2028 Oct 31, 2024
b0c361b
feat: add sendBid test
Evan-Kim2028 Oct 31, 2024
f2f524d
refactor: modularize sendbid function
Evan-Kim2028 Oct 31, 2024
f2db542
feat: add SendBid success and request error tests
Evan-Kim2028 Oct 31, 2024
c668ea6
docs: update with test command
Evan-Kim2028 Oct 31, 2024
c8d9df2
feat: add logging for preconf bid params
Evan-Kim2028 Oct 31, 2024
bae7859
chore; bump go version, reorganize go mod requirements
Evan-Kim2028 Nov 2, 2024
ee8c08e
refactor: SendBundle error responses
Evan-Kim2028 Nov 2, 2024
ac48677
fix: add context timeouts
Evan-Kim2028 Nov 2, 2024
36d6d05
refactor: replace zerolog with standard library logging
Evan-Kim2028 Nov 2, 2024
207ff6b
fix: remove uneceessary log config
Evan-Kim2028 Nov 2, 2024
e6730e9
refactor: integer type and positive integer logic
Evan-Kim2028 Nov 2, 2024
fd4ffab
fix: add error returns for functions
Evan-Kim2028 Nov 12, 2024
dba2a0f
fix: handle error return value from functions
Evan-Kim2028 Nov 12, 2024
eee8dc2
refactor: add service struct for better variable management
Evan-Kim2028 Nov 12, 2024
99a05c7
docs: add code doc comment
Evan-Kim2028 Nov 13, 2024
2656216
refactor: add service struct and function methods to struct
Evan-Kim2028 Nov 13, 2024
2e3c3a6
refactor: slog to use service struct logger
Evan-Kim2028 Nov 13, 2024
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
11 changes: 4 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21
FROM golang:1.22

Evan-Kim2028 marked this conversation as resolved.
Show resolved Hide resolved
WORKDIR /app

Expand All @@ -7,10 +7,7 @@ RUN go mod download

COPY . .

# Build the binary as preconf_bot from main.go at the top level
RUN go build -o preconf_bot .

RUN go build -o getPreconf ./cmd


ENTRYPOINT ["./getPreconf"]

CMD ["--ethtransfer"]
ENTRYPOINT ["./preconf_bot"]
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## About
This repository provides an example workflow that gets preconfirmation bids from mev-commit for eth transfers. Transactions are sent directly to the builder as transaction payloads.
This repository provides an example workflow that gets preconfirmation bids from mev-commit for eth transfers. Transactions are sent directly to the builder as transaction payloads. Currently a fixed priority fee is used alongside a preconf bid amount.


## Requirements
Expand All @@ -24,16 +24,19 @@ PRIVATE_KEY=private_key # L1 private key
USE_PAYLOAD=true
BIDDER_ADDRESS="127.0.0.1:13524"
OFFSET=1 # of blocks in the future to ask for the preconf bid
ETH_TRANSFER="false" # choose eth transfer or blob
BLOB="true"
NUM_BLOB=0 # blob count of 0 will just send eth transfers
BID_AMOUNT=0.0025 # preconf bid amount
BID_AMOUNT_STD_DEV_PERCENTAGE=200 # amount of variation in the preconf bid amount (in %)
DEFAULT_TIMEOUT=0
```
## How to run
Ensure that the mev-commit bidder node is running in the background. A quickstart can be found [here](https://docs.primev.xyz/get-started/quickstart), which will get the latest mev-commit version and start running it with an auto generated private key.

## Docker
Build the docker with `sudo docker-compose build` and then `sudo docker-compose up`. Best run with the [dockerized bidder node example](https://github.com/primev/bidder_node_docker)
Build the docker with `sudo docker-compose up --build`. Best run with the unofficial [dockerized bidder node example](https://github.com/primev/bidder_node_docker)

## Linting
Run linting with `golangci-lint run ./...` inside the repository folder
Run linting with `golangci-lint run ./...` inside the repository folder

## Testing
Run `go test -v ./...` in the main folder directory to run all the tests.
Loading
Loading