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

Dev #28

Merged
merged 139 commits into from
Mar 19, 2024
Merged

Dev #28

Changes from 1 commit
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
9dde3e2
Update readme
Dzejkop Nov 22, 2023
a64e224
Only saved fee estimates on mined blocks
Dzejkop Nov 22, 2023
366a5f6
Fixes & improvements
Dzejkop Nov 22, 2023
bd5ac68
Update stuff
Dzejkop Nov 23, 2023
1905547
Prune blocks
Dzejkop Nov 23, 2023
b1fa082
Networks in DB - Handling reorgs (#2)
Dzejkop Nov 27, 2023
73a9d9c
Update TODO
Dzejkop Nov 28, 2023
f803847
Update TODO
Dzejkop Nov 28, 2023
decd1dd
Allow updating relayers - max inflight txs in relayer
Dzejkop Nov 28, 2023
f4790a9
Start indexing chains at startup
Dzejkop Nov 28, 2023
a56faad
Estimate block fees in a separate task
Dzejkop Nov 28, 2023
426a50c
Add support for cross-chain gas price limits
Dzejkop Nov 28, 2023
8a800ec
Cleanup
Dzejkop Nov 28, 2023
5218017
Add transaction priority
Dzejkop Nov 29, 2023
7279840
Refactor routes
Dzejkop Nov 29, 2023
d76b44a
Fix manual test
Dzejkop Nov 29, 2023
bcdbae3
RPC Access
Dzejkop Nov 29, 2023
4b8e4f1
Minor fixes
Dzejkop Nov 29, 2023
00356f7
Parallelize broadcast per relayer + error handling
Dzejkop Nov 29, 2023
ffb3b67
Expose unsent status
Dzejkop Nov 29, 2023
e87552c
Update TODO
Dzejkop Nov 29, 2023
a49cdcd
Add item to TODO
Dzejkop Nov 29, 2023
b4004a8
Consistent formatting of SQL
Dzejkop Nov 29, 2023
785dbe6
Minor cleanup
Dzejkop Nov 30, 2023
4201210
WIP
Dzejkop Nov 30, 2023
73e1426
Add TODO item
Dzejkop Nov 30, 2023
2d12445
Add TODO item
Dzejkop Nov 30, 2023
53c43dc
misc
Dzejkop Nov 30, 2023
1027cf2
Section TODO
Dzejkop Nov 30, 2023
7eecadb
Dzejkop/api-keys (#3)
Dzejkop Dec 1, 2023
a012706
Dzejkop/dockerize (#4)
Dzejkop Dec 1, 2023
cb21f8c
Update API routes
Dzejkop Dec 1, 2023
0614712
Log more
Dzejkop Dec 1, 2023
7444ddd
Save all txs
Dzejkop Dec 1, 2023
59e4292
Fetch block hashes
Dzejkop Dec 1, 2023
218a8ec
Update AWS libs
Dzejkop Dec 1, 2023
bbaabf2
Minor fixes
Dzejkop Dec 4, 2023
4f77401
Build and push image
Dzejkop Dec 4, 2023
16de8e3
Allow parts for db settings
Dzejkop Dec 4, 2023
c148325
Prefetch deps + use sparse registries + log connection string
Dzejkop Dec 5, 2023
413f38f
Add GH actions
Dzejkop Dec 5, 2023
a8b66db
Enable auth for admin routes
Dzejkop Dec 5, 2023
f657f5c
Speed up tests
Dzejkop Dec 5, 2023
4a0d9e1
Install foundry for tests
Dzejkop Dec 5, 2023
7766fa9
Add health endpoint
Dzejkop Dec 5, 2023
3e55932
Fix anvil issue
Dzejkop Dec 5, 2023
1852855
Cache dependencies in docker builds
Dzejkop Dec 5, 2023
aec0893
Remove secrets leak
Dzejkop Dec 5, 2023
5c09c1f
Use cache
Dzejkop Dec 5, 2023
157c12b
Use buildx
Dzejkop Dec 5, 2023
d32f749
Add clippy
Dzejkop Dec 6, 2023
5642de9
Add getTxs endpoint
Dzejkop Dec 6, 2023
b720181
WIP: Integrate telemetry-batteries
Dzejkop Dec 6, 2023
0ab9ab5
Change service tag
Dzejkop Dec 6, 2023
384a46a
Update telemetry-batteries
Dzejkop Dec 6, 2023
6f39962
fmt
Dzejkop Dec 6, 2023
c231530
Don't destroy the db
Dzejkop Dec 6, 2023
bc37a74
Remove redundant relayer id
Dzejkop Dec 6, 2023
6afcde0
Try unnested fields
Dzejkop Dec 7, 2023
d07d83b
Use new telemetry-batteries
Dzejkop Dec 7, 2023
792b858
Fix
Dzejkop Dec 7, 2023
5a576a4
Emit metrics periodically
Dzejkop Dec 7, 2023
07439b1
Fix get_txs bug
Dzejkop Dec 8, 2023
2e79308
misc
Dzejkop Dec 11, 2023
a82dcd9
Big query & mining metrics
Dzejkop Dec 11, 2023
dad7ff5
More logging & metrics
Dzejkop Dec 11, 2023
956ea8d
Fix escalation fee logic
Dzejkop Dec 11, 2023
34848e3
fmt
Dzejkop Dec 11, 2023
7ce62ba
Metrics for gas
Dzejkop Dec 11, 2023
997ecff
Better logging
Dzejkop Dec 11, 2023
1b9b407
Add tx created log
Dzejkop Dec 11, 2023
b0d0a0b
Add relayers endpoint
Dzejkop Dec 11, 2023
13f18e2
Fix
Dzejkop Dec 11, 2023
b4d2f04
Fix race condition
Dzejkop Dec 11, 2023
03176ec
Add relayer reset endpoint
Dzejkop Dec 11, 2023
6de73df
Fix
Dzejkop Dec 11, 2023
e0e4350
Fix
Dzejkop Dec 11, 2023
3812432
Fix
Dzejkop Dec 11, 2023
27d0325
Remove hard coded gas limit
Dzejkop Dec 11, 2023
fc36d12
Remove surge logic
Dzejkop Dec 11, 2023
4dd4b51
added .gitignore, increased allowable db setup time
0xKitsune Dec 12, 2023
2f2766e
fix: typo
0xKitsune Dec 12, 2023
9139faf
Make transfers in tests more parallel
Dzejkop Dec 12, 2023
3d369f3
updated logic to back fill blocks that have been missed
0xKitsune Dec 13, 2023
d8eec49
adding comments
0xKitsune Dec 13, 2023
80656c1
updated tests
0xKitsune Dec 13, 2023
b73098c
updated get_latest_block_number
0xKitsune Dec 13, 2023
06116d8
updated comments
0xKitsune Dec 13, 2023
299a856
cargo clippy
0xKitsune Dec 13, 2023
41fd8af
Preconfigured start - for dockerization (#6)
Dzejkop Dec 13, 2023
b612dc8
Merge pull request #5 from worldcoin/0xkitsune/fetch-missing-blocks
0xKitsune Dec 13, 2023
74301e6
Allow filtering txs by status (#7)
Dzejkop Dec 13, 2023
524199b
insert into tx_hashes and sent_transactions seperatley, added raw_sig…
0xKitsune Dec 13, 2023
38da969
Example .env
Dzejkop Dec 13, 2023
dc962f0
Fix
Dzejkop Dec 13, 2023
479e335
added logic to recover simulated txs
0xKitsune Dec 13, 2023
9343e42
cargo clippy, cargo sort
0xKitsune Dec 13, 2023
89a93b1
formatting
0xKitsune Dec 13, 2023
280abf4
removed recover simulated tx
0xKitsune Dec 13, 2023
7d9ebd2
updated insert_into_tx_hashes to do nothing on conflict
0xKitsune Dec 13, 2023
8488a9e
on conflict, update tx_hashes
0xKitsune Dec 13, 2023
9412b08
updated tx_hashes to add constraint on tx_id, do nothing on conflict …
0xKitsune Dec 14, 2023
00ff1c6
added insert_tx_broadcast
0xKitsune Dec 14, 2023
eb6b1fc
write to database after successful simulation
0xKitsune Dec 14, 2023
36a47c7
Merge branch 'dev' into 0xkitsune/fetch-missing-txs
0xKitsune Dec 14, 2023
d74d027
removed unneeded function
0xKitsune Dec 14, 2023
61038c6
Merge branch '0xkitsune/fetch-missing-txs' of https://github.com/worl…
0xKitsune Dec 14, 2023
2f73406
updated cargo toml to match dev branch
0xKitsune Dec 14, 2023
9cb1e3e
removed comments and todo
0xKitsune Dec 14, 2023
59ea3c4
Merge pull request #9 from worldcoin/0xkitsune/fetch-missing-txs
0xKitsune Dec 14, 2023
c5ee7fb
Build for multiple platforms
Dzejkop Dec 18, 2023
4fcf48b
Don't build for arm/v7
Dzejkop Dec 18, 2023
986f865
Tags
Dzejkop Dec 18, 2023
877922c
TEMP: Don't build for arm64
Dzejkop Dec 18, 2023
e2afc2d
Bring back arm64
Dzejkop Dec 18, 2023
3e5b122
Update action versions
Dzejkop Dec 19, 2023
81cb3b0
Add annotations
Dzejkop Dec 19, 2023
82cc394
No more matrix
Dzejkop Dec 19, 2023
b1751a0
Remove matrix reference
Dzejkop Dec 19, 2023
0feee6f
Reorg & Escalation testing (#11)
Dzejkop Dec 27, 2023
17560e8
Further dockerization support (#12)
Dzejkop Dec 27, 2023
8a5f5ee
Fix owned deserialization (#13)
Dzejkop Dec 28, 2023
0829d6b
Allow disabling relayers (#14)
Dzejkop Jan 9, 2024
f324c53
Improve-logging (#15)
Dzejkop Jan 10, 2024
9b358f3
instrument db txs (#19)
0xForerunner Jan 22, 2024
18da023
Api Key Rework - PRO-467 (#17)
0xForerunner Jan 22, 2024
8c5b2a4
redact api key (#20)
0xForerunner Jan 23, 2024
97a46e7
update tel batteries (#21)
0xForerunner Jan 25, 2024
77add8f
Remove transaction simulation (#22)
Dzejkop Feb 12, 2024
70031b1
More instrumentation
Dzejkop Feb 14, 2024
e8dd8c6
Docker compose setup
Dzejkop Feb 14, 2024
a357596
Misc
Dzejkop Feb 14, 2024
3a2aad5
Additional logs
Dzejkop Feb 14, 2024
29c90ed
More logs
Dzejkop Feb 14, 2024
1de9292
Abort on panic + better instrumentation
Dzejkop Feb 15, 2024
9be5bfb
Fix escalation fees calculation logic
Dzejkop Feb 15, 2024
683c35c
Bring back metrics (#24)
Dzejkop Feb 29, 2024
bc538aa
Fix telemetry issues (#27)
Dzejkop Mar 19, 2024
3d78aa1
Add max_queued_txs column + minor client improvement (#25)
Dzejkop Mar 19, 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
Prev Previous commit
Next Next commit
Update API routes
Dzejkop committed Dec 1, 2023
commit cb21f8ccc0c2dbfef2675bdf04b3f8b3a8efe3cb
12 changes: 6 additions & 6 deletions manual_test.nu
Original file line number Diff line number Diff line change
@@ -17,25 +17,25 @@ echo "Start"
let txSitter = "http://127.0.0.1:3000"
let anvilSocket = "127.0.0.1:8545"

http post -t application/json $"($txSitter)/1/network/31337" {
http post -t application/json $"($txSitter)/1/admin/network/31337" {
name: "Anvil network",
httpRpc: $"http://($anvilSocket)",
wsRpc: $"ws://($anvilSocket)"
}

echo "Creating relayer"
let relayer = http post -t application/json $"($txSitter)/1/relayer" { "name": "My Relayer", "chainId": 31337 }
let relayer = http post -t application/json $"($txSitter)/1/admin/relayer" { "name": "My Relayer", "chainId": 31337 }

echo "Create api key"
let apiKey = http post $"($txSitter)/1/relayer/($relayer.relayerId)/key" ""
let apiKey = http post $"($txSitter)/1/admin/relayer/($relayer.relayerId)/key" ""

$env.ETH_RPC_URL = $"($txSitter)/1/($apiKey.apiKey)/rpc"
$env.ETH_RPC_URL = $"($txSitter)/1/api/($apiKey.apiKey)/rpc"

echo "Funding relayer"
cast send --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --value 100ether $relayer.address ''

echo "Sending transaction"
let tx = http post -t application/json $"($txSitter)/1/($apiKey.apiKey)/tx" {
let tx = http post -t application/json $"($txSitter)/1/api/($apiKey.apiKey)/tx" {
"relayerId": $relayer.relayerId,
"to": $relayer.address,
"value": "10",
@@ -45,7 +45,7 @@ let tx = http post -t application/json $"($txSitter)/1/($apiKey.apiKey)/tx" {

echo "Wait until tx is mined"
for i in 0..100 {
let txResponse = http get $"($txSitter)/1/($apiKey.apiKey)/tx/($tx.txId)"
let txResponse = http get $"($txSitter)/1/api/($apiKey.apiKey)/tx/($tx.txId)"

if ($txResponse | get -i status) == "mined" {
echo $txResponse
8 changes: 4 additions & 4 deletions src/client.rs
Original file line number Diff line number Diff line change
@@ -56,15 +56,15 @@ impl TxSitterClient {
&self,
req: &CreateRelayerRequest,
) -> eyre::Result<CreateRelayerResponse> {
self.json_post(&format!("{}/1/relayer", self.url), req)
self.json_post(&format!("{}/1/admin/relayer", self.url), req)
.await
}

pub async fn create_relayer_api_key(
&self,
relayer_id: &str,
) -> eyre::Result<CreateApiKeyResponse> {
self.post(&format!("{}/1/relayer/{relayer_id}/key", self.url,))
self.post(&format!("{}/1/admin/relayer/{relayer_id}/key", self.url,))
.await
}

@@ -73,7 +73,7 @@ impl TxSitterClient {
api_key: &ApiKey,
req: &SendTxRequest,
) -> eyre::Result<SendTxResponse> {
self.json_post(&format!("{}/1/{api_key}/tx", self.url), req)
self.json_post(&format!("{}/1/api/{api_key}/tx", self.url), req)
.await
}

@@ -84,7 +84,7 @@ impl TxSitterClient {
) -> eyre::Result<()> {
let response = self
.client
.post(&format!("{}/1/network/{}", self.url, chain_id))
.post(&format!("{}/1/admin/network/{}", self.url, chain_id))
.json(&req)
.send()
.await?;
25 changes: 11 additions & 14 deletions src/server.rs
Original file line number Diff line number Diff line change
@@ -67,28 +67,25 @@ pub async fn serve(app: Arc<App>) -> eyre::Result<()> {
pub async fn spawn_server(
app: Arc<App>,
) -> eyre::Result<axum::Server<AddrIncoming, IntoMakeService<Router>>> {
let permissioned_routes = Router::new()
let api_routes = Router::new()
.route("/:api_token/tx", post(send_tx))
.route("/:api_token/tx/:tx_id", get(get_tx))
.route("/:api_token/rpc", post(relayer_rpc))
.with_state(app.clone());

let relayer_routes = Router::new()
.route("/", post(create_relayer))
.route("/:relayer_id", post(update_relayer).get(get_relayer))
.route("/:relayer_id/key", post(create_relayer_api_key))
.with_state(app.clone());

let network_routes = Router::new()
// .route("/", get(routes::network::get_networks))
// .route("/:chain_id", get(routes::network::get_network))
.route("/:chain_id", post(routes::network::create_network))
let admin_routes = Router::new()
.route("/relayer", post(create_relayer))
.route(
"/relayer/:relayer_id",
post(update_relayer).get(get_relayer),
)
.route("/relayer/:relayer_id/key", post(create_relayer_api_key))
.route("/network/:chain_id", post(routes::network::create_network))
.with_state(app.clone());

let v1_routes = Router::new()
.nest("/", permissioned_routes)
.nest("/relayer", relayer_routes)
.nest("/network", network_routes);
.nest("/api", api_routes)
.nest("/admin", admin_routes);

let router = Router::new()
.nest("/1", v1_routes)
3 changes: 2 additions & 1 deletion tests/rpc_access.rs
Original file line number Diff line number Diff line change
@@ -28,7 +28,8 @@ async fn rpc_access() -> eyre::Result<()> {
let CreateApiKeyResponse { api_key } =
client.create_relayer_api_key(&relayer_id).await?;

let rpc_url = format!("http://{}/1/{api_key}/rpc", service.local_addr());
let rpc_url =
format!("http://{}/1/api/{api_key}/rpc", service.local_addr());

let provider = Provider::new(Http::new(rpc_url.parse::<Url>()?));