Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
326 commits
Select commit Hold shift + click to select a range
e852b62
remove more bss mentions
marcopeereboom Feb 25, 2025
0590732
Oops missed this prometheus panic
marcopeereboom Feb 25, 2025
27f2431
Basic framework for handling keystone request
marcopeereboom Feb 25, 2025
43289a7
Add some nice error handling
marcopeereboom Feb 26, 2025
ded229a
Slight cleanup
marcopeereboom Feb 26, 2025
54cb215
Do not love the go in new
marcopeereboom Feb 26, 2025
366e1ce
rig up gozer in bfg
marcopeereboom Feb 26, 2025
02d1c95
add dumpkeystones to btctool
marcopeereboom Feb 26, 2025
e6314d0
Add method not allowed
marcopeereboom Feb 26, 2025
38a0315
Grab keystone from tbc
marcopeereboom Feb 26, 2025
f38e59b
fixup rpc
marcopeereboom Feb 27, 2025
779e1a2
err
marcopeereboom Feb 27, 2025
a9371ec
Return custom type for abbreviated keystone and fix various nits in w…
marcopeereboom Feb 27, 2025
1da1251
linter fixes
AL-CT Mar 4, 2025
8c1c9fa
skip old test
AL-CT Mar 4, 2025
76ab3b0
add tx creation to wallet
AL-CT Mar 4, 2025
e33732f
add (untested) broadcasting to gozers
AL-CT Mar 4, 2025
dd3639a
fix blockstream broadcast
AL-CT Mar 6, 2025
002ed36
cleanup rebase mess
AL-CT Mar 13, 2025
10814a5
Only print errors at startup then print only one reconnect message
marcopeereboom Mar 18, 2025
5ac2a7d
Fix some error messages
marcopeereboom Mar 18, 2025
8c06e78
fix tx creation change amount
AL-CT Mar 18, 2025
b2161a0
fix test fee estimation
AL-CT Mar 18, 2025
f261e1a
add multi input tx create
AL-CT Mar 19, 2025
94587f7
skip Tx Execution test on OP_RETURN pkscripts
AL-CT Mar 19, 2025
5b9a065
dumb fee calculator
marcopeereboom Mar 20, 2025
0a727ec
Rename vbytes since witness is bakes in
marcopeereboom Mar 20, 2025
961f5d2
Start bringing back mempool
marcopeereboom Mar 20, 2025
f4dd96d
Create mempoolTx type to have a bit more info in mempool
marcopeereboom Mar 20, 2025
6d9cd90
it's ok to ignore error on getinv since the randomness of the network…
marcopeereboom Mar 20, 2025
ad5eaf8
Unexport several footgun functions
marcopeereboom Mar 21, 2025
3f8b853
meh mempool shit
marcopeereboom Mar 21, 2025
4576e48
add mempool fee estimation
AL-CT Mar 21, 2025
6771fee
Add ability to pull tx' from blockstream to test
marcopeereboom Mar 21, 2025
78a97e8
Ask for witness data
marcopeereboom Mar 21, 2025
55fe998
Calculate fees as we go, this is dumb but share with antonio
marcopeereboom Mar 21, 2025
4ab6ecd
dump mempool
marcopeereboom Mar 21, 2025
af29c49
don't panic, from antonio
marcopeereboom Mar 21, 2025
d48e9f2
Don't dump fees for now; it is time to add an rpc call
marcopeereboom Mar 22, 2025
9caeb18
cleanup mempool fees
AL-CT Mar 23, 2025
8186348
change mempool fee format and ramp up fees
AL-CT Mar 24, 2025
436a771
fix fee estimate rpc call from tbc
AL-CT Mar 24, 2025
5877f72
fix linter and replace feesByBlockHash
AL-CT Mar 25, 2025
9eb21ca
skip coinbase in feesbyblockhash
AL-CT Mar 25, 2025
0ef028b
add mempool info rpc call
AL-CT Mar 26, 2025
f5390b8
add popm geth connection
AL-CT Mar 28, 2025
c925527
remove spew
AL-CT Mar 28, 2025
00fb86d
add fake opgeth test
AL-CT Mar 28, 2025
132c03c
cleanup
AL-CT Mar 31, 2025
e64f8a7
add mock keystone subscription and test
AL-CT Apr 2, 2025
a06b0aa
linter fix
AL-CT Apr 2, 2025
d1c5b82
add btc height to gozer
AL-CT Apr 4, 2025
ba80202
popm: add test mining of keystones
AL-CT Apr 4, 2025
d44d6e6
popm: re-add proper keystone mining handling
AL-CT Apr 7, 2025
76e0601
popm: fix subscription lock
AL-CT Apr 7, 2025
a60f724
popm: re-add remaining tests
AL-CT Apr 7, 2025
a23e4fe
bfg: initial finality logic implementation
AL-CT Apr 15, 2025
aa7cb2a
bfg: add multiple queries to bfg test
AL-CT Apr 16, 2025
f3fb0a5
bfg: handle opgeth call and connection race
AL-CT Apr 17, 2025
26b76a8
bfg: add batch tbc call, op-geth sends full keystone
AL-CT Apr 22, 2025
397d6f7
bfg: test using free port
AL-CT Apr 22, 2025
823212e
linter: header fixes post-rebase
AL-CT Apr 23, 2025
5e9feb3
linter: remove yamllinter for removed files
AL-CT Apr 23, 2025
83f909d
Make code less wide and start cleaning up old pop miner logic
marcopeereboom Apr 24, 2025
b3e9112
bfg: fix old test using retry threshold
AL-CT Apr 24, 2025
7627fbe
Comments
marcopeereboom Apr 24, 2025
0ee24e3
Make l2keystones key of hash
marcopeereboom Apr 24, 2025
07fc3bf
unjoin adding and processing keystones
marcopeereboom Apr 24, 2025
256267c
unjoin adding and processing keystones
marcopeereboom Apr 24, 2025
16b147e
some comments and cleanup
marcopeereboom Apr 24, 2025
07355dc
fuck a channel off forever
marcopeereboom Apr 24, 2025
17b2c6c
get rid of more functions that do one thing
marcopeereboom Apr 24, 2025
635b5b9
Deal with XXX
marcopeereboom Apr 24, 2025
16cf7f9
Whitespace
marcopeereboom Apr 24, 2025
9c7630e
move some code to avoid dragons
marcopeereboom Apr 30, 2025
c82ef9d
bit of cleanup
marcopeereboom Apr 30, 2025
a3ac1af
Show antonio
marcopeereboom May 1, 2025
cf020ae
remove debug
marcopeereboom May 1, 2025
e9b056a
A bit more cleanup
marcopeereboom May 1, 2025
956e5a8
constify
marcopeereboom May 1, 2025
772fa97
A bit more cleanup
marcopeereboom May 1, 2025
d735034
Get rid of superfluous structure field
marcopeereboom May 5, 2025
a73bd1d
doco
marcopeereboom May 5, 2025
9ff1a2b
Rename New to Run to be consistent
marcopeereboom May 5, 2025
f98243c
Import opgeth branch
AL-CT May 6, 2025
bca8d0b
wallet: mock integration test gozer
AL-CT May 6, 2025
5a6d339
start adding new keystone handling
marcopeereboom May 6, 2025
d5965b1
remove more stuff
marcopeereboom May 6, 2025
992a70f
popm: refactor base test to reflect new changes
AL-CT May 6, 2025
1d25816
make code more obvious
marcopeereboom May 6, 2025
5221217
oops, antonio wanted this
marcopeereboom May 6, 2025
720da1c
share keystones between mock tbc and opgeth
AL-CT May 7, 2025
66493c6
Add test utility functions
AL-CT May 7, 2025
818358f
oops forgot one
AL-CT May 7, 2025
c01da5d
connect mocked keystones using EPHash
AL-CT May 7, 2025
c2e979a
be loud fo verification
marcopeereboom May 7, 2025
28befd5
fixup keystones generation mock
AL-CT May 7, 2025
fe6a685
Add first pass at keystones state cache
marcopeereboom May 7, 2025
a03b72f
make hashes more readable
AL-CT May 7, 2025
cf46ff3
globaly insert rehydrated cache map
marcopeereboom May 7, 2025
258055d
first pass at testing new cache and flseh out cache
marcopeereboom May 7, 2025
bff675b
Show antonio
marcopeereboom May 8, 2025
a81f7cf
fix the dumbest bug in history
AL-CT May 9, 2025
deea138
Add state code and tests
marcopeereboom May 13, 2025
14ed5c0
oops remove timer go routine for mining; it's now part of the main loop
marcopeereboom May 13, 2025
4ef4b94
XXX
marcopeereboom May 13, 2025
f1dcf2e
use var for delay retry
marcopeereboom May 13, 2025
5afca2a
fix test
AL-CT May 13, 2025
38c8690
Fix cache expiry
marcopeereboom May 13, 2025
942af4e
remove panic
marcopeereboom May 13, 2025
6442637
Be more quiet
marcopeereboom May 13, 2025
acdd886
linter
marcopeereboom May 13, 2025
cf7ae94
linter
marcopeereboom May 13, 2025
9d52301
Checked if we a re synced before starting to build mempool, also add …
marcopeereboom May 13, 2025
f3cdf6c
dedup copy paste
marcopeereboom May 14, 2025
a2ad6a2
more synced
marcopeereboom May 14, 2025
7615c29
Fixup mempool
marcopeereboom May 14, 2025
fbf6a66
add expiry and keystone cache checks to test
AL-CT May 14, 2025
35002db
XXX for antonio
marcopeereboom May 14, 2025
1760925
Add a filter to the wallet to exclude mempool utxos
marcopeereboom May 14, 2025
503f3ff
slight re-org of tests
AL-CT May 14, 2025
6be9d2a
test fixes
AL-CT May 14, 2025
39cb2fd
mempool reaping test
AL-CT May 14, 2025
2e1aa73
improve test readability and logging
AL-CT May 14, 2025
4092822
extra reaping test
AL-CT May 14, 2025
209f7a6
mempool remove test
AL-CT May 14, 2025
04172a0
add utxo filter test
AL-CT May 14, 2025
72c3e58
oops
AL-CT May 14, 2025
bb8ae82
Travel utxos+index into mempool
marcopeereboom May 15, 2025
32cbf7c
New filter mechanism for mempool
marcopeereboom May 16, 2025
4ec8bc8
fix opgeth dependency and tests for utxo changes
AL-CT May 19, 2025
63c58dc
prevent mempool filter if mempool not enabled
AL-CT May 19, 2025
e3f1578
add mempool utxo filter test
AL-CT May 19, 2025
b41ec52
Add mempool filter benchmark
AL-CT May 20, 2025
2227914
limit size of utxos in benchmark
AL-CT May 20, 2025
61f6c6a
Add utxo filtering integration with popm test
AL-CT May 20, 2025
65365d6
fix some XXX
marcopeereboom May 20, 2025
02a0747
Remove unused code
marcopeereboom May 20, 2025
fc48de8
add full mock integration test
AL-CT May 21, 2025
3078dad
Commit this framework so that i can be tested over rpc
marcopeereboom May 28, 2025
c69ca8c
add a debug command to hemictl
marcopeereboom May 28, 2025
fcd24ee
implement canonical forward keystone grabber
marcopeereboom May 28, 2025
d7e3df2
Set height and return proper errors
marcopeereboom May 28, 2025
d0f746d
keep track of duration
marcopeereboom May 28, 2025
aaa8dc7
use proper tx index
marcopeereboom May 28, 2025
088b190
govet shizzle
marcopeereboom May 28, 2025
2cfcc9e
testing progress
ClaytonNorthey92 May 28, 2025
bc72f21
fix build
ClaytonNorthey92 May 29, 2025
321e825
revert test changes and unprivate keystoneTxs method
AL-CT May 29, 2025
24240e8
Remove goto that read a bit difficult
marcopeereboom May 30, 2025
eae2bf9
make tbc block by abrev hash request batched
AL-CT May 30, 2025
796ab77
merge back marcos changes to mempool
AL-CT May 30, 2025
93f7d8d
fix test races and function names
AL-CT May 30, 2025
f6b4435
handle error in reconcileKeystones
AL-CT Jun 2, 2025
caf46a5
separate btc tip call in tbc BlockByl2AbrevHashes request
AL-CT Jun 2, 2025
e70f1cf
Shuffle order of operations to retain idempotence in the various rpc …
marcopeereboom Jun 2, 2025
b7b4be0
sigh typo
marcopeereboom Jun 2, 2025
7a38792
Clayton's bandaid fixes, notes, and re-adding localnet tests
ClaytonNorthey92 May 30, 2025
384a731
check context
ClaytonNorthey92 Jun 2, 2025
24da872
removed _e2e_fixme folder
ClaytonNorthey92 Jun 2, 2025
30f33b4
Only have one RPC listen address env variable
marcopeereboom Jun 2, 2025
376d039
add wait timeout
ClaytonNorthey92 Jun 2, 2025
38596e2
Reword some functions to make them slightly more readable
marcopeereboom Jun 2, 2025
c0ec563
latest op-geth
ClaytonNorthey92 Jun 2, 2025
2c7d102
change e2e popmd docker config to use opgeth websocket
AL-CT Jun 2, 2025
93efd93
update op-geth
ClaytonNorthey92 Jun 2, 2025
7abef60
Add poll to keystone subscription loop
marcopeereboom Jun 2, 2025
45ed9cb
NOPE
marcopeereboom Jun 2, 2025
9b0371a
Complain about missing Bytes() call in btcutil
marcopeereboom Jun 2, 2025
8cce296
debugging ci
ClaytonNorthey92 Jun 2, 2025
7241cae
mock test changes
AL-CT Jun 2, 2025
bd8aca5
remove unique utxo map from wallet
marcopeereboom Jun 2, 2025
0062135
add logging to mock
AL-CT Jun 2, 2025
62d076a
fix localnet test file
ClaytonNorthey92 Jun 2, 2025
e2ad2ce
add popm opgeth disconnect test
AL-CT Jun 2, 2025
3a2785f
address fix
ClaytonNorthey92 Jun 2, 2025
a19f398
tsk tsk, please use gofmt on save
marcopeereboom Jun 3, 2025
736a37f
Rewrite hydrateKeystone logic.
marcopeereboom Jun 3, 2025
7500913
rebase fixes
AL-CT Jun 3, 2025
f3686e5
fix monitor deps
AL-CT Jun 3, 2025
f981671
add inheritance loop logic to bfg
AL-CT Jun 9, 2025
e2ab7fb
removed _e2e_fixme folder, removed extra prune in workflow file
ClaytonNorthey92 Jun 12, 2025
a61c8ef
re-added e2e tests file
ClaytonNorthey92 Jun 12, 2025
e0c3c63
all: fix testutil package usage, remove local service/testutil
joshuasing Jun 12, 2025
12212f6
better way to getPort when not using httptest
ClaytonNorthey92 Jun 12, 2025
a96fb54
linter fixes maybe?
ClaytonNorthey92 Jun 12, 2025
e2bfd3a
let bfg start and walk chain
ClaytonNorthey92 Jun 12, 2025
b779c78
ignoring minor linting issues to get things working
ClaytonNorthey92 Jun 12, 2025
27c6f43
fix compilation error
ClaytonNorthey92 Jun 12, 2025
48e943a
fix some linting
ClaytonNorthey92 Jun 12, 2025
47ea0b6
use testutil opgeth + always used queried-for l2keystone in finality
ClaytonNorthey92 Jun 12, 2025
e0653bd
nil pointer check
ClaytonNorthey92 Jun 12, 2025
e35ce5c
Update api/bfgapi/bfgapi.go
marcopeereboom Jun 13, 2025
82276d8
Apply suggestions from code review
marcopeereboom Jun 13, 2025
6300634
uncomment testutil things
AL-CT Jun 13, 2025
90836dc
fixed CI pipeline with test+code changes (#547)
ClaytonNorthey92 Jun 16, 2025
e27b896
un-skipped test testing effective height
ClaytonNorthey92 Jun 18, 2025
c78ebe3
add some more test debug logging
AL-CT Jun 23, 2025
3d6d5ae
first attempt at short circuit
AL-CT Jun 17, 2025
e950f76
fix test
AL-CT Jun 26, 2025
8866ea7
test error fix after rebase
AL-CT Jun 26, 2025
7a64c09
prevent geth circular dependency
AL-CT Jun 26, 2025
fb6f63e
correct calculations for short circuit
AL-CT Jun 29, 2025
e6b8feb
re-add workflows
AL-CT Jun 29, 2025
6de2182
yamllinter fix
AL-CT Jun 29, 2025
adf4b3a
remove mock logging
AL-CT Jun 29, 2025
9df055e
limit descendant checks in finality query
AL-CT Jun 29, 2025
8ec08d0
make short circuit optional
AL-CT Jun 30, 2025
c9c7a7b
only replace keystone in finality response once
AL-CT Jul 1, 2025
40090fa
comment out short circuit
AL-CT Jul 1, 2025
fe252b0
make popm tests shorter
AL-CT Jul 1, 2025
e267aed
Merge branch 'main' into toni/bfg-rework
joshuasing Jul 2, 2025
93df699
Merge branch 'main' into toni/bfg-rework
joshuasing Jul 2, 2025
075c0aa
linter fix and add kss by height to mock tbc
AL-CT Jul 3, 2025
28e5577
Merge branch 'main' into toni/bfg-rework
joshuasing Jul 4, 2025
ce9f48a
fix method signatures in popm post-merge
AL-CT Jul 7, 2025
c760e77
e2e: revert optimis-stack-legacy.Dockerfile changes
joshuasing Jul 7, 2025
c764a71
ci: add missing newline to localnet-test.yml
joshuasing Jul 7, 2025
ea598bd
golangci: revert adding go-ethereum to replace-allow-list
joshuasing Jul 7, 2025
5c9044f
readme: remove bssd prerequisites section
joshuasing Jul 7, 2025
7272dfa
service/bfg: rename HttpError -> HTTPError
joshuasing Jul 7, 2025
6820f2a
service/bfg: use rand.Read in random
joshuasing Jul 7, 2025
abf361b
service/bfg: fix HTTP errors
joshuasing Jul 7, 2025
885892a
service/bfg: use HTTP status 500 for internal errors
joshuasing Jul 7, 2025
c4808e1
service/bfg: tidy up InternalErrorf
joshuasing Jul 7, 2025
ab1a31f
service/bfg: tidy up logic in handleKeystoneFinality for loop
joshuasing Jul 7, 2025
1b07bb8
service/bfg: more logic tidy up
AL-CT Jul 7, 2025
0596adc
e2e/monitor: fix use of context.Background in tests
joshuasing Jul 7, 2025
eda8741
e2e/monitor: run golangci-lint
joshuasing Jul 7, 2025
386a80c
cmd/bfgd: add opgeth url env variable and initial documentation
AL-CT Jul 8, 2025
906aac8
service/bfg: make TBC default gozer type
AL-CT Jul 8, 2025
767c4c4
reverted back to correctly using heminetwork directory in localnet
ClaytonNorthey92 Jul 8, 2025
2c4bc2b
use correct version of optimism+get rid of bss config
ClaytonNorthey92 Jul 8, 2025
53bb182
update op-geth commit
ClaytonNorthey92 Jul 8, 2025
6e6bb0e
increase popm test deadline
AL-CT Jul 8, 2025
70c040f
updated localnet commits
ClaytonNorthey92 Jul 8, 2025
8e65ee4
service/popm: fix race in popm tests
AL-CT Jul 9, 2025
cc709a7
cmd/bfgd: change btc source env var description
AL-CT Jul 9, 2025
a81a64a
use uint64 to handle higher values
ClaytonNorthey92 Jul 9, 2025
1eb9f64
cmd/hemictl: add minimal hemictl documentation
AL-CT Jul 9, 2025
914cac1
update test timeouts and remove unused function testing
AL-CT Jul 9, 2025
67d6eda
service/bfg: linter fix
AL-CT Jul 9, 2025
68207ff
update op-stack commits to latest in hemi branches
ClaytonNorthey92 Jul 9, 2025
3168781
goreleaser: remove bssd
joshuasing Jul 9, 2025
bdbb620
docker: remove bssd
joshuasing Jul 9, 2025
9403e95
github/labeler: remove bss label
joshuasing Jul 9, 2025
249ba6e
readme: remove bssd, reformat
joshuasing Jul 9, 2025
f6e4c5d
re-added localnode (#575)
ClaytonNorthey92 Jul 15, 2025
4bf16a6
gozer: fix tbcGozer fragile test
AL-CT Jul 15, 2025
39475cf
Merge branch 'main' into toni/bfg-rework
joshuasing Jul 16, 2025
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
Travel utxos+index into mempool
  • Loading branch information
marcopeereboom authored and AL-CT committed Jun 29, 2025
commit bb8ae82273ed1a99c3fb1a2ed2aee44076de921a
15 changes: 15 additions & 0 deletions service/tbc/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package tbc

import (
"context"
"crypto/sha256"
"encoding/binary"
"errors"
"sync"
"time"
Expand All @@ -28,13 +30,26 @@ import (

var MaxTxVersion = int32(2) // XXX this should not be a global

type mempoolUtxo struct {
scriptHash [sha256.Size]byte // sha256(pkscript)
index uint32 // index within transaction
}

func (mu *mempoolUtxo) ID() [sha256.Size]byte {
var id [4 + sha256.Size]byte
binary.BigEndian.PutUint32(id[0:4], mu.index)
copy(id[4:], mu.scriptHash[:])
return sha256.Sum256(id[:])
}

type mempoolTx struct {
id chainhash.Hash // TxID
expires time.Time // When mempool tx expires
weight int64 // transaction weight
size int64 // transaction virtual size
inValue int64 // total txin value
outValue int64 // total txout value
utxos []mempoolUtxo // utxos in transaction
}

type mempool struct {
Expand Down
17 changes: 12 additions & 5 deletions service/tbc/tbc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ package tbc
import (
"bytes"
"context"
"crypto/sha256"
"errors"
"fmt"
"math/big"
Expand Down Expand Up @@ -2213,27 +2214,32 @@ func (s *Server) BlockHeaderByKeystoneIndex(ctx context.Context) (*tbcd.BlockHea
return s.db.BlockHeaderByKeystoneIndex(ctx)
}

func (s *Server) valuesFromTransaction(ctx context.Context, tx *wire.MsgTx) (int64, int64, error) {
func (s *Server) parseTx(ctx context.Context, tx *wire.MsgTx) (int64, int64, []mempoolUtxo, error) {
var iv, ov int64
for _, txIn := range tx.TxIn {
po := txIn.PreviousOutPoint
wtxo, err := s.txOutFromOutPoint(ctx, tbcd.NewOutpoint(po.Hash, po.Index))
if err != nil {
return 0, 0, err
return 0, 0, nil, err
}
iv += wtxo.Value
}

for _, txOut := range tx.TxOut {
utxos := make([]mempoolUtxo, 0, len(tx.TxOut))
for i, txOut := range tx.TxOut {
ov += txOut.Value
utxos = append(utxos, mempoolUtxo{
scriptHash: sha256.Sum256(txOut.PkScript),
index: uint32(i),
})
}

return iv, ov, nil
return iv, ov, utxos, nil
}

func (s *Server) mempoolTxNew(ctx context.Context, utx *btcutil.Tx) (*mempoolTx, error) {
// Create mempool tx
inValue, outValue, err := s.valuesFromTransaction(ctx, utx.MsgTx())
inValue, outValue, utxos, err := s.parseTx(ctx, utx.MsgTx())
if err != nil {
return nil, fmt.Errorf("cannot obtain values from tx: %w", err)
}
Expand All @@ -2244,6 +2250,7 @@ func (s *Server) mempoolTxNew(ctx context.Context, utx *btcutil.Tx) (*mempoolTx,
outValue: outValue,
inValue: inValue,
expires: time.Now().Add(defaultMempoolAge),
utxos: utxos,
}, nil
}

Expand Down